-
Notifications
You must be signed in to change notification settings - Fork 4
/
maintain.inc.php
67 lines (57 loc) · 1.9 KB
/
maintain.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
function plugin_install()
{
global $prefixeTable, $conf;
$query = 'SHOW TABLES LIKE "' . $prefixeTable . 'stuffs"';
$result = pwg_query($query);
if (!pwg_db_fetch_row($result))
{
$q = 'CREATE TABLE `' . $prefixeTable . 'stuffs` (
`id` smallint(5) NOT NULL,
`pos` smallint(5) NOT NULL,
`name` text NOT NULL,
`descr` varchar(255) default NULL,
`path` varchar(255) default NULL,
`datas` longtext default NULL,
`users` varchar(255) default NULL,
`groups` varchar(255) default NULL,
`level` TINYINT( 3 ) NOT NULL default "0",
`show_title` enum(\'true\',\'false\') NOT NULL,
`on_home` enum(\'true\',\'false\') NOT NULL,
`on_root` enum(\'true\',\'false\') NOT NULL,
`on_cats` enum(\'true\',\'false\') NOT NULL,
`on_picture` enum(\'true\',\'false\') NOT NULL,
`id_line` varchar(1) default NULL,
`width` smallint(9) default NULL,
PRIMARY KEY (`id`),
KEY `on_home` (`on_home`),
KEY `on_cats` (`on_cats`),
KEY `on_picture` (`on_picture`)
) DEFAULT CHARSET=utf8;';
pwg_query($q);
$q = "INSERT INTO `" . $prefixeTable . "stuffs` (`id`, `pos`, `name`, `datas`, `users`, `show_title`, `on_home`, `on_cats`, `on_picture`)
VALUES (0, 1, 'MainBlock', '".addslashes(serialize(true))."', 'guest,generic,normal,admin,webmaster', 'true', 'true', 'true', 'true');";
pwg_query($q);
}
if (!isset($conf['PWG_Stuffs']))
{
$config = array(
'level_perm' => false,
'group_perm' => false,
'user_perm' => false,
);
$query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
VALUES ("PWG_Stuffs" , "'.pwg_db_real_escape_string(serialize($config)).'" , "PWG Stuffs plugin configuration");';
pwg_query($query);
}
}
function plugin_uninstall()
{
global $prefixeTable;
$q = 'DROP TABLE ' . $prefixeTable . 'stuffs;';
pwg_query($q);
$q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="PWG_Stuffs";';
pwg_query($q);
}
?>