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