[8771] | 1 | <?php |
---|
| 2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 3 | |
---|
[19732] | 4 | function plugin_install() { |
---|
[19956] | 5 | global $prefixeTable; |
---|
[8771] | 6 | |
---|
[19956] | 7 | require_once('install/functions.inc.php'); |
---|
| 8 | |
---|
| 9 | $query = 'SHOW TABLES LIKE "'.$prefixeTable.'piwecard"'; |
---|
[8771] | 10 | $result = pwg_query($query); |
---|
[19956] | 11 | if (!pwg_db_fetch_row($result)) { |
---|
| 12 | piwecard_db_create($prefixeTable.'piwecard'); |
---|
| 13 | piwecard_conf_create('piwecard'); |
---|
[8771] | 14 | } |
---|
| 15 | } |
---|
| 16 | |
---|
[19732] | 17 | function plugin_activate() { |
---|
[30184] | 18 | global $prefixeTable, $conf; |
---|
[19956] | 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'); |
---|
[20202] | 29 | piwecard_db_update_from_2_3($prefixeTable.'ecard', $prefixeTable.'piwecard'); |
---|
[19956] | 30 | } |
---|
| 31 | piwecard_db_delete($prefixeTable.'ecard'); |
---|
| 32 | |
---|
| 33 | piwecard_conf_rename('ecard', 'piwecard'); |
---|
| 34 | } |
---|
[20202] | 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 | } |
---|
[30184] | 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 | } |
---|
[8771] | 56 | } |
---|
| 57 | |
---|
[19732] | 58 | function plugin_uninstall() { |
---|
[19956] | 59 | global $prefixeTable; |
---|
[8771] | 60 | |
---|
[19956] | 61 | require_once('install/functions.inc.php'); |
---|
| 62 | |
---|
| 63 | piwecard_db_delete($prefixeTable.'piwecard'); |
---|
| 64 | piwecard_conf_delete('piwecard'); |
---|
[8771] | 65 | } |
---|