return $o;
}}
+if(! function_exists('alt_pager')) {
+function alt_pager(&$a, $i) {
+ $o = '';
+ $stripped = preg_replace('/(&page=[0-9]*)/','',$a->query_string);
+ $stripped = str_replace('q=','',$stripped);
+ $stripped = trim($stripped,'/');
+ $pagenum = $a->pager['page'];
+ $url = $a->get_baseurl() . '/' . $stripped;
+
+ $o .= '<div class="pager">';
+
+ if($a->pager['page']>1)
+ $o .= "<a href=\"$url"."&page=".($a->pager['page'] - 1).'">' . t('newer') . '</a>';
+ if($i>0) {
+ if($a->pager['page']>1)
+ $o .= " - ";
+ $o .= "<a href=\"$url"."&page=".($a->pager['page'] + 1).'">' . t('older') . '</a>';
+ }
+
+
+ $o .= '</div>'."\r\n";
+
+ return $o;
+}}
+
// Turn user/group ACLs stored as angle bracketed text into arrays
if(! function_exists('expand_acl')) {
// Only public posts can be shown
// OR your own posts if you are a logged in member
+ if(! get_pconfig(local_user(),'system','alt_pager')) {
+ $r = q("SELECT COUNT(distinct(`item`.`uri`)) AS `total`
+ FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
+ 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 AND `user`.`hidewall` = 0
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0"
+ );
+
+ if(count($r))
+ $a->set_pager_total($r[0]['total']);
+
+ if(! $r[0]['total']) {
+ info( t('No results.') . EOL);
+ return $o;
+ }
- $r = q("SELECT COUNT(distinct(`item`.`uri`)) AS `total`
- FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
- 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 AND `user`.`hidewall` = 0
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0"
- );
-
- if(count($r))
- $a->set_pager_total($r[0]['total']);
-
- if(! $r[0]['total']) {
- info( t('No results.') . EOL);
- return $o;
}
$r = q("SELECT distinct(`item`.`uri`), `item`.*, `item`.`id` AS `item_id`,
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
- AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
+ AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
- AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `user`.`hidewall` = 0
+ AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `user`.`hidewall` = 0
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 group by `item`.`uri`
ORDER BY `received` DESC LIMIT %d, %d ",
intval($a->pager['start']),
);
+ if(! count($r)) {
+ info( t('No results.') . EOL);
+ return $o;
+ }
+
// we behave the same in message lists as the search module
$o .= conversation($a,$r,'community',$update);
- $o .= paginate($a);
+ if(! get_pconfig(local_user(),'system','alt_pager')) {
+ $o .= paginate($a);
+ }
+ else {
+ $o .= alt_pager($a,count($r));
+ }
return $o;
}
}
else {
- $r = q("SELECT COUNT(*) AS `total`
- FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
- WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- $sql_extra2 $sql_extra3
- $sql_extra $sql_nets ",
- intval($_SESSION['uid'])
- );
-
- if(count($r)) {
- $a->set_pager_total($r[0]['total']);
- $itemspage_network = get_pconfig(local_user(),'system','itemspage_network');
- $a->set_pager_itemspage(((intval($itemspage_network)) ? $itemspage_network : 40));
- }
- $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
+ if(! get_pconfig(local_user(),'system','alt_pager')) {
+ $r = q("SELECT COUNT(*) AS `total`
+ FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+ WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+ $sql_extra2 $sql_extra3
+ $sql_extra $sql_nets ",
+ intval($_SESSION['uid'])
+ );
+
+ if(count($r)) {
+ $a->set_pager_total($r[0]['total']);
+ }
+ }
+ $itemspage_network = get_pconfig(local_user(),'system','itemspage_network');
+ $a->set_pager_itemspage(((intval($itemspage_network)) ? $itemspage_network : 40));
+ $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
}
$simple_update = (($update) ? " and `item`.`unseen` = 1 " : '');
$o .= conversation($a,$items,$mode,$update);
if(! $update) {
- $o .= paginate($a);
+ if(! get_pconfig(local_user(),'system','alt_pager')) {
+ $o .= paginate($a);
+ }
+ else {
+ $o .= alt_pager($a,count($items));
+ }
}
return $o;
$sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
}
-
- $r = q("SELECT COUNT(*) AS `total`
- FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
- WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
- and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1
- $sql_extra $sql_extra2 ",
- intval($a->profile['profile_uid'])
- );
-
- if(count($r)) {
- $a->set_pager_total($r[0]['total']);
- $a->set_pager_itemspage(40);
+ if(! get_pconfig($a->profile['profile_uid'],'system','alt_pager')) {
+ $r = q("SELECT COUNT(*) AS `total`
+ FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+ WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
+ and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+ AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1
+ $sql_extra $sql_extra2 ",
+ intval($a->profile['profile_uid'])
+ );
+
+ if(count($r)) {
+ $a->set_pager_total($r[0]['total']);
+ }
}
+ $a->set_pager_itemspage(40);
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
$o .= conversation($a,$items,'profile',$update);
if(! $update) {
- $o .= paginate($a);
+ if(! get_pconfig($a->profile['profile_uid'],'system','alt_pager')) {
+ $o .= paginate($a);
+ }
+ else {
+ $o .= alt_pager($a,count($items));
+ }
}
return $o;
// OR your own posts if you are a logged in member
// No items will be shown if the member has a blocked profile wall.
- $r = q("SELECT distinct(`item`.`uri`) as `total`
- FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
- 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 `user`.`hidewall` = 0)
- OR `item`.`uid` = %d )
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- $sql_extra group by `item`.`uri` ",
- intval(local_user())
- );
-
- if(count($r))
- $a->set_pager_total(count($r));
- if(! count($r)) {
- info( t('No results.') . EOL);
- return $o;
+ if(! get_pconfig(local_user(),'system','alt_pager')) {
+ $r = q("SELECT distinct(`item`.`uri`) as `total`
+ FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
+ 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 `user`.`hidewall` = 0)
+ OR `item`.`uid` = %d )
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+ $sql_extra group by `item`.`uri` ",
+ intval(local_user())
+ );
+
+ if(count($r))
+ $a->set_pager_total(count($r));
+
+ if(! count($r)) {
+ info( t('No results.') . EOL);
+ return $o;
+ }
}
$r = q("SELECT distinct(`item`.`uri`), `item`.*, `item`.`id` AS `item_id`,
);
+ if(! count($r)) {
+ info( t('No results.') . EOL);
+ return $o;
+ }
+
+
if($tag)
$o .= '<h2>Items tagged with: ' . $search . '</h2>';
else
$o .= conversation($a,$r,'search',false);
- $o .= paginate($a);
+ if(! get_pconfig(local_user(),'system','alt_pager')) {
+ $o .= paginate($a);
+ }
+ else {
+ $o .= alt_pager($a,count($r));
+ }
return $o;
}