/adei/ui

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/ui
1 by Suren A. Chilingaryan
Initial import
1
<?php
2
24 by Suren A. Chilingaryan
Logger subsystem
3
$ADEI_RUNDIR = getcwd();
53 by Suren A. Chilingaryan
fixups and some search hooks (incomplete)
4
if (!isset($ADEI_ROOTDIR)) {
5
    if (($_SERVER['SCRIPT_FILENAME'])&&(substr($_SERVER['SCRIPT_FILENAME'],0,1)=="/")) {
6
	if (preg_match("/^(.*\/)(services|system|admin|test|tmp\\/adminscripts)\/?$/", dirname($_SERVER['SCRIPT_FILENAME']), $m)) $ADEI_ROOTDIR = $m[1];
7
	else $ADEI_ROOTDIR =  dirname($_SERVER['SCRIPT_FILENAME']) . "/";
8
    } else {
9
	if (preg_match("/^(.*\/)(services|system|admin|test|tmp\\/adminscripts)\/?$/", $ADEI_RUNDIR, $m)) $ADEI_ROOTDIR = $m[1];
10
	else $ADEI_ROOTDIR = $ADEI_RUNDIR . "/";
11
    }
26 by Suren A. Chilingaryan
Misc. fixes
12
}
13
14
if ($ADEI_ROOTDIR != $ADEI_RUNDIR) chdir($ADEI_ROOTDIR);
1 by Suren A. Chilingaryan
Initial import
15
16
if (isset($_GET['adei_session'])) $ADEI_SESSION = $_GET['adei_session'];
17
else $ADEI_SESSION = "00000000000000000000000000000000";
18
37 by Suren A. Chilingaryan
MASK support improvements
19
require($ADEI_ROOTDIR . "/config.php");
20
require($ADEI_ROOTDIR . "/tools.php");
21
require($ADEI_ROOTDIR . "/classes/adei.php");
1 by Suren A. Chilingaryan
Initial import
22
23
24
//require("classes/zeus.php");
25
26
function adei_app($name, $opts=false, $throw=false) {
27
    global $ADEI_APP_PATH;
28
    
29
    if (isset($ADEI_APP_PATH[$name])) $appname = $ADEI_APP_PATH[$name];
30
    else $appname = $ADEI_APP_PATH["default"] . $name;
31
32
    if (!file_exists($appname)) {
33
	if ($throw) throw new ADEIException("Application \"$name\" is not installed");
34
	else return false;
35
    }
36
    
37
    if (!is_executable($appname)) {
38
	if ($throw) throw new ADEIException("Application \"$name\" is not executable");
39
	else return false;
40
    }
41
    
42
    return $appname . ($opts?(" " . $opts):"");
43
}
44
45
?>