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 | // self::Fin_php("#411: ".$DEBUG_autosize); |
---|
424 | |
---|
425 | } |
---|
426 | |
---|
427 | /************************ |
---|
428 | * cl_autosize_script_1 |
---|
429 | *************************/ |
---|
430 | static public function cl_autosize_script_1(){ |
---|
431 | global $user,$page,$template,$cl_plugin,$cl_version; |
---|
432 | global $has_pamoorama,$css_slideshow; |
---|
433 | global $pictureSelType,$pictureDeriv,$infos_message,$conf; |
---|
434 | global $DEBUG_autosize; |
---|
435 | if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_script_1, " ;} ; |
---|
436 | $ma_page=isset($page['body_id'])?$page['body_id']:"" ; |
---|
437 | if ($ma_page !='thePicturePage') return ; |
---|
438 | if ( $has_pamoorama=="false" ) return ; |
---|
439 | if ($page['slideshow']){ |
---|
440 | //==== mise à l'échelle === |
---|
441 | $current = $template->get_template_vars('current'); |
---|
442 | $default_size = $conf['derivative_default_size']; |
---|
443 | |
---|
444 | if(isset($current['selected_derivative'])) { |
---|
445 | $model=$current['selected_derivative']->get_type() ; |
---|
446 | }else{ |
---|
447 | $model=$default_size; |
---|
448 | } |
---|
449 | |
---|
450 | $selected_derivative = $current['derivatives'][$model]; |
---|
451 | $template->append('current', array( |
---|
452 | 'selected_derivative' => $selected_derivative |
---|
453 | ), |
---|
454 | true); |
---|
455 | |
---|
456 | } |
---|
457 | |
---|
458 | |
---|
459 | |
---|
460 | $template->set_filenames(array('autosize_init'=>AUTOSIZE_PATH_ABS. "template/conflit.tpl" ) ); |
---|
461 | $autosize_parametres = cl_autosize_Get_Options() ; |
---|
462 | $theme=$user['theme']; |
---|
463 | //============================================================================== |
---|
464 | $template->assign( |
---|
465 | array( |
---|
466 | 'autosize_parametres' => $autosize_parametres , |
---|
467 | 'cl_plugins' => $cl_plugin , |
---|
468 | 'cl_version' => $cl_version , |
---|
469 | 'name' => $cl_plugin['name'] , |
---|
470 | 'has_pamoorama' => $has_pamoorama, |
---|
471 | 'theme' => $theme , |
---|
472 | 'DEBUG_autosize' => $DEBUG_autosize, |
---|
473 | 'AUTOSIZE_PATH' => str_replace("../","",AUTOSIZE_PATH) , |
---|
474 | 'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS, |
---|
475 | 'Version_pwg' => PHPWG_VERSION , |
---|
476 | 'slide_show' => $page['slideshow'] |
---|
477 | ) |
---|
478 | ); |
---|
479 | if( preg_match("|c2|", $DEBUG_autosize, $val) ){ |
---|
480 | self::Fin_php( "446: " . $DEBUG_autosize); |
---|
481 | return $content ; |
---|
482 | |
---|
483 | } |
---|
484 | |
---|
485 | return $template->parse( 'autosize_init', false); |
---|
486 | |
---|
487 | |
---|
488 | }// function cl_autosize_script_1 |
---|
489 | |
---|
490 | /************************************* |
---|
491 | * cl_autosize_script_2() |
---|
492 | **************************************/ |
---|
493 | static public function cl_autosize_script_2() |
---|
494 | { global $css_slideshow; |
---|
495 | global $pictureSelType,$pictureDeriv,$infos_message; |
---|
496 | global $template,$user,$conf,$picture ,$page, $cl_plugin,$cl_version,$known_script ; |
---|
497 | |
---|
498 | global $has_pamoorama; |
---|
499 | global $DEBUG_autosize; |
---|
500 | if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_script_2, ";} ; |
---|
501 | $ma_page=isset($page['body_id'])?$page['body_id']:"" ; |
---|
502 | if ($ma_page !='thePicturePage') return ; |
---|
503 | |
---|
504 | $theme=$user['theme']; |
---|
505 | if ($has_pamoorama=="false" ) return ; |
---|
506 | if ($css_slideshow == "no" and isset($_GET['slideshow'])) return ; |
---|
507 | $AUTOSIZE_PATH = dirname(__FILE__).'/'; |
---|
508 | //===================================================================== |
---|
509 | $template->assign( |
---|
510 | array( |
---|
511 | 'cl_version' => $cl_version , |
---|
512 | 'name' => $cl_plugin['name'] , |
---|
513 | 'ma_page' => $ma_page, |
---|
514 | 'theme' => $theme , |
---|
515 | 'DEBUG_autosize' => $DEBUG_autosize , |
---|
516 | 'AUTOSIZE_PATH' => AUTOSIZE_PATH |
---|
517 | ) |
---|
518 | ); |
---|
519 | $autoscript="<script type='text/javascript'> |
---|
520 | /* cl_autosize_script_2 */ |
---|
521 | if (typeof (save_framework) == 'function') |
---|
522 | save_framework('".$ma_page."'); |
---|
523 | |
---|
524 | </script>"; |
---|
525 | $template->append('footer_elements',$autoscript); |
---|
526 | |
---|
527 | return ; |
---|
528 | }// function cl_autosize_script_2 |
---|
529 | |
---|
530 | /************************************* |
---|
531 | * cl_autosize_script_3() |
---|
532 | **************************************/ |
---|
533 | static public function cl_autosize_script_3() { |
---|
534 | global $has_pamoorama,$template,$page,$infos_message; |
---|
535 | global $DEBUG_autosize; |
---|
536 | if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_script_3, ";} ; |
---|
537 | $ma_page=isset($page['body_id'])?$page['body_id']:"" ; |
---|
538 | if ($ma_page !='thePicturePage') return ; |
---|
539 | |
---|
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'> |
---|
558 | if (typeof (Ajout_Ajax) == 'function') |
---|
559 | Ajout_Ajax(); |
---|
560 | </script>"; |
---|
561 | $template->append('footer_elements',$autoscript); |
---|
562 | |
---|
563 | |
---|
564 | return ; |
---|
565 | }// function cl_autosize_script_3 |
---|
566 | |
---|
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; |
---|
585 | global $DEBUG_autosize; |
---|
586 | global $css_slideshow,$css_display; |
---|
587 | if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_affiche, " ;} ; |
---|
588 | $ma_page=isset($page['body_id'])?$page['body_id']:"" ; |
---|
589 | if ($ma_page !='thePicturePage') return ; |
---|
590 | //============================================================ |
---|
591 | self::save_cookies(); |
---|
592 | |
---|
593 | if(isset($set_miniature)){ |
---|
594 | $set_miniature = self::cl_autosize_nofile($set_miniature) ; |
---|
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); |
---|
605 | } |
---|
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); |
---|
611 | |
---|
612 | include_once (AUTOSIZE_PATH."include/affiche.php"); |
---|
613 | |
---|
614 | $file =AUTOSIZE_PATH_ABS.'template/picture_1.tpl' ; |
---|
615 | if ($css_display=="none" && $has_pamoorama=="true" ) { |
---|
616 | $css_display="block" ; |
---|
617 | } |
---|
618 | $file_css=AUTOSIZE_PATH."css/".$theme.".css"; |
---|
619 | if (!file_exists($file_css)) $file_css="no"; |
---|
620 | if ($css_display=="none" ) { |
---|
621 | return ; |
---|
622 | } |
---|
623 | if($pictureSelType == $pictureDeriv ) { |
---|
624 | if(preg_match("|event|", $DEBUG_autosize, $val)) { cl_aff_infos_plus();} ; |
---|
625 | |
---|
626 | } |
---|
627 | |
---|
628 | if (defined('GMAPS_VERSION')) $gmaps_function="true"; |
---|
629 | else $gmaps_function="false" ; |
---|
630 | |
---|
631 | |
---|
632 | |
---|
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, |
---|
637 | 'theme' =>$theme, |
---|
638 | 'gmaps_function' => $gmaps_function |
---|
639 | )); |
---|
640 | $template->concat('autosize_content', $template->parse('autosize_content_header', true)); |
---|
641 | |
---|
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 | } |
---|
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 | } |
---|
692 | |
---|
693 | if(preg_match("|test|", $DEBUG_autosize, $val)) { |
---|
694 | $infos_message .= "#683 <br>cl_autosize_affiche:_COOKIE:" . cl_print_var($_COOKIE) ; |
---|
695 | $pictureMap=$_COOKIE['picture_map']; |
---|
696 | $infos_message .= "<br />SelType:" . $pictureSelType."; pictureDeriv:".$pictureDeriv ."; pictureMap:".$pictureMap; |
---|
697 | |
---|
698 | self::Fin_php("#686: ".$DEBUG_autosize); |
---|
699 | } |
---|
700 | cl_aff_infos_plus(); |
---|
701 | return $template->parse( 'autosize_content', false); |
---|
702 | } //public function cl_autosize_affiche |
---|
703 | |
---|
704 | |
---|
705 | /**************************************** |
---|
706 | * |
---|
707 | ****************************************/ |
---|
708 | function Get_Options(&$parametres,$str_index){ |
---|
709 | global $conf ; |
---|
710 | if (!isset( $conf[$str_index])) { |
---|
711 | $conf[$str_index]=""; |
---|
712 | } |
---|
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 | |
---|
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 | |
---|
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" ; |
---|
747 | $def_para['defaut_type'] = "off" ; |
---|
748 | |
---|
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 | } |
---|
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 | //================================================ |
---|
806 | static public function css($theme_local) { |
---|
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 | |
---|
821 | if(!file_exists($mycssfile)){ |
---|
822 | return Array(); |
---|
823 | } |
---|
824 | |
---|
825 | $ret = file_get_contents ($mycssfile); |
---|
826 | |
---|
827 | function remove_comments( & $string ) { |
---|
828 | $string = preg_replace('#/\*.*?\*/#s',"",$string); |
---|
829 | return $string; |
---|
830 | } |
---|
831 | |
---|
832 | $order = array("\r\n", "\n", "\r"," "); |
---|
833 | $replace = ''; |
---|
834 | $newstr = str_replace($order, $replace, $ret); |
---|
835 | |
---|
836 | $order = array('"'); |
---|
837 | $replace = "'"; |
---|
838 | $newstr = str_replace($order, $replace, $newstr); |
---|
839 | |
---|
840 | |
---|
841 | $order = array("}"); |
---|
842 | $replace = '}\r\n'; |
---|
843 | $newstr = str_replace($order, $replace, $newstr); |
---|
844 | remove_comments($newstr); |
---|
845 | |
---|
846 | $newstr = explode('\r\n',$newstr); |
---|
847 | $css=Array(); |
---|
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 | |
---|
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 ; |
---|
876 | global $DEBUG_autosize; |
---|
877 | |
---|
878 | |
---|
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); |
---|
896 | |
---|
897 | $retour = (object) ''; |
---|
898 | $maxi_image = (object) ''; |
---|
899 | $mini_image = (object) ''; |
---|
900 | $std_image = (object) ''; |
---|
901 | $default_image=(object) ''; |
---|
902 | $SelType_image=(object) ''; |
---|
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 ; |
---|
913 | $nofile=0 ; global $max_crop; |
---|
914 | //============================================= |
---|
915 | // Liste mini maxi |
---|
916 | //============================================= |
---|
917 | foreach ($img_all as $img_select){ |
---|
918 | |
---|
919 | $img_type = $img_select->get_type(); |
---|
920 | $img_url = $img_select->get_path(); |
---|
921 | $max_crop = 0 ; |
---|
922 | $imgWH = self::Get_Size($img_select); |
---|
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++ ; |
---|
931 | if(preg_match("|get_infos|", $DEBUG_autosize, $val)) |
---|
932 | $infos_message .=$nofile ." " ; |
---|
933 | } |
---|
934 | if(preg_match("|get_minfos|", $DEBUG_autosize, $val)) |
---|
935 | $infos_message .=$img_url . " " . $max_crop ." -> " . $img_type . " " . print_r($imgWH,true). " <br >"; |
---|
936 | |
---|
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 | } |
---|
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 >"; |
---|
964 | |
---|
965 | $SelType_image->type=$img_type; |
---|
966 | $SelType_image->url=$img_url; |
---|
967 | $SelType_image=$img_select; |
---|
968 | } |
---|
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 | |
---|
995 | $maxi_image->url = $maxi_image->get_path(); |
---|
996 | |
---|
997 | } else { |
---|
998 | |
---|
999 | $mini_image->type=$img_type; |
---|
1000 | $mini_image->url=$img_url; |
---|
1001 | $mini_image=$img_select; |
---|
1002 | $mini_image->url = $mini_image->get_path(); |
---|
1003 | } |
---|
1004 | |
---|
1005 | } // for |
---|
1006 | //================================================ |
---|
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 | |
---|
1012 | |
---|
1013 | $retour=(object)'' ; |
---|
1014 | if ($pictureSelType=="Autosize") $retour= $maxi_image ; |
---|
1015 | else if ($pictureSelType=="SelMaxi") $retour= $mini_image ; |
---|
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 | } |
---|
1026 | |
---|
1027 | if (!isset( $retour->type)){ |
---|
1028 | $retour=$last_image; |
---|
1029 | $retour->type = $retour->get_type(); |
---|
1030 | $retour->url = $retour->get_path(); |
---|
1031 | |
---|
1032 | } |
---|
1033 | if (isset( $retour->type) && $retour->type=="Original" ){ |
---|
1034 | $retour=$last_image; |
---|
1035 | $retour->type = $last_derivative; |
---|
1036 | $retour->url = $retour->get_path(); |
---|
1037 | |
---|
1038 | } |
---|
1039 | if($nofile > 0){ |
---|
1040 | $set_miniature=$No_files ; |
---|
1041 | } |
---|
1042 | |
---|
1043 | if(preg_match("|get_infos|", $DEBUG_autosize, $val)) |
---|
1044 | $infos_message .=$pictureSelType . " -> " . $retour->type . " : " . $retour->url ."<br >"; |
---|
1045 | |
---|
1046 | return $retour ; |
---|
1047 | |
---|
1048 | } |
---|
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 | } |
---|
1063 | //================================================================== |
---|
1064 | static public function cl_autosize_nofile($img_all){ |
---|
1065 | //=== verification fichiers absents === |
---|
1066 | global $infos_message,$error_message; |
---|
1067 | global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize; |
---|
1068 | global $pictureDeriv; |
---|
1069 | $ok=false ; |
---|
1070 | $nofiles=array(); |
---|
1071 | $file_no=(object) ''; |
---|
1072 | |
---|
1073 | $nosrc=false ; |
---|
1074 | $ok=true ; |
---|
1075 | $listes=""; |
---|
1076 | foreach ($img_all as $img_select){ |
---|
1077 | $img_url = $img_select->get_url(); |
---|
1078 | if(!file_exists(PHPWG_ROOT_PATH.$img_url)){ |
---|
1079 | $img_type = $img_select->get_type(); |
---|
1080 | |
---|
1081 | $file_id=explode("?",$img_url); |
---|
1082 | if(count($file_id) ==1){ |
---|
1083 | $file_id[]=$file_id[0] ; |
---|
1084 | } |
---|
1085 | if ( !preg_match("|".$file_id[1]."|", $listes) ){ |
---|
1086 | $listes .= $file_id[1] ."<br />"; |
---|
1087 | $file_no->url= $file_id[1] ; |
---|
1088 | $id = $img_select->src_image->id; |
---|
1089 | $file_no->id=$id ; |
---|
1090 | $file_no->type=$img_type ; |
---|
1091 | array_push($nofiles,serialize($file_no)) ; |
---|
1092 | if( $img_type == $pictureDeriv){ |
---|
1093 | |
---|
1094 | break ; |
---|
1095 | } |
---|
1096 | } |
---|
1097 | $ok=false ; |
---|
1098 | } |
---|
1099 | } |
---|
1100 | $exec_miniatures=""; |
---|
1101 | if(count($nofiles)>0){ |
---|
1102 | //======================================================================================= |
---|
1103 | if($nosrc!=true ){ |
---|
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 ; |
---|
1107 | } |
---|
1108 | $exec_miniatures =""; |
---|
1109 | $script_miniatures .= "<script type='text/javascript'> |
---|
1110 | var nofile=Array("; |
---|
1111 | for ($i=0;$i < count($nofiles)-1 ;$i++){ |
---|
1112 | $file = unserialize($nofiles[$i]); |
---|
1113 | $exec_miniatures .= "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'},\n" ; |
---|
1114 | } |
---|
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' > |
---|
1125 | if(typeof nofile!='undefined') |
---|
1126 | getDerivativeUrls(nofile); |
---|
1127 | </script>"; |
---|
1128 | //================================================================================== |
---|
1129 | return $script_miniatures ; |
---|
1130 | } |
---|
1131 | } |
---|
1132 | /*************************** |
---|
1133 | * get_cookies |
---|
1134 | ****************************/ |
---|
1135 | static public function get_cookies(){ |
---|
1136 | global $pictureDeriv,$pictureSelType,$pictureDeriv,$pictureMap; |
---|
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(){ |
---|
1156 | global $pictureDeriv,$pictureSelType,$pictureDeriv,$pictureMap; |
---|
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 | } |
---|
1183 | |
---|
1184 | static public function Fin_php($message_){ |
---|
1185 | global $infos_message; |
---|
1186 | echo "End :".$message_."<br>"; |
---|
1187 | die($infos_message); |
---|
1188 | } |
---|
1189 | //================================================== |
---|
1190 | } // class |
---|
1191 | |
---|
1192 | /************************************* |
---|
1193 | * |
---|
1194 | *************************************/ |
---|
1195 | function cl_autosize_Get_Options() |
---|
1196 | { |
---|
1197 | global $conf,$autosize_parametres; |
---|
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 | |
---|
1211 | $autosize_parametres = unserialize($conf['cl_autosize']); |
---|
1212 | // $autosize_parametres = self::Get_Options($autosize_parametres,'cl_autosize'); |
---|
1213 | $autosize_parametres = cl_autosize_Set_Options(); |
---|
1214 | return $autosize_parametres; |
---|
1215 | } |
---|
1216 | /* |
---|
1217 | * |
---|
1218 | */ |
---|
1219 | function cl_autosize_Set_Options() { |
---|
1220 | global $autosize_parametres; |
---|
1221 | //============================================================================= |
---|
1222 | $my_para=$autosize_parametres; |
---|
1223 | if (empty($my_para)) |
---|
1224 | $my_para = (object) ''; |
---|
1225 | |
---|
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') ; |
---|
1228 | |
---|
1229 | $my_para->webmaster_type =(isset($_POST['webmaster_type'])) ? $_POST['webmaster_type'] : ((isset($my_para->webmaster_type )) ? $my_para->webmaster_type : 'Autosize' ) ; |
---|
1230 | |
---|
1231 | $my_para->admin_type =(isset($_POST['admin_type'])) ? $_POST['admin_type'] : ((isset($my_para->admin_type )) ? $my_para->admin_type : 'Autosize' ) ; |
---|
1232 | |
---|
1233 | $my_para->generic_type =(isset($_POST['generic_type'])) ? $_POST['generic_type'] : ((isset($my_para->generic_type )) ? $my_para->generic_type : 'Autosize' ) ; |
---|
1234 | |
---|
1235 | |
---|
1236 | $my_para->guest_type =(isset($_POST['guest_type'])) ? $_POST['guest_type'] : ((isset($my_para->guest_type )) ? $my_para->guest_type : 'Autosize' ) ; |
---|
1237 | |
---|
1238 | |
---|
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 | |
---|
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 | |
---|
1249 | $my_para->echelle_max=(isset($_POST['echelle_max']))? $_POST['echelle_max'] : ((isset($my_para->echelle_max)) ? $my_para->echelle_max : '1.0'); |
---|
1250 | $my_para->marge_basse=(isset($_POST['marge_basse']))? $_POST['marge_basse']: ((isset($my_para->marge_basse)) ? $my_para->marge_basse : '0'); |
---|
1251 | $my_para->fade_in=(isset($_POST['fade_in']))? $_POST['fade_in']: ((isset($my_para->fade_in)) ? $my_para->fade_in : '0'); |
---|
1252 | |
---|
1253 | //=============================================================================== |
---|
1254 | |
---|
1255 | if ( isset($_POST['submit'] ) && $_POST['submit'] == l10n('cl_autosize_save') ) { |
---|
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" ; |
---|
1258 | $my_para->defaut_type= isset($_POST['defaut_type']) ? $_POST['defaut_type'] : "off" ; |
---|
1259 | |
---|
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" ; |
---|
1265 | |
---|
1266 | }else{ |
---|
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') ; |
---|
1269 | $my_para->defaut_type = isset($_POST['defaut_type']) ? $_POST['defaut_type'] : ( ( isset($my_para->defaut_type) ) ? $my_para->defaut_type : 'off') ; |
---|
1270 | |
---|
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') ; |
---|
1276 | |
---|
1277 | |
---|
1278 | } |
---|
1279 | |
---|
1280 | return $my_para; |
---|
1281 | } |
---|
1282 | /* |
---|
1283 | * |
---|
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(); |
---|
1290 | if ( isset($autosize_parametres) ) { |
---|
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 | } |
---|
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 | } |
---|
1305 | } |
---|
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 | } |
---|
1319 | } |
---|
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 | } |
---|
1358 | |
---|
1359 | ?> |
---|