aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Photo.php65
-rw-r--r--include/Scrape.php11
-rw-r--r--include/api.php38
-rw-r--r--include/bb2diaspora.php74
-rw-r--r--include/conversation.php4
-rwxr-xr-xinclude/diaspora.php80
-rw-r--r--include/enotify.php2
-rwxr-xr-xinclude/items.php14
-rw-r--r--include/nav.php4
-rw-r--r--include/plugin.php35
10 files changed, 219 insertions, 108 deletions
diff --git a/include/Photo.php b/include/Photo.php
index aa6f5f113..3af1691ee 100644
--- a/include/Photo.php
+++ b/include/Photo.php
@@ -121,7 +121,70 @@ class Photo {
$this->image = imagerotate($this->image,$degrees,0);
$this->width = imagesx($this->image);
$this->height = imagesy($this->image);
- }
+ }
+
+ public function flip($horiz = true, $vert = false) {
+ $w = imagesx($this->image);
+ $h = imagesy($this->image);
+ $flipped = imagecreate($w, $h);
+ if($horiz) {
+ for ($x = 0; $x < $w; $x++) {
+ imagecopy($flipped, $this->image, $x, 0, $w - $x - 1, 0, 1, $h);
+ }
+ }
+ if($vert) {
+ for ($y = 0; $y < $h; $y++) {
+ imagecopy($flipped, $this->image, 0, $y, 0, $h - $y - 1, $w, 1);
+ }
+ }
+ $this->image = $flipped;
+ }
+
+ public function orient($filename) {
+ // based off comment on http://php.net/manual/en/function.imagerotate.php
+
+ if(! function_exists('exif_read_data'))
+ return;
+
+ $exif = exif_read_data($filename);
+ $ort = $exif['Orientation'];
+
+ switch($ort)
+ {
+ case 1: // nothing
+ break;
+
+ case 2: // horizontal flip
+ $this->flip();
+ break;
+
+ case 3: // 180 rotate left
+ $this->rotate(180);
+ break;
+
+ case 4: // vertical flip
+ $this->flip(false, true);
+ break;
+
+ case 5: // vertical flip + 90 rotate right
+ $this->flip(false, true);
+ $this->rotate(-90);
+ break;
+
+ case 6: // 90 rotate right
+ $this->rotate(-90);
+ break;
+
+ case 7: // horizontal flip + 90 rotate right
+ $this->flip();
+ $this->rotate(-90);
+ break;
+
+ case 8: // 90 rotate left
+ $this->rotate(90);
+ break;
+ }
+ }
diff --git a/include/Scrape.php b/include/Scrape.php
index ca8f6e83a..4f53effe9 100644
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -352,10 +352,11 @@ function probe_url($url, $mode = PROBE_NORMAL) {
$email_conversant = false;
$twitter = ((strpos($url,'twitter.com') !== false) ? true : false);
+ $lastfm = ((strpos($url,'last.fm/user') !== false) ? true : false);
$at_addr = ((strpos($url,'@') !== false) ? true : false);
- if(! $twitter) {
+ if((! $twitter) && (! $lastfm)) {
if(strpos($url,'mailto:') !== false && $at_addr) {
$url = str_replace('mailto:','',$url);
@@ -564,6 +565,14 @@ function probe_url($url, $mode = PROBE_NORMAL) {
$vcard['fn'] = $tid . '@twitter';
}
+ if($lastfm) {
+ $profile = $url;
+ $poll = str_replace(array('www.','last.fm/'),array('','ws.audioscrobbler.com/1.0/'),$url) . '/recenttracks.rss';
+ $vcard['nick'] = basename($url);
+ $vcard['fn'] = $vcard['nick'] . t(' on Last.fm');
+ $network = NETWORK_FEED;
+ }
+
if(! x($vcard,'fn'))
if(x($vcard,'nick'))
$vcard['fn'] = $vcard['nick'];
diff --git a/include/api.php b/include/api.php
index 855e4efa3..b77156dfa 100644
--- a/include/api.php
+++ b/include/api.php
@@ -719,14 +719,18 @@
if ($page<0) $page=0;
$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
$max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0);
+ $exclude_replies = (x($_REQUEST,'exclude_replies')?1:0);
//$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
$start = $page*$count;
//$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
+ $sql_extra = '';
if ($max_id > 0)
- $sql_extra = 'AND `item`.`id` <= '.intval($max_id);
+ $sql_extra .= ' AND `item`.`id` <= '.intval($max_id);
+ if ($exclude_replies > 0)
+ $sql_extra .= ' AND `item`.`parent` = `item`.`id`';
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
@@ -860,6 +864,8 @@
logger('API: api_statuses_show: '.$id);
//$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
+ //$sql_extra = "";
+ if ($_GET["conversation"] == "true") $sql_extra .= " AND `item`.`parent` = %d ORDER BY `received` ASC "; else $sql_extra .= " AND `item`.`id` = %d";
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
@@ -870,19 +876,24 @@
AND `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra
- AND `item`.`id`=%d",
+ ",
intval($id)
);
-
+//var_dump($r);
$ret = api_format_items($r,$user_info);
-
- $data = array('$status' => $ret[0]);
- /*switch($type){
- case "atom":
- case "rss":
- $data = api_rss_extra($a, $data, $user_info);
- }*/
- return api_apply_template("status", $type, $data);
+//var_dump($ret);
+ if ($_GET["conversation"] == "true") {
+ $data = array('$statuses' => $ret);
+ return api_apply_template("timeline", $type, $data);
+ } else {
+ $data = array('$status' => $ret[0]);
+ /*switch($type){
+ case "atom":
+ case "rss":
+ $data = api_rss_extra($a, $data, $user_info);
+ }*/
+ return api_apply_template("status", $type, $data);
+ }
}
api_register_func('api/statuses/show','api_statuses_show', true);
@@ -1061,11 +1072,14 @@
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
if ($page<0) $page=0;
$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
+ $exclude_replies = (x($_REQUEST,'exclude_replies')?1:0);
//$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
$start = $page*$count;
- if ($user_info['self']==1) $sql_extra = "AND `item`.`wall` = 1 ";
+ $sql_extra = '';
+ if ($user_info['self']==1) $sql_extra .= " AND `item`.`wall` = 1 ";
+ if ($exclude_replies > 0) $sql_extra .= ' AND `item`.`parent` = `item`.`id`';
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 7b4caec46..96cc735bd 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -67,6 +67,22 @@ function stripdcode_br_cb($s) {
}
+function diaspora_ul($s) {
+ // Replace "[\\*]" followed by any number (including zero) of
+ // spaces by "* " to match Diaspora's list format
+ return preg_replace("/\[\\\\\*\]( *)/", "* ", $s[1]);
+}
+
+
+function diaspora_ol($s) {
+ // A hack: Diaspora will create a properly-numbered ordered list even
+ // if you use '1.' for each element of the list, like:
+ // 1. First element
+ // 1. Second element
+ // 1. Third element
+ return preg_replace("/\[\\\\\*\]( *)/", "1. ", $s[1]);
+}
+
function bb2diaspora($Text,$preserve_nl = false) {
@@ -95,6 +111,11 @@ function bb2diaspora($Text,$preserve_nl = false) {
if($preserve_nl)
$Text = str_replace(array("\n","\r"), array('',''),$Text);
+ else
+ // Remove the "return" character, as Diaspora uses only the "newline"
+ // character, so having the "return" character can cause signature
+ // failures
+ $Text = str_replace("\r", "", $Text);
// Set up the parameters for a URL search string
@@ -136,38 +157,45 @@ function bb2diaspora($Text,$preserve_nl = false) {
// Check for bold text
$Text = preg_replace("(\[b\](.*?)\[\/b\])is",'**$1**',$Text);
- // Check for Italics text
+ // Check for italics text
$Text = preg_replace("(\[i\](.*?)\[\/i\])is",'_$1_',$Text);
- // Check for Underline text
-// $Text = preg_replace("(\[u\](.*?)\[\/u\])is",'<u>$1</u>',$Text);
+ // Check for underline text
+ // Replace with italics since Diaspora doesn't have underline
+ $Text = preg_replace("(\[u\](.*?)\[\/u\])is",'_$1_',$Text);
// Check for strike-through text
-// $Text = preg_replace("(\[s\](.*?)\[\/s\])is",'<strike>$1</strike>',$Text);
+ $Text = preg_replace("(\[s\](.*?)\[\/s\])is",'**[strike]**$1**[/strike]**',$Text);
// Check for over-line text
// $Text = preg_replace("(\[o\](.*?)\[\/o\])is",'<span class="overline">$1</span>',$Text);
// Check for colored text
-// $Text = preg_replace("(\[color=(.*?)\](.*?)\[\/color\])is","<span style=\"color: $1;\">$2</span>",$Text);
+ // Remove color since Diaspora doesn't support it
+ $Text = preg_replace("(\[color=(.*?)\](.*?)\[\/color\])is","$2",$Text);
// Check for sized text
-// $Text = preg_replace("(\[size=(.*?)\](.*?)\[\/size\])is","<span style=\"font-size: $1;\">$2</span>",$Text);
+ // Remove it since Diaspora doesn't support sizes very well
+ $Text = preg_replace("(\[size=(.*?)\](.*?)\[\/size\])is","$2",$Text);
// Check for list text
-// $Text = preg_replace("/\[list\](.*?)\[\/list\]/is", '<ul class="listbullet">$1</ul>' ,$Text);
-// $Text = preg_replace("/\[list=1\](.*?)\[\/list\]/is", '<ul class="listdecimal">$1</ul>' ,$Text);
-// $Text = preg_replace("/\[list=i\](.*?)\[\/list\]/s",'<ul class="listlowerroman">$1</ul>' ,$Text);
-// $Text = preg_replace("/\[list=I\](.*?)\[\/list\]/s", '<ul class="listupperroman">$1</ul>' ,$Text);
-// $Text = preg_replace("/\[list=a\](.*?)\[\/list\]/s", '<ul class="listloweralpha">$1</ul>' ,$Text);
-// $Text = preg_replace("/\[list=A\](.*?)\[\/list\]/s", '<ul class="listupperalpha">$1</ul>' ,$Text);
+ $Text = preg_replace_callback("/\[list\](.*?)\[\/list\]/is", 'diaspora_ul', $Text);
+ $Text = preg_replace_callback("/\[ul\](.*?)\[\/ul\]/is", 'diaspora_ul', $Text);
+ $Text = preg_replace_callback("/\[list=1\](.*?)\[\/list\]/is", 'diaspora_ol', $Text);
+ $Text = preg_replace_callback("/\[list=i\](.*?)\[\/list\]/s",'diaspora_ol', $Text);
+ $Text = preg_replace_callback("/\[list=I\](.*?)\[\/list\]/s", 'diaspora_ol', $Text);
+ $Text = preg_replace_callback("/\[list=a\](.*?)\[\/list\]/s", 'diaspora_ol', $Text);
+ $Text = preg_replace_callback("/\[list=A\](.*?)\[\/list\]/s", 'diaspora_ol', $Text);
+ $Text = preg_replace_callback("/\[ol\](.*?)\[\/ol\]/is", 'diaspora_ol', $Text);
// $Text = preg_replace("/\[li\](.*?)\[\/li\]/s", '<li>$1</li>' ,$Text);
-// $Text = preg_replace("/\[td\](.*?)\[\/td\]/s", '<td>$1</td>' ,$Text);
-// $Text = preg_replace("/\[tr\](.*?)\[\/tr\]/s", '<tr>$1</tr>' ,$Text);
-// $Text = preg_replace("/\[table\](.*?)\[\/table\]/s", '<table>$1</table>' ,$Text);
+ // Just get rid of table tags since Diaspora doesn't support tables
+ $Text = preg_replace("/\[th\](.*?)\[\/th\]/s", '$1' ,$Text);
+ $Text = preg_replace("/\[td\](.*?)\[\/td\]/s", '$1' ,$Text);
+ $Text = preg_replace("/\[tr\](.*?)\[\/tr\]/s", '$1' ,$Text);
+ $Text = preg_replace("/\[table\](.*?)\[\/table\]/s", '$1' ,$Text);
-// $Text = preg_replace("/\[table border=1\](.*?)\[\/table\]/s", '<table border="1" >$1</table>' ,$Text);
+ $Text = preg_replace("/\[table border=(.*?)\](.*?)\[\/table\]/s", '$2' ,$Text);
// $Text = preg_replace("/\[table border=0\](.*?)\[\/table\]/s", '<table border="0" >$1</table>' ,$Text);
@@ -177,7 +205,7 @@ function bb2diaspora($Text,$preserve_nl = false) {
// $Text = preg_replace("(\[font=(.*?)\](.*?)\[\/font\])","<span style=\"font-family: $1;\">$2</span>",$Text);
- $Text = preg_replace_callback("/\[code\](.*?)\[\/code\]/is",'stripdcode_br_cb',$Text);
+ $Text = preg_replace_callback("/\[code\](.*?)\[\/code\]/is",'stripdcode_br_cb',$Text);
// Check for [code] text
$Text = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/is","\t$2\n", $Text);
@@ -189,6 +217,7 @@ function bb2diaspora($Text,$preserve_nl = false) {
// $QuoteLayout = '<blockquote>$1</blockquote>';
// Check for [quote] text
$Text = preg_replace("/\[quote\](.*?)\[\/quote\]/is",">$1\n\n", $Text);
+ $Text = preg_replace("/\[quote=(.*?)\](.*?)\[\/quote\]/is",">$2\n\n", $Text);
// Images
@@ -203,9 +232,9 @@ function bb2diaspora($Text,$preserve_nl = false) {
// [img=widthxheight]image source[/img]
// $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/", '<img src="$3" style="height:{$2}px; width:{$1}px;" >', $Text);
- $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism",'http://www.youtube.com/watch?v=$1',$Text);
- $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/embed\/(.*?)\[\/youtube\]/ism",'http://www.youtube.com/watch?v=$1',$Text);
- $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism",'http://www.youtube.com/watch?v=$1',$Text);
+ $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism",'http://www.youtube.com/watch?v=$1',$Text);
+ $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/embed\/(.*?)\[\/youtube\]/ism",'http://www.youtube.com/watch?v=$1',$Text);
+ $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism",'http://www.youtube.com/watch?v=$1',$Text);
$Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", 'http://www.youtube.com/watch?v=$1', $Text);
$Text = preg_replace("/\[vimeo\]https?:\/\/player.vimeo.com\/video\/([0-9]+)(.*?)\[\/vimeo\]/ism",'http://vimeo.com/$1',$Text);
@@ -235,6 +264,11 @@ function bb2diaspora($Text,$preserve_nl = false) {
$Text = preg_replace_callback('/\[(.*?)\]\((.*?)\)/ism','unescape_underscores_in_links',$Text);
*/
+
+ // Remove any leading or trailing whitespace, as this will mess up
+ // the Diaspora signature verification and cause the item to disappear
+ $Text = trim($Text);
+
call_hooks('bb2diaspora',$Text);
return $Text;
diff --git a/include/conversation.php b/include/conversation.php
index 1d5a92284..2244e8df7 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -308,7 +308,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
if(($normalised != 'mailbox') && (x($a->contacts[$normalised])))
$profile_avatar = $a->contacts[$normalised]['thumb'];
else
- $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
+ $profile_avatar = ((strlen($item['author-avatar'])) ? $a->get_cached_avatar_image($item['author-avatar']) : $item['thumb']);
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
call_hooks('render_location',$locate);
@@ -657,7 +657,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
$profile_avatar = $a->contacts[$normalised]['thumb'];
else
- $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb);
+ $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $a->get_cached_avatar_image($thumb));
$like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
$dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
diff --git a/include/diaspora.php b/include/diaspora.php
index a0a1df00e..80fb10404 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -2162,7 +2162,7 @@ function diaspora_send_followup($item,$owner,$contact,$public_batch = false) {
$a = get_app();
$myaddr = $owner['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
- $theiraddr = $contact['addr'];
+// $theiraddr = $contact['addr'];
// The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always
// return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
@@ -2226,7 +2226,10 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
$a = get_app();
$myaddr = $owner['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
- $theiraddr = $contact['addr'];
+// $theiraddr = $contact['addr'];
+
+ $body = $item['body'];
+ $text = html_entity_decode(bb2diaspora($body));
// The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always
@@ -2245,26 +2248,30 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
$relay_retract = false;
$sql_sign_id = 'iid';
if( $item['deleted']) {
- $tpl = get_markup_template('diaspora_relayable_retraction.tpl');
$relay_retract = true;
- $sql_sign_id = 'retract_iid';
+
$target_type = ( ($item['verb'] === ACTIVITY_LIKE) ? 'Like' : 'Comment');
+ $sender_signed_text = $item['guid'] . ';' . $target_type ;
+
+ $sql_sign_id = 'retract_iid';
+ $tpl = get_markup_template('diaspora_relayable_retraction.tpl');
}
elseif($item['verb'] === ACTIVITY_LIKE) {
- $tpl = get_markup_template('diaspora_like_relay.tpl');
$like = true;
+
$target_type = 'Post';
// $positive = (($item['deleted']) ? 'false' : 'true');
$positive = 'true';
+ $sender_signed_text = $item['guid'] . ';' . $target_type . ';' . $parent_guid . ';' . $positive . ';' . $myaddr;
+
+ $tpl = get_markup_template('diaspora_like_relay.tpl');
}
- else {
+ else { // item is a comment
+ $sender_signed_text = $item['guid'] . ';' . $parent_guid . ';' . $text . ';' . $myaddr;
+
$tpl = get_markup_template('diaspora_comment_relay.tpl');
}
- $body = $item['body'];
-
- $text = html_entity_decode(bb2diaspora($body));
-
// fetch the original signature if the relayable was created by a Diaspora
// or DFRN user. Relayables for other networks are not supported.
@@ -2285,51 +2292,20 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
// function is called
logger('diaspora_send_relay: original author signature not found, cannot send relayable');
return;
-/*
- $itemcontact = q("select * from contact where `id` = %d limit 1",
- intval($item['contact-id'])
- );
- if(count($itemcontact)) {
- if(! $itemcontact[0]['self']) {
- $prefix = sprintf( t('[Relayed] Comment authored by %s from network %s'),
- '['. $item['author-name'] . ']' . '(' . $item['author-link'] . ')',
- network_to_name($itemcontact['network'])) . "\n";
- // "$body" was assigned to "$text" above. It isn't used after that, so I don't think
- // the following change will do anything
- $body = $prefix . $body;
-
- // I think this comment will fail upon reaching Diaspora, because "$signed_text" is not defined
- }
- }
- else {
- // I'm confused about this "else." Since it sets "$handle = $myaddr," it seems like it should be for the case
- // where the top-level post owner commented on his own post, i.e. "$itemcontact[0]['self']" is true. But it's
- // positioned to be for the case where "count($itemcontact)" is 0.
-
- $handle = $myaddr;
-
- if($like)
- $signed_text = $item['guid'] . ';' . $target_type . ';' . $parent_guid . ';' . $positive . ';' . $handle;
- elseif($relay_retract)
- $signed_text = $item['guid'] . ';' . $target_type;
- else
- $signed_text = $item['guid'] . ';' . $parent_guid . ';' . $text . ';' . $handle;
-
- $authorsig = base64_encode(rsa_sign($signed_text,$owner['uprvkey'],'sha256'));
-
- q("insert into sign (`" . $sql_sign_id . "`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
- intval($item['id']),
- dbesc($signed_text),
- dbesc($authorsig),
- dbesc($handle)
- );
- }
-*/
}
- // sign it with the top-level owner's signature
+ // Sign the relayable with the top-level owner's signature
+ //
+ // We'll use the $sender_signed_text that we just created, instead of the $signed_text
+ // stored in the database, because that provides the best chance that Diaspora will
+ // be able to reconstruct the signed text the same way we did. This is particularly a
+ // concern for the comment, whose signed text includes the text of the comment. The
+ // smallest change in the text of the comment, including removing whitespace, will
+ // make the signature verification fail. Since we translate from BB code to Diaspora's
+ // markup at the top of this function, which is AFTER we placed the original $signed_text
+ // in the database, it's hazardous to trust the original $signed_text.
- $parentauthorsig = base64_encode(rsa_sign($signed_text,$owner['uprvkey'],'sha256'));
+ $parentauthorsig = base64_encode(rsa_sign($sender_signed_text,$owner['uprvkey'],'sha256'));
$msg = replace_macros($tpl,array(
'$guid' => xmlify($item['guid']),
diff --git a/include/enotify.php b/include/enotify.php
index 81f3e11eb..134e42f8e 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -123,7 +123,7 @@ function notification($params) {
if($params['type'] == NOTIFY_TAGSELF) {
$subject = sprintf( t('[Friendica:Notify] %s tagged you') , $params['source_name']);
$preamble = sprintf( t('%1$s tagged you at %2$s') , $params['source_name'], $sitename);
- $epreamble = sprintf( t('%1$s [url=%2s]tagged you[/url].') ,
+ $epreamble = sprintf( t('%1$s [url=%2$s]tagged you[/url].') ,
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
$params['link']);
diff --git a/include/items.php b/include/items.php
index 3db1a2802..a0dd1c815 100755
--- a/include/items.php
+++ b/include/items.php
@@ -446,6 +446,8 @@ function get_atom_elements($feed,$item) {
$res['body'] = $purifier->purify($res['body']);
$res['body'] = @html2bbcode($res['body']);
+
+
}
elseif(! $have_real_body) {
@@ -814,6 +816,12 @@ function item_store($arr,$force_parent = false) {
if($r[0]['private'])
$arr['private'] = 1;
+ // Edge case. We host a public forum that was originally posted to privately.
+ // The original author commented, but as this is a comment, the permissions
+ // weren't fixed up so it will still show the comment as private unless we fix it here.
+
+ if((intval($r[0]['forum_mode']) == 1) && (! $r[0]['private']))
+ $arr['private'] = 0;
}
else {
@@ -1258,6 +1266,12 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
return 3;
}
+ if($contact['term-date'] != '0000-00-00 00:00:00') {
+ logger("dfrn_deliver: $url back from the dead - removing mark for death");
+ require_once('include/Contact.php');
+ unmark_for_death($contact);
+ }
+
$res = parse_xml_string($xml);
return $res->status;
diff --git a/include/nav.php b/include/nav.php
index d760cc8ae..a67a8b614 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -53,9 +53,9 @@ function nav(&$a) {
$nav['usermenu'][] = Array('notes/', t('Personal notes'), "", t('Your personal photos'));
// user info
- $r = q("SELECT `micro`,`avatar-date` FROM `contact` WHERE uid=%d AND self=1", intval($a->user['uid']));
+ $r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
$userinfo = array(
- 'icon' => (count($r) ? $r[0]['micro']."?rev=".urlencode($r[0]['avatar-date']): $a->get_baseurl($ssl_state)."/images/person-48.jpg"),
+ 'icon' => (count($r) ? $a->get_cached_avatar_image($r[0]['micro']) : $a->get_baseurl($ssl_state)."/images/person-48.jpg"),
'name' => $a->user['username'],
);
diff --git a/include/plugin.php b/include/plugin.php
index ae8eee78a..c6b61ae6e 100644
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -148,7 +148,9 @@ function load_hooks() {
$r = q("SELECT * FROM `hook` WHERE 1");
if(count($r)) {
foreach($r as $rr) {
- $a->hooks[] = array($rr['hook'], $rr['file'], $rr['function']);
+ if(! array_key_exists($rr['hook'],$a->hooks))
+ $a->hooks[$rr['hook']] = array();
+ $a->hooks[$rr['hook']][] = array($rr['file'],$rr['function']);
}
}
}}
@@ -158,25 +160,24 @@ if(! function_exists('call_hooks')) {
function call_hooks($name, &$data = null) {
$a = get_app();
- if(count($a->hooks)) {
- foreach($a->hooks as $hook) {
- if($hook[HOOK_HOOK] === $name) {
- @include_once($hook[HOOK_FILE]);
- if(function_exists($hook[HOOK_FUNCTION])) {
- $func = $hook[HOOK_FUNCTION];
- $func($a,$data);
- }
- else {
- // remove orphan hooks
- q("delete from hook where hook = '%s' and file = '$s' and function = '%s' limit 1",
- dbesc($hook[HOOK_HOOK]),
- dbesc($hook[HOOK_FILE]),
- dbesc($hook[HOOK_FUNCTION])
- );
- }
+ if((is_array($a->hooks)) && (array_key_exists($name,$a->hooks))) {
+ foreach($a->hooks[$name] as $hook) {
+ @include_once($hook[0]);
+ if(function_exists($hook[1])) {
+ $func = $hook[1];
+ $func($a,$data);
+ }
+ else {
+ // remove orphan hooks
+ q("delete from hook where hook = '%s' and file = '$s' and function = '%s' limit 1",
+ dbesc($name),
+ dbesc($hook[0]),
+ dbesc($hook[1])
+ );
}
}
}
+
}}