[6798] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
| 3 | // | User Tags - a plugin for Piwigo | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
[11081] | 5 | // | Copyright(C) 2010-2011 Nicolas Roudaire http://www.nikrou.net | |
---|
[6798] | 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 | |
---|
| 22 | if (!defined('PHPWG_ROOT_PATH')) { |
---|
| 23 | die('Hacking attempt!'); |
---|
| 24 | } |
---|
| 25 | |
---|
[6806] | 26 | load_language('plugin.lang', T4U_PLUGIN_LANG); |
---|
| 27 | |
---|
| 28 | $me = get_plugin_data($plugin_id); |
---|
| 29 | $save_config = false; |
---|
| 30 | |
---|
[11081] | 31 | if (!empty($_GET['action']) && in_array($_GET['action'], array('add', 'get'))) { |
---|
| 32 | include_once T4U_PLUGIN_ROOT . "/include/t4u_admin_action.inc.php"; |
---|
| 33 | } |
---|
| 34 | |
---|
[6806] | 35 | $status_options[null] = '----------'; |
---|
| 36 | foreach (get_enums(USER_INFOS_TABLE, 'status') as $status) { |
---|
| 37 | $status_options[$status] = l10n('user_status_'.$status); |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | if (!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']); |
---|
[11081] | 44 | $page['infos'][] = l10n('Add permission updated'); |
---|
[6806] | 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']); |
---|
[11081] | 50 | $page['infos'] = l10n('Delete permission updated'); |
---|
[6806] | 51 | $save_config = true; |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | if ($save_config) { |
---|
| 55 | $me->save_config(); |
---|
| 56 | } |
---|
| 57 | } |
---|
| 58 | |
---|
[11081] | 59 | $template->set_filenames(array('plugin_admin_content' => T4U_TEMPLATE . '/admin.tpl')); |
---|
| 60 | $template->assign('T4U_CSS', T4U_CSS); |
---|
[6806] | 61 | |
---|
[11081] | 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'); |
---|
[6806] | 66 | |
---|
[11081] | 67 | $template->assign('U_HELP', get_root_url().'admin/popuphelp.php?page=readme'); |
---|
[6798] | 68 | ?> |
---|