1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Piwigo - a PHP based picture gallery | |
---|
4 | // | EDIT_CL | |
---|
5 | // +-----------------------------------------------------------------------+ |
---|
6 | // | Copyright(C) 2010 cljosse | |
---|
7 | // +-----------------------------------------------------------------------+ |
---|
8 | // | This program is free software; you can redistribute it and/or modify | |
---|
9 | // | it under the terms of the GNU General Public License as published by | |
---|
10 | // | the Free Software Foundation | |
---|
11 | // | | |
---|
12 | // | This program is distributed in the hope that it will be useful, but | |
---|
13 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
14 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
15 | // | General Public License for more details. | |
---|
16 | // | | |
---|
17 | // | You should have received a copy of the GNU General Public License | |
---|
18 | // | along with this program; if not, write to the Free Software | |
---|
19 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
20 | // | USA. | |
---|
21 | // +-----------------------------------------------------------------------+ |
---|
22 | if (!defined('EDIT_CL_PATH')) |
---|
23 | define( |
---|
24 | 'EDIT_CL_PATH', |
---|
25 | PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/' |
---|
26 | ); |
---|
27 | if (!defined('ROOT_URL')) |
---|
28 | define( 'ROOT_URL', get_root_url().'/' ); |
---|
29 | |
---|
30 | $EDIT_CL_PATH_ABS=str_replace('\\','/',dirname(__FILE__) ); |
---|
31 | if (!defined('EDIT_CL_PATH_ABS')) |
---|
32 | define( |
---|
33 | 'EDIT_CL_PATH_ABS', $EDIT_CL_PATH_ABS."/" |
---|
34 | ); |
---|
35 | |
---|
36 | class cl_edit_functions { |
---|
37 | static public function Memo_vars($variables) { |
---|
38 | ob_start(); |
---|
39 | echo '<pre>'; |
---|
40 | print_r($variables); |
---|
41 | echo '</pre>'; |
---|
42 | $m= ob_get_contents(); |
---|
43 | ob_end_clean(); |
---|
44 | return $m; |
---|
45 | } |
---|
46 | |
---|
47 | /** |
---|
48 | * list all columns of each given table |
---|
49 | * |
---|
50 | * @return array of array |
---|
51 | */ |
---|
52 | static public function Get_columns_of($table){ |
---|
53 | $columns_of = array(); |
---|
54 | $query = 'DESC '.$table.';'; |
---|
55 | $result = mysql_query($query); |
---|
56 | $columns_of[$table] = array(); |
---|
57 | |
---|
58 | if ($result) |
---|
59 | while ($row = mysql_fetch_row($result)) |
---|
60 | array_push($columns_of[$table], $row[0]); |
---|
61 | |
---|
62 | return $columns_of; |
---|
63 | } |
---|
64 | } |
---|
65 | |
---|
66 | class cl_edit_controler { |
---|
67 | |
---|
68 | static public function cl_edit_admin_menu($menu) |
---|
69 | { |
---|
70 | include_once( dirname(__FILE__) .'/include/functions.php'); |
---|
71 | add_event_handler('invalidate_user_cache', 'cl_meta_invalidate_cache' ); |
---|
72 | array_push($menu, |
---|
73 | array( |
---|
74 | 'NAME' => 'EDIT Maps & Earth', |
---|
75 | 'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin/admin.php') ) |
---|
76 | ); |
---|
77 | return $menu; |
---|
78 | } |
---|
79 | |
---|
80 | |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | |
---|
85 | /* |
---|
86 | * |
---|
87 | */ |
---|
88 | function cl_edit_Get_Options() |
---|
89 | { |
---|
90 | global $conf,$EDIT_CL_parametres; |
---|
91 | $EDIT_CL_parametres = unserialize($conf['cl_edit']); |
---|
92 | $EDIT_CL_parametres = cl_edit_Set_Options(); |
---|
93 | return $EDIT_CL_parametres; |
---|
94 | } |
---|
95 | /* |
---|
96 | * |
---|
97 | */ |
---|
98 | function cl_edit_Set_Options() |
---|
99 | { |
---|
100 | |
---|
101 | global $EDIT_CL_parametres; |
---|
102 | //============================================================================= |
---|
103 | $my_para=$EDIT_CL_parametres; |
---|
104 | $my_para->type=(isset($_POST['type']))? $_POST['type']: ((isset($my_para->type)) ? $my_para->type: 'Ty') ; |
---|
105 | |
---|
106 | //=============================================================================== |
---|
107 | |
---|
108 | if ( isset($_POST['submit'] ) && $_POST['submit'] == l10n('cl_edit_save') ) { |
---|
109 | $my_para->check_desc_v = isset($_POST['check_desc_v']) ? $_POST['check_desc_v'] : "off" ; |
---|
110 | |
---|
111 | }else{ |
---|
112 | $my_para->check_desc_v = isset($_POST['check_desc_v']) ? $_POST['check_desc_v'] : ( ( isset($my_para->check_desc_v) ) ? $my_para->check_desc_v : 'off') ; |
---|
113 | |
---|
114 | |
---|
115 | } |
---|
116 | |
---|
117 | return $my_para; |
---|
118 | } |
---|
119 | /* |
---|
120 | * |
---|
121 | */ |
---|
122 | function cl_edit_sauve_options_inf() |
---|
123 | { |
---|
124 | global $options,$infos_message,$conf,$EDIT_CL_parametres ; |
---|
125 | $infos_message .=l10n("cl_edit_save_config")."<br>"; |
---|
126 | $EDIT_CL_parametres=cl_edit_Set_Options(); |
---|
127 | |
---|
128 | if ( isset($EDIT_CL_parametres) ) |
---|
129 | { |
---|
130 | |
---|
131 | $query = ' |
---|
132 | UPDATE '.CONFIG_TABLE.' |
---|
133 | SET value="'.addslashes(serialize($EDIT_CL_parametres)).'" |
---|
134 | WHERE param = "cl_EDIT_CL" |
---|
135 | LIMIT 1'; |
---|
136 | pwg_query($query); |
---|
137 | } |
---|
138 | |
---|
139 | } |
---|
140 | |
---|
141 | |
---|
142 | |
---|
143 | } // class |
---|
144 | |
---|
145 | |
---|
146 | ?> |
---|