[8771] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * Plugin Name: Piwecard |
---|
| 4 | * File : maintain.inc.php |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | function plugin_install() |
---|
| 11 | { |
---|
| 12 | global $prefixeTable, $conf; |
---|
| 13 | |
---|
| 14 | $query = 'SHOW TABLES LIKE "' . $prefixeTable . 'ecard"'; |
---|
| 15 | $result = pwg_query($query); |
---|
| 16 | if (!mysql_fetch_row($result)) |
---|
| 17 | { |
---|
| 18 | |
---|
| 19 | // ecard description |
---|
| 20 | $q = 'CREATE TABLE `' . $prefixeTable . 'ecard` ( |
---|
| 21 | `numero` CHAR(15) not null, |
---|
| 22 | `nomexp` CHAR(100) not null, |
---|
| 23 | `nomdest` CHAR(100) not null, |
---|
| 24 | `adrexp` CHAR(100) not null, |
---|
| 25 | `adrdest` CHAR(100) not null, |
---|
| 26 | `sujet` CHAR(100) not null, |
---|
| 27 | `message` TEXT not null, |
---|
| 28 | `image` smallint(5) not null, |
---|
| 29 | `date` datetime NOT NULL, |
---|
| 30 | `duration` smallint(5) not null default 10, |
---|
| 31 | PRIMARY KEY (`numero`), |
---|
| 32 | UNIQUE (`numero`) |
---|
| 33 | ) DEFAULT CHARSET=utf8;'; |
---|
| 34 | pwg_query($q); |
---|
| 35 | |
---|
| 36 | $q = ' |
---|
| 37 | INSERT INTO '.CONFIG_TABLE.' (param,value,comment) |
---|
| 38 | VALUES ("ecard","","Configuration ecard") |
---|
| 39 | ;'; |
---|
| 40 | |
---|
| 41 | pwg_query($q); |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | function plugin_activate() |
---|
| 50 | { |
---|
| 51 | |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | function plugin_uninstall() |
---|
| 55 | { |
---|
| 56 | global $prefixeTable; |
---|
| 57 | |
---|
| 58 | $q = 'DROP TABLE ' . $prefixeTable . 'ecard;'; |
---|
| 59 | pwg_query($q); |
---|
| 60 | |
---|
| 61 | $q = ' |
---|
| 62 | DELETE FROM '.CONFIG_TABLE.' |
---|
| 63 | WHERE param="ecard" LIMIT 1 |
---|
| 64 | ;'; |
---|
| 65 | pwg_query($q); |
---|
| 66 | |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | ?> |
---|