source: extensions/user_tags/admin.php @ 11298

Revision 11081, 3.1 KB checked in by nikrou, 9 years ago (diff)

Fix incompatibility with piwigo 2.2
Change jquery plugin from fcbkcomplete to tokeninput

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 = get_plugin_data($plugin_id);
29$save_config = false;
30
31if (!empty($_GET['action']) && in_array($_GET['action'], array('add', 'get'))) {
32  include_once T4U_PLUGIN_ROOT . "/include/t4u_admin_action.inc.php";
33}
34
35$status_options[null] = '----------';
36foreach (get_enums(USER_INFOS_TABLE, 'status') as $status) {
37  $status_options[$status] = l10n('user_status_'.$status);
38}
39
40if (!empty($_POST['submit'])) {
41  if (isset($_POST['permission_add']) && isset($status_options[$_POST['permission_add']]) 
42      && $_POST['permission_add']!=$me->getPermission('add')) {
43    $me->setPermission('add', $_POST['permission_add']);
44    $page['infos'][] = l10n('Add permission updated');
45    $save_config = true;
46  }
47  if (isset($_POST['permission_delete']) && isset($status_options[$_POST['permission_delete']]) 
48      && $_POST['permission_delete']!=$me->getPermission('delete')) {
49    $me->setPermission('delete', $_POST['permission_delete']);
50    $page['infos'] = l10n('Delete permission updated');
51    $save_config = true;
52  }
53
54  if ($save_config) {
55    $me->save_config();
56  }
57}
58
59$template->set_filenames(array('plugin_admin_content' => T4U_TEMPLATE . '/admin.tpl'));
60$template->assign('T4U_CSS', T4U_CSS);
61
62$template->assign('T4U_PERMISSION_ADD', $me->getPermission('add'));
63$template->assign('T4U_PERMISSION_DELETE', $me->getPermission('delete'));
64$template->assign('STATUS_OPTIONS', $status_options);
65$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
66
67$template->assign('U_HELP', get_root_url().'admin/popuphelp.php?page=readme');
68?>
Note: See TracBrowser for help on using the repository browser.