source: extensions/NBC_UserAdvManager/trunk/maintain.inc.php @ 4124

Last change on this file since 4124 was 4124, checked in by Eric, 14 years ago

[NBC_UserAdvManager] pre 2.12.0 :

  • Adding of password enforcement control function
  • Main code refactory
  • French language file refactory
  • Admin panel refactory
  • Property svn:eol-style set to LF
File size: 3.5 KB
RevLine 
[3742]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{
[3872]10        global $conf;
11       
[3742]12  $q = '
13    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
[4124]14    VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;;;false;;false;100;false","Parametres du plugin nbc UserAdvManager")
[3742]15  ;';
16  pwg_query($q);
17
18  $q = '
19    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
[3881]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.
[3872]23
[3881]24Note: After this period, your account will be permanently deleted.;false;Hello.
[3872]25
[3881]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.
[3872]27
28Note: After this period, your account will be permanently deleted.","Parametres nbc_UserAdvManager - ConfirmMail")
[3742]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
[3872]45function plugin_activate()
46{
47          global $conf;
48       
49/* Check for upgrade */
50          $query = '
[3881]51    SELECT *
[3872]52                FROM '.CONFIG_TABLE.'
53    WHERE param = "nbc_UserAdvManager_ConfirmMail"
54  ;';
[3881]55  $count = mysql_num_rows(pwg_query($query)); 
[3872]56 
57  /* upgrade from branch 2.10 */
58        if ($count == 0)
59        {
[4061]60                upgrade_210();
[3872]61        }
62}
[3742]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
[3881]78  if (isset($conf['nbc_UserAdvManager_ConfirmMail']))
79  {
80    $q = '
81      DELETE FROM '.CONFIG_TABLE.'
82      WHERE param="nbc_UserAdvManager_ConfirmMail"
83    ;';
[3742]84
[3881]85    pwg_query($q);
86  }
87
[3742]88  $q = 'DROP TABLE '.USER_CONFIRM_MAIL_TABLE.';';
89  pwg_query( $q );
90}
[3872]91
[4061]92function upgrade_210()
[3872]93{
94        global $conf;
95         
96  $q = '
97    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
[3881]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.
[3872]101
[3881]102Note: After this period, your account will be permanently deleted.;false;Hello.
[3872]103
[3881]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.
[3872]105
106Note: After this period, your account will be permanently deleted.","Parametres nbc_UserAdvManager - ConfirmMail")
107  ;';
108  pwg_query($q);
109}
[3742]110?>
Note: See TracBrowser for help on using the repository browser.