mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 07:35:14 +00:00
Merge pull request #967 from dawnbreak/dev
Fix a PHP7.2 warning when a channel has no cards.
This commit is contained in:
commit
0d21c6f863
1 changed files with 41 additions and 38 deletions
|
@ -19,6 +19,10 @@ class Cards extends \Zotlabs\Web\Controller {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Zotlabs\Web\Controller::get()
|
||||
*/
|
||||
function get($update = 0, $load = false) {
|
||||
|
||||
if(observer_prohibited(true)) {
|
||||
|
@ -31,7 +35,7 @@ class Cards extends \Zotlabs\Web\Controller {
|
|||
return;
|
||||
}
|
||||
|
||||
if(! feature_enabled(\App::$profile_uid,'cards')) {
|
||||
if(! feature_enabled(\App::$profile_uid, 'cards')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -48,7 +52,7 @@ class Cards extends \Zotlabs\Web\Controller {
|
|||
$category = (($_REQUEST['cat']) ? escape_tags(trim($_REQUEST['cat'])) : '');
|
||||
|
||||
if($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));
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,7 +68,7 @@ class Cards extends \Zotlabs\Web\Controller {
|
|||
|
||||
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
|
||||
|
||||
if(! perm_is_allowed($owner,$ob_hash,'view_pages')) {
|
||||
if(! perm_is_allowed($owner, $ob_hash, 'view_pages')) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
@ -74,12 +78,12 @@ class Cards extends \Zotlabs\Web\Controller {
|
|||
$channel = channelx_by_n($owner);
|
||||
|
||||
if($channel) {
|
||||
$channel_acl = array(
|
||||
$channel_acl = [
|
||||
'allow_cid' => $channel['channel_allow_cid'],
|
||||
'allow_gid' => $channel['channel_allow_gid'],
|
||||
'deny_cid' => $channel['channel_deny_cid'],
|
||||
'deny_gid' => $channel['channel_deny_gid']
|
||||
);
|
||||
];
|
||||
}
|
||||
else {
|
||||
$channel_acl = [ 'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ];
|
||||
|
@ -87,7 +91,7 @@ class Cards extends \Zotlabs\Web\Controller {
|
|||
|
||||
|
||||
|
||||
if(perm_is_allowed($owner,$ob_hash,'write_pages')) {
|
||||
if(perm_is_allowed($owner, $ob_hash, 'write_pages')) {
|
||||
|
||||
$x = [
|
||||
'webpage' => ITEM_TYPE_CARD,
|
||||
|
@ -110,7 +114,7 @@ class Cards extends \Zotlabs\Web\Controller {
|
|||
'layoutselect' => false,
|
||||
'expanded' => false,
|
||||
'novoting' => false,
|
||||
'catsenabled' => feature_enabled($owner,'categories'),
|
||||
'catsenabled' => feature_enabled($owner, 'categories'),
|
||||
'bbco_autocomplete' => 'bbcode',
|
||||
'bbcode' => true
|
||||
];
|
||||
|
@ -119,8 +123,8 @@ class Cards extends \Zotlabs\Web\Controller {
|
|||
$x['title'] = $_REQUEST['title'];
|
||||
if($_REQUEST['body'])
|
||||
$x['body'] = $_REQUEST['body'];
|
||||
$editor = status_editor($a,$x);
|
||||
|
||||
$editor = status_editor($a, $x);
|
||||
}
|
||||
else {
|
||||
$editor = '';
|
||||
|
@ -149,9 +153,10 @@ class Cards extends \Zotlabs\Web\Controller {
|
|||
and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0
|
||||
and item.item_blocked = 0 ";
|
||||
|
||||
$items_result = [];
|
||||
if($r) {
|
||||
|
||||
$parents_str = ids_to_querystr($r,'id');
|
||||
$parents_str = ids_to_querystr($r, 'id');
|
||||
|
||||
$items = q("SELECT item.*, item.id AS item_id
|
||||
FROM item
|
||||
|
@ -164,24 +169,22 @@ class Cards extends \Zotlabs\Web\Controller {
|
|||
if($items) {
|
||||
xchan_query($items);
|
||||
$items = fetch_post_tags($items, true);
|
||||
$items = conv_sort($items,'updated');
|
||||
$items_result = conv_sort($items, 'updated');
|
||||
}
|
||||
else
|
||||
$items = [];
|
||||
}
|
||||
|
||||
$mode = 'cards';
|
||||
|
||||
$content = conversation($items,$mode,false,'traditional');
|
||||
$content = conversation($items_result, $mode, false, 'traditional');
|
||||
|
||||
$o = replace_macros(get_markup_template('cards.tpl'), [
|
||||
'$title' => t('Cards'),
|
||||
'$editor' => $editor,
|
||||
'$content' => $content,
|
||||
'$pager' => alt_pager($a,count($items))
|
||||
'$pager' => alt_pager($a, count($items_result))
|
||||
]);
|
||||
|
||||
return $o;
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue