/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk
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)=="/")) {
386 by Suren A. Chilingaryan
Fix include paths in the samples
6
	if (preg_match("/^(.*\/)(services|system|admin|test|tmp\\/adminscripts|docs\\/samples.*)\/?$/", dirname($_SERVER['SCRIPT_FILENAME']), $m)) $ADEI_ROOTDIR = $m[1];
53 by Suren A. Chilingaryan
fixups and some search hooks (incomplete)
7
	else $ADEI_ROOTDIR =  dirname($_SERVER['SCRIPT_FILENAME']) . "/";
8
    } else {
386 by Suren A. Chilingaryan
Fix include paths in the samples
9
	if (preg_match("/^(.*\/)(services|system|admin|test|tmp\\/adminscripts|docs\\/samples.*)\/?$/", $ADEI_RUNDIR, $m)) $ADEI_ROOTDIR = $m[1];
53 by Suren A. Chilingaryan
fixups and some search hooks (incomplete)
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
227 by Suren A. Chilingaryan
Use localization subsystem, updated Katrin configs
23
require($ADEI_ROOTDIR . "locale.php");
24
1 by Suren A. Chilingaryan
Initial import
25
26
//require("classes/zeus.php");
27
28
function adei_app($name, $opts=false, $throw=false) {
29
    global $ADEI_APP_PATH;
30
    
403 by Suren A. Chilingaryan
Allow full path in ADEI applications
31
    if (substr($name, 0, 1) == "/") $appname = $name;
32
    else if (isset($ADEI_APP_PATH[$name])) $appname = $ADEI_APP_PATH[$name];
1 by Suren A. Chilingaryan
Initial import
33
    else $appname = $ADEI_APP_PATH["default"] . $name;
34
35
    if (!file_exists($appname)) {
36
	if ($throw) throw new ADEIException("Application \"$name\" is not installed");
37
	else return false;
38
    }
39
    
40
    if (!is_executable($appname)) {
41
	if ($throw) throw new ADEIException("Application \"$name\" is not executable");
42
	else return false;
43
    }
44
    
45
    return $appname . ($opts?(" " . $opts):"");
46
}
47
48
?>