source: extensions/LLGBO2/maintain.class.php

Last change on this file was 29862, checked in by gbo, 10 years ago

Fix notice during installation or activation

File size: 6.2 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Plugin Name : Register_llgbo                                          |
4// | Plugin Version : 2.7.0                                                  |
5// | File Version : 2.7.A                                                  |
6// | Plugin Version author : GBo
7// | Plugin description :                                                  |
8// | Ce plugin permet d'afficher les miniatures au survol des boutons      |
9// | de navigation. This plugin allows display thumbnail under buton       |
10// |                                                           |
11// +-----------------------------------------------------------------------+
12// | This program is free software; you can redistribute it and/or modify  |
13// | it under the terms of the GNU General private License as published by  |
14// | the Free Software Foundation                                          |
15// |                                                                       |
16// | This program is distributed in the hope that it will be useful, but   |
17// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
18// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
19// | General private License for more details.                              |
20// |                                                                       |
21// | You should have received a copy of the GNU General private License     |
22// | along with this program; if not, write to the Free Software           |
23// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
24// | USA.                                                                  |
25// +-----------------------------------------------------------------------+
26/*                                      */
27if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
28
29class Look_like_gbo2_maintain extends PluginMaintain
30{ 
31        private $default_main;
32        private $default_tooltip;
33        private $default_frame;
34        private $default_header;
35       
36 function __construct(){
37// +-----------------------------------------------------------------------+
38// +----------------- default values            ---------------------------+
39// +-----------------------------------------------------------------------+   
40 include(PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/' .'defaultvalues.php');
41     // variable declared in include       
42         $this->default_main = $default_main;
43         $this->default_tooltip = $default_tooltip; 
44         $this->default_frame = $default_frame; 
45         $this->default_header = $default_header; 
46 }       
47       
48// +-----------------------------------------------------------------------+
49// +---------------  Install all settings  --------------------------------+
50// +-----------------------------------------------------------------------+
51 function install($plugin_version, &$errors=array()) { 
52        global $conf; 
53// +-----------------------------------------------------------------------+   
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;}
60                                        }
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                                }
84               
85// +-----------------------------------------------------------------------+                           
86
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                        } 
101       
102// +-----------------------------------------------------------------------+                                   
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                        } 
113       
114         $conf['LLGBO2'] =array_merge((array)$this->default_main, (array)$this->default_tooltip,(array) $this->default_frame,(array) $this->default_header);
115         conf_update_param('LLGBO2_Settings', $conf['LLGBO2'],true);   
116        }
117 }
118       
119// +-----------------------------------------------------------------------+                   
120  function update($old_version, $new_version, &$errors=array())
121        {
122    $this->install($new_version, $errors);
123        }
124       
125// +-----------------------------------------------------------------------+
126 function uninstall() 
127        { 
128                conf_delete_param('LLGBO2_Settings');
129        }
130}
131?>
Note: See TracBrowser for help on using the repository browser.