From: Michael Date: Thu, 4 Jan 2018 10:51:49 +0000 (+0000) Subject: Use network paging X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=04e802e0f65d47dee230c5146d33fad1093a9898;p=friendica.git Use network paging --- diff --git a/mod/community.php b/mod/community.php index f4c650ec17..0c1324fec9 100644 --- a/mod/community.php +++ b/mod/community.php @@ -2,6 +2,7 @@ use Friendica\App; use Friendica\Core\Config; +use Friendica\Core\PConfig; use Friendica\Database\DBM; function community_init(App $a) { @@ -32,16 +33,24 @@ function community_content(App $a, $update = 0) { nav_set_selected('community'); } - if (x($a->data,'search')) { - $search = notags(trim($a->data['search'])); - } else { - $search = (x($_GET,'search') ? notags(trim(rawurldecode($_GET['search']))) : ''); + if (Config::get('system', 'comment_public')) { + // check if we serve a mobile device and get the user settings + // accordingly + if ($a->is_mobile) { + $itemspage_network = PConfig::get(local_user(),'system','itemspage_mobile_network', 20); + } else { + $itemspage_network = PConfig::get(local_user(),'system','itemspage_network', 40); + } + + // now that we have the user settings, see if the theme forces + // a maximum item number which is lower then the user choice + if (($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network)) { + $itemspage_network = $a->force_max_items; + } + + $a->set_pager_itemspage($itemspage_network); } - // Here is the way permissions work in this module... - // Only public posts can be shown - // OR your own posts if you are a logged in member - $r = community_getitems($a->pager['start'], $a->pager['itemspage']); if (!DBM::is_result($r)) { @@ -77,7 +86,6 @@ function community_content(App $a, $update = 0) { } else { $s = $r; } - // we behave the same in message lists as the search module $o .= conversation($a, $s, 'community', $update); diff --git a/src/Module/GlobalModule.php b/src/Module/GlobalModule.php index 2032497f65..0d9c1110cd 100644 --- a/src/Module/GlobalModule.php +++ b/src/Module/GlobalModule.php @@ -8,6 +8,7 @@ namespace Friendica\Module; use Friendica\BaseModule; use Friendica\Core\Config; +use Friendica\Core\PConfig; use Friendica\Database\DBM; use dba; @@ -51,16 +52,24 @@ class GlobalModule extends BaseModule { nav_set_selected('global'); } - if (x($a->data,'search')) { - $search = notags(trim($a->data['search'])); - } else { - $search = (x($_GET,'search') ? notags(trim(rawurldecode($_GET['search']))) : ''); + if (Config::get('system', 'comment_public')) { + // check if we serve a mobile device and get the user settings + // accordingly + if ($a->is_mobile) { + $itemspage_network = PConfig::get(local_user(),'system','itemspage_mobile_network', 20); + } else { + $itemspage_network = PConfig::get(local_user(),'system','itemspage_network', 40); + } + + // now that we have the user settings, see if the theme forces + // a maximum item number which is lower then the user choice + if (($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network)) { + $itemspage_network = $a->force_max_items; + } + + $a->set_pager_itemspage($itemspage_network); } - // Here is the way permissions work in this module... - // Only public posts can be shown - // OR your own posts if you are a logged in member - $r = self::getPublicItems($a->pager['start'], $a->pager['itemspage']); if (!DBM::is_result($r)) { @@ -68,8 +77,6 @@ class GlobalModule extends BaseModule { return $o; } - // we behave the same in message lists as the search module - $o .= conversation($a, $r, 'community', $update); $o .= alt_pager($a, count($r));