source: extensions/Mail_supervisor/maintain.inc.php @ 4051

Last change on this file since 4051 was 4051, checked in by cljosse, 15 years ago

[mail_supervisor] bug in first install

File size: 3.4 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based picture gallery                                  |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
6// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
7// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
8// +-----------------------------------------------------------------------+
9// | This program is free software; you can redistribute it and/or modify  |
10// | it under the terms of the GNU General Public License as published by  |
11// | the Free Software Foundation                                          |
12// |                                                                       |
13// | This program is distributed in the hope that it will be useful, but   |
14// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
15// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
16// | General Public License for more details.                              |
17// |                                                                       |
18// | You should have received a copy of the GNU General Public License     |
19// | along with this program; if not, write to the Free Software           |
20// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
21// | USA.                                                                  |
22// +-----------------------------------------------------------------------+
23if  (!defined('PHPWG_ROOT_PATH')) 
24{
25  die('Hacking attempt!');
26}
27
28
29if (!defined('MAIL_SUPERV_DIR')) define('MAIL_SUPERV_DIR' , basename(dirname(__FILE__)));
30if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
31
32include_once (MAIL_SUPERV_PATH.'include/constants.php');
33include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
34
35function plugin_install()
36{
37
38// efface free mail
39$q = '
40  SELECT  count(`id`) as total   FROM `'.PLUGINS_TABLE.'` WHERE `id` LIKE "free_mail"   ;';
41     $plugs = mysql_fetch_array(pwg_query($q));
42 $nb= $plugs['total'];
43
44  if (count($nb)>=1) { 
45 /*          $q = '
46UPDATE ' . PLUGINS_TABLE . ' SET state="inactive" WHERE `id` LIKE "free_mail"';
47        pwg_query($q);
48   pwg_query( $q );*/
49      $q = '
50      DELETE FROM '.PLUGINS_TABLE.'
51      WHERE `id` LIKE "free_mail"
52    ;';
53    pwg_query($q);             
54        $q = 'DROP TABLE IF EXISTS '.FREE_MAIL_TABLE.';';
55                 
56   pwg_query( $q );
57      $q = '
58      DELETE FROM '.CONFIG_TABLE.'
59      WHERE param="free_mail"
60    ;';
61    pwg_query($q);
62       
63       
64               
65 }
66
67
68         
69   pwg_query( $q );
70      $q = '
71      DELETE FROM '.CONFIG_TABLE.'
72      WHERE param="mail_superv"
73    ;';
74    pwg_query($q);
75               
76 
77  $q = '
78    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
79    VALUES ("mail_superv","on,on,off ,off,off","Parametres du plugin Mail superviseur")
80  ;';
81  pwg_query($q);
82
83
84        vérif_base();
85
86}
87
88
89
90function plugin_uninstall()
91{
92  global $conf;
93
94  if (isset($conf['mail_superv']))
95  {
96
97    $q = '
98      DELETE FROM '.CONFIG_TABLE.'
99      WHERE param="mail_superv"
100    ;';
101
102    pwg_query($q);
103
104
105
106  $q = 'DROP TABLE '.MAIL_SUPERV_TABLE.';';
107   pwg_query( $q );
108   }
109 
110}
111
112
113
114?>
Note: See TracBrowser for help on using the repository browser.