merge upstream
This commit is contained in:
@@ -196,6 +196,14 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
|
||||
// The bbcode parser now handles youtube-links (and the other stuff) correctly.
|
||||
// Additionally the html code is now fixed so that lists are now working.
|
||||
|
||||
/**
|
||||
* Transform #tags, strip off the [url] and replace spaces with underscore
|
||||
*/
|
||||
$Text = preg_replace_callback('/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', create_function('$match',
|
||||
'return \'#\'. str_replace(\' \', \'_\', $match[2]);'
|
||||
), $Text);
|
||||
|
||||
|
||||
// Converting images with size parameters to simple images. Markdown doesn't know it.
|
||||
$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $Text);
|
||||
|
||||
|
||||
@@ -303,6 +303,9 @@ function localize_item(&$item){
|
||||
function count_descendants($item) {
|
||||
$total = count($item['children']);
|
||||
|
||||
if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE)
|
||||
return 0;
|
||||
|
||||
if($total > 0) {
|
||||
foreach($item['children'] as $child) {
|
||||
$total += count_descendants($child);
|
||||
@@ -316,7 +319,7 @@ function count_descendants($item) {
|
||||
* Recursively prepare a thread for HTML
|
||||
*/
|
||||
|
||||
function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $profile_owner, $thread_level=1) {
|
||||
function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $profile_owner, $alike, $dlike, $thread_level=1) {
|
||||
$result = array();
|
||||
|
||||
$wall_template = 'wall_thread.tpl';
|
||||
@@ -333,11 +336,14 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
|
||||
$nb_items--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) {
|
||||
$nb_items --;
|
||||
continue;
|
||||
}
|
||||
|
||||
$items_seen++;
|
||||
|
||||
$alike = array();
|
||||
$dlike = array();
|
||||
$comment = '';
|
||||
$template = $wall_template;
|
||||
$commentww = '';
|
||||
@@ -408,9 +414,6 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
|
||||
$tag = trim($tag);
|
||||
if ($tag!="") $tags[] = bbcode($tag);
|
||||
}
|
||||
|
||||
like_puller($a,$item,$alike,'like');
|
||||
like_puller($a,$item,$dlike,'dislike');
|
||||
|
||||
$like = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : '');
|
||||
$dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : '');
|
||||
@@ -530,6 +533,7 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
|
||||
'$edurl' => t('Link'),
|
||||
'$edvideo' => t('Video'),
|
||||
'$preview' => t('Preview'),
|
||||
'$indent' => $indent,
|
||||
'$sourceapp' => t($a->sourcename),
|
||||
'$ww' => (($mode === 'network') ? $commentww : '')
|
||||
));
|
||||
@@ -586,6 +590,7 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
|
||||
'comment' => $comment,
|
||||
'previewing' => $previewing,
|
||||
'wait' => t('Please wait'),
|
||||
'thread_level' => $thread_level,
|
||||
);
|
||||
|
||||
$arr = array('item' => $item, 'output' => $tmp_item);
|
||||
@@ -599,7 +604,7 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
|
||||
|
||||
$item_result['children'] = array();
|
||||
if(count($item['children'])) {
|
||||
$item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $page_writeable, $mode, $profile_owner, ($thread_level + 1));
|
||||
$item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $page_writeable, $mode, $profile_owner, $alike, $dlike, ($thread_level + 1));
|
||||
}
|
||||
$item_result['private'] = $item['private'];
|
||||
$item_result['toplevel'] = ($toplevelpost ? 'toplevel_item' : '');
|
||||
@@ -607,7 +612,7 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
|
||||
/*
|
||||
* I don't like this very much...
|
||||
*/
|
||||
if(get_config('system','thread_allow')) {
|
||||
if(get_config('system','thread_allow') && $a->theme_thread_allow) {
|
||||
$item_result['flatten'] = false;
|
||||
$item_result['threaded'] = true;
|
||||
}
|
||||
@@ -831,6 +836,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
||||
'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
|
||||
'previewing' => $previewing,
|
||||
'wait' => t('Please wait'),
|
||||
'thread_level' => 1,
|
||||
);
|
||||
|
||||
$arr = array('item' => $item, 'output' => $tmp_item);
|
||||
@@ -870,6 +876,11 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
||||
foreach($items as $item) {
|
||||
like_puller($a,$item,$alike,'like');
|
||||
like_puller($a,$item,$dlike,'dislike');
|
||||
|
||||
if($item['id'] == $item['parent']) {
|
||||
$threads[] = $item;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$comments_collapsed = false;
|
||||
|
||||
@@ -2430,7 +2430,7 @@ function local_delivery($importer,$data) {
|
||||
intval($importer['importer_uid'])
|
||||
);
|
||||
if($r && count($r))
|
||||
$is_a_remote_delete = true;
|
||||
$is_a_remote_delete = true;
|
||||
|
||||
// Does this have the characteristics of a community or private group comment?
|
||||
// If it's a reply to a wall post on a community/prvgroup page it's a
|
||||
@@ -2739,7 +2739,7 @@ function local_delivery($importer,$data) {
|
||||
}
|
||||
|
||||
if($posted_id && $parent) {
|
||||
|
||||
|
||||
proc_run('php',"include/notifier.php","comment-import","$posted_id");
|
||||
|
||||
if((! $is_like) && (! $importer['self'])) {
|
||||
|
||||
@@ -18,6 +18,31 @@ require_once('include/html2plain.php');
|
||||
* us by hosting providers.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The notifier is typically called with:
|
||||
*
|
||||
* proc_run('php', "include/notifier.php", COMMAND, ITEM_ID);
|
||||
*
|
||||
* where COMMAND is one of the following:
|
||||
*
|
||||
* activity (in diaspora.php, dfrn_confirm.php, profiles.php)
|
||||
* comment-import (in diaspora.php, items.php)
|
||||
* comment-new (in item.php)
|
||||
* drop (in diaspora.php, items.php, photos.php)
|
||||
* edit_post (in item.php)
|
||||
* event (in events.php)
|
||||
* expire (in items.php)
|
||||
* like (in like.php, poke.php)
|
||||
* mail (in message.php)
|
||||
* suggest (in fsuggest.php)
|
||||
* tag (in photos.php, poke.php, tagger.php)
|
||||
* tgroup (in items.php)
|
||||
* wall-new (in photos.php, item.php)
|
||||
*
|
||||
* and ITEM_ID is the id of the item in the database that needs to be sent to others.
|
||||
*/
|
||||
|
||||
|
||||
function notifier_run($argv, $argc){
|
||||
global $a, $db;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
if ($b[0]=="$") $b = $this->_get_var($b);
|
||||
$val = ($a == $b);
|
||||
} else if (strpos($args[2],"!=")>0){
|
||||
list($a,$b) = explode("!=",$args[2]);
|
||||
list($a,$b) = array_map("trim", explode("!=",$args[2]));
|
||||
$a = $this->_get_var($a);
|
||||
if ($b[0]=="$") $b = $this->_get_var($b);
|
||||
$val = ($a != $b);
|
||||
@@ -133,6 +133,26 @@
|
||||
return $ret;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* DEBUG node
|
||||
*
|
||||
* {{ debug $var [$var [$var [...]]] }}{{ enddebug }}
|
||||
*
|
||||
* replace node with <pre>var_dump($var, $var, ...);</pre>
|
||||
*/
|
||||
private function _replcb_debug($args){
|
||||
$vars = array_map('trim', explode(" ",$args[2]));
|
||||
$vars[] = $args[1];
|
||||
|
||||
$ret = "<pre>";
|
||||
foreach ($vars as $var){
|
||||
$ret .= htmlspecialchars(var_export( $this->_get_var($var), true ));
|
||||
$ret .= "\n";
|
||||
}
|
||||
$ret .= "</pre>";
|
||||
return $ret;
|
||||
}
|
||||
|
||||
private function _replcb_node($m) {
|
||||
$node = $this->nodes[$m[1]];
|
||||
|
||||
Reference in New Issue
Block a user