1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Manage Properties Photos plugin for Piwigo by TEMMII | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2007-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')) |
---|
23 | die('Hacking attempt!'); |
---|
24 | global $template, $conf, $user; |
---|
25 | include_once(PHPWG_ROOT_PATH . 'admin/include/tabsheet.class.php'); |
---|
26 | load_language('plugin.lang', ADD_PROP_PHOTO_PATH); |
---|
27 | $my_base_url = get_admin_plugin_menu_link(__FILE__); |
---|
28 | |
---|
29 | // +-----------------------------------------------------------------------+ |
---|
30 | // | Check Access and exit when user status is not ok | |
---|
31 | // +-----------------------------------------------------------------------+ |
---|
32 | check_status(ACCESS_ADMINISTRATOR); |
---|
33 | |
---|
34 | //-------------------------------------------------------- sections definitions |
---|
35 | |
---|
36 | $template->assign(array( |
---|
37 | 'ADD_PROP_PHOTO_PATH'=> get_root_url() . ADD_PROP_PHOTO_PATH, |
---|
38 | )); |
---|
39 | |
---|
40 | |
---|
41 | if (!isset($_GET['tab'])) |
---|
42 | $page['tab'] = 'define_properties'; |
---|
43 | else |
---|
44 | $page['tab'] = $_GET['tab']; |
---|
45 | |
---|
46 | |
---|
47 | if ($page['tab'] != 'iap') { |
---|
48 | $tabsheet = new tabsheet(); |
---|
49 | $tabsheet->add('addip', l10n('Property'), ADD_PROP_PHOTO_ADMIN . '-define_properties'); |
---|
50 | $tabsheet->add('config', l10n('Configuration'), ADD_PROP_PHOTO_ADMIN . '-config'); |
---|
51 | $tabsheet->select($page['tab']); |
---|
52 | $tabsheet->assign(); |
---|
53 | } else if ($_GET['tab'] == 'iap') { |
---|
54 | |
---|
55 | $page['active_menu'] = get_active_menu('photo'); // force oppening "Photos" menu block |
---|
56 | |
---|
57 | /* Basic checks */ |
---|
58 | check_status(ACCESS_ADMINISTRATOR); |
---|
59 | |
---|
60 | check_input_parameter('image_id', $_GET, false, PATTERN_ID); |
---|
61 | $id_img = $_GET['image_id']; |
---|
62 | $admin_photo_base_url = get_root_url() . 'admin.php?page=photo-' . $_GET['image_id']; |
---|
63 | |
---|
64 | $page['tab'] = 'iap'; |
---|
65 | |
---|
66 | $tabsheet = new tabsheet(); |
---|
67 | $tabsheet->set_id('photo'); |
---|
68 | $tabsheet->select('iap'); |
---|
69 | $tabsheet->assign(); |
---|
70 | |
---|
71 | $template->assign( |
---|
72 | 'gestionD', array( |
---|
73 | 'A' => 'a' |
---|
74 | )); |
---|
75 | |
---|
76 | if (isset($pwg_loaded_plugins['ExtendedDescription'])){ |
---|
77 | add_event_handler('AP_render_content', 'get_user_language_desc'); |
---|
78 | $template->assign('useED',1); |
---|
79 | }else{ |
---|
80 | $template->assign('useED',0); |
---|
81 | } |
---|
82 | |
---|
83 | $tab_add_info_one_photo = tab_add_info_by_photo($_GET['image_id']); |
---|
84 | if (pwg_db_num_rows($tab_add_info_one_photo)) { |
---|
85 | while ($info_photos = pwg_db_fetch_assoc($tab_add_info_one_photo)) { |
---|
86 | if($info_photos['Typ']==2){ |
---|
87 | $d = data_info_photosdate($id_img, $info_photos['id_prop_pho']); |
---|
88 | $row = pwg_db_fetch_assoc($d); |
---|
89 | |
---|
90 | $items = array( |
---|
91 | 'IDPHO' => $_GET['image_id'], |
---|
92 | 'IDINFOPHO' => $info_photos['id_prop_pho'], |
---|
93 | 'AIPWORDING' => trigger_change('AP_render_content',$info_photos['wording']), |
---|
94 | 'AIPDATA' => $row['datadate'], |
---|
95 | 'AIPTYP' => $info_photos['Typ'], |
---|
96 | ); |
---|
97 | if($info_photos['wording']=="**delpho**"){ |
---|
98 | $items['AIPWORDING'] =l10n('Delete photo'); |
---|
99 | } |
---|
100 | }else{ |
---|
101 | $d = data_info_photos($id_img, $info_photos['id_prop_pho']); |
---|
102 | $row = pwg_db_fetch_assoc($d); |
---|
103 | |
---|
104 | $items = array( |
---|
105 | 'IDPHO' => $_GET['image_id'], |
---|
106 | 'IDINFOPHO' => $info_photos['id_prop_pho'], |
---|
107 | 'AIPWORDING' => trigger_change('AP_render_content',$info_photos['wording']), |
---|
108 | 'AIPDATA' => $row['data'], |
---|
109 | 'AIPTYP' => $info_photos['Typ'], |
---|
110 | ); |
---|
111 | if($info_photos['Typ']==4||$info_photos['Typ']==5){ |
---|
112 | $items['AIPSELECT']=unserialize($info_photos['dataprop']); |
---|
113 | foreach ($items['AIPSELECT'] as $key => $dataselect){ |
---|
114 | $items['AIPSELECTTRANS'][] = trigger_change('AP_render_content',$dataselect); |
---|
115 | } |
---|
116 | } |
---|
117 | } |
---|
118 | $template->append('info_photos', $items); |
---|
119 | } |
---|
120 | } |
---|
121 | |
---|
122 | if (isset($_POST['submitaddinfoimg'])) { |
---|
123 | foreach ($_POST['data'] AS $id_prop_pho => $data) { |
---|
124 | $q = 'SELECT 1 FROM ' . ADD_PROP_PHOTO_DATA_TABLE . ' WHERE id_img=' . $id_img . ' AND id_prop_pho=' . $id_prop_pho; |
---|
125 | $test = pwg_query($q); |
---|
126 | $row = pwg_db_fetch_assoc($test); |
---|
127 | if (count($row) > 0) { |
---|
128 | if ($data != '') { |
---|
129 | $query = 'UPDATE ' . $prefixeTable . 'add_properties_photos_data SET data="' . $data . '" WHERE id_img=' . $id_img . ' AND id_prop_pho=' . $id_prop_pho; |
---|
130 | pwg_query($query); |
---|
131 | } else { |
---|
132 | $query = 'DELETE FROM ' . $prefixeTable . 'add_properties_photos_data WHERE id_img=' . $id_img . ' AND id_prop_pho=' . $id_prop_pho; |
---|
133 | pwg_query($query); |
---|
134 | } |
---|
135 | } else if ($data != '') { |
---|
136 | $query = 'INSERT ' . $prefixeTable . 'add_properties_photos_data(id_img,id_prop_pho,data) VALUES (' . $id_img . ',' . $id_prop_pho . ',"' . $data . '");'; |
---|
137 | pwg_query($query); |
---|
138 | } |
---|
139 | } |
---|
140 | foreach ($_POST['datadate'] AS $id_prop_pho => $data) { |
---|
141 | $q = 'SELECT 1 FROM ' . ADD_PROP_PHOTO_DATADATE_TABLE . ' WHERE id_img=' . $id_img . ' AND id_prop_pho=' . $id_prop_pho; |
---|
142 | $test = pwg_query($q); |
---|
143 | $row = pwg_db_fetch_assoc($test); |
---|
144 | if (count($row) > 0) { |
---|
145 | if ($data != '') { |
---|
146 | $query = 'UPDATE ' . $prefixeTable . 'add_properties_photos_datadate SET datadate="' . $data . '" WHERE id_img=' . $id_img . ' AND id_prop_pho=' . $id_prop_pho; |
---|
147 | pwg_query($query); |
---|
148 | } else { |
---|
149 | $query = 'DELETE FROM ' . $prefixeTable . 'add_properties_photos_datadate WHERE id_img=' . $id_img . ' AND id_prop_pho=' . $id_prop_pho; |
---|
150 | pwg_query($query); |
---|
151 | } |
---|
152 | } else if ($data != '') { |
---|
153 | $query = 'INSERT ' . $prefixeTable . 'add_properties_photos_datadate(id_img,id_prop_pho,datadate) VALUES (' . $id_img . ',' . $id_prop_pho . ',"' . $data . '");'; |
---|
154 | pwg_query($query); |
---|
155 | } |
---|
156 | } |
---|
157 | $redirect_url = ADD_PROP_PHOTO_ADMIN . '-iap&image_id=' . $id_img; |
---|
158 | $_SESSION['page_infos'] = array(l10n('Properties update')); |
---|
159 | redirect($redirect_url); |
---|
160 | } |
---|
161 | } |
---|
162 | |
---|
163 | switch ($page['tab']) { |
---|
164 | case 'define_properties': |
---|
165 | $admin_base_url = ADD_PROP_PHOTO_ADMIN . '-define_properties'; |
---|
166 | $template->assign( |
---|
167 | 'addinfotemplate', array( |
---|
168 | 'addinfo' => l10n('addinfo'), |
---|
169 | )); |
---|
170 | $maxfields = (isset($conf['mpp_max_fields'])) ? $conf['mpp_max_fields'] : '5'; |
---|
171 | $template->assign('MPPMAXFIELD',$maxfields); |
---|
172 | |
---|
173 | if (isset($pwg_loaded_plugins['ExtendedDescription'])){ |
---|
174 | add_event_handler('AP_render_content', 'get_user_language_desc'); |
---|
175 | $template->assign('useED',1); |
---|
176 | }else{ |
---|
177 | $template->assign('useED',0); |
---|
178 | } |
---|
179 | |
---|
180 | $admin_base_url = ADD_PROP_PHOTO_ADMIN . '-define_properties'; |
---|
181 | $tab_info_photos = tab_info_photos(); |
---|
182 | |
---|
183 | if (pwg_db_num_rows($tab_info_photos)) { |
---|
184 | while ($info_photos = pwg_db_fetch_assoc($tab_info_photos)) { |
---|
185 | $items = array( |
---|
186 | 'IDINFOPHO' => $info_photos['id_prop_pho'], |
---|
187 | 'AIPORDER' => $info_photos['orderprop'], |
---|
188 | 'AIPACTIVE' => $info_photos['active'], |
---|
189 | 'AIPEDIT' => $info_photos['edit'], |
---|
190 | 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], |
---|
191 | 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'] |
---|
192 | ); |
---|
193 | if($info_photos['id_prop_pho']==1){ |
---|
194 | $items['AIPWORDING'] = l10n('Author'); |
---|
195 | }else if($info_photos['id_prop_pho']==2){ |
---|
196 | $items['AIPWORDING'] = l10n('Created on'); |
---|
197 | }else if($info_photos['id_prop_pho']==3){ |
---|
198 | $items['AIPWORDING'] = l10n('Posted on'); |
---|
199 | }else if($info_photos['id_prop_pho']==4){ |
---|
200 | $items['AIPWORDING'] = l10n('Dimensions'); |
---|
201 | }else if($info_photos['id_prop_pho']==5){ |
---|
202 | $items['AIPWORDING'] = l10n('File'); |
---|
203 | }else if($info_photos['id_prop_pho']==6){ |
---|
204 | $items['AIPWORDING'] = l10n('Filesize'); |
---|
205 | }else if($info_photos['id_prop_pho']==7){ |
---|
206 | $items['AIPWORDING'] = l10n('Tags'); |
---|
207 | }else if($info_photos['id_prop_pho']==8){ |
---|
208 | $items['AIPWORDING'] = l10n('Albums'); |
---|
209 | }else if($info_photos['id_prop_pho']==9){ |
---|
210 | $items['AIPWORDING'] = l10n('Visits'); |
---|
211 | }else if($info_photos['id_prop_pho']==10){ |
---|
212 | $items['AIPWORDING'] = l10n('Average'); |
---|
213 | }else if($info_photos['id_prop_pho']==11){ |
---|
214 | $items['AIPWORDING'] = l10n('Who can see this photo?'); |
---|
215 | }else{ |
---|
216 | if($info_photos['dataprop']=="DeletePhoto" and $info_photos['wording'] ="**delpho**"){ |
---|
217 | $items['AIPWORDING'] = l10n('Delete photo'); |
---|
218 | }else{ |
---|
219 | $items['AIPWORDING'] = trigger_change('AP_render_content',$info_photos['wording']); |
---|
220 | } |
---|
221 | $items['AIPWORDING2'] = $info_photos['wording']; |
---|
222 | $items['U_DELETE'] = $admin_base_url . '&delete=' . $info_photos['id_prop_pho']; |
---|
223 | $items['AIPTYP'] = $info_photos['Typ']; |
---|
224 | if($info_photos['Typ']==4||$info_photos['Typ']==5){ |
---|
225 | $items['AIPDATAPROP'] = json_encode(unserialize($info_photos['dataprop'])); |
---|
226 | } |
---|
227 | if($info_photos['Typ']==3||$info_photos['Typ']==6){ |
---|
228 | $items['AIPDATAPROP'] = $info_photos['dataprop']; |
---|
229 | } |
---|
230 | } |
---|
231 | $template->append('info_photos', $items); |
---|
232 | } |
---|
233 | |
---|
234 | $idexifone = pwg_db_fetch_assoc(pwg_query("SELECT MIN(id) as id FROM " . IMAGES_TABLE .";")); |
---|
235 | $idexif = (isset($conf['mpp_idexif'])) ? $conf['mpp_idexif'] : $idexifone['id']; |
---|
236 | $filename = pwg_db_fetch_assoc(pwg_query("SELECT path FROM " . IMAGES_TABLE . " WHERE id = '".$idexif."';")); |
---|
237 | if(empty($filename['path'])){ |
---|
238 | $_SESSION['page_errors'] = array(l10n('reference photo id doesn\'t exist please update')); |
---|
239 | }else if(exif_imagetype($filename['path']) != IMAGETYPE_JPEG and exif_imagetype($filename['path']) != IMAGETYPE_TIFF_II and exif_imagetype($filename['path']) != IMAGETYPE_TIFF_MM){ |
---|
240 | $_SESSION['page_errors'] = array(l10n('reference photo type doesn\'t use metadata please update')); |
---|
241 | }else{ |
---|
242 | $exif = exif_read_data($filename['path']); |
---|
243 | foreach ($exif as $key => $section){ |
---|
244 | if(is_array($section)){ |
---|
245 | $i=0; |
---|
246 | foreach ($section as $name => $value){ |
---|
247 | if($i==0){ |
---|
248 | $items['RM_AFF'] = $key; |
---|
249 | }else{ |
---|
250 | $items['RM_AFF'] = ''; |
---|
251 | } |
---|
252 | $items['RM_SECTION'] = $key; |
---|
253 | $items['RM_KEY'] = $name; |
---|
254 | $template->append('rm_exif', $items); |
---|
255 | $i++; |
---|
256 | } |
---|
257 | }else{ |
---|
258 | $items['RM_SECTION'] = '1'; |
---|
259 | $items['RM_KEY'] = $key; |
---|
260 | $items['RM_VALUE'] = $section; |
---|
261 | $template->append('rm_exif', $items); |
---|
262 | } |
---|
263 | } |
---|
264 | $iptc_result = array(); |
---|
265 | $imginfo = array(); |
---|
266 | getimagesize($filename['path'], $imginfo); |
---|
267 | if (isset ($imginfo['APP13'])){ |
---|
268 | $iptc = iptcparse($imginfo['APP13']); |
---|
269 | if (is_array($iptc)){ |
---|
270 | foreach (array_keys($iptc) as $iptc_key){ |
---|
271 | if (isset($iptc[$iptc_key][0])){ |
---|
272 | $iptc_result[$iptc_key] = $value; |
---|
273 | } |
---|
274 | } |
---|
275 | } |
---|
276 | $keys = array_keys($iptc_result); |
---|
277 | sort($keys); |
---|
278 | foreach ($keys as $key){ |
---|
279 | $items['RM_KEY'] = $key; |
---|
280 | $template->append('rm_iptc', $items); |
---|
281 | } |
---|
282 | } |
---|
283 | } |
---|
284 | } |
---|
285 | |
---|
286 | if (isset($_POST['submitManualOrderInfo'])){ |
---|
287 | |
---|
288 | asort($_POST['infoOrd'], SORT_NUMERIC); |
---|
289 | |
---|
290 | $data = array(); |
---|
291 | foreach ($_POST['infoOrd'] as $id =>$val){ |
---|
292 | |
---|
293 | $data[] = array('id_prop_pho' => $id, 'orderprop' => $val+1); |
---|
294 | } |
---|
295 | $fields = array('primary' => array('id_prop_pho'), 'update' => array('orderprop')); |
---|
296 | mass_updates(ADD_PROP_PHOTO_TABLE, $fields, $data); |
---|
297 | |
---|
298 | $page['infos'][] = l10n('Properties manual order was saved'); |
---|
299 | redirect($admin_base_url); |
---|
300 | } |
---|
301 | |
---|
302 | if (isset($_POST['submitaddAIP'])) { |
---|
303 | if ($_POST['inserwording'] == '') { |
---|
304 | $_SESSION['page_errors'] = array(l10n('Wording isn\'t empty')); |
---|
305 | redirect($admin_base_url); |
---|
306 | } |
---|
307 | if ($_POST['typ'] == '4'||$_POST['typ'] == '5') { |
---|
308 | $select= serialize($_POST['mytext']); |
---|
309 | } |
---|
310 | if ($_POST['typ'] == '3') { |
---|
311 | $select= $_POST['selectexif']; |
---|
312 | } |
---|
313 | if ($_POST['typ'] == '6') { |
---|
314 | $select= $_POST['selectiptc']; |
---|
315 | } |
---|
316 | if (!isset($_POST['inseractive'])) { |
---|
317 | $_POST['inseractive'] = 0; |
---|
318 | } |
---|
319 | if ($_POST['invisibleID'] == 0) { |
---|
320 | $result = pwg_query('SELECT MAX(orderprop) FROM '. ADD_PROP_PHOTO_TABLE ); |
---|
321 | $row = pwg_db_fetch_assoc($result); |
---|
322 | $or = ($row['MAX(orderprop)'] + 1); |
---|
323 | if ($_POST['typ'] == '4'||$_POST['typ'] == '3'||$_POST['typ'] == '5'||$_POST['typ'] == '6') { |
---|
324 | $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(wording,orderprop,active,edit,Typ,dataprop)VALUES ("' . $_POST['inserwording'] . '","' . $or . '","' . $_POST['inseractive'] . '",1,"' . $_POST['typ'] . '",\''. $select .'\');'; |
---|
325 | pwg_query($q); |
---|
326 | }else{ |
---|
327 | $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(wording,orderprop,active,edit,Typ)VALUES ("' . $_POST['inserwording'] . '","' . $or . '","' . $_POST['inseractive'] . '",1,"' . $_POST['typ'] . '");'; |
---|
328 | pwg_query($q); |
---|
329 | } |
---|
330 | $_SESSION['page_infos'] = array(l10n('Property photo add')); |
---|
331 | } else { |
---|
332 | if ($_POST['typ'] == '4'||$_POST['typ'] == '3'||$_POST['typ'] == '5'||$_POST['typ'] == '6') { |
---|
333 | $q = ' |
---|
334 | UPDATE ' . $prefixeTable . 'add_properties_photos' |
---|
335 | . ' set wording ="' . $_POST['inserwording'] . '" ' |
---|
336 | . ' ,active =' . $_POST['inseractive'] |
---|
337 | . ' ,Typ =' . $_POST['typ'] |
---|
338 | . ' ,dataprop =\'' . $select . '\' ' |
---|
339 | . ' WHERE id_prop_pho=' . $_POST['invisibleID'] . ';'; |
---|
340 | }else{ |
---|
341 | $q = ' |
---|
342 | UPDATE ' . $prefixeTable . 'add_properties_photos' |
---|
343 | . ' set wording ="' . $_POST['inserwording'] . '" ' |
---|
344 | . ' ,active=' . $_POST['inseractive'] |
---|
345 | . ' ,Typ =' . $_POST['typ'] |
---|
346 | . ' WHERE id_prop_pho=' . $_POST['invisibleID'] . ';'; |
---|
347 | } |
---|
348 | pwg_query($q); |
---|
349 | $_SESSION['page_infos'] = array(l10n('Property photo update')); |
---|
350 | } |
---|
351 | redirect($admin_base_url); |
---|
352 | } |
---|
353 | |
---|
354 | if (isset($_GET['delete'])) { |
---|
355 | check_input_parameter('delete', $_GET, false, PATTERN_ID); |
---|
356 | $query = 'DELETE FROM ' . ADD_PROP_PHOTO_TABLE . ' WHERE id_prop_pho = ' . $_GET['delete'] . ';'; |
---|
357 | pwg_query($query); |
---|
358 | $query = 'DELETE FROM ' . ADD_PROP_PHOTO_DATA_TABLE . ' WHERE id_prop_pho = ' . $_GET['delete'] . ';'; |
---|
359 | pwg_query($query); |
---|
360 | $query = 'DELETE FROM ' . ADD_PROP_PHOTO_DATADATE_TABLE . ' WHERE id_prop_pho = ' . $_GET['delete'] . ';'; |
---|
361 | pwg_query($query); |
---|
362 | |
---|
363 | $_SESSION['page_infos'] = array(l10n('Property delete')); |
---|
364 | redirect($admin_base_url); |
---|
365 | } |
---|
366 | |
---|
367 | if (isset($_GET['hide'])) { |
---|
368 | check_input_parameter('hide', $_GET, false, PATTERN_ID); |
---|
369 | $query = 'UPDATE ' . ADD_PROP_PHOTO_TABLE . ' SET active = 1 WHERE id_prop_pho=' . $_GET['hide'] . ';'; |
---|
370 | pwg_query($query); |
---|
371 | } |
---|
372 | |
---|
373 | if (isset($_GET['show'])) { |
---|
374 | check_input_parameter('show', $_GET, false, PATTERN_ID); |
---|
375 | $query = 'UPDATE ' . ADD_PROP_PHOTO_TABLE . ' SET active = 0 WHERE id_prop_pho=' . $_GET['show'] . ';'; |
---|
376 | pwg_query($query); |
---|
377 | } |
---|
378 | |
---|
379 | break; |
---|
380 | case 'config': |
---|
381 | $maxfields = (isset($conf['mpp_max_fields'])) ? $conf['mpp_max_fields'] : '5'; |
---|
382 | $template->assign('MPPMAXFIELD',$maxfields); |
---|
383 | $idexif = (isset($conf['mpp_idexif'])) ? $conf['mpp_idexif'] : ''; |
---|
384 | $template->assign('MPPIDEXIF',$idexif); |
---|
385 | $admin_base_url = ADD_PROP_PHOTO_ADMIN . '-config'; |
---|
386 | $template->assign( |
---|
387 | 'mppconfig', array( |
---|
388 | 'a' => 'a', |
---|
389 | )); |
---|
390 | |
---|
391 | $delpho = pwg_db_fetch_assoc(pwg_query('SELECT dataprop FROM ' . ADD_PROP_PHOTO_TABLE.' WHERE dataprop="DeletePhoto";')); |
---|
392 | if(empty($delpho)){ |
---|
393 | $template->assign( |
---|
394 | 'mppconfig', array( |
---|
395 | 'ADDPHOAC' => 'actiondelphoadd', |
---|
396 | )); |
---|
397 | } |
---|
398 | if (isset($_POST['submitadddelpho'])){ |
---|
399 | $result = pwg_query('SELECT MAX(orderprop) FROM '. ADD_PROP_PHOTO_TABLE ); |
---|
400 | $row = pwg_db_fetch_assoc($result); |
---|
401 | $or = ($row['MAX(orderprop)'] + 1); |
---|
402 | $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(wording,orderprop,active,edit,Typ,dataprop)VALUES ("**delpho**","' . $or . '","1",1,"2","DeletePhoto");'; |
---|
403 | pwg_query($q); |
---|
404 | header('Location:'.ADD_PROP_PHOTO_ADMIN . '-config'); |
---|
405 | } |
---|
406 | if (isset($_POST['submitremovedelpho'])){ |
---|
407 | $iddelpho = pwg_db_fetch_assoc(pwg_query('SELECT id_prop_pho FROM '. ADD_PROP_PHOTO_TABLE.' where dataprop="DeletePhoto";')); |
---|
408 | pwg_query('DELETE FROM ' . ADD_PROP_PHOTO_TABLE . ' where dataprop ="DeletePhoto";'); |
---|
409 | $query = 'DELETE FROM ' . ADD_PROP_PHOTO_DATADATE_TABLE . ' WHERE id_prop_pho = ' . $iddelpho['id_prop_pho'] . ';'; |
---|
410 | pwg_query($query); |
---|
411 | header('Location:'.ADD_PROP_PHOTO_ADMIN . '-config'); |
---|
412 | } |
---|
413 | $descpho = pwg_db_fetch_assoc(pwg_query('SELECT dataprop FROM ' . ADD_PROP_PHOTO_TABLE.' WHERE dataprop="movedescription";')); |
---|
414 | if(empty($descpho)){ |
---|
415 | $vars['MOVEDESC']='actionmovedesc'; |
---|
416 | $template->append('mppconfig', $vars, true); |
---|
417 | } |
---|
418 | if (isset($_POST['submitmovedesc'])){ |
---|
419 | $result = pwg_query('SELECT MAX(orderprop) FROM '. ADD_PROP_PHOTO_TABLE ); |
---|
420 | $row = pwg_db_fetch_assoc($result); |
---|
421 | $or = ($row['MAX(orderprop)'] + 1); |
---|
422 | $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(wording,orderprop,active,edit,Typ,dataprop)VALUES ("Description","' . $or . '","0",0,"1","movedescription");'; |
---|
423 | pwg_query($q); |
---|
424 | header('Location:'.ADD_PROP_PHOTO_ADMIN . '-config'); |
---|
425 | } |
---|
426 | if (isset($_POST['submitdefaultdesc'])){ |
---|
427 | pwg_query('DELETE FROM ' . ADD_PROP_PHOTO_TABLE . ' where dataprop ="movedescription";'); |
---|
428 | header('Location:'.ADD_PROP_PHOTO_ADMIN . '-config'); |
---|
429 | } |
---|
430 | if (isset($_POST['submitmppoption'])){ |
---|
431 | conf_update_param('mpp_max_fields', $_POST['mppmaxfield']); |
---|
432 | conf_update_param('mpp_idexif', $_POST['mppitidexif']); |
---|
433 | $_SESSION['page_infos'] = array(l10n('Information data registered in database')); |
---|
434 | redirect(ADD_PROP_PHOTO_ADMIN . '-config'); |
---|
435 | } |
---|
436 | break; |
---|
437 | } |
---|
438 | |
---|
439 | |
---|
440 | $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin/admin.tpl')); |
---|
441 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
442 | ?> |
---|