From b53ae0d42af7cc4c2a682bec7229669dba114ca6 Mon Sep 17 00:00:00 2001
From: Michael Vogel <icarus@dabo.de>
Date: Tue, 17 Nov 2015 08:39:09 +0100
Subject: [PATCH 1/3] Bugfix: The own avatar was (sometimes?) changed back when
 it was changed.

---
 include/items.php |  8 ++++----
 mod/dfrn_poll.php | 10 ++++------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/include/items.php b/include/items.php
index 65c49bf263..c4310c24e2 100644
--- a/include/items.php
+++ b/include/items.php
@@ -2384,7 +2384,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
 		$photos = import_profile_photo($photo_url,$contact['uid'],$contact['id']);
 
 		q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
-			WHERE `uid` = %d AND `id` = %d",
+			WHERE `uid` = %d AND `id` = %d AND NOT `self`",
 			dbesc(datetime_convert()),
 			dbesc($photos[0]),
 			dbesc($photos[1]),
@@ -2403,7 +2403,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
 			intval($contact['id'])
 		);
 
-		$x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d AND `name` != '%s'",
+		$x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d AND `name` != '%s' AND NOT `self`",
 			dbesc(notags(trim($new_name))),
 			dbesc(datetime_convert()),
 			intval($contact['uid']),
@@ -3083,7 +3083,7 @@ function local_delivery($importer,$data) {
 		$photos = import_profile_photo($photo_url,$importer['importer_uid'],$importer['id']);
 
 		q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
-			WHERE `uid` = %d AND `id` = %d",
+			WHERE `uid` = %d AND `id` = %d AND NOT `self`",
 			dbesc(datetime_convert()),
 			dbesc($photos[0]),
 			dbesc($photos[1]),
@@ -3102,7 +3102,7 @@ function local_delivery($importer,$data) {
 			intval($importer['id'])
 		);
 
-		$x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d AND `name` != '%s'",
+		$x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d AND `name` != '%s' AND NOT `self`",
 			dbesc(notags(trim($new_name))),
 			dbesc(datetime_convert()),
 			intval($importer['importer_uid']),
diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php
index b5f60a0397..d6a07186ac 100644
--- a/mod/dfrn_poll.php
+++ b/mod/dfrn_poll.php
@@ -476,8 +476,8 @@ function dfrn_poll_content(&$a) {
 			// URL reply
 
 			if($dfrn_version < 2.2) {
-				$s = fetch_url($r[0]['poll'] 
-					. '?dfrn_id=' . $encrypted_id 
+				$s = fetch_url($r[0]['poll']
+					. '?dfrn_id=' . $encrypted_id
 					. '&type=profile-check'
 					. '&dfrn_version=' . DFRN_PROTOCOL_VERSION
 					. '&challenge=' . $challenge
@@ -493,7 +493,7 @@ function dfrn_poll_content(&$a) {
 					'sec' => $sec
 				));
 			}
-			
+
 			$profile = ((count($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
 
 			switch($destination_url) {
@@ -506,7 +506,7 @@ function dfrn_poll_content(&$a) {
 				case 'status':
 				case '':
 					$dest = $a->get_baseurl() . '/profile/' . $profile;
-					break;		
+					break;
 				default:
 					$dest = $destination_url . '?f=&redir=1';
 					break;
@@ -564,5 +564,3 @@ function dfrn_poll_content(&$a) {
 		}
 	}
 }
-
-

From a07a0fd1d7a47b1945a31635c4a3fad73d5a1929 Mon Sep 17 00:00:00 2001
From: rabuzarus <>
Date: Tue, 17 Nov 2015 20:57:12 +0100
Subject: [PATCH 2/3] forumlist: fix id conflict and js show-more

---
 include/forums.php                  |  2 +-
 view/templates/widget_forumlist.tpl | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/forums.php b/include/forums.php
index e604a31567..00b7bd6ce1 100644
--- a/include/forums.php
+++ b/include/forums.php
@@ -74,7 +74,7 @@ function widget_forumlist($a) {
 
 	$contacts = get_forumlist($a->user['uid'],true,$lastitem, true);
 	$total = count($contacts);
-	$visible_forums = 10;
+	$visible_forums = 1;
 
 	if(count($contacts)) {
 
diff --git a/view/templates/widget_forumlist.tpl b/view/templates/widget_forumlist.tpl
index 4d155fd0ad..cfc3f8cbcc 100644
--- a/view/templates/widget_forumlist.tpl
+++ b/view/templates/widget_forumlist.tpl
@@ -1,13 +1,13 @@
 <script>
 
 function showHideForumlist() {
-	if( $('#forum-widget-entry-extended').is(':visible')) {
-		$('#forum-widget-entry-extended').hide();
+	if( $("div[id^='forum-widget-entry-extended-']").is(':visible')) {
+		$("div[id^='forum-widget-entry-extended-']").hide();
 		$('#forum-widget-collapse').html(window.showMore);
 
 	}
 	else {
-		$('#forum-widget-entry-extended').show();
+		$("div[id^='forum-widget-entry-extended-']").show();
 		$('#forum-widget-collapse').html(window.showFewer);
 	}
 	}
@@ -18,7 +18,7 @@ function showHideForumlist() {
 
 	{{foreach $forums as $forum}}
 		{{if $forum.id <= $visible_forums}}
-		<div class="forum-widget-entry" id="forum-widget-entry" role="menuitem">
+		<div class="forum-widget-entry" id="forum-widget-entry-{{$forum.id}}" role="menuitem">
 			<a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
 				<img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
 			</a>
@@ -27,7 +27,7 @@ function showHideForumlist() {
 		{{/if}}
 	
 		{{if $forum.id > $visible_forums}}
-		<div class="forum-widget-entry" id="forum-widget-entry-extended" role="menuitem" style="display: none;">
+		<div class="forum-widget-entry" id="forum-widget-entry-extended-{{$forum.id}}" role="menuitem" style="display: none;">
 			<a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
 				<img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
 			</a>

From 9123cb0fa3f0906b12c055c49cfeb4273ab975d2 Mon Sep 17 00:00:00 2001
From: rabuzarus <>
Date: Tue, 17 Nov 2015 20:59:12 +0100
Subject: [PATCH 3/3] forumlist: oh forgot to raise $visible_forums after
 testing

---
 include/forums.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/forums.php b/include/forums.php
index 00b7bd6ce1..e604a31567 100644
--- a/include/forums.php
+++ b/include/forums.php
@@ -74,7 +74,7 @@ function widget_forumlist($a) {
 
 	$contacts = get_forumlist($a->user['uid'],true,$lastitem, true);
 	$total = count($contacts);
-	$visible_forums = 1;
+	$visible_forums = 10;
 
 	if(count($contacts)) {