From 2e0ebcd1c84e53b10a716984fb61cc5d23daa277 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 14 Dec 2015 23:02:49 +0100 Subject: [PATCH 1/3] The "about" in feed has to be rendered as HTML --- include/ostatus.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/ostatus.php b/include/ostatus.php index d2d25b76ff..bcaef4f439 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -2,6 +2,7 @@ require_once("include/Contact.php"); require_once("include/threads.php"); require_once("include/html2bbcode.php"); +require_once("include/bbcode.php"); require_once("include/items.php"); require_once("mod/share.php"); require_once("include/enotify.php"); @@ -141,7 +142,7 @@ function ostatus_fetchauthor($xpath, $context, $importer, &$contact, $onlyfetch) $value = $xpath->evaluate('atom:author/poco:note/text()', $context)->item(0)->nodeValue; if ($value != "") - $contact["about"] = $value; + $contact["about"] = html2bbcode($value); $value = $xpath->evaluate('atom:author/poco:address/poco:formatted/text()', $context)->item(0)->nodeValue; if ($value != "") @@ -1288,7 +1289,7 @@ function ostatus_add_author($doc, $owner, $profile) { xml_add_element($doc, $author, "poco:preferredUsername", $owner["nick"]); xml_add_element($doc, $author, "poco:displayName", $profile["name"]); - xml_add_element($doc, $author, "poco:note", $profile["about"]); + xml_add_element($doc, $author, "poco:note", bbcode($profile["about"])); if (trim($owner["location"]) != "") { $element = $doc->createElement("poco:address"); From d077dbbcdede01887f58fd2754249594d722b089 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 14 Dec 2015 23:53:35 +0100 Subject: [PATCH 2/3] Bugfix: The bbcode conversion of the profile was inconsistent --- include/Contact.php | 12 ------------ include/identity.php | 15 ++++++++++++--- mod/display.php | 17 +++++++---------- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/include/Contact.php b/include/Contact.php index 6673e6911d..340b3ec6fa 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -192,9 +192,6 @@ function unmark_for_death($contact) { }} function get_contact_details_by_url($url, $uid = -1) { - require_once("mod/proxy.php"); - require_once("include/bbcode.php"); - if ($uid == -1) $uid = local_user(); @@ -268,15 +265,6 @@ function get_contact_details_by_url($url, $uid = -1) { } else $profile["cid"] = 0; - if (isset($profile["photo"])) - $profile["photo"] = proxy_url($profile["photo"], false, PROXY_SIZE_SMALL); - - if (isset($profile["location"])) - $profile["location"] = bbcode($profile["location"]); - - if (isset($profile["about"])) - $profile["about"] = bbcode($profile["about"]); - if (($profile["cid"] == 0) AND ($profile["network"] == NETWORK_DIASPORA)) { $profile["location"] = ""; $profile["about"] = ""; diff --git a/include/identity.php b/include/identity.php index b5791ba1e9..d87d891a5c 100644 --- a/include/identity.php +++ b/include/identity.php @@ -4,7 +4,8 @@ */ require_once('include/forums.php'); - +require_once('include/bbcode.php'); +require_once("mod/proxy.php"); /** * @@ -108,7 +109,6 @@ if(! function_exists('profile_load')) { else $a->page['aside'] .= profile_sidebar($a->profile, $block); - /*if(! $block) $a->page['aside'] .= contact_block();*/ @@ -199,7 +199,7 @@ if(! function_exists('profile_sidebar')) { if (($profile['network'] != "") AND ($profile['network'] != NETWORK_DFRN)) { $profile['network_name'] = format_network_name($profile['network'],$profile['url']); - } else + } else $profile['network_name'] = ""; call_hooks('profile_sidebar_enter', $profile); @@ -360,6 +360,15 @@ if(! function_exists('profile_sidebar')) { $p[$k] = $v; } + if (isset($p["about"])) + $p["about"] = bbcode($p["about"]); + + if (isset($p["location"])) + $p["location"] = bbcode($p["location"]); + + if (isset($p["photo"])) + $p["photo"] = proxy_url($p["photo"], false, PROXY_SIZE_SMALL); + if($a->theme['template_engine'] === 'internal') $location = template_escape($location); diff --git a/mod/display.php b/mod/display.php index 6b345e6302..6d1f417e71 100644 --- a/mod/display.php +++ b/mod/display.php @@ -89,15 +89,13 @@ function display_init(&$a) { } function display_fetchauthor($a, $item) { - require_once("mod/proxy.php"); - require_once("include/bbcode.php"); $profiledata = array(); $profiledata["uid"] = -1; $profiledata["nickname"] = $item["author-name"]; $profiledata["name"] = $item["author-name"]; $profiledata["picdate"] = ""; - $profiledata["photo"] = proxy_url($item["author-avatar"], false, PROXY_SIZE_SMALL); + $profiledata["photo"] = $item["author-avatar"]; $profiledata["url"] = $item["author-link"]; $profiledata["network"] = $item["network"]; @@ -174,9 +172,9 @@ function display_fetchauthor($a, $item) { $r[0]["about"] = ""; } - $profiledata["photo"] = proxy_url($r[0]["photo"], false, PROXY_SIZE_SMALL); - $profiledata["address"] = bbcode($r[0]["location"]); - $profiledata["about"] = bbcode($r[0]["about"]); + $profiledata["photo"] = $r[0]["photo"]; + $profiledata["address"] = $r[0]["location"]; + $profiledata["about"] = $r[0]["about"]; if ($r[0]["nick"] != "") $profiledata["nickname"] = $r[0]["nick"]; } @@ -185,11 +183,11 @@ function display_fetchauthor($a, $item) { $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($profiledata["url"]))); if (count($r)) { if ($profiledata["photo"] == "") - $profiledata["photo"] = proxy_url($r[0]["avatar"], false, PROXY_SIZE_SMALL); + $profiledata["photo"] = $r[0]["avatar"]; if (($profiledata["address"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA)) - $profiledata["address"] = bbcode($r[0]["location"]); + $profiledata["address"] = $r[0]["location"]; if (($profiledata["about"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA)) - $profiledata["about"] = bbcode($r[0]["about"]); + $profiledata["about"] = $r[0]["about"]; if (($profiledata["nickname"] == "") AND ($r[0]["nick"] != "")) $profiledata["nickname"] = $r[0]["nick"]; } @@ -212,7 +210,6 @@ function display_content(&$a, $update = 0) { return; } - require_once("include/bbcode.php"); require_once('include/security.php'); require_once('include/conversation.php'); require_once('include/acl_selectors.php'); From f42a7a3469f02f6786000decbc96bd968db64fa6 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 15 Dec 2015 00:11:19 +0100 Subject: [PATCH 3/3] Just one more place where we had forgotten to use the bbcode function for the about text --- include/items.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/items.php b/include/items.php index 2ac494ba27..eff1366899 100644 --- a/include/items.php +++ b/include/items.php @@ -4402,7 +4402,7 @@ function atom_author($tag,$name,$uri,$h,$w,$photo,$geo) { $o .= "\t".xmlify($r[0]["nick"])."\r\n"; $o .= "\t".xmlify($r[0]["name"])."\r\n"; - $o .= "\t".xmlify($r[0]["about"])."\r\n"; + $o .= "\t".xmlify(bbcode($r[0]["about"]))."\r\n"; $o .= "\t\r\n"; $o .= "\t\t".xmlify($location)."\r\n"; $o .= "\t\r\n";