diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/FeedParser.php | 2 | ||||
-rw-r--r-- | inc/HTTPClient.php | 2 | ||||
-rw-r--r-- | inc/JSON.php | 2 | ||||
-rw-r--r-- | inc/JpegMeta.php | 2 | ||||
-rw-r--r-- | inc/actions.php | 2 | ||||
-rw-r--r-- | inc/auth.php | 2 | ||||
-rw-r--r-- | inc/cache.php | 2 | ||||
-rw-r--r-- | inc/cliopts.php | 4 | ||||
-rw-r--r-- | inc/common.php | 6 | ||||
-rw-r--r-- | inc/confutils.php | 2 | ||||
-rw-r--r-- | inc/events.php | 2 | ||||
-rw-r--r-- | inc/form.php | 2 | ||||
-rw-r--r-- | inc/fulltext.php | 2 | ||||
-rw-r--r-- | inc/html.php | 2 | ||||
-rw-r--r-- | inc/indexer.php | 2 | ||||
-rw-r--r-- | inc/infoutils.php | 2 | ||||
-rw-r--r-- | inc/init.php | 46 | ||||
-rw-r--r-- | inc/io.php | 4 | ||||
-rw-r--r-- | inc/mail.php | 2 | ||||
-rw-r--r-- | inc/media.php | 2 | ||||
-rw-r--r-- | inc/parser/handler.php | 2 | ||||
-rw-r--r-- | inc/parser/lexer.php | 2 | ||||
-rw-r--r-- | inc/parser/metadata.php | 2 | ||||
-rw-r--r-- | inc/parser/parser.php | 2 | ||||
-rw-r--r-- | inc/parser/renderer.php | 2 | ||||
-rw-r--r-- | inc/parser/xhtml.php | 2 | ||||
-rw-r--r-- | inc/parser/xhtmlsummary.php | 2 | ||||
-rw-r--r-- | inc/parserutils.php | 2 | ||||
-rw-r--r-- | inc/search.php | 2 | ||||
-rw-r--r-- | inc/template.php | 6 | ||||
-rw-r--r-- | inc/toolbar.php | 2 |
31 files changed, 79 insertions, 39 deletions
diff --git a/inc/FeedParser.php b/inc/FeedParser.php index 867392add..386d7c3f4 100644 --- a/inc/FeedParser.php +++ b/inc/FeedParser.php @@ -5,7 +5,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_INC.'inc/HTTPClient.php'); require_once(DOKU_INC.'inc/SimplePie.php'); diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index 26edeb491..23a376c39 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -6,7 +6,7 @@ * @author Andreas Goetz <cpuidle@gmx.de> */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_CONF.'dokuwiki.php'); define('HTTP_NL',"\r\n"); diff --git a/inc/JSON.php b/inc/JSON.php index 09a837da7..380b064cb 100644 --- a/inc/JSON.php +++ b/inc/JSON.php @@ -58,7 +58,7 @@ */ // for DokuWiki -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_INC.'inc/utf8.php'); /** diff --git a/inc/JpegMeta.php b/inc/JpegMeta.php index 1b57ccd05..6d61ad54c 100644 --- a/inc/JpegMeta.php +++ b/inc/JpegMeta.php @@ -1196,7 +1196,7 @@ class JpegMeta if (file_exists($this->_fileName)) { $this->_info['file'] = array(); $this->_info['file']['Name'] = basename($this->_fileName); - $this->_info['file']['Path'] = realpath($this->_fileName); + $this->_info['file']['Path'] = fullpath($this->_fileName); $this->_info['file']['Size'] = filesize($this->_fileName); if ($this->_info['file']['Size'] < 1024) { $this->_info['file']['NiceSize'] = $this->_info['file']['Size'] . 'B'; diff --git a/inc/actions.php b/inc/actions.php index 7330c8d95..653910fe0 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -6,7 +6,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ - if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_INC.'inc/template.php'); diff --git a/inc/auth.php b/inc/auth.php index 3e5362a41..0a6b1cb76 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -9,7 +9,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ - if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_INC.'inc/common.php'); require_once(DOKU_INC.'inc/io.php'); diff --git a/inc/cache.php b/inc/cache.php index a3b16d974..2c43da5ff 100644 --- a/inc/cache.php +++ b/inc/cache.php @@ -6,7 +6,7 @@ * @author Chris Smith <chris@jalakai.co.uk> */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_INC.'inc/io.php'); require_once(DOKU_INC.'inc/pageutils.php'); diff --git a/inc/cliopts.php b/inc/cliopts.php index 06167b0bd..6ca8de748 100644 --- a/inc/cliopts.php +++ b/inc/cliopts.php @@ -20,7 +20,7 @@ // +----------------------------------------------------------------------+ // -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); //------------------------------------------------------------------------------ /** @@ -86,7 +86,7 @@ define('DOKU_CLI_OPTS_ARG_READ',5);//Could not read argv } // Compatibility between "php extensions.php" and "./extensions.php" - if ( realpath($_SERVER['argv'][0]) == $bin_file ) { + if ( fullpath($_SERVER['argv'][0]) == $bin_file ) { $options = Doku_Cli_Opts::getOpt($args,$short_options,$long_options); } else { $options = Doku_Cli_Opts::getOpt2($args,$short_options,$long_options); diff --git a/inc/common.php b/inc/common.php index 73e8e9369..18fad2120 100644 --- a/inc/common.php +++ b/inc/common.php @@ -6,7 +6,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_CONF.'dokuwiki.php'); require_once(DOKU_INC.'inc/io.php'); require_once(DOKU_INC.'inc/changelog.php'); @@ -136,7 +136,7 @@ function pageinfo(){ $info['namespace'] = getNS($ID); $info['locked'] = checklock($ID); - $info['filepath'] = realpath(wikiFN($ID)); + $info['filepath'] = fullpath(wikiFN($ID)); $info['exists'] = @file_exists($info['filepath']); if($REV){ //check if current revision was meant @@ -144,7 +144,7 @@ function pageinfo(){ $REV = ''; }else{ //really use old revision - $info['filepath'] = realpath(wikiFN($ID,$REV)); + $info['filepath'] = fullpath(wikiFN($ID,$REV)); $info['exists'] = @file_exists($info['filepath']); } } diff --git a/inc/confutils.php b/inc/confutils.php index c668e8066..8133dc209 100644 --- a/inc/confutils.php +++ b/inc/confutils.php @@ -6,7 +6,7 @@ * @author Harry Fuecks <hfuecks@gmail.com> */ - if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); /** * Returns the (known) extension and mimetype of a given filename diff --git a/inc/events.php b/inc/events.php index 5caba5cff..b87bbadbc 100644 --- a/inc/events.php +++ b/inc/events.php @@ -6,7 +6,7 @@ * @author Christopher Smith <chris@jalakai.co.uk> */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_INC.'inc/pluginutils.php'); class Doku_Event { diff --git a/inc/form.php b/inc/form.php index 4e210ab07..e03591e88 100644 --- a/inc/form.php +++ b/inc/form.php @@ -6,7 +6,7 @@ * @author Tom N Harris <tnharris@whoopdedo.org> */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); if(!defined('NL')) define('NL',"\n"); require_once(DOKU_INC.'inc/html.php'); diff --git a/inc/fulltext.php b/inc/fulltext.php index 59a469362..fd83a8c05 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -6,7 +6,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ - if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_INC.'inc/indexer.php'); diff --git a/inc/html.php b/inc/html.php index 4c92060eb..74ec1cd64 100644 --- a/inc/html.php +++ b/inc/html.php @@ -6,7 +6,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); if(!defined('NL')) define('NL',"\n"); require_once(DOKU_INC.'inc/parserutils.php'); require_once(DOKU_INC.'inc/form.php'); diff --git a/inc/indexer.php b/inc/indexer.php index ca446827d..bc92a9a83 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -6,7 +6,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ - if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_CONF.'dokuwiki.php'); require_once(DOKU_INC.'inc/io.php'); require_once(DOKU_INC.'inc/utf8.php'); diff --git a/inc/infoutils.php b/inc/infoutils.php index 6da344d81..f08acb318 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -5,7 +5,7 @@ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Andreas Gohr <andi@splitbrain.org> */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); if(!defined('DOKU_MESSAGEURL')) define('DOKU_MESSAGEURL','http://update.dokuwiki.org/check/'); require_once(DOKU_INC.'inc/HTTPClient.php'); diff --git a/inc/init.php b/inc/init.php index 416b117eb..f96997f21 100644 --- a/inc/init.php +++ b/inc/init.php @@ -11,7 +11,7 @@ define('DOKU_START_TIME', delta_time()); // define the include path - if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); // define config path (packagers may want to change this to /etc/dokuwiki/) if(!defined('DOKU_CONF')) define('DOKU_CONF',DOKU_INC.'conf/'); @@ -201,9 +201,9 @@ function init_files(){ */ function init_path($path){ // check existance - $p = realpath($path); + $p = fullpath($path); if(!@file_exists($p)){ - $p = realpath(DOKU_INC.$path); + $p = fullpath(DOKU_INC.$path); if(!@file_exists($p)){ return ''; } @@ -400,4 +400,44 @@ EOT; } +/** + * A realpath() replacement + * + * This function behaves similar to PHP's realpath() but does not resolve + * symlinks or accesses upper directories + * + * @author <richpageau at yahoo dot co dot uk> + * @link http://de3.php.net/manual/en/function.realpath.php#75992 + */ +function fullpath($path){ + + // check if path begins with "/" ie. is absolute + // if it isnt concat with script path + if (strpos($path,"/") !== 0) { + $base=dirname($_SERVER['SCRIPT_FILENAME']); + $path=$base."/".$path; + } + + // canonicalize + $path=explode('/', $path); + $newpath=array(); + for ($i=0; $i<sizeof($path); $i++) { + if ($path[$i]==='' || $path[$i]==='.') continue; + if ($path[$i]==='..') { + array_pop($newpath); + continue; + } + array_push($newpath, $path[$i]); + } + $finalpath="/".implode('/', $newpath); + + // check then return valid path or filename + if (file_exists($finalpath)) { + return ($finalpath); + } + else return false; +} + + + //Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/inc/io.php b/inc/io.php index e097dce69..f23a9a544 100644 --- a/inc/io.php +++ b/inc/io.php @@ -6,7 +6,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ - if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_INC.'inc/common.php'); require_once(DOKU_INC.'inc/HTTPClient.php'); require_once(DOKU_INC.'inc/events.php'); @@ -385,7 +385,7 @@ function io_mkdir_p($target){ //recursion if (io_mkdir_p(substr($target,0,strrpos($target,'/')))){ if($conf['safemodehack']){ - $dir = preg_replace('/^'.preg_quote(realpath($conf['ftp']['root']),'/').'/','', $target); + $dir = preg_replace('/^'.preg_quote(fullpath($conf['ftp']['root']),'/').'/','', $target); return io_mkdir_ftp($dir); }else{ $ret = @mkdir($target,$conf['dmode']); // crawl back up & create dir tree diff --git a/inc/mail.php b/inc/mail.php index a75aeefc4..9a2ae96c7 100644 --- a/inc/mail.php +++ b/inc/mail.php @@ -6,7 +6,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ - if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_INC.'inc/utf8.php'); // end of line for mail lines - RFC822 says CRLF but postfix (and other MTAs?) diff --git a/inc/media.php b/inc/media.php index c1bee133a..e08bd569a 100644 --- a/inc/media.php +++ b/inc/media.php @@ -6,7 +6,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); if(!defined('NL')) define('NL',"\n"); require_once(DOKU_INC.'inc/html.php'); diff --git a/inc/parser/handler.php b/inc/parser/handler.php index 9716bd74f..740ccea04 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -1,5 +1,5 @@ <?php -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../../').'/'); class Doku_Handler { diff --git a/inc/parser/lexer.php b/inc/parser/lexer.php index 2175e6786..0887dde93 100644 --- a/inc/parser/lexer.php +++ b/inc/parser/lexer.php @@ -13,7 +13,7 @@ /** * Init path constant */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../../').'/'); /**#@+ * lexer mode constant diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php index 20a37ff18..f3cea82cd 100644 --- a/inc/parser/metadata.php +++ b/inc/parser/metadata.php @@ -5,7 +5,7 @@ * @author Esther Brunner <wikidesign@gmail.com> */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../../').'/'); if ( !defined('DOKU_LF') ) { // Some whitespace to help View > Source diff --git a/inc/parser/parser.php b/inc/parser/parser.php index 849c6f0ea..89ce4313d 100644 --- a/inc/parser/parser.php +++ b/inc/parser/parser.php @@ -1,6 +1,6 @@ <?php -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../../').'/'); require_once DOKU_INC . 'inc/parser/lexer.php'; require_once DOKU_INC . 'inc/parser/handler.php'; diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index dd4974f0d..aa4da9dc1 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -5,7 +5,7 @@ * @author Harry Fuecks <hfuecks@gmail.com> * @author Andreas Gohr <andi@splitbrain.org> */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../../').'/'); require_once DOKU_INC . 'inc/parser/renderer.php'; require_once DOKU_INC . 'inc/plugin.php'; diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 7279844f9..7b3e0cf9b 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -6,7 +6,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../../').'/'); if ( !defined('DOKU_LF') ) { // Some whitespace to help View > Source diff --git a/inc/parser/xhtmlsummary.php b/inc/parser/xhtmlsummary.php index b82c564ed..2992b2a23 100644 --- a/inc/parser/xhtmlsummary.php +++ b/inc/parser/xhtmlsummary.php @@ -1,5 +1,5 @@ <?php -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../../').'/'); require_once DOKU_INC . 'inc/parser/xhtml.php'; diff --git a/inc/parserutils.php b/inc/parserutils.php index 7078161e3..ceaef2f65 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -7,7 +7,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ - if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_INC.'inc/confutils.php'); require_once(DOKU_INC.'inc/pageutils.php'); diff --git a/inc/search.php b/inc/search.php index a41125f61..584e684ff 100644 --- a/inc/search.php +++ b/inc/search.php @@ -6,7 +6,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ - if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_INC.'inc/common.php'); /** diff --git a/inc/template.php b/inc/template.php index 10719c08c..5879d98db 100644 --- a/inc/template.php +++ b/inc/template.php @@ -6,7 +6,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ - if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_CONF.'dokuwiki.php'); /** @@ -859,9 +859,9 @@ function tpl_pageinfo(){ $fn = $INFO['filepath']; if(!$conf['fullpath']){ if($REV){ - $fn = str_replace(realpath($conf['olddir']).DIRECTORY_SEPARATOR,'',$fn); + $fn = str_replace(fullpath($conf['olddir']).DIRECTORY_SEPARATOR,'',$fn); }else{ - $fn = str_replace(realpath($conf['datadir']).DIRECTORY_SEPARATOR,'',$fn); + $fn = str_replace(fullpath($conf['datadir']).DIRECTORY_SEPARATOR,'',$fn); } } $fn = utf8_decodeFN($fn); diff --git a/inc/toolbar.php b/inc/toolbar.php index b8ac76f6d..c507d3eb0 100644 --- a/inc/toolbar.php +++ b/inc/toolbar.php @@ -6,7 +6,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ - if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); require_once(DOKU_INC.'inc/JSON.php'); |