source: extensions/add_head_element/admin.php @ 31933

Revision 31463, 3.4 KB checked in by ddtddt, 4 years ago (diff)

[extensions] - add_head_element - 2.8

Line 
1<?php
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
22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
23global $template, $conf, $user;
24include_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// +-----------------------------------------------------------------------+
30check_status(ACCESS_ADMINISTRATOR);
31
32//-------------------------------------------------------- sections definitions
33
34$tabsheet = new tabsheet();
35$tabsheet->add('Management', l10n('Management'), '');
36$tabsheet->select('Management');
37$tabsheet->assign();
38
39if (isset($conf['add_head_element_apply_on']))
40{
41  $conf['add_head_element_apply_on'] = explode(',', $conf['add_head_element_apply_on']);
42}
43else
44{
45  $conf['add_head_element_apply_on'] = array('gallery', 'admin');
46}
47
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
56if (isset($_POST['submitahe']))
57{
58  conf_update_param('add_head_element', $_POST['ahe']);
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 
74  $template->assign(
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}
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?>
Note: See TracBrowser for help on using the repository browser.