nicer error messages for fatal errors

darcs-hash:20060303180548-7ad00-db294c2c5c10c8df69ebae7596e64e1af4d9bc35.gz
This commit is contained in:
Andreas Gohr 2006-03-03 19:05:48 +01:00
parent 3bb35907e9
commit 3816dcbc4f
2 changed files with 27 additions and 5 deletions

View File

@ -33,10 +33,10 @@
$conf['useacl'] = 0;
}
} else {
die($lang['authmodfailed']);
nice_die($lang['authmodfailed']);
}
} else {
die($lang['authmodfailed']);
nice_die($lang['authmodfailed']);
}
}

View File

@ -128,7 +128,8 @@ function init_paths(){
foreach($paths as $c => $p){
if(!$conf[$c]) $conf[$c] = $conf['savedir'].'/'.$p;
$conf[$c] = init_path($conf[$c]);
if(!$conf[$c]) die("$c does not exist, isn't accessable or writable. Check config and permissions!");
if(!$conf[$c]) nice_die("The $c does not exist, isn't accessable or writable.
Check your config and permission settings!");
}
}
@ -149,7 +150,7 @@ function init_files(){
fclose($fh);
if(isset($conf['fmask'])) { chmod($file, $conf['fmask']); }
}else{
die("$file is not writable. Check permissions!");
nice_die("$file is not writable. Check your permissions settings!");
}
}
}
@ -282,7 +283,7 @@ function scriptify($file) {
}
$fh = fopen($fn, 'w');
if (!$fh) {
die($fn.' is not writable!');
nice_die($fn.' is not writable. Check your permission settings!');
}
// write php exit hack first
fwrite($fh, "# $fn\n");
@ -299,5 +300,26 @@ function scriptify($file) {
@rename($file,"$file.old");
}
/**
* print a nice message even if no styles are loaded yet.
*/
function nice_die($msg){
echo<<<EOT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>DokuWiki Setup Error</title></head>
<body style="font-family: Arial, sans-serif">
<div style="width:60%; margin: auto; background-color: #fcc;
border: 1px solid #faa; padding: 0.5em 1em;">
<h1 style="font-size: 120%">DokuWiki Setup Error</h1>
<p>$msg</p>
</div>
</body>
</html>
EOT;
exit;
}
//Setup VIM: ex: et ts=2 enc=utf-8 :