aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-01-22 10:42:58 +0000
committerMario <mario@mariovavti.com>2021-01-22 10:42:58 +0000
commit92f420f77c830163fe7d58d98ed3eefb4d79bbed (patch)
tree249a7c50f8a5f15663d5e3b72601cfb3fa1d8bfb
parent78716c42d6ff31bcd89c2316166bf9731a5ab3ab (diff)
downloadvolse-hubzilla-92f420f77c830163fe7d58d98ed3eefb4d79bbed.tar.gz
volse-hubzilla-92f420f77c830163fe7d58d98ed3eefb4d79bbed.tar.bz2
volse-hubzilla-92f420f77c830163fe7d58d98ed3eefb4d79bbed.zip
cleanup
-rw-r--r--Zotlabs/Daemon/Externals.php2
-rw-r--r--Zotlabs/Module/Zotfeed.php4
-rwxr-xr-xinclude/items.php70
3 files changed, 37 insertions, 39 deletions
diff --git a/Zotlabs/Daemon/Externals.php b/Zotlabs/Daemon/Externals.php
index da05cad18..064b3f71d 100644
--- a/Zotlabs/Daemon/Externals.php
+++ b/Zotlabs/Daemon/Externals.php
@@ -37,7 +37,7 @@ class Externals {
$r = q("select site_url, site_pull from site where site_url != '%s'
and site_flags != %d and site_type = %d
- and site_dead = 0 and site_project like '%s' and site_version > '5.3.1' order by $randfunc limit 1",
+ and site_dead = 0 and site_project like '%s' and site_version > '5.3.1' order by $randfunc limit 1",
dbesc(z_root()),
intval(DIRECTORY_MODE_STANDALONE),
intval(SITE_TYPE_ZOT),
diff --git a/Zotlabs/Module/Zotfeed.php b/Zotlabs/Module/Zotfeed.php
index e838ae34c..17b0e3057 100644
--- a/Zotlabs/Module/Zotfeed.php
+++ b/Zotlabs/Module/Zotfeed.php
@@ -66,7 +66,7 @@ class Zotfeed extends Controller {
}
else {
$items = zot_feed($channel['channel_id'], $observer_hash, []);
- $ret = Activity::encode_item_collection($items, App::$query_string, 'OrderedCollection', $total);
+ $ret = Activity::encode_item_collection($items, App::$query_string, 'OrderedCollection', $total);
}
as_return_and_die($ret, $channel);
@@ -114,7 +114,7 @@ class Zotfeed extends Controller {
'compat' => $params['compat']
], $channel, $observer_hash, CLIENT_MODE_NORMAL, App::$module
);
- $ret = Activity::encode_item_collection($items, App::$query_string, 'OrderedCollection', $total);
+ $ret = Activity::encode_item_collection($items, App::$query_string, 'OrderedCollection', $total);
}
as_return_and_die($ret, $channel);
diff --git a/include/items.php b/include/items.php
index 370aa5a93..7229b66eb 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4318,55 +4318,54 @@ function fetch_post_tags($items, $link = false) {
*/
function zot_feed($uid, $observer_hash, $arr) {
- $result = array();
- $mindate = null;
+ $result = [];
+ $mindate = null;
$message_id = null;
- $wall = true;
+ $wall = true;
require_once('include/security.php');
- if(array_key_exists('mindate',$arr)) {
- $mindate = datetime_convert('UTC','UTC',$arr['mindate']);
+ if (array_key_exists('mindate', $arr)) {
+ $mindate = datetime_convert('UTC', 'UTC', $arr['mindate']);
}
- if(array_key_exists('message_id',$arr)) {
+ if (array_key_exists('message_id', $arr)) {
$message_id = $arr['message_id'];
}
- if(array_key_exists('wall',$arr)) {
+ if (array_key_exists('wall', $arr)) {
$wall = intval($arr['wall']);
}
- if(! $mindate)
+ if (!$mindate)
$mindate = NULL_DATE;
$mindate = dbesc($mindate);
logger('zot_feed: requested for uid ' . $uid . ' from observer ' . $observer_hash, LOGGER_DEBUG);
- if($message_id)
- logger('message_id: ' . $message_id,LOGGER_DEBUG);
+ if ($message_id)
+ logger('message_id: ' . $message_id, LOGGER_DEBUG);
- if(! perm_is_allowed($uid,$observer_hash,'view_stream')) {
+ if (!perm_is_allowed($uid, $observer_hash, 'view_stream')) {
logger('zot_feed: permission denied.');
return $result;
}
- if(! is_sys_channel($uid))
- $sql_extra = item_permissions_sql($uid,$observer_hash);
-
+ if (!is_sys_channel($uid))
+ $sql_extra = item_permissions_sql($uid, $observer_hash);
$limit = " LIMIT 5000 ";
- if($mindate > NULL_DATE) {
+ if ($mindate > NULL_DATE) {
$sql_extra .= " and ( created > '$mindate' or changed > '$mindate' ) ";
}
- if($message_id) {
+ if ($message_id) {
$sql_extra .= " and mid = '" . dbesc($message_id) . "' ";
- $limit = '';
+ $limit = '';
}
- if($wall) {
+ if ($wall) {
$sql_extra .= " and item_wall = 1 ";
}
@@ -4375,9 +4374,9 @@ function zot_feed($uid, $observer_hash, $arr) {
$item_normal = item_normal();
- if(is_sys_channel($uid)) {
- $nonsys_uids = q("SELECT channel_id FROM channel WHERE channel_system = 0");
- $nonsys_uids_str = ids_to_querystr($nonsys_uids,'channel_id');
+ if (is_sys_channel($uid)) {
+ $nonsys_uids = q("SELECT channel_id FROM channel WHERE channel_system = 0");
+ $nonsys_uids_str = ids_to_querystr($nonsys_uids, 'channel_id');
if ($arr['total']) {
$items = q("SELECT count(created) AS total FROM item
@@ -4392,7 +4391,7 @@ function zot_feed($uid, $observer_hash, $arr) {
return 0;
}
- $itemspage = (($channel) ? get_pconfig($uid,'system','itemspage') : 30);
+ $itemspage = (($uid) ? get_pconfig($uid, 'system', 'itemspage') : 30);
App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 30));
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
@@ -4405,7 +4404,7 @@ function zot_feed($uid, $observer_hash, $arr) {
);
xchan_query($items);
- $items = fetch_post_tags($items,true);
+ $items = fetch_post_tags($items, true);
return $items;
}
@@ -4420,19 +4419,19 @@ function zot_feed($uid, $observer_hash, $arr) {
$parents = [];
- if($r) {
- foreach($r as $rv) {
- if(array_key_exists($rv['parent'],$parents))
+ if ($r) {
+ foreach ($r as $rv) {
+ if (array_key_exists($rv['parent'], $parents))
continue;
- if(strpos($rv['postopts'],'nodeliver') !== false)
+ if (strpos($rv['postopts'], 'nodeliver') !== false)
continue;
$parents[$rv['parent']] = $rv;
- if(count($parents) > 200)
+ if (count($parents) > 200)
break;
}
- $parents_str = ids_to_querystr($parents,'parent');
- $sys_query = ((is_sys_channel($uid)) ? $sql_extra : '');
+ $parents_str = ids_to_querystr($parents, 'parent');
+ $sys_query = ((is_sys_channel($uid)) ? $sql_extra : '');
$items = q("SELECT item.*, item.id AS item_id FROM item
WHERE item.parent IN ( %s ) $item_normal $sys_query ",
@@ -4440,25 +4439,24 @@ function zot_feed($uid, $observer_hash, $arr) {
);
}
- if($items) {
+ if ($items) {
xchan_query($items);
$items = fetch_post_tags($items);
require_once('include/conversation.php');
- $items = conv_sort($items,'ascending');
+ $items = conv_sort($items, 'ascending');
}
else
- $items = array();
+ $items = [];
- logger('zot_feed: number items: ' . count($items),LOGGER_DEBUG);
+ logger('zot_feed: number items: ' . count($items), LOGGER_DEBUG);
- foreach($items as $item)
+ foreach ($items as $item)
$result[] = encode_item($item);
return $result;
}
-
function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = CLIENT_MODE_NORMAL,$module = 'network') {
$result = array('success' => false);