Last change
on this file since 19144 was
15149,
checked in by mistic100, 12 years ago
|
- display typetags everywhere (not only tags page)
- little redesign of admin page + code cleaning
|
File size:
1.2 KB
|
Line | |
---|
1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | function plugin_install() |
---|
5 | { |
---|
6 | global $prefixeTable; |
---|
7 | |
---|
8 | $query = 'SHOW FULL COLUMNS FROM ' . TAGS_TABLE . ';'; |
---|
9 | $result = array_from_query($query, 'Field'); |
---|
10 | if (!in_array('id_typetags', $result)) |
---|
11 | { |
---|
12 | pwg_query('ALTER TABLE '.TAGS_TABLE.' ADD COLUMN `id_typetags` SMALLINT(5);'); |
---|
13 | } |
---|
14 | |
---|
15 | $result = pwg_query('SHOW TABLES LIKE "' . $prefixeTable .'typetags"'); |
---|
16 | if (!mysql_fetch_row($result)) |
---|
17 | { |
---|
18 | $query = ' |
---|
19 | CREATE TABLE `'. $prefixeTable .'typetags` ( |
---|
20 | `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
---|
21 | `name` varchar(255) NOT NULL, |
---|
22 | `color` varchar(255) NOT NULL, |
---|
23 | PRIMARY KEY (`id`) |
---|
24 | ) DEFAULT CHARSET=utf8 |
---|
25 | ;'; |
---|
26 | pwg_query($query); |
---|
27 | } |
---|
28 | |
---|
29 | conf_update_param('TypeTags', serialize(array('show_all'=>true))); |
---|
30 | } |
---|
31 | |
---|
32 | function plugin_activate() |
---|
33 | { |
---|
34 | global $conf; |
---|
35 | |
---|
36 | if (!isset($conf['TypeTags'])) |
---|
37 | { |
---|
38 | conf_update_param('TypeTags', serialize(array('show_all'=>true))); |
---|
39 | } |
---|
40 | } |
---|
41 | |
---|
42 | function plugin_uninstall() |
---|
43 | { |
---|
44 | global $prefixeTable; |
---|
45 | |
---|
46 | pwg_query('ALTER TABLE '.TAGS_TABLE.' DROP COLUMN `id_typetags`'); |
---|
47 | pwg_query('DROP TABLE '. $prefixeTable .'typetags;'); |
---|
48 | pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param = "TypeTags" LIMIT 1;'); |
---|
49 | } |
---|
50 | |
---|
51 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.