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