source: extensions/manage_properties_photos/admin.php @ 32184

Last change on this file since 32184 was 32180, checked in by ddtddt, 4 years ago

[manage_properties_photos]

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