source: extensions/user_tags/admin.php @ 14974

Last change on this file since 14974 was 11741, checked in by nikrou, 13 years ago

Make plugin works as expected using webservice.

File size: 2.9 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | User Tags  - a plugin for Piwigo                                      |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2010-2011 Nicolas Roudaire        http://www.nikrou.net  |
6// +-----------------------------------------------------------------------+
7// | This program is free software; you can redistribute it and/or modify  |
8// | it under the terms of the GNU General Public License as published by  |
9// | the Free Software Foundation                                          |
10// |                                                                       |
11// | This program is distributed in the hope that it will be useful, but   |
12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
14// | General Public License for more details.                              |
15// |                                                                       |
16// | You should have received a copy of the GNU General Public License     |
17// | along with this program; if not, write to the Free Software           |
18// | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,            |
19// | MA 02110-1301 USA.                                                    |
20// +-----------------------------------------------------------------------+
21
22if (!defined('PHPWG_ROOT_PATH')) {
23  die('Hacking attempt!');
24}
25
26load_language('plugin.lang', T4U_PLUGIN_LANG);
27
28$me = t4u_Config::getInstance();
29$save_config = false;
30
31$status_options[null] = '----------';
32foreach (get_enums(USER_INFOS_TABLE, 'status') as $status) {
33  $status_options[$status] = l10n('user_status_'.$status);
34}
35
36if (!empty($_POST['submit'])) {
37  if (isset($_POST['permission_add']) && isset($status_options[$_POST['permission_add']]) 
38      && $_POST['permission_add']!=$me->getPermission('add')) {
39    $me->setPermission('add', $_POST['permission_add']);
40    $page['infos'][] = l10n('Add permission updated');
41    $save_config = true;
42  }
43  if (isset($_POST['permission_delete']) && isset($status_options[$_POST['permission_delete']]) 
44      && $_POST['permission_delete']!=$me->getPermission('delete')) {
45    $me->setPermission('delete', $_POST['permission_delete']);
46    $page['infos'] = l10n('Delete permission updated');
47    $save_config = true;
48  }
49
50  if ($save_config) {
51    $me->save_config();
52  }
53}
54
55$template->set_filenames(array('plugin_admin_content' => T4U_TEMPLATE . '/admin.tpl'));
56$template->assign('T4U_CSS', T4U_CSS);
57
58$template->assign('T4U_PERMISSION_ADD', $me->getPermission('add'));
59$template->assign('T4U_PERMISSION_DELETE', $me->getPermission('delete'));
60$template->assign('STATUS_OPTIONS', $status_options);
61$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
62
63$template->assign('U_HELP', get_root_url().'admin/popuphelp.php?page=readme');
64?>
Note: See TracBrowser for help on using the repository browser.