Changeset 22133 for extensions/Autosize
- Timestamp:
- Apr 11, 2013, 11:37:27 AM (11 years ago)
- Location:
- extensions/Autosize
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Autosize/autosize.inc.php
r22116 r22133 22 22 class autosize_ctrl { 23 23 /********************************* 24 * cl_autosize_admin24 * cl_autosize_admin 25 25 **********************************/ 26 26 static public function cl_autosize_admin($menu) { … … 32 32 33 33 34 /************************** 35 * autosize_calcContent * 36 **************************/ 37 static public function autosize_calcContent($content,$element_info){ 38 global $conf,$page, $template,$picture,$user; 39 global $defined_types,$pictureSelType,$pictureMap ,$pictureDeriv ,$liste_type,$SRC_IMG; 40 global $autosize_parametres,$user_status; 41 global $infos_message,$error_message; 42 //============================================================================== 43 global $DEBUG_autosize; 44 if( isset($_GET['cl_debug']) && $_GET['cl_debug'] =='false') { 45 $DEBUG_autosize=""; 46 }else{ 47 $DEBUG_autosize = isset($_POST['cl_debug']) ? $_POST['cl_debug'] : "" ; 48 $DEBUG_autosize = isset($_GET['cl_debug']) ? $_GET['cl_debug'] : $DEBUG_autosize ; 49 $DEBUG_autosize = isset($conf['cl_debug']) ? $conf['cl_debug']."," . $DEBUG_autosize : $DEBUG_autosize ; 50 //=============================================================== 34 /************************** 35 * autosize_calcContent * 36 **************************/ 37 static public function autosize_calcContent($content,$element_info){ 38 global $conf,$page, $template,$picture,$user; 39 global $defined_types,$pictureSelType,$pictureMap ,$pictureDeriv ,$liste_type,$SRC_IMG; 40 global $autosize_parametres,$user_status; 41 global $infos_message,$error_message; 42 //============================================================================== 43 global $DEBUG_autosize; 44 if(preg_match("|event|", $DEBUG_autosize, $val)) $infos_message = "autosize_calcContent, " ; 45 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 46 if ($ma_page !='thePicturePage') return ; 47 $default_size = $conf['derivative_default_size']; 48 //============================================================ 49 $types = array_intersect(array_keys(ImageStdParams::get_defined_type_map()), array("Autosize","SelMaxi")); 50 if (count($types)==0){ 51 include_once (AUTOSIZE_PATH.'maintain.inc.php'); 52 if (isset($conf['cl_derivatives_sav'])) { 53 plugin_deactivate() ; 54 } 55 plugin_activate(); 56 unset ( $_COOKIE['autosize_reload']) ; 57 } 58 //============================================================= 59 self::get_cookies(); 60 if(preg_match("|test|", $DEBUG_autosize, $val)) { 61 $infos_message .= "#65 autosize_calcContent: <br>"; 62 if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ; 63 $infos_message .= "SESSION:" . cl_print_var($_SESSION) ; 64 $infos_message .= "COOKIE:" . cl_print_var($_COOKIE) ; 65 $infos_message .= "GET:" . cl_print_var($_GET) ; 66 $infos_message .= "POST:" . cl_print_var($_POST) ; 67 $infos_message .= "$pictureDeriv $pictureSelType $pictureMap "; 68 } 69 //=================================================================== 70 $current = $template->get_template_vars('current'); 71 if (!isset($current)) return ; 72 //=============================================================== 73 global $imgSizeWH; 74 $derivative = $current['src_image'] ; 75 $imgSizeWH = $derivative->get_size(); 76 $SRC_IMG = $derivative->get_url(); 77 78 $picture['current']['scaled_width']=$imgSizeWH[0]; 79 $picture['current']['scaled_height']= $imgSizeWH[1]; 80 $picture['current']['high_url']= $SRC_IMG; 81 $picture['current']['image_url']=$SRC_IMG; 82 $picture['current']['thumbnail']=$SRC_IMG; 83 84 //============================================================== 85 $autosize_parametres = cl_autosize_Get_Options(); 86 return false ; 87 }//calc_content ; 88 89 90 91 /********************* 92 * INIT 93 *********************/ 94 static public function init_3(){ 95 96 } 97 static public function init_1($content, $image) 98 { 99 global $conf, $template, $page; 100 if(!isset($conf['AS_panorama'])) return $content; 101 if( !is_array($conf['AS_panorama']) ){ 102 return $content; 103 } 104 $asp = & $conf['AS_panorama']; 105 if(!isset($asp['in_mode_360'])) $asp['in_mode_360']=""; 106 if(!isset($asp['in_mode_180'])) $asp['in_mode_180']=""; 107 108 if ( !stristr($image['name'], $asp['in_mode_360']) and !stristr($image['name'], $asp['in_mode_180']) ) return $content; 109 110 $asp['min_viewport_width']=$_COOKIE['windowWidth'] -$_COOKIE['theImageLeft']-$_COOKIE['theImageRight']; 111 $asp['viewport_height']=$_COOKIE['windowHeight']-130 ; 112 113 $asp['start_position']= 10; 114 115 } 116 /*********************/ 117 static public function init($content,$element_info){ 118 global $template,$version,$icon_path,$page,$picture,$conf; 119 global $user,$Css,$css_slideshow,$css_display,$liste_type; 120 global $has_pamoorama,$pictureSelType,$pictureDeriv,$pictureMap; 121 global $infos_message,$warnings_message; 122 123 global $set_miniature,$imgSizeWH,$DEBUG_autosize; 124 global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize; 125 //======================================================= 126 global $has_pamoorama, $DEBUG_autosize ; 127 128 if(preg_match("|event|", $DEBUG_autosize, $val)) { 129 $infos_message .= "init, "; 130 } ; 131 132 $has_pamoorama = isset($template->files['pamooramics_content'])?"true":"false"; 133 $theme=$user['theme']; 134 135 $Css = self::css($theme."-rules.css"); 136 $css_slideshow=isset($Css['.Autosize']['slideshow'])?$Css['.Autosize']['slideshow']:"yes"; 137 $css_display= isset($Css['.Autosize']['display'])?$Css['.Autosize']['display']:"block"; 138 $default_size = $conf['derivative_default_size']; 139 //============================================================ 140 self::get_cookies(); 141 //============================================================== 142 if(preg_match("|test|", $DEBUG_autosize, $val)) { 143 $infos_message .= "#133 <br>Init:SESSION:" . cl_print_var($_SESSION) ; 144 if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ; 145 $infos_message .= "GET:" . cl_print_var($_GET) ; 146 $infos_message .= "POST:" . cl_print_var($_POST) ; 147 $infos_message .= "$pictureDeriv $pictureSelType $pictureMap "; 148 $infos_message .= cl_print_var($template,true); 149 } 150 $autosize_parametres = cl_autosize_Get_Options(); 151 //===================================================================== 152 $current = $template->get_template_vars('current'); 153 //=== Zone affichage == 154 $windowWidth=$_COOKIE['windowWidth'] ; 155 $windowHeight=$_COOKIE['windowHeight'] ; 156 157 $theImageTop= isset($_COOKIE['theImageTop'])?$_COOKIE['theImageTop']:0; 158 $theImageLeft=isset($_COOKIE['theImageLeft'])?$_COOKIE['theImageLeft']:0; 159 160 $theImageRight=isset($_COOKIE['theImageRight'])?$_COOKIE['theImageRight']:0; 161 $theImageBottom=isset($_COOKIE['theImageBottom'])?$_COOKIE['theImageBottom']:0; 162 163 164 $theImageMargeWidth=isset($_COOKIE['theImageMargeWidth']) ? $_COOKIE['theImageMargeWidth']:0; 165 $theImageMargeHeight=isset($_COOKIE['theImageMargeHeight'])?$_COOKIE['theImageMargeHeight']:0; 166 167 $theImageMargeHeight -= 2; 168 if(isset($_COOKIE['theImageWidth'])){ 169 $theImageWidth= $_COOKIE['theImageWidth']; 170 $theImageHeight= $_COOKIE['theImageHeight'] ; 171 } 172 $theImageWidth= $windowWidth - $theImageLeft - $theImageMargeWidth; 173 $theImageHeight= $windowHeight - $theImageTop - $theImageMargeHeight ; 174 175 if (isset($element_info['is_gvideo']) && $element_info['is_gvideo'] ){ 176 $pictureDeriv=$default_size; 177 178 }else{ 179 180 181 $retour = self::get_min_max() ; 182 183 $theMainImageSize = $retour->get_size(); 184 $theMainImageWidth= isset($_COOKIE['theMainImageWidth'])?$_COOKIE['theMainImageWidth']:$theMainImageSize[0]; 185 $theMainImageHeight= isset($_COOKIE['theMainImageHeight'])?$_COOKIE['theMainImageHeight']:$theMainImageSize[1] ; 186 187 if($theImageHeight!=0 && $theImageWidth!=0){ 188 $pictureDeriv=$retour->type ; 189 }else{ 190 $pictureDeriv=$default_size; 191 } 192 } 193 194 if(preg_match("|test|", $DEBUG_autosize, $val)) { 195 $infos_message .= "#208 <br>Init:SESSION:" . cl_print_var($_SESSION) ; 196 197 if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ; 198 $infos_message .= "Init: COOKIE:" . cl_print_var($_COOKIE) ; 199 $infos_message .= "GET:" . cl_print_var($_GET) ; 200 $infos_message .= "POST:" . cl_print_var($_POST) ; 201 $infos_message .=("#201: ".$DEBUG_autosize); 202 } 203 $pattern = array(); 204 if($has_pamoorama=="true"){ 205 if(preg_match("|c1|", $DEBUG_autosize, $val)) echo $theImageWidth . "x" . $theImageHeight ; 206 $pattern[0] = '/width\:(.*)(\d+),/';$replacement[0] = 'width: '.$theImageWidth.' ,'; 207 if(($theImageWidth!=0)){ 208 $content= preg_replace($pattern, $replacement, $content); 209 } 210 if(preg_match("|c1|", $DEBUG_autosize, $val)) { 211 echo "<!-- " . $theImageWidth . "x" . $theImageHeight . " " .cl_print_var($content) ." -->"; 212 self::Fin_php("#212: " . $DEBUG_autosize); 213 } 214 return $content; 215 } 216 if(isset($_GET['map'])){ 217 return $content; 218 } 219 $pattern[0] = '/width\:(.*)(\d+)px/';$replacement[0] = 'width:100% '; 220 $pattern[1] = '/height\:(.*)(\d+)px/';$replacement[1] = 'height:100% '; 221 $pattern[2] = '/width=\"(\d+)\"/';$replacement[2] = ' '; 222 $pattern[3] = '/height=\"(\d+)\"/';$replacement[3] = ' '; 223 224 if ( strstr( $content,"iframe")||strstr($content,"charlie" )){ 225 226 $pictureSelType="Autosize"; 227 $pictureDeriv=$conf['derivative_default_size']; 228 229 $_COOKIE['picture_sel_type']=$pictureSelType; 230 $_COOKIE['picture_deriv']=$pictureDeriv; 231 232 $ncount=1; 233 if (strstr($content,"charlie" )){ 234 $content=str_replace( "<object" , "<object id='theMainImage_obj' name='theMainImage' " ,$content,$ncount); 235 $content=str_replace( "<embed" , "<embed id='theMainImage_emb' name='theMainImage' " ,$content,$ncount); 236 $content=str_replace( 'id="video"',"id='theMainImage_vid' name='theMainImage' " ,$content,$ncount); 237 $content=str_replace( '<video"',"<video id='theMainImage_vid' name='theMainImage' " ,$content,$ncount); 238 }else{ 239 $content=str_replace( "<iframe" , "<iframe id='iframe' name='theMainImage' " ,$content,$ncount); 240 } 241 $content= preg_replace($pattern, "", $content); 242 243 $content= "<div id='theMainImage' style='height:".$theImageHeight."px ;width:".$theImageWidth."px '>". $content . "</div>"; 244 $content= "<style>#theImageAndInfos{height:auto;width:auto;position:relative} 245 #theImage{height:auto;align:center;text-align:center;position:relative} 246 #theMainImage{height:auto;align:center;text-align:center;position:static} 247 #charlie{display:none } 248 #iframe{display:none } 249 </style>".$content; 250 return $content; 251 } 252 253 $content= preg_replace($pattern, "", $content); 254 255 return $content; 256 }//INIT 257 258 /************************ 259 * INIT 2 260 *************************/ 261 static public function init2($content,$element_info){ 262 263 264 global $template,$version,$icon_path,$page,$picture,$conf; 265 global $user,$Css,$css_slideshow,$css_display,$liste_type; 266 global $infos_message; 267 //content = photo 268 269 //===================================================================== 270 global $has_pamoorama,$pictureSelType,$pictureDeriv; 271 global $DEBUG_autosize; 272 if(preg_match("|event|", $DEBUG_autosize, $val)) { 273 $infos_message .= "init2, "; 274 } ; 275 global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize; 276 //-- si Autosize correction redim --------------- 277 $current = $template->get_template_vars('current'); 278 if (!isset($current)) return ; 279 if($pictureSelType!="Autosize") return $content ; 280 $pattern =Array('/width=\"(\d+)\"/','/height=\"(\d+)\"/'); 281 $replacement = Array('',"style='height:".$theImageHeight."px'"); 282 $replacement = Array('',""); 283 $content= preg_replace($pattern, $replacement, $content); 284 if( $has_pamoorama=="true") return $content ; 285 286 if( !preg_match("|c1|", $DEBUG_autosize, $val) ) return $content ; 287 //************************ c1 *************************************** 288 echo "theMainImageWidth :" . $theMainImageSize[0] . " X " . $theMainImageSize[1] . "<br >"; 289 echo "theImageWidth :" . $theImageWidth . " X " . $theImageHeight . "<br >"; 290 echo $infos_message."<br />"; 291 $Ratio = $theMainImageSize[0]/$theMainImageSize[1]; 292 293 $nh = intval($theImageWidth / $Ratio) ; 294 $nw = intval($theImageHeight * $Ratio) ; 295 296 echo $nw . "x " . $nh ."<br />"; 297 298 if($theMainImageSize[0] < $nw){ 299 echo "HEIGHT " .$theImageHeight . " WIDTH " . $nw."<br />"; 300 } 301 if($theMainImageSize[1] < $nh ){ 302 echo "HEIGHT " . $nh . " WIDTH " . ($theImageWidth)."<br />"; 303 } 304 305 $content= $content . $pictureDeriv . " " .$pictureSelType; 306 echo "<div style='color:white;position:absolute;left:0;top:0;width:".$windowWidth ."px;height:" .$windowHeight."px;background-color:blue'>"; 307 echo "left:".$theImageLeft."px;top:".$theImageTop."px;width:".$theImageWidth ."px;height:" .$theImageHeight."px;"; 308 echo "<div style='position:absolute;left:".$theImageLeft."px;top:".$theImageTop."px;width:".$theImageWidth ."px;height:" . $theImageHeight."px;background-color:green;'>"; 309 self::Fin_php("#309 : " . $content + $DEBUG_autosize); 310 311 } //INIT2 312 /*************************** 313 * 314 ***************************/ 315 static public function reload($id_ret){ 316 //========================================= 317 include_once ( "include/functions_cookie.inc.php"); 318 global $ma_page,$user,$element_info,$infos_message,$DEBUG_autosize; 319 global $pictureDeriv,$pictureSelType,$pictureMap; 320 global $conf; 321 $set_miniature = "<!DOCTYPE html><html><head> 322 <meta http-equiv='content-type' content='text/html; charset=UTF-8'/> 323 <script type='text/javascript' src='themes/default/js/jquery.min.js'></script> 324 <script type='text/javascript' src='plugins/Autosize/js/autosizeDetect.js'></script> 325 <script type='text/javascript' src='plugins/Autosize/js/autosize.cookie.js'></script> 326 <script type='text/javascript' src='themes/default/js/plugins/jquery.ajaxmanager.js'></script>"; $set_miniature .= "<script type='text/javascript' src='plugins/Autosize/js/autosize_ajax.js' id='autosize_ajax' > </script >"; 327 $set_var = "<script type='text/javascript'>\n var COOKIE_PATH = '".cookie_path()."';\n"; 328 if(preg_match("|noreload|", $DEBUG_autosize, $val)) { 329 $set_var .= " var reload = 'false';\n"; 330 } else { 331 $set_var .= " var reload = 'true';\n"; 332 } 333 $set_var .= " var ret_id = '". $id_ret . "';\n"; 334 $set_var .= " var mapage = '". $ma_page . "';\n"; 335 $set_var .= " var theme = '" .$user['theme']. "';\n"; 336 $set_var .= " var theMainImageWidth = '" .$element_info['width'] . "';\n"; 337 $set_var .= " var theMainImageHeight = '" .$element_info['height'] . "';\n"; 338 $set_var .= " var theMainImageSrc = '" .$element_info['path']. "';\n"; 339 $set_var .= " </script >"; 340 $autoscript="</head> 341 <body onload=on_load() style='background-color:black;color:white;font-size:30px' > 342 please wait, loading($id_ret)... <div>"; 343 $default_size = $conf['derivative_default_size']; 344 //======================================================================= 345 $pictureSelType = pwg_get_session_var('picture_sel_type',$default_size); 346 $pictureDeriv = pwg_get_session_var('picture_deriv',$default_size); 347 $pictureMap = pwg_get_session_var('picture_map',$default_size); 348 //======================================================================= 349 $autosize_parametres = cl_autosize_Get_Options(); 350 $userst= $user['status']."_enabled" ; 351 $userst=$autosize_parametres-> $userst; 352 $usertype= $user['status']."_type" ; 353 $usertype = $autosize_parametres->$usertype; 354 if($userst=='off'){ 355 356 }else{ 357 if($usertype!="Autosize" && $usertype!="SelMaxi" ){ 358 $pictureSelType = $usertype; 359 $pictureDeriv = $usertype; 360 }else if($autosize_parametres->defaut_type=="off"){ 361 $pictureSelType = pwg_get_session_var('picture_sel_type',"SelMaxi"); 362 }else { 363 $pictureSelType = pwg_get_session_var('picture_sel_type',"Autosize"); 364 } 365 } 366 $autoscript.="$pictureSelType</div></body></html>"; 367 //============================================================ 368 self::save_cookies(); 369 if( !isset($_COOKIE['picture_deriv']) ){ 370 echo "INIT <pre>"; 371 print_r($_COOKIE); 372 self::Fin_php("#372: No COOKIE['picture_deriv'] ".$DEBUG_autosize); 373 } 374 375 if(preg_match("|vue_init|", $DEBUG_autosize, $val)) { 376 $infos_message.="Reload: $userst <br> $usertype <br> autosize_parametres:" . cl_print_var($autosize_parametres) ; 377 if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ; 378 echo "Reload: SESSION:" . cl_print_var($_SESSION) ; 379 echo "Reload: COOKIE:" . cl_print_var($_COOKIE) ; 380 echo "GET:" . cl_print_var($_GET) ; 381 echo "POST:" . cl_print_var($_POST) ; 382 self::Fin_php("#382: ".$DEBUG_autosize); 383 } 384 385 $infos_message.="Reload: $userst <br> $usertype <br> autosize_parametres:" . cl_print_var($autosize_parametres) ; 386 if(!preg_match("|aff_init|", $DEBUG_autosize, $val)) { 387 $infos_message=""; 388 } 389 echo $set_miniature ; 390 echo $set_var ; 391 echo $autoscript; 392 if (!isset($_COOKIE['autosize_reload']) ){ 393 self::Fin_php("#393: Initialisation ".$DEBUG_autosize); 394 } 395 // 396 397 } 398 399 /************************ 400 * cl_autosize_script_1 401 *************************/ 402 static public function cl_autosize_script_1(){ 403 global $user,$page,$template,$cl_plugin,$cl_version; 404 global $has_pamoorama,$css_slideshow; 405 global $pictureSelType,$pictureDeriv,$infos_message,$conf; 406 global $DEBUG_autosize; 407 if(preg_match("|event|", $DEBUG_autosize, $val)) { 408 $infos_message .= "cl_autosize_script_1, " ; 409 } ; 410 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 411 if ($ma_page !='thePicturePage') return ; 412 if ( $has_pamoorama=="false" ) return ; 413 if ($page['slideshow']){ 414 //==== mise à l'échelle === 415 $current = $template->get_template_vars('current'); 416 $default_size = $conf['derivative_default_size']; 417 418 if(isset($current['selected_derivative'])) { 419 $model=$current['selected_derivative']->get_type() ; 420 }else{ 421 $model=$default_size; 422 } 423 424 $selected_derivative = $current['derivatives'][$model]; 425 $template->append('current', array( 426 'selected_derivative' => $selected_derivative 427 ), 428 true); 429 430 } 431 432 433 434 $template->set_filenames(array('autosize_init'=>AUTOSIZE_PATH_ABS. "template/conflit.tpl" ) ); 435 $autosize_parametres = cl_autosize_Get_Options() ; 436 $theme=$user['theme']; 437 //============================================================================== 438 $template->assign( 439 array( 440 'autosize_parametres' => $autosize_parametres , 441 'cl_plugins' => $cl_plugin , 442 'cl_version' => $cl_version , 443 'name' => $cl_plugin['name'] , 444 'has_pamoorama' => $has_pamoorama, 445 'theme' => $theme , 446 'DEBUG_autosize' => $DEBUG_autosize, 447 'AUTOSIZE_PATH' => str_replace("../","",AUTOSIZE_PATH) , 448 'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS, 449 'Version_pwg' => PHPWG_VERSION , 450 'slide_show' => $page['slideshow'] 451 ) 452 ); 453 if( preg_match("|c2|", $DEBUG_autosize, $val) ){ 454 self::Fin_php( "454: " . $DEBUG_autosize); 455 return $content ; 456 457 } 458 459 return $template->parse( 'autosize_init', false); 460 461 462 }// function cl_autosize_script_1 463 464 /************************************* 465 * cl_autosize_script_2() 466 **************************************/ 467 static public function cl_autosize_script_2() 468 { 469 global $css_slideshow; 470 global $pictureSelType,$pictureDeriv,$infos_message; 471 global $template,$user,$conf,$picture ,$page, $cl_plugin,$cl_version,$known_script ; 472 473 global $has_pamoorama; 474 global $DEBUG_autosize; 475 if(preg_match("|event|", $DEBUG_autosize, $val)) { 476 $infos_message .= "cl_autosize_script_2, "; 477 } ; 478 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 479 if ($ma_page !='thePicturePage') return ; 480 481 $theme=$user['theme']; 482 if ($has_pamoorama=="false" ) return ; 483 if ($css_slideshow == "no" and isset($_GET['slideshow'])) return ; 484 $AUTOSIZE_PATH = dirname(__FILE__).'/'; 485 //===================================================================== 486 $template->assign( 487 array( 488 'cl_version' => $cl_version , 489 'name' => $cl_plugin['name'] , 490 'ma_page' => $ma_page, 491 'theme' => $theme , 492 'DEBUG_autosize' => $DEBUG_autosize , 493 'AUTOSIZE_PATH' => AUTOSIZE_PATH 494 ) 495 ); 496 $autoscript="<script type='text/javascript'> 497 /* cl_autosize_script_2 */ 498 if (typeof (save_framework) == 'function') 499 save_framework('".$ma_page."'); 500 501 </script>"; 502 $template->append('footer_elements',$autoscript); 503 504 return ; 505 }// function cl_autosize_script_2 506 507 /************************************* 508 * cl_autosize_script_3() 509 **************************************/ 510 static public function cl_autosize_script_3() { 511 global $has_pamoorama,$template,$page,$infos_message; 512 global $DEBUG_autosize; 513 if(preg_match("|event|", $DEBUG_autosize, $val)) { 514 $infos_message .= "cl_autosize_script_3, "; 515 } ; 516 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 517 if ($ma_page !='thePicturePage') return ; 518 519 520 $template->func_combine_script(array('id'=>'my_script_2', 521 'path'=> AUTOSIZE_PATH.'js/JScript.js', 522 'require' => 'jquery'), 523 $template->smarty); 524 525 $template->func_combine_css(array('id'=>'autosize.css', 526 'path'=> AUTOSIZE_PATH.'css/autosize.css' 527 )); 528 529 530 $autoscript="<script type='text/javascript'> 531 var COOKIE_PATH = '".cookie_path()."' ; 532 </script>"; 533 $template->append('footer_elements',$autoscript); 534 if ($has_pamoorama=="false" ) return ; 535 536 $autoscript="<script type='text/javascript'> 537 if (typeof (Ajout_Ajax) == 'function') 538 Ajout_Ajax(); 539 </script>"; 540 $template->append('footer_elements',$autoscript); 541 542 543 return ; 544 }// function cl_autosize_script_3 545 546 /************************ 547 * cl_autosize_affiche 548 *************************/ 549 static public function cl_autosize_affiche(){ 550 if (!defined('AUTOSIZE_PATH')) { 551 define( 'AUTOSIZE_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/' ); 552 if (!defined('AUTOSIZE_PATH_ABS')) 553 define( 'AUTOSIZE_PATH_ABS', realpath(AUTOSIZE_PATH)."/"); 554 } 555 556 global $user, $picture, $template,$page,$known_script; 557 global $content, $element_info; 558 global $infos_message,$error_message,$warnings_message; 559 global $conf,$lang ,$user,$userdata; 560 global $defined_types, $liste_type,$SRC_IMG; 561 global $set_miniature; 562 global $autosize_parametres,$user_status; 563 global $has_pamoorama,$pictureSelType,$pictureDeriv; 564 global $DEBUG_autosize; 565 global $css_slideshow,$css_display; 566 if(preg_match("|event|", $DEBUG_autosize, $val)) { 567 $infos_message .= "cl_autosize_affiche, " ; 568 } ; 569 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 570 if ($ma_page !='thePicturePage') return ; 571 //============================================================ 572 self::save_cookies(); 573 574 if(isset($set_miniature)){ 575 $set_miniature = self::cl_autosize_nofile($set_miniature) ; 576 $set_miniatures= explode("script",$set_miniature); 577 if(preg_match("|noGen|", $DEBUG_autosize, $val)) { 578 if(count($set_miniatures)> 1 ) 579 $infos_message .= "PictureDeriv:" . $pictureDeriv. ' miniature:' . cl_print_var( $set_miniature); 580 581 }else { 582 583 584 } ; 585 $template->append('footer_elements',$set_miniature); 586 } 587 if ($css_slideshow == "no" and isset($_GET['slideshow'])) return ; 588 589 $AUTOSIZE_PATH = dirname(__FILE__).'/'; 590 $theme=$user['theme']; 591 load_language('plugin.lang', AUTOSIZE_PATH); 592 593 include_once (AUTOSIZE_PATH."include/affiche.php"); 594 595 $file =AUTOSIZE_PATH_ABS.'template/picture_1.tpl' ; 596 if ($css_display=="none" && $has_pamoorama=="true" ) { 597 $css_display="block" ; 598 } 599 $file_css=AUTOSIZE_PATH."css/".$theme.".css"; 600 if (!file_exists($file_css)) $file_css="no"; 601 if ($css_display=="none" ) { 602 return ; 603 } 604 if($pictureSelType == $pictureDeriv ) { 605 if(preg_match("|event|", $DEBUG_autosize, $val)) { 606 cl_aff_infos_plus(); 607 } ; 608 609 } 610 611 if (defined('GMAPS_VERSION')) $gmaps_function="true"; 612 else $gmaps_function="false" ; 613 614 615 616 $template->set_filenames(array('autosize_content_header'=> $file )); 617 $template->assign( array( AUTOSIZE_PATH,$AUTOSIZE_PATH, 618 'file_css' =>$file_css, 619 'css_display' => $css_display, 620 'theme' =>$theme, 621 'gmaps_function' => $gmaps_function 622 )); 623 $template->concat('autosize_content', $template->parse('autosize_content_header', true)); 624 625 $file =AUTOSIZE_PATH_ABS.'template/header.tpl' ; 626 $template->set_filenames(array('autosize_init_header'=> $file )); 627 $template->parse( 'autosize_init_header', false); 628 $theme=$user['theme']; 629 630 if($autosize_parametres->check_icon_v == 'on'){ 631 $template->assign('cl_autosize_button', 632 array( 'cl_autosize_info' => 'cl_autosize_info' , 633 'cl_autosize_info_1' => 'cl_autosize_info_' , 634 'cl_autosize_info_2' => 'cl_autosize_info_2' , 635 'URL' => $_SERVER['REQUEST_URI'] , 636 'ICON2' => AUTOSIZE_PATH . 'icons/button-maximize.png', 637 'ICON' => AUTOSIZE_PATH . 'icons/button-minimize.png', 638 'ICON1' => AUTOSIZE_PATH . 'icons/button-no.png' 639 ) 640 641 ); 642 $template->set_filenames(array('cl_bp' => $AUTOSIZE_PATH. 'template/picture.tpl')); 643 $template->concat('PLUGIN_PICTURE_ACTIONS', $template->parse('cl_bp', true)); 644 } 645 646 $template->set_filenames( 647 array('autosize_content'=> $AUTOSIZE_PATH.'template/autosize.tpl', 648 'theme' => $theme ) 649 ); 650 651 $template->concat('autosize_content', $template->parse('autosize_content_header', true)); 652 if(isset($conf['go_up_down']) && ($conf['go_up_down']==true) ){ 653 $template->set_filenames(array('mes_script' => realpath(AUTOSIZE_PATH).'/template/mes_scripts.tpl') ); 654 655 $template->func_combine_script(array('id'=>'my_script_2', 656 'path'=> AUTOSIZE_PATH.'/js/JScript.js', 657 'require' => 'jquery'), 658 $template->smarty 659 ); 660 661 $template->assign(array( 662 'MY_FOOTER_PATH' =>AUTOSIZE_PATH 663 )); 664 $template->parse('mes_script'); 665 } 666 667 668 if(preg_match("|vue_cookies|", $DEBUG_autosize, $val)) { 669 670 $pictureSelType=$_COOKIE['picture_sel_type']; 671 $pictureDeriv=$_COOKIE['picture_deriv']; 672 $infos_message .= "cl_autosize_affiche: $pictureSelType <--> $pictureDeriv \n" ; 673 674 } 675 676 if(preg_match("|test|", $DEBUG_autosize, $val)) { 677 $infos_message .= "#683 <br>cl_autosize_affiche:_COOKIE:" . cl_print_var($_COOKIE) ; 678 $pictureMap=$_COOKIE['picture_map']; 679 $infos_message .= "<br />SelType:" . $pictureSelType."; pictureDeriv:".$pictureDeriv ."; pictureMap:".$pictureMap; 680 681 self::Fin_php("#681: ".$DEBUG_autosize); 682 } 683 cl_aff_infos_plus(); 684 return $template->parse( 'autosize_content', false); 685 } //public function cl_autosize_affiche 686 687 688 /**************************************** 689 * 690 ****************************************/ 691 function Get_Options(&$parametres,$str_index){ 692 global $conf ; 693 if (!isset( $conf[$str_index])) { 694 $conf[$str_index]=""; 695 } 696 $m_options= $conf[$str_index]; 697 if(isset($m_options)) 698 if ( preg_match("|s:(.*)|", $m_options, $val) ) 699 $parametres = unserialize($conf[$str_index]); 700 else{ 701 $parametres=explode(",",$_options); 702 } 703 //====== par defaut ======================= 704 $new_val=false; 705 $def_para=Array(); 706 707 $def_para['query'] = 'Qt' ; 708 $def_para['type'] = 'Ty' ; 709 710 $def_para['webmaster_type'] = 'Autosize' ; 711 $def_para['admin_type'] = 'Autosize' ; 712 $def_para['generic_type'] = 'Autosize' ; 713 $def_para['guest_type'] = 'Autosize' ; 714 $def_para['normal_type'] = 'Autosize' ; 715 716 717 718 $def_para['mini_height'] = '150' ; 719 $def_para['mini_width'] = '300' ; 720 721 $def_para['mini_height2'] = '150' ; 722 $def_para['mini_width2'] = '300' ; 723 724 $def_para['echelle_max'] = '1.0'; 725 $def_para['marge_basse'] = '0'; 726 $def_para['fade_in'] = '0'; 727 //================================================== 728 $def_para['check_desc_v'] = "off" ; 729 $def_para['check_icon_v'] = "off" ; 730 $def_para['defaut_type'] = "off" ; 731 732 $def_para['webmaster_enabled'] = "off" ; 733 $def_para['admin_enabled'] = "off" ; 734 $def_para['generic_enabled'] = "off" ; 735 $def_para['guest_enabled'] = "off" ; 736 $def_para['normal_enabled'] = "off" ; 737 //=================================================== 738 $para=$def_para; 739 foreach ($para as $key => $value) { 740 if( isset($parametres->$key) ){ 741 $value=$parametres->$key; 742 } 743 if($def_para[$key] =="on" ||$def_para[$key] =="off" ){ 744 $val_pg=(isset($_POST[$key]))? ($_POST[$key]=="off"||$_POST[$key]=="on")?$_POST[$key]:"on" : "off" ; 745 $value =(isset($_POST[$key]))? $val_pg : $value ; 746 $val_pg=(isset($_GET[$key]))? ($_GET[$key]=="off"||$_GET[$key]=="on")?$_GET[$key]:"on" : "off" ; 747 $value =(isset($_GET[$key]))? $val_pg : $value ; 748 }else{ 749 $value =(isset($_POST[$key]))? $_POST[$key] : $value ; 750 $value =(isset($_GET[$key]))? $_GET[$key] : $value ; 751 } 752 unset( $parametres->$key) ; 753 $parametres->$key = $value ; 754 } 755 return $parametres ; 756 } 757 /****************************************************/ 758 759 function listeFichiers($dir,$theme){ 760 global $extensions_allowed; 761 $extensions_allowed = array(); 762 $extensions_allowed [] = 'css'; 763 if ($handle = opendir($dir)) { 764 while (false !== ($file = readdir($handle))) { 765 if (($file <>'.') && ($file<>'..')) { 766 if (is_file($dir.'/'.$file)){ 767 $extension = pathinfo($dir.'/'.$file, PATHINFO_EXTENSION); 768 if (in_array($extension,$extensions_allowed)){ 769 $fileHandle = fopen($dir.'/'.$file, "r"); 770 771 $intro = fread($fileHandle,filesize ($dir.'/'.$file)); 772 fclose($fileHandle); 773 if ($file== $theme){ 774 flush(); 775 return $intro ; 776 } 777 } 778 } else { 779 if (is_dir($dir.'/'.$file)){ 780 listeFichiers($dir.'/'.$file,$theme); 781 } 782 } 783 } 784 } 785 closedir($handle); 786 } 787 } 788 //================================================ 789 static public function css($theme_local) { 790 $path = $_SERVER['DOCUMENT_ROOT']; 791 if (substr($path,-1)=='/'){ 792 $path = substr($path,0,-1); 793 } 794 if(isset($_GET['path'])) 795 $path=$_GET['path']; 796 else 797 $path=PHPWG_ROOT_PATH."local/css/"; 798 799 $mycssfile=$path.$theme_local; 800 801 if(!file_exists($mycssfile)) 802 $mycssfile=$path."default-rules.css"; 803 804 if(!file_exists($mycssfile)){ 805 return Array(); 806 } 807 808 $ret = file_get_contents ($mycssfile); 809 810 function remove_comments( & $string ) { 811 $string = preg_replace('#/\*.*?\*/#s',"",$string); 812 return $string; 813 } 814 815 $order = array("\r\n", "\n", "\r"," "); 816 $replace = ''; 817 $newstr = str_replace($order, $replace, $ret); 818 819 $order = array('"'); 820 $replace = "'"; 821 $newstr = str_replace($order, $replace, $newstr); 822 823 824 $order = array("}"); 825 $replace = '}\r\n'; 826 $newstr = str_replace($order, $replace, $newstr); 827 remove_comments($newstr); 828 829 $newstr = explode('\r\n',$newstr); 830 $css=Array(); 831 832 foreach ($newstr as $key => $value) { 833 if($value){ 834 $css2=Array(); 835 $key=explode("{",$value); 836 $value = str_replace("}","",$key[1]) ; 837 $value=explode(";",$value); 838 foreach ($value as $key2 => $value2) { 839 if($value2){ 840 $key2=explode(":",$value2); 841 $value2 = $key2[1] ; 842 $css2[$key2[0]] = $value2 ; 843 } 844 } 845 $css[$key[0]]=$css2 ; 846 } 847 } 848 849 850 return $css; 851 } 852 853 /*************************** 854 * get_min_max 855 ***************************/ 856 static public function get_min_max(){ 857 global $liste_type,$img_all,$set_miniature,$template,$infos_message,$error_message,$has_pamoorama ; 858 global $theImageWidth,$theImageHeight,$pictureSelType,$pictureDeriv ; 859 global $DEBUG_autosize; 860 861 862 $current = $template->get_template_vars('current'); 863 $liste_type=""; 864 $del_deriv_types = array(); 865 $i=0; 866 $defined_types = array_keys(ImageStdParams::get_defined_type_map()); 867 foreach($defined_types as $type){ 868 869 if($type!="Autosize" && $type!="SelMaxi" ){ 870 $last_derivative= $type ; 871 $del_deriv_types[$i] = $last_derivative ; 872 $i++; 873 } 874 875 } 876 ; 877 $derivative=$current['derivatives'][$last_derivative] ; 878 $img_all= $derivative->get_all($derivative->src_image); 879 880 $retour = (object) ''; 881 $maxi_image = (object) ''; 882 $mini_image = (object) ''; 883 $std_image = (object) ''; 884 $default_image=(object) ''; 885 $SelType_image=(object) ''; 886 $last_image=(object) ''; 887 888 global $imgSizeWH ; 889 $imgSizeWH = $derivative->get_size(); 890 $theImage_maxi=0; 891 $theImage_mini=0; 892 $theImage_def=0; 893 $No_files= array(); 894 //================= Liste ========================= 895 $ok= 0 ; 896 $nofile=0 ; global $max_crop; 897 //============================================= 898 // Liste mini maxi 899 //============================================= 900 foreach ($img_all as $img_select){ 901 902 $img_type = $img_select->get_type(); 903 $img_url = $img_select->get_path(); 904 $max_crop = 0 ; 905 $imgWH = self::Get_Size($img_select); 906 if ($img_type=="square" || $img_type=="thumb" ) continue ; 907 if($img_type=="Autosize" || $img_type=="SelMaxi"){ 908 $theImage_def +=1 ; 909 continue; 910 } 911 if(!file_exists(PHPWG_ROOT_PATH.$img_url)){ 912 $No_files[$img_type] = $img_select ; 913 $nofile++ ; 914 if(preg_match("|get_infos|", $DEBUG_autosize, $val)) 915 $infos_message .=$nofile ." " ; 916 } 917 if(preg_match("|get_minfos|", $DEBUG_autosize, $val)) 918 $infos_message .=$img_url . " " . $max_crop ." -> " . $img_type . " " . print_r($imgWH,true). " <br >"; 919 920 if(file_exists(PHPWG_ROOT_PATH.$img_url)){ 921 } // if file 922 923 if ($theImage_def==0){ 924 // Avant Autosize ou Original; 925 if($img_type=="Original") { 926 $theImage_def = 1; 927 $theImage_maxi=1; 928 $theImage_mini=1; 929 if($ok==0){ 930 $last_image->type=$img_type; 931 $last_image->url=$img_url; 932 $last_image=$img_select; 933 } 934 }else{ 935 $last_derivative=$img_type ; 936 $last_image= $img_select; 937 } 938 } 939 if ($theImage_maxi==0){ 940 $maxi_image= $img_select; 941 } 942 if ($theImage_mini==0){ 943 $mini_image= $img_select; 944 } 945 $liste_type[$img_type]=$img_type.",".$img_url.",".$imgWH[0] .",".$imgWH[1] ; 946 if( $img_type==$pictureSelType){ 947 if(preg_match("|get_minfos|", $DEBUG_autosize, $val)) $infos_message .= $pictureSelType . " <--> " . $img_type ."<br >"; 948 949 $SelType_image->type=$img_type; 950 $SelType_image->url=$img_url; 951 $SelType_image=$img_select; 952 } 953 if( $img_type=="Original" && $theImage_def==0 ){ 954 $theImage_def=1; 955 $img_type = $last_derivative ; 956 $img_url= $derivative->get_path(); 957 $imgWH = $derivative->get_size(); 958 959 $default_image->type=$img_type; 960 $default_image->url=$img_url; 961 $default_image=$img_select; 962 963 } 964 965 if($has_pamoorama==true) 966 $test= ($imgWH[1] > $theImageHeight) ; 967 else 968 $test= ($imgWH[1] > $theImageHeight && $imgWH[0] > $theImageWidth); 969 if($theImage_maxi==0) 970 if( $test ){ 971 $theImage_maxi=1; 972 $maxi_image->type = $img_type; 973 $img_type=$img_select->get_type(); 974 if($img_type=="Original") 975 $maxi_image = $last_image; 976 else 977 $maxi_image = $img_select; 978 979 $maxi_image->url = $maxi_image->get_path(); 980 981 } else { 982 983 $mini_image->type=$img_type; 984 $mini_image->url=$img_url; 985 $mini_image=$img_select; 986 $mini_image->url = $mini_image->get_path(); 987 } 988 989 } // for 990 //================================================ 991 992 $img_url = $img_select->src_image->get_url(); 993 $imgSizeWH = $img_select->src_image->get_size(); 994 $liste_type["Original"]="Original".",".$img_url.",".$imgSizeWH[0] .",".$imgSizeWH[1] ; 995 996 997 $retour=(object)'' ; 998 if ($pictureSelType=="Autosize") $retour= $maxi_image ; 999 else if ($pictureSelType=="SelMaxi") $retour= $mini_image ; 1000 else{ 1001 $types = array_intersect(array_keys($liste_type), array($pictureSelType)); 1002 if(!count($types)){ 1003 $pictureSelType="Original"; 1004 } 1005 $retours= explode(",",$liste_type[$pictureSelType]); 1006 $retour=$SelType_image; 1007 $retour->type=$retours[0]; 1008 $retour->url=$retours[1]; 1009 } 1010 1011 if (!isset( $retour->type)){ 1012 $retour=$last_image; 1013 $retour->type = $retour->get_type(); 1014 $retour->url = $retour->get_path(); 1015 1016 } 1017 if (isset( $retour->type) && $retour->type=="Original" ){ 1018 $retour=$last_image; 1019 $retour->type = $last_derivative; 1020 $retour->url = $retour->get_path(); 1021 1022 } 1023 if($nofile > 0){ 1024 $set_miniature=$No_files ; 1025 } 1026 1027 if(preg_match("|get_infos|", $DEBUG_autosize, $val)) 1028 $infos_message .=$pictureSelType . " -> " . $retour->type . " : " . $retour->url ."<br >"; 1029 1030 return $retour ; 1031 1032 } 1033 //================================================================= 1034 1035 static public function Get_Size($Img_Select){ 1036 global $max_crop; 1037 $imgWH = $Img_Select->get_size(); 1038 $img_type = $Img_Select->get_type(); 1039 if( $img_type =="Original") return ; 1040 $smaller = ImageStdParams::get_by_type($img_type); 1041 $max_crop=0; 1042 if($smaller->sizing->max_crop==1){ 1043 $imgWH =$smaller->sizing->min_size; 1044 $max_crop=1; 1045 } 1046 return $imgWH ; 1047 } 1048 //================================================================== 1049 static public function cl_autosize_nofile($img_all){ 1050 //=== verification fichiers absents === 1051 global $infos_message,$error_message; 1052 global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize; 1053 global $pictureDeriv; 1054 $ok=false ; 1055 $nofiles=array(); 1056 $file_no=(object) ''; 1057 1058 $nosrc=false ; 1059 $ok=true ; 1060 $listes=""; 1061 foreach ($img_all as $img_select){ 1062 $img_url = $img_select->get_url(); 1063 if(!file_exists(PHPWG_ROOT_PATH.$img_url)){ 1064 $img_type = $img_select->get_type(); 1065 1066 $file_id=explode("?",$img_url); 1067 if(count($file_id) ==1){ 1068 $file_id[]=$file_id[0] ; 1069 } 1070 if ( !preg_match("|".$file_id[1]."|", $listes) ){ 1071 $listes .= $file_id[1] ."<br />"; 1072 $file_no->url= $file_id[1] ; 1073 $id = $img_select->src_image->id; 1074 $file_no->id=$id ; 1075 $file_no->type=$img_type ; 1076 array_push($nofiles,serialize($file_no)) ; 1077 if( $img_type == $pictureDeriv){ 1078 1079 break ; 1080 } 1081 } 1082 $ok=false ; 1083 } 1084 } 1085 $exec_miniatures=""; 1086 if(count($nofiles)>0){ 1087 //======================================================================================= 1088 if($nosrc!=true ){ 1089 $script_miniatures = "<script type='text/javascript' src='".PHPWG_ROOT_PATH."themes/default/js/plugins/jquery.ajaxmanager.js' ></script>"; 1090 $script_miniatures .= "<script type='text/javascript' src='".PHPWG_ROOT_PATH."plugins/Autosize/js/autosize_ajax.js' id='autosize_ajax' > </script >"; 1091 $nosrc=true ; 1092 } 1093 $exec_miniatures =""; 1094 $script_miniatures .= "<script type='text/javascript'> 1095 var nofile=Array("; 1096 for ($i=0;$i < count($nofiles)-1 ;$i++){ 1097 $file = unserialize($nofiles[$i]); 1098 $exec_miniatures .= "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'},\n" ; 1099 } 1100 if($i < count($nofiles)) 1101 { 1102 $file = unserialize($nofiles[$i]); 1103 $exec_miniatures .= "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'}" ; 1104 } 1105 /*** Un seul ***********/ 1106 $file = unserialize($nofiles[count($nofiles)-1]); 1107 $exec_miniatures = "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'}" ; 1108 1109 $script_miniatures .= $exec_miniatures . "); </script>\n" ; 1110 $script_miniatures .= "<script type='text/javascript' > 1111 if(typeof nofile!='undefined') 1112 getDerivativeUrls(nofile); 1113 </script>"; 1114 //================================================================================== 1115 return $script_miniatures ; 1116 } 1117 } 1118 /*************************** 1119 * get_cookies 1120 ****************************/ 1121 static public function get_cookies(){ 1122 global $pictureDeriv,$pictureSelType,$pictureDeriv,$pictureMap; 1123 if(!isset($_COOKIE['picture_deriv'])){ 1124 $pictureDeriv= pwg_get_session_var('picture_deriv'); 1125 $pictureSelType = pwg_get_session_var('picture_sel_type'); 1126 $pictureMap = pwg_get_session_var('picture_map') | $pictureDeriv; 1127 }else{ 1128 $pictureDeriv = $_COOKIE['picture_deriv']; 1129 $pictureSelType = isset( $_COOKIE['picture_sel_type'])?$_COOKIE['picture_sel_type']:$pictureDeriv; 1130 $pictureMap = isset($_COOKIE['picture_map'])?$_COOKIE['picture_map']:$pictureDeriv; 1131 } 1132 $_COOKIE['picture_sel_type']=$pictureSelType; 1133 $_COOKIE['picture_deriv']=$pictureDeriv; 1134 $_COOKIE['picture_map']=$pictureMap; 1135 //================================================================ 1136 global $DEBUG_autosize; 1137 if( isset($_GET['cl_debug']) && $_GET['cl_debug'] =='false') { 1138 $DEBUG_autosize=""; 1139 }else{ 1140 $DEBUG_autosize = isset($_POST['cl_debug']) ? $_POST['cl_debug'] : "" ; 1141 $DEBUG_autosize = isset($_GET['cl_debug']) ? $_GET['cl_debug'] : $DEBUG_autosize ; 1142 $DEBUG_autosize = isset($conf['cl_debug']) ? $conf['cl_debug']."," . $DEBUG_autosize : $DEBUG_autosize ; 1143 //=============================================================== 1144 } 1145 if(!isset($_COOKIE['picture_deriv'] )){ 1146 if(preg_match("|test_1|", $DEBUG_autosize, $val)) { 1147 $infos_message .= "not COOKIE['picture_deriv'] -> reload(): <br>"; 1148 self::Fin_php("#1148 autosize_calcContent:" . $DEBUG_autosize ); 1149 } 1150 unset($_COOKIE['autosize_reload']); 1151 } 1152 if (!isset($_COOKIE['autosize_reload']) ){ 1153 if(preg_match("|test_2|", $DEBUG_autosize, $val)) { 1154 $infos_message .= "not COOKIE['autosize_reload'] -> reload(): <br>"; 1155 self::Fin_php("#1155 autosize_calcContent:" . $DEBUG_autosize); 1156 } 1157 self::reload("#1157"); 1158 } 1159 } 1160 /*************************** 1161 * save_cookies 1162 ****************************/ 1163 static public function save_cookies(){ 1164 global $pictureDeriv,$pictureSelType,$pictureDeriv,$pictureMap; 1165 1166 pwg_set_session_var('picture_deriv',$pictureDeriv); 1167 pwg_set_session_var('picture_sel_type',$pictureSelType); 1168 pwg_set_session_var('picture_map',$pictureDeriv); 1169 //============================================================ 1170 setcookie( 'picture_sel_type', 1171 $pictureSelType, 1172 time()+5, 1173 cookie_path() 1174 ); 1175 //============================================================= 1176 setcookie( 'picture_map', 1177 $pictureDeriv, 1178 time()+5, 1179 cookie_path() 1180 ); 1181 //============================================================ 1182 setcookie( 'picture_deriv', 1183 $pictureDeriv, 1184 time()+5, 1185 cookie_path() 1186 ); 1187 $_COOKIE['picture_sel_type']=$pictureSelType; 1188 $_COOKIE['picture_deriv']=$pictureDeriv; 1189 $_COOKIE['picture_map']=$pictureDeriv; 1190 } 1191 1192 static public function Fin_php($message_){ 1193 global $infos_message; 1194 echo "End :".$message_."<br>"; 1195 die($infos_message); 1196 } 1197 //================================================== 1198 } // class 1199 1200 /************************************* 1201 * 1202 *************************************/ 1203 function cl_autosize_Get_Options() 1204 { 1205 global $conf,$autosize_parametres; 1206 $autosize_parametres =""; 1207 1208 if (!isset($conf['cl_autosize'])) { 1209 $conf['cl_autosize']=""; 1210 $q = ' 1211 INSERT INTO '.CONFIG_TABLE.' (param, value, comment) 1212 VALUES ("cl_autosize","","Parametres du plugin Autosize") 1213 ;'; 1214 pwg_query($q); 1215 } 1216 $autosize_parametres = unserialize($conf['cl_autosize']); 1217 // $autosize_parametres = self::Get_Options($autosize_parametres,'cl_autosize'); 1218 $autosize_parametres = cl_autosize_Set_Options(); 1219 return $autosize_parametres; 51 1220 } 52 if(preg_match("|event|", $DEBUG_autosize, $val)) $infos_message = "autosize_calcContent, " ; 53 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 54 if ($ma_page !='thePicturePage') return ; 55 $default_size = $conf['derivative_default_size']; 56 //============================================================ 57 self::get_cookies(); 58 $types = array_intersect(array_keys(ImageStdParams::get_defined_type_map()), array("Autosize","SelMaxi")); 59 if (count($types)==0){ 60 include_once (AUTOSIZE_PATH.'maintain.inc.php'); 61 if (isset($conf['cl_derivatives_sav'])) { 62 plugin_deactivate() ; 63 } 64 plugin_activate(); 65 unset ( $_COOKIE['autosize_reload']) ; 66 } 67 if(preg_match("|test|", $DEBUG_autosize, $val)) { 68 $infos_message .= "#65 autosize_calcContent: <br>"; 69 if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ; 70 $infos_message .= "SESSION:" . cl_print_var($_SESSION) ; 71 $infos_message .= "COOKIE:" . cl_print_var($_COOKIE) ; 72 $infos_message .= "GET:" . cl_print_var($_GET) ; 73 $infos_message .= "POST:" . cl_print_var($_POST) ; 74 $infos_message .= "$pictureDeriv $pictureSelType $pictureMap "; 75 // self::Fin_php ("#75: ".$DEBUG_autosize); 76 } 77 if(!isset($_COOKIE['picture_deriv'] )){ 78 if(preg_match("|test_1|", $DEBUG_autosize, $val)) { 79 $infos_message .= "not COOKIE['picture_deriv'] -> reload(): <br>"; 80 self::Fin_php("#80 autosize_calcContent:" . $DEBUG_autosize ); 81 } 82 unset($_COOKIE['autosize_reload']); 83 } 84 if (!isset($_COOKIE['autosize_reload']) ){ 85 if(preg_match("|test_2|", $DEBUG_autosize, $val)) { 86 $infos_message .= "not COOKIE['autosize_reload'] -> reload(): <br>"; 87 self::Fin_php("#87 autosize_calcContent:" . $DEBUG_autosize); 88 } 89 self::reload("#89"); 90 // self::Fin_php("#90 autosize_calcContent:" + $DEBUG_autosize); 91 92 } 93 //=================================================================== 94 $current = $template->get_template_vars('current'); 95 if (!isset($current)) return ; 96 //=============================================================== 97 global $imgSizeWH; 98 $derivative = $current['src_image'] ; 99 $imgSizeWH = $derivative->get_size(); 100 $SRC_IMG = $derivative->get_url(); 101 102 $picture['current']['scaled_width']=$imgSizeWH[0]; 103 $picture['current']['scaled_height']= $imgSizeWH[1]; 104 $picture['current']['high_url']= $SRC_IMG; 105 $picture['current']['image_url']=$SRC_IMG; 106 $picture['current']['thumbnail']=$SRC_IMG; 107 108 //============================================================== 109 $autosize_parametres = cl_autosize_Get_Options(); 110 return false ; 111 }//calc_content ; 112 113 114 115 /********************* 116 * INIT 117 *********************/ 118 static public function init_3(){ 119 120 } 121 static public function init_1($content, $image) 122 { 123 global $conf, $template, $page; 124 if(!isset($conf['AS_panorama'])) return $content; 125 if( !is_array($conf['AS_panorama']) ){ 126 return $content; 127 } 128 $asp = & $conf['AS_panorama']; 129 if(!isset($asp['in_mode_360'])) $asp['in_mode_360']=""; 130 if(!isset($asp['in_mode_180'])) $asp['in_mode_180']=""; 131 132 if ( !stristr($image['name'], $asp['in_mode_360']) and !stristr($image['name'], $asp['in_mode_180']) ) return $content; 133 134 $asp['min_viewport_width']=$_COOKIE['windowWidth'] -$_COOKIE['theImageLeft']-$_COOKIE['theImageRight']; 135 $asp['viewport_height']=$_COOKIE['windowHeight']-130 ; 136 137 $asp['start_position']= 10; 138 139 } 140 /*********************/ 141 static public function init($content,$element_info){ 142 global $template,$version,$icon_path,$page,$picture,$conf; 143 global $user,$Css,$css_slideshow,$css_display,$liste_type; 144 global $has_pamoorama,$pictureSelType,$pictureDeriv,$pictureMap; 145 global $infos_message,$warnings_message; 146 147 global $set_miniature,$imgSizeWH,$DEBUG_autosize; 148 global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize; 149 //======================================================= 150 global $has_pamoorama ; 151 152 if( isset($_GET['cl_debug']) && $_GET['cl_debug'] =='false') { 153 $DEBUG_autosize=""; 154 }else{ 155 $DEBUG_autosize = isset($_POST['cl_debug']) ? $_POST['cl_debug'] : "" ; 156 $DEBUG_autosize = isset($_GET['cl_debug']) ? $_GET['cl_debug'] : $DEBUG_autosize ; 157 $DEBUG_autosize = isset($conf['cl_debug']) ? $conf['cl_debug']."," . $DEBUG_autosize : $DEBUG_autosize ; 158 //=============================================================== 159 } 160 if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "init, ";} ; 161 162 $has_pamoorama = isset($template->files['pamooramics_content'])?"true":"false"; 163 $theme=$user['theme']; 164 165 $Css = self::css($theme."-rules.css"); 166 $css_slideshow=isset($Css['.Autosize']['slideshow'])?$Css['.Autosize']['slideshow']:"yes"; 167 $css_display= isset($Css['.Autosize']['display'])?$Css['.Autosize']['display']:"block"; 168 $default_size = $conf['derivative_default_size']; 169 //============================================================ 170 self::get_cookies(); 171 //============================================================== 172 if(preg_match("|test|", $DEBUG_autosize, $val)) { 173 $infos_message .= "#133 <br>Init:SESSION:" . cl_print_var($_SESSION) ; 174 if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ; 175 $infos_message .= "GET:" . cl_print_var($_GET) ; 176 $infos_message .= "POST:" . cl_print_var($_POST) ; 177 $infos_message .= "$pictureDeriv $pictureSelType $pictureMap "; 178 // self::Fin_php("#138: ".$DEBUG_autosize); 179 } 180 $autosize_parametres = cl_autosize_Get_Options(); 181 182 //===================================================================== 183 $current = $template->get_template_vars('current'); 184 //=== Zone affichage == 185 $windowWidth=$_COOKIE['windowWidth'] ; 186 $windowHeight=$_COOKIE['windowHeight'] ; 187 188 $theImageTop= isset($_COOKIE['theImageTop'])?$_COOKIE['theImageTop']:0; 189 $theImageLeft=isset($_COOKIE['theImageLeft'])?$_COOKIE['theImageLeft']:0; 190 191 $theImageRight=isset($_COOKIE['theImageRight'])?$_COOKIE['theImageRight']:0; 192 $theImageBottom=isset($_COOKIE['theImageBottom'])?$_COOKIE['theImageBottom']:0; 193 194 195 $theImageMargeWidth=isset($_COOKIE['theImageMargeWidth']) ? $_COOKIE['theImageMargeWidth']:0; 196 $theImageMargeHeight=isset($_COOKIE['theImageMargeHeight'])?$_COOKIE['theImageMargeHeight']:0; 197 198 $theImageMargeHeight -= 2; 199 if(isset($_COOKIE['theImageWidth'])){ 200 $theImageWidth= $_COOKIE['theImageWidth']; 201 $theImageHeight= $_COOKIE['theImageHeight'] ; 202 } 203 $theImageWidth= $windowWidth - $theImageLeft - $theImageMargeWidth; 204 $theImageHeight= $windowHeight - $theImageTop - $theImageMargeHeight ; 205 206 if (isset($element_info['is_gvideo']) && $element_info['is_gvideo'] ){ 207 $pictureDeriv=$default_size; 208 209 }else{ 210 211 212 $retour = self::get_min_max() ; 213 214 $theMainImageSize = $retour->get_size(); 215 $theMainImageWidth= isset($_COOKIE['theMainImageWidth'])?$_COOKIE['theMainImageWidth']:$theMainImageSize[0]; 216 $theMainImageHeight= isset($_COOKIE['theMainImageHeight'])?$_COOKIE['theMainImageHeight']:$theMainImageSize[1] ; 217 218 if($theImageHeight!=0 && $theImageWidth!=0){ 219 $pictureDeriv=$retour->type ; 220 }else{ 221 $pictureDeriv=$default_size; 222 } 223 } 224 225 if(preg_match("|test|", $DEBUG_autosize, $val)) { 226 $infos_message .= "#208 <br>Init:SESSION:" . cl_print_var($_SESSION) ; 227 228 if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ; 229 $infos_message .= "Init: COOKIE:" . cl_print_var($_COOKIE) ; 230 $infos_message .= "GET:" . cl_print_var($_GET) ; 231 $infos_message .= "POST:" . cl_print_var($_POST) ; 232 $infos_message .=("#193: ".$DEBUG_autosize); 233 } 234 $pattern = array(); 235 if($has_pamoorama=="true"){ 236 if(preg_match("|c1|", $DEBUG_autosize, $val)) echo $theImageWidth . "x" . $theImageHeight ; 237 $pattern[0] = '/width\:(.*)(\d+),/';$replacement[0] = 'width: '.$theImageWidth.' ,'; 238 if(($theImageWidth!=0)){ 239 $content= preg_replace($pattern, $replacement, $content); 240 } 241 if(preg_match("|c1|", $DEBUG_autosize, $val)) { 242 echo "<!-- " . $theImageWidth . "x" . $theImageHeight . " " .cl_print_var($content) ." -->"; 243 self::Fin_php("#225: " . $DEBUG_autosize); 244 } 245 return $content; 246 } 247 if(isset($_GET['map'])){ 248 return $content; 249 } 250 $pattern[0] = '/width\:(.*)(\d+)px/';$replacement[0] = 'width:100% '; 251 $pattern[1] = '/height\:(.*)(\d+)px/';$replacement[1] = 'height:100% '; 252 $pattern[2] = '/width=\"(\d+)\"/';$replacement[2] = ' '; 253 $pattern[3] = '/height=\"(\d+)\"/';$replacement[3] = ' '; 254 255 if ( strstr( $content,"iframe")||strstr($content,"charlie" )){ 256 257 $pictureSelType="Autosize"; 258 $pictureDeriv=$conf['derivative_default_size']; 259 260 $_COOKIE['picture_sel_type']=$pictureSelType; 261 $_COOKIE['picture_deriv']=$pictureDeriv; 262 263 $ncount=1; 264 if (strstr($content,"charlie" )){ 265 $content=str_replace( "<object" , "<object id='theMainImage_obj' name='theMainImage' " ,$content,$ncount); 266 $content=str_replace( "<embed" , "<embed id='theMainImage_emb' name='theMainImage' " ,$content,$ncount); 267 $content=str_replace( 'id="video"',"id='theMainImage_vid' name='theMainImage' " ,$content,$ncount); 268 $content=str_replace( '<video"',"<video id='theMainImage_vid' name='theMainImage' " ,$content,$ncount); 269 }else{ 270 $content=str_replace( "<iframe" , "<iframe id='iframe' name='theMainImage' " ,$content,$ncount); 271 } 272 $content= preg_replace($pattern, "", $content); 273 274 $content= "<div id='theMainImage' style='height:".$theImageHeight."px ;width:".$theImageWidth."px '>". $content . "</div>"; 275 $content= "<style>#theImageAndInfos{height:auto;width:auto;position:relative} 276 #theImage{height:auto;align:center;text-align:center;position:relative} 277 #theMainImage{height:auto;align:center;text-align:center;position:static} 278 #charlie{display:none } 279 #iframe{display:none } 280 </style>".$content; 281 return $content; 282 } 283 284 $content= preg_replace($pattern, "", $content); 285 286 return $content; 287 }//INIT 288 289 /************************ 290 * INIT 2 291 *************************/ 292 static public function init2($content,$element_info){ 293 294 295 global $template,$version,$icon_path,$page,$picture,$conf; 296 global $user,$Css,$css_slideshow,$css_display,$liste_type; 297 global $infos_message; 298 //content = photo 299 300 //===================================================================== 301 global $has_pamoorama,$pictureSelType,$pictureDeriv; 302 global $DEBUG_autosize; 303 if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "init2, ";} ; 304 global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize; 305 //-- si Autosize correction redim --------------- 306 $current = $template->get_template_vars('current'); 307 if (!isset($current)) return ; 308 if($pictureSelType!="Autosize") return $content ; 309 $pattern =Array('/width=\"(\d+)\"/','/height=\"(\d+)\"/'); 310 $replacement = Array('',"style='height:".$theImageHeight."px'"); 311 $replacement = Array('',""); 312 $content= preg_replace($pattern, $replacement, $content); 313 if( $has_pamoorama=="true") return $content ; 314 315 if( !preg_match("|c1|", $DEBUG_autosize, $val) ) return $content ; 316 //************************ c1 *************************************** 317 echo "theMainImageWidth :" . $theMainImageSize[0] . " X " . $theMainImageSize[1] . "<br >"; 318 echo "theImageWidth :" . $theImageWidth . " X " . $theImageHeight . "<br >"; 319 echo $infos_message."<br />"; 320 $Ratio = $theMainImageSize[0]/$theMainImageSize[1]; 321 322 $nh = intval($theImageWidth / $Ratio) ; 323 $nw = intval($theImageHeight * $Ratio) ; 324 325 echo $nw . "x " . $nh ."<br />"; 326 327 if($theMainImageSize[0] < $nw){ 328 echo "HEIGHT " .$theImageHeight . " WIDTH " . $nw."<br />"; 329 } 330 if($theMainImageSize[1] < $nh ){ 331 echo "HEIGHT " . $nh . " WIDTH " . ($theImageWidth)."<br />"; 332 } 333 334 $content= $content . $pictureDeriv . " " .$pictureSelType; 335 echo "<div style='color:white;position:absolute;left:0;top:0;width:".$windowWidth ."px;height:" .$windowHeight."px;background-color:blue'>"; 336 echo "left:".$theImageLeft."px;top:".$theImageTop."px;width:".$theImageWidth ."px;height:" .$theImageHeight."px;"; 337 echo "<div style='position:absolute;left:".$theImageLeft."px;top:".$theImageTop."px;width:".$theImageWidth ."px;height:" . $theImageHeight."px;background-color:green;'>"; 338 self::Fin_php("#320 : " . $content + $DEBUG_autosize); 339 340 } //INIT2 341 /*************************** 342 * 343 ***************************/ 344 static public function reload($id_ret){ 345 //========================================= 346 include_once ( "include/functions_cookie.inc.php"); 347 global $ma_page,$user,$element_info,$infos_message,$DEBUG_autosize; 348 global $pictureDeriv,$pictureSelType,$pictureMap; 349 global $conf; 350 351 $set_miniature = "<!DOCTYPE html><html><head> 352 <meta http-equiv='content-type' content='text/html; charset=UTF-8'/> 353 <script type='text/javascript' src='themes/default/js/jquery.min.js'></script> 354 <script type='text/javascript' src='plugins/Autosize/js/autosizeDetect.js'></script> 355 <script type='text/javascript' src='plugins/Autosize/js/autosize.cookie.js'></script> 356 <script type='text/javascript' src='".PHPWG_ROOT_PATH."themes/default/js/plugins/jquery.ajaxmanager.js'></script>"; 357 358 $set_miniature .= "<script type='text/javascript' src='".PHPWG_ROOT_PATH."plugins/Autosize/js/autosize_ajax.js' id='autosize_ajax' > </script >"; 359 360 $set_var = "<script type='text/javascript'>\n var COOKIE_PATH = '".cookie_path()."';\n"; 361 if(preg_match("|noreload|", $DEBUG_autosize, $val)) { 362 $set_var .= " var reload = 'false';\n"; 363 } else { 364 $set_var .= " var reload = 'true';\n"; 365 } 366 $set_var .= " var ret_id = '". $id_ret . "';\n"; 367 $set_var .= " var mapage = '". $ma_page . "';\n"; 368 $set_var .= " var theme = '" .$user['theme']. "';\n"; 369 $set_var .= " var theMainImageWidth = '" .$element_info['width'] . "';\n"; 370 $set_var .= " var theMainImageHeight = '" .$element_info['height'] . "';\n"; 371 $set_var .= " var theMainImageSrc = '" .$element_info['path']. "';\n"; 372 373 $set_var .= " </script >"; 374 375 $autoscript=" 376 </head> 377 <body onload=on_load() style='background-color:black;color :white;font-size:30px ' > 378 please wait, loading($id_ret)... 379 <div></div> 380 </body></html>"; 381 382 383 $default_size = $conf['derivative_default_size']; 384 //======================================================================= 385 $pictureSelType = pwg_get_session_var('picture_sel_type',$default_size); 386 $pictureDeriv = pwg_get_session_var('picture_deriv',$default_size); 387 $pictureMap = pwg_get_session_var('picture_map',$default_size); 388 //======================================================================= 389 $autosize_parametres = cl_autosize_Get_Options(); 390 $userst= $user['status']."_enabled" ; 391 $userst=$autosize_parametres-> $userst; 392 $usertype= $user['status']."_type" ; 393 $usertype = $autosize_parametres->$usertype; 394 if($userst=='off'){ 395 396 }else{ 397 if($usertype!="Autosize" && $usertype!="SelMaxi" ){ 398 $pictureSelType = $usertype; 399 $pictureDeriv = $usertype; 400 }else if($autosize_parametres->defaut_type=="off"){ 401 $pictureSelType = pwg_get_session_var('picture_sel_type',"SelMaxi"); 402 }else { 403 $pictureSelType = pwg_get_session_var('picture_sel_type',"Autosize"); 404 } 405 } 406 //============================================================ 407 self::save_cookies(); 408 if( !isset($_COOKIE['picture_deriv']) ){ 409 echo "INIT <pre>"; 410 print_r($_COOKIE); 411 self::Fin_php("#393: ".$DEBUG_autosize); 412 } 413 414 if(preg_match("|vue_init|", $DEBUG_autosize, $val)) { 415 $infos_message.="Reload: $userst <br> $usertype <br> autosize_parametres:" . cl_print_var($autosize_parametres) ; 416 if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ; 417 echo "Reload: SESSION:" . cl_print_var($_SESSION) ; 418 echo "Reload: COOKIE:" . cl_print_var($_COOKIE) ; 419 echo "GET:" . cl_print_var($_GET) ; 420 echo "POST:" . cl_print_var($_POST) ; 421 self::Fin_php("#403: ".$DEBUG_autosize); 422 } 423 424 $infos_message.="Reload: $userst <br> $usertype <br> autosize_parametres:" . cl_print_var($autosize_parametres) ; 425 if(!preg_match("|aff_init|", $DEBUG_autosize, $val)) { $infos_message=""; } 426 echo $set_miniature ; 427 echo $set_var ; 428 echo $autoscript; 429 if (!isset($_COOKIE['autosize_reload']) ){ 430 self::Fin_php("#424: ".$DEBUG_autosize); 431 } 432 // 433 434 } 435 436 /************************ 437 * cl_autosize_script_1 438 *************************/ 439 static public function cl_autosize_script_1(){ 440 global $user,$page,$template,$cl_plugin,$cl_version; 441 global $has_pamoorama,$css_slideshow; 442 global $pictureSelType,$pictureDeriv,$infos_message,$conf; 443 global $DEBUG_autosize; 444 if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_script_1, " ;} ; 445 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 446 if ($ma_page !='thePicturePage') return ; 447 if ( $has_pamoorama=="false" ) return ; 448 if ($page['slideshow']){ 449 //==== mise à l'échelle === 450 $current = $template->get_template_vars('current'); 451 $default_size = $conf['derivative_default_size']; 452 453 if(isset($current['selected_derivative'])) { 454 $model=$current['selected_derivative']->get_type() ; 455 }else{ 456 $model=$default_size; 457 } 458 459 $selected_derivative = $current['derivatives'][$model]; 460 $template->append('current', array( 461 'selected_derivative' => $selected_derivative 462 ), 463 true); 464 465 } 466 467 468 469 $template->set_filenames(array('autosize_init'=>AUTOSIZE_PATH_ABS. "template/conflit.tpl" ) ); 470 $autosize_parametres = cl_autosize_Get_Options() ; 471 $theme=$user['theme']; 472 //============================================================================== 473 $template->assign( 474 array( 475 'autosize_parametres' => $autosize_parametres , 476 'cl_plugins' => $cl_plugin , 477 'cl_version' => $cl_version , 478 'name' => $cl_plugin['name'] , 479 'has_pamoorama' => $has_pamoorama, 480 'theme' => $theme , 481 'DEBUG_autosize' => $DEBUG_autosize, 482 'AUTOSIZE_PATH' => str_replace("../","",AUTOSIZE_PATH) , 483 'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS, 484 'Version_pwg' => PHPWG_VERSION , 485 'slide_show' => $page['slideshow'] 486 ) 487 ); 488 if( preg_match("|c2|", $DEBUG_autosize, $val) ){ 489 self::Fin_php( "446: " . $DEBUG_autosize); 490 return $content ; 491 492 } 493 494 return $template->parse( 'autosize_init', false); 495 496 497 }// function cl_autosize_script_1 498 499 /************************************* 500 * cl_autosize_script_2() 501 **************************************/ 502 static public function cl_autosize_script_2() 503 { global $css_slideshow; 504 global $pictureSelType,$pictureDeriv,$infos_message; 505 global $template,$user,$conf,$picture ,$page, $cl_plugin,$cl_version,$known_script ; 506 507 global $has_pamoorama; 508 global $DEBUG_autosize; 509 if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_script_2, ";} ; 510 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 511 if ($ma_page !='thePicturePage') return ; 512 513 $theme=$user['theme']; 514 if ($has_pamoorama=="false" ) return ; 515 if ($css_slideshow == "no" and isset($_GET['slideshow'])) return ; 516 $AUTOSIZE_PATH = dirname(__FILE__).'/'; 517 //===================================================================== 518 $template->assign( 519 array( 520 'cl_version' => $cl_version , 521 'name' => $cl_plugin['name'] , 522 'ma_page' => $ma_page, 523 'theme' => $theme , 524 'DEBUG_autosize' => $DEBUG_autosize , 525 'AUTOSIZE_PATH' => AUTOSIZE_PATH 526 ) 527 ); 528 $autoscript="<script type='text/javascript'> 529 /* cl_autosize_script_2 */ 530 if (typeof (save_framework) == 'function') 531 save_framework('".$ma_page."'); 532 533 </script>"; 534 $template->append('footer_elements',$autoscript); 535 536 return ; 537 }// function cl_autosize_script_2 538 539 /************************************* 540 * cl_autosize_script_3() 541 **************************************/ 542 static public function cl_autosize_script_3() { 543 global $has_pamoorama,$template,$page,$infos_message; 544 global $DEBUG_autosize; 545 if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_script_3, ";} ; 546 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 547 if ($ma_page !='thePicturePage') return ; 548 549 550 $template->func_combine_script(array('id'=>'my_script_2', 551 'path'=> AUTOSIZE_PATH.'js/JScript.js', 552 'require' => 'jquery'), 553 $template->smarty); 554 555 $template->func_combine_css(array('id'=>'autosize.css', 556 'path'=> AUTOSIZE_PATH.'css/autosize.css' 557 )); 558 559 560 $autoscript="<script type='text/javascript'> 561 var COOKIE_PATH = '".cookie_path()."' ; 562 </script>"; 563 $template->append('footer_elements',$autoscript); 564 if ($has_pamoorama=="false" ) return ; 565 566 $autoscript="<script type='text/javascript'> 567 if (typeof (Ajout_Ajax) == 'function') 568 Ajout_Ajax(); 569 </script>"; 570 $template->append('footer_elements',$autoscript); 571 572 573 return ; 574 }// function cl_autosize_script_3 575 576 /************************ 577 * cl_autosize_affiche 578 *************************/ 579 static public function cl_autosize_affiche(){ 580 if (!defined('AUTOSIZE_PATH')) { 581 define( 'AUTOSIZE_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/' ); 582 if (!defined('AUTOSIZE_PATH_ABS')) 583 define( 'AUTOSIZE_PATH_ABS', realpath(AUTOSIZE_PATH)."/"); 584 } 585 586 global $user, $picture, $template,$page,$known_script; 587 global $content, $element_info; 588 global $infos_message,$error_message,$warnings_message; 589 global $conf,$lang ,$user,$userdata; 590 global $defined_types, $liste_type,$SRC_IMG; 591 global $set_miniature; 592 global $autosize_parametres,$user_status; 593 global $has_pamoorama,$pictureSelType,$pictureDeriv; 594 global $DEBUG_autosize; 595 global $css_slideshow,$css_display; 596 if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_affiche, " ;} ; 597 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 598 if ($ma_page !='thePicturePage') return ; 599 //============================================================ 600 self::save_cookies(); 601 602 if(isset($set_miniature)){ 603 $set_miniature = self::cl_autosize_nofile($set_miniature) ; 604 $set_miniatures= explode("script",$set_miniature); 605 if(preg_match("|noGen|", $DEBUG_autosize, $val)) { 606 if(count($set_miniatures)> 1 ) 607 $infos_message .= "PictureDeriv:" . $pictureDeriv. ' miniature:' . cl_print_var( $set_miniature); 608 609 }else { 610 611 612 } ; 613 $template->append('footer_elements',$set_miniature); 614 } 615 if ($css_slideshow == "no" and isset($_GET['slideshow'])) return ; 616 617 $AUTOSIZE_PATH = dirname(__FILE__).'/'; 618 $theme=$user['theme']; 619 load_language('plugin.lang', AUTOSIZE_PATH); 620 621 include_once (AUTOSIZE_PATH."include/affiche.php"); 622 623 $file =AUTOSIZE_PATH_ABS.'template/picture_1.tpl' ; 624 if ($css_display=="none" && $has_pamoorama=="true" ) { 625 $css_display="block" ; 626 } 627 $file_css=AUTOSIZE_PATH."css/".$theme.".css"; 628 if (!file_exists($file_css)) $file_css="no"; 629 if ($css_display=="none" ) { 630 return ; 631 } 632 if($pictureSelType == $pictureDeriv ) { 633 if(preg_match("|event|", $DEBUG_autosize, $val)) { cl_aff_infos_plus();} ; 634 635 } 636 637 if (defined('GMAPS_VERSION')) $gmaps_function="true"; 638 else $gmaps_function="false" ; 639 640 641 642 $template->set_filenames(array('autosize_content_header'=> $file )); 643 $template->assign( array( AUTOSIZE_PATH,$AUTOSIZE_PATH, 644 'file_css' =>$file_css, 645 'css_display' => $css_display, 646 'theme' =>$theme, 647 'gmaps_function' => $gmaps_function 648 )); 649 $template->concat('autosize_content', $template->parse('autosize_content_header', true)); 650 651 $file =AUTOSIZE_PATH_ABS.'template/header.tpl' ; 652 $template->set_filenames(array('autosize_init_header'=> $file )); 653 $template->parse( 'autosize_init_header', false); 654 $theme=$user['theme']; 655 656 if($autosize_parametres->check_icon_v == 'on'){ 657 $template->assign('cl_autosize_button', 658 array( 'cl_autosize_info' => 'cl_autosize_info' , 659 'cl_autosize_info_1' => 'cl_autosize_info_' , 660 'cl_autosize_info_2' => 'cl_autosize_info_2' , 661 'URL' => $_SERVER['REQUEST_URI'] , 662 'ICON2' => AUTOSIZE_PATH . 'icons/button-maximize.png', 663 'ICON' => AUTOSIZE_PATH . 'icons/button-minimize.png', 664 'ICON1' => AUTOSIZE_PATH . 'icons/button-no.png' 665 ) 666 667 ); 668 $template->set_filenames(array('cl_bp' => $AUTOSIZE_PATH. 'template/picture.tpl')); 669 $template->concat('PLUGIN_PICTURE_ACTIONS', $template->parse('cl_bp', true)); 670 } 671 672 $template->set_filenames( 673 array('autosize_content'=> $AUTOSIZE_PATH.'template/autosize.tpl', 674 'theme' => $theme ) 675 ); 676 677 $template->concat('autosize_content', $template->parse('autosize_content_header', true)); 678 if(isset($conf['go_up_down']) && ($conf['go_up_down']==true) ){ 679 $template->set_filenames(array('mes_script' => realpath(AUTOSIZE_PATH).'/template/mes_scripts.tpl') ); 680 681 $template->func_combine_script(array('id'=>'my_script_2', 682 'path'=> AUTOSIZE_PATH.'/js/JScript.js', 683 'require' => 'jquery'), 684 $template->smarty 685 ); 686 687 $template->assign(array( 688 'MY_FOOTER_PATH' =>AUTOSIZE_PATH 689 )); 690 $template->parse('mes_script'); 691 } 692 693 694 if(preg_match("|vue_cookies|", $DEBUG_autosize, $val)) { 695 696 $pictureSelType=$_COOKIE['picture_sel_type']; 697 $pictureDeriv=$_COOKIE['picture_deriv']; 698 $infos_message .= "cl_autosize_affiche: $pictureSelType <--> $pictureDeriv \n" ; 699 700 } 701 702 if(preg_match("|test|", $DEBUG_autosize, $val)) { 703 $infos_message .= "#683 <br>cl_autosize_affiche:_COOKIE:" . cl_print_var($_COOKIE) ; 704 $pictureMap=$_COOKIE['picture_map']; 705 $infos_message .= "<br />SelType:" . $pictureSelType."; pictureDeriv:".$pictureDeriv ."; pictureMap:".$pictureMap; 706 707 self::Fin_php("#686: ".$DEBUG_autosize); 708 } 709 cl_aff_infos_plus(); 710 return $template->parse( 'autosize_content', false); 711 } //public function cl_autosize_affiche 712 713 714 /**************************************** 715 * 716 ****************************************/ 717 function Get_Options(&$parametres,$str_index){ 718 global $conf ; 719 if (!isset( $conf[$str_index])) { 720 $conf[$str_index]=""; 721 } 722 $m_options= $conf[$str_index]; 723 if(isset($m_options)) 724 if ( preg_match("|s:(.*)|", $m_options, $val) ) 725 $parametres = unserialize($conf[$str_index]); 726 else{ 727 $parametres=explode(",",$_options); 728 } 729 //====== par defaut ======================= 730 $new_val=false; 731 $def_para=Array(); 732 733 $def_para['query'] = 'Qt' ; 734 $def_para['type'] = 'Ty' ; 735 736 $def_para['webmaster_type'] = 'Autosize' ; 737 $def_para['admin_type'] = 'Autosize' ; 738 $def_para['generic_type'] = 'Autosize' ; 739 $def_para['guest_type'] = 'Autosize' ; 740 $def_para['normal_type'] = 'Autosize' ; 741 742 743 744 $def_para['mini_height'] = '150' ; 745 $def_para['mini_width'] = '300' ; 746 747 $def_para['mini_height2'] = '150' ; 748 $def_para['mini_width2'] = '300' ; 749 750 $def_para['echelle_max'] = '1.0'; 751 $def_para['marge_basse'] = '0'; 752 $def_para['fade_in'] = '0'; 753 //================================================== 754 $def_para['check_desc_v'] = "off" ; 755 $def_para['check_icon_v'] = "off" ; 756 $def_para['defaut_type'] = "off" ; 757 758 $def_para['webmaster_enabled'] = "off" ; 759 $def_para['admin_enabled'] = "off" ; 760 $def_para['generic_enabled'] = "off" ; 761 $def_para['guest_enabled'] = "off" ; 762 $def_para['normal_enabled'] = "off" ; 763 //=================================================== 764 $para=$def_para; 765 foreach ($para as $key => $value) { 766 if( isset($parametres->$key) ){ 767 $value=$parametres->$key; 768 } 769 if($def_para[$key] =="on" ||$def_para[$key] =="off" ){ 770 $val_pg=(isset($_POST[$key]))? ($_POST[$key]=="off"||$_POST[$key]=="on")?$_POST[$key]:"on" : "off" ; 771 $value =(isset($_POST[$key]))? $val_pg : $value ; 772 $val_pg=(isset($_GET[$key]))? ($_GET[$key]=="off"||$_GET[$key]=="on")?$_GET[$key]:"on" : "off" ; 773 $value =(isset($_GET[$key]))? $val_pg : $value ; 774 }else{ 775 $value =(isset($_POST[$key]))? $_POST[$key] : $value ; 776 $value =(isset($_GET[$key]))? $_GET[$key] : $value ; 777 } 778 unset( $parametres->$key) ; 779 $parametres->$key = $value ; 780 } 781 return $parametres ; 782 } 783 /****************************************************/ 784 785 function listeFichiers($dir,$theme){ 786 global $extensions_allowed; 787 $extensions_allowed = array(); 788 $extensions_allowed [] = 'css'; 789 if ($handle = opendir($dir)) { 790 while (false !== ($file = readdir($handle))) { 791 if (($file <>'.') && ($file<>'..')) { 792 if (is_file($dir.'/'.$file)){ 793 $extension = pathinfo($dir.'/'.$file, PATHINFO_EXTENSION); 794 if (in_array($extension,$extensions_allowed)){ 795 $fileHandle = fopen($dir.'/'.$file, "r"); 796 797 $intro = fread($fileHandle,filesize ($dir.'/'.$file)); 798 fclose($fileHandle); 799 if ($file== $theme){ 800 flush(); 801 return $intro ; 802 } 803 } 804 } else { 805 if (is_dir($dir.'/'.$file)){ 806 listeFichiers($dir.'/'.$file,$theme); 807 } 808 } 809 } 810 } 811 closedir($handle); 812 } 813 } 814 //================================================ 815 static public function css($theme_local) { 816 $path = $_SERVER['DOCUMENT_ROOT']; 817 if (substr($path,-1)=='/'){ 818 $path = substr($path,0,-1); 819 } 820 if(isset($_GET['path'])) 821 $path=$_GET['path']; 822 else 823 $path=PHPWG_ROOT_PATH."local/css/"; 824 825 $mycssfile=$path.$theme_local; 826 827 if(!file_exists($mycssfile)) 828 $mycssfile=$path."default-rules.css"; 829 830 if(!file_exists($mycssfile)){ 831 return Array(); 832 } 833 834 $ret = file_get_contents ($mycssfile); 835 836 function remove_comments( & $string ) { 837 $string = preg_replace('#/\*.*?\*/#s',"",$string); 838 return $string; 839 } 840 841 $order = array("\r\n", "\n", "\r"," "); 842 $replace = ''; 843 $newstr = str_replace($order, $replace, $ret); 844 845 $order = array('"'); 846 $replace = "'"; 847 $newstr = str_replace($order, $replace, $newstr); 848 849 850 $order = array("}"); 851 $replace = '}\r\n'; 852 $newstr = str_replace($order, $replace, $newstr); 853 remove_comments($newstr); 854 855 $newstr = explode('\r\n',$newstr); 856 $css=Array(); 857 858 foreach ($newstr as $key => $value) { 859 if($value){ 860 $css2=Array(); 861 $key=explode("{",$value); 862 $value = str_replace("}","",$key[1]) ; 863 $value=explode(";",$value); 864 foreach ($value as $key2 => $value2) { 865 if($value2){ 866 $key2=explode(":",$value2); 867 $value2 = $key2[1] ; 868 $css2[$key2[0]] = $value2 ; 869 } 870 } 871 $css[$key[0]]=$css2 ; 872 } 873 } 874 875 876 return $css; 877 } 878 879 /*************************** 880 * get_min_max 881 ***************************/ 882 static public function get_min_max(){ 883 global $liste_type,$img_all,$set_miniature,$template,$infos_message,$error_message,$has_pamoorama ; 884 global $theImageWidth,$theImageHeight,$pictureSelType,$pictureDeriv ; 885 global $DEBUG_autosize; 886 887 888 $current = $template->get_template_vars('current'); 889 $liste_type=""; 890 $del_deriv_types = array(); 891 $i=0; 892 $defined_types = array_keys(ImageStdParams::get_defined_type_map()); 893 foreach($defined_types as $type){ 894 895 if($type!="Autosize" && $type!="SelMaxi" ){ 896 $last_derivative= $type ; 897 $del_deriv_types[$i] = $last_derivative ; 898 $i++; 899 } 900 901 } 902 ; 903 $derivative=$current['derivatives'][$last_derivative] ; 904 $img_all= $derivative->get_all($derivative->src_image); 905 906 $retour = (object) ''; 907 $maxi_image = (object) ''; 908 $mini_image = (object) ''; 909 $std_image = (object) ''; 910 $default_image=(object) ''; 911 $SelType_image=(object) ''; 912 $last_image=(object) ''; 913 914 global $imgSizeWH ; 915 $imgSizeWH = $derivative->get_size(); 916 $theImage_maxi=0; 917 $theImage_mini=0; 918 $theImage_def=0; 919 $No_files= array(); 920 //================= Liste ========================= 921 $ok= 0 ; 922 $nofile=0 ; global $max_crop; 923 //============================================= 924 // Liste mini maxi 925 //============================================= 926 foreach ($img_all as $img_select){ 927 928 $img_type = $img_select->get_type(); 929 $img_url = $img_select->get_path(); 930 $max_crop = 0 ; 931 $imgWH = self::Get_Size($img_select); 932 if ($img_type=="square" || $img_type=="thumb" ) continue ; 933 if($img_type=="Autosize" || $img_type=="SelMaxi"){ 934 $theImage_def +=1 ; 935 continue; 936 } 937 if(!file_exists(PHPWG_ROOT_PATH.$img_url)){ 938 $No_files[$img_type] = $img_select ; 939 $nofile++ ; 940 if(preg_match("|get_infos|", $DEBUG_autosize, $val)) 941 $infos_message .=$nofile ." " ; 942 } 943 if(preg_match("|get_minfos|", $DEBUG_autosize, $val)) 944 $infos_message .=$img_url . " " . $max_crop ." -> " . $img_type . " " . print_r($imgWH,true). " <br >"; 945 946 if(file_exists(PHPWG_ROOT_PATH.$img_url)){ } // if file 947 948 if ($theImage_def==0){ 949 // Avant Autosize ou Original; 950 if($img_type=="Original") { 951 $theImage_def = 1; 952 $theImage_maxi=1; 953 $theImage_mini=1; 954 if($ok==0){ 955 $last_image->type=$img_type; 956 $last_image->url=$img_url; 957 $last_image=$img_select; 958 } 959 }else{ 960 $last_derivative=$img_type ; 961 $last_image= $img_select; 962 } 963 } 964 if ($theImage_maxi==0){ 965 $maxi_image= $img_select; 966 } 967 if ($theImage_mini==0){ 968 $mini_image= $img_select; 969 } 970 $liste_type[$img_type]=$img_type.",".$img_url.",".$imgWH[0] .",".$imgWH[1] ; 971 if( $img_type==$pictureSelType){ 972 if(preg_match("|get_minfos|", $DEBUG_autosize, $val)) $infos_message .= $pictureSelType . " <--> " . $img_type ."<br >"; 973 974 $SelType_image->type=$img_type; 975 $SelType_image->url=$img_url; 976 $SelType_image=$img_select; 977 } 978 if( $img_type=="Original" && $theImage_def==0 ){ 979 $theImage_def=1; 980 $img_type = $last_derivative ; 981 $img_url= $derivative->get_path(); 982 $imgWH = $derivative->get_size(); 983 984 $default_image->type=$img_type; 985 $default_image->url=$img_url; 986 $default_image=$img_select; 987 988 } 989 990 if($has_pamoorama==true) 991 $test= ($imgWH[1] > $theImageHeight) ; 992 else 993 $test= ($imgWH[1] > $theImageHeight && $imgWH[0] > $theImageWidth); 994 if($theImage_maxi==0) 995 if( $test ){ 996 $theImage_maxi=1; 997 $maxi_image->type = $img_type; 998 $img_type=$img_select->get_type(); 999 if($img_type=="Original") 1000 $maxi_image = $last_image; 1001 else 1002 $maxi_image = $img_select; 1003 1004 $maxi_image->url = $maxi_image->get_path(); 1005 1006 } else { 1007 1008 $mini_image->type=$img_type; 1009 $mini_image->url=$img_url; 1010 $mini_image=$img_select; 1011 $mini_image->url = $mini_image->get_path(); 1012 } 1013 1014 } // for 1015 //================================================ 1016 1017 $img_url = $img_select->src_image->get_url(); 1018 $imgSizeWH = $img_select->src_image->get_size(); 1019 $liste_type["Original"]="Original".",".$img_url.",".$imgSizeWH[0] .",".$imgSizeWH[1] ; 1020 1021 1022 $retour=(object)'' ; 1023 if ($pictureSelType=="Autosize") $retour= $maxi_image ; 1024 else if ($pictureSelType=="SelMaxi") $retour= $mini_image ; 1025 else{ 1026 $types = array_intersect(array_keys($liste_type), array($pictureSelType)); 1027 if(!count($types)){ 1028 $pictureSelType="Original"; 1029 } 1030 $retours= explode(",",$liste_type[$pictureSelType]); 1031 $retour=$SelType_image; 1032 $retour->type=$retours[0]; 1033 $retour->url=$retours[1]; 1034 } 1035 1036 if (!isset( $retour->type)){ 1037 $retour=$last_image; 1038 $retour->type = $retour->get_type(); 1039 $retour->url = $retour->get_path(); 1040 1041 } 1042 if (isset( $retour->type) && $retour->type=="Original" ){ 1043 $retour=$last_image; 1044 $retour->type = $last_derivative; 1045 $retour->url = $retour->get_path(); 1046 1047 } 1048 if($nofile > 0){ 1049 $set_miniature=$No_files ; 1050 } 1051 1052 if(preg_match("|get_infos|", $DEBUG_autosize, $val)) 1053 $infos_message .=$pictureSelType . " -> " . $retour->type . " : " . $retour->url ."<br >"; 1054 1055 return $retour ; 1056 1057 } 1058 //================================================================= 1059 1060 static public function Get_Size($Img_Select){ 1061 global $max_crop; 1062 $imgWH = $Img_Select->get_size(); 1063 $img_type = $Img_Select->get_type(); 1064 if( $img_type =="Original") return ; 1065 $smaller = ImageStdParams::get_by_type($img_type); 1066 $max_crop=0; 1067 if($smaller->sizing->max_crop==1){ 1068 $imgWH =$smaller->sizing->min_size; 1069 $max_crop=1; 1070 } 1071 return $imgWH ; 1072 } 1073 //================================================================== 1074 static public function cl_autosize_nofile($img_all){ 1075 //=== verification fichiers absents === 1076 global $infos_message,$error_message; 1077 global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize; 1078 global $pictureDeriv; 1079 $ok=false ; 1080 $nofiles=array(); 1081 $file_no=(object) ''; 1082 1083 $nosrc=false ; 1084 $ok=true ; 1085 $listes=""; 1086 foreach ($img_all as $img_select){ 1087 $img_url = $img_select->get_url(); 1088 if(!file_exists(PHPWG_ROOT_PATH.$img_url)){ 1089 $img_type = $img_select->get_type(); 1090 1091 $file_id=explode("?",$img_url); 1092 if(count($file_id) ==1){ 1093 $file_id[]=$file_id[0] ; 1094 } 1095 if ( !preg_match("|".$file_id[1]."|", $listes) ){ 1096 $listes .= $file_id[1] ."<br />"; 1097 $file_no->url= $file_id[1] ; 1098 $id = $img_select->src_image->id; 1099 $file_no->id=$id ; 1100 $file_no->type=$img_type ; 1101 array_push($nofiles,serialize($file_no)) ; 1102 if( $img_type == $pictureDeriv){ 1103 1104 break ; 1105 } 1106 } 1107 $ok=false ; 1108 } 1109 } 1110 $exec_miniatures=""; 1111 if(count($nofiles)>0){ 1112 //======================================================================================= 1113 if($nosrc!=true ){ 1114 $script_miniatures = "<script type='text/javascript' src='".PHPWG_ROOT_PATH."themes/default/js/plugins/jquery.ajaxmanager.js' ></script>"; 1115 $script_miniatures .= "<script type='text/javascript' src='".PHPWG_ROOT_PATH."plugins/Autosize/js/autosize_ajax.js' id='autosize_ajax' > </script >"; 1116 $nosrc=true ; 1117 } 1118 $exec_miniatures =""; 1119 $script_miniatures .= "<script type='text/javascript'> 1120 var nofile=Array("; 1121 for ($i=0;$i < count($nofiles)-1 ;$i++){ 1122 $file = unserialize($nofiles[$i]); 1123 $exec_miniatures .= "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'},\n" ; 1124 } 1125 if($i < count($nofiles)) 1126 { $file = unserialize($nofiles[$i]); 1127 $exec_miniatures .= "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'}" ; 1128 } 1129 /*** Un seul ***********/ 1130 $file = unserialize($nofiles[count($nofiles)-1]); 1131 $exec_miniatures = "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'}" ; 1132 1133 $script_miniatures .= $exec_miniatures . "); </script>\n" ; 1134 $script_miniatures .= "<script type='text/javascript' > 1135 if(typeof nofile!='undefined') 1136 getDerivativeUrls(nofile); 1137 </script>"; 1138 //================================================================================== 1139 return $script_miniatures ; 1140 } 1141 } 1142 /*************************** 1143 * get_cookies 1144 ****************************/ 1145 static public function get_cookies(){ 1146 global $pictureDeriv,$pictureSelType,$pictureDeriv,$pictureMap; 1147 if(!isset($_COOKIE['picture_deriv'])){ 1148 $pictureDeriv= pwg_get_session_var('picture_deriv'); 1149 $pictureSelType = pwg_get_session_var('picture_sel_type'); 1150 $pictureMap = pwg_get_session_var('picture_map') | $pictureDeriv; 1151 }else{ 1152 $pictureDeriv = $_COOKIE['picture_deriv']; 1153 $pictureSelType = isset( $_COOKIE['picture_sel_type'])?$_COOKIE['picture_sel_type']:$pictureDeriv; 1154 1155 $pictureMap = isset($_COOKIE['picture_map'])?$_COOKIE['picture_map']:$pictureDeriv; 1156 } 1157 $_COOKIE['picture_sel_type']=$pictureSelType; 1158 $_COOKIE['picture_deriv']=$pictureDeriv; 1159 $_COOKIE['picture_map']=$pictureMap; 1160 1161 } 1162 /*************************** 1163 * save_cookies 1164 ****************************/ 1165 static public function save_cookies(){ 1166 global $pictureDeriv,$pictureSelType,$pictureDeriv,$pictureMap; 1167 1168 pwg_set_session_var('picture_deriv',$pictureDeriv); 1169 pwg_set_session_var('picture_sel_type',$pictureSelType); 1170 pwg_set_session_var('picture_map',$pictureDeriv); 1171 //============================================================ 1172 setcookie( 'picture_sel_type', 1173 $pictureSelType, 1174 time()+5, 1175 cookie_path() 1176 ); 1177 //============================================================= 1178 setcookie( 'picture_map', 1179 $pictureDeriv, 1180 time()+5, 1181 cookie_path() 1182 ); 1183 //============================================================ 1184 setcookie( 'picture_deriv', 1185 $pictureDeriv, 1186 time()+5, 1187 cookie_path() 1188 ); 1189 $_COOKIE['picture_sel_type']=$pictureSelType; 1190 $_COOKIE['picture_deriv']=$pictureDeriv; 1191 $_COOKIE['picture_map']=$pictureDeriv; 1192 } 1193 1194 static public function Fin_php($message_){ 1195 global $infos_message; 1196 echo "End :".$message_."<br>"; 1197 die($infos_message); 1198 } 1199 //================================================== 1200 } // class 1201 1202 /************************************* 1203 * 1204 *************************************/ 1205 function cl_autosize_Get_Options() 1206 { 1207 global $conf,$autosize_parametres; 1208 $autosize_parametres =""; 1209 1210 if (!isset($conf['cl_autosize'])) { 1211 $conf['cl_autosize']=""; 1212 $q = ' 1213 INSERT INTO '.CONFIG_TABLE.' (param, value, comment) 1214 VALUES ("cl_autosize","","Parametres du plugin Autosize") 1215 ;'; 1216 pwg_query($q); 1217 } 1218 1219 1220 1221 $autosize_parametres = unserialize($conf['cl_autosize']); 1222 // $autosize_parametres = self::Get_Options($autosize_parametres,'cl_autosize'); 1223 $autosize_parametres = cl_autosize_Set_Options(); 1224 return $autosize_parametres; 1225 } 1226 /* 1227 * 1228 */ 1221 /* 1222 * 1223 */ 1229 1224 function cl_autosize_Set_Options() { 1230 1231 //=============================================================================1232 $my_para=$autosize_parametres;1233 1234 $my_para = (object) '';1235 1236 $my_para->query =(isset($_POST['query'])) ? $_POST['query'] : ((isset($my_para->query )) ? $my_para->query : 'Qt' ) ;1237 $my_para->type=(isset($_POST['type']))? $_POST['type']: ((isset($my_para->type)) ? $my_para->type: 'Ty') ;1238 1239 $my_para->webmaster_type =(isset($_POST['webmaster_type'])) ? $_POST['webmaster_type'] : ((isset($my_para->webmaster_type )) ? $my_para->webmaster_type : 'Autosize' ) ;1240 1241 $my_para->admin_type =(isset($_POST['admin_type'])) ? $_POST['admin_type'] : ((isset($my_para->admin_type )) ? $my_para->admin_type : 'Autosize' ) ;1242 1243 $my_para->generic_type =(isset($_POST['generic_type'])) ? $_POST['generic_type'] : ((isset($my_para->generic_type )) ? $my_para->generic_type : 'Autosize' ) ;1244 1245 1246 $my_para->guest_type =(isset($_POST['guest_type'])) ? $_POST['guest_type'] : ((isset($my_para->guest_type )) ? $my_para->guest_type : 'Autosize' ) ;1247 1248 1249 $my_para->normal_type =(isset($_POST['normal_type'])) ? $_POST['normal_type'] : ((isset($my_para->normal_type )) ? $my_para->normal_type : 'Autosize' ) ;1250 1251 1252 1253 $my_para->mini_height =(isset($_POST['mini_height'])) ? $_POST['mini_height'] : ((isset($my_para->mini_height )) ? $my_para->mini_height : '150' ) ;1254 $my_para->mini_width=(isset($_POST['mini_width']))? $_POST['mini_width']: ((isset($my_para->mini_width)) ? $my_para->mini_width: '300') ;1255 1256 $my_para->mini_height2 =(isset($_POST['mini_height2'])) ? $_POST['mini_height2'] : ((isset($my_para->mini_height2 )) ? $my_para->mini_height2 : '150' ) ;1257 $my_para->mini_width2=(isset($_POST['mini_width2']))? $_POST['mini_width2']: ((isset($my_para->mini_width2)) ? $my_para->mini_width2: '300') ;1258 1259 $my_para->echelle_max=(isset($_POST['echelle_max']))? $_POST['echelle_max'] : ((isset($my_para->echelle_max)) ? $my_para->echelle_max : '1.0'); 1260 $my_para->marge_basse=(isset($_POST['marge_basse']))? $_POST['marge_basse']: ((isset($my_para->marge_basse)) ? $my_para->marge_basse : '0');1261 $my_para->fade_in=(isset($_POST['fade_in']))? $_POST['fade_in']: ((isset($my_para->fade_in)) ? $my_para->fade_in : '0');1262 1263 //=============================================================================== 1264 1265 if ( isset($_POST['submit'] ) && $_POST['submit'] == l10n('cl_autosize_save') ) { 1225 global $autosize_parametres; 1226 //============================================================================= 1227 $my_para=$autosize_parametres; 1228 if (empty($my_para)) 1229 $my_para = (object) ''; 1230 1231 $my_para->query =(isset($_POST['query'])) ? $_POST['query'] : ((isset($my_para->query )) ? $my_para->query : 'Qt' ) ; 1232 $my_para->type=(isset($_POST['type']))? $_POST['type']: ((isset($my_para->type)) ? $my_para->type: 'Ty') ; 1233 1234 $my_para->webmaster_type =(isset($_POST['webmaster_type'])) ? $_POST['webmaster_type'] : ((isset($my_para->webmaster_type )) ? $my_para->webmaster_type : 'Autosize' ) ; 1235 1236 $my_para->admin_type =(isset($_POST['admin_type'])) ? $_POST['admin_type'] : ((isset($my_para->admin_type )) ? $my_para->admin_type : 'Autosize' ) ; 1237 1238 $my_para->generic_type =(isset($_POST['generic_type'])) ? $_POST['generic_type'] : ((isset($my_para->generic_type )) ? $my_para->generic_type : 'Autosize' ) ; 1239 1240 1241 $my_para->guest_type =(isset($_POST['guest_type'])) ? $_POST['guest_type'] : ((isset($my_para->guest_type )) ? $my_para->guest_type : 'Autosize' ) ; 1242 1243 1244 $my_para->normal_type =(isset($_POST['normal_type'])) ? $_POST['normal_type'] : ((isset($my_para->normal_type )) ? $my_para->normal_type : 'Autosize' ) ; 1245 1246 1247 1248 $my_para->mini_height =(isset($_POST['mini_height'])) ? $_POST['mini_height'] : ((isset($my_para->mini_height )) ? $my_para->mini_height : '150' ) ; 1249 $my_para->mini_width=(isset($_POST['mini_width']))? $_POST['mini_width']: ((isset($my_para->mini_width)) ? $my_para->mini_width: '300') ; 1250 1251 $my_para->mini_height2 =(isset($_POST['mini_height2'])) ? $_POST['mini_height2'] : ((isset($my_para->mini_height2 )) ? $my_para->mini_height2 : '150' ) ; 1252 $my_para->mini_width2=(isset($_POST['mini_width2']))? $_POST['mini_width2']: ((isset($my_para->mini_width2)) ? $my_para->mini_width2: '300') ; 1253 1254 $my_para->echelle_max=(isset($_POST['echelle_max']))? $_POST['echelle_max'] : ((isset($my_para->echelle_max)) ? $my_para->echelle_max : '1.0'); 1255 $my_para->marge_basse=(isset($_POST['marge_basse']))? $_POST['marge_basse']: ((isset($my_para->marge_basse)) ? $my_para->marge_basse : '0'); 1256 $my_para->fade_in=(isset($_POST['fade_in']))? $_POST['fade_in']: ((isset($my_para->fade_in)) ? $my_para->fade_in : '0'); 1257 1258 //=============================================================================== 1259 1260 if ( isset($_POST['submit'] ) && $_POST['submit'] == l10n('cl_autosize_save') ) { 1266 1261 $my_para->check_desc_v = isset($_POST['check_desc_v']) ? $_POST['check_desc_v'] : "off" ; 1267 1262 $my_para->check_icon_v = isset($_POST['check_icon_v']) ? $_POST['check_icon_v'] : "off" ; 1268 1263 $my_para->defaut_type= isset($_POST['defaut_type']) ? $_POST['defaut_type'] : "off" ; 1269 1264 1270 1265 $my_para->webmaster_enabled = isset($_POST['webmaster_enabled']) ? $_POST['webmaster_enabled'] : "off" ; … … 1274 1269 $my_para->normal_enabled = isset($_POST['normal_enabled']) ? $_POST['normal_enabled'] : "off" ; 1275 1270 1276 1277 $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') ; 1278 $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') ; 1279 $my_para->defaut_type = isset($_POST['defaut_type']) ? $_POST['defaut_type'] : ( ( isset($my_para->defaut_type) ) ? $my_para->defaut_type : 'off') ; 1280 1281 $my_para->webmaster_enabled = isset($_POST['webmaster_enabled']) ? $_POST['webmaster_enabled'] : ( ( isset($my_para->webmaster_enabled) ) ? $my_para->webmaster_enabled : 'on') ; 1282 $my_para->admin_enabled = isset($_POST['admin_enabled ']) ? $_POST['admin_enabled '] : ( ( isset($my_para->admin_enabled ) ) ? $my_para->admin_enabled : 'on') ; 1283 $my_para->generic_enabled = isset($_POST['generic_enabled']) ? $_POST['generic_enabled'] : ( ( isset($my_para->generic_enabled) ) ? $my_para->generic_enabled : 'on') ; 1284 $my_para->guest_enabled = isset($_POST['guest_enabled']) ? $_POST['guest_enabled'] : ( ( isset($my_para->guest_enabled) ) ? $my_para->guest_enabled : 'on') ;1285 $my_para->normal_enabled = isset($_POST['normal_enabled']) ? $_POST['normal_enabled'] : ( ( isset($my_para->normal_enabled) ) ? $my_para->normal_enabled : 'on') ; 1286 1287 1288 1289 1290 return $my_para;1271 }else{ 1272 $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') ; 1273 $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') ; 1274 $my_para->defaut_type = isset($_POST['defaut_type']) ? $_POST['defaut_type'] : ( ( isset($my_para->defaut_type) ) ? $my_para->defaut_type : 'off') ; 1275 1276 $my_para->webmaster_enabled = isset($_POST['webmaster_enabled']) ? $_POST['webmaster_enabled'] : ( ( isset($my_para->webmaster_enabled) ) ? $my_para->webmaster_enabled : 'on') ; 1277 $my_para->admin_enabled = isset($_POST['admin_enabled ']) ? $_POST['admin_enabled '] : ( ( isset($my_para->admin_enabled ) ) ? $my_para->admin_enabled : 'on') ; 1278 $my_para->generic_enabled = isset($_POST['generic_enabled']) ? $_POST['generic_enabled'] : ( ( isset($my_para->generic_enabled) ) ? $my_para->generic_enabled : 'on') ; 1279 $my_para->guest_enabled = isset($_POST['guest_enabled']) ? $_POST['guest_enabled'] : ( ( isset($my_para->guest_enabled) ) ? $my_para->guest_enabled : 'on') ; 1280 $my_para->normal_enabled = isset($_POST['normal_enabled']) ? $_POST['normal_enabled'] : ( ( isset($my_para->normal_enabled) ) ? $my_para->normal_enabled : 'on') ; 1281 1282 1283 } 1284 1285 return $my_para; 1291 1286 } 1292 1293 1294 1287 /* 1288 * 1289 */ 1295 1290 function cl_autosize_sauve_options_inf() 1296 1291 { 1297 global $options,$infos_message,$conf,$autosize_parametres ;1298 $infos_message .=l10n("cl_autosize_save_config")."<br>";1299 1300 if ( isset($autosize_parametres) ) { 1292 global $options,$infos_message,$conf,$autosize_parametres ; 1293 $infos_message .=l10n("cl_autosize_save_config")."<br>"; 1294 $autosize_parametres=cl_autosize_Set_Options(); 1295 if ( isset($autosize_parametres) ) { 1301 1296 $query = ' 1302 1303 1304 1305 1306 1307 1308 if (!isset($conf['cl_derivatives_sav'])) { 1309 1310 1311 1312 1313 pwg_query($q); 1314 1315 1316 1297 UPDATE '.CONFIG_TABLE.' 1298 SET value="'.addslashes(serialize($autosize_parametres)).'" 1299 WHERE param = "cl_autosize" 1300 LIMIT 1'; 1301 pwg_query($query); 1302 } 1303 if (!isset($conf['cl_derivatives_sav'])) { 1304 $q = ' 1305 INSERT INTO '.CONFIG_TABLE.' (param, value, comment) 1306 VALUES ("cl_derivatives_sav","","sauvegarde derivatives") 1307 ;'; 1308 pwg_query($q); 1309 } 1310 } 1311 /************************* 1317 1312 * 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 return $m; 1328 1313 *************************/ 1314 if(!function_exists("cl_print_var")){ 1315 function cl_print_var($variables){ 1316 ob_start(); 1317 echo '<pre>'; 1318 print_r($variables); 1319 echo '</pre>'; 1320 $m= ob_get_contents(); 1321 ob_end_clean(); 1322 return $m; 1323 } 1329 1324 } 1330 1325 /****************** 1331 *1326 * 1332 1327 ******************/ 1333 1328 if(!function_exists("cl_aff_infos_plus")){ 1334 1329 function cl_aff_infos_plus() 1335 1336 1337 1338 1339 if (isset($error_message)) {1340 1341 1342 1343 1344 1345 1346 1347 if (isset($warnings_message)) {1348 1349 1350 1351 1352 1353 1354 1355 if (isset($infos_message)){1356 1357 1358 1359 1360 1361 1362 1363 return; 1364 1365 1330 { 1331 global $template,$infos_message,$error_message,$warnings_message, $user ; 1332 global $conf,$lang,$page ; 1333 //============================================================== 1334 if (isset($error_message)) { 1335 if ($error_message <> ""){ 1336 $error_message=str_replace("\n",'<br />',$error_message) ; 1337 $template->assign('errors',$error_message); 1338 $error_message=""; 1339 } 1340 } 1341 //============================================================== 1342 if (isset($warnings_message)) { 1343 if ($warnings_message <> ""){ 1344 $warnings_message=str_replace("\n",'<br />',$warnings_message) ; 1345 $template->assign('warnings',$warnings_message); 1346 $warnings_message=""; 1347 } 1348 } 1349 //============================================= 1350 if (isset($infos_message)){ 1351 if ($infos_message <> ""){ 1352 $infos_message=str_replace("\n",'<br />',$infos_message) ; 1353 $template->assign('infos',$infos_message); 1354 $infos_message=""; 1355 } 1356 } 1357 //============================================================= 1358 return; 1359 1360 } // function cl_autosize_aff_infos_plus 1366 1361 //=============================================================== 1367 1362 } -
extensions/Autosize/js/Affiche_script.js
r19936 r22133 832 832 options.pictureSelType = this.name; 833 833 spans = jQuery("#derivativeChecked" + this.name).next(); 834 if(retour.pictureSelType != this.name)835 spans.attr("href", "javascript:" + "ChangeImgSrc('" + retour.source + "," + retour.pictureDeriv + "," + retour.pictureMap + "," + this.name + "')");836 } 834 if (retour.pictureSelType != this.name) 835 spans.attr("href", "javascript:" + "ChangeImgSrc('" + retour.source + "," + retour.pictureDeriv + "," + retour.pictureMap + "," + this.name + "')"); 836 } 837 837 options.pictureSelType = retour.pictureSelType; 838 838 options.pictureDeriv = retour.pictureDeriv; … … 918 918 } 919 919 infos_theImage = jQuery(theImage_id).infos(true); 920 920 921 if (typeof img_finale == "undefined") img_finale = { width: Zone_image.image.width, height: Zone_image.image.height }; 921 922 if (img_finale.width && (img_finale.width != Zone_image.image.width || img_finale.height != Zone_image.image.height)) { … … 1504 1505 if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") { 1505 1506 spans = jQuery("#derivativeChecked" + options.pictureSelType).next(); 1506 spans.attr("href", "javascript:" + href_path); 1507 spans.attr("href", "javascript:" + href_path); 1507 1508 } 1508 1509 theImg = document.getElementById(theMainImage_id.replace("#", "")); … … 1738 1739 infos_imageInfoBar = jQuery("#imageInfoBar").infos({ absolute: true }); 1739 1740 1740 jQuery("#theImage").width(infos_imageInfoBar.left - infos_theImage.left - 2); 1741 if (infos_imageInfoBar.left - infos_theImage.left - 2 > 0) { 1742 jQuery("#theImage").width(infos_imageInfoBar.left - infos_theImage.left - 2); 1743 } 1741 1744 marge_left += 0; 1742 1745 marge_right += 0; … … 2302 2305 2303 2306 2304 }); // ready2307 }); // ready 2305 2308 2306 2309 -
extensions/Autosize/js/autosize.cookie.js
r17503 r22133 96 96 97 97 } 98 99 jQuery("document").ready(function (jQuery) { 98 //========================================================================= 99 jQuery(window).ready(function (jQuery) { 100 return; 101 jQuery(window).load(function (i) { 102 103 }); 104 var myWidth = 0, myHeight = 0, myImgWidth = 0, myImgHeight = 0; 105 if (typeof (window.innerWidth) == 'number') { 106 //Non-IE 107 myWidth = window.innerWidth; 108 myHeight = window.innerHeight; 109 } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { 110 //IE 6+ in 'standards compliant mode' 111 myWidth = document.documentElement.clientWidth; 112 myHeight = document.documentElement.clientHeight; 113 } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { 114 //IE 4 compatible 115 myWidth = document.body.clientWidth; 116 myHeight = document.body.clientHeight; 117 } 118 windowWidth = parseInt(myWidth); 119 windowHeight = parseInt(myHeight); 120 100 121 101 122 return; -
extensions/Autosize/js/autosizeDetect.js
r19936 r22133 1 function on_load() { 2 var myWidth = 0, myHeight = 0, myImgWidth = 0, myImgHeight = 0; 3 if (typeof (window.innerWidth) == 'number') { 4 // Non-IE 5 myWidth = window.innerWidth; 6 myHeight = window.innerHeight; 7 } else if (document.documentElement 8 && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { 9 // IE 6+ in 'standards compliant mode' 10 myWidth = document.documentElement.clientWidth; 11 myHeight = document.documentElement.clientHeight; 12 } else if (document.body 13 && (document.body.clientWidth || document.body.clientHeight)) { 14 // IE 4 compatible 15 myWidth = document.body.clientWidth; 16 myHeight = document.body.clientHeight; 17 } 18 windowWidth = parseInt(myWidth); 19 windowHeight = parseInt(myHeight); 20 theImageRight = 2; 21 theImageLeft = 261; 22 theImageMargeWidth = 0; 23 theImageTop = 73; 24 theImageBottom = 0; 25 theImageMargeHeight = 0; 26 jQuery.cookie('windowHeight', myHeight, { 27 path : COOKIE_PATH 28 }); 29 jQuery.cookie('windowWidth', myWidth, { 30 path : COOKIE_PATH 31 }); 32 jQuery.cookie('theImageRight', theImageRight, { 33 path : COOKIE_PATH 34 }); 35 jQuery.cookie('theImageLeft', theImageLeft, { 36 path : COOKIE_PATH 37 }); 38 jQuery.cookie('theImageMargeWidth', theImageMargeWidth, { 39 path : COOKIE_PATH 40 }); 41 jQuery.cookie('theImageTop', theImageTop, { 42 path : COOKIE_PATH 43 }); 44 jQuery.cookie('theImageBottom', theImageBottom, { 45 path : COOKIE_PATH 46 }); 47 jQuery.cookie('theImageMargeHeight', theImageMargeHeight, { 48 path : COOKIE_PATH 49 }); 50 retval = jQuery.cookie('autosize_reload'); 51 retval2 = jQuery.cookie('picture_deriv'); 1 52 2 function on_load() { 3 var myWidth = 0, myHeight = 0, myImgWidth =0, myImgHeight = 0; 4 if (typeof (window.innerWidth) == 'number') { 5 //Non-IE 6 myWidth = window.innerWidth; 7 myHeight = window.innerHeight; 8 } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { 9 //IE 6+ in 'standards compliant mode' 10 myWidth = document.documentElement.clientWidth; 11 myHeight = document.documentElement.clientHeight; 12 } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { 13 //IE 4 compatible 14 myWidth = document.body.clientWidth; 15 myHeight = document.body.clientHeight; 16 } 17 windowWidth =parseInt( myWidth); 18 windowHeight = parseInt(myHeight); 53 if (retval == "ok" && retval2) 54 return; 55 // 56 jQuery.cookie('autosize_reload', "ok", { 57 path : COOKIE_PATH 58 }); 19 59 20 theImageRight = 2; 21 theImageLeft=261; 22 theImageMargeWidth=0; 60 if (reload == "true") { 61 document.location = document.location; 23 62 24 theImageTop =73; 25 theImageBottom = 0; 26 theImageMargeHeight=0; 27 jQuery.cookie('windowHeight', myHeight, { path: COOKIE_PATH }); 28 jQuery.cookie('windowWidth', myWidth, { path: COOKIE_PATH }); 63 return; 64 // document.location.reload(false); // from cache 65 try { 29 66 30 jQuery.cookie('theImageRight', theImageRight, { path: COOKIE_PATH }); 31 jQuery.cookie('theImageLeft',theImageLeft, { path: COOKIE_PATH }); 32 jQuery.cookie('theImageMargeWidth',theImageMargeWidth, { path: COOKIE_PATH }); 33 34 jQuery.cookie('theImageTop',theImageTop, { path: COOKIE_PATH }); 35 jQuery.cookie('theImageBottom',theImageBottom, { path: COOKIE_PATH }); 36 jQuery.cookie('theImageMargeHeight', theImageMargeHeight, { path: COOKIE_PATH }); 37 /* 38 theImageWidth = windowWidth - theImageRight - theImageLeft - theImageMargeWidth; 39 theImageHeight = windowHeight - theImageTop - theImageBottom - theImageMargeHeight; 40 jQuery.cookie('theImageHeight', theImageHeight, { path: COOKIE_PATH }); 41 jQuery.cookie('theImageWidth', theImageWidth, { path: COOKIE_PATH }); 42 jQuery.cookie('theMainImageHeight', theMainImageHeight, { path: COOKIE_PATH }); 43 jQuery.cookie('theMainImage', theMainImageWidth, { path: COOKIE_PATH }); 44 */ 45 retval = jQuery.cookie('autosize_reload'); 46 retval2= jQuery.cookie('picture_deriv'); 47 if (retval == "ok" && retval2) return; 48 // 49 jQuery.cookie('autosize_reload', "ok", { path: COOKIE_PATH }); 50 if (reload == "true") { 51 document.location = document.location ; 52 53 return ; 54 //document.location.reload(false); // from cache 55 try { 56 57 58 var retval = document.location.reload(true); 59 } 60 catch (err) { 61 var retval = window.location.reload(); 62 } 63 } 67 var retval = document.location.reload(true); 68 } catch (err) { 69 var retval = window.location.reload(); 70 } 71 } 64 72 } -
extensions/Autosize/main.inc.php
r22122 r22133 2 2 /* 3 3 Plugin Name: AutoSize 4 Version: 3.1. 04 Version: 3.1.1 5 5 Description: Ajuste l'affichage des photos en fonction de la hauteur de la fenetre de navigation 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=448 … … 57 57 add_event_handler('loc_after_page_header',array(&$autosize_ctrl, 'cl_autosize_script_3') ); 58 58 add_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL +21 ); 59 59 if(!isset($_GET['slideshow'])) add_event_handler('loc_begin_picture', array(&$autosize_ctrl, 'init_3'), EVENT_HANDLER_PRIORITY_NEUTRAL+6); 60 60 } 61 61 } ;
Note: See TracChangeset
for help on using the changeset viewer.