Ignore:
Timestamp:
Apr 13, 2013, 4:53:32 PM (11 years ago)
Author:
cljosse
Message:

[extensions] Autosize update to piwigo 2.5 (fix init)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/autosize.inc.php

    r22133 r22191  
    3939                global $defined_types,$pictureSelType,$pictureMap ,$pictureDeriv ,$liste_type,$SRC_IMG;
    4040                global $autosize_parametres,$user_status;
    41                 global $infos_message,$error_message;
    4241                //==============================================================================
    43                 global $DEBUG_autosize;
     42                global $DEBUG_autosize,$infos_message,$error_message;
    4443                if(preg_match("|event|", $DEBUG_autosize, $val))  $infos_message =  "autosize_calcContent, " ;
     44                if(!realpath($element_info['path'])) return $content;
     45
    4546                $ma_page=isset($page['body_id'])?$page['body_id']:"" ;
    4647                if ($ma_page !='thePicturePage') return ;
     
    9394        *********************/
    9495        static public function init_3(){
     96                global $DEBUG_autosize,$infos_message,$error_message;
     97                if(preg_match("|event|", $DEBUG_autosize, $val))  $infos_message .=  "init_3, " ;
    9598
    9699        }
     
    98101        {
    99102                global $conf, $template, $page;
     103                global $DEBUG_autosize,$infos_message,$error_message;
     104                if(!realpath($image['path'])) return $content;
     105                if(preg_match("|event|", $DEBUG_autosize, $val))  $infos_message .=  "init_1, " ;
    100106                if(!isset($conf['AS_panorama'])) return $content;
    101                 if(  !is_array($conf['AS_panorama']) ){
    102                         return $content;
    103                 }
     107                if(  !is_array($conf['AS_panorama']) )                  return $content;
    104108                $asp = & $conf['AS_panorama'];
    105109                if(!isset($asp['in_mode_360'])) $asp['in_mode_360']="";
    106110                if(!isset($asp['in_mode_180'])) $asp['in_mode_180']="";
    107 
    108111                if ( !stristr($image['name'], $asp['in_mode_360']) and !stristr($image['name'], $asp['in_mode_180']) ) return $content;
    109 
    110112                $asp['min_viewport_width']=$_COOKIE['windowWidth'] -$_COOKIE['theImageLeft']-$_COOKIE['theImageRight'];
    111113                $asp['viewport_height']=$_COOKIE['windowHeight']-130 ;
    112 
    113114                $asp['start_position']= 10;
    114 
    115115        }
    116116        /*********************/
     
    119119                global $user,$Css,$css_slideshow,$css_display,$liste_type;
    120120                global $has_pamoorama,$pictureSelType,$pictureDeriv,$pictureMap;
    121                 global $infos_message,$warnings_message;
    122 
    123                 global $set_miniature,$imgSizeWH,$DEBUG_autosize;
     121                global $warnings_message;
     122
     123                global $set_miniature,$imgSizeWH;
    124124                global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize;
    125125                //=======================================================
    126                 global $has_pamoorama, $DEBUG_autosize ;
    127 
    128                 if(preg_match("|event|", $DEBUG_autosize, $val)) {
    129                         $infos_message .=  "init, ";
    130                 } ;
     126                global $has_pamoorama  ;
     127                global $DEBUG_autosize,$infos_message,$error_message;
     128                if(!realpath($element_info['path'])) return $content;
     129                if(preg_match("|event|", $DEBUG_autosize, $val))  $infos_message .=  "init, " ;
    131130
    132131                $has_pamoorama = isset($template->files['pamooramics_content'])?"true":"false";
     
    194193                if(preg_match("|test|", $DEBUG_autosize, $val)) {
    195194                        $infos_message .=  "#208 <br>Init:SESSION:"  . cl_print_var($_SESSION) ;
    196                          
     195
    197196                        if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ;
    198197                        $infos_message .=  "Init: COOKIE:"  . cl_print_var($_COOKIE) ;
     
    210209                        if(preg_match("|c1|", $DEBUG_autosize, $val)) {
    211210                                echo "<!-- " . $theImageWidth . "x" . $theImageHeight . " " .cl_print_var($content) ." -->";
    212                                 self::Fin_php("#212: " . $DEBUG_autosize);
     211                                self::Fin_php("#211: " . $DEBUG_autosize);
    213212                        }
    214213                        return  $content;
     
    260259        *************************/
    261260        static public function init2($content,$element_info){
    262 
    263 
    264261                global  $template,$version,$icon_path,$page,$picture,$conf;
    265262                global $user,$Css,$css_slideshow,$css_display,$liste_type;
     
    270267                global  $has_pamoorama,$pictureSelType,$pictureDeriv;
    271268                global $DEBUG_autosize;
    272                 if(preg_match("|event|", $DEBUG_autosize, $val)) {
    273                         $infos_message .= "init2, ";
    274                 } ;
     269                if(preg_match("|event|", $DEBUG_autosize, $val)) $infos_message .= "init2, ";
     270                if(!realpath($element_info['path'])) return $content;
    275271                global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize;
    276272                //-- si Autosize correction redim ---------------
     
    307303                echo "left:".$theImageLeft."px;top:".$theImageTop."px;width:".$theImageWidth ."px;height:" .$theImageHeight."px;";
    308304                echo "<div style='position:absolute;left:".$theImageLeft."px;top:".$theImageTop."px;width:".$theImageWidth ."px;height:" .  $theImageHeight."px;background-color:green;'>";
    309                 self::Fin_php("#309 : " . $content + $DEBUG_autosize);
     305                self::Fin_php("#305 : " . $content + $DEBUG_autosize);
    310306
    311307        } //INIT2
     
    320316                global $conf;
    321317                $set_miniature = "<!DOCTYPE html><html><head>
    322                                 <meta http-equiv='content-type' content='text/html; charset=UTF-8'/>
    323                                 <script type='text/javascript' src='themes/default/js/jquery.min.js'></script>
    324                                 <script type='text/javascript' src='plugins/Autosize/js/autosizeDetect.js'></script>
    325                                 <script type='text/javascript' src='plugins/Autosize/js/autosize.cookie.js'></script>
    326                                 <script type='text/javascript' src='themes/default/js/plugins/jquery.ajaxmanager.js'></script>";   $set_miniature .= "<script type='text/javascript' src='plugins/Autosize/js/autosize_ajax.js' id='autosize_ajax' >  </script >";
     318                <meta http-equiv='content-type' content='text/html; charset=UTF-8'/>
     319                <script type='text/javascript' src='themes/default/js/jquery.min.js'></script>
     320                <script type='text/javascript' src='plugins/Autosize/js/autosizeDetect.js'></script>
     321                <script type='text/javascript' src='plugins/Autosize/js/autosize.cookie.js'></script>
     322                <script type='text/javascript' src='themes/default/js/plugins/jquery.ajaxmanager.js'></script>";
     323                $set_miniature .= "<script type='text/javascript' src='plugins/Autosize/js/autosize_ajax.js' id='autosize_ajax' >  </script >";
    327324                $set_var = "<script type='text/javascript'>\n var COOKIE_PATH =  '".cookie_path()."';\n";
    328325                if(preg_match("|noreload|", $DEBUG_autosize, $val)) {
     
    370367                        echo "INIT <pre>";
    371368                        print_r($_COOKIE);
    372                         self::Fin_php("#372:  No COOKIE['picture_deriv'] ".$DEBUG_autosize);
     369                        self::Fin_php("#369:  No COOKIE['picture_deriv'] ".$DEBUG_autosize);
    373370                }
    374371
     
    380377                        echo "GET:"  . cl_print_var($_GET) ;
    381378                        echo "POST:"  . cl_print_var($_POST) ;
    382                         self::Fin_php("#382: ".$DEBUG_autosize);
     379                        self::Fin_php("#379: ".$DEBUG_autosize);
    383380                }
    384381
     
    391388                echo $autoscript;
    392389                if (!isset($_COOKIE['autosize_reload'])  ){
    393                         self::Fin_php("#393:  Initialisation ".$DEBUG_autosize);
    394                 }
    395                 //
    396                  
     390                        self::Fin_php("#390:  Initialisation ".$DEBUG_autosize);
     391                }                       
    397392        }
    398393
     
    452447                );
    453448                if( preg_match("|c2|", $DEBUG_autosize, $val) ){
    454                         self::Fin_php( "454: " . $DEBUG_autosize);
     449                        self::Fin_php( "449: " . $DEBUG_autosize);
    455450                        return $content ;
    456451
     
    517512                if ($ma_page !='thePicturePage') return ;
    518513
    519                  
     514                       
    520515                $template->func_combine_script(array('id'=>'my_script_2',
    521516                                'path'=> AUTOSIZE_PATH.'js/JScript.js',
     
    540535                $template->append('footer_elements',$autoscript);
    541536
    542                  
     537                       
    543538                return ;
    544539        }// function cl_autosize_script_3
     
    578573                                if(count($set_miniatures)> 1 )
    579574                                        $infos_message .= "PictureDeriv:" . $pictureDeriv. ' miniature:' . cl_print_var( $set_miniature);
    580                                  
     575                                       
    581576                        }else {
    582577
     
    664659                        $template->parse('mes_script');
    665660                }
    666                  
     661                       
    667662
    668663                if(preg_match("|vue_cookies|", $DEBUG_autosize, $val)) {
     
    679674                        $infos_message .= "<br />SelType:" . $pictureSelType."; pictureDeriv:".$pictureDeriv ."; pictureMap:".$pictureMap;
    680675
    681                         self::Fin_php("#681: ".$DEBUG_autosize);
     676                        self::Fin_php("#676: ".$DEBUG_autosize);
    682677                }
    683678                cl_aff_infos_plus();
     
    847842                }
    848843
    849                  
     844                       
    850845                return $css;
    851846        }
     
    872867                                $i++;
    873868                        }
    874                          
     869
    875870                }
    876871                ;
     
    920915                        if(file_exists(PHPWG_ROOT_PATH.$img_url)){
    921916                        } // if file
    922                          
     917
    923918                        if ($theImage_def==0){
    924919                                // Avant Autosize ou Original;
     
    976971                                else
    977972                                        $maxi_image = $img_select;
    978                                  
     973                                       
    979974                                $maxi_image->url  =  $maxi_image->get_path();
    980975
     
    986981                                $mini_image->url  =  $mini_image->get_path();
    987982                        }
    988                          
     983
    989984                } // for
    990985                //================================================
     
    993988                $imgSizeWH  =  $img_select->src_image->get_size();
    994989                $liste_type["Original"]="Original".",".$img_url.",".$imgSizeWH[0] .",".$imgSizeWH[1] ;
    995                  
     990                       
    996991
    997992                $retour=(object)'' ;
     
    10631058                        if(!file_exists(PHPWG_ROOT_PATH.$img_url)){
    10641059                                $img_type  =  $img_select->get_type();
    1065                                  
     1060                                       
    10661061                                $file_id=explode("?",$img_url);
    10671062                                if(count($file_id) ==1){
     
    10761071                                        array_push($nofiles,serialize($file_no)) ;
    10771072                                        if( $img_type == $pictureDeriv){
    1078                                                  
     1073                                                       
    10791074                                                break ;
    10801075                                        }
     
    11201115        ****************************/
    11211116        static public  function  get_cookies(){
    1122                 global $pictureDeriv,$pictureSelType,$pictureDeriv,$pictureMap;
     1117                global $pictureDeriv,$pictureSelType,$pictureDeriv,$pictureMap,$DEBUG_autosize;
    11231118                if(!isset($_COOKIE['picture_deriv'])){
    11241119                        $pictureDeriv= pwg_get_session_var('picture_deriv');
     
    11331128                $_COOKIE['picture_deriv']=$pictureDeriv;
    11341129                $_COOKIE['picture_map']=$pictureMap;
    1135                 //================================================================
    1136                 global $DEBUG_autosize;
    1137                 if( isset($_GET['cl_debug']) && $_GET['cl_debug'] =='false') {
    1138                         $DEBUG_autosize="";
    1139                 }else{
    1140                         $DEBUG_autosize = isset($_POST['cl_debug']) ? $_POST['cl_debug'] : "" ;
    1141                         $DEBUG_autosize = isset($_GET['cl_debug']) ? $_GET['cl_debug'] :  $DEBUG_autosize ;
    1142                         $DEBUG_autosize = isset($conf['cl_debug']) ? $conf['cl_debug']."," . $DEBUG_autosize : $DEBUG_autosize ;
    1143                         //===============================================================
    1144                 }
    11451130                if(!isset($_COOKIE['picture_deriv'] )){
    11461131                        if(preg_match("|test_1|", $DEBUG_autosize, $val)) {
    11471132                                $infos_message .= "not COOKIE['picture_deriv'] -> reload(): <br>";
    1148                                 self::Fin_php("#1148 autosize_calcContent:" . $DEBUG_autosize );
     1133                                self::Fin_php("#1133 autosize_calcContent:" . $DEBUG_autosize );
    11491134                        }
    11501135                        unset($_COOKIE['autosize_reload']);
     
    11531138                        if(preg_match("|test_2|", $DEBUG_autosize, $val)) {
    11541139                                $infos_message .= "not COOKIE['autosize_reload'] -> reload(): <br>";
    1155                                 self::Fin_php("#1155 autosize_calcContent:" . $DEBUG_autosize);
    1156                         }
    1157                         self::reload("#1157");
     1140                                self::Fin_php("#1140 autosize_calcContent:" . $DEBUG_autosize);
     1141                        }
     1142                        self::reload("#1142");
    11581143                }
    11591144        }
Note: See TracChangeset for help on using the changeset viewer.