[31368] | 1 | <?php |
---|
[31373] | 2 | |
---|
| 3 | // +-----------------------------------------------------------------------+ |
---|
| 4 | // | Ban IP plugin for piwigo | |
---|
| 5 | // +-----------------------------------------------------------------------+ |
---|
[31408] | 6 | // | Copyright(C) 2016 ddtddt http://temmii.com/piwigo/ | |
---|
[31373] | 7 | // +-----------------------------------------------------------------------+ |
---|
| 8 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 9 | // | it under the terms of the GNU General Public License as published by | |
---|
| 10 | // | the Free Software Foundation | |
---|
| 11 | // | | |
---|
| 12 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 13 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 14 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 15 | // | General Public License for more details. | |
---|
| 16 | // | | |
---|
| 17 | // | You should have received a copy of the GNU General Public License | |
---|
| 18 | // | along with this program; if not, write to the Free Software | |
---|
| 19 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 20 | // | USA. | |
---|
| 21 | // +-----------------------------------------------------------------------+ |
---|
| 22 | |
---|
[31368] | 23 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 24 | |
---|
| 25 | class BanIP_maintain extends PluginMaintain |
---|
| 26 | { |
---|
| 27 | function install($plugin_version, &$errors=array()) |
---|
| 28 | { |
---|
| 29 | global $prefixeTable; |
---|
| 30 | |
---|
| 31 | $query = "CREATE TABLE IF NOT EXISTS ". $prefixeTable.'ip_ban' ." ( |
---|
| 32 | id int(11) NOT NULL auto_increment, |
---|
| 33 | ip char(50) NOT NULL default '', |
---|
| 34 | PRIMARY KEY (id))DEFAULT CHARSET=utf8;"; |
---|
| 35 | pwg_query($query); |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | function update($old_version, $new_version, &$errors=array()) |
---|
| 39 | { |
---|
| 40 | $this->install($new_version, $errors); |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | function uninstall() |
---|
| 44 | { |
---|
| 45 | global $prefixeTable; |
---|
| 46 | |
---|
| 47 | pwg_query('DROP TABLE '.$prefixeTable.'ip_ban;'); |
---|
| 48 | } |
---|
| 49 | } |
---|