source: extensions/LLGBO2/maintain.class.php @ 29005

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

Only 1 setting in database

File size: 6.6 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       
36function __construct(){
37// +-----------------------------------------------------------------------+
38// +----------------- default values            ---------------------------+
39// +-----------------------------------------------------------------------+   
40include(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// +----------------- default values            ---------------------------+
49// +-----------------------------------------------------------------------+   
50       
51// +-----------------------------------------------------------------------+
52// +---------------  Install all settings  --------------------------------+
53// +-----------------------------------------------------------------------+
54    function install($plugin_version, &$errors=array()) { 
55                global $conf; 
56// +-----------------------------------------------------------------------+   
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
72                                        }
73                       
74               
75// +-----------------------------------------------------------------------+                           
76                        if  (isset($conf['LLGBOTOOLTIP'])) // compatibility 2.6 --> 2.7
77                                        {        $Oldvalues = explode("," , $conf['LLGBOTOOLTIP']);
78
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// +-----------------------------------------------------------------------+                           
90       
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               
107// +-----------------------------------------------------------------------+                                   
108       
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                }
123        }
124
125       
126// +-----------------------------------------------------------------------+           
127// +-----------------------------------------------------------------------+                   
128  function update($old_version, $new_version, &$errors=array())
129  {
130    $this->install($new_version, $errors);
131  }
132       
133// +-----------------------------------------------------------------------+
134        function uninstall() { 
135                conf_delete_param('LLGBO2_Settings');
136       
137        }
138}
139?>
Note: See TracBrowser for help on using the repository browser.