From 997e94555b1511b907662f688207f17d4ad868e2 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 27 Feb 2017 21:46:37 +0000 Subject: [PATCH 1/3] The old pager is removed --- include/Contact.php | 30 ++---------------------------- mod/admin.php | 3 --- mod/community.php | 27 +-------------------------- mod/network.php | 19 +------------------ mod/profile.php | 25 ++----------------------- view/templates/admin_site.tpl | 1 - 6 files changed, 6 insertions(+), 99 deletions(-) diff --git a/include/Contact.php b/include/Contact.php index 2aab828f8..9e3e6e010 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -675,15 +675,6 @@ function posts_from_gcontact(App $a, $gcontact_id) { else $sql = "`item`.`uid` = %d"; - if(get_config('system', 'old_pager')) { - $r = q("SELECT COUNT(*) AS `total` FROM `item` - WHERE `gcontact-id` = %d and $sql", - intval($gcontact_id), - intval(local_user())); - - $a->set_pager_total($r[0]['total']); - } - $r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`, `author-name` AS `name`, `owner-avatar` AS `photo`, `owner-link` AS `url`, `owner-avatar` AS `thumb` @@ -699,11 +690,7 @@ function posts_from_gcontact(App $a, $gcontact_id) { $o = conversation($a,$r,'community',false); - if(!get_config('system', 'old_pager')) { - $o .= alt_pager($a,count($r)); - } else { - $o .= paginate($a); - } + $o .= alt_pager($a,count($r)); return $o; } @@ -736,15 +723,6 @@ function posts_from_contact_url(App $a, $contact_url) { $author_id = intval($r[0]["author-id"]); - if (get_config('system', 'old_pager')) { - $r = q("SELECT COUNT(*) AS `total` FROM `item` - WHERE `author-id` = %d and $sql", - intval($author_id), - intval(local_user())); - - $a->set_pager_total($r[0]['total']); - } - $r = q(item_query()." AND `item`.`author-id` = %d AND ".$sql. " ORDER BY `item`.`created` DESC LIMIT %d, %d", intval($author_id), @@ -755,11 +733,7 @@ function posts_from_contact_url(App $a, $contact_url) { $o = conversation($a,$r,'community',false); - if (!get_config('system', 'old_pager')) { - $o .= alt_pager($a,count($r)); - } else { - $o .= paginate($a); - } + $o .= alt_pager($a,count($r)); return $o; } diff --git a/mod/admin.php b/mod/admin.php index 147513083..d91b2d0a5 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -662,7 +662,6 @@ function admin_page_site_post(App $a) { $basepath = ((x($_POST,'basepath')) ? notags(trim($_POST['basepath'])) : ''); $singleuser = ((x($_POST,'singleuser')) ? notags(trim($_POST['singleuser'])) : ''); $proxy_disabled = ((x($_POST,'proxy_disabled')) ? True : False); - $old_pager = ((x($_POST,'old_pager')) ? True : False); $only_tag_search = ((x($_POST,'only_tag_search')) ? True : False); $rino = ((x($_POST,'rino')) ? intval($_POST['rino']) : 0); $embedly = ((x($_POST,'embedly')) ? notags(trim($_POST['embedly'])) : ''); @@ -815,7 +814,6 @@ function admin_page_site_post(App $a) { set_config('system','temppath', $temppath); set_config('system','basepath', $basepath); set_config('system','proxy_disabled', $proxy_disabled); - set_config('system','old_pager', $old_pager); set_config('system','only_tag_search', $only_tag_search); set_config('system','worker', $worker); set_config('system','worker_queues', $worker_queues); @@ -1061,7 +1059,6 @@ function admin_page_site(App $a) { '$temppath' => array('temppath', t("Temp path"), get_config('system','temppath'), t("If you have a restricted system where the webserver can't access the system temp path, enter another path here.")), '$basepath' => array('basepath', t("Base path to installation"), get_config('system','basepath'), t("If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot.")), '$proxy_disabled' => array('proxy_disabled', t("Disable picture proxy"), get_config('system','proxy_disabled'), t("The picture proxy increases performance and privacy. It shouldn't be used on systems with very low bandwith.")), - '$old_pager' => array('old_pager', t("Enable old style pager"), get_config('system','old_pager'), t("The old style pager has page numbers but slows down massively the page speed.")), '$only_tag_search' => array('only_tag_search', t("Only search in tags"), get_config('system','only_tag_search'), t("On large systems the text search can slow down the system extremely.")), '$relocate_url' => array('relocate_url', t("New base url"), App::get_baseurl(), t("Change base url for this server. Sends relocate message to all DFRN contacts of all users.")), diff --git a/mod/community.php b/mod/community.php index 7c92ff462..91b09bba9 100644 --- a/mod/community.php +++ b/mod/community.php @@ -48,27 +48,6 @@ function community_content(App $a, $update = 0) { // Only public posts can be shown // OR your own posts if you are a logged in member - if(get_config('system', 'old_pager')) { - $r = qu("SELECT COUNT(distinct(`item`.`uri`)) AS `total` - FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` - AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - INNER JOIN `user` ON `user`.`uid` = `item`.`uid` AND `user`.`hidewall` = 0 - WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 - AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' - AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' - AND `item`.`private` = 0 AND `item`.`wall` = 1" - ); - - if (dbm::is_result($r)) - $a->set_pager_total($r[0]['total']); - - if(! $r[0]['total']) { - info( t('No results.') . EOL); - return $o; - } - - } - $r = community_getitems($a->pager['start'], $a->pager['itemspage']); if (! dbm::is_result($r)) { @@ -107,11 +86,7 @@ function community_content(App $a, $update = 0) { $o .= conversation($a,$s,'community',$update); - if(!get_config('system', 'old_pager')) { - $o .= alt_pager($a,count($r)); - } else { - $o .= paginate($a); - } + $o .= alt_pager($a,count($r)); return $o; } diff --git a/mod/network.php b/mod/network.php index 23cf098b6..284bf3d96 100644 --- a/mod/network.php +++ b/mod/network.php @@ -599,21 +599,6 @@ function network_content(App $a, $update = 0) { $pager_sql = ''; } else { - if(get_config('system', 'old_pager')) { - $r = qu("SELECT COUNT(*) AS `total` - FROM $sql_table $sql_post_table INNER JOIN `contact` ON `contact`.`id` = $sql_table.`contact-id` - AND (NOT `contact`.`blocked` OR `contact`.`pending`) - WHERE $sql_table.`uid` = %d AND $sql_table.`visible` AND NOT $sql_table.`deleted` - $sql_extra2 $sql_extra3 - $sql_extra $sql_nets ", - intval($_SESSION['uid']) - ); - - if (dbm::is_result($r)) { - $a->set_pager_total($r[0]['total']); - } - } - // check if we serve a mobile device and get the user settings // accordingly if ($a->is_mobile) { @@ -793,10 +778,8 @@ function network_content(App $a, $update = 0) { if (!$update) { if (get_pconfig(local_user(),'system','infinite_scroll')) { $o .= scroll_loader(); - } elseif (!get_config('system', 'old_pager')) { - $o .= alt_pager($a,count($items)); } else { - $o .= paginate($a); + $o .= alt_pager($a,count($items)); } } diff --git a/mod/profile.php b/mod/profile.php index 5dd8293c7..ab7b7cff7 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -240,23 +240,6 @@ function profile_content(App $a, $update = 0) { $sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2)))); } - if(get_config('system', 'old_pager')) { - $r = q("SELECT COUNT(*) AS `total` - FROM `thread` INNER JOIN `item` ON `item`.`id` = `thread`.`iid` - $sql_post_table INNER JOIN `contact` ON `contact`.`id` = `thread`.`contact-id` - AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - WHERE `thread`.`uid` = %d AND `thread`.`visible` = 1 AND `thread`.`deleted` = 0 - and `thread`.`moderated` = 0 - AND `thread`.`wall` = 1 - $sql_extra $sql_extra2 ", - intval($a->profile['profile_uid']) - ); - - if (dbm::is_result($r)) { - $a->set_pager_total($r[0]['total']); - } - } - // check if we serve a mobile device and get the user settings // accordingly if ($a->is_mobile) { @@ -328,12 +311,8 @@ function profile_content(App $a, $update = 0) { $o .= conversation($a,$items,'profile',$update); - if(! $update) { - if(!get_config('system', 'old_pager')) { - $o .= alt_pager($a,count($items)); - } else { - $o .= paginate($a); - } + if (!$update) { + $o .= alt_pager($a,count($items)); } return $o; diff --git a/view/templates/admin_site.tpl b/view/templates/admin_site.tpl index 2edfddb88..743499370 100644 --- a/view/templates/admin_site.tpl +++ b/view/templates/admin_site.tpl @@ -153,7 +153,6 @@ {{include file="field_input.tpl" field=$itemcache_duration}} {{include file="field_input.tpl" field=$max_comments}} {{include file="field_checkbox.tpl" field=$proxy_disabled}} - {{include file="field_checkbox.tpl" field=$old_pager}}

{{$worker_title}}

From 80e58964ceac470b2571e542e53de2558b3fb499 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 13 Mar 2017 00:09:32 +0000 Subject: [PATCH 2/3] Standard stuff --- include/Contact.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/Contact.php b/include/Contact.php index 3d4d6ded7..85dc1008e 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -717,7 +717,7 @@ function posts_from_gcontact(App $a, $gcontact_id) { $o = conversation($a,$r,'community',false); - $o .= alt_pager($a,count($r)); + $o .= alt_pager($a, count($r)); return $o; } @@ -760,7 +760,7 @@ function posts_from_contact_url(App $a, $contact_url) { $o = conversation($a,$r,'community',false); - $o .= alt_pager($a,count($r)); + $o .= alt_pager($a, count($r)); return $o; } From eb6a6228f752d56e20b897dec8b9525281363ef0 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 13 Mar 2017 05:57:37 +0000 Subject: [PATCH 3/3] more spaces --- include/Contact.php | 4 ++-- mod/community.php | 4 ++-- mod/network.php | 6 +++--- mod/profile.php | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/Contact.php b/include/Contact.php index 85dc1008e..9fd61f8d5 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -715,7 +715,7 @@ function posts_from_gcontact(App $a, $gcontact_id) { intval($a->pager['itemspage']) ); - $o = conversation($a,$r,'community',false); + $o = conversation($a, $r, 'community', false); $o .= alt_pager($a, count($r)); @@ -758,7 +758,7 @@ function posts_from_contact_url(App $a, $contact_url) { intval($a->pager['itemspage']) ); - $o = conversation($a,$r,'community',false); + $o = conversation($a, $r, 'community', false); $o .= alt_pager($a, count($r)); diff --git a/mod/community.php b/mod/community.php index 91b09bba9..174330401 100644 --- a/mod/community.php +++ b/mod/community.php @@ -84,9 +84,9 @@ function community_content(App $a, $update = 0) { // we behave the same in message lists as the search module - $o .= conversation($a,$s,'community',$update); + $o .= conversation($a, $s, 'community', $update); - $o .= alt_pager($a,count($r)); + $o .= alt_pager($a, count($r)); return $o; } diff --git a/mod/network.php b/mod/network.php index 284bf3d96..a1181a74c 100644 --- a/mod/network.php +++ b/mod/network.php @@ -773,13 +773,13 @@ function network_content(App $a, $update = 0) { $mode = (($nouveau) ? 'network-new' : 'network'); - $o .= conversation($a,$items,$mode,$update); + $o .= conversation($a, $items, $mode, $update); if (!$update) { - if (get_pconfig(local_user(),'system','infinite_scroll')) { + if (get_pconfig(local_user(), 'system', 'infinite_scroll')) { $o .= scroll_loader(); } else { - $o .= alt_pager($a,count($items)); + $o .= alt_pager($a, count($items)); } } diff --git a/mod/profile.php b/mod/profile.php index 93f2602e2..fbce509d2 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -318,10 +318,10 @@ function profile_content(App $a, $update = 0) { ); } - $o .= conversation($a,$items,'profile',$update); + $o .= conversation($a, $items, 'profile', $update); if (!$update) { - $o .= alt_pager($a,count($items)); + $o .= alt_pager($a, count($items)); } return $o;