Index: /extensions/AntiAspi/admin.php
===================================================================
--- /extensions/AntiAspi/admin.php	(revision 31369)
+++ /extensions/AntiAspi/admin.php	(revision 31370)
@@ -18,15 +18,19 @@
 else
     $page['tab'] = $_GET['tab'];
-
+	$template->func_combine_css(array('id'=>'dst','path'=>ANTIASPI_PATH.'antiaspi.css'));
 
 
     $tabsheet = new tabsheet();
     $tabsheet->add('ipban', l10n('IP ban'), ANTIASPI_ADMIN . '-ipban');
+	$tabsheet->add('ipconfig', l10n('Configuration '), ANTIASPI_ADMIN . '-ipconfig ');
     $tabsheet->select($page['tab']);
     $tabsheet->assign();
 
-// Tab gest
 switch ($page['tab']) {
     case 'ipban':
+	  $template->assign(
+       'ipbangest', array(
+       'A' => 'a'
+    ));
 	$ipban = pwg_query("SELECT * FROM " . ANTIASPI_TABLE . ";");
 	
@@ -99,4 +103,109 @@
 	
 	break;
+	case 'ipconfig':
+  global $conf, $template;
+  $admin_base_url = ANTIASPI_ADMIN . '-ipconfig';
+  $antiaspi = safe_unserialize($conf['antiaspi']);	
+/*
+$conf['antiaspi'] = array(
+  'diff' => '20 pages in 00:00:10' , // IP banned if 20 different pages viewed in 10 seconds
+  'same' => '15 pages in 00:00:30' , // IP banned if same 15 pages viewed in 30 seconds
+  'banned during' => '23:59:59' ,    // IP banned during hh:mm:ss
+  'only guest' => true ,             // If true, don't ban registered users
+  'only picture' => false ,          // If true, apply antiaspi only on picture page
+  'allowed ip' => array()            // Autorized IP (robots for example)
+);
+*/
+$diff = explode(" pages in ", $antiaspi['diff']);
+$tempsdiff= explode(":", $diff[1]);
+$tempsdiffsec=$tempsdiff[2]+($tempsdiff[1]*60)+($tempsdiff[0]*60*60);
+
+$same = explode(" pages in ", $antiaspi['same']);
+$tempssame= explode(":", $same[1]);
+$tempssamesec=$tempssame[2]+($tempssame[1]*60)+($tempssame[0]*60*60);
+
+$onlyguest = array(
+l10n('yes'),
+l10n('no'),
+);
+$onlyguestv = array(
+true,
+false,
+);
+$onlypicture = array(
+l10n('yes'),
+l10n('no'),
+);
+$onlypicturev = array(
+true,
+false,
+); 
+  $template->assign(
+   'ipconfiggest', array(
+	  'DIFFA' => $diff[0],
+	  'DIFFB' => $tempsdiffsec,
+	  'SAMEA' => $same[0],
+	  'SAMEB' => $tempssamesec,
+	  'ONLYGUEST' => $onlyguest,
+	  'ONLYGUESTV' => $onlyguestv,
+	  'ONLYGUESTSELECT' => $antiaspi['only guest'],
+	  'ONLYPICTURE' => $onlypicture,
+	  'ONLYPICTUREV' => $onlypicturev,
+	  'ONLYPICTURESELECT' => $antiaspi['only picture'],
+  ));
+  $i = 0;
+  while ($i < count($antiaspi['allowed ip'])) {
+
+	$items = array(
+		'IP' => $antiaspi['allowed ip'][$i],
+		'U_DELETE' => $admin_base_url . '&amp;delete='.$i ,
+	);
+
+	$template->append('allowip', $items);
+	$i++;
+  }
+  
+  
+	/*$time = '7000';
+echo date('h:i:s', $time);
+*/
+
+if (isset($_POST['submitconfban'])) {
+	/*$time = date('h:i:s', $_POST['insdiffb']);  revoir fonction date HS ?*/
+	$antiaspi['diff']=$_POST['insdiffa'].' pages in '.date('00:i:s', ($_POST['insdiffb']));
+	$antiaspi['same']=$_POST['inssamea'].' pages in '.date('00:i:s', ($_POST['inssameb']));
+	$antiaspi['only guest']=$_POST['insonlyguest'];
+	$antiaspi['only picture']=$_POST['insonlypicturet'];
+	
+	conf_update_param('antiaspi', $antiaspi);
+	redirect($admin_base_url);
+}
+
+if (isset($_POST['submitaddipallowed'])) {
+	 $i = 0;
+	while ($i < count($antiaspi['allowed ip'])) {
+		if($_POST['insipallowed']==$antiaspi['allowed ip'][$i])
+		{
+			$_SESSION['page_errors'] = array(l10n('IP already allowed'));
+			redirect($admin_base_url);
+		}
+		$i++;
+	};
+
+	$antiaspi['allowed ip'][]=$_POST['insipallowed'];
+	conf_update_param('antiaspi', $antiaspi);
+	redirect($admin_base_url);
+}
+
+  if (isset($_GET['delete'])) {
+    check_input_parameter('delete', $_GET, false, PATTERN_ID);
+	unset($antiaspi['allowed ip'][($_GET['delete'])]);
+	$antiaspi['allowed ip'] = array_values($antiaspi['allowed ip']);
+    conf_update_param('antiaspi', $antiaspi);
+	redirect($admin_base_url);
+  }
+
+
+	break;
 }
 	
