Use network paging
This commit is contained in:
parent
174a1bb54b
commit
04e802e0f6
2 changed files with 34 additions and 19 deletions
|
@ -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,15 +33,23 @@ function community_content(App $a, $update = 0) {
|
|||
nav_set_selected('community');
|
||||
}
|
||||
|
||||
if (x($a->data,'search')) {
|
||||
$search = notags(trim($a->data['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 {
|
||||
$search = (x($_GET,'search') ? notags(trim(rawurldecode($_GET['search']))) : '');
|
||||
$itemspage_network = PConfig::get(local_user(),'system','itemspage_network', 40);
|
||||
}
|
||||
|
||||
// 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
|
||||
// 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);
|
||||
}
|
||||
|
||||
$r = community_getitems($a->pager['start'], $a->pager['itemspage']);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,15 +52,23 @@ class GlobalModule extends BaseModule {
|
|||
nav_set_selected('global');
|
||||
}
|
||||
|
||||
if (x($a->data,'search')) {
|
||||
$search = notags(trim($a->data['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 {
|
||||
$search = (x($_GET,'search') ? notags(trim(rawurldecode($_GET['search']))) : '');
|
||||
$itemspage_network = PConfig::get(local_user(),'system','itemspage_network', 40);
|
||||
}
|
||||
|
||||
// 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
|
||||
// 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);
|
||||
}
|
||||
|
||||
$r = self::getPublicItems($a->pager['start'], $a->pager['itemspage']);
|
||||
|
||||
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue