1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Title plugin for piwigo by TEMMII | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2011 - 2020 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 | |
---|
22 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
23 | global $template, $conf, $user, $pwg_loaded_plugins; |
---|
24 | include_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 | // +-----------------------------------------------------------------------+ |
---|
30 | check_status(ACCESS_ADMINISTRATOR); |
---|
31 | |
---|
32 | // Gestion des onglets |
---|
33 | if (!isset($_GET['tab'])) |
---|
34 | $page['tab'] = 'plugtitle'; |
---|
35 | else |
---|
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 |
---|
50 | switch ($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 | |
---|
96 | if (isset($_POST['subtitlespecialET']) and (!$_POST['titlelist'])==0) |
---|
97 | { |
---|
98 | $lire=$_POST['titlelist']; |
---|
99 | $query = ' |
---|
100 | select 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 | |
---|
121 | if (isset($_POST['subtitlespecial'])) |
---|
122 | { |
---|
123 | $query = ' |
---|
124 | UPDATE ' . 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 | |
---|
138 | if (isset($_POST['submitct'])) |
---|
139 | { |
---|
140 | conf_update_param('contacttitle', $_POST['contacttitle']); |
---|
141 | $template->assign( |
---|
142 | 'gestB', |
---|
143 | array('CTBASE' => stripslashes($_POST['contacttitle']),)); |
---|
144 | } |
---|
145 | |
---|
146 | break; |
---|
147 | |
---|
148 | case 'AdditionalPagestitle': |
---|
149 | if (!defined('TITLE_AP_TABLE')) define('TITLE_AP_TABLE', $prefixeTable.'title_ap'); |
---|
150 | $groups = array(); |
---|
151 | $query = ' |
---|
152 | select 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 | |
---|
166 | foreach($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 = ' |
---|
181 | select 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 = ' |
---|
191 | select 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 | |
---|
212 | if (isset($_POST['submitinsapt'])) |
---|
213 | { |
---|
214 | $query = ' |
---|
215 | DELETE |
---|
216 | FROM ' . TITLE_AP_TABLE . ' |
---|
217 | WHERE id = \''.$_POST['invisible'].'\' |
---|
218 | ;'; |
---|
219 | $result = pwg_query($query); |
---|
220 | $q = ' |
---|
221 | INSERT 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 | ?> |
---|