source: extensions/manage_properties_photos/admin.php @ 32225

Last change on this file since 32225 was 32218, checked in by ddtddt, 4 years ago

[manage_properties_photos]

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