1 | <?php |
---|
2 | |
---|
3 | if(!defined("REGPHPBB_DIR")) define('REGPHPBB_DIR' , basename(dirname(__FILE__))); |
---|
4 | if(!defined("REGPHPBB_PATH")) define('REGPHPBB_PATH' , PHPWG_PLUGINS_PATH.REGPHPBB_DIR.'/'); |
---|
5 | //ini_set('error_reporting', E_ALL); |
---|
6 | //ini_set('display_errors', true); |
---|
7 | |
---|
8 | include_once (PHPWG_ROOT_PATH.'/include/constants.php'); |
---|
9 | include_once (REGPHPBB_PATH.'include/constants.php'); |
---|
10 | include_once (REGPHPBB_PATH.'include/functions.inc.php'); |
---|
11 | |
---|
12 | |
---|
13 | function plugin_install() |
---|
14 | { |
---|
15 | global $prefixeTable; |
---|
16 | |
---|
17 | $q = ' |
---|
18 | INSERT INTO '.CONFIG_TABLE.' (param,value,comment) |
---|
19 | VALUES ("Register_PhpBB","phpbb_;admin;Anonymous;false;true;false;REGISTERED","Parametres Register_PhpBB") |
---|
20 | ;'; |
---|
21 | |
---|
22 | pwg_query($q); |
---|
23 | |
---|
24 | $q = " |
---|
25 | CREATE TABLE IF NOT EXISTS ".Register_PhpBB_ID_TABLE." ( |
---|
26 | id_user_pwg smallint(5) NOT NULL default '0', |
---|
27 | id_user_PhpBB int(10) NOT NULL default '0', |
---|
28 | PRIMARY KEY (id_user_pwg), |
---|
29 | KEY id_user_pwg (id_user_pwg, id_user_PhpBB) |
---|
30 | ) |
---|
31 | ;"; |
---|
32 | |
---|
33 | pwg_query($q); |
---|
34 | |
---|
35 | } |
---|
36 | |
---|
37 | function plugin_activate() |
---|
38 | { |
---|
39 | global $conf; |
---|
40 | |
---|
41 | /* Cleaning obsolete files */ |
---|
42 | /* *********************** */ |
---|
43 | regphpbb_obsolete_files(); |
---|
44 | |
---|
45 | /* Check version < 2.3.0 */ |
---|
46 | $conf_Register_PhpBB = isset($conf['Register_PhpBB']) ? explode(";" , $conf['Register_PhpBB']) : array(); |
---|
47 | |
---|
48 | if (!isset($conf_Register_PhpBB[5]) and !isset($conf_Register_PhpBB[6])) |
---|
49 | { |
---|
50 | $upgrade_RFBB = $conf_Register_PhpBB[0].';'.$conf_Register_PhpBB[1].';'.$conf_Register_PhpBB[2].';'.$conf_Register_PhpBB[3].';'.$conf_Register_PhpBB[4].';false;REGISTERED'; |
---|
51 | |
---|
52 | $query = ' |
---|
53 | UPDATE '.CONFIG_TABLE.' |
---|
54 | SET value="'.$upgrade_RFBB.'" |
---|
55 | WHERE param="Register_PhpBB" |
---|
56 | LIMIT 1 |
---|
57 | ;'; |
---|
58 | pwg_query($query); |
---|
59 | } |
---|
60 | } |
---|
61 | |
---|
62 | function plugin_uninstall() |
---|
63 | { |
---|
64 | global $conf; |
---|
65 | |
---|
66 | if (isset($conf['Register_PhpBB'])) |
---|
67 | { |
---|
68 | $q = ' |
---|
69 | DELETE FROM '.CONFIG_TABLE.' |
---|
70 | WHERE param="Register_PhpBB" LIMIT 1 |
---|
71 | ;'; |
---|
72 | |
---|
73 | pwg_query($q); |
---|
74 | } |
---|
75 | |
---|
76 | $q = 'DROP TABLE '.Register_PhpBB_ID_TABLE.';'; |
---|
77 | pwg_query( $q ); |
---|
78 | |
---|
79 | } |
---|
80 | ?> |
---|