diff options
author | habeascodice <habeascodice@federated.social> | 2014-10-11 05:41:14 -0700 |
---|---|---|
committer | habeascodice <habeascodice@federated.social> | 2014-10-11 05:41:14 -0700 |
commit | 89faf23aacaaabf07ccf9a6c7b8f0af5b1e581bd (patch) | |
tree | 598928300196120d90a28aac79e57d213dd61779 /include | |
parent | 328ed8bb1b5f73626a032091a78609aea312f5ae (diff) | |
parent | bde8c6d39e1ccf7a53569cc652a62b5447d3243f (diff) | |
download | volse-hubzilla-89faf23aacaaabf07ccf9a6c7b8f0af5b1e581bd.tar.gz volse-hubzilla-89faf23aacaaabf07ccf9a6c7b8f0af5b1e581bd.tar.bz2 volse-hubzilla-89faf23aacaaabf07ccf9a6c7b8f0af5b1e581bd.zip |
Merge branch 'master' of https://github.com/habeascodice/red
Diffstat (limited to 'include')
-rw-r--r-- | include/bbcode.php | 4 | ||||
-rwxr-xr-x | include/diaspora.php | 13 | ||||
-rw-r--r-- | include/externals.php | 2 | ||||
-rwxr-xr-x | include/items.php | 3 | ||||
-rw-r--r-- | include/photo/photo_driver.php | 1 | ||||
-rw-r--r-- | include/zot.php | 29 |
6 files changed, 35 insertions, 17 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index d7a5ac457..6b7217f91 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -162,7 +162,7 @@ function bb_parse_app($match) { function bb_parse_element($match) { $j = json_decode(base64url_decode($match[1]),true); if($j) { - $o = EOL . '<a href="' . z_root() . '" foo="baz" onclick="importElement(\'' . $match[1] . '\'); return false;" >' . t('Install design element: ') . $j['pagetitle'] . '</a>' . EOL; + $o = EOL . '<a href="#" onclick="importElement(\'' . $match[1] . '\'); return false;" >' . t('Install design element: ') . $j['pagetitle'] . '</a>' . EOL; } return $o; } @@ -823,7 +823,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { // fix any escaped ampersands that may have been converted into links $Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text); - $Text = preg_replace("/\<(.*?)(src|href)=\"[^hfm](.*?)\>/ism",'<$1$2="">',$Text); + $Text = preg_replace("/\<(.*?)(src|href)=\"[^hfm#](.*?)\>/ism",'<$1$2="">',$Text); call_hooks('bbcode',$Text); diff --git a/include/diaspora.php b/include/diaspora.php index d288e1435..fb321a813 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1379,6 +1379,8 @@ function diaspora_comment($importer,$xml,$msg) { $datarray['mid'] = $guid; $datarray['parent_mid'] = $parent_item['mid']; + // set the route to that of the parent so downstream hubs won't reject it. + $datarray['route'] = $parent_item['route']; // No timestamps for comments? OK, we'll the use current time. $datarray['changed'] = $datarray['created'] = $datarray['edited'] = datetime_convert(); @@ -1404,13 +1406,6 @@ function diaspora_comment($importer,$xml,$msg) { $message_id = $result['item_id']; if(($parent_item['item_flags'] & ITEM_ORIGIN) && (! $parent_author_signature)) { - q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ", - intval($message_id), - dbesc($signed_data), - dbesc(base64_encode($author_signature)), - dbesc($diaspora_handle) - ); - // if the message isn't already being relayed, notify others // the existence of parent_author_signature means the parent_author or owner // is already relaying. @@ -1968,6 +1963,9 @@ function diaspora_like($importer,$xml,$msg) { $arr['app'] = 'Diaspora'; + // set the route to that of the parent so downstream hubs won't reject it. + $arr['route'] = $parent_item['route']; + $arr['item_private'] = $parent_item['item_private']; $arr['verb'] = $activity; $arr['obj_type'] = $objtype; @@ -2446,6 +2444,7 @@ function diaspora_send_followup($item,$owner,$contact,$public_batch = false) { else return; + if(($item['verb'] === ACTIVITY_LIKE) && ($parent['mid'] === $parent['parent_mid'])) { $tpl = get_markup_template('diaspora_like.tpl'); $like = true; diff --git a/include/externals.php b/include/externals.php index acfaae3b6..280daf4a4 100644 --- a/include/externals.php +++ b/include/externals.php @@ -85,6 +85,8 @@ function externals_run($argv, $argc){ if($j['success'] && $j['messages']) { $sys = get_sys_channel(); foreach($j['messages'] as $message) { + // on these posts, clear any route info. + $message['route'] = ''; $results = process_delivery(array('hash' => 'undefined'), get_item_elements($message), array(array('hash' => $sys['xchan_hash'])), false, true); $total ++; diff --git a/include/items.php b/include/items.php index a930a7c3e..c4ae948b8 100755 --- a/include/items.php +++ b/include/items.php @@ -2072,6 +2072,7 @@ function item_store($arr,$allow_exec = false) { return $ret; } + // is the new message multi-level threaded? // even though we don't support it now, preserve the info // and re-attach to the conversation parent. @@ -2414,7 +2415,7 @@ function item_store_update($arr,$allow_exec = false) { $arr['commented'] = $orig[0]['commented']; $arr['received'] = datetime_convert(); $arr['changed'] = datetime_convert(); - + $arr['route'] = ((array_key_exists('route',$arr)) ? trim($arr['route']) : $orig[0]['route']); $arr['diaspora_meta'] = ((x($arr,'diaspora_meta')) ? $arr['diaspora_meta'] : $orig[0]['diaspora_meta']); $arr['location'] = ((x($arr,'location')) ? notags(trim($arr['location'])) : $orig[0]['location']); $arr['coord'] = ((x($arr,'coord')) ? notags(trim($arr['coord'])) : $orig[0]['coord']); diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 508d82957..9cd05e26e 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -8,6 +8,7 @@ function photo_factory($data, $type = null) { if(class_exists('Imagick') && !$ignore_imagick) { $v = Imagick::getVersion(); preg_match('/ImageMagick ([0-9]+\.[0-9]+\.[0-9]+)/', $v['versionString'], $m); + logger('image v='.$v.',v[ver]='.$v['versionString'].',matches='.var_export($m, true), LOGGER_DEBUG); if(version_compare($m[1],'6.6.7') >= 0) { require_once('include/photo/photo_imagick.php'); $ph = new photo_imagick($data,$type); diff --git a/include/zot.php b/include/zot.php index 9ea92aed8..fda2a2bea 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1420,8 +1420,8 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { $result[] = array($d['hash'],'permission denied',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); continue; } - - if(($arr['mid'] != $arr['parent_mid']) && (! $relay)) { + + if($arr['mid'] != $arr['parent_mid']) { // check source route. // We are only going to accept comments from this sender if the comment has the same route as the top-level-post, @@ -1437,11 +1437,24 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { $result[] = array($d['hash'],'comment parent not found',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); continue; } - $current_route = (($arr['route']) ? $arr['route'] . ',' : '') . $sender['hash']; + if($relay) { + // reset the route in case it travelled a great distance upstream + // use our parent's route so when we go back downstream we'll match + // with whatever route our parent has. + $arr['route'] = $r[0]['route']; + } + else { - if($r[0]['route'] != $current_route) { - $result[] = array($d['hash'],'comment route mismatch',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); - continue; + // going downstream check that we have the same upstream provider that + // sent it to us originally. Ignore it if it came from another source + // (with potentially different permissions) + + $current_route = (($arr['route']) ? $arr['route'] . ',' : '') . $sender['hash']; + + if($r[0]['route'] != $current_route) { + $result[] = array($d['hash'],'comment route mismatch',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + continue; + } } } @@ -1467,16 +1480,18 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { intval($channel['channel_id']) ); if($r) { + $item_id = $r[0]['id']; if($arr['edited'] > $r[0]['edited']) { $arr['id'] = $r[0]['id']; $arr['uid'] = $channel['channel_id']; update_imported_item($sender,$arr,$channel['channel_id']); $result[] = array($d['hash'],'updated',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + if(! $relay) + add_source_route($item_id,$sender['hash']); } else { $result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); } - $item_id = $r[0]['id']; } else { $arr['aid'] = $channel['channel_account_id']; |