source: extensions/NBC_UserAdvManager/branches/2.11/maintain.inc.php @ 3882

Last change on this file since 3882 was 3882, checked in by Eric, 15 years ago

V2.11.2 merged from trunk

Bug fixed : Bad query on unvalidated users display
Bug fixed : Sql syntax error on plugin install / update
Language files corrections

  • Property svn:eol-style set to LF
File size: 3.5 KB
Line 
1<?php
2
3if(!defined("NBC_UserAdvManager_PATH"))
4  define('NBC_UserAdvManager_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
5
6include_once (NBC_UserAdvManager_PATH.'include/constants.php');
7
8function plugin_install()
9{
10        global $conf;
11       
12  $q = '
13    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
14    VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;;;false;;","Parametres du plugin nbc UserAdvManager")
15  ;';
16  pwg_query($q);
17
18  $q = '
19    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
20    VALUES ("nbc_UserAdvManager_ConfirmMail","false;5;Hello.
21               
22This is a reminder message because you registered on our gallery but you do not validate your registration and your validation key has expired. To still allow you to access to our gallery, your validation period has been reset. You have again 5 days to validate your registration.
23
24Note: After this period, your account will be permanently deleted.;false;Hello.
25
26This is a reminder message because you registered on our gallery but you do not validate your registration and your validation key will expire. To allow you access to our gallery, you have 2 days to confirm your registration by clicking on the link in the message you should have received when you registered.
27
28Note: After this period, your account will be permanently deleted.","Parametres nbc_UserAdvManager - ConfirmMail")
29  ;';
30  pwg_query($q);
31
32        $q = "
33    CREATE TABLE IF NOT EXISTS ".USER_CONFIRM_MAIL_TABLE." (
34      id varchar(50) NOT NULL default '',
35      user_id smallint(5) NOT NULL default '0',
36      mail_address varchar(255) default NULL,
37      status enum('webmaster','admin','normal','generic','guest') default NULL,
38      date_check datetime default NULL,
39      PRIMARY KEY  (id)
40    )
41  ;";
42  pwg_query($q);
43}
44
45function plugin_activate()
46{
47          global $conf;
48       
49/* Check for upgrade */
50          $query = '
51    SELECT *
52                FROM '.CONFIG_TABLE.'
53    WHERE param = "nbc_UserAdvManager_ConfirmMail"
54  ;';
55  $count = mysql_num_rows(pwg_query($query)); 
56 
57  /* upgrade from branch 2.10 */
58        if ($count == 0)
59        {
60                upgrade_UserAdvManager();
61        }
62}
63
64function plugin_uninstall()
65{
66  global $conf;
67
68  if (isset($conf['nbc_UserAdvManager']))
69  {
70    $q = '
71      DELETE FROM '.CONFIG_TABLE.'
72      WHERE param="nbc_UserAdvManager"
73    ;';
74
75    pwg_query($q);
76  }
77
78  if (isset($conf['nbc_UserAdvManager_ConfirmMail']))
79  {
80    $q = '
81      DELETE FROM '.CONFIG_TABLE.'
82      WHERE param="nbc_UserAdvManager_ConfirmMail"
83    ;';
84
85    pwg_query($q);
86  }
87
88  $q = 'DROP TABLE '.USER_CONFIRM_MAIL_TABLE.';';
89  pwg_query( $q );
90}
91
92function upgrade_UserAdvManager()
93{
94        global $conf;
95         
96  $q = '
97    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
98    VALUES ("nbc_UserAdvManager_ConfirmMail","false;5;Hello.
99               
100This is a reminder message because you registered on our gallery but you do not validate your registration and your validation key has expired. To still allow you to access to our gallery, your validation period has been reset. You have again 5 days to validate your registration.
101
102Note: After this period, your account will be permanently deleted.;false;Hello.
103
104This is a reminder message because you registered on our gallery but you do not validate your registration and your validation key will expire. To allow you access to our gallery, you have 2 days to confirm your registration by clicking on the link in the message you should have received when you registered.
105
106Note: After this period, your account will be permanently deleted.","Parametres nbc_UserAdvManager - ConfirmMail")
107  ;';
108  pwg_query($q);
109}
110?>
Note: See TracBrowser for help on using the repository browser.