diff options
-rw-r--r-- | Zotlabs/Lib/Enotify.php | 5 | ||||
-rw-r--r-- | Zotlabs/Lib/ThreadItem.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Item.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Oembed.php | 2 | ||||
-rw-r--r-- | include/bbcode.php | 2 | ||||
-rwxr-xr-x | include/oembed.php | 63 | ||||
-rwxr-xr-x | view/tpl/conv_item.tpl | 2 |
7 files changed, 46 insertions, 35 deletions
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index 92b9fddbd..ca83adb34 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -115,6 +115,9 @@ class Enotify { // logger("notification: params = " . print_r($params, true), LOGGER_DEBUG); $itemlink = $params['link']; + if($params['item']['id']) + $itemlink .= '#item_' . $params['item']['id']; + // ignore like/unlike activity on posts - they probably require a separate notification preference @@ -677,7 +680,7 @@ class Enotify { // convert this logic into a json array just like the system notifications return array( - 'notify_link' => $item['llink'], + 'notify_link' => $item['llink'] . '#item_' . $item['id'], 'name' => $item['author']['xchan_name'], 'url' => $item['author']['xchan_url'], 'photo' => $item['author']['xchan_photo_s'], diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index f50b9680e..2f5a0c325 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -412,6 +412,9 @@ class ThreadItem { if($visible_comments === false) $visible_comments = 3; + if(in_array(\App::$module,['display','update_display'])) + $visible_comments = 99999; + if(($this->get_display_mode() === 'normal') && ($nb_children > 0)) { foreach($children as $child) { $result['children'][] = $child->get_template_data($conv_responses, $thread_level + 1); diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index ac2067356..dff1c6404 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -922,7 +922,9 @@ class Item extends \Zotlabs\Web\Controller { $post = item_store($datarray,$execflag); $post_id = $post['item_id']; - + + $datarray = $post['item']; + if($post_id) { logger('mod_item: saved item ' . $post_id); diff --git a/Zotlabs/Module/Oembed.php b/Zotlabs/Module/Oembed.php index 6f61ab4d8..9394e5942 100644 --- a/Zotlabs/Module/Oembed.php +++ b/Zotlabs/Module/Oembed.php @@ -25,7 +25,7 @@ class Oembed extends \Zotlabs\Web\Controller { echo "<html><head><base target=\"_blank\" /></head><body>"; $src = base64url_decode(argv(1)); $j = oembed_fetch_url($src); - echo $j->html; + echo $j['html']; // logger('mod-oembed ' . $h, LOGGER_ALL); echo "</body></html>"; } diff --git a/include/bbcode.php b/include/bbcode.php index 70c75e5c4..45dd5ef24 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -15,7 +15,7 @@ function tryoembed($match) { $o = oembed_fetch_url($url); - if ($o->type == 'error') + if ($o['type'] == 'error') return $match[0]; $html = oembed_format_object($o); diff --git a/include/oembed.php b/include/oembed.php index 085637a00..be2501229 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -105,7 +105,7 @@ function oembed_action($embedurl) { function oembed_process($url) { $j = oembed_fetch_url($url); logger('oembed_process: ' . print_r($j,true)); - if($j && $j->type !== 'error') + if($j && $j['type'] !== 'error') return '[embed]' . $url . '[/embed]'; return false; } @@ -215,26 +215,29 @@ function oembed_fetch_url($embedurl){ } - $j = json_decode($txt); + $j = json_decode($txt,true); + + if(! $j) + $j = []; if($action === 'filter') { - if($j->html) { - $orig = $j->html; + if($j['html']) { + $orig = $j['html']; $allow_position = (($zrl) ? true : false); - $j->html = purify_html($j->html,$allow_position); - if($j->html != $orig) { - logger('oembed html was purified. original: ' . $orig . ' purified: ' . $j->html, LOGGER_DEBUG, LOG_INFO); + $j['html'] = purify_html($j['html'],$allow_position); + if($j['html'] != $orig) { + logger('oembed html was purified. original: ' . $orig . ' purified: ' . $j['html'], LOGGER_DEBUG, LOG_INFO); } $orig_len = mb_strlen(preg_replace('/\s+/','',$orig)); - $new_len = mb_strlen(preg_replace('/\s+/','',$j->html)); + $new_len = mb_strlen(preg_replace('/\s+/','',$j['html'])); if(stripos($orig,'<script') || (! $new_len)) - $j->type = 'error'; + $j['type'] = 'error'; elseif($orig_len) { $ratio = $new_len / $orig_len; if($ratio < 0.5) { - $j->type = 'error'; + $j['type'] = 'error'; logger('oembed html truncated: ' . $ratio, LOGGER_DEBUG, LOG_INFO); } } @@ -242,7 +245,7 @@ function oembed_fetch_url($embedurl){ } } - $j->embedurl = $embedurl; + $j['embedurl'] = $embedurl; // logger('fetch return: ' . print_r($j,true)); @@ -253,27 +256,27 @@ function oembed_fetch_url($embedurl){ function oembed_format_object($j){ - $embedurl = $j->embedurl; + $embedurl = $j['embedurl']; // logger('format: ' . print_r($j,true)); - $jhtml = oembed_iframe($j->embedurl,(isset($j->width) ? $j->width : null), (isset($j->height) ? $j->height : null)); + $jhtml = oembed_iframe($j['embedurl'],(isset($j['width']) ? $j['width'] : null), (isset($j['height']) ? $j['height'] : null)); - $ret="<span class='oembed ".$j->type."'>"; - switch ($j->type) { + $ret="<span class='oembed " . $j['type'] . "'>"; + switch ($j['type']) { case "video": { - if (isset($j->thumbnail_url)) { - $tw = (isset($j->thumbnail_width)) ? $j->thumbnail_width:200; - $th = (isset($j->thumbnail_height)) ? $j->thumbnail_height:180; + if (isset($j['thumbnail_url'])) { + $tw = (isset($j['thumbnail_width'])) ? $j['thumbnail_width'] : 200; + $th = (isset($j['thumbnail_height'])) ? $j['thumbnail_height'] : 180; $tr = $tw/$th; $th=120; $tw = $th*$tr; $tpl=get_markup_template('oembed_video.tpl'); if(strstr($embedurl,'youtu') && strstr(z_root(),'https:')) { $embedurl = str_replace('http:','https:',$embedurl); - $j->thumbnail_url = str_replace('http:','https:', $j->thumbnail_url); + $j['thumbnail_url'] = str_replace('http:','https:', $j['thumbnail_url']); $jhtml = str_replace('http:','https:', $jhtml); - $j->html = str_replace('http:','https:', $j->html); + $j['html'] = str_replace('http:','https:', $j['html']); } $ret.=replace_macros($tpl, array( @@ -282,7 +285,7 @@ function oembed_format_object($j){ '$escapedhtml'=>base64_encode($jhtml), '$tw'=>$tw, '$th'=>$th, - '$turl'=>$j->thumbnail_url, + '$turl'=> $j['thumbnail_url'], )); } else { @@ -291,19 +294,19 @@ function oembed_format_object($j){ $ret.="<br>"; }; break; case "photo": { - $ret.= "<img width='".$j->width."' src='".$j->url."'>"; + $ret.= "<img width='".$j['width']."' src='".$j['url']."'>"; $ret.="<br>"; }; break; case "link": { - if($j->thumbnail_url) { + if($j['thumbnail_url']) { if(is_matrix_url($embedurl)) { $embedurl = zid($embedurl); - $j->thumbnail_url = zid($j->thumbnail_url); + $j['thumbnail_url'] = zid($j['thumbnail_url']); } - $ret = '<a href="' . $embedurl . '" ><img src="' . $j->thumbnail_url . '" alt="thumbnail" /></a><br /><br />'; + $ret = '<a href="' . $embedurl . '" ><img src="' . $j['thumbnail_url'] . '" alt="thumbnail" /></a><br /><br />'; } - //$ret = "<a href='".$embedurl."'>".$j->title."</a>"; + //$ret = "<a href='".$embedurl."'>".$j['title']."</a>"; }; break; case "rich": { // not so safe.. @@ -312,12 +315,12 @@ function oembed_format_object($j){ } // add link to source if not present in "rich" type - if ( $j->type!='rich' || !strpos($j->html,$embedurl) ){ - $embedlink = (isset($j->title))?$j->title:$embedurl; + if ( $j['type'] != 'rich' || !strpos($j['html'],$embedurl) ){ + $embedlink = (isset($j['title']))?$j['title'] : $embedurl; $ret .= '<br />' . "<a href='$embedurl' rel='oembed'>$embedlink</a>"; $ret .= "<br />"; - if (isset($j->author_name)) $ret.=" by ".$j->author_name; - if (isset($j->provider_name)) $ret.=" on ".$j->provider_name; + if (isset($j['author_name'])) $ret .= t(' by ') . $j['author_name']; + if (isset($j['provider_name'])) $ret .= t(' on ') . $j['provider_name']; } else { // add <a> for html2bbcode conversion $ret .= "<br /><a href='$embedurl' rel='oembed'>$embedurl</a>"; diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index add80885b..7e42aa891 100755 --- a/view/tpl/conv_item.tpl +++ b/view/tpl/conv_item.tpl @@ -5,7 +5,7 @@ <div id="collapsed-comments-{{$item.id}}" class="collapsed-comments" style="display: none;"> {{/if}} <div id="thread-wrapper-{{$item.id}}" class="thread-wrapper{{if $item.toplevel}} {{$item.toplevel}} generic-content-wrapper h-entry {{else}} u-comment h-cite {{/if}}"> - <a name="{{$item.id}}" ></a> + <a name="item_{{$item.id}}" ></a> <div class="wall-item-outside-wrapper {{$item.indent}}{{$item.previewing}}" id="wall-item-outside-wrapper-{{$item.id}}" > <div class="wall-item-content-wrapper {{$item.indent}}" id="wall-item-content-wrapper-{{$item.id}}" style="clear:both;"> {{if $item.photo}} |