-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathadmin_config.php
More file actions
168 lines (135 loc) · 3.4 KB
/
admin_config.php
File metadata and controls
168 lines (135 loc) · 3.4 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?php
/**
* @file
* Class installations to handle configuration forms on Admin UI.
*/
require_once('../../class2.php');
if(!getperms('P'))
{
header('location:' . e_BASE . 'index.php');
exit;
}
// [PLUGINS]/nodejs/languages/[LANGUAGE]/[LANGUAGE]_admin.php
e107::lan('nodejs', true, true);
/**
* Class nodejs_admin.
*/
class nodejs_admin extends e_admin_dispatcher
{
protected $modes = array(
'main' => array(
'controller' => 'nodejs_admin_main_ui',
'path' => null,
),
'scan' => array(
'controller' => 'nodejs_admin_scan_ui',
'path' => null,
),
);
protected $adminMenu = array(
'main/prefs' => array(
'caption' => LAN_AC_NODEJS_01,
'perm' => 'P',
),
'scan/list' => array(
'caption' => LAN_AC_NODEJS_03,
'perm' => 'P',
),
);
protected $menuTitle = LAN_PLUGIN__NODEJS_NAME;
}
/**
* Class nodejs_admin_ui.
*/
class nodejs_admin_main_ui extends e_admin_ui
{
protected $pluginTitle = LAN_PLUGIN__NODEJS_NAME;
protected $pluginName = "nodejs";
protected $preftabs = array(
LAN_AC_NODEJS_02,
);
protected $prefs = array(
// Node.js server tab.
'nodejs_protocol' => array(
'title' => LAN_AI_NODEJS_01,
'description' => LAN_AD_NODEJS_01,
'type' => 'boolean',
'writeParms' => 'enabled=http&disabled=https',
'data' => 'int',
'tab' => 0,
),
'nodejs_host' => array(
'title' => LAN_AI_NODEJS_02,
'description' => LAN_AD_NODEJS_02,
'type' => 'text',
'data' => 'str',
'tab' => 0,
),
'nodejs_port' => array(
'title' => LAN_AI_NODEJS_03,
'description' => LAN_AD_NODEJS_03,
'type' => 'number',
'data' => 'int',
'tab' => 0,
),
'nodejs_resource' => array(
'title' => LAN_AI_NODEJS_04,
'description' => LAN_AD_NODEJS_04,
'type' => 'text',
'data' => 'str',
'tab' => 0,
),
'nodejs_service_key' => array(
'title' => LAN_AI_NODEJS_05,
'description' => LAN_AD_NODEJS_05,
'type' => 'text',
'data' => 'str',
'tab' => 0,
),
'nodejs_socket_cdn' => array(
'title' => LAN_AI_NODEJS_06,
'type' => 'boolean',
'writeParms' => 'label=yesno',
'data' => 'int',
'tab' => 0,
),
);
}
class nodejs_admin_scan_ui extends e_admin_ui
{
protected $pluginTitle = LAN_PLUGIN__NODEJS_NAME;
function listPage()
{
$fl = e107::getFile();
$mes = e107::getMessage();
$plugList = $fl->get_files(e_PLUGIN, "^plugin\.(php|xml)$", "standard", 1);
$pluginList = array();
$addonsList = array();
// Remove Duplicates caused by having both plugin.php AND plugin.xml.
foreach($plugList as $num => $val)
{
$key = basename($val['path']);
$pluginList[$key] = $val;
}
foreach($pluginList as $p)
{
$p['path'] = substr(str_replace(e_PLUGIN, '', $p['path']), 0, -1);
$plugin_path = $p['path'];
if(is_readable(e_PLUGIN . $plugin_path . '/e_nodejs.php'))
{
$addonsList[] = $plugin_path;
}
}
e107::getPlugConfig('nodejs')->set('nodejs_addon_list', $addonsList)->save();
$summ = count($addonsList);
$message = str_replace('[summ]', $summ, LAN_AC_NODEJS_05);
$mes->addInfo($message);
$this->addTitle(LAN_AC_NODEJS_04);
echo $mes->render();
}
}
new nodejs_admin();
require_once(e_ADMIN . "auth.php");
e107::getAdminUI()->runPage();
require_once(e_ADMIN . "footer.php");
exit;