source: extensions/title/admin.php @ 32420

Last change on this file since 32420 was 32420, checked in by ddtddt, 3 years ago
File size: 6.1 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Title plugin for piwigo by TEMMII                                     |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2011 - 2021 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, $pwg_loaded_plugins;
24include_once(PHPWG_ROOT_PATH .'admin/include/tabsheet.class.php');
25$my_base_url = PHPWG_ROOT_PATH.'admin.php?page=plugin-';
26
27// +-----------------------------------------------------------------------+
28// | Check Access and exit when user status is not ok                      |
29// +-----------------------------------------------------------------------+
30check_status(ACCESS_ADMINISTRATOR);
31
32// Gestion des onglets
33if (!isset($_GET['tab']))
34  $page['tab'] = 'plugtitle';
35else
36  $page['tab'] = $_GET['tab'];
37
38$tabsheet = new tabsheet();
39  $tabsheet->add('plugtitle', l10n('title_tab_plgtitle'), TITLE_ADMIN . '-plugtitle');
40  if (isset($pwg_loaded_plugins['ContactForm'])){
41        $tabsheet->add('contacttitle', l10n('Contact Title'), TITLE_ADMIN . '-contacttitle');
42  }
43  if (isset($pwg_loaded_plugins['AdditionalPages'])){
44        $tabsheet->add('AdditionalPagestitle', l10n('Additional Pages Title'), TITLE_ADMIN . '-AdditionalPagestitle');
45  }                       
46$tabsheet->select($page['tab']);
47$tabsheet->assign();
48
49// Tab Title on specials pages
50switch ($page['tab'])
51{
52  case 'plugtitle':
53
54$titlepagelistT = array(
55    l10n('title_select'),
56        '----------------------',
57    l10n('Home'),
58    l10n('Best rated'),
59    l10n('Most visited'),
60        l10n('Recent pictures'),
61        l10n('Recent categories'),
62        l10n('Favorites'),
63        l10n('Tags'),
64        l10n('Comments'),
65        l10n('About'),
66        l10n('search'),
67        l10n('Random pictures'),
68        l10n('Notification'),
69  );
70 
71$titlepagelist = array(
72    '',
73    '',
74    'home',
75    'best_rated',
76    'most_visited',
77        'recent_pics',
78        'recent_cats',
79        'favorites',
80        'tags',
81        'comments',
82        'about',
83        'search',
84        'random',
85        'notification',
86  );
87 
88    $template->assign(
89    'gestionA',
90    array(
91      ));
92
93$template->assign('titlepagelist', $titlepagelist);
94$template->assign('titlepagelistT', $titlepagelistT);
95
96if (isset($_POST['subtitlespecialET']) and (!$_POST['titlelist'])==0)
97        {
98$lire=$_POST['titlelist'];
99        $query = '
100select id,page,title
101  FROM ' . TITLE_TABLE . '
102  WHERE page = \''.$lire.'\'
103  ;';
104$result = pwg_query($query);
105
106$row = pwg_db_fetch_assoc($result);
107$titlepage=$row['page'];
108$titletitle=$row['title'];
109
110  $selected2 = "";
111 
112  $template->assign(
113    'title_edit',
114    array(
115      'VALUE' => $titlepage,
116      'CONTENT' => $titletitle,
117      'SELECTED' => $selected2
118      ));
119        }
120
121if (isset($_POST['subtitlespecial']))
122        {
123        $query = '
124UPDATE ' . TITLE_TABLE . '
125  SET title= \''.$_POST['inser'].'\'
126  WHERE page = \''.$_POST['invisible'].'\'
127    ;';
128$result = pwg_query($query);
129        }
130
131    break;
132       
133        case 'contacttitle':
134       
135        $template->assign('gestB',
136    array('CTBASE' => $conf['contacttitle'],));
137
138if (isset($_POST['submitct']))
139        {
140conf_update_param('contacttitle', $_POST['contacttitle']);
141$template->assign(
142    'gestB',
143    array('CTBASE' => stripslashes($_POST['contacttitle']),));
144        }
145       
146        break;
147
148        case 'AdditionalPagestitle':
149if (!defined('TITLE_AP_TABLE')) define('TITLE_AP_TABLE', $prefixeTable.'title_ap');
150$groups = array();
151$query = '
152select id,title
153  FROM ' . ADD_PAGES_TABLE . '
154  ORDER BY id ASC;';
155$result = pwg_query($query);
156       
157        while ($row = pwg_db_fetch_assoc($result))
158        {
159  $groups[$row['id']] = $row['id'].' : '.$row['title'];
160        }
161       
162        $selected = 0;
163        $options[] = l10n('Choose the page');
164        $options['a'] = '----------------------';
165       
166foreach($groups as $listid => $listid2)
167        {
168    $options[$listid] = $listid2;
169        }
170  $template->assign(
171    'gestionC',
172    array(
173          'OPTIONS' => $options,
174      'SELECTED' => $selected
175      ));
176       
177        if (isset($_POST['submitchoixAP'])and is_numeric($_POST['APchoix']) and (!$_POST['APchoix'])==0)
178        {
179$lire=$_POST['APchoix'];
180        $query = '
181select id,title
182  FROM ' . TITLE_AP_TABLE . '
183  WHERE id = \''.$lire.'\'
184  ;';
185$result = pwg_query($query);
186$row = pwg_db_fetch_assoc($result);
187$idap=$row['id'];
188$titleap=$row['title'];
189
190$query = '
191select id,title
192  FROM ' . ADD_PAGES_TABLE . '
193  WHERE id = \''.$lire.'\'
194    ;';
195$result = pwg_query($query);
196$row = pwg_db_fetch_assoc($result);
197$idap=$row['id'];
198$nameap=$row['title'];
199
200  $selected3 = 0;
201 
202  $template->assign(
203    'ap_edit',
204    array(
205      'VALUE' => $idap,
206          'VALUEN' => $nameap,
207      'CONTENT' => $titleap,
208      'SELECTED' => $selected3
209      ));
210        }
211
212if (isset($_POST['submitinsapt']))
213        {
214        $query = '
215DELETE
216  FROM ' . TITLE_AP_TABLE . '
217  WHERE id = \''.$_POST['invisible'].'\'
218  ;';
219$result = pwg_query($query);
220        $q = '
221INSERT INTO ' . $prefixeTable . 'title_ap(id,title)VALUES ('.$_POST['invisible'].',"'.$_POST['insertitle'].'");';
222    pwg_query($q);
223        }
224       
225        break;
226       
227} 
228
229$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); 
230$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
231?>
Note: See TracBrowser for help on using the repository browser.