summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEsther Brunner <esther@kaffeehaus.ch>2005-08-30 22:21:15 +0200
committerEsther Brunner <esther@kaffeehaus.ch>2005-08-30 22:21:15 +0200
commitdbb00abcfb0db727767b60293e390e4adc959398 (patch)
treeb0a1d136ba6cbf3aca24b55c4cd8800e5f8d82af
parenta15ce62dba2e46a5754ac7f4c603661dd98a429a (diff)
downloadrpg-dbb00abcfb0db727767b60293e390e4adc959398.tar.gz
rpg-dbb00abcfb0db727767b60293e390e4adc959398.tar.bz2
Namespace filtering for recent changes
darcs-hash:20050830202115-283c4-2a186854aa11e2e6e5a12da39dcd90c8723e2c90.gz
-rw-r--r--feed.php10
-rw-r--r--inc/common.php14
-rw-r--r--inc/html.php6
3 files changed, 13 insertions, 17 deletions
diff --git a/feed.php b/feed.php
index 521f9b968..ddeea4a83 100644
--- a/feed.php
+++ b/feed.php
@@ -52,7 +52,7 @@
// create new feed
$rss = new DokuWikiFeedCreator();
- $rss->title = $conf['title'];
+ $rss->title = $conf['title'].(($ns) ? ' '.$ns : '');
$rss->link = DOKU_URL;
$rss->syndicationURL = DOKU_URL.'feed.php';
$rss->cssStyleSheet = DOKU_URL.'lib/styles/feed.css';
@@ -66,7 +66,7 @@
if($mode == 'list'){
rssListNamespace($rss,$ns);
}else{
- rssRecentChanges($rss,$num,$ltype);
+ rssRecentChanges($rss,$num,$ltype,$ns);
}
$feed = $rss->createFeed($type,'utf-8');
@@ -85,11 +85,11 @@
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function rssRecentChanges(&$rss,$num,$ltype){
+function rssRecentChanges(&$rss,$num,$ltype,$ns){
global $conf;
- if(!$num) $num = $conf['recent'];
+ if(!$num) $num = $conf['recent'];
- $recents = getRecents(0,$num);
+ $recents = getRecents(0,$num,false,$ns);
//this can take some time if a lot of recaching has to be done
@set_time_limit(90); // set max execution time
diff --git a/inc/common.php b/inc/common.php
index 99fa381bc..c478fb35a 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -582,7 +582,6 @@ function dbg($msg,$hidden=false){
*/
function addLogEntry($date,$id,$summary=""){
global $conf;
- $id = cleanID($id);//FIXME not needed anymore?
if(!@is_writable($conf['changelog'])){
msg($conf['changelog'].' is not writable!',-1);
@@ -594,13 +593,7 @@ function addLogEntry($date,$id,$summary=""){
$user = $_SERVER['REMOTE_USER'];
$logline = join("\t",array($date,$remote,$id,$user,$summary))."\n";
-
- //FIXME: use adjusted io_saveFile instead
- $fh = fopen($conf['changelog'],'a');
- if($fh){
- fwrite($fh,$logline);
- fclose($fh);
- }
+ io_saveFile($conf['changelog'],$logline,true);
}
/**
@@ -611,7 +604,7 @@ function addLogEntry($date,$id,$summary=""){
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function getRecents($first,$num,$incdel=false){
+function getRecents($first,$num,$incdel=false,$ns=''){
global $conf;
$recent = array();
$names = array();
@@ -636,6 +629,9 @@ function getRecents($first,$num,$incdel=false){
(@file_exists(wikiFN($info[2])) || $incdel) &&
(auth_quickaclcheck($info[2]) >= AUTH_READ)
){
+ // filter namespace
+ if (($ns) && (strpos($info[2],$ns.':') !== 0)) continue;
+
$names[$info[2]] = 1;
if(--$first >= 0) continue; /* skip "first" entries */
diff --git a/inc/html.php b/inc/html.php
index 3078ff838..dcd11feb1 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -450,15 +450,15 @@ function html_revisions(){
function html_recent($first=0){
global $conf;
global $lang;
-
+ global $ID;
/* we need to get one additionally log entry to be able to
* decide if this is the last page or is there another one.
* This is the cheapest solution to get this information.
*/
- $recents = getRecents($first,$conf['recent'] + 1,true);
+ $recents = getRecents($first,$conf['recent'] + 1,true,getNS($ID));
if(count($recents) == 0 && $first != 0){
$first=0;
- $recents = getRecents(0,$conf['recent'] + 1,true);
+ $recents = getRecents(0,$conf['recent'] + 1,true,getNS($ID));
}
$cnt = count($recents) <= $conf['recent'] ? count($recents) : $conf['recent'];