Line | |
---|
1 | <?php |
---|
2 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | class comments_blacklist_maintain extends PluginMaintain |
---|
5 | { |
---|
6 | private $installed = false; |
---|
7 | |
---|
8 | private $default_conf = array( |
---|
9 | 'action' => 'reject', |
---|
10 | ); |
---|
11 | |
---|
12 | private $file; |
---|
13 | |
---|
14 | function __contruct($plugin_id) |
---|
15 | { |
---|
16 | parent::_construct($plugin_id); |
---|
17 | $this->file = PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'comments_blacklist.txt'; |
---|
18 | } |
---|
19 | |
---|
20 | function install($plugin_version, &$errors=array()) |
---|
21 | { |
---|
22 | global $conf, $prefixeTable; |
---|
23 | |
---|
24 | if (empty($conf['comments_blacklist'])) |
---|
25 | { |
---|
26 | $conf['comments_blacklist'] = serialize($this->default_conf); |
---|
27 | conf_update_param('comments_blacklist', $conf['comments_blacklist']); |
---|
28 | } |
---|
29 | |
---|
30 | if (!file_exists($this->file)) |
---|
31 | { |
---|
32 | touch($this->file); |
---|
33 | } |
---|
34 | |
---|
35 | $this->installed = true; |
---|
36 | } |
---|
37 | |
---|
38 | function activate($plugin_version, &$errors=array()) |
---|
39 | { |
---|
40 | if (!$this->installed) |
---|
41 | { |
---|
42 | $this->install($plugin_version, $errors); |
---|
43 | } |
---|
44 | } |
---|
45 | |
---|
46 | function deactivate() |
---|
47 | { |
---|
48 | } |
---|
49 | |
---|
50 | function uninstall() |
---|
51 | { |
---|
52 | conf_delete_param('comments_blacklist'); |
---|
53 | |
---|
54 | @unlink($this->file); |
---|
55 | } |
---|
56 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.