1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | function plugin_install() |
---|
6 | { |
---|
7 | global $prefixeTable, $conf; |
---|
8 | |
---|
9 | $query = 'SHOW TABLES LIKE "' . $prefixeTable . 'wfs_%"'; |
---|
10 | $result = pwg_query($query); |
---|
11 | if (!pwg_db_fetch_assoc($result)) |
---|
12 | { |
---|
13 | $q = 'CREATE TABLE ' . $prefixeTable . 'wfs_img_cat_sound( |
---|
14 | image_id MEDIUMINT( 8 ) UNSIGNED default NULL , |
---|
15 | cat_id MEDIUMINT( 8 ) default NULL , |
---|
16 | sound_id SMALLINT( 5 ) NOT NULL , |
---|
17 | volume SMALLINT ( 3 ) UNSIGNED default NULL , |
---|
18 | INDEX (image_id) , |
---|
19 | INDEX (cat_id), |
---|
20 | INDEX (sound_id)) |
---|
21 | DEFAULT CHARACTER SET utf8;'; |
---|
22 | pwg_query($q); |
---|
23 | |
---|
24 | $q = 'CREATE TABLE ' . $prefixeTable . 'wfs_sounds ( |
---|
25 | id SMALLINT( 5 ) NOT NULL , |
---|
26 | file VARCHAR( 255 ) NOT NULL , |
---|
27 | PRIMARY KEY (id)) |
---|
28 | DEFAULT CHARACTER SET utf8;'; |
---|
29 | pwg_query($q); |
---|
30 | } |
---|
31 | |
---|
32 | if (!isset($conf['wired_for_sound'])) |
---|
33 | { |
---|
34 | $q = ' |
---|
35 | INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) |
---|
36 | VALUES |
---|
37 | ("wired_for_sound" , "plugins/WiredForSound/mp3/,100,44,1,0" , "Parametres du plugin WiredForSound");'; |
---|
38 | |
---|
39 | pwg_query($q); |
---|
40 | } |
---|
41 | } |
---|
42 | |
---|
43 | function plugin_uninstall() |
---|
44 | { |
---|
45 | global $prefixeTable; |
---|
46 | |
---|
47 | $q = 'DROP TABLE ' . $prefixeTable . 'wfs_img_cat_sound;'; |
---|
48 | pwg_query($q); |
---|
49 | |
---|
50 | $q = 'DROP TABLE ' . $prefixeTable . 'wfs_sounds;'; |
---|
51 | pwg_query($q); |
---|
52 | |
---|
53 | $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="wired_for_sound" LIMIT 1;'; |
---|
54 | pwg_query($q); |
---|
55 | } |
---|
56 | |
---|
57 | ?> |
---|