From: Michael Vogel Date: Mon, 9 Dec 2013 23:13:19 +0000 (+0100) Subject: Keeping an offset for page switching: This helps so that you don't see old messages X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7e5c8ab91c0c53910023d1fb50d8001c70f36300;p=friendica.git Keeping an offset for page switching: This helps so that you don't see old messages --- diff --git a/include/text.php b/include/text.php index d41e7689e2..e223071292 100644 --- a/include/text.php +++ b/include/text.php @@ -279,6 +279,9 @@ function paginate_data(&$a, $count=null) { $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); @@ -286,7 +289,6 @@ function paginate_data(&$a, $count=null) { $url = $a->get_baseurl() . '/' . $stripped; - $data = array(); function _l(&$d, $name, $url, $text, $class="") { @@ -307,7 +309,7 @@ function paginate_data(&$a, $count=null) { _l($data, "first", $url."&page=1", t('first')); - + $numpages = $a->pager['total'] / $a->pager['itemspage']; $numstart = 1; @@ -338,11 +340,11 @@ function paginate_data(&$a, $count=null) { $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; @@ -384,14 +386,14 @@ function alt_pager(&$a, $i) { $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 */ diff --git a/index.php b/index.php index e751dcbaf9..26bc800f78 100644 --- a/index.php +++ b/index.php @@ -473,6 +473,10 @@ if ($_GET["mode"] == "raw") { if (($param != "page") AND ($param != "q")) $reload_uri .= "&".$param."=".urlencode($value); + if (($a->page_offset != "") AND !strstr($reload_uri, "&offset=")) + $reload_uri .= "&offset=".urlencode($a->page_offset); + + $a->page['htmlhead'] .= <<< EOT