source: extensions/user_tags/admin.php @ 32069

Revision 22063, 3.4 KB checked in by nikrou, 7 years ago (diff)

Forget debug lines

Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | User Tags  - a plugin for Piwigo                                      |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2010-2013 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 version 2 as     |
9// | published by 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
44  if (!empty($_POST['existing_tags_only']) 
45      && $_POST['existing_tags_only']!=$me->getPermission('existing_tags_only')) {
46    $me->setPermission('existing_tags_only', 1);
47    $save_config = true;
48  } elseif (!isset($_POST['existing_tags_only']) && $me->getPermission('existing_tags_only')!=0) {
49    $me->setPermission('existing_tags_only', 0);
50    $save_config = true;   
51  }
52 
53  if (isset($_POST['permission_delete']) && isset($status_options[$_POST['permission_delete']]) 
54      && $_POST['permission_delete']!=$me->getPermission('delete')) {
55    $me->setPermission('delete', $_POST['permission_delete']);
56    $page['infos'] = l10n('Delete permission updated');
57    $save_config = true;
58  }
59
60  if ($save_config) {
61    $me->save_config();
62  }
63}
64
65$template->set_filenames(array('plugin_admin_content' => T4U_TEMPLATE . '/admin.tpl'));
66$template->assign('T4U_CSS', T4U_CSS);
67
68$template->assign('T4U_PERMISSION_ADD', $me->getPermission('add'));
69$template->assign('T4U_PERMISSION_DELETE', $me->getPermission('delete'));
70$template->assign('T4U_EXISTING_TAG_ONLY', $me->getPermission('existing_tags_only'));
71$template->assign('STATUS_OPTIONS', $status_options);
72$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
73
74$template->assign('U_HELP', get_root_url().'admin/popuphelp.php?page=readme');
Note: See TracBrowser for help on using the repository browser.