4 * Things which must be done and defined before anything else.
7 function rcs_id ($id) { $GLOBALS['RCS_IDS'] .= "$id\n"; }
8 rcs_id('$Id: prepend.php,v 1.20 2004-05-14 11:32:52 rurban Exp $');
10 define ('PHPWIKI_VERSION', '1.3.11pre');
12 // If your php was compiled with --enable-trans-sid it tries to
13 // add a PHPSESSID query argument to all URL strings when cookie
14 // support isn't detected in the client browser. For reasons
15 // which aren't entirely clear (PHP bug) this screws up the URLs
16 // generated by PhpWiki. Therefore, transparent session ids
17 // should be disabled. This next line does that.
19 // (At the present time, you will not be able to log-in to PhpWiki,
20 // unless your browser supports cookies.)
21 @ini_set('session.use_trans_sid', 0);
24 // Used for debugging purposes
26 function DebugTimer() {
27 $this->_start = $this->microtime();
28 if (function_exists('posix_times'))
29 $this->_times = posix_times();
33 * @param string $which One of 'real', 'utime', 'stime', 'cutime', 'sutime'
34 * @return float Seconds.
36 function getTime($which='real', $now=false) {
38 return $this->microtime() - $this->_start;
40 if (isset($this->_times)) {
41 if (!$now) $now = posix_times();
42 $ticks = $now[$which] - $this->_times[$which];
43 return $ticks / $this->_CLK_TCK();
46 return 0.0; // Not available.
50 if (!isset($this->_times)) {
51 // posix_times() not available.
52 return sprintf("real: %.3f", $this->getTime('real'));
55 return sprintf("real: %.3f, user: %.3f, sys: %.3f",
56 $this->getTime('real'),
57 $this->getTime('utime', $now),
58 $this->getTime('stime', $now));
62 // FIXME: this is clearly not always right.
63 // But how to figure out the right value?
68 list($usec, $sec) = explode(" ", microtime());
69 return ((float)$usec + (float)$sec);
72 $RUNTIMER = new DebugTimer;
74 error_reporting(E_ALL);
75 require_once(dirname(__FILE__).'/ErrorManager.php');
76 require_once(dirname(__FILE__).'/WikiCallback.php');
79 function ExitWiki($errormsg = false)
84 if (is_object($request))
85 $request->finish($errormsg); // NORETURN
93 $ErrorManager->flushPostponedErrors();
95 if(!empty($errormsg)) {
96 PrintXML(HTML::br(), $errormsg);
97 print "\n</body></html>";
101 if (!defined('DEBUG') or (defined('DEBUG') and DEBUG > 2)) {
102 $ErrorManager->setPostponedErrorMask(E_ALL); // ignore all errors
103 $ErrorManager->setFatalHandler(new WikiFunctionCb('ExitWiki'));
105 $ErrorManager->setPostponedErrorMask(E_USER_NOTICE | E_NOTICE);
109 // (c-file-style: "gnu")
114 // c-hanging-comment-ender-p: nil
115 // indent-tabs-mode: nil