Index: /extensions/AntiAspi/admin.tpl
===================================================================
--- /extensions/AntiAspi/admin.tpl	(revision 31369)
+++ /extensions/AntiAspi/admin.tpl	(revision 31370)
@@ -1,4 +1,5 @@
 {include file='include/datepicker.inc.tpl'}
-
+{combine_script id='jquery.ui.slider' require='jquery.ui' load='footer' path='themes/default/js/ui/minified/jquery.ui.slider.min.js'}
+{combine_css path="themes/default/js/ui/theme/jquery.ui.slider.css"}
 {footer_script}
 
@@ -55,11 +56,38 @@
 		$(this).val(d);
 	});
+// slide
+    $('.range').each(function(){
+        var cls=$(this).attr('class');
+        var elem=$(this).parent();
+        var input=elem.find('input');
+        var options={};
+        elem.append('<div class="uirange"></div>');
+        options.slide=function(event,ui){
+            elem.find('label span').empty().append(ui.value);
+            input.val(ui.value);
+        }
+        options.value=input.val();
+        options.range='min';
+        options.min=$(this).data('min');
+        options.max=$(this).data('max');
+        elem.find('.uirange').slider(options);
+        elem.find('label span').empty().append(input.val());
+        input.hide();
+    });
 });
 
 {/footer_script}
+
+{html_style}
+.uirange{
+    margin:10px;
+    margin-left: 40px;
+}
+{/html_style}
 
 <div class="titrePage">
   <h2>{'AntiAspi'|@translate}</h2>
 </div>
+{if isset ($ipbangest)}
 <form method="post" >
 	<fieldset>
@@ -67,4 +95,5 @@
 	</fieldset>
 </form>
+{/if}
 {if isset ($ipban_add)}
 	<form method="post">
@@ -81,9 +110,14 @@
 	</form>
 {/if}
+{if isset ($ipbangest)}
 <form method="post" >
 	<fieldset>
 	  <legend>{'List IP banned'|@translate}</legend>
+	   <table class="lban">
 		{foreach from=$ipban2 item=ipban}
-			<!-- {$ipban.ID} -->   {$ipban.IP}   {$ipban.DATE}
+		  <tr>
+			<td><!-- {$ipban.ID} --> {$ipban.IP}</td>
+			<td>{$ipban.DATE}</td>
+			<td>
 			<a href="{$ipban.U_EDIT}">
 				<img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/edit_s.png" alt="{'edit'|@translate}" title="{'edit'|@translate}" />
@@ -92,8 +126,11 @@
 				<img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" id="btn_delete" alt="{'delete'|@translate}" title="{'Delete'|@translate}" />
 			</a>
-		  <br>
+			</td>
+		  </tr>
 		{/foreach}
+	 </table>
   	</fieldset>
 </form>
+{/if}
 {if isset ($ipban_edit)}
 	<form method="post" >
@@ -111,2 +148,71 @@
 	</form>
 {/if}
