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