1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Piwigo - a PHP based picture gallery | |
---|
4 | // | Autosize | |
---|
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 | class autosize_controler { |
---|
23 | //============================================================ |
---|
24 | /* |
---|
25 | * cl_autosize_script_1 |
---|
26 | */ |
---|
27 | static public function cl_autosize_script_1() |
---|
28 | { |
---|
29 | global $user,$page,$template,$cl_plugin; |
---|
30 | // header ('X-UA-Compatible: n=7') ; |
---|
31 | // header ('X-UA-Compatible: IE=Edge') ; |
---|
32 | if(isset($page['body_id']) && $page['body_id'] == 'theAdminPage' ) return ; |
---|
33 | $ma_page=isset($page['body_id'])?$page['body_id']:"" ; |
---|
34 | if ($ma_page=='thePiwiShackControllerPage') return ; |
---|
35 | if (!isset($template->files['pamooramics_content'])) return ; |
---|
36 | if ('kardon' == $user['theme'] and isset($_GET['slideshow'])) return ; |
---|
37 | $has_pamoorama=isset($template->files['pamooramics_content']); |
---|
38 | |
---|
39 | $file =AUTOSIZE_PATH_ABS.'template/header.tpl' ; |
---|
40 | $template->set_filenames(array('autosize_init_header'=> $file )); |
---|
41 | $template->set_filenames(array('autosize_init'=>AUTOSIZE_PATH_ABS. "template/conflit.tpl" ) ); |
---|
42 | //================================================================ |
---|
43 | $DEBUG_autosize = isset($_POST['cl_debug_conflit']) ? $_POST['cl_debug_conflit'] : "false" ; |
---|
44 | $DEBUG_autosize = isset($_GET['cl_debug_conflit']) ? $_GET['cl_debug_conflit'] : $DEBUG_autosize ; |
---|
45 | $DEBUG_autosize = isset($conf['cl_debug_conflit']) ? $conf['cl_debug_conflit'] : $DEBUG_autosize ; |
---|
46 | //====================================================================== |
---|
47 | $autosize_parametres = cl_autosize_Get_Options() ; |
---|
48 | $theme=$user['theme']; |
---|
49 | $template->assign( |
---|
50 | array( |
---|
51 | 'autosize_parametres' => $autosize_parametres , |
---|
52 | 'cl_plugins' => $cl_plugin , |
---|
53 | 'cl_version' => $cl_plugin['version'] , |
---|
54 | 'name' => $cl_plugin['name'] , |
---|
55 | 'pamoorama' => $has_pamoorama, |
---|
56 | 'theme' => $theme , |
---|
57 | 'DEBUG_autosize' => $DEBUG_autosize , |
---|
58 | 'AUTOSIZE_PATH' => str_replace("../","",AUTOSIZE_PATH) , |
---|
59 | 'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS, |
---|
60 | 'Version_pwg' => PHPWG_VERSION ) |
---|
61 | ); |
---|
62 | $template->concat('cl_conflit_init', $template->parse('autosize_init_header', true)); |
---|
63 | return $template->parse( 'autosize_init', false); |
---|
64 | }// function cl_autosize_script_1 |
---|
65 | |
---|
66 | /************************************* |
---|
67 | * cl_autosize_script_2() |
---|
68 | **************************************/ |
---|
69 | static public function cl_autosize_script_2() |
---|
70 | { |
---|
71 | global $template,$user,$conf,$picture ,$page, $cl_plugin,$known_script ; |
---|
72 | global $template,$user,$conf,$picture ,$page, $cl_plugin ; |
---|
73 | if ('kardon' == $user['theme'] and isset($_GET['slideshow'])) return ; |
---|
74 | if (!isset($PAMOORAMICS_PATH)) return ; |
---|
75 | $AUTOSIZE_PATH = dirname(__FILE__).'/'; |
---|
76 | //================================================================ |
---|
77 | $DEBUG_autosize = isset($_POST['cl_debug_conflit']) ? $_POST['cl_debug_conflit'] : "false" ; |
---|
78 | $DEBUG_autosize = isset($_GET['cl_debug_conflit']) ? $_GET['cl_debug_conflit'] : $DEBUG_autosize ; |
---|
79 | $DEBUG_autosize = isset($conf['cl_debug_conflit']) ? $conf['cl_debug_conflit'] : $DEBUG_autosize ; |
---|
80 | //===================================================================== |
---|
81 | $ma_page=isset($page['body_id'])?$page['body_id']:"" ; |
---|
82 | $theme=$user['theme']; |
---|
83 | if ($ma_page=='thePiwiShackControllerPage') return ; |
---|
84 | $img_width=isset($picture['current']['width'])?$picture['current']['width']:480; |
---|
85 | $img_height=isset($picture['current']['height'])?$picture['current']['height']:320; |
---|
86 | $img_scaled_width=isset($picture['current']['scaled_width'])?$picture['current']['scaled_width']:480; |
---|
87 | $img_scaled_height=isset($picture['current']['scaled_height'])?$picture['current']['scaled_height']:320; |
---|
88 | $src_img_h=isset($_POST['src_img_h'])?$_POST['src_img_h']: $img_width ; |
---|
89 | $src_img_w= isset($_POST['src_img_w'])?$_POST['src_img_w']:$img_height ; |
---|
90 | if(isset($_COOKIE['img_w'])){ |
---|
91 | $src_img_w=$_COOKIE['img_w']; |
---|
92 | $src_img_h=$_COOKIE['img_h']; |
---|
93 | } |
---|
94 | |
---|
95 | $window_height= isset($_POST['window_height'])?$_POST['window_height']: $img_scaled_height ; |
---|
96 | $window_width= isset($_POST['window_width'])?$_POST['window_width']: $img_scaled_width ; |
---|
97 | |
---|
98 | |
---|
99 | $size=array( |
---|
100 | 'src_img_h' => $src_img_h, |
---|
101 | 'src_img_w' => $src_img_w, |
---|
102 | 'window_height' =>$window_height, |
---|
103 | 'window_width' => $window_width |
---|
104 | |
---|
105 | ); |
---|
106 | |
---|
107 | $template->assign( |
---|
108 | array( |
---|
109 | 'cl_version' => $cl_plugin['version'] , |
---|
110 | 'name' => $cl_plugin['name'] , |
---|
111 | 'ma_page' => $ma_page, |
---|
112 | |
---|
113 | 'theme' => $theme , |
---|
114 | 'DEBUG_autosize' => $DEBUG_autosize , |
---|
115 | 'AUTOSIZE_PATH' => AUTOSIZE_PATH, |
---|
116 | 'Size' => $size |
---|
117 | |
---|
118 | ) |
---|
119 | ); |
---|
120 | include_once (PHPWG_ROOT_PATH.'include/functions_cookie.inc.php') ; |
---|
121 | $autoscript="<script type='text/javascript'> |
---|
122 | /* cl_autosize_script_2 */ |
---|
123 | if (typeof (save_framework) == 'function') |
---|
124 | save_framework('".$ma_page."'); |
---|
125 | var cookie_path ='". cookie_path() ."' |
---|
126 | </script>"; |
---|
127 | $template->append('footer_elements',$autoscript); |
---|
128 | return ; |
---|
129 | }// function cl_autosize_script_2 |
---|
130 | /************************************* |
---|
131 | * cl_autosize_script_3() |
---|
132 | **************************************/ |
---|
133 | static public function cl_autosize_script_3() |
---|
134 | { |
---|
135 | global $template; |
---|
136 | |
---|
137 | |
---|
138 | $has_pamoorama=isset($template->files['pamooramics_content']); |
---|
139 | if (!$has_pamoorama) return ; |
---|
140 | |
---|
141 | $autoscript="<div id='debug' >TEST</div> |
---|
142 | <script type='text/javascript'> |
---|
143 | if (typeof (Ajout_Ajax) == 'function') |
---|
144 | Ajout_Ajax(); |
---|
145 | </script>"; |
---|
146 | $template->append('footer_elements',$autoscript); |
---|
147 | return ; |
---|
148 | }// function cl_autosize_script_3 |
---|
149 | |
---|
150 | //================================================================ |
---|
151 | /* |
---|
152 | * cl_autosize_admin |
---|
153 | */ |
---|
154 | static public function cl_autosize_admin($menu) |
---|
155 | { |
---|
156 | global $lang ; |
---|
157 | array_push($menu, array('NAME' => 'Autosize', |
---|
158 | 'URL' => get_admin_plugin_menu_link(AUTOSIZE_PATH . 'admin/admin_autosize.php'))); |
---|
159 | return $menu; |
---|
160 | } //function cl_autosize_admin |
---|
161 | //===================================== |
---|
162 | |
---|
163 | |
---|
164 | // this is the default handler that generates the display for the element |
---|
165 | static public function autosize_calcContent($content) |
---|
166 | { |
---|
167 | global $conf; |
---|
168 | |
---|
169 | global $page, $template,$picture; |
---|
170 | |
---|
171 | |
---|
172 | $current = $template->get_template_vars('current'); |
---|
173 | $defined_types = array_keys(ImageStdParams::get_defined_type_map()); |
---|
174 | if (isset($current)){ |
---|
175 | if (!isset($current['selected_derivative'])){ |
---|
176 | $model= $defined_types[count($defined_types)-1]; |
---|
177 | $selected_derivative = $current['derivatives'][$model]; |
---|
178 | $template->append('current', array( |
---|
179 | 'selected_derivative' => $selected_derivative |
---|
180 | ), true); |
---|
181 | |
---|
182 | |
---|
183 | $current = $template->get_template_vars('current'); |
---|
184 | } |
---|
185 | |
---|
186 | $derivative=$current['selected_derivative'] ; |
---|
187 | $imgScaledWH=$derivative->src_image->get_size(); |
---|
188 | $imgSizeWH = $derivative->get_size(); |
---|
189 | $img_type = $derivative->get_type(); |
---|
190 | $img_url = $derivative->get_url(); |
---|
191 | $img_all= $derivative->get_all($derivative->src_image); |
---|
192 | $scaled_size=$derivative->get_size_hr(); //792 x 441 |
---|
193 | $scaled_size=$derivative->get_scaled_size_htm(); // width="792" height="441" |
---|
194 | //================= taille mis a l'échelle |
---|
195 | $scaled_size=$derivative->get_scaled_size(100,100); // array([0]=>100,[1]=>55) |
---|
196 | $src= $derivative->src_image ; |
---|
197 | |
---|
198 | } |
---|
199 | |
---|
200 | $img_scaled_width=isset($imgScaledWH)?$imgScaledWH[0]:"480"; |
---|
201 | $img_scaled_height=isset($imgScaledWH)?$imgScaledWH[1]:"320"; |
---|
202 | $current = $template->get_template_vars('picture'); |
---|
203 | $picture['current']['scaled_width']=$img_scaled_width; |
---|
204 | $picture['current']['scaled_height']= $img_scaled_height; |
---|
205 | $picture['current']['image_url']=$src->rel_path; |
---|
206 | |
---|
207 | } |
---|
208 | |
---|
209 | //=============================================================== |
---|
210 | /* |
---|
211 | * |
---|
212 | */ |
---|
213 | static public function cl_autosize_affiche() |
---|
214 | { |
---|
215 | global $user, $picture, $template,$page,$known_script; |
---|
216 | global $content, $element_info; |
---|
217 | global $infos_message,$erreur_message; |
---|
218 | global $conf,$lang ,$user,$userdata; |
---|
219 | if ('kardon' == $user['theme'] and isset($_GET['slideshow'])) return ; |
---|
220 | load_language('plugin.lang', AUTOSIZE_PATH); |
---|
221 | |
---|
222 | $AUTOSIZE_PATH = dirname(__FILE__).'/'; |
---|
223 | if (isset( $page['body_id']) && $page['body_id']=='thePicturePage' ) { |
---|
224 | if ( isset($picture['current'])){ |
---|
225 | $autosize_parametres = cl_autosize_Get_Options(); |
---|
226 | include (AUTOSIZE_PATH."include/affiche.php"); |
---|
227 | $file =AUTOSIZE_PATH_ABS.'template/picture_1.tpl' ; |
---|
228 | $template->set_filenames(array('autosize_content_header'=> $file )); |
---|
229 | $template->concat('autosize_content', $template->parse('autosize_content_header', true)); |
---|
230 | $template->set_filenames(array('autosize_init_header'=> $file )); |
---|
231 | $theme=$user['theme']; |
---|
232 | $deriv_type = pwg_get_session_var('picture_deriv', IMG_LARGE); |
---|
233 | $defined_types = array_keys(ImageStdParams::get_defined_type_map()); |
---|
234 | |
---|
235 | if($autosize_parametres->check_icon_v == 'on'){ |
---|
236 | $template->assign('cl_autosize_button', |
---|
237 | array( 'cl_autosize_info' => 'cl_autosize_info' , |
---|
238 | 'cl_autosize_info_1' => 'cl_autosize_info_' , |
---|
239 | 'cl_autosize_info_2' => 'cl_autosize_info_2' , |
---|
240 | 'URL' => $_SERVER['REQUEST_URI'] , |
---|
241 | 'ICON2' => AUTOSIZE_PATH . 'icons/button-maximize.png', |
---|
242 | 'ICON' => AUTOSIZE_PATH . 'icons/button-minimize.png', |
---|
243 | 'ICON1' => AUTOSIZE_PATH . 'icons/button-no.png' |
---|
244 | ) |
---|
245 | |
---|
246 | ); |
---|
247 | $template->set_filenames(array('cl_bp' => $AUTOSIZE_PATH. 'template/picture.tpl')); |
---|
248 | $template->concat('PLUGIN_PICTURE_ACTIONS', $template->parse('cl_bp', true)); |
---|
249 | } |
---|
250 | $template->set_filenames( |
---|
251 | array('autosize_content'=> $AUTOSIZE_PATH.'template/autosize.tpl', |
---|
252 | 'theme' => $theme ) |
---|
253 | ); |
---|
254 | $template->concat('autosize_content', $template->parse('autosize_content_header', true)); |
---|
255 | if(isset($conf['go_up_down']) && ($conf['go_up_down']==true) ){ |
---|
256 | $template->set_filenames(array('mes_script' => realpath(AUTOSIZE_PATH).'/template/mes_scripts.tpl') ); |
---|
257 | $template->func_combine_script(array('id'=>'my_script_2', |
---|
258 | 'path'=> AUTOSIZE_PATH.'/js/JScript.js', |
---|
259 | 'require' => 'jquery'), |
---|
260 | $template->smarty); |
---|
261 | $template->assign(array( |
---|
262 | 'MY_FOOTER_PATH' =>AUTOSIZE_PATH |
---|
263 | )); |
---|
264 | |
---|
265 | $template->parse('mes_script'); |
---|
266 | } |
---|
267 | |
---|
268 | return $template->parse( 'autosize_content', false); |
---|
269 | } |
---|
270 | } |
---|
271 | |
---|
272 | } //public function cl_autosize_affiche |
---|
273 | //=============================================================== |
---|
274 | /* |
---|
275 | * |
---|
276 | */ |
---|
277 | static public function cl_autosize_aff_infos_plus() |
---|
278 | { |
---|
279 | global $template,$infos_message,$erreur_message, $user ; |
---|
280 | global $conf,$lang ; |
---|
281 | |
---|
282 | //============================================================== |
---|
283 | if (isset($erreur_message)) |
---|
284 | { |
---|
285 | if ($erreur_message <> "") |
---|
286 | { |
---|
287 | $erreur_message=str_replace("\n",'<br />',$erreur_message) ; |
---|
288 | $template->assign('errors',$erreur_message); |
---|
289 | $erreur_message=""; |
---|
290 | } |
---|
291 | } |
---|
292 | if (isset($infos_message)) |
---|
293 | { |
---|
294 | |
---|
295 | if ($infos_message <> "") |
---|
296 | { |
---|
297 | $infos_message=str_replace("\n",'<br />',$infos_message) ; |
---|
298 | $template->assign('infos',$infos_message); |
---|
299 | $infos_message=""; |
---|
300 | } |
---|
301 | } |
---|
302 | //============================================================= |
---|
303 | return; |
---|
304 | |
---|
305 | } // function cl_autosize_aff_infos_plus |
---|
306 | //=============================================================== |
---|
307 | /* |
---|
308 | * |
---|
309 | */ |
---|
310 | static public function cl_ajuste_data($content){ |
---|
311 | global $template,$user,$conf,$picture ; |
---|
312 | global $size; |
---|
313 | $AUTOSIZE_PATH = realpath(AUTOSIZE_PATH .'/'); |
---|
314 | $userdata=$user; |
---|
315 | $fields = array( 'maxwidth', 'maxheight' ); |
---|
316 | |
---|
317 | $ThePicture = $template->get_template_vars('current'); |
---|
318 | $data = array(); |
---|
319 | return $content; |
---|
320 | |
---|
321 | $data['maxwidth'] = $size['src_img_w']; |
---|
322 | $data['maxheight'] =$size['src_img_h']; |
---|
323 | $data['user_id'] = $userdata['id']; |
---|
324 | foreach ($fields as $field) |
---|
325 | { |
---|
326 | if (isset($_POST[$field])) |
---|
327 | { |
---|
328 | $data[$field] = $_POST[$field]; |
---|
329 | } |
---|
330 | } |
---|
331 | |
---|
332 | if($data['maxwidth'] != "" ) |
---|
333 | { |
---|
334 | $picture['current']['scaled_width']=$data['maxwidth']; |
---|
335 | $picture['current']['scaled_height']=$data['maxheight']; |
---|
336 | mass_updates(USER_INFOS_TABLE, |
---|
337 | array('primary' => array('user_id'), 'update' => $fields), |
---|
338 | array($data)); |
---|
339 | } |
---|
340 | |
---|
341 | return $content; |
---|
342 | } |
---|
343 | |
---|
344 | |
---|
345 | /**************************************** |
---|
346 | * |
---|
347 | ****************************************/ |
---|
348 | function Get_Options(&$parametres,$str_index){ |
---|
349 | global $conf ; |
---|
350 | if (!isset( $conf[$str_index])) { |
---|
351 | $conf[$str_index]=""; |
---|
352 | } |
---|
353 | $m_options= $conf[$str_index]; |
---|
354 | if(isset($m_options)) |
---|
355 | if ( preg_match("|s:(.*)|", $m_options, $val) ) |
---|
356 | $parametres = unserialize($conf[$str_index]); |
---|
357 | else{ |
---|
358 | $parametres=explode(",",$_options); |
---|
359 | } |
---|
360 | //====== par defaut ======================= |
---|
361 | $new_val=false; |
---|
362 | $def_para=Array(); |
---|
363 | |
---|
364 | $def_para['query'] = 'Qt' ; |
---|
365 | $def_para['type'] = 'Ty' ; |
---|
366 | |
---|
367 | $def_para['webmaster_type'] = 'Autosize' ; |
---|
368 | $def_para['admin_type'] = 'Autosize' ; |
---|
369 | $def_para['generic_type'] = 'Autosize' ; |
---|
370 | $def_para['guest_type'] = 'Autosize' ; |
---|
371 | $def_para['normal_type'] = 'Autosize' ; |
---|
372 | |
---|
373 | |
---|
374 | |
---|
375 | $def_para['mini_height'] = '150' ; |
---|
376 | $def_para['mini_width'] = '300' ; |
---|
377 | |
---|
378 | $def_para['mini_height2'] = '150' ; |
---|
379 | $def_para['mini_width2'] = '300' ; |
---|
380 | |
---|
381 | $def_para['echelle_max'] = '1.0'; |
---|
382 | $def_para['marge_basse'] = '0'; |
---|
383 | $def_para['fade_in'] = '0'; |
---|
384 | //================================================== |
---|
385 | $def_para['check_desc_v'] = "off" ; |
---|
386 | $def_para['check_icon_v'] = "off" ; |
---|
387 | |
---|
388 | $def_para['webmaster_enabled'] = "off" ; |
---|
389 | $def_para['admin_enabled'] = "off" ; |
---|
390 | $def_para['generic_enabled'] = "off" ; |
---|
391 | $def_para['guest_enabled'] = "off" ; |
---|
392 | $def_para['normal_enabled'] = "off" ; |
---|
393 | //=================================================== |
---|
394 | $para=$def_para; |
---|
395 | foreach ($para as $key => $value) { |
---|
396 | if( isset($parametres->$key) ){ |
---|
397 | $value=$parametres->$key; |
---|
398 | } |
---|
399 | if($def_para[$key] =="on" ||$def_para[$key] =="off" ){ |
---|
400 | $val_pg=(isset($_POST[$key]))? ($_POST[$key]=="off"||$_POST[$key]=="on")?$_POST[$key]:"on" : "off" ; |
---|
401 | $value =(isset($_POST[$key]))? $val_pg : $value ; |
---|
402 | $val_pg=(isset($_GET[$key]))? ($_GET[$key]=="off"||$_GET[$key]=="on")?$_GET[$key]:"on" : "off" ; |
---|
403 | $value =(isset($_GET[$key]))? $val_pg : $value ; |
---|
404 | }else{ |
---|
405 | $value =(isset($_POST[$key]))? $_POST[$key] : $value ; |
---|
406 | $value =(isset($_GET[$key]))? $_GET[$key] : $value ; |
---|
407 | } |
---|
408 | unset( $parametres->$key) ; |
---|
409 | $parametres->$key = $value ; |
---|
410 | } |
---|
411 | return $parametres ; |
---|
412 | } |
---|
413 | } // class |
---|
414 | |
---|
415 | /************************************* |
---|
416 | * |
---|
417 | *************************************/ |
---|
418 | function cl_autosize_Get_Options() |
---|
419 | { |
---|
420 | global $conf,$autosize_parametres; |
---|
421 | $autosize_parametres =""; |
---|
422 | |
---|
423 | if (!isset($conf['cl_autosize'])) { |
---|
424 | $conf['cl_autosize']=""; |
---|
425 | $q = ' |
---|
426 | INSERT INTO '.CONFIG_TABLE.' (param, value, comment) |
---|
427 | VALUES ("cl_autosize","","Parametres du plugin Autosize") |
---|
428 | ;'; |
---|
429 | pwg_query($q); |
---|
430 | } |
---|
431 | |
---|
432 | |
---|
433 | |
---|
434 | $autosize_parametres = unserialize($conf['cl_autosize']); |
---|
435 | // $autosize_parametres = autosize_controler::Get_Options($autosize_parametres,'cl_autosize'); |
---|
436 | $autosize_parametres = cl_autosize_Set_Options(); |
---|
437 | return $autosize_parametres; |
---|
438 | } |
---|
439 | /* |
---|
440 | * |
---|
441 | */ |
---|
442 | function cl_autosize_Set_Options() { |
---|
443 | global $autosize_parametres; |
---|
444 | //============================================================================= |
---|
445 | $my_para=$autosize_parametres; |
---|
446 | if (empty($my_para)) |
---|
447 | $my_para = (object) ''; |
---|
448 | |
---|
449 | $my_para->query =(isset($_POST['query'])) ? $_POST['query'] : ((isset($my_para->query )) ? $my_para->query : 'Qt' ) ; |
---|
450 | $my_para->type=(isset($_POST['type']))? $_POST['type']: ((isset($my_para->type)) ? $my_para->type: 'Ty') ; |
---|
451 | |
---|
452 | $my_para->webmaster_type =(isset($_POST['webmaster_type'])) ? $_POST['webmaster_type'] : ((isset($my_para->webmaster_type )) ? $my_para->webmaster_type : 'Autosize' ) ; |
---|
453 | |
---|
454 | $my_para->admin_type =(isset($_POST['admin_type'])) ? $_POST['admin_type'] : ((isset($my_para->admin_type )) ? $my_para->admin_type : 'Autosize' ) ; |
---|
455 | |
---|
456 | $my_para->generic_type =(isset($_POST['generic_type'])) ? $_POST['generic_type'] : ((isset($my_para->generic_type )) ? $my_para->generic_type : 'Autosize' ) ; |
---|
457 | |
---|
458 | |
---|
459 | $my_para->guest_type =(isset($_POST['guest_type'])) ? $_POST['guest_type'] : ((isset($my_para->guest_type )) ? $my_para->guest_type : 'Autosize' ) ; |
---|
460 | |
---|
461 | |
---|
462 | $my_para->normal_type =(isset($_POST['normal_type'])) ? $_POST['normal_type'] : ((isset($my_para->normal_type )) ? $my_para->normal_type : 'Autosize' ) ; |
---|
463 | |
---|
464 | |
---|
465 | |
---|
466 | $my_para->mini_height =(isset($_POST['mini_height'])) ? $_POST['mini_height'] : ((isset($my_para->mini_height )) ? $my_para->mini_height : '150' ) ; |
---|
467 | $my_para->mini_width=(isset($_POST['mini_width']))? $_POST['mini_width']: ((isset($my_para->mini_width)) ? $my_para->mini_width: '300') ; |
---|
468 | |
---|
469 | $my_para->mini_height2 =(isset($_POST['mini_height2'])) ? $_POST['mini_height2'] : ((isset($my_para->mini_height2 )) ? $my_para->mini_height2 : '150' ) ; |
---|
470 | $my_para->mini_width2=(isset($_POST['mini_width2']))? $_POST['mini_width2']: ((isset($my_para->mini_width2)) ? $my_para->mini_width2: '300') ; |
---|
471 | |
---|
472 | $my_para->echelle_max=(isset($_POST['echelle_max']))? $_POST['echelle_max'] : ((isset($my_para->echelle_max)) ? $my_para->echelle_max : '1.0'); |
---|
473 | $my_para->marge_basse=(isset($_POST['marge_basse']))? $_POST['marge_basse']: ((isset($my_para->marge_basse)) ? $my_para->marge_basse : '0'); |
---|
474 | $my_para->fade_in=(isset($_POST['fade_in']))? $_POST['fade_in']: ((isset($my_para->fade_in)) ? $my_para->fade_in : '0'); |
---|
475 | |
---|
476 | //=============================================================================== |
---|
477 | |
---|
478 | if ( isset($_POST['submit'] ) && $_POST['submit'] == l10n('cl_autosize_save') ) { |
---|
479 | $my_para->check_desc_v = isset($_POST['check_desc_v']) ? $_POST['check_desc_v'] : "off" ; |
---|
480 | $my_para->check_icon_v = isset($_POST['check_icon_v']) ? $_POST['check_icon_v'] : "off" ; |
---|
481 | |
---|
482 | |
---|
483 | $my_para->webmaster_enabled = isset($_POST['webmaster_enabled']) ? $_POST['webmaster_enabled'] : "off" ; |
---|
484 | $my_para->admin_enabled = isset($_POST['admin_enabled']) ? $_POST['admin_enabled'] : "off" ; |
---|
485 | $my_para->generic_enabled = isset($_POST['generic_enabled']) ? $_POST['generic_enabled'] : "off" ; |
---|
486 | $my_para->guest_enabled = isset($_POST['guest_enabled']) ? $_POST['guest_enabled'] : "off" ; |
---|
487 | $my_para->normal_enabled = isset($_POST['normal_enabled']) ? $_POST['normal_enabled'] : "off" ; |
---|
488 | |
---|
489 | }else{ |
---|
490 | $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') ; |
---|
491 | $my_para->check_icon_v = isset($_POST['check_icon_v']) ? $_POST['check_icon_v'] : ( ( isset($my_para->check_icon_v) ) ? $my_para->check_icon_v : 'off') ; |
---|
492 | |
---|
493 | |
---|
494 | |
---|
495 | $my_para->webmaster_enabled = isset($_POST['webmaster_enabled']) ? $_POST['webmaster_enabled'] : ( ( isset($my_para->webmaster_enabled) ) ? $my_para->webmaster_enabled : 'on') ; |
---|
496 | $my_para->admin_enabled = isset($_POST['admin_enabled ']) ? $_POST['admin_enabled '] : ( ( isset($my_para->admin_enabled ) ) ? $my_para->admin_enabled : 'on') ; |
---|
497 | $my_para->generic_enabled = isset($_POST['generic_enabled']) ? $_POST['generic_enabled'] : ( ( isset($my_para->generic_enabled) ) ? $my_para->generic_enabled : 'on') ; |
---|
498 | $my_para->guest_enabled = isset($_POST['guest_enabled']) ? $_POST['guest_enabled'] : ( ( isset($my_para->guest_enabled) ) ? $my_para->guest_enabled : 'on') ; |
---|
499 | $my_para->normal_enabled = isset($_POST['normal_enabled']) ? $_POST['normal_enabled'] : ( ( isset($my_para->normal_enabled) ) ? $my_para->normal_enabled : 'on') ; |
---|
500 | |
---|
501 | |
---|
502 | } |
---|
503 | |
---|
504 | return $my_para; |
---|
505 | } |
---|
506 | /* |
---|
507 | * |
---|
508 | */ |
---|
509 | function cl_autosize_sauve_options_inf() |
---|
510 | { |
---|
511 | global $options,$infos_message,$conf,$autosize_parametres ; |
---|
512 | $infos_message .=l10n("cl_autosize_save_config")."<br>"; |
---|
513 | $autosize_parametres=cl_autosize_Set_Options(); |
---|
514 | if ( isset($autosize_parametres) ) { |
---|
515 | $query = ' |
---|
516 | UPDATE '.CONFIG_TABLE.' |
---|
517 | SET value="'.addslashes(serialize($autosize_parametres)).'" |
---|
518 | WHERE param = "cl_autosize" |
---|
519 | LIMIT 1'; |
---|
520 | pwg_query($query); |
---|
521 | } |
---|
522 | |
---|
523 | } |
---|
524 | |
---|
525 | function auto_memo_var($variables) |
---|
526 | { |
---|
527 | ob_start(); |
---|
528 | echo '<pre>'; |
---|
529 | print_r($variables); |
---|
530 | echo '</pre>'; |
---|
531 | $m= ob_get_contents(); |
---|
532 | ob_end_clean(); |
---|
533 | return $m; |
---|
534 | } |
---|
535 | |
---|
536 | |
---|
537 | ?> |
---|