From 71e0e55b0b5bc1746cb481056b027e76c1821ef7 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 30 Oct 2017 18:49:18 -0700 Subject: provide a 'tile' view (view only) mode to mod_cloud --- Zotlabs/Module/Cloud_tiles.php | 17 +++++++++++++++++ Zotlabs/Storage/Browser.php | 20 ++++++++++++++++++++ view/tpl/cloud_directory.tpl | 35 +++++++++++++++++++++++++++++++++++ view/tpl/cloud_header.tpl | 1 + 4 files changed, 73 insertions(+) create mode 100644 Zotlabs/Module/Cloud_tiles.php diff --git a/Zotlabs/Module/Cloud_tiles.php b/Zotlabs/Module/Cloud_tiles.php new file mode 100644 index 000000000..45124cdfa --- /dev/null +++ b/Zotlabs/Module/Cloud_tiles.php @@ -0,0 +1,17 @@ +escapeHTML($displayName); $type = $this->escapeHTML($type); + $icon = ''; if ($this->enableAssets) { @@ -196,12 +197,28 @@ class Browser extends DAV\Browser\Plugin { } } + $photo_icon = ''; + + if(strpos($type,'image/') === 0 && $attachHash) { + $r = q("select resource_id, imgscale from photo where resource_id = '%s' and imgscale in ( %d, %d ) order by imgscale asc limit 1", + dbesc($attachHash), + intval(PHOTO_RES_320), + intval(PHOTO_RES_PROFILE_80) + ); + if($r) { + $photo_icon = $r[0]['resource_id'] . '-' . $r[0]['imgscale']; + } + } + + + $attachIcon = ""; // ""; // put the array for this file together $ft['attachId'] = $this->findAttachIdByHash($attachHash); $ft['fileStorageUrl'] = substr($fullPath, 0, strpos($fullPath, "cloud/")) . "filestorage/" . $this->auth->getCurrentUser(); $ft['icon'] = $icon; + $ft['photo_icon'] = $photo_icon; $ft['attachIcon'] = (($size) ? $attachIcon : ''); // @todo Should this be an item value, not a global one? $ft['is_owner'] = $is_owner; @@ -221,6 +238,7 @@ class Browser extends DAV\Browser\Plugin { $this->server->emit('onHTMLActionsPanel', array($parent, &$output, $path)); } + $html .= replace_macros(get_markup_template('cloud.tpl'), array( '$header' => t('Files') . ": " . $this->escapeHTML($path) . "/", '$total' => t('Total'), @@ -230,6 +248,8 @@ class Browser extends DAV\Browser\Plugin { '$upload' => t('Upload'), '$is_owner' => $is_owner, '$parentpath' => $parentpath, + '$cpath' => bin2hex(\App::$query_string), + '$tiles' => intval($_SESSION['cloud_tiles']), '$entries' => $f, '$name' => t('Name'), '$type' => t('Type'), diff --git a/view/tpl/cloud_directory.tpl b/view/tpl/cloud_directory.tpl index e8ae6a590..3beeb4f8a 100644 --- a/view/tpl/cloud_directory.tpl +++ b/view/tpl/cloud_directory.tpl @@ -1,4 +1,38 @@
+ {{if $tiles}} + + {{if $parentpath}} +
+ +
.. +
+
+ {{/if}} + + {{foreach $entries as $item}} + + {{/foreach}} +
+ {{else}} @@ -42,4 +76,5 @@ {{/foreach}}
+ {{/if}}
diff --git a/view/tpl/cloud_header.tpl b/view/tpl/cloud_header.tpl index c1e589341..468f2febc 100644 --- a/view/tpl/cloud_header.tpl +++ b/view/tpl/cloud_header.tpl @@ -1,6 +1,7 @@
{{if $actionspanel}}
+ {{if $is_owner}}  {{$shared}} {{/if}} -- cgit v1.2.3 From 60da235efb53b4e38c91489b500dac75facc4a9b Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 30 Oct 2017 20:43:24 -0700 Subject: use 1) personal setting, 2) site setting, 3) default false - for system.channel_menu --- include/nav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/nav.php b/include/nav.php index 89947e270..af0ebbae2 100644 --- a/include/nav.php +++ b/include/nav.php @@ -312,7 +312,7 @@ EOT; '$pleasewait' => t('Please wait...'), '$nav_apps' => $nav_apps, '$navbar_apps' => $navbar_apps, - '$channel_menu' => get_config('system','channel_menu'), + '$channel_menu' => get_pconfig(App::$profile_uid,'system','channel_menu',get_config('system','channel_menu')), '$channel_thumb' => ((App::$profile) ? App::$profile['thumb'] : ''), '$channel_apps' => $channel_apps, '$addapps' => t('Add Apps'), -- cgit v1.2.3 From 16a2bfa95b5ba487825213239e759e23893cf7ab Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 30 Oct 2017 21:00:17 -0700 Subject: move tile styles to theme instead of template file --- view/theme/redbasic/css/style.css | 23 +++++++++++++++++++++++ view/tpl/cloud_directory.tpl | 14 +++++++------- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index aea75df65..9f9ece7c3 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1695,3 +1695,26 @@ dl.bb-dl > dd > li { #permcat-index { margin: 10px; } + +.cloud-container { + float: left; + width: 80px; + height: 80px; + margin: 5px; +} + +.cloud-icon i { + font-size: 48px; +} + +.cloud-icon img { + width: 48px; + height: 48px; +} + +.cloud-title { + width: 78px; + height: 36px; + overflow: hidden; +} + diff --git a/view/tpl/cloud_directory.tpl b/view/tpl/cloud_directory.tpl index 3beeb4f8a..40278661f 100644 --- a/view/tpl/cloud_directory.tpl +++ b/view/tpl/cloud_directory.tpl @@ -2,27 +2,27 @@ {{if $tiles}} {{if $parentpath}} -
+
-
.. +
{{/if}} {{foreach $entries as $item}} -
+
-
+ -- cgit v1.2.3 From caec565de57dd77f51e917a40370bd9bc7617c3f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 31 Oct 2017 12:18:16 -0700 Subject: bring back sitesearch widget in mod_search because some screen modes don't have search in the navbar and there is no other way to enter text - hubzilla issue #898 --- view/pdl/mod_search.pdl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/pdl/mod_search.pdl b/view/pdl/mod_search.pdl index 8353b4571..0bcdfdee3 100644 --- a/view/pdl/mod_search.pdl +++ b/view/pdl/mod_search.pdl @@ -1,5 +1,5 @@ [region=aside] -[comment][widget=sitesearch][/widget][/comment] +[widget=sitesearch][/widget] [/region] [region=right_aside] [widget=notifications][/widget] -- cgit v1.2.3 From 6efef3922b9fe6864c0855e6407b77ca54af70c5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 31 Oct 2017 15:41:44 -0700 Subject: add another delivery control parameter (force queue threshold) --- Zotlabs/Module/Admin/Site.php | 7 +++++-- include/queue_fn.php | 12 +++++++++++- view/tpl/admin_site.tpl | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index d3d058c53..2df8b9908 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -61,8 +61,9 @@ class Site { $maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50); $feed_contacts = ((x($_POST,'feed_contacts')) ? intval($_POST['feed_contacts']) : 0); $verify_email = ((x($_POST,'verify_email')) ? 1 : 0); - $techlevel_lock = ((x($_POST,'techlock')) ? intval($_POST['techlock']) : 0); - $imagick_path = ((x($_POST,'imagick_path')) ? trim($_POST['imagick_path']) : ''); + $techlevel_lock = ((x($_POST,'techlock')) ? intval($_POST['techlock']) : 0); + $imagick_path = ((x($_POST,'imagick_path')) ? trim($_POST['imagick_path']) : ''); + $force_queue = ((intval($_POST['force_queue']) > 0) ? intval($_POST['force_queue']) : 300); $techlevel = null; if(array_key_exists('techlevel', $_POST)) @@ -128,6 +129,7 @@ class Site { set_config('system','allowed_sites', $allowed_sites); set_config('system','publish_all', $force_publish); set_config('system','disable_discover_tab', $disable_discover_tab); + set_config('system','force_queue_threshold', $force_queue); if ($global_directory == '') { del_config('system', 'directory_submit_url'); } else { @@ -318,6 +320,7 @@ class Site { '$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")), '$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")), '$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(get_config('system','delivery_batch_count'))?get_config('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")), + '$force_queue' => array('force_queue', t("Queue Threshold"), get_config('system','force_queue_threshold',300), t("Always defer immediate delivery if queue contains more than this number of entries.")), '$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")), '$imagick_path' => array('imagick_path', t("Path to ImageMagick convert program"), get_config('system','imagick_convert_path'), t("If set, use this program to generate photo thumbnails for huge images ( > 4000 pixels in either dimension), otherwise memory exhaustion may occur. Example: /usr/bin/convert")), '$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")), diff --git a/include/queue_fn.php b/include/queue_fn.php index c9179b953..c09033d0a 100644 --- a/include/queue_fn.php +++ b/include/queue_fn.php @@ -158,6 +158,16 @@ function queue_deliver($outq, $immediate = false) { } } + if($immediate) { + $x = q("select count(outq_hash) as total from outq where outq_delivered = 0"); + if(intval($x[0]['total']) > intval(get_config('system','force_queue_threshold',300))) { + logger('immediate delivery deferred.', LOGGER_DEBUG, LOG_INFO); + update_queue_item($outq['outq_hash']); + return; + } + } + + $arr = array('outq' => $outq, 'base' => $base, 'handled' => false, 'immediate' => $immediate); call_hooks('queue_deliver',$arr); if($arr['handled']) @@ -205,7 +215,7 @@ function queue_deliver($outq, $immediate = false) { else { logger('deliver: queue post returned ' . $result['return_code'] . ' from ' . $outq['outq_posturl'],LOGGER_DEBUG); - update_queue_item($outq['outq_posturl']); + update_queue_item($outq['outq_hash']); } return; } diff --git a/view/tpl/admin_site.tpl b/view/tpl/admin_site.tpl index d6ff34f93..6b39e844a 100755 --- a/view/tpl/admin_site.tpl +++ b/view/tpl/admin_site.tpl @@ -88,6 +88,7 @@ {{include file="field_input.tpl" field=$timeout}} {{include file="field_input.tpl" field=$delivery_interval}} {{include file="field_input.tpl" field=$delivery_batch_count}} + {{include file="field_input.tpl" field=$force_queue}} {{include file="field_input.tpl" field=$poll_interval}} {{include file="field_input.tpl" field=$maxloadavg}} {{include file="field_input.tpl" field=$abandon_days}} -- cgit v1.2.3 From bff1e215cce27706fabe9f1764bce5c5a5b3b434 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 31 Oct 2017 18:04:01 -0700 Subject: pdledit - show original/system layout text for comparison --- Zotlabs/Module/Pdledit.php | 8 ++++++-- view/tpl/pdledit.tpl | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Module/Pdledit.php b/Zotlabs/Module/Pdledit.php index f8af470ac..9b86b599b 100644 --- a/Zotlabs/Module/Pdledit.php +++ b/Zotlabs/Module/Pdledit.php @@ -77,8 +77,10 @@ class Pdledit extends \Zotlabs\Web\Controller { } $t = get_pconfig(local_channel(),'system',$module); - if(! $t) - $t = file_get_contents(theme_include($module)); + $s = file_get_contents(theme_include($module)); + if(! $t) { + $t = $s; + } if(! $t) { notice( t('Layout not found.') . EOL); return ''; @@ -89,7 +91,9 @@ class Pdledit extends \Zotlabs\Web\Controller { '$mname' => t('Module Name:'), '$help' => t('Layout Help'), '$another' => t('Edit another layout'), + '$original' => t('System layout'), '$module' => argv(1), + '$src' => $s, '$content' => htmlspecialchars($t,ENT_COMPAT,'UTF-8'), '$submit' => t('Submit') )); diff --git a/view/tpl/pdledit.tpl b/view/tpl/pdledit.tpl index 2ea89b6c1..66b8209c9 100644 --- a/view/tpl/pdledit.tpl +++ b/view/tpl/pdledit.tpl @@ -11,7 +11,10 @@

