Last change
on this file since 20683 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
|
Rev | Line | |
---|
[3609] | 1 | <?php |
---|
| 2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 3 | |
---|
| 4 | function plugin_install() |
---|
| 5 | { |
---|
[10987] | 6 | global $prefixeTable; |
---|
[3609] | 7 | |
---|
[10987] | 8 | $query = 'SHOW FULL COLUMNS FROM ' . TAGS_TABLE . ';'; |
---|
| 9 | $result = array_from_query($query, 'Field'); |
---|
| 10 | if (!in_array('id_typetags', $result)) |
---|
| 11 | { |
---|
[15149] | 12 | pwg_query('ALTER TABLE '.TAGS_TABLE.' ADD COLUMN `id_typetags` SMALLINT(5);'); |
---|
[10987] | 13 | } |
---|
[3609] | 14 | |
---|
[10987] | 15 | $result = pwg_query('SHOW TABLES LIKE "' . $prefixeTable .'typetags"'); |
---|
| 16 | if (!mysql_fetch_row($result)) |
---|
| 17 | { |
---|
[15149] | 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); |
---|
[10987] | 27 | } |
---|
[15149] | 28 | |
---|
| 29 | conf_update_param('TypeTags', serialize(array('show_all'=>true))); |
---|
[3609] | 30 | } |
---|
[9863] | 31 | |
---|
[15149] | 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 | |
---|
[3609] | 42 | function plugin_uninstall() |
---|
| 43 | { |
---|
[10987] | 44 | global $prefixeTable; |
---|
[3609] | 45 | |
---|
[15149] | 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;'); |
---|
[3609] | 49 | } |
---|
[9863] | 50 | |
---|
[3301] | 51 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.