This repository has been archived by the owner on Mar 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.php
91 lines (63 loc) · 1.55 KB
/
api.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
<?php
if (!file_exists('include/api/key.php'))
{
echo json_encode(array("error" => "No Shared Secret Definied"));
exit();
}
require "include/class.php";
require_once "include/standalone.php";
require_once "include/api/types.inc.php";
require_once "include/class_api.php";
require_once 'include/class_widgets.php';
require_once 'include/class_subpages.php';
require_once 'include/class_pluginloader.php';
require_once "include/base/SiteTemplate.php";
require_once "include/base/subpageTemplate.php";
require_once "include/base/pluginTemplate.php";
require 'include/api/key.php';
//Standalone:
$hp = new Standalone("./");
$pluginloader = new PluginLoader;
$widgets = new widgets;
$subpages = new subpages;
$pluginloader->sethp($hp);
$hp->setpluginloader($pluginloader);
$widgets->sethp($hp);
$hp->setwidgets($widgets);
$subpages->sethp($hp);
$hp->setsubpages($subpages);
$pluginloader->Init();
$right = $hp->getright();
$level = $_SESSION['level'];
$get = $hp->get();
$post = $hp->post();
$dbprefix = $hp->getprefix();
$config = $hp->getconfig();
$pluginloader->Load();
if (!is_array($get))
{
$get = array();
}
if (!is_array($post))
{
$post = array();
}
$req = array_merge($get, $post);
if ($config["enable_ScriptAccess"])
{
if (isset($req["req"]))
{
echo $pluginloader->request($req["data"]);
} elseif (isset($req["com"]))
{
echo $pluginloader->command($req["data"]);
} else
{
echo json_encode(array("error" => "Unknown Subset"));
}
} else
{
echo json_encode(array("error" => "Not Allowed"));
}
$pluginloader->Save();
?>