Ignore:
Timestamp:
Dec 23, 2013, 11:58:09 AM (10 years ago)
Author:
mistic100
Message:

update for 2.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/comments_blacklist/maintain.inc.php

    r19838 r26113  
    22defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    33
    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');
     4class 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  }
    619
     20  function install($plugin_version, &$errors=array())
     21  {
     22    global $conf, $prefixeTable;
    723
    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    }
    1334
    14 function plugin_activate()
    15 {
    16   if (!defined('comm_blacklist_installed'))
     35    $this->installed = true;
     36  }
     37
     38  function activate($plugin_version, &$errors=array())
    1739  {
    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);
    1955  }
    2056}
    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.