Changeset 26113 for extensions/comments_blacklist/maintain.inc.php
- Timestamp:
- Dec 23, 2013, 11:58:09 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/comments_blacklist/maintain.inc.php
r19838 r26113 2 2 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 3 3 4 defined('COMM_BLACKLIST_ID') or define('COMM_BLACKLIST_ID', basename(dirname(__FILE__))); 5 include_once(PHPWG_PLUGINS_PATH . COMM_BLACKLIST_ID . '/include/install.inc.php'); 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 } 6 19 20 function install($plugin_version, &$errors=array()) 21 { 22 global $conf, $prefixeTable; 7 23 8 function plugin_install() 9 { 10 comm_blacklist_install(); 11 define('comm_blacklist_installed', true); 12 } 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 } 13 34 14 function plugin_activate() 15 { 16 if (!defined('comm_blacklist_installed')) 35 $this->installed = true; 36 } 37 38 function activate($plugin_version, &$errors=array()) 17 39 { 18 comm_blacklist_install(); 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); 19 55 } 20 56 } 21 22 function plugin_uninstall()23 {24 @unlink(PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'comments_blacklist.txt');25 }26 27 ?>
Note: See TracChangeset
for help on using the changeset viewer.