From 161ea6d51fea95be8071bea8e8f0999a25241801 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 7 Dec 2019 13:05:07 +0000 Subject: sse: initial commit to deal with forum notifications --- Zotlabs/Module/Sse_bs.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 5e00593ef..4340876ea 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -77,10 +77,6 @@ class Sse_bs extends Controller { default: } - set_xconfig(self::$ob_hash, 'sse', 'timestamp', datetime_convert()); - set_xconfig(self::$ob_hash, 'sse', 'notifications', []); // reset the cache - set_xconfig(self::$ob_hash, 'sse', 'language', App::$language); - if(self::$offset && $f) { $result = self::$f(true); json_return_and_die($result); @@ -99,6 +95,10 @@ class Sse_bs extends Controller { self::bs_register() ); + set_xconfig(self::$ob_hash, 'sse', 'timestamp', datetime_convert()); + set_xconfig(self::$ob_hash, 'sse', 'notifications', []); // reset the cache + set_xconfig(self::$ob_hash, 'sse', 'language', App::$language); + json_return_and_die($result); } @@ -390,22 +390,29 @@ class Sse_bs extends Controller { $p_str = ids_to_querystr($p, 'parent'); $p_sql = (($p_str) ? "OR parent IN ( $p_str )" : ''); - $r = q("select count(id) as unseen from item + $r = q("select mid from item where uid = %d and ( owner_xchan = '%s' OR author_xchan = '%s' $p_sql ) and item_unseen = 1 $sql_extra $item_normal", intval(self::$uid), dbesc($forums[$x]['xchan_hash']), dbesc($forums[$x]['xchan_hash']) ); - if($r[0]['unseen']) { + if($r) { + $mids = flatten_array_recursive($r); + + + foreach($mids as $mid) + $b64mids[] = 'b64.' . base64url_encode($mid); + $forums[$x]['notify_link'] = (($forums[$x]['private_forum']) ? $forums[$x]['xchan_url'] : z_root() . '/network/?f=&pf=1&unseen=1&cid=' . $forums[$x]['abook_id']); $forums[$x]['name'] = $forums[$x]['xchan_name']; $forums[$x]['addr'] = $forums[$x]['xchan_addr']; $forums[$x]['url'] = $forums[$x]['xchan_url']; $forums[$x]['photo'] = $forums[$x]['xchan_photo_s']; - $forums[$x]['unseen'] = $r[0]['unseen']; + $forums[$x]['unseen'] = count($b64mids); $forums[$x]['private_forum'] = (($forums[$x]['private_forum']) ? 'lock' : ''); $forums[$x]['message'] = (($forums[$x]['private_forum']) ? t('Private forum') : t('Public forum')); + $forums[$x]['mids'] = json_encode($b64mids); unset($forums[$x]['abook_id']); unset($forums[$x]['xchan_hash']); @@ -413,7 +420,7 @@ class Sse_bs extends Controller { unset($forums[$x]['xchan_url']); unset($forums[$x]['xchan_photo_s']); - $i = $i + $r[0]['unseen']; + $i = $i + count($mids); } else { -- cgit v1.2.3 From aed682305173a67b2af1a56b8595445bec690e2b Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 7 Dec 2019 20:14:17 +0100 Subject: Add .webp image format support --- Zotlabs/Module/Embedphotos.php | 2 ++ Zotlabs/Module/Help.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Embedphotos.php b/Zotlabs/Module/Embedphotos.php index 6a88513dc..9b0884197 100644 --- a/Zotlabs/Module/Embedphotos.php +++ b/Zotlabs/Module/Embedphotos.php @@ -68,6 +68,8 @@ class Embedphotos extends \Zotlabs\Web\Controller { $ext = '.png'; elseif($r[0]['mimetype'] === 'image/gif') $ext = '.gif'; + elseif($r[0]['mimetype'] === 'image/webp') + $exp = '.webp'; else $ext = EMPTY_STR; diff --git a/Zotlabs/Module/Help.php b/Zotlabs/Module/Help.php index f1b1acaef..ce05035b3 100644 --- a/Zotlabs/Module/Help.php +++ b/Zotlabs/Module/Help.php @@ -66,7 +66,10 @@ class Help extends \Zotlabs\Web\Controller { case IMAGETYPE_PNG: header("Content-Type: image/png"); break; - default: + case IMAGETYPE_WEBP: + header("Content-Type: image/webp"); + break; + default: break; } header("Content-Length: " . filesize($realpath)); -- cgit v1.2.3 From e1400e5745d154b365aeab11b971a6c7d201f3a9 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sun, 8 Dec 2019 00:18:51 +0100 Subject: Don't show pinned post on single post displaying --- Zotlabs/Module/Channel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 20a5418c2..5529db70e 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -470,7 +470,7 @@ class Channel extends Controller { } // Add pinned content - if(! $decoded && ! $search) { + if(! x($_REQUEST,'mid') && ! $search) { $pinned = new \Zotlabs\Widget\Pinned; $r = $pinned->widget(intval(App::$profile['profile_uid']), [ITEM_TYPE_POST]); $o .= $r['html']; -- cgit v1.2.3 From c4f4edd743b79ec3f3bebecf786cbb6da8921ce9 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 9 Dec 2019 10:44:44 +0000 Subject: directory: port censoring from zap and disable oembed in profile about --- Zotlabs/Module/Dircensor.php | 52 ++++++++++++++++++++++++++++++++++++++++++ Zotlabs/Module/Directory.php | 43 +++++++++++++++++++++++------------ Zotlabs/Module/Dirsearch.php | 54 ++++++++++++++++++++++++-------------------- 3 files changed, 110 insertions(+), 39 deletions(-) create mode 100644 Zotlabs/Module/Dircensor.php (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Dircensor.php b/Zotlabs/Module/Dircensor.php new file mode 100644 index 000000000..0fa65e948 --- /dev/null +++ b/Zotlabs/Module/Dircensor.php @@ -0,0 +1,52 @@ + false])) : False); + if ($about && $safe_mode) { + $about = html2plain($about); + } + $keywords = ((x($profile,'keywords')) ? $profile['keywords'] : ''); @@ -343,9 +356,11 @@ class Directory extends \Zotlabs\Web\Controller { 'canrate' => (($rating_enabled && local_channel()) ? true : false), 'pdesc' => $pdesc, 'pdesc_label' => t('Description:'), + 'censor' => (($directory_admin) ? 'dircensor/' . $rr['hash'] : ''), + 'censor_label' => (($rr['censored']) ? t('Uncensor') : t('Censor')), 'marital' => $marital, 'homepage' => $homepage, - 'homepageurl' => linkify($homepageurl, true), + 'homepageurl' => (($safe_mode) ? $homepageurl : linkify($homepageurl)), 'hometown' => $hometown, 'hometown_label' => t('Hometown:'), 'about' => $about, @@ -387,7 +402,7 @@ class Directory extends \Zotlabs\Web\Controller { ksort($entries); // Sort array by key so that foreach-constructs work as expected if($j['keywords']) { - \App::$data['directory_keywords'] = $j['keywords']; + App::$data['directory_keywords'] = $j['keywords']; } logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA); @@ -438,7 +453,7 @@ class Directory extends \Zotlabs\Web\Controller { echo $o; killme(); } - if(\App::$pager['page'] == 1 && $j['records'] == 0 && strpos($search,'@')) { + if(App::$pager['page'] == 1 && $j['records'] == 0 && strpos($search,'@')) { goaway(z_root() . '/chanview/?f=&address=' . $search); } info( t("No entries (some entries may be hidden).") . EOL); diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php index 92b33df0c..62af75f4c 100644 --- a/Zotlabs/Module/Dirsearch.php +++ b/Zotlabs/Module/Dirsearch.php @@ -1,14 +1,17 @@ Date: Sat, 28 Dec 2019 14:37:52 +0000 Subject: pubstream: use search mode for tag filter view and add a title --- Zotlabs/Module/Pubstream.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 84ac42f72..282c10989 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -62,6 +62,11 @@ class Pubstream extends \Zotlabs\Web\Controller { $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); $net = ((array_key_exists('net',$_REQUEST)) ? escape_tags($_REQUEST['net']) : ''); + $title = replace_macros(get_markup_template("section_title.tpl"),array( + '$title' => (($hashtags) ? '#' . htmlspecialchars($hashtags, ENT_COMPAT,'UTF-8') : '') + )); + + $o = (($hashtags) ? $title : ''); if(local_channel() && (! $update)) { @@ -94,7 +99,7 @@ class Pubstream extends \Zotlabs\Web\Controller { 'reset' => t('Reset form') ); - $o = '
'; + $o .= '
'; $o .= status_editor($a,$x,false,'Pubstream'); $o .= '
'; } @@ -285,7 +290,7 @@ class Pubstream extends \Zotlabs\Web\Controller { } // fake it - $mode = ('pubstream'); + $mode = (($hashtags) ? 'search' : 'pubstream'); $o .= conversation($items,$mode,$update,$page_mode); -- cgit v1.2.3