[6768] | 1 | <?php |
---|
| 2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 3 | |
---|
[9200] | 4 | // Configuration par défaut |
---|
[9572] | 5 | define('default_config', serialize(array( |
---|
[6768] | 6 | 'menubar_mode' => array( |
---|
| 7 | 'link' => 0, |
---|
[9975] | 8 | 'block' => 1, |
---|
[6768] | 9 | ), |
---|
| 10 | 'menubar_link' => array( |
---|
| 11 | 'menu' => 1, |
---|
[9975] | 12 | 'specials' => 0, |
---|
[6768] | 13 | ), |
---|
| 14 | 'menubar_block' => array( |
---|
[9975] | 15 | 'number' => 5, |
---|
| 16 | 'display_days' => true, |
---|
[9745] | 17 | ), |
---|
| 18 | 'truncate_summary' => 350, |
---|
[6770] | 19 | ))); |
---|
[6768] | 20 | |
---|
[9745] | 21 | // Installation |
---|
[9200] | 22 | function plugin_install() { |
---|
[6768] | 23 | global $prefixeTable; |
---|
| 24 | |
---|
[9200] | 25 | pwg_query("CREATE TABLE `" . $prefixeTable . "contests` ( |
---|
[6768] | 26 | `id` INT NOT NULL AUTO_INCREMENT , |
---|
| 27 | `name` VARCHAR( 255 ) NOT NULL , |
---|
| 28 | `date_begin` DATE NOT NULL , |
---|
| 29 | `date_end` DATE NOT NULL , |
---|
| 30 | `visible` TINYINT(1) NOT NULL , |
---|
| 31 | `logo` VARCHAR( 255 ) NULL , |
---|
| 32 | `banner` VARCHAR( 255 ) NULL , |
---|
[9745] | 33 | `summary` TEXT NULL , |
---|
[9572] | 34 | `description` TEXT NULL , |
---|
[6768] | 35 | PRIMARY KEY ( `id` ) |
---|
[9745] | 36 | ) DEFAULT CHARSET=utf8;"); |
---|
[6768] | 37 | |
---|
[9200] | 38 | pwg_query("CREATE TABLE `" . $prefixeTable . "contests_results` ( |
---|
[6768] | 39 | `image_id` INT NOT NULL , |
---|
| 40 | `contest_id` INT NOT NULL , |
---|
| 41 | `rank` INT NOT NULL , |
---|
| 42 | `author` VARCHAR( 255 ) NOT NULL , |
---|
| 43 | `comment` TEXT NULL, |
---|
| 44 | UNIQUE ( `image_id` , `contest_id` ) |
---|
[9745] | 45 | ) DEFAULT CHARSET=utf8;"); |
---|
[6768] | 46 | |
---|
[9200] | 47 | pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('ContestResults', '" . default_config . "', 'Parametres du plugin ContestResults');"); |
---|
[6768] | 48 | } |
---|
| 49 | |
---|
[9200] | 50 | // Activation |
---|
[6768] | 51 | function plugin_activate(){ |
---|
[9200] | 52 | global $conf, $prefixeTable; |
---|
[6782] | 53 | |
---|
[9745] | 54 | include('include/compatibility.inc.php'); |
---|
[6768] | 55 | } |
---|
| 56 | |
---|
[9200] | 57 | // Désinstallation |
---|
| 58 | function plugin_uninstall() { |
---|
[6768] | 59 | global $prefixeTable; |
---|
| 60 | |
---|
[9200] | 61 | pwg_query("DROP TABLE `" . $prefixeTable . "contests`;"); |
---|
| 62 | pwg_query("DROP TABLE `" . $prefixeTable . "contests_results`;"); |
---|
| 63 | pwg_query("DELETE FROM " . CONFIG_TABLE . " WHERE `param` = 'ContestResults';"); |
---|
[6768] | 64 | } |
---|
| 65 | ?> |
---|