1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | // Configuration par défaut |
---|
5 | define('default_config', serialize(array( |
---|
6 | 'menubar_mode' => array( |
---|
7 | 'link' => 0, |
---|
8 | 'block' => 1, |
---|
9 | ), |
---|
10 | 'menubar_link' => array( |
---|
11 | 'menu' => 1, |
---|
12 | 'specials' => 0, |
---|
13 | ), |
---|
14 | 'menubar_block' => array( |
---|
15 | 'number' => 5, |
---|
16 | 'display_days' => true, |
---|
17 | ), |
---|
18 | 'truncate_summary' => 350, |
---|
19 | ))); |
---|
20 | |
---|
21 | // Installation |
---|
22 | function plugin_install() { |
---|
23 | global $prefixeTable; |
---|
24 | |
---|
25 | pwg_query("CREATE TABLE `" . $prefixeTable . "contests` ( |
---|
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 , |
---|
33 | `summary` TEXT NULL , |
---|
34 | `description` TEXT NULL , |
---|
35 | PRIMARY KEY ( `id` ) |
---|
36 | ) DEFAULT CHARSET=utf8;"); |
---|
37 | |
---|
38 | pwg_query("CREATE TABLE `" . $prefixeTable . "contests_results` ( |
---|
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` ) |
---|
45 | ) DEFAULT CHARSET=utf8;"); |
---|
46 | |
---|
47 | pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('ContestResults', '" . default_config . "', 'Parametres du plugin ContestResults');"); |
---|
48 | } |
---|
49 | |
---|
50 | // Activation |
---|
51 | function plugin_activate(){ |
---|
52 | global $conf, $prefixeTable; |
---|
53 | |
---|
54 | include('include/compatibility.inc.php'); |
---|
55 | } |
---|
56 | |
---|
57 | // Désinstallation |
---|
58 | function plugin_uninstall() { |
---|
59 | global $prefixeTable; |
---|
60 | |
---|
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';"); |
---|
64 | } |
---|
65 | ?> |
---|