-
Notifications
You must be signed in to change notification settings - Fork 16
/
index.php
executable file
·111 lines (96 loc) · 3.63 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php /*
ocPortal
Copyright (c) ocProducts, 2004-2012
See text/EN/licence.txt for full licencing information.
*/
/**
* @license http://opensource.org/licenses/cpal_1.0 Common Public Attribution License
* @copyright ocProducts Ltd
* @package core
*/
// This is the standard zone bootstrap file. Zone: root.
// FIX PATH
global $FILE_BASE,$RELATIVE_PATH;
$FILE_BASE=(strpos(__FILE__,'./')===false)?__FILE__:realpath(__FILE__);
$FILE_BASE=str_replace('\\\\','\\',$FILE_BASE);
if (substr($FILE_BASE,-4)=='.php')
{
$a=strrpos($FILE_BASE,'/');
if ($a===false) $a=0;
$b=strrpos($FILE_BASE,'\\');
if ($b===false) $b=0;
$FILE_BASE=substr($FILE_BASE,0,($a>$b)?$a:$b);
}
$RELATIVE_PATH='';
if (getcwd()!=$FILE_BASE) @chdir($FILE_BASE);
$profile=false;//array_key_exists('tick_profile',$_GET);
if ($profile)
{
/**
* Get the time difference in microseconds between two PHP microtimes.
* Original source: php.net
*
* @param string First microtime
* @param string Second microtime
* @return integer The time difference
*/
function amicrotime_diff($a,$b)
{
list($a_micro,$a_int)=explode(' ',$a);
list($b_micro,$b_int)=explode(' ',$b);
if ($a_int>$b_int)
{
return ($a_int-$b_int)+($a_micro-$b_micro);
}
elseif ($a_int==$b_int)
{
if ($a_micro>$b_micro)
{
return ($a_int-$b_int)+($a_micro-$b_micro);
}
elseif ($a_micro<$b_micro)
{
return ($b_int-$a_int)+($b_micro-$a_micro);
}
else
{
return 0;
}
}
else
{ // $a_int<$b_int
return ($b_int-$a_int)+($b_micro-$a_micro);
}
}
global $FUNC_WATCH,$MICROTIME;
$MICROTIME=microtime(false);
/**
* Profile tick function.
*/
function tick_func()
{
global $FUNC_WATCH,$MICROTIME;
$LAST_MICROTIME=$MICROTIME;
$MICROTIME=microtime(false);
$trace=debug_backtrace();
$func=$trace[1]['function'];
if (isset($trace[1]['class'])) $func=$trace[1]['class'].$trace[1]['type'].$func;
if (!isset($FUNC_WATCH[$func])) $FUNC_WATCH[$func]=0;
$FUNC_WATCH[$func]+=amicrotime_diff($LAST_MICROTIME,$MICROTIME);
}
/* register_tick_function('tick_func');
declare(ticks=10);*/
}
global $NON_PAGE_SCRIPT;
$NON_PAGE_SCRIPT=0;
global $FORCE_INVISIBLE_GUEST;
$FORCE_INVISIBLE_GUEST=0;
//if (!is_file($FILE_BASE.'/sources/global.php')) exit('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'.chr(10).'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN"><head><title>Critical startup error</title></head><body><h1>ocPortal startup error</h1><p>The second most basic ocPortal startup file, sources/global.php, could not be located. This is almost always due to an incomplete upload of the ocPortal system, so please check all files are uploaded correctly.</p><p>Once all ocPortal files are in place, ocPortal must actually be installed by running the installer. You must be seeing this message either because your system has become corrupt since installation, or because you have uploaded some but not all files from our manual installer package: the quick installer is easier, so you might consider using that instead.</p><p>ocProducts maintains full documentation for all procedures and tools, especially those for installation. These may be found on the <a href="http://ocportal.com">ocPortal website</a>. If you are unable to easily solve this problem, we may be contacted from our website and can help resolve it for you.</p><hr /><p style="font-size: 0.8em">ocPortal is a website engine created by ocProducts.</p></body></html>');
require($FILE_BASE.'/sources/global.php');
// If we're still here, we're ok to go
do_site();
if ($profile)
{
asort($FUNC_WATCH);
print_r($FUNC_WATCH);
}