1 | <?php |
---|
2 | |
---|
3 | if(!defined("NBC_UserAdvManager_PATH")) |
---|
4 | define('NBC_UserAdvManager_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
5 | |
---|
6 | include_once (NBC_UserAdvManager_PATH.'include/constants.php'); |
---|
7 | include_once (NBC_UserAdvManager_PATH.'include/functions_UserAdvManager.inc.php'); |
---|
8 | |
---|
9 | function plugin_install() |
---|
10 | { |
---|
11 | global $conf; |
---|
12 | |
---|
13 | $q = ' |
---|
14 | INSERT INTO '.CONFIG_TABLE.' (param, value, comment) |
---|
15 | VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;;;false;;false;100;false;false;10;Hello. |
---|
16 | |
---|
17 | This is a reminder because a very long time passed since your last visit on our gallery. If you do not want anymore to use your access account, please let us know by replying to this email. Your account will be deleted. |
---|
18 | |
---|
19 | On receipt of this message and no new visit within 15 days, we would be obliged to automatically delete your account. |
---|
20 | |
---|
21 | Best regards, |
---|
22 | |
---|
23 | The admin of the gallery.","Parametres du plugin nbc UserAdvManager") |
---|
24 | ;'; |
---|
25 | pwg_query($q); |
---|
26 | |
---|
27 | $q = ' |
---|
28 | INSERT INTO '.CONFIG_TABLE.' (param, value, comment) |
---|
29 | VALUES ("nbc_UserAdvManager_ConfirmMail","false;5;Hello. |
---|
30 | |
---|
31 | This 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. |
---|
32 | |
---|
33 | Note: After this period, your account will be permanently deleted.;false;Hello. |
---|
34 | |
---|
35 | This 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. |
---|
36 | |
---|
37 | Note: After this period, your account will be permanently deleted.","Parametres nbc_UserAdvManager - ConfirmMail") |
---|
38 | ;'; |
---|
39 | pwg_query($q); |
---|
40 | |
---|
41 | $q = " |
---|
42 | CREATE TABLE IF NOT EXISTS ".USER_CONFIRM_MAIL_TABLE." ( |
---|
43 | id varchar(50) NOT NULL default '', |
---|
44 | user_id smallint(5) NOT NULL default '0', |
---|
45 | mail_address varchar(255) default NULL, |
---|
46 | status enum('webmaster','admin','normal','generic','guest') default NULL, |
---|
47 | date_check datetime default NULL, |
---|
48 | PRIMARY KEY (id) |
---|
49 | ) |
---|
50 | ;"; |
---|
51 | pwg_query($q); |
---|
52 | |
---|
53 | $q = " |
---|
54 | CREATE TABLE IF NOT EXISTS ".USER_LASTVISIT_TABLE." ( |
---|
55 | user_id SMALLINT(5) NOT NULL DEFAULT '0', |
---|
56 | lastvisit DATETIME NULL DEFAULT NULL, |
---|
57 | reminder ENUM('true','false') NULL, |
---|
58 | PRIMARY KEY (`user_id`) |
---|
59 | ) |
---|
60 | ;"; |
---|
61 | pwg_query($q); |
---|
62 | } |
---|
63 | |
---|
64 | function plugin_activate() |
---|
65 | { |
---|
66 | global $conf; |
---|
67 | |
---|
68 | /* Check for upgrade from 2.10 */ |
---|
69 | $query = ' |
---|
70 | SELECT * |
---|
71 | FROM '.CONFIG_TABLE.' |
---|
72 | WHERE param = "nbc_UserAdvManager_ConfirmMail" |
---|
73 | ;'; |
---|
74 | $count = mysql_num_rows(pwg_query($query)); |
---|
75 | |
---|
76 | /* upgrade from branch 2.10 */ |
---|
77 | if ($count == 0) |
---|
78 | { |
---|
79 | upgrade_210(); |
---|
80 | } |
---|
81 | |
---|
82 | /* Check for upgrade from 2.11 */ |
---|
83 | if (!table_exist(USER_LASTVISIT_TABLE)) |
---|
84 | { |
---|
85 | /* upgrade from branch 2.11 */ |
---|
86 | upgrade_211(); |
---|
87 | } |
---|
88 | } |
---|
89 | |
---|
90 | |
---|
91 | function plugin_uninstall() |
---|
92 | { |
---|
93 | global $conf; |
---|
94 | |
---|
95 | if (isset($conf['nbc_UserAdvManager'])) |
---|
96 | { |
---|
97 | $q = ' |
---|
98 | DELETE FROM '.CONFIG_TABLE.' |
---|
99 | WHERE param="nbc_UserAdvManager" |
---|
100 | ;'; |
---|
101 | |
---|
102 | pwg_query($q); |
---|
103 | } |
---|
104 | |
---|
105 | if (isset($conf['nbc_UserAdvManager_ConfirmMail'])) |
---|
106 | { |
---|
107 | $q = ' |
---|
108 | DELETE FROM '.CONFIG_TABLE.' |
---|
109 | WHERE param="nbc_UserAdvManager_ConfirmMail" |
---|
110 | ;'; |
---|
111 | |
---|
112 | pwg_query($q); |
---|
113 | } |
---|
114 | |
---|
115 | $q = 'DROP TABLE '.USER_CONFIRM_MAIL_TABLE.';'; |
---|
116 | pwg_query( $q ); |
---|
117 | |
---|
118 | $q = 'DROP TABLE '.USER_LASTVISIT_TABLE.';'; |
---|
119 | pwg_query( $q ); |
---|
120 | } |
---|
121 | |
---|
122 | /* upgrade from branch 2.10 */ |
---|
123 | function upgrade_210() |
---|
124 | { |
---|
125 | global $conf; |
---|
126 | |
---|
127 | $q = ' |
---|
128 | INSERT INTO '.CONFIG_TABLE.' (param, value, comment) |
---|
129 | VALUES ("nbc_UserAdvManager_ConfirmMail","false;5;Hello. |
---|
130 | |
---|
131 | This 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. |
---|
132 | |
---|
133 | Note: After this period, your account will be permanently deleted.;false;Hello. |
---|
134 | |
---|
135 | This 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. |
---|
136 | |
---|
137 | Note: After this period, your account will be permanently deleted.","Parametres nbc_UserAdvManager - ConfirmMail") |
---|
138 | ;'; |
---|
139 | pwg_query($q); |
---|
140 | |
---|
141 | upgrade_211(); |
---|
142 | } |
---|
143 | |
---|
144 | /* upgrade from branch 2.11 */ |
---|
145 | function upgrade_211() |
---|
146 | { |
---|
147 | global $conf; |
---|
148 | |
---|
149 | $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array(); |
---|
150 | |
---|
151 | if ((!isset($conf_nbc_UserAdvManager[14]) and !isset($conf_nbc_UserAdvManager[15])) and !isset($conf_nbc_UserAdvManager[16]) and !isset($conf_nbc_UserAdvManager[17])) |
---|
152 | { |
---|
153 | $upgrade_nbc_UserAdvManager = $conf_nbc_UserAdvManager[0].';'.$conf_nbc_UserAdvManager[1].';'.$conf_nbc_UserAdvManager[2].';'.$conf_nbc_UserAdvManager[3].';'.$conf_nbc_UserAdvManager[4].';'.$conf_nbc_UserAdvManager[5].';'.$conf_nbc_UserAdvManager[6].';'.$conf_nbc_UserAdvManager[7].';'.$conf_nbc_UserAdvManager[8].';'.$conf_nbc_UserAdvManager[9].';'.$conf_nbc_UserAdvManager[10].';'.$conf_nbc_UserAdvManager[11].';'.$conf_nbc_UserAdvManager[12].';'.$conf_nbc_UserAdvManager[13].';false;100;false;false;10;Hello. |
---|
154 | |
---|
155 | This is a reminder because a very long time passed since your last visit on our gallery. If you do not want anymore to use your access account, please let us know by replying to this email. Your account will be deleted. |
---|
156 | |
---|
157 | On receipt of this message and no new visit within 15 days, we would be obliged to automatically delete your account. |
---|
158 | |
---|
159 | Best regards, |
---|
160 | |
---|
161 | The admin of the gallery.'; |
---|
162 | |
---|
163 | $query = ' |
---|
164 | UPDATE '.CONFIG_TABLE.' |
---|
165 | SET value="'.$upgrade_nbc_UserAdvManager.'" |
---|
166 | WHERE param="nbc_UserAdvManager" |
---|
167 | LIMIT 1 |
---|
168 | ;'; |
---|
169 | pwg_query($query); |
---|
170 | } |
---|
171 | |
---|
172 | $q = " |
---|
173 | CREATE TABLE IF NOT EXISTS ".USER_LASTVISIT_TABLE." ( |
---|
174 | user_id SMALLINT(5) NOT NULL DEFAULT '0', |
---|
175 | lastvisit DATETIME NULL DEFAULT NULL, |
---|
176 | reminder ENUM('true','false') NULL, |
---|
177 | PRIMARY KEY (`user_id`) |
---|
178 | ) |
---|
179 | ;"; |
---|
180 | pwg_query($q); |
---|
181 | } |
---|
182 | ?> |
---|