Hello!
I have tried to install dokuwiki on awardspace but it's not working because
realpath function is not supported :#:
Warning: realpath() has been disabled for security reasons
So I have decided to define this function myself:
<?php
function cleanPath($path) {
$result = array();
// $pathA = preg_split('/[\/\\\]/', $path);
$pathA = explode('/', $path);
if (!$pathA[0])
$result[] = '';
foreach ($pathA AS $key => $dir) {
if ($dir == '..') {
if (end($result) == '..') {
$result[] = '..';
} elseif (!array_pop($result)) {
$result[] = '..';
}
} elseif ($dir && $dir != '.') {
$result[] = $dir;
}
}
if (!end($pathA))
$result[] = '';
/* echo implode('/', $result); */
return implode('/', $result);
}
?>
I have then wrote a Perl script to modify all dokuwiki php source files. It will
- replace realpath function through cleanPath
-add @require_once('cleanpath.php'); when needed
I'm not really php expert, the only option how to get @require_once('cleanpath.php') working was to link file "cleanpath.php" to every directory with php files. Any idea how to get this fix working with cleanpath.php stored only at ONE location is very welcome!
Please read more on my dokuwiki:
http://lnx-hladky2/~hladky/dokuwiki/doku.php?id=dokuwiki:awardspace
Jiri