$stripped = trim($stripped,'/');
$pagenum = $a->pager['page'];
+ if (($a->page_offset != "") AND !strstr($stripped, "&offset="))
+ $stripped .= "&offset=".urlencode($a->page_offset);
+
if (!strstr($stripped, "?")) {
$pos = strpos($stripped, "&");
$stripped = substr($stripped, 0, $pos)."?".substr($stripped, $pos + 1);
$url = $a->get_baseurl() . '/' . $stripped;
-
$data = array();
function _l(&$d, $name, $url, $text, $class="") {
_l($data, "first", $url."&page=1", t('first'));
-
+
$numpages = $a->pager['total'] / $a->pager['itemspage'];
$numstart = 1;
$lastpage = (($numpages > intval($numpages)) ? intval($numpages)+1 : $numpages);
_l($data, "last", $url."&page=$lastpage", t('last'));
-
+
if(($a->pager['total'] - ($a->pager['itemspage'] * $a->pager['page'])) > 0)
_l($data, "next", $url."&page=".($a->pager['page'] + 1), t('next'));
- }
+ }
}
return $data;
$data = paginate_data($a, $i);
$tpl = get_markup_template("paginate.tpl");
return replace_macros($tpl, array('pager' => $data));
-
+
}}
if(! function_exists('expand_acl')) {
/**
* Turn user/group ACLs stored as angle bracketed text into arrays
- *
+ *
* @param string $s
* @return array
*/
$a = get_app();
- $srchurl = '/network?f='
- . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
+ $srchurl = '/network?f='
+ . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
. ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
. ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '')
. ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '')
. ((x($_GET,'cmax')) ? '&cmax=' . $_GET['cmax'] : '')
. ((x($_GET,'file')) ? '&file=' . $_GET['file'] : '');
;
-
+
$o = '';
$r = q("select `id`,`term` from `search` WHERE `uid` = %d",
$spam_active = '';
$postord_active = '';
- if(($a->argc > 1 && $a->argv[1] === 'new')
+ if(($a->argc > 1 && $a->argv[1] === 'new')
|| ($a->argc > 2 && $a->argv[2] === 'new')) {
$new_active = 'active';
}
- if (($new_active == '')
- && ($starred_active == '')
+ if (($new_active == '')
+ && ($starred_active == '')
&& ($bookmarked_active == '')
&& ($conv_active == '')
&& ($search_active == '')
$sql_extra3 = (($nouveau) ? '' : $sql_extra3);
//$sql_order = "`item`.`received`";
$sql_order = "";
+ $order_mode = "received";
if ($sql_table == "")
$sql_table = "`item`";
dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), intval(local_user()));
$sql_order = "`item`.`received`";
+ $order_mode = "received";
} else {
if (get_config('system','use_fulltext_engine'))
$sql_extra = sprintf(" AND MATCH (`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode) ", dbesc(protect_sprintf($search)));
$sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
$sql_order = "`item`.`received`";
+ $order_mode = "received";
}
}
if(strlen($file)) {
// Normal conversation view
- if($order === 'post')
- $ordering = "`created`";
- else
- $ordering = "`commented`";
+ if($order === 'post') {
+ $ordering = "`created`";
+ if ($sql_order == "")
+ $order_mode = "created";
+ } else {
+ $ordering = "`commented`";
+ if ($sql_order == "")
+ $order_mode = "commented";
+ }
if ($sql_order == "")
$sql_order = "`item`.$ordering";
+ if (($_GET["offset"] != ""))
+ $sql_extra3 .= sprintf(" AND $sql_order <= '%s'", dbesc($_GET["offset"]));
+
// Fetch a page full of parent items for this page
if($update) {
$parents_arr = array();
$parents_str = '';
+ $date_offset = "";
if(count($r)) {
foreach($r as $rr)
$items = array();
}
+ if ($_GET["offset"] == "")
+ $date_offset = $items[0][$order_mode];
+ else
+ $date_offset = $_GET["offset"];
+
+ $a->page_offset = $date_offset;
+
if($parents_str)
$update_unseen = ' WHERE uid = ' . intval(local_user()) . ' AND unseen = 1 AND parent IN ( ' . dbesc($parents_str) . ' )';
}