+
+{if isset ($ipconfiggest)}
+<form method="post">
+ <fieldset>
+  <legend>{'Configuration'|translate}</legend>
+	 <fieldset>
+		<p class="input" style="width: 700px;">
+		  <label for="insdiffa"><strong>{'IP banned if '|@translate}<span></span></strong></label>
+		  <input type="text" name="insdiffa" data-min="10" data-max="500" class="range" value="{$ipconfiggest.DIFFA}"/>  
+		</p>	
+		<p class="input" style="width: 700px;">
+			<label for="insdiffb"><strong>{' different pages viewed in <span></span> seconds'|@translate} </strong></label>
+			<input type="text" name="insdiffb" data-min="5" data-max="3599" class="range" value="{$ipconfiggest.DIFFB}"/>
+		</p>
+	</fieldset>
+	<fieldset>
+		<p class="input" style="width: 700px;">
+		  <label for="inssamea"><strong>{'IP banned if same '|@translate}<span></span></strong></label>
+		  <input type="text" name="inssamea" data-min="10" data-max="500" class="range" value="{$ipconfiggest.SAMEA}"/>  
+		</p>	
+		<p class="input" style="width: 700px;">
+			<label for="inssameb"><strong>{' different pages viewed in <span></span> seconds'|@translate} </strong></label>
+			<input type="text" name="inssameb" data-min="5" data-max="3599" class="range" value="{$ipconfiggest.SAMEB}"/>
+		</p>
+	</fieldset>
+	<p>
+        <strong>{'only guest'|@translate}</strong>
+        {html_radios separator="  " name="insonlyguest" values=$ipconfiggest.ONLYGUESTV output=$ipconfiggest.ONLYGUEST selected="{$ipconfiggest.ONLYGUESTSELECT}"}
+		({'If yes, don\'t ban registered users'|@translate})
+    </p>
+	<p>
+        <strong>{'only picture'|@translate}</strong>
+        {html_radios separator="  " name="insonlypicturet" values=$ipconfiggest.ONLYPICTUREV output=$ipconfiggest.ONLYPICTURE selected="{$ipconfiggest.ONLYPICTURESELECT}"}
+		({'If yes, apply antiaspi only on picture page'|@translate})
+    </p>
+	 <fieldset>
+      <legend>{'allowed ip'|translate}</legend>
+		<table class="lban">
+			{foreach from=$allowip item=allowip2}
+			  <tr>
+				<td>{$allowip2.IP}</td>
+				<td>
+				<a href="{$allowip2.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>
+    <p>
+        <input class="submit" type="submit" name="submitconfban" value="{'Submit'|@translate}">
+    </p>
+ </fieldset>
+</form>
+  {if isset ($ipconfiggest)}
+	<form method="post">
+		<fieldset>
+			<legend>{'Add IP allowed'|@translate}</legend>
+			{'IP'|@translate} <input " type="text" name="insipallowed" data-ip placeholder="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="submitaddipallowed" type="submit" value="{'Submit'|@translate}" />
+				</div>
+		</fieldset>
+	</form>
+{/if}
+{/if}
Index: /extensions/AntiAspi/antiaspi.css
===================================================================
--- /extensions/AntiAspi/antiaspi.css	(revision 31369)
+++ /extensions/AntiAspi/antiaspi.css	(revision 31370)
@@ -14,2 +14,9 @@
   background-image:none;
 }
+table.lban td{
+  padding-right:20px;
+}
+
+.lignebis {
+  background-color:green;
+}
Index: /extensions/AntiAspi/main.inc.php
===================================================================
--- /extensions/AntiAspi/main.inc.php	(revision 31369)
+++ /extensions/AntiAspi/main.inc.php	(revision 31370)
@@ -29,5 +29,5 @@
   global $user, $conf, $page;
   
-  $antiaspi = array(
+  /*$antiaspi = array(
     'diff' => '20 pages in 00:00:10' , // IP bannie si 20 pages différentes vues en 10 secondes
     'same' => '15 pages in 00:00:30' , // IP bannie si 15 pages identiques vues en 30 secondes
@@ -39,7 +39,7 @@
   
   if (isset($conf['antiaspi']))
-  {
-    $antiaspi = array_merge($antiaspi, $conf['antiaspi']);
-  }
+  {*/
+    $antiaspi = safe_unserialize($conf['antiaspi']);
+ // }
 
   if (is_admin() or ($antiaspi['only guest'] and !is_a_guest())) return;
Index: /extensions/AntiAspi/maintain.class.php
===================================================================
--- /extensions/AntiAspi/maintain.class.php	(revision 31369)
+++ /extensions/AntiAspi/maintain.class.php	(revision 31370)
@@ -43,4 +43,19 @@
   function update($old_version, $new_version, &$errors=array())
   {
+	global $conf;  
+	  
+	if (!isset($conf['antiaspi']))
+      {
+	  	$conf['antiaspi'] = array(
+		  'diff' => '20 pages in 00:00:10' ,
+		  'same' => '15 pages in 00:00:30' ,
+		  'banned during' => '23:59:59' ,
+		  'only guest' => true ,
+		  'only picture' => false ,
+		  'allowed ip' => array('123.123.123.123','122.122.122.122'),
+		);
+		conf_update_param('antiaspi', $conf['antiaspi']);
+      }  
+	  
     $this->install($new_version, $errors);
   }
