1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | function plugin_install() { |
---|
5 | global $prefixeTable; |
---|
6 | |
---|
7 | require_once('install/functions.inc.php'); |
---|
8 | |
---|
9 | $query = 'SHOW TABLES LIKE "'.$prefixeTable.'piwecard"'; |
---|
10 | $result = pwg_query($query); |
---|
11 | if (!pwg_db_fetch_row($result)) { |
---|
12 | piwecard_db_create($prefixeTable.'piwecard'); |
---|
13 | piwecard_conf_create('piwecard'); |
---|
14 | } |
---|
15 | } |
---|
16 | |
---|
17 | function plugin_activate() { |
---|
18 | global $prefixeTable, $conf; |
---|
19 | |
---|
20 | require_once('install/functions.inc.php'); |
---|
21 | |
---|
22 | $query_ecard = 'SHOW TABLES LIKE "'.$prefixeTable.'ecard"'; |
---|
23 | $result_ecard = pwg_query($query_ecard); |
---|
24 | $query_piwecard = 'SHOW TABLES LIKE "'.$prefixeTable.'piwecard"'; |
---|
25 | $result_piwecard = pwg_query($query_piwecard); |
---|
26 | if (pwg_db_num_rows($result_ecard) != 0) { //Update old configs |
---|
27 | if (pwg_db_num_rows($result_piwecard) == 0){ |
---|
28 | piwecard_db_create($prefixeTable.'piwecard'); |
---|
29 | piwecard_db_update_from_2_3($prefixeTable.'ecard', $prefixeTable.'piwecard'); |
---|
30 | } |
---|
31 | piwecard_db_delete($prefixeTable.'ecard'); |
---|
32 | |
---|
33 | piwecard_conf_rename('ecard', 'piwecard'); |
---|
34 | } |
---|
35 | |
---|
36 | $query_unique_id = 'SHOW COLUMNS FROM '.$prefixeTable.'piwecard LIKE "unique_id"'; |
---|
37 | $result_unique_id = pwg_query($query_unique_id); |
---|
38 | if(pwg_db_num_rows($result_unique_id) == 0) { |
---|
39 | piwecard_db_update_from_2_4a_b3($prefixeTable.'piwecard'); |
---|
40 | } |
---|
41 | |
---|
42 | if (empty($conf['piwecard'])) |
---|
43 | { |
---|
44 | if (!defined('PIWECARD_INSTALL_PATH')) |
---|
45 | { |
---|
46 | define('PIWECARD_INSTALL_PATH', PHPWG_PLUGINS_PATH.'Piwecard/install/'); |
---|
47 | } |
---|
48 | |
---|
49 | load_language('plugin.lang', PHPWG_PLUGINS_PATH.'Piwecard'); |
---|
50 | |
---|
51 | require_once('include/piwecard.class.php'); |
---|
52 | $piwecard = new Piwecard(); |
---|
53 | $piwecard->get_default_config(); |
---|
54 | $piwecard->set_config(); |
---|
55 | } |
---|
56 | } |
---|
57 | |
---|
58 | function plugin_uninstall() { |
---|
59 | global $prefixeTable; |
---|
60 | |
---|
61 | require_once('install/functions.inc.php'); |
---|
62 | |
---|
63 | piwecard_db_delete($prefixeTable.'piwecard'); |
---|
64 | piwecard_conf_delete('piwecard'); |
---|
65 | } |
---|