1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | define('default_config' , serialize(array( |
---|
5 | 'menubar_mode' => array( |
---|
6 | 'link' => 0, |
---|
7 | 'block' => 1 |
---|
8 | ), |
---|
9 | 'menubar_link' => array( |
---|
10 | 'menu' => 1, |
---|
11 | 'specials' => 0 |
---|
12 | ), |
---|
13 | 'menubar_block' => array( |
---|
14 | 'number' => 5 |
---|
15 | ) |
---|
16 | ))); |
---|
17 | |
---|
18 | function plugin_install(){ |
---|
19 | global $prefixeTable; |
---|
20 | |
---|
21 | $query = "CREATE TABLE `" . $prefixeTable . "contests` ( |
---|
22 | `id` INT NOT NULL AUTO_INCREMENT , |
---|
23 | `name` VARCHAR( 255 ) NOT NULL , |
---|
24 | `date_begin` DATE NOT NULL , |
---|
25 | `date_end` DATE NOT NULL , |
---|
26 | `status` VARCHAR( 255 ) NOT NULL , |
---|
27 | `visible` TINYINT(1) NOT NULL , |
---|
28 | `logo` VARCHAR( 255 ) NULL , |
---|
29 | `banner` VARCHAR( 255 ) NULL , |
---|
30 | `summary` TEXT NULL , |
---|
31 | `presentation` TEXT NULL , |
---|
32 | `presentation_display` VARCHAR( 255 ) NULL , |
---|
33 | `rules` TEXT NULL , |
---|
34 | `rules_display` VARCHAR( 255 ) NULL , |
---|
35 | `prices` TEXT NULL , |
---|
36 | `prices_display` VARCHAR( 255 ) NULL , |
---|
37 | `final` TEXT NULL , |
---|
38 | `final_display` VARCHAR( 255 ) NULL , |
---|
39 | PRIMARY KEY ( `id` ) |
---|
40 | );"; |
---|
41 | pwg_query($query); |
---|
42 | |
---|
43 | $query = "CREATE TABLE `" . $prefixeTable . "contests_results` ( |
---|
44 | `image_id` INT NOT NULL , |
---|
45 | `contest_id` INT NOT NULL , |
---|
46 | `rank` INT NOT NULL , |
---|
47 | `author` VARCHAR( 255 ) NOT NULL , |
---|
48 | `comment` TEXT NULL, |
---|
49 | UNIQUE ( `image_id` , `contest_id` ) |
---|
50 | );"; |
---|
51 | pwg_query($query); |
---|
52 | |
---|
53 | $query = "INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('ContestResults', '" . default_config . "', 'Parametres du plugin ContestResults');"; |
---|
54 | pwg_query($query); |
---|
55 | } |
---|
56 | |
---|
57 | function plugin_activate(){ |
---|
58 | global $conf; |
---|
59 | |
---|
60 | // compatibilité avec les versions < 1.1 |
---|
61 | if(!isset($conf['ContestResults'])){ |
---|
62 | $query = "INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('ContestResults', '" . default_config . "', 'Parametres du plugin ContestResults');"; |
---|
63 | pwg_query($query); |
---|
64 | } |
---|
65 | } |
---|
66 | |
---|
67 | function plugin_uninstall(){ |
---|
68 | global $prefixeTable; |
---|
69 | |
---|
70 | $query = "DROP TABLE `" . $prefixeTable . "contests`;"; |
---|
71 | pwg_query($query); |
---|
72 | |
---|
73 | $query = "DROP TABLE `" . $prefixeTable . "contests_results`;"; |
---|
74 | pwg_query($query); |
---|
75 | |
---|
76 | $query = "DELETE FROM " . CONFIG_TABLE . " WHERE `param` = 'ContestResults';"; |
---|
77 | pwg_query($query); |
---|
78 | } |
---|
79 | ?> |
---|