summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/common.php5
-rw-r--r--inc/html.php29
-rw-r--r--inc/template.php4
3 files changed, 33 insertions, 5 deletions
diff --git a/inc/common.php b/inc/common.php
index 728319e09..775071b7f 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -476,6 +476,9 @@ function addLogEntry($date,$id,$summary=""){
/**
* returns an array of recently changed files using the
* changelog
+ * num : return 'num' entries
+ * num = 0: return count of entries set by $conf['recent']
+ * num = -1: return all available entries
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
@@ -507,7 +510,7 @@ function getRecents($num=0,$incdel=false){
$recent[$info[2]]['sum'] = $info[4];
$recent[$info[2]]['del'] = !@file_exists(wikiFN($info[2]));
}
- if(count($recent) >= $num){
+ if($num != -1 && count($recent) >= $num){
break; //finish if enough items found
}
}
diff --git a/inc/html.php b/inc/html.php
index 370754c52..c9b1539f1 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -447,14 +447,22 @@ function html_revisions(){
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function html_recent(){
+function html_recent($first=0){
global $conf;
global $lang;
- $recents = getRecents(0,true);
+ $recents = getRecents(-1,true);
+
+ if($first >= count($recents)) $first = 0;
+ $last = $first + $conf['recent'];
+ if ($last > count($recents))
+ $last = count($recents);
print p_locale_xhtml('recent');
print '<ul>';
- foreach(array_keys($recents) as $id){
+
+ $keys = array_keys($recents);
+ for ($n=$first; $n < $last; $n++){
+ $id = $keys[$n];
$date = date($conf['dformat'],$recents[$id]['date']);
print '<li>';
@@ -482,6 +490,21 @@ function html_recent(){
print '</li>';
}
print '</ul>';
+
+ print '<div class="pagenav">';
+ if ($first > 0) {
+ $first -= $conf['recent'];
+ if ($first < 0) $first = 0;
+ print '<div class="pagenav-prev">';
+ print html_btn('prevpage','',"p",array('do' => 'recent', 'first' => $first));
+ print '</div>';
+ }
+ if ($last < count($recents)) {
+ print '<div class="pagenav-next">';
+ print html_btn('nextpage','',"n",array('do' => 'recent', 'first' => $last));
+ print '</div>';
+ }
+ print '</div>';
}
/**
diff --git a/inc/template.php b/inc/template.php
index f76e48108..a5e656443 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -75,7 +75,9 @@ function tpl_content(){
html_diff();
break;
case 'recent':
- html_recent();
+ $first = $_REQUEST['first'];
+ if(empty($first)) $first=0;
+ html_recent($first);
break;
case 'index':
html_index($IDX); #FIXME can this be pulled from globals? is it sanitized correctly?