DokuWiki

It's better when it's simple

User Tools

Site Tools

Trace: disabled_functions

tips:disabled_functions

Disabled Functions

If you use a cheap webhost, they may have disabled some PHP functions for "Security Reasons", this will probably break DokuWiki with errors like

Warning: xyz() has been disabled for security reasons

The first thing you should do is ask your Webhoster to change this or see if you can find a better hoster. If this is not a possibility you sometimes may be able to replace those functions.

To do so you need to find a replacement which doesn't use any of the disabled functions and put it into a inc/preload.php file, then you need to replace all calls to the disabled function with calls to your replacement in the whole DokuWiki code.

Below is a collection of a few replacements for functions used in DokuWiki:

readfile

Replaces readfile. find all places where it is used : readfile

function rpl_readfile($file){
 $handle=@fopen ($file,"r");
 echo @fread ($handle,filesize ($file));
 @fclose ($handle);
}

glob

Replaces glob (From php.net comment #71083). find all places where it is used : glob();

/**
 * @author <BigueNique at yahoo dot ca>
 */
function rpl_glob($pattern, $flags=0) {
 $split=explode ('/',$pattern);
 $match=array_pop ($split);
 $path=implode ('/',$split);
 if (($dir=opendir ($path))!==false) {
 $glob=array ();
 while(($file=readdir ($dir))!==false) {
 if (fnmatch ($match,$file)) {
 if ((is_dir ("$path/$file"))||(!($flags&GLOB_ONLYDIR))) {
 if ($flags&GLOB_MARK) $file.='/';
 $glob[]=$file;
 }
 }
 }
 closedir ($dir);
 if (!($flags&GLOB_NOSORT)) sort ($glob);
 return $glob;
 } else {
 return false;
 } 
}
 
/**
 * @author <soywiz at php dot net>
 */
if (!function_exists ('fnmatch')) {
 function fnmatch ($pattern, $string) {
 return @preg_match ('/^' . strtr (addcslashes ($pattern, '\\.+^$(){}=!<>|'), array ('*' => '.*', '?' => '.?')) . '$/i', $string);
 }
}

parse_ini_file

tips/disabled_functions.txt · Last modified: by andi

AltStyle によって変換されたページ (->オリジナル) /