-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.php
50 lines (45 loc) · 1.19 KB
/
util.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
<?php
include_once 'config.php';
function __autoload($classname)
{
$filename = $classname . '.php';
if(file_exists($filename))
{
$filename = './' . $filename;
include_once($filename);
}
else if(file_exists('modules/' . $filename))
{
$filename = 'modules/' . $filename;
include_once($filename);
}
else if(file_exists('objects/' . $filename))
{
$filename = 'objects/' . $filename;
include_once($filename);
}
else if(file_exists('modules/' . strtolower($classname) . '/' . $filename))
{
$filename = 'modules/' . strtolower($classname) . '/' . $filename;
include_once($filename);
}
}
function userExists()
{
if(!isset($_SESSION['user']) || empty($_SESSION['user']))
return false;
else return true;
}
function jsConfig($key, $val)
{
global $_jsConfig;
$_jsConfig[$key] = $val;
}
function addJSVars()
{
global $_jsConfig;
$_inlineJs = "\n<!--//--><![CDATA[//><!--\nKBA = " . json_encode($_jsConfig) . ";\n//--><!]]>\n";
$includes .= "<script type=\"text/javascript\">$_inlineJs</script>\n";
return $includes;
}
?>