[3609] | 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 . 'stuffs"'; |
---|
| 10 | $result = pwg_query($query); |
---|
| 11 | if (!mysql_fetch_row($result)) |
---|
| 12 | { |
---|
| 13 | $q = 'CREATE TABLE `' . $prefixeTable . 'stuffs` ( |
---|
| 14 | `id` smallint(5) NOT NULL, |
---|
| 15 | `pos` smallint(5) NOT NULL, |
---|
| 16 | `name` text NOT NULL, |
---|
| 17 | `descr` varchar(255) default NULL, |
---|
| 18 | `type` varchar(255) NOT NULL, |
---|
[9369] | 19 | `path` varchar(255) default NULL, |
---|
[3609] | 20 | `datas` longtext default NULL, |
---|
| 21 | `users` varchar(255) default NULL, |
---|
| 22 | `groups` varchar(255) default NULL, |
---|
| 23 | `show_title` enum(\'true\',\'false\') NOT NULL, |
---|
| 24 | `on_home` enum(\'true\',\'false\') NOT NULL, |
---|
| 25 | `on_cats` enum(\'true\',\'false\') NOT NULL, |
---|
| 26 | `on_picture` enum(\'true\',\'false\') NOT NULL, |
---|
| 27 | `id_line` varchar(1) default NULL, |
---|
| 28 | `width` smallint(9) default NULL, |
---|
| 29 | PRIMARY KEY (`id`), |
---|
| 30 | KEY `on_home` (`on_home`), |
---|
| 31 | KEY `on_cats` (`on_cats`), |
---|
| 32 | KEY `on_picture` (`on_picture`) |
---|
| 33 | ) DEFAULT CHARSET=utf8;'; |
---|
| 34 | pwg_query($q); |
---|
| 35 | |
---|
[9369] | 36 | $q = "INSERT INTO `" . $prefixeTable . "stuffs` (`id`, `pos`, `name`, `descr`, `type`, `path`, `datas`, `users`, `groups`, `show_title`, `on_home`, `on_cats`, `on_picture`, `id_line`, `width`) |
---|
| 37 | VALUES (0, 1, 'MainBlock', NULL, 'MainBlock', NULL, NULL, 'guest,generic,normal,admin,webmaster', NULL, 'true', 'true', 'true', 'true', NULL, NULL);"; |
---|
[3609] | 38 | pwg_query($q); |
---|
| 39 | } |
---|
| 40 | } |
---|
| 41 | |
---|
[9369] | 42 | function plugin_activate($id, $version) |
---|
[3609] | 43 | { |
---|
[9369] | 44 | global $plugins, $prefixeTable; |
---|
[3609] | 45 | |
---|
| 46 | // Check if upgrade is needed |
---|
[9369] | 47 | if ($version != $plugins->fs_plugins[$id]['version']) |
---|
[3609] | 48 | { |
---|
[9369] | 49 | define('STUFFS_VERSION', $plugins->fs_plugins[$id]['version']); |
---|
| 50 | include('admin/upgrade.inc.php'); |
---|
[3609] | 51 | } |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | function plugin_uninstall() |
---|
| 55 | { |
---|
| 56 | global $prefixeTable; |
---|
| 57 | |
---|
[9369] | 58 | $q = 'DROP TABLE ' . $prefixeTable . 'stuffs;'; |
---|
[3609] | 59 | pwg_query($q); |
---|
| 60 | } |
---|
| 61 | |
---|
[3300] | 62 | ?> |
---|