Ignore:
Timestamp:
Sep 11, 2014, 2:03:20 PM (10 years ago)
Author:
gbo
Message:

Compliance Piwigo 2.7rc1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/LLGBO2/maintain.class.php

    r29005 r29484  
    3434        private $default_header;
    3535       
    36 function __construct(){
     36 function __construct(){
    3737// +-----------------------------------------------------------------------+
    3838// +----------------- default values            ---------------------------+
    3939// +-----------------------------------------------------------------------+   
    40 include(PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/' .'defaultvalues.php');
     40 include(PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/' .'defaultvalues.php');
    4141     // variable declared in include       
    4242         $this->default_main = $default_main;
     
    4444         $this->default_frame = $default_frame;
    4545         $this->default_header = $default_header; 
    46     }       
    47 // +-----------------------------------------------------------------------+
    48 // +----------------- default values            ---------------------------+
    49 // +-----------------------------------------------------------------------+   
     46 }       
    5047       
    5148// +-----------------------------------------------------------------------+
    5249// +---------------  Install all settings  --------------------------------+
    5350// +-----------------------------------------------------------------------+
    54     function install($plugin_version, &$errors=array()) {
    55                 global $conf;
     51 function install($plugin_version, &$errors=array()) {
     52        global $conf;
    5653// +-----------------------------------------------------------------------+   
    57                 if (empty($conf['LLGBO2_Settings']))
    58                         {       if  (isset($conf['LLGBO'])) // compatibility 2.6 --> 2.7
    59                                         { $Oldvalues = explode("," , $conf['LLGBO']);                   
    60                                                 foreach($Oldvalues as $cle  => $valeur)
    61                                                 {       if ($Oldvalues[$cle]  == 'true' )
    62                                                                 {$Oldvalues[$cle]  = (boolean)true ;}   else { $Oldvalues[$cle]  = (boolean)false;}
    63                                                 }
    64                                                 $this->default_main['version']                          =  1;
    65                                                 $this->default_main['frame']                            =  $Oldvalues[0];
    66                                                 $this->default_main['tooltipdisp']                      =  $Oldvalues[1];
    67                                                 $this->default_main['exifunderbt']                      =  $Oldvalues[2];
    68                                                 $this->default_main['titleframe']                       =  $Oldvalues[5];
    69                                                 $this->default_main['manageheader']             =  $Oldvalues[6];
    70                                                 $this->default_main['alwaysdisplayexif']        =  $Oldvalues[10];
    71                                                 conf_delete_param('LLGBO');  // old values before 2.7
     54        if (empty($conf['LLGBO2_Settings']))
     55                {       if  (isset($conf['LLGBO'])) // compatibility 2.6 --> 2.7
     56                                { $Oldvalues = explode("," , $conf['LLGBO']);                   
     57                                        foreach($Oldvalues as $cle  => $valeur)
     58                                        {       if ($Oldvalues[$cle]  == 'true' )
     59                                                        {$Oldvalues[$cle]  = (boolean)true ;}   else { $Oldvalues[$cle]  = (boolean)false;}
    7260                                        }
    73                        
     61                                        $this->default_main['version']                          =  1;
     62                                        $this->default_main['frame']                            =  $Oldvalues[0];
     63                                        $this->default_main['tooltipdisp']                      =  $Oldvalues[1];
     64                                        $this->default_main['exifunderbt']                      =  $Oldvalues[2];
     65                                        $this->default_main['titleframe']                       =  $Oldvalues[5];
     66                                        $this->default_main['manageheader']             =  $Oldvalues[6];
     67                                        $this->default_main['alwaysdisplayexif']        =  $Oldvalues[10];
     68                                        conf_delete_param('LLGBO');  // old values before 2.7
     69                                }
     70
     71// +-----------------------------------------------------------------------+                           
     72                if  (isset($conf['LLGBOTOOLTIP'])) // compatibility 2.6 --> 2.7
     73                                {        $Oldvalues = explode("," , $conf['LLGBOTOOLTIP']);
     74
     75                                        $this->default_tooltip['TT-width']                      = $Oldvalues[0];
     76                                        $this->default_tooltip['TT-size']                       = $Oldvalues[1];
     77                                        $this->default_tooltip['TT-bordercolor']        = $Oldvalues[2];
     78                                        $this->default_tooltip['TT-bgcolor']            = $Oldvalues[3];
     79                                        $this->default_tooltip['TT-titlecolor']         = $Oldvalues[4];
     80                                        $this->default_tooltip['TT-textcolor']          = $Oldvalues[5];
     81                                               
     82                                        conf_delete_param('LLGBOTOOLTIP');  // old values before 2.7
     83                                }
    7484               
    7585// +-----------------------------------------------------------------------+                           
    76                         if  (isset($conf['LLGBOTOOLTIP'])) // compatibility 2.6 --> 2.7
    77                                         {        $Oldvalues = explode("," , $conf['LLGBOTOOLTIP']);
    7886
    79                                                 $this->default_tooltip['TT-width']                      = $Oldvalues[0];
    80                                                 $this->default_tooltip['TT-size']                       = $Oldvalues[1];
    81                                                 $this->default_tooltip['TT-bordercolor']        = $Oldvalues[2];
    82                                                 $this->default_tooltip['TT-bgcolor']            = $Oldvalues[3];
    83                                                 $this->default_tooltip['TT-titlecolor']         = $Oldvalues[4];
    84                                                 $this->default_tooltip['TT-textcolor']          = $Oldvalues[5];
    85                                                        
    86                                                 conf_delete_param('LLGBOTOOLTIP');  // old values before 2.7
    87                                         }
    88                        
    89 // +-----------------------------------------------------------------------+                           
     87                if (isset($conf['LLGBOFRAME']))  // compatibility 2.6 --> 2.7
     88                        {        $Oldvalues = explode("," , $conf['LLGBOFRAME']);
     89                                 $i=0;
     90                                for ($x = 1   ;$x < 32  ; $x =$x +2)
     91                                {       $newcolors[$i]  = $Oldvalues[$x]; 
     92                                        $newsizes[$i]  =  $Oldvalues[$x +1];
     93                                        $i = $i +1;
     94                                }
     95                                $this->default_frame['FR-titlecolor']   =   $Oldvalues[0];
     96                                $this->default_frame['FR-sizes']                =   $newsizes;
     97                                $this->default_frame['FR-colors']               =   $newcolors;
     98                               
     99                                conf_delete_param('LLGBOFRAME');  // old values before 2.7
     100                        }
    90101       
    91                         if (isset($conf['LLGBOFRAME']))  // compatibility 2.6 --> 2.7
    92                                 {        $Oldvalues = explode("," , $conf['LLGBOFRAME']);
    93                                      $i=0;
    94                                         for ($x = 1   ;$x < 32  ; $x =$x +2)
    95                                         {       $newcolors[$i]  = $Oldvalues[$x]; 
    96                                                 $newsizes[$i]  =  $Oldvalues[$x +1];
    97                                                 $i = $i +1;
    98                                         }
    99                        
    100                                                 $this->default_frame['FR-titlecolor']   =   $Oldvalues[0];
    101                                                 $this->default_frame['FR-sizes']                =   $newsizes;
    102                                                 $this->default_frame['FR-colors']               =   $newcolors;
    103                                        
    104                                         conf_delete_param('LLGBOFRAME');  // old values before 2.7
    105                                 }
    106                
    107102// +-----------------------------------------------------------------------+                                   
     103
     104                 if (isset($conf['LLGBOHEADER']))  // compatibility 2.6 --> 2.7
     105                        {       $Oldvalues = explode("," , $conf['LLGBOHEADER']);
     106                                $i = 0;
     107                                foreach($this->default_header['HD-dispheader'] as $cle  => $valeur)
     108                                {       if ($Oldvalues[$i] == 'true' )  {$Oldvalues[$i] = (boolean)true ;} else { $Oldvalues[$i] = (boolean)false;}
     109                                        $this->default_header['HD-dispheader'][$cle] = $Oldvalues[$i];
     110                                        $i = $i +1;}
     111                                conf_delete_param('LLGBOHEADER');  // old values before 2.7
     112                        }
    108113       
    109                          if (isset($conf['LLGBOHEADER']))  // compatibility 2.6 --> 2.7
    110                                 {       $Oldvalues = explode("," , $conf['LLGBOHEADER']);
    111                                         $i = 0;
    112                                         foreach($this->default_header['HD-dispheader'] as $cle  => $valeur)
    113                                         {       if ($Oldvalues[$i] == 'true' )  {$Oldvalues[$i] = (boolean)true ;} else { $Oldvalues[$i] = (boolean)false;}
    114                                                 $this->default_header['HD-dispheader'][$cle] = $Oldvalues[$i];
    115                                                 $i = $i +1;}
    116                                         conf_delete_param('LLGBOHEADER');  // old values before 2.7
    117                                 }
    118                
    119          $conf['LLGBO2'] =array_merge((array)$this->default_main, (array)$this->default_tooltip,(array) $this->default_frame,(array) $this->default_header);
    120                  print_r($this->default_main);
    121                  conf_update_param('LLGBO2_Settings', $conf['LLGBO2']);
    122                 }
     114         $conf['LLGBO2'] =array_merge((array)$this->default_main, (array)$this->default_tooltip,(array) $this->default_frame,(array) $this->default_header);
     115         print_r($this->default_main);
     116         conf_update_param('LLGBO2_Settings', $conf['LLGBO2']);
    123117        }
    124 
     118 }
    125119       
    126 // +-----------------------------------------------------------------------+           
    127120// +-----------------------------------------------------------------------+                   
    128121  function update($old_version, $new_version, &$errors=array())
    129   {
     122        {
    130123    $this->install($new_version, $errors);
    131   }
     124        }
    132125       
    133126// +-----------------------------------------------------------------------+
    134         function uninstall() { 
     127 function uninstall()
     128        { 
    135129                conf_delete_param('LLGBO2_Settings');
    136        
    137130        }
    138131}
Note: See TracChangeset for help on using the changeset viewer.