[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 { |
---|
[17503] | 23 | /********************************* |
---|
| 24 | * cl_autosize_admin |
---|
| 25 | **********************************/ |
---|
| 26 | static public function cl_autosize_admin($menu) { |
---|
| 27 | global $lang ; |
---|
| 28 | array_push($menu, array('NAME' => 'Autosize', |
---|
| 29 | 'URL' => get_admin_plugin_menu_link(AUTOSIZE_PATH . 'admin/admin_autosize.php'))); |
---|
| 30 | return $menu; |
---|
| 31 | } //function cl_autosize_admin |
---|
| 32 | /********************* |
---|
| 33 | * INIT |
---|
| 34 | *********************/ |
---|
| 35 | static public function init($content){ |
---|
| 36 | // header ('X-UA-Compatible: n=7') ; |
---|
| 37 | // header ('X-UA-Compatible: IE=Edge') ; |
---|
[18325] | 38 | global $template,$version,$icon_path,$page,$picture,$conf; |
---|
| 39 | global $user,$Css,$css_slideshow,$css_display; |
---|
[18234] | 40 | $current = $template->get_template_vars('current'); |
---|
[18325] | 41 | //======================================================= |
---|
| 42 | $theme=$user['theme']; |
---|
| 43 | $Css = autosize_controler::css($theme."-rules.css"); |
---|
| 44 | $css_slideshow=isset($Css['.Autosize']['slideshow'])?$Css['.Autosize']['slideshow']:"yes"; |
---|
| 45 | |
---|
| 46 | $css_display= isset($Css['.Autosize']['display'])?$Css['.Autosize']['display']:"block"; |
---|
| 47 | |
---|
[18127] | 48 | //==================================================================== |
---|
[18234] | 49 | $pictureDeriv = pwg_get_session_var('picture_deriv',$conf['derivative_default_size']); |
---|
| 50 | $default_size = $conf['derivative_default_size']; |
---|
| 51 | $SRC_IMG=""; |
---|
| 52 | //===================================================================== |
---|
[18325] | 53 | |
---|
[18234] | 54 | if(!isset($_COOKIE['picture_deriv'])) |
---|
[18325] | 55 | if(isset($current['derivatives']['Autosize'])){ |
---|
[18234] | 56 | $_COOKIE['picture_deriv']="Autosize"; |
---|
[18325] | 57 | } |
---|
| 58 | if(isset( $_COOKIE['picture_deriv'])) |
---|
[18127] | 59 | $model= $_COOKIE['picture_deriv'] ; |
---|
| 60 | else |
---|
| 61 | $model= $pictureDeriv ; |
---|
[18115] | 62 | |
---|
[18325] | 63 | |
---|
| 64 | |
---|
| 65 | if (($css_display=="none" || $css_slideshow=="no") && ($model=="SelMaxi" || $model=="Autosize") ) { |
---|
| 66 | $model=$default_size ; |
---|
| 67 | $_COOKIE['picture_deriv'] =$model ; |
---|
| 68 | } |
---|
| 69 | |
---|
[18234] | 70 | if(!isset($current['derivatives'][$model])) |
---|
| 71 | $model=$default_size ; |
---|
[18325] | 72 | |
---|
[18127] | 73 | $selected_derivative = $current['derivatives'][$model]; |
---|
[18325] | 74 | /* |
---|
| 75 | 'selected_derivative' => $selected_derivative, |
---|
| 76 | 'unique_derivatives' => $unique_derivatives, |
---|
| 77 | */ |
---|
[18234] | 78 | |
---|
| 79 | |
---|
[18127] | 80 | if (!isset($current['selected_derivative'])){ |
---|
[18234] | 81 | |
---|
| 82 | $current['SelMaxi'] = ImageStdParams::get_custom(900,900); |
---|
| 83 | $selected_derivative = ImageStdParams::get_custom($_COOKIE['theImageWidth'], $_COOKIE['theImageHeight']); |
---|
| 84 | |
---|
| 85 | $selected_derivative->type=$model; |
---|
[18127] | 86 | $template->append('current', array( |
---|
| 87 | 'selected_derivative' => $selected_derivative |
---|
| 88 | ), |
---|
| 89 | true); |
---|
| 90 | $current = $template->get_template_vars('current'); |
---|
[18234] | 91 | |
---|
[18127] | 92 | } |
---|
[18115] | 93 | |
---|
[18127] | 94 | if(isset($current['derivatives'][$model])) { |
---|
| 95 | $selected_derivative = $current['derivatives'][$model]; |
---|
| 96 | $template->assign('current[selected_derivative]', $selected_derivative , true); |
---|
| 97 | $current = $template->get_template_vars('current'); |
---|
[18325] | 98 | } |
---|
[18127] | 99 | return $content; |
---|
[17503] | 100 | |
---|
[18325] | 101 | |
---|
[17503] | 102 | }//INIT |
---|
| 103 | /************************** |
---|
| 104 | * autosize_calcContent * |
---|
| 105 | **************************/ |
---|
| 106 | static public function autosize_calcContent($content){ |
---|
| 107 | global $conf,$page, $template,$picture,$user; |
---|
| 108 | global $defined_types,$maxi_img ,$pictureDeriv ,$liste_type,$SRC_IMG,$select_type; |
---|
| 109 | global $has_pamoorama; |
---|
| 110 | global $autosize_parametres,$user_status; |
---|
| 111 | $defined_types = array_keys(ImageStdParams::get_defined_type_map()); |
---|
| 112 | //=============================================================== |
---|
| 113 | if(isset($page['body_id']) && $page['body_id'] == 'theAdminPage' ) return ; |
---|
| 114 | if (!isset($_COOKIE['autosize_reload'])){ |
---|
[17545] | 115 | $autoscript="<script type='text/javascript' src='themes/default/js/jquery.min.js'></script> <script type='text/javascript' src='plugins/Autosize/js/autosizeDetect.js'></script> |
---|
[17503] | 116 | <script type='text/javascript' src='plugins/Autosize/js/autosize.cookie.js'></script> |
---|
| 117 | <body onload=on_load() style='background-color:black;color :white;font-size:30px ' > |
---|
| 118 | please wait, loading... |
---|
| 119 | </body>"; |
---|
| 120 | echo $autoscript; |
---|
| 121 | die(); |
---|
| 122 | } |
---|
| 123 | $current = $template->get_template_vars('current'); |
---|
[18115] | 124 | if (!isset($current)) return ; |
---|
[18325] | 125 | |
---|
[17503] | 126 | //=============================================================== |
---|
| 127 | $derivative = $current['src_image'] ; |
---|
| 128 | $imgScaledWH = $derivative->get_size(); |
---|
| 129 | $SRC_IMG = $derivative->get_url(); |
---|
| 130 | $picture['current']['scaled_width']=$imgScaledWH[0]; |
---|
| 131 | $picture['current']['scaled_height']= $imgScaledWH[1]; |
---|
| 132 | $picture['current']['high_url']= $SRC_IMG; |
---|
| 133 | $picture['current']['image_url']=$SRC_IMG; |
---|
| 134 | //=============================================================== |
---|
[18115] | 135 | |
---|
[17503] | 136 | $user_status = $user['status'] ; |
---|
| 137 | $autosize_parametres = cl_autosize_Get_Options(); |
---|
| 138 | $user_type= get_user_status($user_status)."_type"; |
---|
| 139 | $select_type=$autosize_parametres->$user_type ; |
---|
| 140 | |
---|
| 141 | |
---|
| 142 | if (isset($_COOKIE['theImageHeight'])){ |
---|
| 143 | pwg_set_session_var('theImageWidtht',$_COOKIE['theImageWidth']); |
---|
| 144 | pwg_set_session_var('theImageHeight',$_COOKIE['theImageHeight']); |
---|
| 145 | } |
---|
| 146 | if (isset($_COOKIE['theMainImageHeight'])) pwg_set_session_var('theMainImageHeight',$_COOKIE['theMainImageHeight']); |
---|
| 147 | if (isset($_COOKIE['theMainImageWidth'])) pwg_set_session_var('theImageWidth',$_COOKIE['theMainImageWidth']); |
---|
| 148 | |
---|
| 149 | |
---|
| 150 | if (isset($_COOKIE['picture_deriv'])) |
---|
| 151 | pwg_set_session_var('picture_deriv',$_COOKIE['picture_deriv']); |
---|
| 152 | else |
---|
| 153 | pwg_set_session_var('picture_deriv',$select_type); |
---|
| 154 | |
---|
| 155 | |
---|
| 156 | $model= $conf['derivative_default_size'] ; // par defaut |
---|
| 157 | $pictureDeriv = pwg_get_session_var('picture_deriv', $model); |
---|
| 158 | |
---|
| 159 | |
---|
| 160 | $model=$pictureDeriv ; |
---|
| 161 | |
---|
| 162 | $value=0; |
---|
| 163 | $liste_type=""; |
---|
| 164 | $maxi_info=""; |
---|
| 165 | if($model!="Autosize" & $model!="SelMaxi"){ |
---|
| 166 | |
---|
| 167 | }else{ |
---|
[18234] | 168 | $model=$conf['derivative_default_size'] ; // format par défaut |
---|
[17503] | 169 | } |
---|
[18115] | 170 | $derivative=$current['derivatives'][$model] ; |
---|
[17503] | 171 | $img_all= $derivative->get_all($derivative->src_image); |
---|
| 172 | $maxi_img=""; |
---|
| 173 | $mini_img=""; |
---|
| 174 | $maxi_url=""; |
---|
| 175 | $imgSizeWH = $derivative->get_size(); |
---|
| 176 | //==== valeur taille image ==== |
---|
| 177 | |
---|
| 178 | $window_width=$imgSizeWH[0]; |
---|
| 179 | $window_height=$imgSizeWH[1]; |
---|
| 180 | |
---|
[18234] | 181 | |
---|
[17503] | 182 | |
---|
[18115] | 183 | $window_width = pwg_get_session_var('theMainImageWidth',$imgSizeWH[0]); |
---|
[17503] | 184 | $window_height = pwg_get_session_var('theMainImageHeight',$imgSizeWH[1]); |
---|
| 185 | |
---|
[18115] | 186 | if (!isset($_COOKIE['theMainImageHeight'])) setcookie('theMainImageHeight', $window_height ); |
---|
[17503] | 187 | if (!isset($_COOKIE['theMainImageWidth'])) setcookie('theMainImageWidth',$window_width); |
---|
| 188 | |
---|
[18325] | 189 | //================= Liste ========================= |
---|
[18234] | 190 | $last_defined=ImageStdParams::get_defined_type_map(); |
---|
[17503] | 191 | foreach ($img_all as $img_select){ |
---|
| 192 | $img_type = $img_select->get_type(); |
---|
| 193 | if ($img_type=="square" || $img_type=="thumb" ) continue ; |
---|
[18234] | 194 | if (!isset($last_img)) $last_img = $img_select; |
---|
[18127] | 195 | |
---|
[17503] | 196 | $img_url = $img_select->get_url(); |
---|
| 197 | $imgSizeWH = $img_select->get_size(); |
---|
[18234] | 198 | |
---|
[18127] | 199 | |
---|
[17503] | 200 | if($img_type=="Autosize" || $img_type=="SelMaxi"){ |
---|
| 201 | $img_url = $img_select->src_image->get_url(); |
---|
| 202 | $imgSizeWH = $img_select->src_image->get_size(); |
---|
| 203 | $liste_type[$img_type]=$img_type.",".$img_url.",".$imgSizeWH[0] .",".$imgSizeWH[1] ; |
---|
[18234] | 204 | |
---|
| 205 | } |
---|
[18127] | 206 | $liste_type[$img_type]=$img_type.",".$img_url.",".$imgSizeWH[0] .",".$imgSizeWH[1] ; |
---|
[18234] | 207 | |
---|
[17503] | 208 | if($window_height < $imgSizeWH[0] ){ |
---|
| 209 | $maxi_img= $img_type; |
---|
| 210 | $maxi_url= $img_url; |
---|
| 211 | $maxi_i=$img_select; |
---|
| 212 | } |
---|
[18234] | 213 | |
---|
[17503] | 214 | if($window_height < $imgSizeWH[0] && $mini_img==""){ |
---|
| 215 | $mini_img= $img_type; |
---|
| 216 | $mini_url= $img_url; |
---|
| 217 | $mini_i=$img_select; |
---|
[18234] | 218 | } |
---|
[17503] | 219 | |
---|
[18234] | 220 | if($select_type == $img_type){ |
---|
[17503] | 221 | if($maxi_img==""){ |
---|
[18234] | 222 | $maxi_img = $img_type; |
---|
| 223 | $maxi_url = $img_url; |
---|
| 224 | $maxi_i = $img_select; |
---|
| 225 | } |
---|
| 226 | if($mini_img==""){ |
---|
| 227 | $mini_img= $img_type; |
---|
| 228 | $mini_url= $img_url; |
---|
| 229 | $mini_i=$img_select; |
---|
| 230 | } |
---|
| 231 | break ; |
---|
| 232 | } |
---|
[17503] | 233 | } |
---|
| 234 | |
---|
| 235 | return false ; |
---|
| 236 | |
---|
| 237 | } |
---|
| 238 | |
---|
| 239 | /************************ |
---|
| 240 | * cl_autosize_affiche |
---|
| 241 | *************************/ |
---|
| 242 | static public function cl_autosize_affiche(){ |
---|
[18234] | 243 | global $user, $picture, $template,$page,$known_script; |
---|
| 244 | global $content, $element_info; |
---|
| 245 | global $infos_message,$erreur_message; |
---|
| 246 | global $conf,$lang ,$user,$userdata; |
---|
| 247 | global $defined_types,$maxi_img ,$pictureDeriv ,$liste_type,$SRC_IMG,$select_type; |
---|
| 248 | global $has_pamoorama; |
---|
| 249 | global $autosize_parametres,$user_status; |
---|
[18325] | 250 | |
---|
[17503] | 251 | if(isset($page['body_id']) && $page['body_id'] == 'theAdminPage' ) return ; |
---|
| 252 | |
---|
[18325] | 253 | global $css_slideshow,$css_display; |
---|
| 254 | $AUTOSIZE_PATH = dirname(__FILE__).'/'; |
---|
| 255 | $theme=$user['theme']; |
---|
[18127] | 256 | |
---|
[18325] | 257 | load_language('plugin.lang', AUTOSIZE_PATH); |
---|
[17503] | 258 | if (isset( $page['body_id']) && $page['body_id']=='thePicturePage' ) { |
---|
| 259 | if ( isset($picture['current'])){ |
---|
| 260 | include (AUTOSIZE_PATH."include/affiche.php"); |
---|
| 261 | $file =AUTOSIZE_PATH_ABS.'template/picture_1.tpl' ; |
---|
[18325] | 262 | if ($css_display=="none" && $has_pamoorama) { |
---|
| 263 | $css_display="block" ; |
---|
| 264 | } |
---|
[18329] | 265 | $file_css=AUTOSIZE_PATH."css/".$theme.".css"; |
---|
| 266 | if (!file_exists($file_css)){ |
---|
| 267 | $file_css="no"; |
---|
| 268 | } |
---|
| 269 | |
---|
| 270 | |
---|
[17503] | 271 | $template->set_filenames(array('autosize_content_header'=> $file )); |
---|
[18325] | 272 | $template->assign( array( AUTOSIZE_PATH,$AUTOSIZE_PATH, |
---|
[18329] | 273 | 'file_css' =>$file_css, |
---|
[18325] | 274 | 'css_display' => $css_display, |
---|
| 275 | 'select_type' =>$select_type, |
---|
| 276 | 'theme' =>$theme |
---|
| 277 | )); |
---|
| 278 | $template->concat('autosize_content', $template->parse('autosize_content_header', true)); |
---|
| 279 | if ($css_display=="none" ) { |
---|
| 280 | return ; |
---|
| 281 | } |
---|
| 282 | |
---|
[17503] | 283 | $file =AUTOSIZE_PATH_ABS.'template/header.tpl' ; |
---|
| 284 | $template->set_filenames(array('autosize_init_header'=> $file )); |
---|
[18234] | 285 | $template->parse( 'autosize_init_header', false); |
---|
| 286 | $theme=$user['theme']; |
---|
| 287 | |
---|
[17503] | 288 | if($autosize_parametres->check_icon_v == 'on'){ |
---|
| 289 | $template->assign('cl_autosize_button', |
---|
| 290 | array( 'cl_autosize_info' => 'cl_autosize_info' , |
---|
| 291 | 'cl_autosize_info_1' => 'cl_autosize_info_' , |
---|
| 292 | 'cl_autosize_info_2' => 'cl_autosize_info_2' , |
---|
| 293 | 'URL' => $_SERVER['REQUEST_URI'] , |
---|
| 294 | 'ICON2' => AUTOSIZE_PATH . 'icons/button-maximize.png', |
---|
| 295 | 'ICON' => AUTOSIZE_PATH . 'icons/button-minimize.png', |
---|
| 296 | 'ICON1' => AUTOSIZE_PATH . 'icons/button-no.png' |
---|
| 297 | ) |
---|
| 298 | |
---|
| 299 | ); |
---|
| 300 | $template->set_filenames(array('cl_bp' => $AUTOSIZE_PATH. 'template/picture.tpl')); |
---|
| 301 | $template->concat('PLUGIN_PICTURE_ACTIONS', $template->parse('cl_bp', true)); |
---|
| 302 | } |
---|
| 303 | $template->set_filenames( |
---|
| 304 | array('autosize_content'=> $AUTOSIZE_PATH.'template/autosize.tpl', |
---|
| 305 | 'theme' => $theme ) |
---|
| 306 | ); |
---|
[18234] | 307 | $template->concat('autosize_content', $template->parse('autosize_content_header', true)); |
---|
[17503] | 308 | if(isset($conf['go_up_down']) && ($conf['go_up_down']==true) ){ |
---|
| 309 | $template->set_filenames(array('mes_script' => realpath(AUTOSIZE_PATH).'/template/mes_scripts.tpl') ); |
---|
| 310 | $template->func_combine_script(array('id'=>'my_script_2', |
---|
[18325] | 311 | 'path'=> AUTOSIZE_PATH.'/js/JScript.js', |
---|
| 312 | 'require' => 'jquery'), |
---|
[17503] | 313 | $template->smarty); |
---|
| 314 | $template->assign(array( |
---|
| 315 | 'MY_FOOTER_PATH' =>AUTOSIZE_PATH |
---|
| 316 | )); |
---|
| 317 | $template->parse('mes_script'); |
---|
| 318 | } |
---|
| 319 | return $template->parse( 'autosize_content', false); |
---|
| 320 | } |
---|
[18127] | 321 | } |
---|
[17503] | 322 | |
---|
| 323 | } //public function cl_autosize_affiche |
---|
| 324 | |
---|
| 325 | /************************ |
---|
| 326 | * cl_autosize_script_1 |
---|
| 327 | *************************/ |
---|
| 328 | static public function cl_autosize_script_1(){ |
---|
[17192] | 329 | global $user,$page,$template,$cl_plugin; |
---|
[17308] | 330 | if(isset($page['body_id']) && $page['body_id'] == 'theAdminPage' ) return ; |
---|
[17503] | 331 | |
---|
[10347] | 332 | $ma_page=isset($page['body_id'])?$page['body_id']:"" ; |
---|
[18325] | 333 | if ($ma_page=='thePiwiShackControllerPage') return ; |
---|
| 334 | global $has_pamoorama,$css_slideshow; |
---|
| 335 | $has_pamoorama = isset($template->files['pamooramics_content']); |
---|
| 336 | if (!$has_pamoorama) return ; |
---|
[17308] | 337 | |
---|
[18325] | 338 | if ($page['slideshow']){ |
---|
| 339 | $current = $template->get_template_vars('current'); |
---|
| 340 | $model=$current['selected_derivative']->type ; |
---|
| 341 | $selected_derivative = $current['derivatives'][$model]; |
---|
| 342 | $template->append('current', array( |
---|
| 343 | 'selected_derivative' => $selected_derivative |
---|
| 344 | ), |
---|
| 345 | true); |
---|
| 346 | |
---|
| 347 | } |
---|
[10845] | 348 | $template->set_filenames(array('autosize_init'=>AUTOSIZE_PATH_ABS. "template/conflit.tpl" ) ); |
---|
[10347] | 349 | $autosize_parametres = cl_autosize_Get_Options() ; |
---|
| 350 | $theme=$user['theme']; |
---|
[17503] | 351 | //============================================================================== |
---|
| 352 | $DEBUG_autosize = isset($_POST['cl_debug_conflit']) ? $_POST['cl_debug_conflit'] : "false" ; |
---|
| 353 | $DEBUG_autosize = isset($_GET['cl_debug_conflit']) ? $_GET['cl_debug_conflit'] : $DEBUG_autosize ; |
---|
| 354 | $DEBUG_autosize = isset($conf['cl_debug_conflit']) ? $conf['cl_debug_conflit'] : $DEBUG_autosize ; |
---|
| 355 | //============================================================================== |
---|
[10347] | 356 | $template->assign( |
---|
| 357 | array( |
---|
[17308] | 358 | 'autosize_parametres' => $autosize_parametres , |
---|
| 359 | 'cl_plugins' => $cl_plugin , |
---|
| 360 | 'cl_version' => $cl_plugin['version'] , |
---|
| 361 | 'name' => $cl_plugin['name'] , |
---|
| 362 | 'pamoorama' => $has_pamoorama, |
---|
[17503] | 363 | 'theme' => $theme , |
---|
| 364 | 'DEBUG_autosize' => $DEBUG_autosize, |
---|
[17308] | 365 | 'AUTOSIZE_PATH' => str_replace("../","",AUTOSIZE_PATH) , |
---|
| 366 | 'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS, |
---|
[18325] | 367 | 'Version_pwg' => PHPWG_VERSION , |
---|
| 368 | 'slideshow' => $page['slideshow'] |
---|
| 369 | ) |
---|
[10347] | 370 | ); |
---|
[18325] | 371 | |
---|
[17503] | 372 | return $template->parse( 'autosize_init', false); |
---|
[18325] | 373 | |
---|
[8627] | 374 | }// function cl_autosize_script_1 |
---|
[16931] | 375 | |
---|
| 376 | /************************************* |
---|
| 377 | * cl_autosize_script_2() |
---|
| 378 | **************************************/ |
---|
[8627] | 379 | static public function cl_autosize_script_2() |
---|
| 380 | { |
---|
[8911] | 381 | global $template,$user,$conf,$picture ,$page, $cl_plugin,$known_script ; |
---|
[18325] | 382 | global $template,$user,$conf,$picture ,$page, $cl_plugin ; |
---|
| 383 | if(isset($page['body_id']) && $page['body_id'] == 'theAdminPage' ) return ; |
---|
| 384 | global $has_pamoorama; |
---|
| 385 | if (!$has_pamoorama) return ; |
---|
| 386 | global $css_slideshow; |
---|
| 387 | |
---|
| 388 | if ($css_slideshow="no" and isset($_GET['slideshow'])) return ; |
---|
| 389 | |
---|
| 390 | |
---|
[11429] | 391 | $AUTOSIZE_PATH = dirname(__FILE__).'/'; |
---|
[16931] | 392 | //================================================================ |
---|
[10845] | 393 | $DEBUG_autosize = isset($_POST['cl_debug_conflit']) ? $_POST['cl_debug_conflit'] : "false" ; |
---|
| 394 | $DEBUG_autosize = isset($_GET['cl_debug_conflit']) ? $_GET['cl_debug_conflit'] : $DEBUG_autosize ; |
---|
| 395 | $DEBUG_autosize = isset($conf['cl_debug_conflit']) ? $conf['cl_debug_conflit'] : $DEBUG_autosize ; |
---|
[16931] | 396 | //===================================================================== |
---|
[17308] | 397 | $ma_page=isset($page['body_id'])?$page['body_id']:"" ; |
---|
| 398 | $theme=$user['theme']; |
---|
| 399 | if ($ma_page=='thePiwiShackControllerPage') return ; |
---|
| 400 | $img_width=isset($picture['current']['width'])?$picture['current']['width']:480; |
---|
| 401 | $img_height=isset($picture['current']['height'])?$picture['current']['height']:320; |
---|
| 402 | $img_scaled_width=isset($picture['current']['scaled_width'])?$picture['current']['scaled_width']:480; |
---|
| 403 | $img_scaled_height=isset($picture['current']['scaled_height'])?$picture['current']['scaled_height']:320; |
---|
| 404 | $src_img_h=isset($_POST['src_img_h'])?$_POST['src_img_h']: $img_width ; |
---|
| 405 | $src_img_w= isset($_POST['src_img_w'])?$_POST['src_img_w']:$img_height ; |
---|
[17503] | 406 | |
---|
| 407 | |
---|
| 408 | include_once (PHPWG_ROOT_PATH.'include/functions_cookie.inc.php') ; |
---|
[12527] | 409 | if(isset($_COOKIE['img_w'])){ |
---|
[17308] | 410 | $src_img_w=$_COOKIE['img_w']; |
---|
| 411 | $src_img_h=$_COOKIE['img_h']; |
---|
[12527] | 412 | } |
---|
| 413 | |
---|
[17503] | 414 | $window_height= isset($_SESSION['height'])?$_SESSION['height']: $img_scaled_height ; |
---|
| 415 | $window_width= isset($_SESSION['width'])?$_SESSION['width']: $img_scaled_width ; |
---|
[11961] | 416 | |
---|
| 417 | |
---|
| 418 | $size=array( |
---|
| 419 | 'src_img_h' => $src_img_h, |
---|
| 420 | 'src_img_w' => $src_img_w, |
---|
| 421 | 'window_height' =>$window_height, |
---|
| 422 | 'window_width' => $window_width |
---|
[12527] | 423 | |
---|
[11961] | 424 | ); |
---|
| 425 | |
---|
[8627] | 426 | $template->assign( |
---|
| 427 | array( |
---|
| 428 | 'cl_version' => $cl_plugin['version'] , |
---|
| 429 | 'name' => $cl_plugin['name'] , |
---|
| 430 | 'ma_page' => $ma_page, |
---|
| 431 | |
---|
| 432 | 'theme' => $theme , |
---|
[10845] | 433 | 'DEBUG_autosize' => $DEBUG_autosize , |
---|
[11961] | 434 | 'AUTOSIZE_PATH' => AUTOSIZE_PATH, |
---|
| 435 | 'Size' => $size |
---|
[16124] | 436 | |
---|
[8627] | 437 | ) |
---|
| 438 | ); |
---|
[17503] | 439 | |
---|
[8627] | 440 | $autoscript="<script type='text/javascript'> |
---|
| 441 | /* cl_autosize_script_2 */ |
---|
| 442 | if (typeof (save_framework) == 'function') |
---|
[16124] | 443 | save_framework('".$ma_page."'); |
---|
[16579] | 444 | var cookie_path ='". cookie_path() ."' |
---|
[8627] | 445 | </script>"; |
---|
| 446 | $template->append('footer_elements',$autoscript); |
---|
| 447 | return ; |
---|
| 448 | }// function cl_autosize_script_2 |
---|
[17308] | 449 | /************************************* |
---|
| 450 | * cl_autosize_script_3() |
---|
| 451 | **************************************/ |
---|
[17503] | 452 | static public function cl_autosize_script_3() { |
---|
| 453 | global $template,$page; |
---|
| 454 | if(isset($page['body_id']) && $page['body_id'] == 'theAdminPage' ) return ; |
---|
| 455 | global $has_pamoorama; |
---|
| 456 | if (!$has_pamoorama) return ; |
---|
[8627] | 457 | |
---|
[17503] | 458 | $autoscript="<script type='text/javascript'> |
---|
[17308] | 459 | if (typeof (Ajout_Ajax) == 'function') |
---|
| 460 | Ajout_Ajax(); |
---|
| 461 | </script>"; |
---|
| 462 | $template->append('footer_elements',$autoscript); |
---|
| 463 | return ; |
---|
| 464 | }// function cl_autosize_script_3 |
---|
| 465 | |
---|
[8627] | 466 | //=============================================================== |
---|
| 467 | /* |
---|
[7375] | 468 | * |
---|
| 469 | */ |
---|
[7193] | 470 | static public function cl_autosize_aff_infos_plus() |
---|
| 471 | { |
---|
| 472 | global $template,$infos_message,$erreur_message, $user ; |
---|
[8627] | 473 | global $conf,$lang ; |
---|
[7669] | 474 | |
---|
[7193] | 475 | //============================================================== |
---|
| 476 | if (isset($erreur_message)) |
---|
| 477 | { |
---|
| 478 | if ($erreur_message <> "") |
---|
| 479 | { |
---|
| 480 | $erreur_message=str_replace("\n",'<br />',$erreur_message) ; |
---|
| 481 | $template->assign('errors',$erreur_message); |
---|
| 482 | $erreur_message=""; |
---|
| 483 | } |
---|
| 484 | } |
---|
| 485 | if (isset($infos_message)) |
---|
| 486 | { |
---|
| 487 | |
---|
| 488 | if ($infos_message <> "") |
---|
| 489 | { |
---|
| 490 | $infos_message=str_replace("\n",'<br />',$infos_message) ; |
---|
| 491 | $template->assign('infos',$infos_message); |
---|
| 492 | $infos_message=""; |
---|
| 493 | } |
---|
| 494 | } |
---|
| 495 | //============================================================= |
---|
| 496 | return; |
---|
| 497 | |
---|
[7375] | 498 | } // function cl_autosize_aff_infos_plus |
---|
[8627] | 499 | //=============================================================== |
---|
| 500 | /* |
---|
| 501 | * |
---|
| 502 | */ |
---|
| 503 | static public function cl_ajuste_data($content){ |
---|
| 504 | global $template,$user,$conf,$picture ; |
---|
[11961] | 505 | global $size; |
---|
[11429] | 506 | $AUTOSIZE_PATH = realpath(AUTOSIZE_PATH .'/'); |
---|
[8627] | 507 | $userdata=$user; |
---|
| 508 | $fields = array( 'maxwidth', 'maxheight' ); |
---|
[8070] | 509 | |
---|
[8627] | 510 | $ThePicture = $template->get_template_vars('current'); |
---|
| 511 | $data = array(); |
---|
| 512 | return $content; |
---|
[7816] | 513 | |
---|
[11961] | 514 | $data['maxwidth'] = $size['src_img_w']; |
---|
| 515 | $data['maxheight'] =$size['src_img_h']; |
---|
[8627] | 516 | $data['user_id'] = $userdata['id']; |
---|
| 517 | foreach ($fields as $field) |
---|
[7943] | 518 | { |
---|
[8627] | 519 | if (isset($_POST[$field])) |
---|
| 520 | { |
---|
| 521 | $data[$field] = $_POST[$field]; |
---|
| 522 | } |
---|
[7943] | 523 | } |
---|
[7193] | 524 | |
---|
[8627] | 525 | if($data['maxwidth'] != "" ) |
---|
| 526 | { |
---|
| 527 | $picture['current']['scaled_width']=$data['maxwidth']; |
---|
| 528 | $picture['current']['scaled_height']=$data['maxheight']; |
---|
| 529 | mass_updates(USER_INFOS_TABLE, |
---|
| 530 | array('primary' => array('user_id'), 'update' => $fields), |
---|
| 531 | array($data)); |
---|
| 532 | } |
---|
[7943] | 533 | |
---|
[8627] | 534 | return $content; |
---|
| 535 | } |
---|
[7375] | 536 | |
---|
[11961] | 537 | |
---|
| 538 | /**************************************** |
---|
| 539 | * |
---|
| 540 | ****************************************/ |
---|
| 541 | function Get_Options(&$parametres,$str_index){ |
---|
| 542 | global $conf ; |
---|
[16124] | 543 | if (!isset( $conf[$str_index])) { |
---|
| 544 | $conf[$str_index]=""; |
---|
| 545 | } |
---|
[11961] | 546 | $m_options= $conf[$str_index]; |
---|
| 547 | if(isset($m_options)) |
---|
| 548 | if ( preg_match("|s:(.*)|", $m_options, $val) ) |
---|
| 549 | $parametres = unserialize($conf[$str_index]); |
---|
| 550 | else{ |
---|
| 551 | $parametres=explode(",",$_options); |
---|
| 552 | } |
---|
| 553 | //====== par defaut ======================= |
---|
| 554 | $new_val=false; |
---|
| 555 | $def_para=Array(); |
---|
| 556 | |
---|
| 557 | $def_para['query'] = 'Qt' ; |
---|
| 558 | $def_para['type'] = 'Ty' ; |
---|
| 559 | |
---|
[16931] | 560 | $def_para['webmaster_type'] = 'Autosize' ; |
---|
| 561 | $def_para['admin_type'] = 'Autosize' ; |
---|
| 562 | $def_para['generic_type'] = 'Autosize' ; |
---|
| 563 | $def_para['guest_type'] = 'Autosize' ; |
---|
| 564 | $def_para['normal_type'] = 'Autosize' ; |
---|
| 565 | |
---|
[11961] | 566 | |
---|
| 567 | |
---|
| 568 | $def_para['mini_height'] = '150' ; |
---|
| 569 | $def_para['mini_width'] = '300' ; |
---|
| 570 | |
---|
| 571 | $def_para['mini_height2'] = '150' ; |
---|
| 572 | $def_para['mini_width2'] = '300' ; |
---|
| 573 | |
---|
| 574 | $def_para['echelle_max'] = '1.0'; |
---|
| 575 | $def_para['marge_basse'] = '0'; |
---|
| 576 | $def_para['fade_in'] = '0'; |
---|
| 577 | //================================================== |
---|
| 578 | $def_para['check_desc_v'] = "off" ; |
---|
| 579 | $def_para['check_icon_v'] = "off" ; |
---|
[16931] | 580 | |
---|
[11961] | 581 | $def_para['webmaster_enabled'] = "off" ; |
---|
| 582 | $def_para['admin_enabled'] = "off" ; |
---|
| 583 | $def_para['generic_enabled'] = "off" ; |
---|
| 584 | $def_para['guest_enabled'] = "off" ; |
---|
| 585 | $def_para['normal_enabled'] = "off" ; |
---|
| 586 | //=================================================== |
---|
| 587 | $para=$def_para; |
---|
| 588 | foreach ($para as $key => $value) { |
---|
| 589 | if( isset($parametres->$key) ){ |
---|
| 590 | $value=$parametres->$key; |
---|
| 591 | } |
---|
| 592 | if($def_para[$key] =="on" ||$def_para[$key] =="off" ){ |
---|
| 593 | $val_pg=(isset($_POST[$key]))? ($_POST[$key]=="off"||$_POST[$key]=="on")?$_POST[$key]:"on" : "off" ; |
---|
| 594 | $value =(isset($_POST[$key]))? $val_pg : $value ; |
---|
| 595 | $val_pg=(isset($_GET[$key]))? ($_GET[$key]=="off"||$_GET[$key]=="on")?$_GET[$key]:"on" : "off" ; |
---|
| 596 | $value =(isset($_GET[$key]))? $val_pg : $value ; |
---|
| 597 | }else{ |
---|
| 598 | $value =(isset($_POST[$key]))? $_POST[$key] : $value ; |
---|
| 599 | $value =(isset($_GET[$key]))? $_GET[$key] : $value ; |
---|
| 600 | } |
---|
| 601 | unset( $parametres->$key) ; |
---|
| 602 | $parametres->$key = $value ; |
---|
| 603 | } |
---|
| 604 | return $parametres ; |
---|
| 605 | } |
---|
[18325] | 606 | /****************************************************/ |
---|
| 607 | |
---|
| 608 | function listeFichiers($dir,$theme){ |
---|
| 609 | global $extensions_allowed; |
---|
| 610 | $extensions_allowed = array(); |
---|
| 611 | $extensions_allowed [] = 'css'; |
---|
| 612 | if ($handle = opendir($dir)) { |
---|
| 613 | while (false !== ($file = readdir($handle))) { |
---|
| 614 | if (($file <>'.') && ($file<>'..')) { |
---|
| 615 | if (is_file($dir.'/'.$file)){ |
---|
| 616 | $extension = pathinfo($dir.'/'.$file, PATHINFO_EXTENSION); |
---|
| 617 | if (in_array($extension,$extensions_allowed)){ |
---|
| 618 | $fileHandle = fopen($dir.'/'.$file, "r"); |
---|
| 619 | |
---|
| 620 | $intro = fread($fileHandle,filesize ($dir.'/'.$file)); |
---|
| 621 | fclose($fileHandle); |
---|
| 622 | if ($file== $theme){ |
---|
| 623 | flush(); |
---|
| 624 | return $intro ; |
---|
| 625 | } |
---|
| 626 | } |
---|
| 627 | } else { |
---|
| 628 | if (is_dir($dir.'/'.$file)){ |
---|
| 629 | listeFichiers($dir.'/'.$file,$theme); |
---|
| 630 | } |
---|
| 631 | } |
---|
| 632 | } |
---|
| 633 | } |
---|
| 634 | closedir($handle); |
---|
| 635 | } |
---|
| 636 | } |
---|
| 637 | //================================================ |
---|
[18328] | 638 | static public function css($theme_local) { |
---|
[18325] | 639 | $path = $_SERVER['DOCUMENT_ROOT']; |
---|
| 640 | if (substr($path,-1)=='/'){ |
---|
| 641 | $path = substr($path,0,-1); |
---|
| 642 | } |
---|
| 643 | if(isset($_GET['path'])) |
---|
| 644 | $path=$_GET['path']; |
---|
| 645 | else |
---|
| 646 | $path=PHPWG_ROOT_PATH."local/css/"; |
---|
| 647 | |
---|
| 648 | $mycssfile=$path.$theme_local; |
---|
| 649 | |
---|
| 650 | if(!file_exists($mycssfile)) |
---|
| 651 | $mycssfile=$path."default-rules.css"; |
---|
| 652 | |
---|
[18326] | 653 | if(!file_exists($mycssfile)){ |
---|
| 654 | return Array(); |
---|
| 655 | } |
---|
| 656 | |
---|
[18325] | 657 | $ret = file_get_contents ($mycssfile); |
---|
| 658 | |
---|
| 659 | function remove_comments( & $string ) { |
---|
| 660 | $string = preg_replace('#/\*.*?\*/#s',"",$string); |
---|
| 661 | return $string; |
---|
| 662 | } |
---|
| 663 | |
---|
| 664 | $order = array("\r\n", "\n", "\r"," "); |
---|
| 665 | $replace = ''; |
---|
| 666 | $newstr = str_replace($order, $replace, $ret); |
---|
| 667 | |
---|
| 668 | $order = array('"'); |
---|
| 669 | $replace = "'"; |
---|
| 670 | $newstr = str_replace($order, $replace, $newstr); |
---|
| 671 | |
---|
| 672 | |
---|
| 673 | $order = array("}"); |
---|
| 674 | $replace = '}\r\n'; |
---|
| 675 | $newstr = str_replace($order, $replace, $newstr); |
---|
| 676 | remove_comments($newstr); |
---|
| 677 | |
---|
| 678 | $newstr = explode('\r\n',$newstr); |
---|
| 679 | $css=Array(); |
---|
| 680 | |
---|
| 681 | foreach ($newstr as $key => $value) { |
---|
| 682 | if($value){ |
---|
| 683 | $css2=Array(); |
---|
| 684 | $key=explode("{",$value); |
---|
| 685 | $value = str_replace("}","",$key[1]) ; |
---|
| 686 | $value=explode(";",$value); |
---|
| 687 | foreach ($value as $key2 => $value2) { |
---|
| 688 | if($value2){ |
---|
| 689 | $key2=explode(":",$value2); |
---|
| 690 | $value2 = $key2[1] ; |
---|
| 691 | $css2[$key2[0]] = $value2 ; |
---|
| 692 | } |
---|
| 693 | } |
---|
| 694 | $css[$key[0]]=$css2 ; |
---|
| 695 | } |
---|
| 696 | } |
---|
| 697 | |
---|
| 698 | |
---|
| 699 | return $css; |
---|
| 700 | } |
---|
| 701 | //================================================= |
---|
| 702 | |
---|
| 703 | |
---|
[7375] | 704 | } // class |
---|
| 705 | |
---|
[11961] | 706 | /************************************* |
---|
[7375] | 707 | * |
---|
[11961] | 708 | *************************************/ |
---|
[7193] | 709 | function cl_autosize_Get_Options() |
---|
| 710 | { |
---|
[7394] | 711 | global $conf,$autosize_parametres; |
---|
[12652] | 712 | $autosize_parametres =""; |
---|
| 713 | |
---|
| 714 | if (!isset($conf['cl_autosize'])) { |
---|
| 715 | $conf['cl_autosize']=""; |
---|
| 716 | $q = ' |
---|
| 717 | INSERT INTO '.CONFIG_TABLE.' (param, value, comment) |
---|
| 718 | VALUES ("cl_autosize","","Parametres du plugin Autosize") |
---|
| 719 | ;'; |
---|
| 720 | pwg_query($q); |
---|
| 721 | } |
---|
| 722 | |
---|
| 723 | |
---|
| 724 | |
---|
[7394] | 725 | $autosize_parametres = unserialize($conf['cl_autosize']); |
---|
[11961] | 726 | // $autosize_parametres = autosize_controler::Get_Options($autosize_parametres,'cl_autosize'); |
---|
[7394] | 727 | $autosize_parametres = cl_autosize_Set_Options(); |
---|
| 728 | return $autosize_parametres; |
---|
[7375] | 729 | } |
---|
| 730 | /* |
---|
| 731 | * |
---|
[7193] | 732 | */ |
---|
[11961] | 733 | function cl_autosize_Set_Options() { |
---|
[7193] | 734 | global $autosize_parametres; |
---|
| 735 | //============================================================================= |
---|
[7962] | 736 | $my_para=$autosize_parametres; |
---|
[16124] | 737 | if (empty($my_para)) |
---|
| 738 | $my_para = (object) ''; |
---|
| 739 | |
---|
[7962] | 740 | $my_para->query =(isset($_POST['query'])) ? $_POST['query'] : ((isset($my_para->query )) ? $my_para->query : 'Qt' ) ; |
---|
| 741 | $my_para->type=(isset($_POST['type']))? $_POST['type']: ((isset($my_para->type)) ? $my_para->type: 'Ty') ; |
---|
[7193] | 742 | |
---|
[16931] | 743 | $my_para->webmaster_type =(isset($_POST['webmaster_type'])) ? $_POST['webmaster_type'] : ((isset($my_para->webmaster_type )) ? $my_para->webmaster_type : 'Autosize' ) ; |
---|
[7193] | 744 | |
---|
[16931] | 745 | $my_para->admin_type =(isset($_POST['admin_type'])) ? $_POST['admin_type'] : ((isset($my_para->admin_type )) ? $my_para->admin_type : 'Autosize' ) ; |
---|
[7193] | 746 | |
---|
[16931] | 747 | $my_para->generic_type =(isset($_POST['generic_type'])) ? $_POST['generic_type'] : ((isset($my_para->generic_type )) ? $my_para->generic_type : 'Autosize' ) ; |
---|
[7193] | 748 | |
---|
| 749 | |
---|
[16931] | 750 | $my_para->guest_type =(isset($_POST['guest_type'])) ? $_POST['guest_type'] : ((isset($my_para->guest_type )) ? $my_para->guest_type : 'Autosize' ) ; |
---|
[7193] | 751 | |
---|
[7725] | 752 | |
---|
[16931] | 753 | $my_para->normal_type =(isset($_POST['normal_type'])) ? $_POST['normal_type'] : ((isset($my_para->normal_type )) ? $my_para->normal_type : 'Autosize' ) ; |
---|
| 754 | |
---|
| 755 | |
---|
| 756 | |
---|
[7962] | 757 | $my_para->mini_height =(isset($_POST['mini_height'])) ? $_POST['mini_height'] : ((isset($my_para->mini_height )) ? $my_para->mini_height : '150' ) ; |
---|
| 758 | $my_para->mini_width=(isset($_POST['mini_width']))? $_POST['mini_width']: ((isset($my_para->mini_width)) ? $my_para->mini_width: '300') ; |
---|
| 759 | |
---|
| 760 | $my_para->mini_height2 =(isset($_POST['mini_height2'])) ? $_POST['mini_height2'] : ((isset($my_para->mini_height2 )) ? $my_para->mini_height2 : '150' ) ; |
---|
| 761 | $my_para->mini_width2=(isset($_POST['mini_width2']))? $_POST['mini_width2']: ((isset($my_para->mini_width2)) ? $my_para->mini_width2: '300') ; |
---|
| 762 | |
---|
[9473] | 763 | $my_para->echelle_max=(isset($_POST['echelle_max']))? $_POST['echelle_max'] : ((isset($my_para->echelle_max)) ? $my_para->echelle_max : '1.0'); |
---|
[9225] | 764 | $my_para->marge_basse=(isset($_POST['marge_basse']))? $_POST['marge_basse']: ((isset($my_para->marge_basse)) ? $my_para->marge_basse : '0'); |
---|
[9473] | 765 | $my_para->fade_in=(isset($_POST['fade_in']))? $_POST['fade_in']: ((isset($my_para->fade_in)) ? $my_para->fade_in : '0'); |
---|
[7962] | 766 | |
---|
[7193] | 767 | //=============================================================================== |
---|
| 768 | |
---|
| 769 | if ( isset($_POST['submit'] ) && $_POST['submit'] == l10n('cl_autosize_save') ) { |
---|
[7962] | 770 | $my_para->check_desc_v = isset($_POST['check_desc_v']) ? $_POST['check_desc_v'] : "off" ; |
---|
| 771 | $my_para->check_icon_v = isset($_POST['check_icon_v']) ? $_POST['check_icon_v'] : "off" ; |
---|
[16931] | 772 | |
---|
[7394] | 773 | |
---|
[7962] | 774 | $my_para->webmaster_enabled = isset($_POST['webmaster_enabled']) ? $_POST['webmaster_enabled'] : "off" ; |
---|
| 775 | $my_para->admin_enabled = isset($_POST['admin_enabled']) ? $_POST['admin_enabled'] : "off" ; |
---|
| 776 | $my_para->generic_enabled = isset($_POST['generic_enabled']) ? $_POST['generic_enabled'] : "off" ; |
---|
| 777 | $my_para->guest_enabled = isset($_POST['guest_enabled']) ? $_POST['guest_enabled'] : "off" ; |
---|
| 778 | $my_para->normal_enabled = isset($_POST['normal_enabled']) ? $_POST['normal_enabled'] : "off" ; |
---|
[7394] | 779 | |
---|
[7193] | 780 | }else{ |
---|
[7962] | 781 | $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') ; |
---|
| 782 | $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] | 783 | |
---|
| 784 | |
---|
[16931] | 785 | |
---|
[7962] | 786 | $my_para->webmaster_enabled = isset($_POST['webmaster_enabled']) ? $_POST['webmaster_enabled'] : ( ( isset($my_para->webmaster_enabled) ) ? $my_para->webmaster_enabled : 'on') ; |
---|
| 787 | $my_para->admin_enabled = isset($_POST['admin_enabled ']) ? $_POST['admin_enabled '] : ( ( isset($my_para->admin_enabled ) ) ? $my_para->admin_enabled : 'on') ; |
---|
| 788 | $my_para->generic_enabled = isset($_POST['generic_enabled']) ? $_POST['generic_enabled'] : ( ( isset($my_para->generic_enabled) ) ? $my_para->generic_enabled : 'on') ; |
---|
| 789 | $my_para->guest_enabled = isset($_POST['guest_enabled']) ? $_POST['guest_enabled'] : ( ( isset($my_para->guest_enabled) ) ? $my_para->guest_enabled : 'on') ; |
---|
| 790 | $my_para->normal_enabled = isset($_POST['normal_enabled']) ? $_POST['normal_enabled'] : ( ( isset($my_para->normal_enabled) ) ? $my_para->normal_enabled : 'on') ; |
---|
[7394] | 791 | |
---|
| 792 | |
---|
[7193] | 793 | } |
---|
[7316] | 794 | |
---|
[7962] | 795 | return $my_para; |
---|
[7193] | 796 | } |
---|
[7375] | 797 | /* |
---|
| 798 | * |
---|
[7193] | 799 | */ |
---|
| 800 | function cl_autosize_sauve_options_inf() |
---|
| 801 | { |
---|
| 802 | global $options,$infos_message,$conf,$autosize_parametres ; |
---|
| 803 | $infos_message .=l10n("cl_autosize_save_config")."<br>"; |
---|
| 804 | $autosize_parametres=cl_autosize_Set_Options(); |
---|
[12652] | 805 | if ( isset($autosize_parametres) ) { |
---|
[7193] | 806 | $query = ' |
---|
| 807 | UPDATE '.CONFIG_TABLE.' |
---|
| 808 | SET value="'.addslashes(serialize($autosize_parametres)).'" |
---|
| 809 | WHERE param = "cl_autosize" |
---|
| 810 | LIMIT 1'; |
---|
| 811 | pwg_query($query); |
---|
| 812 | } |
---|
[17503] | 813 | if (!isset($conf['cl_derivatives_sav'])) { |
---|
| 814 | $q = ' |
---|
| 815 | INSERT INTO '.CONFIG_TABLE.' (param, value, comment) |
---|
| 816 | VALUES ("cl_derivatives_sav","","sauvegarde derivatives") |
---|
| 817 | ;'; |
---|
| 818 | pwg_query($q); |
---|
| 819 | } |
---|
[7193] | 820 | } |
---|
[7375] | 821 | |
---|
[17503] | 822 | function print_var($variables) |
---|
[8729] | 823 | { |
---|
| 824 | ob_start(); |
---|
| 825 | echo '<pre>'; |
---|
| 826 | print_r($variables); |
---|
| 827 | echo '</pre>'; |
---|
| 828 | $m= ob_get_contents(); |
---|
| 829 | ob_end_clean(); |
---|
| 830 | return $m; |
---|
| 831 | } |
---|
[7375] | 832 | |
---|
[18325] | 833 | |
---|
| 834 | |
---|
[7193] | 835 | ?> |
---|