aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-08-21 13:19:30 +0200
committerMario Vavti <mario@mariovavti.com>2018-08-21 13:19:30 +0200
commitdb853134e31d5f42344d140339e0dea626fd429a (patch)
tree5fb4798a2549c1b9b83fa806426f6875cccbbb80 /Zotlabs
parent218029ee578ed40f37ec093e6bb7eafa7127263c (diff)
parent066febdf4092a308d70e9989b322afb470253132 (diff)
downloadvolse-hubzilla-db853134e31d5f42344d140339e0dea626fd429a.tar.gz
volse-hubzilla-db853134e31d5f42344d140339e0dea626fd429a.tar.bz2
volse-hubzilla-db853134e31d5f42344d140339e0dea626fd429a.zip
Merge remote-tracking branch 'mike/master' into dev
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Channel.php86
-rw-r--r--Zotlabs/Module/Display.php90
-rw-r--r--Zotlabs/Widget/Cover_photo.php10
3 files changed, 96 insertions, 90 deletions
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index b5e6b3aee..f1ae2f507 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Module;
+use \App;
+
require_once('include/contact_widgets.php');
require_once('include/items.php');
require_once("include/bbcode.php");
@@ -26,7 +28,7 @@ class Channel extends \Zotlabs\Web\Controller {
$which = argv(1);
if(! $which) {
if(local_channel()) {
- $channel = \App::get_channel();
+ $channel = App::get_channel();
if($channel && $channel['channel_address'])
$which = $channel['channel_address'];
}
@@ -37,7 +39,7 @@ class Channel extends \Zotlabs\Web\Controller {
}
$profile = 0;
- $channel = \App::get_channel();
+ $channel = App::get_channel();
if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) {
$which = $channel['channel_address'];
@@ -70,8 +72,6 @@ class Channel extends \Zotlabs\Web\Controller {
if($load)
$_SESSION['loadtime'] = datetime_convert();
- $checkjs = new \Zotlabs\Web\CheckJS(1);
-
$category = $datequery = $datequery2 = '';
$mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : '');
@@ -95,22 +95,22 @@ class Channel extends \Zotlabs\Web\Controller {
if($update) {
// Ensure we've got a profile owner if updating.
- \App::$profile['profile_uid'] = \App::$profile_uid = $update;
+ App::$profile['profile_uid'] = App::$profile_uid = $update;
}
- $is_owner = (((local_channel()) && (\App::$profile['profile_uid'] == local_channel())) ? true : false);
+ $is_owner = (((local_channel()) && (App::$profile['profile_uid'] == local_channel())) ? true : false);
- $channel = \App::get_channel();
- $observer = \App::get_observer();
+ $channel = App::get_channel();
+ $observer = App::get_observer();
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
- $perms = get_all_perms(\App::$profile['profile_uid'],$ob_hash);
+ $perms = get_all_perms(App::$profile['profile_uid'],$ob_hash);
if(! $perms['view_stream']) {
// We may want to make the target of this redirect configurable
if($perms['view_profile']) {
notice( t('Insufficient permissions. Request redirected to profile page.') . EOL);
- goaway (z_root() . "/profile/" . \App::$profile['channel_address']);
+ goaway (z_root() . "/profile/" . App::$profile['channel_address']);
}
notice( t('Permission denied.') . EOL);
return;
@@ -121,7 +121,7 @@ class Channel extends \Zotlabs\Web\Controller {
nav_set_selected('Channel Home');
- $static = channel_manual_conv_update(\App::$profile['profile_uid']);
+ $static = channel_manual_conv_update(App::$profile['profile_uid']);
// search terms header
if($search) {
@@ -147,16 +147,16 @@ class Channel extends \Zotlabs\Web\Controller {
$x = array(
'is_owner' => $is_owner,
- 'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(\App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false),
- 'default_location' => (($is_owner) ? \App::$profile['channel_location'] : ''),
- 'nickname' => \App::$profile['channel_address'],
- 'lockstate' => (((strlen(\App::$profile['channel_allow_cid'])) || (strlen(\App::$profile['channel_allow_gid'])) || (strlen(\App::$profile['channel_deny_cid'])) || (strlen(\App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'),
+ 'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false),
+ 'default_location' => (($is_owner) ? App::$profile['channel_location'] : ''),
+ 'nickname' => App::$profile['channel_address'],
+ 'lockstate' => (((strlen(App::$profile['channel_allow_cid'])) || (strlen(App::$profile['channel_allow_gid'])) || (strlen(App::$profile['channel_deny_cid'])) || (strlen(App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'),
'acl' => (($is_owner) ? populate_acl($channel_acl,true, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post') : ''),
'permissions' => $channel_acl,
'showacl' => (($is_owner) ? 'yes' : ''),
'bang' => '',
'visitor' => (($is_owner || $observer) ? true : false),
- 'profile_uid' => \App::$profile['profile_uid'],
+ 'profile_uid' => App::$profile['profile_uid'],
'editor_autocomplete' => true,
'bbco_autocomplete' => 'bbcode',
'bbcode' => true,
@@ -176,14 +176,14 @@ class Channel extends \Zotlabs\Web\Controller {
$item_normal = item_normal();
$item_normal_update = item_normal_update();
- $sql_extra = item_permissions_sql(\App::$profile['profile_uid']);
+ $sql_extra = item_permissions_sql(App::$profile['profile_uid']);
- if(get_pconfig(\App::$profile['profile_uid'],'system','channel_list_mode') && (! $mid))
+ if(get_pconfig(App::$profile['profile_uid'],'system','channel_list_mode') && (! $mid))
$page_mode = 'list';
else
$page_mode = 'client';
- $abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " ";
+ $abook_uids = " and abook.abook_channel = " . intval(App::$profile['profile_uid']) . " ";
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
@@ -203,7 +203,7 @@ class Channel extends \Zotlabs\Web\Controller {
head_add_link([
'rel' => 'alternate',
'type' => 'application/json+oembed',
- 'href' => z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string),
+ 'href' => z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . App::$query_string),
'title' => 'oembed'
]);
@@ -221,7 +221,7 @@ class Channel extends \Zotlabs\Web\Controller {
$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal_update
AND item_wall = 1 $simple_update $sql_extra limit 1",
dbesc($mid . '%'),
- intval(\App::$profile['profile_uid'])
+ intval(App::$profile['profile_uid'])
);
$_SESSION['loadtime'] = datetime_convert();
}
@@ -233,7 +233,7 @@ class Channel extends \Zotlabs\Web\Controller {
AND (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra
ORDER BY created DESC",
- intval(\App::$profile['profile_uid'])
+ intval(App::$profile['profile_uid'])
);
$_SESSION['loadtime'] = datetime_convert();
}
@@ -242,10 +242,10 @@ class Channel extends \Zotlabs\Web\Controller {
else {
if(x($category)) {
- $sql_extra2 .= protect_sprintf(term_item_parent_query(\App::$profile['profile_uid'],'item', $category, TERM_CATEGORY));
+ $sql_extra2 .= protect_sprintf(term_item_parent_query(App::$profile['profile_uid'],'item', $category, TERM_CATEGORY));
}
if(x($hashtags)) {
- $sql_extra2 .= protect_sprintf(term_item_parent_query(\App::$profile['profile_uid'],'item', $hashtags, TERM_HASHTAG, TERM_COMMUNITYTAG));
+ $sql_extra2 .= protect_sprintf(term_item_parent_query(App::$profile['profile_uid'],'item', $hashtags, TERM_HASHTAG, TERM_COMMUNITYTAG));
}
if($datequery) {
@@ -267,15 +267,15 @@ class Channel extends \Zotlabs\Web\Controller {
$itemspage = get_pconfig(local_channel(),'system','itemspage');
- \App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
- $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
+ App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
+ $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
- if($load || ($checkjs->disabled())) {
+ if((! $update) || ($load)) {
if($mid) {
$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal
AND item_wall = 1 $sql_extra limit 1",
dbesc($mid . '%'),
- intval(\App::$profile['profile_uid'])
+ intval(App::$profile['profile_uid'])
);
if (! $r) {
notice( t('Permission denied.') . EOL);
@@ -289,7 +289,7 @@ class Channel extends \Zotlabs\Web\Controller {
AND item.item_wall = 1 AND item.item_thread_top = 1
$sql_extra $sql_extra2
ORDER BY $ordering DESC $pager_sql ",
- intval(\App::$profile['profile_uid'])
+ intval(App::$profile['profile_uid'])
);
}
}
@@ -306,7 +306,7 @@ class Channel extends \Zotlabs\Web\Controller {
WHERE item.uid = %d $item_normal
AND item.parent IN ( %s )
$sql_extra ",
- intval(\App::$profile['profile_uid']),
+ intval(App::$profile['profile_uid']),
dbesc($parents_str)
);
@@ -329,19 +329,19 @@ class Channel extends \Zotlabs\Web\Controller {
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
// because browser prefetching might change it on us. We have to deliver it with the page.
- $maxheight = get_pconfig(\App::$profile['profile_uid'],'system','channel_divmore_height');
+ $maxheight = get_pconfig(App::$profile['profile_uid'],'system','channel_divmore_height');
if(! $maxheight)
$maxheight = 400;
$o .= '<div id="live-channel"></div>' . "\r\n";
- $o .= "<script> var profile_uid = " . \App::$profile['profile_uid']
- . "; var netargs = '?f='; var profile_page = " . \App::$pager['page']
+ $o .= "<script> var profile_uid = " . App::$profile['profile_uid']
+ . "; var netargs = '?f='; var profile_page = " . App::$pager['page']
. "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
- \App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
+ App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
'$baseurl' => z_root(),
'$pgtype' => 'channel',
- '$uid' => ((\App::$profile['profile_uid']) ? \App::$profile['profile_uid'] : '0'),
+ '$uid' => ((App::$profile['profile_uid']) ? App::$profile['profile_uid'] : '0'),
'$gid' => '0',
'$cid' => '0',
'$cmin' => '(-1)',
@@ -354,7 +354,7 @@ class Channel extends \Zotlabs\Web\Controller {
'$wall' => '1',
'$fh' => '0',
'$static' => $static,
- '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1),
+ '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1),
'$search' => $search,
'$xchan' => '',
'$order' => $order,
@@ -405,17 +405,19 @@ class Channel extends \Zotlabs\Web\Controller {
$mode = (($search) ? 'search' : 'channel');
- if($checkjs->disabled()) {
- $o .= conversation($items,$mode,$update,'traditional');
+ if($update) {
+ $o .= conversation($items,$mode,$update,$page_mode);
}
else {
+ $o .= '<noscript>';
+ $o .= conversation($items,$mode,$update,'traditional');
+ $o .= alt_pager(count($items));
+ $o .= '</noscript>';
$o .= conversation($items,$mode,$update,$page_mode);
- }
- if((! $update) || ($checkjs->disabled())) {
- $o .= alt_pager(count($items));
if ($mid && $items[0]['title'])
- \App::$page['title'] = $items[0]['title'] . " - " . \App::$page['title'];
+ App::$page['title'] = $items[0]['title'] . " - " . App::$page['title'];
+
}
if($mid)
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index fe0408c6f..bdaed0933 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -21,8 +21,6 @@ class Display extends \Zotlabs\Web\Controller {
$module_format = 'html';
}
- $checkjs = new \Zotlabs\Web\CheckJS(1);
-
if($load)
$_SESSION['loadtime'] = datetime_convert();
@@ -253,53 +251,44 @@ class Display extends \Zotlabs\Web\Controller {
$sql_extra = public_permissions_sql($observer_hash);
- if(($update && $load) || ($checkjs->disabled()) || ($module_format !== 'html')) {
+ if((! $update) || ($load)) {
- $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']),intval(\App::$pager['start']));
+ $r = null;
- if($load || ($checkjs->disabled()) || ($module_format !== 'html')) {
+ require_once('include/channel.php');
+ $sys = get_sys_channel();
+ $sysid = $sys['channel_id'];
- $r = null;
+ if(local_channel()) {
+ $r = q("SELECT item.id as item_id from item WHERE uid = %d and mid = '%s' $item_normal limit 1",
+ intval(local_channel()),
+ dbesc($target_item['parent_mid'])
+ );
+ if($r) {
+ $updateable = true;
+ }
+ }
- require_once('include/channel.php');
- $sys = get_sys_channel();
- $sysid = $sys['channel_id'];
+ if(! $r) {
- if(local_channel()) {
- $r = q("SELECT item.id as item_id from item
- WHERE uid = %d
- and mid = '%s'
- $item_normal
- limit 1",
- intval(local_channel()),
- dbesc($target_item['parent_mid'])
- );
- if($r) {
- $updateable = true;
- }
- }
+ // in case somebody turned off public access to sys channel content using permissions
+ // make that content unsearchable by ensuring the owner uid can't match
- if(! $r) {
-
- // in case somebody turned off public access to sys channel content using permissions
- // make that content unsearchable by ensuring the owner uid can't match
-
- if(! perm_is_allowed($sysid,$observer_hash,'view_stream'))
- $sysid = 0;
-
- $r = q("SELECT item.id as item_id from item
- WHERE mid = '%s'
- AND (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = ''
- AND item.deny_gid = '' AND item_private = 0 )
- and uid in ( " . stream_perms_api_uids(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
- OR uid = %d )
- $sql_extra )
- $item_normal
- limit 1",
- dbesc($target_item['parent_mid']),
- intval($sysid)
- );
- }
+ if(! perm_is_allowed($sysid,$observer_hash,'view_stream'))
+ $sysid = 0;
+
+ $r = q("SELECT item.id as item_id from item
+ WHERE mid = '%s'
+ AND (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = ''
+ AND item.deny_gid = '' AND item_private = 0 )
+ and uid in ( " . stream_perms_api_uids(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
+ OR uid = %d )
+ $sql_extra )
+ $item_normal
+ limit 1",
+ dbesc($target_item['parent_mid']),
+ intval($sysid)
+ );
}
}
@@ -373,14 +362,19 @@ class Display extends \Zotlabs\Web\Controller {
case 'html':
- if ($checkjs->disabled()) {
+ if ($update) {
+ $o .= conversation($items, 'display', $update, 'client');
+ }
+ else {
+ $o .= '<noscript>';
$o .= conversation($items, 'display', $update, 'traditional');
+ $o .= '</noscript>';
+
if ($items[0]['title'])
\App::$page['title'] = $items[0]['title'] . " - " . \App::$page['title'];
- }
- else {
+
$o .= conversation($items, 'display', $update, 'client');
- }
+ }
break;
@@ -435,7 +429,7 @@ class Display extends \Zotlabs\Web\Controller {
$o .= '<div id="content-complete"></div>';
- if((($update && $load) || $checkjs->disabled()) && (! $items)) {
+ if(((! $update) || ($load)) && (! $items)) {
$r = q("SELECT id, item_deleted FROM item WHERE mid = '%s' LIMIT 1",
dbesc($item_hash)
diff --git a/Zotlabs/Widget/Cover_photo.php b/Zotlabs/Widget/Cover_photo.php
index d2eb1be92..af1ae5c7f 100644
--- a/Zotlabs/Widget/Cover_photo.php
+++ b/Zotlabs/Widget/Cover_photo.php
@@ -20,6 +20,16 @@ class Cover_photo {
if(! $channel_id)
return '';
+ // only show cover photos once per login session
+
+ if(array_key_exists('channels_visited',$_SESSION) && is_array($_SESSION['channels_visited']) && in_array($channel_id,$_SESSION['channels_visited'])) {
+ return EMPTY_STR;
+ }
+ if(! array_key_exists('channels_visited',$_SESSION)) {
+ $_SESSION['channels_visited'] = [];
+ }
+ $_SESSION['channels_visited'][] = $channel_id;
+
$channel = channelx_by_n($channel_id);
if(array_key_exists('style', $arr) && isset($arr['style']))