-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathadmin.php
More file actions
60 lines (46 loc) · 1.59 KB
/
admin.php
File metadata and controls
60 lines (46 loc) · 1.59 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
<?php
defined('TR_PATH') or die('Hacking attempt!');
global $template, $page, $conf;
include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
$page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'config';
$tabsheet = new tabsheet();
$tabsheet->add('config', '<span class="tr-icon-robot"></span>'.l10n('Configuration'), TR_ADMIN.'-config');
$tabsheet->select($page['tab']);
$tabsheet->assign();
if (isset($_POST['use'])||isset($_POST['save']))
{
check_pwg_token();
if (in_array($_POST['api'], TR_API_LIST))
{
$newConf = tr_getConf();
if (isset($_POST['use']))
{
$newConf->setSelectedAPI($_POST['api']);
}
$apiObject = tr_getAPI($_POST['api']);
foreach ($apiObject->getConfParams() as $key => $value) {
$newConf->setParam($_POST['api'], $key, trim($_POST[$key]));
}
tr_setConf($newConf);
}
}
$tr_api_info = [];
$tr_api_params = [];
$tr_api_conf = [];
foreach (TR_API_LIST as $apiName) {
$apiObject = tr_getAPI($apiName);
$tr_api_info[$apiName] = $apiObject->getInfo();
$tr_api_params[$apiName] = $apiObject->getConfParams();
$tr_api_conf[$apiName] = tr_getConf()->getConf($apiName);
}
$template->assign(array(
'TR_PATH' => TR_PATH,
'TR_API_LIST' => TR_API_LIST,
'TR_API_INFO' => $tr_api_info,
'TR_API_PARAMS' => $tr_api_params,
'TR_API_CONF' => $tr_api_conf,
'TR_API_SELECTED' => tr_getConf()->getSelectedAPI(),
'PWG_TOKEN' => get_pwg_token()
));
$template->set_filename('plugin_admin_content', realpath(TR_PATH . 'template/admin.tpl'));
$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');