-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
82 lines (65 loc) · 1.48 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
<?php
function parseURI()
{
$uri=ltrim($_SERVER['REQUEST_URI'],'/');
$tmp=explode('/',$uri);
$result['type']=$tmp[0];
if(array_key_exists(1,$tmp))
$result['uri']=preg_replace('/[^a-z]/', '',$tmp[1]);
else
$result['uri']='';
if(array_key_exists(2,$tmp))
$result['id']=$tmp[2];
else
$result['id']='';
return $result;
}
$CONFIG_FILE ='config.ini';
define('CONFIG_FILE', $CONFIG_FILE);
$CONFIG = (array) parse_ini_file(CONFIG_FILE, true);
//
require 'smarty/libs/Smarty.class.php';
$smarty = new Smarty;
require_once "./lib/definitions.php";
require_once "./lib/GMSGenieACS.class.php";
require_once "./lib/GMSPostgres.class.php";
require_once "./lib/GMS.class.php";
$API=new GMSGenieACS();
$psql=new GMSPostgres();
$GMS=new GMS($psql,$API);
//
$route=parseURI();
if ($route['type']=='genieacs') {
require_once "./lib/GMSApiServer.class.php";
$server= new GMSApiServer($GMS);
$result = $server->execute();
echo $result;
}
elseif(file_exists('smarty/libs/Smarty.class.php'))
{
if(!$GMS->isUserAdded())
{
$module='useradd';
}
elseif($GMS->isLoged())
{
if(!array_key_exists('m', $_GET) || $_GET['m']=='login')
$module='customerlist';
else
$module=$_GET['m'];
$smarty->assign('title', 'GMS');
}
else
$module='login';
$file='modules/'. $module . '.php';
if (file_exists($file)) {
include $file;
}
else {
echo "Page not found.";
exit;
}
}
else
echo 'Install Smarty.';
?>