[12496] | 1 | <?php |
---|
[31463] | 2 | // +-----------------------------------------------------------------------+ |
---|
| 3 | // | Add < head > element plugin for piwigo | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
| 5 | // | Copyright(C) 2011 - 2016 ddtddt http://temmii.com/piwigo/ | |
---|
| 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 19 | // | USA. | |
---|
| 20 | // +-----------------------------------------------------------------------+ |
---|
| 21 | |
---|
[12496] | 22 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 23 | global $template, $conf, $user; |
---|
| 24 | include_once(PHPWG_ROOT_PATH .'admin/include/tabsheet.class.php'); |
---|
| 25 | $my_base_url = get_admin_plugin_menu_link(__FILE__); |
---|
| 26 | |
---|
| 27 | // +-----------------------------------------------------------------------+ |
---|
| 28 | // | Check Access and exit when user status is not ok | |
---|
| 29 | // +-----------------------------------------------------------------------+ |
---|
| 30 | check_status(ACCESS_ADMINISTRATOR); |
---|
| 31 | |
---|
| 32 | //-------------------------------------------------------- sections definitions |
---|
| 33 | |
---|
| 34 | $tabsheet = new tabsheet(); |
---|
[23583] | 35 | $tabsheet->add('Management', l10n('Management'), ''); |
---|
| 36 | $tabsheet->select('Management'); |
---|
[12496] | 37 | $tabsheet->assign(); |
---|
| 38 | |
---|
[23583] | 39 | if (isset($conf['add_head_element_apply_on'])) |
---|
[12496] | 40 | { |
---|
[23583] | 41 | $conf['add_head_element_apply_on'] = explode(',', $conf['add_head_element_apply_on']); |
---|
| 42 | } |
---|
| 43 | else |
---|
| 44 | { |
---|
| 45 | $conf['add_head_element_apply_on'] = array('gallery', 'admin'); |
---|
| 46 | } |
---|
[12496] | 47 | |
---|
[23583] | 48 | $template->assign( |
---|
| 49 | array( |
---|
| 50 | 'AHEBASE' => $conf['add_head_element'], |
---|
| 51 | 'gallery' => in_array('gallery', $conf['add_head_element_apply_on']), |
---|
| 52 | 'admin' => in_array('admin', $conf['add_head_element_apply_on']), |
---|
| 53 | ) |
---|
| 54 | ); |
---|
| 55 | |
---|
[12496] | 56 | if (isset($_POST['submitahe'])) |
---|
[23583] | 57 | { |
---|
[14969] | 58 | conf_update_param('add_head_element', $_POST['ahe']); |
---|
[23583] | 59 | |
---|
| 60 | $conf['add_head_element_apply_on'] = array(); |
---|
| 61 | |
---|
| 62 | if (!empty($_POST['apply_on_gallery'])) |
---|
| 63 | { |
---|
| 64 | $conf['add_head_element_apply_on'][] = 'gallery'; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | if (!empty($_POST['apply_on_admin'])) |
---|
| 68 | { |
---|
| 69 | $conf['add_head_element_apply_on'][] = 'admin'; |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | conf_update_param('add_head_element_apply_on', implode(',', $conf['add_head_element_apply_on'])); |
---|
| 73 | |
---|
[12496] | 74 | $template->assign( |
---|
[23583] | 75 | array( |
---|
| 76 | 'AHEBASE' => stripslashes($_POST['ahe']), |
---|
| 77 | 'gallery' => in_array('gallery', $conf['add_head_element_apply_on']), |
---|
| 78 | 'admin' => in_array('admin', $conf['add_head_element_apply_on']), |
---|
| 79 | ) |
---|
| 80 | ); |
---|
| 81 | } |
---|
[12496] | 82 | |
---|
| 83 | $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); |
---|
| 84 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
| 85 | ?> |
---|