[7375] | 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 { |
---|
[8627] | 23 | //============================================================ |
---|
| 24 | /* |
---|
| 25 | * cl_autosize_script_1 |
---|
| 26 | */ |
---|
| 27 | static public function cl_autosize_script_1() |
---|
| 28 | { |
---|
[17192] | 29 | global $user,$page,$template,$cl_plugin; |
---|
[12527] | 30 | // header ('X-UA-Compatible: n=7') ; |
---|
| 31 | // header ('X-UA-Compatible: IE=Edge') ; |
---|
[17308] | 32 | if(isset($page['body_id']) && $page['body_id'] == 'theAdminPage' ) return ; |
---|
[10347] | 33 | $ma_page=isset($page['body_id'])?$page['body_id']:"" ; |
---|
| 34 | if ($ma_page=='thePiwiShackControllerPage') return ; |
---|
[17308] | 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' ; |
---|
[10347] | 40 | $template->set_filenames(array('autosize_init_header'=> $file )); |
---|
[10845] | 41 | $template->set_filenames(array('autosize_init'=>AUTOSIZE_PATH_ABS. "template/conflit.tpl" ) ); |
---|
[16931] | 42 | //================================================================ |
---|
[10845] | 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 ; |
---|
[16931] | 46 | //====================================================================== |
---|
[10347] | 47 | $autosize_parametres = cl_autosize_Get_Options() ; |
---|
| 48 | $theme=$user['theme']; |
---|
| 49 | $template->assign( |
---|
| 50 | array( |
---|
[17308] | 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 ) |
---|
[10347] | 61 | ); |
---|
[8957] | 62 | $template->concat('cl_conflit_init', $template->parse('autosize_init_header', true)); |
---|
[8627] | 63 | return $template->parse( 'autosize_init', false); |
---|
| 64 | }// function cl_autosize_script_1 |
---|
[16931] | 65 | |
---|
| 66 | /************************************* |
---|
| 67 | * cl_autosize_script_2() |
---|
| 68 | **************************************/ |
---|
[8627] | 69 | static public function cl_autosize_script_2() |
---|
| 70 | { |
---|
[8911] | 71 | global $template,$user,$conf,$picture ,$page, $cl_plugin,$known_script ; |
---|
[17192] | 72 | global $template,$user,$conf,$picture ,$page, $cl_plugin ; |
---|
[11429] | 73 | if ('kardon' == $user['theme'] and isset($_GET['slideshow'])) return ; |
---|
[17192] | 74 | if (!isset($PAMOORAMICS_PATH)) return ; |
---|
[11429] | 75 | $AUTOSIZE_PATH = dirname(__FILE__).'/'; |
---|
[16931] | 76 | //================================================================ |
---|
[10845] | 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 ; |
---|
[16931] | 80 | //===================================================================== |
---|
[17308] | 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 ; |
---|
[12527] | 90 | if(isset($_COOKIE['img_w'])){ |
---|
[17308] | 91 | $src_img_w=$_COOKIE['img_w']; |
---|
| 92 | $src_img_h=$_COOKIE['img_h']; |
---|
[12527] | 93 | } |
---|
| 94 | |
---|
[11961] | 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 |
---|
[12527] | 104 | |
---|
[11961] | 105 | ); |
---|
| 106 | |
---|
[8627] | 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 , |
---|
[10845] | 114 | 'DEBUG_autosize' => $DEBUG_autosize , |
---|
[11961] | 115 | 'AUTOSIZE_PATH' => AUTOSIZE_PATH, |
---|
| 116 | 'Size' => $size |
---|
[16124] | 117 | |
---|
[8627] | 118 | ) |
---|
| 119 | ); |
---|
[16124] | 120 | include_once (PHPWG_ROOT_PATH.'include/functions_cookie.inc.php') ; |
---|
[8627] | 121 | $autoscript="<script type='text/javascript'> |
---|
| 122 | /* cl_autosize_script_2 */ |
---|
| 123 | if (typeof (save_framework) == 'function') |
---|
[16124] | 124 | save_framework('".$ma_page."'); |
---|
[16579] | 125 | var cookie_path ='". cookie_path() ."' |
---|
[8627] | 126 | </script>"; |
---|
| 127 | $template->append('footer_elements',$autoscript); |
---|
| 128 | return ; |
---|
| 129 | }// function cl_autosize_script_2 |
---|
[17308] | 130 | /************************************* |
---|
| 131 | * cl_autosize_script_3() |
---|
| 132 | **************************************/ |
---|
| 133 | static public function cl_autosize_script_3() |
---|
| 134 | { |
---|
| 135 | global $template; |
---|
| 136 | |
---|
[8627] | 137 | |
---|
[17308] | 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 | |
---|
[8627] | 150 | //================================================================ |
---|
[7375] | 151 | /* |
---|
[8627] | 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 |
---|
[16931] | 161 | //===================================== |
---|
[8627] | 162 | |
---|
[16931] | 163 | |
---|
| 164 | // this is the default handler that generates the display for the element |
---|
[17192] | 165 | static public function autosize_calcContent($content) |
---|
[16931] | 166 | { |
---|
[17192] | 167 | global $conf; |
---|
| 168 | |
---|
| 169 | global $page, $template,$picture; |
---|
[16931] | 170 | |
---|
| 171 | |
---|
[17192] | 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); |
---|
[16931] | 181 | |
---|
| 182 | |
---|
[17192] | 183 | $current = $template->get_template_vars('current'); |
---|
| 184 | } |
---|
[16931] | 185 | |
---|
[17192] | 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 | |
---|
[16931] | 207 | } |
---|
| 208 | |
---|
[8627] | 209 | //=============================================================== |
---|
| 210 | /* |
---|
[7375] | 211 | * |
---|
[8627] | 212 | */ |
---|
[7375] | 213 | static public function cl_autosize_affiche() |
---|
[7193] | 214 | { |
---|
[8911] | 215 | global $user, $picture, $template,$page,$known_script; |
---|
[7193] | 216 | global $content, $element_info; |
---|
| 217 | global $infos_message,$erreur_message; |
---|
| 218 | global $conf,$lang ,$user,$userdata; |
---|
[11429] | 219 | if ('kardon' == $user['theme'] and isset($_GET['slideshow'])) return ; |
---|
[10845] | 220 | load_language('plugin.lang', AUTOSIZE_PATH); |
---|
[17192] | 221 | |
---|
[11429] | 222 | $AUTOSIZE_PATH = dirname(__FILE__).'/'; |
---|
[8070] | 223 | if (isset( $page['body_id']) && $page['body_id']=='thePicturePage' ) { |
---|
| 224 | if ( isset($picture['current'])){ |
---|
[7193] | 225 | $autosize_parametres = cl_autosize_Get_Options(); |
---|
[8911] | 226 | include (AUTOSIZE_PATH."include/affiche.php"); |
---|
[16931] | 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)); |
---|
[8959] | 230 | $template->set_filenames(array('autosize_init_header'=> $file )); |
---|
[16931] | 231 | $theme=$user['theme']; |
---|
[17308] | 232 | $deriv_type = pwg_get_session_var('picture_deriv', IMG_LARGE); |
---|
| 233 | $defined_types = array_keys(ImageStdParams::get_defined_type_map()); |
---|
| 234 | |
---|
[8057] | 235 | if($autosize_parametres->check_icon_v == 'on'){ |
---|
| 236 | $template->assign('cl_autosize_button', |
---|
| 237 | array( 'cl_autosize_info' => 'cl_autosize_info' , |
---|
[16931] | 238 | 'cl_autosize_info_1' => 'cl_autosize_info_' , |
---|
[10845] | 239 | 'cl_autosize_info_2' => 'cl_autosize_info_2' , |
---|
| 240 | 'URL' => $_SERVER['REQUEST_URI'] , |
---|
| 241 | 'ICON2' => AUTOSIZE_PATH . 'icons/button-maximize.png', |
---|
[16931] | 242 | 'ICON' => AUTOSIZE_PATH . 'icons/button-minimize.png', |
---|
| 243 | 'ICON1' => AUTOSIZE_PATH . 'icons/button-no.png' |
---|
[8057] | 244 | ) |
---|
[7536] | 245 | |
---|
[8627] | 246 | ); |
---|
[11429] | 247 | $template->set_filenames(array('cl_bp' => $AUTOSIZE_PATH. 'template/picture.tpl')); |
---|
[8057] | 248 | $template->concat('PLUGIN_PICTURE_ACTIONS', $template->parse('cl_bp', true)); |
---|
[7229] | 249 | } |
---|
[8057] | 250 | $template->set_filenames( |
---|
[16931] | 251 | array('autosize_content'=> $AUTOSIZE_PATH.'template/autosize.tpl', |
---|
| 252 | 'theme' => $theme ) |
---|
[7193] | 253 | ); |
---|
[11442] | 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'); |
---|
[16931] | 266 | } |
---|
[17192] | 267 | |
---|
[11442] | 268 | return $template->parse( 'autosize_content', false); |
---|
[8070] | 269 | } |
---|
[7375] | 270 | } |
---|
[8070] | 271 | |
---|
[7375] | 272 | } //public function cl_autosize_affiche |
---|
[8627] | 273 | //=============================================================== |
---|
| 274 | /* |
---|
[7375] | 275 | * |
---|
| 276 | */ |
---|
[7193] | 277 | static public function cl_autosize_aff_infos_plus() |
---|
| 278 | { |
---|
| 279 | global $template,$infos_message,$erreur_message, $user ; |
---|
[8627] | 280 | global $conf,$lang ; |
---|
[7669] | 281 | |
---|
[7193] | 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 | |
---|
[7375] | 305 | } // function cl_autosize_aff_infos_plus |
---|
[8627] | 306 | //=============================================================== |
---|
| 307 | /* |
---|
| 308 | * |
---|
| 309 | */ |
---|
| 310 | static public function cl_ajuste_data($content){ |
---|
| 311 | global $template,$user,$conf,$picture ; |
---|
[11961] | 312 | global $size; |
---|
[11429] | 313 | $AUTOSIZE_PATH = realpath(AUTOSIZE_PATH .'/'); |
---|
[8627] | 314 | $userdata=$user; |
---|
| 315 | $fields = array( 'maxwidth', 'maxheight' ); |
---|
[8070] | 316 | |
---|
[8627] | 317 | $ThePicture = $template->get_template_vars('current'); |
---|
| 318 | $data = array(); |
---|
| 319 | return $content; |
---|
[7816] | 320 | |
---|
[11961] | 321 | $data['maxwidth'] = $size['src_img_w']; |
---|
| 322 | $data['maxheight'] =$size['src_img_h']; |
---|
[8627] | 323 | $data['user_id'] = $userdata['id']; |
---|
| 324 | foreach ($fields as $field) |
---|
[7943] | 325 | { |
---|
[8627] | 326 | if (isset($_POST[$field])) |
---|
| 327 | { |
---|
| 328 | $data[$field] = $_POST[$field]; |
---|
| 329 | } |
---|
[7943] | 330 | } |
---|
[7193] | 331 | |
---|
[8627] | 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 | } |
---|
[7943] | 340 | |
---|
[8627] | 341 | return $content; |
---|
| 342 | } |
---|
[7375] | 343 | |
---|
[11961] | 344 | |
---|
| 345 | /**************************************** |
---|
| 346 | * |
---|
| 347 | ****************************************/ |
---|
| 348 | function Get_Options(&$parametres,$str_index){ |
---|
| 349 | global $conf ; |
---|
[16124] | 350 | if (!isset( $conf[$str_index])) { |
---|
| 351 | $conf[$str_index]=""; |
---|
| 352 | } |
---|
[11961] | 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 | |
---|
[16931] | 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 | |
---|
[11961] | 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" ; |
---|
[16931] | 387 | |
---|
[11961] | 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 | } |
---|
[7375] | 413 | } // class |
---|
| 414 | |
---|
[11961] | 415 | /************************************* |
---|
[7375] | 416 | * |
---|
[11961] | 417 | *************************************/ |
---|
[7193] | 418 | function cl_autosize_Get_Options() |
---|
| 419 | { |
---|
[7394] | 420 | global $conf,$autosize_parametres; |
---|
[12652] | 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 | |
---|
[7394] | 434 | $autosize_parametres = unserialize($conf['cl_autosize']); |
---|
[11961] | 435 | // $autosize_parametres = autosize_controler::Get_Options($autosize_parametres,'cl_autosize'); |
---|
[7394] | 436 | $autosize_parametres = cl_autosize_Set_Options(); |
---|
| 437 | return $autosize_parametres; |
---|
[7375] | 438 | } |
---|
| 439 | /* |
---|
| 440 | * |
---|
[7193] | 441 | */ |
---|
[11961] | 442 | function cl_autosize_Set_Options() { |
---|
[7193] | 443 | global $autosize_parametres; |
---|
| 444 | //============================================================================= |
---|
[7962] | 445 | $my_para=$autosize_parametres; |
---|
[16124] | 446 | if (empty($my_para)) |
---|
| 447 | $my_para = (object) ''; |
---|
| 448 | |
---|
[7962] | 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') ; |
---|
[7193] | 451 | |
---|
[16931] | 452 | $my_para->webmaster_type =(isset($_POST['webmaster_type'])) ? $_POST['webmaster_type'] : ((isset($my_para->webmaster_type )) ? $my_para->webmaster_type : 'Autosize' ) ; |
---|
[7193] | 453 | |
---|
[16931] | 454 | $my_para->admin_type =(isset($_POST['admin_type'])) ? $_POST['admin_type'] : ((isset($my_para->admin_type )) ? $my_para->admin_type : 'Autosize' ) ; |
---|
[7193] | 455 | |
---|
[16931] | 456 | $my_para->generic_type =(isset($_POST['generic_type'])) ? $_POST['generic_type'] : ((isset($my_para->generic_type )) ? $my_para->generic_type : 'Autosize' ) ; |
---|
[7193] | 457 | |
---|
| 458 | |
---|
[16931] | 459 | $my_para->guest_type =(isset($_POST['guest_type'])) ? $_POST['guest_type'] : ((isset($my_para->guest_type )) ? $my_para->guest_type : 'Autosize' ) ; |
---|
[7193] | 460 | |
---|
[7725] | 461 | |
---|
[16931] | 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 | |
---|
[7962] | 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 | |
---|
[9473] | 472 | $my_para->echelle_max=(isset($_POST['echelle_max']))? $_POST['echelle_max'] : ((isset($my_para->echelle_max)) ? $my_para->echelle_max : '1.0'); |
---|
[9225] | 473 | $my_para->marge_basse=(isset($_POST['marge_basse']))? $_POST['marge_basse']: ((isset($my_para->marge_basse)) ? $my_para->marge_basse : '0'); |
---|
[9473] | 474 | $my_para->fade_in=(isset($_POST['fade_in']))? $_POST['fade_in']: ((isset($my_para->fade_in)) ? $my_para->fade_in : '0'); |
---|
[7962] | 475 | |
---|
[7193] | 476 | //=============================================================================== |
---|
| 477 | |
---|
| 478 | if ( isset($_POST['submit'] ) && $_POST['submit'] == l10n('cl_autosize_save') ) { |
---|
[7962] | 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" ; |
---|
[16931] | 481 | |
---|
[7394] | 482 | |
---|
[7962] | 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" ; |
---|
[7394] | 488 | |
---|
[7193] | 489 | }else{ |
---|
[7962] | 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') ; |
---|
[7394] | 492 | |
---|
| 493 | |
---|
[16931] | 494 | |
---|
[7962] | 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') ; |
---|
[7394] | 500 | |
---|
| 501 | |
---|
[7193] | 502 | } |
---|
[7316] | 503 | |
---|
[7962] | 504 | return $my_para; |
---|
[7193] | 505 | } |
---|
[7375] | 506 | /* |
---|
| 507 | * |
---|
[7193] | 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(); |
---|
[12652] | 514 | if ( isset($autosize_parametres) ) { |
---|
[7193] | 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 | } |
---|
[7375] | 524 | |
---|
[8729] | 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 | |
---|
[7375] | 536 | |
---|
[7193] | 537 | ?> |
---|