[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, |
---|
[9369] | 18 | `path` varchar(255) default NULL, |
---|
[3609] | 19 | `datas` longtext default NULL, |
---|
| 20 | `users` varchar(255) default NULL, |
---|
| 21 | `groups` varchar(255) default NULL, |
---|
[9383] | 22 | `level` TINYINT( 3 ) NOT NULL default "0", |
---|
[3609] | 23 | `show_title` enum(\'true\',\'false\') NOT NULL, |
---|
| 24 | `on_home` enum(\'true\',\'false\') NOT NULL, |
---|
[9383] | 25 | `on_root` enum(\'true\',\'false\') NOT NULL, |
---|
[3609] | 26 | `on_cats` enum(\'true\',\'false\') NOT NULL, |
---|
| 27 | `on_picture` enum(\'true\',\'false\') NOT NULL, |
---|
| 28 | `id_line` varchar(1) default NULL, |
---|
| 29 | `width` smallint(9) default NULL, |
---|
| 30 | PRIMARY KEY (`id`), |
---|
| 31 | KEY `on_home` (`on_home`), |
---|
| 32 | KEY `on_cats` (`on_cats`), |
---|
| 33 | KEY `on_picture` (`on_picture`) |
---|
| 34 | ) DEFAULT CHARSET=utf8;'; |
---|
| 35 | pwg_query($q); |
---|
| 36 | |
---|
[9449] | 37 | $q = "INSERT INTO `" . $prefixeTable . "stuffs` (`id`, `pos`, `name`, `datas`, `users`, `show_title`, `on_home`, `on_cats`, `on_picture`) |
---|
| 38 | VALUES (0, 1, 'MainBlock', '".addslashes(serialize(true))."', 'guest,generic,normal,admin,webmaster', 'true', 'true', 'true', 'true');"; |
---|
[3609] | 39 | pwg_query($q); |
---|
| 40 | } |
---|
| 41 | |
---|
[9383] | 42 | if (!isset($conf['PWG_Stuffs'])) |
---|
| 43 | { |
---|
| 44 | $config = array( |
---|
| 45 | 'level_perm' => false, |
---|
| 46 | 'group_perm' => false, |
---|
| 47 | 'user_perm' => false, |
---|
| 48 | ); |
---|
[3609] | 49 | |
---|
[9383] | 50 | $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) |
---|
[9449] | 51 | VALUES ("PWG_Stuffs" , "'.pwg_db_real_escape_string(serialize($config)).'" , "PWG Stuffs plugin configuration");'; |
---|
[9383] | 52 | pwg_query($query); |
---|
[3609] | 53 | } |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | function plugin_uninstall() |
---|
| 57 | { |
---|
[9383] | 58 | global $prefixeTable; |
---|
[3609] | 59 | |
---|
[9369] | 60 | $q = 'DROP TABLE ' . $prefixeTable . 'stuffs;'; |
---|
[9383] | 61 | pwg_query($q); |
---|
| 62 | |
---|
| 63 | $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="PWG_Stuffs";'; |
---|
| 64 | pwg_query($q); |
---|
[3609] | 65 | } |
---|
| 66 | |
---|
[3300] | 67 | ?> |
---|