]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/prepend.php
Jeff's hacks II.
[SourceForge/phpwiki.git] / lib / prepend.php
1 <?php
2 /* lib/prepend.php
3  *
4  * Things which must be done and defined before anything else.
5  */
6 $RCS_IDS = '';
7 function rcs_id ($id) { $GLOBALS['RCS_IDS'] .= "$id\n"; }
8 rcs_id('$Id: prepend.php,v 1.4 2001-09-18 19:16:23 dairiki Exp $');
9
10 error_reporting(E_ALL);
11 require_once('lib/ErrorManager.php');
12
13 // FIXME: make this part of Request?
14 function ExitWiki($errormsg = false)
15 {
16     static $in_exit = 0;
17     global $dbi, $request;
18
19     if($in_exit)
20         exit();         // just in case CloseDataBase calls us
21     $in_exit = true;
22
23     if (!empty($dbi))
24         $dbi->close();
25
26     global $ErrorManager;
27     $ErrorManager->flushPostponedErrors();
28    
29     if(!empty($errormsg)) {
30         print "<p><hr noshade><h2>" . gettext("WikiFatalError") . "</h2>\n";
31         
32         if (is_string($errormsg))
33             print $errormsg;
34         else
35             $errormsg->printError();
36         
37         print "\n</body></html>";
38     }
39
40     $request->finish();
41     exit;
42 }
43
44 $ErrorManager->setPostponedErrorMask(E_ALL);
45 $ErrorManager->setFatalHandler('ExitWiki');
46
47
48 // (c-file-style: "gnu")
49 // Local Variables:
50 // mode: php
51 // tab-width: 8
52 // c-basic-offset: 4
53 // c-hanging-comment-ender-p: nil
54 // indent-tabs-mode: nil
55 // End:   
56 ?>