[dokuwiki] My dokuwiki changes (updated)
- From: RM <romanrm@xxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Thu, 19 May 2005 03:12:34 +0600
Hello.
The following is a diff of my dokuwiki tree against the 2005-05-07
release. It seems that people are mailing here prior to making changes
to ask if anyone else is doing the same, but as I already made all
these changes, there is no point in asking, I guess :) Instead, now I
took the time to document each change, and post a diff, given that it
is not too big. Any questions or comments are welcome.
---------------------
diff -Pur -x .cache -x _cache -x rm -x .htaccess -x images -x includes
-x interwiki -x lang -x media -x conf dokuwiki-2005-05-07\doku.php
roshia\wiki\doku.php
--- dokuwiki-2005-05-07\doku.php Sat May 07 15:22:56 2005
+++ roshia\wiki\doku.php Thu May 19 02:27:29 2005
@@ -8,6 +8,10 @@
// xdebug_start_profiling();
+ // Enable gzip output compression, if it's not enabled yet.
+ // Also fixes the problem with unicode wiki config file, and the
BOM mark as its first character.
+ ob_start('ob_gzhandler');
+
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__)).'/');
require_once(DOKU_INC.'inc/init.php');
require_once(DOKU_INC.'inc/common.php');
@@ -47,12 +51,13 @@
//set default #FIXME not needed here? done in actions?
if(empty($ACT)) $ACT = 'show';
-
+// I believe the following is a security hole and should be disabled.
+/*
if($ACT == 'debug'){
html_debug();
exit;
}
-
+*/
//make infos about the selected page available
$INFO = pageinfo();
diff -Pur -x .cache -x _cache -x rm -x .htaccess -x images -x includes
-x interwiki -x lang -x media -x conf dokuwiki-2005-05-07\feed.php
roshia\wiki\feed.php
--- dokuwiki-2005-05-07\feed.php Sat May 07 15:22:56 2005
+++ roshia\wiki\feed.php Thu May 19 02:37:41 2005
@@ -6,6 +6,10 @@
* @author Andreas Gohr <andi@xxxxxxxxxxxxxx>
*/
+ // Enable gzip output compression, if it's not enabled yet.
+ // Also fixes the problem with unicode wiki config file, and the
BOM mark as its first character.
+ ob_start('ob_gzhandler');
+
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__)).'/');
require_once(DOKU_INC.'inc/init.php');
require_once(DOKU_INC.'inc/common.php');
@@ -103,11 +107,15 @@
$item->category = substr($id,0,strrpos($id,':'));
}
if($recents[$id]['user']){
- $item->author = $recents[$id]['user'].'@';
+ $item->author = $recents[$id]['user'];
+ // An experimental option to show or hide registered users' IPs
(perhaps obsolete now)
+ if($conf['rm_show_registered_user_ips']){
+ $item->author .= '@'.$recents[$id]['ip'];
+ }
}else{
- $item->author = 'anonymous@';
+ $item->author = 'anonymous@'.$recents[$id]['ip'];
}
- $item->author .= $recents[$id]['ip'];
+
$rss->addItem($item);
//this can take some time if a lot of recaching has to be done
diff -Pur -x .cache -x _cache -x rm -x .htaccess -x images -x includes
-x interwiki -x lang -x media -x conf
dokuwiki-2005-05-07\inc\actions.php roshia\wiki\inc\actions.php
--- dokuwiki-2005-05-07\inc\actions.php Sat May 07 15:22:56 2005
+++ roshia\wiki\inc\actions.php Thu May 19 02:53:53 2005
@@ -166,7 +166,11 @@
//show it
session_write_close();
- header("Location: ".wl($ID,'',true));
+ // Add an unique parameter so that browser does not show
+ // a cached (unedited) version of the page.
+ // Also, change absolute redirect URL to relative, to make it
+ // work correctly with Firefox and International Domain Names.
+ header("Location: ".wl($ID,'',false).'?nocache='.time());
exit();
}
diff -Pur -x .cache -x _cache -x rm -x .htaccess -x images -x includes
-x interwiki -x lang -x media -x conf
dokuwiki-2005-05-07\inc\auth_plain.php roshia\wiki\inc\auth_plain.php
--- dokuwiki-2005-05-07\inc\auth_plain.php Sat May 07 15:22:54 2005
+++ roshia\wiki\inc\auth_plain.php Thu May 19 02:34:20 2005
@@ -107,7 +107,9 @@
$groups = split(",",$row[4]);
$data[$row[0]]['pass'] = $row[1];
$data[$row[0]]['name'] = urldecode($row[2]);
- $data[$row[0]]['mail'] = $row[3];
+ // It is now possible to specify a wiki pagename separated by slash
+ // (e.g. namespace/page) instead of users' E-Mail address
+ $data[$row[0]]['mail'] = str_replace('/', ':', $row[3]);
$data[$row[0]]['grps'] = $groups;
}
return $data;
diff -Pur -x .cache -x _cache -x rm -x .htaccess -x images -x includes
-x interwiki -x lang -x media -x conf
dokuwiki-2005-05-07\inc\common.php roshia\wiki\inc\common.php
--- dokuwiki-2005-05-07\inc\common.php Sat May 07 15:22:56 2005
+++ roshia\wiki\inc\common.php Thu May 19 02:37:29 2005
@@ -66,8 +66,13 @@
$info['ip'] = $revinfo['ip'];
$info['user'] = $revinfo['user'];
$info['sum'] = $revinfo['sum'];
- $info['editor'] = $revinfo['ip'];
- if($revinfo['user']) $info['editor'].= ' ('.$revinfo['user'].')';
+ // An experimental option to show or hide registered users' IPs
(perhaps obsolete now)
+ if($conf['rm_show_registered_user_ips']||!$revinfo['user']){
+ $info['editor'] = $revinfo['ip'];
+ if($revinfo['user']) $info['editor'].= ' ('.$revinfo['user'].')';
+ } else {
+ $info['editor'] = $revinfo['user'];
+ }
return $info;
}
@@ -636,7 +641,12 @@
}
$text = str_replace('@DIFF@',$diff,$text);
- mail_send($conf['notify'],$subject,$text,$conf['mailfrom']);
+ // I have made the $conf['notify'] option to be an array,
+ // so that notification can be sent to several addresses at once.
+ // Also, the "From" field will contain name of the user who
changed/added a page.
+ foreach($conf['notify'] as $address){
+
mail_send($address,$subject,$text,$_SERVER['REMOTE_USER'].'<'.$conf['mailfrom'].'>');
+ }
}
/**
diff -Pur -x .cache -x _cache -x rm -x .htaccess -x images -x includes
-x interwiki -x lang -x media -x conf dokuwiki-2005-05-07\inc\html.php
roshia\wiki\inc\html.php
--- dokuwiki-2005-05-07\inc\html.php Sat May 07 15:22:56 2005
+++ roshia\wiki\inc\html.php Thu May 19 02:38:11 2005
@@ -406,8 +406,9 @@
print $INFO['sum'];
print ' <span class="user">(';
- print $INFO['ip'];
- if($INFO['user']) print ' '.$INFO['user'];
+ // An experimental option to show or hide registered users' IPs
(perhaps obsolete now)
+ if($conf['rm_show_registered_user_ips']||!$INFO['user']) print
$INFO['ip'].' ';
+ if($INFO['user']) print $INFO['user'];
print ')</span> ';
print '('.$lang['current'].')';
@@ -430,7 +431,8 @@
print htmlspecialchars($info['sum']);
print ' <span class="user">(';
- print $info['ip'];
+ // An experimental option to show or hide registered users' IPs
(perhaps obsolete now)
+ if($conf['rm_show_registered_user_ips']||!$info['user']) print $info['ip'];
if($info['user']) print ' '.$info['user'];
print ')</span>';
@@ -469,8 +471,9 @@
print ' '.htmlspecialchars($recents[$id]['sum']);
print ' <span class="user">(';
- print $recents[$id]['ip'];
- if($recents[$id]['user']) print ' '.$recents[$id]['user'];
+ // An experimental option to show or hide registered users' IPs
(perhaps obsolete now)
+ if($conf['rm_show_registered_user_ips']||!$recents[$id]['user'])
print $recents[$id]['ip'].' ';
+ if($recents[$id]['user']) print $recents[$id]['user'];
print ')</span>';
print '</li>';
diff -Pur -x .cache -x _cache -x rm -x .htaccess -x images -x includes
-x interwiki -x lang -x media -x conf dokuwiki-2005-05-07\inc\init.php
roshia\wiki\inc\init.php
--- dokuwiki-2005-05-07\inc\init.php Sat May 07 15:22:56 2005
+++ roshia\wiki\inc\init.php Thu May 19 03:11:07 2005
@@ -35,6 +35,13 @@
// init session
session_name("DokuWiki");
+
+ // Enable session control caching, as described in
http://bugs.splitbrain.org/index.php?do=details&id=94
+ // After adding an unique parameter to the redirect after page
edit, this change causes no problems.
+ session_cache_limiter('private');
+ // Limit the cache lifetime to 2 minutes (perhaps this should be
made an option in the config).
+ session_cache_expire(2);
+
if (!headers_sent()) session_start();
// kill magic quotes
diff -Pur -x .cache -x _cache -x rm -x .htaccess -x images -x includes
-x interwiki -x lang -x media -x conf
dokuwiki-2005-05-07\inc\parser\handler.php
roshia\wiki\inc\parser\handler.php
--- dokuwiki-2005-05-07\inc\parser\handler.php Sat May 07 15:22:56 2005
+++ roshia\wiki\inc\parser\handler.php Thu May 19 02:41:13 2005
@@ -562,12 +562,16 @@
}
//get caching command
- if (preg_match('/(nocache|recache)/i',$param,$cachemode)){
- $cache = $cachemode[1];
- }else{
- $cache = 'cache';
+ // Added an experimental option to globally disable image caching
+ if ($conf['rm_dont_cache_images']==true){
+ $cache = 'nocache';
+ } else {
+ if (preg_match('/(nocache|recache)/i',$param,$cachemode)){
+ $cache = $cachemode[1];
+ }else{
+ $cache = 'cache';
+ }
}
-
// Check whether this is a local or remote image
if ( preg_match('#^(https?|ftp)#i',$src) ) {
$call = 'externalmedia';
diff -Pur -x .cache -x _cache -x rm -x .htaccess -x images -x includes
-x interwiki -x lang -x media -x conf
dokuwiki-2005-05-07\inc\parser\xhtml.php
roshia\wiki\inc\parser\xhtml.php
--- dokuwiki-2005-05-07\inc\parser\xhtml.php Thu May 19 02:45:09 2005
+++ roshia\wiki\inc\parser\xhtml.php Thu May 19 02:46:36 2005
@@ -692,7 +692,7 @@
$link['target'] = $conf['target']['media'];
$link['title'] = $this->_xmlEntities($src);
- $link['url'] =
DOKU_BASE.'fetch.php?cache='.$cache.'&media='.urlencode($src);
+ $link['url'] = $this->_mediaLink($src);
$link['name'] = $this->_media ($src, $title, $align,
$width, $height, $cache);
@@ -716,7 +716,7 @@
$link['target'] = $conf['target']['media'];
$link['title'] = $this->_xmlEntities($src);
- $link['url'] =
DOKU_BASE.'fetch.php?cache='.$cache.'&media='.urlencode($src);
+ $link['url'] = $this->_mediaLink($src);
$link['name'] = $this->_media ($src, $title, $align,
$width, $height, $cache);
@@ -863,16 +863,25 @@
*
* @author Andreas Gohr <andi@xxxxxxxxxxxxxx>
*/
+ // Media handling is hacked to get pre-20050507 behavior back.
+ //
+ // I really do NOT like when my server has to become some kind
+ // of a caching proxy for all externally linked images. Also,
passing all images
+ // through fetch.php could have performance issues and probably
will break client-side caching.
+ //
+ // I am not really sure that these "hackbacks" work correctly in
ALL cases, but for what we
+ // have in the wiki currently, they do.
+ //
+ // -- RM
function _media ($src, $title=NULL, $align=NULL, $width=NULL,
$height=NULL, $cache=NULL) {
$ret = '';
- list($ext,$mime) = mimetype($src);
+ list($ext,$mime) = mimetype($this->_mediaLink($src));
if(substr($mime,0,5) == 'image'){
//add image tag
- $ret .= '<img
src="'.DOKU_BASE.'fetch.php?w='.$width.'&h='.$height.
- '&cache='.$cache.'&media='.urlencode($src).'"';
+ $ret .= '<img src="'.$this->_mediaLink($src).'"';
$ret .= ' class="media'.$align.'"';
@@ -897,9 +906,9 @@
if ( !is_null($width) ) $ret .= '
width="'.$this->_xmlEntities($width).'"';
if ( !is_null($height) ) $ret .= '
height="'.$this->_xmlEntities($height).'"';
$ret .= '>'.DOKU_LF;
- $ret .= '<param name="movie"
value="'.DOKU_BASE.'fetch.php?media='.urlencode($src).'" />'.DOKU_LF;
+ $ret .= '<param name="movie"
value="'.$this->_mediaLink($src).'" />'.DOKU_LF;
$ret .= '<param name="quality" value="high" />'.DOKU_LF;
- $ret .= '<embed
src="'.DOKU_BASE.'fetch.php?media='.urlencode($src).'"'.
+ $ret .= '<embed src="'.$this->_mediaLink($src).'"'.
' quality="high"';
if ( !is_null($width) ) $ret .= '
width="'.$this->_xmlEntities($width).'"';
if ( !is_null($height) ) $ret .= '
height="'.$this->_xmlEntities($height).'"';
@@ -917,7 +926,21 @@
return $ret;
}
-
+
+ function _mediaLink($wikiname) {
+ //created by RM, 2005-05-07
+ global $conf;
+ $filename = $wikiname;
+ if(strpos($wikiname,'http://')===0){
+ // do nothing
+ } else {
+ $filename = preg_replace('/\.{2,}/','/\./',$filename);
+ $filename = str_replace(':','/',$filename);
+ $filename = $conf['mediawebdir'].'/'.$filename;
+ }
+ return $filename;
+ }
+
function _newFootnoteId() {
static $id = 1;
return $id++;
diff -Pur -x .cache -x _cache -x rm -x .htaccess -x images -x includes
-x interwiki -x lang -x media -x conf
dokuwiki-2005-05-07\inc\parserutils.php
roshia\wiki\inc\parserutils.php
--- dokuwiki-2005-05-07\inc\parserutils.php Sat May 07 15:22:56 2005
+++ roshia\wiki\inc\parserutils.php Thu May 19 02:40:33 2005
@@ -86,7 +86,9 @@
{
//well then use the cache
$parsed = io_readfile($cache);
- $parsed .= "\n<!-- cachefile $cache used -->\n";
+ // Fix for a strange bug, where certain string in file pathname was
+ // preventing the browser from "seeing" the comment's closing tag. :-/
+ $parsed .= "\n<!-- cachefile used -->\n";
}else{
$parsed = p_render('xhtml', p_cached_instructions($file),$info);
//try to use cached instructions
diff -Pur -x .cache -x _cache -x rm -x .htaccess -x images -x includes
-x interwiki -x lang -x media -x conf dokuwiki-2005-05-07\index.php
roshia\wiki\index.php
--- dokuwiki-2005-05-07\index.php Sat May 07 15:22:52 2005
+++ roshia\wiki\index.php Thu May 19 02:31:12 2005
@@ -5,5 +5,8 @@
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Andreas Gohr <andi@xxxxxxxxxxxxxx>
*/
-header("Location: doku.php");
+
+// I do not want anyone to see or add to the bookmarks the URL ending
with "...doku.php"
+// Let it redirect to the start page instead (works only with
mod_rewrite configured).
+header("Location: start");
?>
---------------------
--
With Respect,
Roman
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
Other related posts: