more code optimisation

This commit is contained in:
zotlabs 2018-08-20 22:02:08 -07:00
parent 066febdf40
commit 8bf1e3a944
2 changed files with 20 additions and 16 deletions

View File

@ -2,21 +2,23 @@
namespace Zotlabs\Module; namespace Zotlabs\Module;
use \App;
require_once('include/contact_widgets.php'); use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\PermissionDescription;
require_once('include/items.php'); require_once('include/items.php');
require_once("include/bbcode.php");
require_once('include/security.php'); require_once('include/security.php');
require_once('include/conversation.php'); require_once('include/conversation.php');
require_once('include/acl_selectors.php'); require_once('include/acl_selectors.php');
require_once('include/permissions.php');
/** /**
* @brief Channel Controller * @brief Channel Controller
* *
*/ */
class Channel extends \Zotlabs\Web\Controller {
class Channel extends Controller {
function init() { function init() {
@ -151,7 +153,7 @@ class Channel extends \Zotlabs\Web\Controller {
'default_location' => (($is_owner) ? App::$profile['channel_location'] : ''), 'default_location' => (($is_owner) ? App::$profile['channel_location'] : ''),
'nickname' => App::$profile['channel_address'], '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'), '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') : ''), 'acl' => (($is_owner) ? populate_acl($channel_acl,true, PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post') : ''),
'permissions' => $channel_acl, 'permissions' => $channel_acl,
'showacl' => (($is_owner) ? 'yes' : ''), 'showacl' => (($is_owner) ? 'yes' : ''),
'bang' => '', 'bang' => '',

View File

@ -1,6 +1,8 @@
<?php <?php
namespace Zotlabs\Module; namespace Zotlabs\Module;
use App;
require_once('include/items.php'); require_once('include/items.php');
require_once('include/group.php'); require_once('include/group.php');
require_once('include/contact_widgets.php'); require_once('include/contact_widgets.php');
@ -25,8 +27,8 @@ class Network extends \Zotlabs\Web\Controller {
goaway('network' . '?f=&' . $network_options); goaway('network' . '?f=&' . $network_options);
} }
$channel = \App::get_channel(); $channel = App::get_channel();
\App::$profile_uid = local_channel(); App::$profile_uid = local_channel();
head_set_icon($channel['xchan_photo_s']); head_set_icon($channel['xchan_photo_s']);
} }
@ -34,7 +36,7 @@ class Network extends \Zotlabs\Web\Controller {
function get($update = 0, $load = false) { function get($update = 0, $load = false) {
if(! local_channel()) { if(! local_channel()) {
$_SESSION['return_url'] = \App::$query_string; $_SESSION['return_url'] = App::$query_string;
return login(false); return login(false);
} }
@ -44,11 +46,11 @@ class Network extends \Zotlabs\Web\Controller {
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime'] = datetime_convert();
} }
$arr = array('query' => \App::$query_string); $arr = array('query' => App::$query_string);
call_hooks('network_content_init', $arr); call_hooks('network_content_init', $arr);
$channel = \App::get_channel(); $channel = App::get_channel();
$item_normal = item_normal(); $item_normal = item_normal();
$item_normal_update = item_normal_update(); $item_normal_update = item_normal_update();
@ -326,10 +328,10 @@ class Network extends \Zotlabs\Web\Controller {
$o .= '<div id="live-network"></div>' . "\r\n"; $o .= '<div id="live-network"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . local_channel() $o .= "<script> var profile_uid = " . local_channel()
. "; var profile_page = " . \App::$pager['page'] . "; var profile_page = " . App::$pager['page']
. "; divmore_height = " . intval($maxheight) . "; </script>\r\n"; . "; 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(), '$baseurl' => z_root(),
'$pgtype' => 'network', '$pgtype' => 'network',
'$uid' => ((local_channel()) ? local_channel() : '0'), '$uid' => ((local_channel()) ? local_channel() : '0'),
@ -346,7 +348,7 @@ class Network extends \Zotlabs\Web\Controller {
'$wall' => '0', '$wall' => '0',
'$static' => $static, '$static' => $static,
'$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0),
'$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1),
'$search' => (($search) ? $search : ''), '$search' => (($search) ? $search : ''),
'$xchan' => $xchan, '$xchan' => $xchan,
'$order' => $order, '$order' => $order,
@ -417,8 +419,8 @@ class Network extends \Zotlabs\Web\Controller {
} }
else { else {
$itemspage = get_pconfig(local_channel(),'system','itemspage'); $itemspage = get_pconfig(local_channel(),'system','itemspage');
\App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start'])); $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
} }
// cmin and cmax are both -1 when the affinity tool is disabled // cmin and cmax are both -1 when the affinity tool is disabled