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