<?php

// +-----------------------------------------------------------------------+
// | Ban IP plugin for Piwigo by TEMMII                                    |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2016-2023 ddtddt               http://temmii.com/piwigo/ |
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify  |
// | it under the terms of the GNU General Public License as published by  |
// | the Free Software Foundation                                          |
// |                                                                       |
// | This program is distributed in the hope that it will be useful, but   |
// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
// | General Public License for more details.                              |
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+

if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');

class BanIP_maintain extends PluginMaintain
{
  function install($plugin_version, &$errors=array())
  {
    global $prefixeTable;

	$query = "CREATE TABLE IF NOT EXISTS ". $prefixeTable.'ip_ban' ." (
  id int(11) NOT NULL auto_increment,
  ip char(50) NOT NULL default '',
PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
	pwg_query($query);
  }

  function update($old_version, $new_version, &$errors=array())
  {
	$this->install($new_version, $errors);
  }

  function uninstall()
  {
    global $prefixeTable;

    pwg_query('DROP TABLE '.$prefixeTable.'ip_ban;');
  }
}
