Index: /extensions/BanIP/admin.php
===================================================================
--- /extensions/BanIP/admin.php	(revision 31368)
+++ /extensions/BanIP/admin.php	(revision 31368)
@@ -0,0 +1,107 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH'))
+    die('Hacking attempt!');
+global $template, $conf, $user;
+include_once(PHPWG_ROOT_PATH . 'admin/include/tabsheet.class.php');
+load_language('plugin.lang', BANIP_PATH);
+$my_base_url = PHPWG_ROOT_PATH.'admin.php?page=plugin-';
+
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok                      |
+// +-----------------------------------------------------------------------+
+check_status(ACCESS_ADMINISTRATOR);
+
+//-------------------------------------------------------- sections definitions
+if (!isset($_GET['tab']))
+    $page['tab'] = 'banip';
+else
+    $page['tab'] = $_GET['tab'];
+
+
+
+    $tabsheet = new tabsheet();
+    $tabsheet->add('banip', l10n('IP ban'), BANIP_ADMIN . '-banip');
+    $tabsheet->select($page['tab']);
+    $tabsheet->assign();
+
+switch ($page['tab']) {
+    case 'banip':
+	  $template->assign(
+       'ipbangest', array(
+       'A' => 'a'
+    ));
+	$ipban = pwg_query("SELECT * FROM " . BANIP_TABLE . ";");
+	
+	$template->func_combine_css(array('id'=>'dst','path'=>BANIP_PATH.'banip.css'));
+	
+    $admin_base_url = BANIP_ADMIN . '-banip';
+        if (pwg_db_num_rows($ipban)) {
+            while ($ipban2 = pwg_db_fetch_assoc($ipban)) {
+				
+                $items = array(
+                    'ID' => $ipban2['id'],
+                    'IP' => $ipban2['ip'],
+                    'U_DELETE' => $admin_base_url . '&amp;delete=' . $ipban2['id'],
+                    'U_EDIT' => $admin_base_url . '&amp;edit=' . $ipban2['id'],
+                );
+
+                $template->append('ipban2', $items);
+            }
+        }
+		
+  if (isset($_GET['delete'])) {
+
+    check_input_parameter('delete', $_GET, false, PATTERN_ID);
+    $query = 'DELETE FROM ' . BANIP_TABLE . ' WHERE id = ' . $_GET['delete'] . ';';
+    pwg_query($query);
+
+    $_SESSION['page_infos'] = array(l10n('IP ban deleted'));
+    redirect($admin_base_url);
+  }
+
+if (isset($_GET['edit'])) {
+    check_input_parameter('edit', $_GET, false, PATTERN_ID);
+    $query = 'SELECT * FROM ' . BANIP_TABLE . ' WHERE id = \'' . $_GET['edit'] . '\';';
+		$result = pwg_query($query);
+		$row = pwg_db_fetch_assoc($result);
+		$template->assign(
+			'ipban_edit', array(
+			'ID' => $row['id'],
+			'IP' => $row['ip'],
+		));
+}  
+
+if (isset($_POST['submitaddipban2'])) {
+	$query = 'UPDATE ' . BANIP_TABLE .' SET ip= "'.$_POST['inserip'].'" WHERE id = '.$_POST['invisibleID'].';';
+	$result = pwg_query($query);
+	$_SESSION['page_infos'] = array(l10n('Ip ban update'));
+	redirect($admin_base_url);
+}
+
+//add ban
+if (isset($_POST['submitipban'])) {
+	$template->assign(
+		'ipban_add', array(
+		'nada' => l10n('nada'),
+	));
+	$template->clear_assign(
+		'ipban_edit', array(
+	));
+}
+
+if (isset($_POST['submitaddipban'])) {
+	$query = 'INSERT INTO ' . BANIP_TABLE .'(ip) VALUES ("' . $_POST['inserip'] . '");';
+	$result = pwg_query($query);
+	$_SESSION['page_infos'] = array(l10n('Ip ban insert'));
+	redirect($admin_base_url);
+}
+		
+	
+	break;
+}
+	
+
+$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl'));
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/BanIP/admin.tpl
===================================================================
--- /extensions/BanIP/admin.tpl	(revision 31368)
+++ /extensions/BanIP/admin.tpl	(revision 31368)
@@ -0,0 +1,59 @@
+<div class="titrePage">
+  <h2>{'AntiAspi'|@translate}</h2>
+</div>
+{if isset ($ipbangest)}
+<form method="post" >
+	<fieldset>
+		<input class="submit" name="submitipban" type="submit" value="{'Add IP ban'|@translate}" />
+	</fieldset>
+</form>
+{/if}
+{if isset ($ipban_add)}
+	<form method="post">
+		<fieldset>
+			<legend>{'Add IP ban or IP address range'|@translate}</legend>
+			{'IP'|@translate} <input " type="text" name="inserip" data-ip placeholder="123.123.123.123/123.123.123.*" value="" size="50" maxlenght="50" required pattern="^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|\*)$">
+			<br>
+			<br>
+				<div style="text-align:center;">
+				<input class="submit" name="submitaddipban" type="submit" value="{'Submit'|@translate}" />
+				</div>
+		</fieldset>
+	</form>
+{/if}
+{if isset ($ipbangest)}
+<form method="post" >
+	<fieldset>
+	  <legend>{'List IP banned and IP address range'|@translate}</legend>
+	   <table class="lban">
+		{foreach from=$ipban2 item=ipban}
+		  <tr>
+			<td><!-- {$ipban.ID} --> {$ipban.IP}</td>
+			<td>
+			<a href="{$ipban.U_EDIT}">
+				<img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/edit_s.png" alt="{'edit'|@translate}" title="{'edit'|@translate}" />
+			</a>
+			<a href="{$ipban.U_DELETE}" onclick="return confirm( document.getElementById('btn_delete').title + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}');">
+				<img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" id="btn_delete" alt="{'delete'|@translate}" title="{'Delete'|@translate}" />
+			</a>
+			</td>
+		  </tr>
+		{/foreach}
+	 </table>
+  	</fieldset>
+</form>
+{/if}
+{if isset ($ipban_edit)}
+	<form method="post" >
+		<fieldset>
+			<legend>{'Edit IP banned or IP address range'|@translate}</legend>
+			<input type="hidden" name="invisibleID" value="{$ipban_edit.ID}">
+			{'IP'|@translate} <input " type="text" name="inserip" data-ip="1" placeholder="123.123.123.123/123.123.123.*" value="{$ipban_edit.IP}" size="50" maxlenght="50" required pattern="^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|\*)$">
+			<br>	
+			<br>
+				<div style="text-align:center;">
+				<input class="submit" name="submitaddipban2" data-ip type="submit" value="{'Submit'|@translate}" />
+				</div>
+		</fieldset>
+	</form>
+{/if}
Index: /extensions/BanIP/banip.css
===================================================================
--- /extensions/BanIP/banip.css	(revision 31368)
+++ /extensions/BanIP/banip.css	(revision 31368)
@@ -0,0 +1,22 @@
+input:required{
+  background:url(aste.jpg) 98% center no-repeat;
+}
+input:focus:invalid{
+  border-color:#FF0000;
+  background-image:none;
+}
+
+input:focus:valid{
+  border-color:#56C93F;
+}
+
+input:valid{
+  background-image:none;
+}
+table.lban td{
+  padding-right:20px;
+}
+
+.lignebis {
+  background-color:green;
+}
Index: /extensions/BanIP/initadmin.php
===================================================================
--- /extensions/BanIP/initadmin.php	(revision 31368)
+++ /extensions/BanIP/initadmin.php	(revision 31368)
@@ -0,0 +1,13 @@
+<?php
+//add admin menu
+add_event_handler('get_admin_plugin_menu_links', 'banip_admin_menu');
+
+function banip_admin_menu($menu) {
+    load_language('plugin.lang', BANIP_PATH);
+    $menu[] = array(
+        'NAME' => l10n('BAN IP'),
+        'URL' => BANIP_ADMIN,
+    );
+     return $menu;
+} 
+ 
Index: /extensions/BanIP/language/en_UK/description.txt
===================================================================
--- /extensions/BanIP/language/en_UK/description.txt	(revision 31368)
+++ /extensions/BanIP/language/en_UK/description.txt	(revision 31368)
@@ -0,0 +1,1 @@
+Ban IP
Index: /extensions/BanIP/language/en_UK/index.php
===================================================================
--- /extensions/BanIP/language/en_UK/index.php	(revision 31368)
+++ /extensions/BanIP/language/en_UK/index.php	(revision 31368)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 7192 2010-10-15 07:31:57Z ddtddt $
+// | last update   : $Date: 2010-10-15 09:31:57 +0200 (ven. 15 oct. 2010) $
+// | last modifier : $Author: ddtddt $
+// | revision      : $Revision: 7192 $
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/BanIP/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/BanIP/language/en_UK/plugin.lang.php	(revision 31368)
+++ /extensions/BanIP/language/en_UK/plugin.lang.php	(revision 31368)
@@ -0,0 +1,11 @@
+<?php
+//admin
+$lang['IP ban'] = 'IP ban';
+$lang['IP ban deleted'] = 'IP ban deleted';
+$lang['Ip ban update'] = 'Ip ban update';
+$lang['Ip ban insert'] = 'Ip ban insert';
+$lang['Add IP ban or IP address range'] = 'Add IP ban or IP address range';
+$lang['IP banned'] = 'IP banned';
+$lang['List IP banned and IP address range'] = 'List IP banned and IP address range';
+$lang['Edit IP banned or IP address range'] = 'Edit IP banned or IP address range';
+
Index: /extensions/BanIP/language/fr_FR/description.txt
===================================================================
--- /extensions/BanIP/language/fr_FR/description.txt	(revision 31368)
+++ /extensions/BanIP/language/fr_FR/description.txt	(revision 31368)
@@ -0,0 +1,1 @@
+Bannir une adresses ip ou une plage d'adresse ip
Index: /extensions/BanIP/language/fr_FR/index.php
===================================================================
--- /extensions/BanIP/language/fr_FR/index.php	(revision 31368)
+++ /extensions/BanIP/language/fr_FR/index.php	(revision 31368)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 7188 2010-10-15 07:10:22Z ddtddt $
+// | last update   : $Date: 2010-10-15 09:10:22 +0200 (ven. 15 oct. 2010) $
+// | last modifier : $Author: ddtddt $
+// | revision      : $Revision: 7188 $
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/BanIP/language/index.php
===================================================================
--- /extensions/BanIP/language/index.php	(revision 31368)
+++ /extensions/BanIP/language/index.php	(revision 31368)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 4195 2009-11-05 11:57:50Z ddtddt $
+// | last update   : $Date: 2009-11-05 12:57:50 +0100 (jeu. 05 nov. 2009) $
+// | last modifier : $Author: ddtddt $
+// | revision      : $Revision: 4195 $
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/BanIP/main.inc.php
===================================================================
--- /extensions/BanIP/main.inc.php	(revision 31368)
+++ /extensions/BanIP/main.inc.php	(revision 31368)
@@ -0,0 +1,58 @@
+<?php
+/*
+Plugin Name: BanIP
+Version: auto
+Description: Ban IP
+Plugin URI: http://piwigo.org/ext/extension_view.php?eid=
+Author: ddtddt
+Author URI: http://www.temmii.com
+*/
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $prefixeTable;
+
+// +-----------------------------------------------------------------------+
+// | Define plugin constants                                               |
+// +-----------------------------------------------------------------------+
+
+define('BANIP_ID', basename(dirname(__FILE__)));
+define('BANIP_PATH', PHPWG_PLUGINS_PATH.BANIP_ID.'/');
+define('BANIP_TABLE' , $prefixeTable . 'ip_ban');
+define('BANIP_ADMIN',get_root_url().'admin.php?page=plugin-'.BANIP_ID);
+
+add_event_handler('loc_end_section_init', 'banip');
+
+function banip()
+{
+  global $user, $page;
+   load_language('plugin.lang', BANIP_PATH);
+  if (is_admin() ) return;
+  
+  $Vip = $_SERVER["REMOTE_ADDR"];
+  $plage= explode(".", $Vip);
+  $Vip2=$plage[0].".".$plage[1].".".$plage[2].".*";
+
+  $query = 'SELECT ip FROM ' . BANIP_TABLE . ' WHERE ip="' . $Vip . '";'; 
+  $result = pwg_query($query);
+
+  while(list($ip) = pwg_db_fetch_row($result))
+  {
+
+    die("IP " . $ip . "  ".l10n('IP ban'));
+  }
+
+  $query = 'SELECT ip FROM ' . BANIP_TABLE . ' WHERE ip="' . $Vip2 . '";';
+  $result = pwg_query($query);
+
+  while(list($ip) = pwg_db_fetch_row($result))
+  {
+    die("IP " . $ip . "  ".l10n('Plage IP ban'));
+  }
+  
+}
+
+// Plugin for admin
+if (script_basename() == 'admin') {
+    include_once(dirname(__FILE__) . '/initadmin.php');
+}
Index: /extensions/BanIP/maintain.class.php
===================================================================
--- /extensions/BanIP/maintain.class.php	(revision 31368)
+++ /extensions/BanIP/maintain.class.php	(revision 31368)
@@ -0,0 +1,28 @@
+<?php
+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;');
+  }
+}