+
{{$original}}
+
{{$src}}
+
-- cgit v1.2.3 From 98b53801e062f1fe1b5ae16c6e30635b21ebef91 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 31 Oct 2017 19:56:14 -0700 Subject: provide personal config for channel_menu; the site can set an initial site-wide value but this but there isn't a corresponding admin setting currently and can only be set by manual config --- Zotlabs/Module/Settings/Display.php | 3 +++ view/tpl/settings_display.tpl | 1 + 2 files changed, 4 insertions(+) diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index a444d28a2..e1ea0e3e5 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -23,6 +23,7 @@ class Display { $mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : ''); $preload_images = ((x($_POST,'preload_images')) ? intval($_POST['preload_images']) : 0); + $channel_menu = ((x($_POST,'channel_menu')) ? intval($_POST['channel_menu']) : 0); $user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0); $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0); $title_tosource = ((x($_POST,'title_tosource')) ? intval($_POST['title_tosource']) : 0); @@ -63,6 +64,7 @@ class Display { set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height); set_pconfig(local_channel(),'system','network_divmore_height', $network_divmore_height); set_pconfig(local_channel(),'system','manual_conversation_update', $manual_update); + set_pconfig(local_channel(),'system','channel_menu', $channel_menu); $newschema = ''; if($theme){ @@ -217,6 +219,7 @@ class Display { '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')), '$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 100 items')), '$nosmile' => array('nosmile', t("Show emoticons (smilies) as images"), 1-intval($nosmile), '', $yes_no), + '$channel_menu' => [ 'channel_menu', t('Provide channel menu in navigation bar'), get_pconfig(local_channel(),'system','channel_menu',get_config('system','channel_menu',0)), t('Default: channel menu located in app menu'),$yes_no ], '$manual_update' => array('manual_update', t('Manual conversation updates'), channel_manual_conv_update(local_channel()), t('Default is on, turning this off may increase screen jumping'), $yes_no), '$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no), '$layout_editor' => t('System Page Layout Editor - (advanced)'), diff --git a/view/tpl/settings_display.tpl b/view/tpl/settings_display.tpl index d8c1ac7aa..d1e6e0609 100755 --- a/view/tpl/settings_display.tpl +++ b/view/tpl/settings_display.tpl @@ -64,6 +64,7 @@ {{include file="field_input.tpl" field=$channel_divmore_height}} {{include file="field_input.tpl" field=$network_divmore_height}} {{include file="field_checkbox.tpl" field=$nosmile}} + {{include file="field_checkbox.tpl" field=$channel_menu}} {{include file="field_checkbox.tpl" field=$title_tosource}} {{include file="field_checkbox.tpl" field=$channel_list_mode}} {{include file="field_checkbox.tpl" field=$network_list_mode}} -- cgit v1.2.3 From 7d9d1e0cdb21e47aec20b64148a0714323383914 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 1 Nov 2017 02:15:40 -0700 Subject: Maria's profile photo issue, please push to master. --- Zotlabs/Module/Profile_photo.php | 10 ++++++++-- include/zot.php | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 27e6bc445..411518c61 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -150,6 +150,14 @@ class Profile_photo extends \Zotlabs\Web\Controller { // If setting for the default profile, unset the profile photo flag from any other photos I own if($is_default_profile) { + + $r = q("update profile set photo = '%s', thumb = '%s' where is_default = 1 and uid = %d", + dbesc(z_root() . '/photo/profile/l/' . local_channel()), + dbesc(z_root() . '/photo/profile/m/' . local_channel()), + intval(local_channel()) + ); + + $r = q("UPDATE photo SET photo_usage = %d WHERE photo_usage = %d AND resource_id != '%s' AND uid = %d", intval(PHOTO_NORMAL), @@ -159,8 +167,6 @@ class Profile_photo extends \Zotlabs\Web\Controller { ); - - send_profile_photo_activity($channel,$base_image,$profile); } diff --git a/include/zot.php b/include/zot.php index dad30dbb0..5270ed8b8 100644 --- a/include/zot.php +++ b/include/zot.php @@ -3649,6 +3649,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { $disallowed = array('id','aid','uid','guid'); foreach($arr['profile'] as $profile) { + $x = q("select * from profile where profile_guid = '%s' and uid = %d limit 1", dbesc($profile['profile_guid']), intval($channel['channel_id']) @@ -3671,6 +3672,9 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { if(in_array($k,$disallowed)) continue; + if($profile['is_default'] && in_array($k,['photo','thumb'])) + continue; + if($k === 'name') $clean['fullname'] = $v; elseif($k === 'with') -- cgit v1.2.3 From 22d45a8d1ecfa0a0a2b8429ec3233e7099e84b66 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 1 Nov 2017 02:53:12 -0700 Subject: support for netselect query --- Zotlabs/Module/Channel.php | 1 + Zotlabs/Module/Display.php | 1 + Zotlabs/Module/Network.php | 16 +++++++++++++--- Zotlabs/Module/Pubstream.php | 20 +++++++++++++++----- Zotlabs/Module/Search.php | 1 + view/tpl/build_query.tpl | 2 ++ 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 14d02d873..7c4c900a1 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -332,6 +332,7 @@ class Channel extends \Zotlabs\Web\Controller { '$tags' => (($hashtags) ? urlencode($hashtags) : ''), '$mid' => $mid, '$verb' => '', + '$net' => '', '$dend' => $datequery, '$dbegin' => $datequery2 )); diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 785274105..85f08fd08 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -188,6 +188,7 @@ class Display extends \Zotlabs\Web\Controller { '$dend' => '', '$dbegin' => '', '$verb' => '', + '$net' => '', '$mid' => $mid )); diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index ee736ff42..66032aada 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -119,6 +119,7 @@ class Network extends \Zotlabs\Web\Controller { $cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : 99); $file = ((x($_GET,'file')) ? $_GET['file'] : ''); $xchan = ((x($_GET,'xchan')) ? $_GET['xchan'] : ''); + $net = ((x($_GET,'net')) ? $_GET['net'] : ''); $deftag = ''; @@ -326,7 +327,8 @@ class Network extends \Zotlabs\Web\Controller { '$tags' => urlencode($hashtags), '$dend' => $datequery, '$mid' => '', - '$verb' => $verb, + '$verb' => $verb, + '$net' => $net, '$dbegin' => $datequery2 )); } @@ -404,7 +406,10 @@ class Network extends \Zotlabs\Web\Controller { } - + + $net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : ''); + $net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : ''); + $abook_uids = " and abook.abook_channel = " . local_channel() . " "; $uids = " and item.uid = " . local_channel() . " "; @@ -441,10 +446,12 @@ class Network extends \Zotlabs\Web\Controller { $items = q("SELECT item.*, item.id AS item_id, received FROM item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) + $net_query WHERE true $uids $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) $simple_update $sql_extra $sql_nets + $net_query2 ORDER BY item.received DESC $pager_sql " ); @@ -469,10 +476,12 @@ class Network extends \Zotlabs\Web\Controller { $r = q("SELECT distinct item.id AS item_id, $ordering FROM item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) + $net_query WHERE true $uids $item_normal AND item.parent = item.id and (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets + $net_query2 ORDER BY $ordering DESC $pager_sql " ); @@ -482,9 +491,10 @@ class Network extends \Zotlabs\Web\Controller { // this is an update $r = q("SELECT item.parent AS item_id FROM item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) + $net_query WHERE true $uids $item_normal_update $simple_update and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets " + $sql_extra3 $sql_extra $sql_nets $net_query2" ); $_SESSION['loadtime'] = datetime_convert(); } diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 15e2d8a74..e83de6bc0 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -31,6 +31,7 @@ class Pubstream extends \Zotlabs\Web\Controller { $item_normal_update = item_normal_update(); $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); + $net = ((array_key_exists('net',$_REQUEST)) ? escape_tags($_REQUEST['net']) : ''); if(! $update && !$load) { @@ -81,7 +82,8 @@ class Pubstream extends \Zotlabs\Web\Controller { '$tags' => '', '$dend' => '', '$mid' => $mid, - '$verb' => '', + '$verb' => '', + '$net' => $net, '$dbegin' => '' )); } @@ -112,6 +114,10 @@ class Pubstream extends \Zotlabs\Web\Controller { $page_mode = 'list'; else $page_mode = 'client'; + + + $net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : ''); + $net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : ''); $simple_update = (($update) ? " and item.item_unseen = 1 " : ''); @@ -134,9 +140,10 @@ class Pubstream extends \Zotlabs\Web\Controller { if($mid) { $r = q("SELECT parent AS item_id FROM item left join abook on item.author_xchan = abook.abook_xchan + $net_query WHERE mid like '%s' $uids $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets LIMIT 1", + $sql_extra3 $sql_extra $sql_nets $net_query2 LIMIT 1", dbesc($mid . '%') ); } @@ -144,10 +151,11 @@ class Pubstream extends \Zotlabs\Web\Controller { // Fetch a page full of parent items for this page $r = q("SELECT distinct item.id AS item_id, $ordering FROM item left join abook on item.author_xchan = abook.abook_xchan + $net_query WHERE true $uids $item_normal AND item.parent = item.id and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets + $sql_extra3 $sql_extra $sql_nets $net_query2 ORDER BY $ordering DESC $pager_sql " ); } @@ -156,19 +164,21 @@ class Pubstream extends \Zotlabs\Web\Controller { if($mid) { $r = q("SELECT parent AS item_id FROM item left join abook on item.author_xchan = abook.abook_xchan + $net_query WHERE mid like '%s' $uids $item_normal_update $simple_update and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets LIMIT 1", + $sql_extra3 $sql_extra $sql_nets $net_query2 LIMIT 1", dbesc($mid . '%') ); } else { $r = q("SELECT distinct item.id AS item_id, $ordering FROM item left join abook on item.author_xchan = abook.abook_xchan + $net_query WHERE true $uids $item_normal_update AND item.parent = item.id $simple_update and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets" + $sql_extra3 $sql_extra $sql_nets $net_query2" ); } $_SESSION['loadtime'] = datetime_convert(); diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index 37e9a336f..7bc3429b1 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -138,6 +138,7 @@ class Search extends \Zotlabs\Web\Controller { '$tags' => '', '$mid' => '', '$verb' => '', + '$net' => '', '$dend' => '', '$dbegin' => '' )); diff --git a/view/tpl/build_query.tpl b/view/tpl/build_query.tpl index a76d4e549..bfe5c8a08 100755 --- a/view/tpl/build_query.tpl +++ b/view/tpl/build_query.tpl @@ -29,6 +29,7 @@ var bParam_dbegin = "{{$dbegin}}"; var bParam_mid = "{{$mid}}"; var bParam_verb = "{{$verb}}"; + var bParam_net = "{{$net}}"; function buildCmd() { var udargs = ((page_load) ? "/load" : ""); @@ -57,6 +58,7 @@ if(bParam_dbegin != "") bCmd = bCmd + "&dbegin=" + bParam_dbegin; if(bParam_mid != "") bCmd = bCmd + "&mid=" + bParam_mid; if(bParam_verb != "") bCmd = bCmd + "&verb=" + bParam_verb; + if(bParam_net != "") bCmd = bCmd + "&net=" + bParam_net; if(bParam_page != 1) bCmd = bCmd + "&page=" + bParam_page; return(bCmd); } -- cgit v1.2.3