source: extensions/AddInfo/admin/admin.php @ 30813

Last change on this file since 30813 was 30813, checked in by ddtddt, 9 years ago

[extensions] - Add info - update export to manage_properties_photos error case with linux

File size: 4.1 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3global $template, $conf, $user;
4include_once(PHPWG_ROOT_PATH .'admin/include/tabsheet.class.php');
5load_language('plugin.lang', ADDINFO_PATH);
6$my_base_url = get_admin_plugin_menu_link(__FILE__);
7
8// +-----------------------------------------------------------------------+
9// | Check Access and exit when user status is not ok                      |
10// +-----------------------------------------------------------------------+
11check_status(ACCESS_ADMINISTRATOR);
12
13//-------------------------------------------------------- sections definitions
14
15// Gestion des onglets
16if (!isset($_GET['tab']))
17    $page['tab'] = 'explication';
18else
19    $page['tab'] = $_GET['tab'];
20
21$tabsheet = new tabsheet();
22$tabsheet->add('explication',
23               l10n('addinfo_explication'),
24               $my_base_url.'&amp;tab=explication');
25$tabsheet->add('gestion',
26               l10n('Configuration'),
27               $my_base_url.'&amp;tab=gestion');
28$tabsheet->select($page['tab']);
29$tabsheet->assign();
30
31switch ($page['tab'])
32{
33// tab help
34  case 'explication':
35  $explication = 'explication';
36$template->assign(
37        $explication,
38        array(
39          'meta'=>l10n('meta_name'),
40          ));
41         
42        $exp = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'manage_properties_photos';"));
43        if($exp['state']=='active'){
44                $template->assign(
45                        'gestionC',
46                                array(
47                                 'meta'=>l10n('meta_name'),
48                ));
49        }       
50        if (isset($_POST['submitexpot'])){
51
52        $idinfo=pwg_db_fetch_assoc(pwg_query('SELECT id_prop_pho FROM ' . ADD_PROP_PHOTO_TABLE . ' ORDER BY id_prop_pho DESC LIMIT 1;'));       
53        $idinfo=$idinfo['id_prop_pho'];
54        $idinfo1=$idinfo+1;$idinfo2=$idinfo+2;$idinfo3=$idinfo+3;
55        $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES ('.$idinfo1.',"infos1",'.$idinfo1.',0,1);';
56    pwg_query($q);
57        $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES ('.$idinfo2.',"infos2",'.$idinfo2.',0,1);';
58    pwg_query($q);
59        $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES ('.$idinfo3.',"infos3",'.$idinfo3.',0,1);';
60    pwg_query($q);
61        $query = 'SELECT * FROM ' . ADDINFO_TABLE . ';';
62        $result = pwg_query($query);
63        if (pwg_db_num_rows($result)) {
64                while ($info = pwg_db_fetch_assoc($result)){
65                        $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos_data(id_img,id_prop_pho,data)VALUES ('.$info['id'].','.$idinfo1.',"'.$info['info1'].'");';
66                        pwg_query($q);
67                        $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos_data(id_img,id_prop_pho,data)VALUES ('.$info['id'].','.$idinfo2.',"'.$info['info2'].'");';
68                        pwg_query($q);
69                        $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos_data(id_img,id_prop_pho,data)VALUES ('.$info['id'].','.$idinfo3.',"'.$info['info3'].'");';
70                        pwg_query($q);
71
72                }
73        }
74        array_push($page['infos'], l10n('export is ok'));
75
76 
77
78       
79        } 
80         
81 
82        break;
83       
84  case 'gestion':
85
86  global $conf;
87 
88    $selected = $conf['AddInfo'];
89        $options['Author'] = l10n('Author');
90        $options['datecreate'] = l10n('Created on');
91        $options['datepost'] = l10n('Posted on');
92        $options['Dimensions'] = l10n('Dimensions');
93        $options['File'] = l10n('File');
94        $options['Filesize'] = l10n('Filesize');
95        $options['Tags'] = l10n('tags');
96        $options['Categories'] = l10n('Albums');
97        $options['Visits'] = l10n('Visits');
98        $options['Average'] = l10n('Rating score');
99
100       
101
102  $template->assign(
103    'gestionA',
104    array(
105      'OPTIONS' => $options,
106      'SELECTED' => $selected
107      ));
108   
109
110if (isset($_POST['infoaddinfo']))
111        {
112conf_update_param('AddInfo', $_POST['infoaddinfo']);
113$template->delete_compiled_templates();
114array_push($page['infos'], l10n('Your configuration settings are saved'));
115
116  $selected = $_POST['infoaddinfo'];
117  $template->assign(
118    'gestionA',
119    array(
120      'OPTIONS' => $options,
121      'SELECTED' => $selected
122      ));
123        }
124  break;
125       
126} 
127
128$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); 
129$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
130?>
Note: See TracBrowser for help on using the repository browser.