Rev | Line | |
---|
[18369] | 1 | <?php |
---|
| 2 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
| 3 | |
---|
[26113] | 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 | } |
---|
[18369] | 19 | |
---|
[26113] | 20 | function install($plugin_version, &$errors=array()) |
---|
| 21 | { |
---|
| 22 | global $conf, $prefixeTable; |
---|
[18369] | 23 | |
---|
[26113] | 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 | } |
---|
[18369] | 34 | |
---|
[26113] | 35 | $this->installed = true; |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | function activate($plugin_version, &$errors=array()) |
---|
[18369] | 39 | { |
---|
[26113] | 40 | if (!$this->installed) |
---|
| 41 | { |
---|
| 42 | $this->install($plugin_version, $errors); |
---|
| 43 | } |
---|
[18369] | 44 | } |
---|
| 45 | |
---|
[26113] | 46 | function deactivate() |
---|
| 47 | { |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | function uninstall() |
---|
| 51 | { |
---|
| 52 | conf_delete_param('comments_blacklist'); |
---|
| 53 | |
---|
| 54 | @unlink($this->file); |
---|
| 55 | } |
---|
[18369] | 56 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.