summaryrefslogtreecommitdiff
path: root/inc/init.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-03-03 19:05:48 +0100
committerAndreas Gohr <andi@splitbrain.org>2006-03-03 19:05:48 +0100
commit3816dcbc4fc7d70493037bf3ee9468ca5a203db8 (patch)
tree361626f9cabce6f830d80881b4283f205fa7c829 /inc/init.php
parent3bb35907e94c813b0bd286c6e3d1b12359c84618 (diff)
downloadrpg-3816dcbc4fc7d70493037bf3ee9468ca5a203db8.tar.gz
rpg-3816dcbc4fc7d70493037bf3ee9468ca5a203db8.tar.bz2
nicer error messages for fatal errors
darcs-hash:20060303180548-7ad00-db294c2c5c10c8df69ebae7596e64e1af4d9bc35.gz
Diffstat (limited to 'inc/init.php')
-rw-r--r--inc/init.php28
1 files changed, 25 insertions, 3 deletions
diff --git a/inc/init.php b/inc/init.php
index e4d2fac5b..31ad8d37c 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -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 :