forked from pommes-frites/piwigo-facetag
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathadmin.php
executable file
·126 lines (89 loc) · 2.41 KB
/
admin.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
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
<?php
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
// Fetch the template
global $template;
/*
* Include some php files for functions and such.
*/
include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
$my_base_url = get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__));
/*
* Exit if user status is not okay
*/
check_status(ACCESS_WEBMASTER);
// +-----------------------------------------------------------------------+
// | Tabssheet
// +-----------------------------------------------------------------------+
$tabsheet = new tabsheet();
$tabs = array(
array(
'code' => 'config',
'label' => l10n('Configuration'),
),
);
if (empty($conf['MugShot_tabs']))
{
$conf['MugShot_tabs'] = $tabs;
}
$page['tab'] = isset($_GET['tab']) ? $_GET['tab'] : $conf['MugShot_tabs'][0]['code'];
if (!in_array($page['tab'], $conf['MugShot_tabs'][0])) die('Hacking attempt!');
foreach ($conf['MugShot_tabs'] as $tab)
{
$tabsheet->add($tab['code'], $tab['label'], $my_base_url.'-'.$tab['code']);
}
$tabsheet->select($page['tab']);
$tabsheet->assign();
/*
* Update the parameters and escape the serialized string.
*/
if(isset($_POST['save'])) {
unset($_POST['save']);
conf_update_param(MUGSHOT_ID, pwg_db_real_escape_string(serialize($_POST)));
array_push($page['infos'], l10n('Information data registered in database'));
}
/*
* Add our template to the global template
*/
$template -> set_filenames(
array(
'plugin_admin_content' => dirname(__FILE__) . '/template/admin.tpl'
)
);
/*
* Assign action to template for the form submit
*/
$template -> assign(
array(
'PLUGIN_ACTION' => get_root_url() . 'admin.php?page=plugin-MugShot'
)
);
/*
* Retrieve configuration variable.
*/
if (empty($_POST)) {
$data = conf_get_param(MUGSHOT_ID);
} else {
$data = $_POST;
}
/*
* Assign configuration data to the template
*/
$template -> assign($data);
/*
* Fetch groups for mugshot
*/
$query = 'SELECT id FROM '.GROUPS_TABLE.';';
$group_ids = query2array($query, null, 'id');
$template->assign(
array(
'CACHE_KEYS' => get_admin_client_cache_keys(array('groups')),
'groups' => $group_ids,
'groups_selected' => isset($data['groups']) ? $data['groups'] : []
)
);
/*
* Assign template contents to admin content
*/
$template -> assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
?>