[ Index ]
 

Code source de phpMyVisites 2.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/forms/ -> FormSiteIpExclude.class.php (source)

   1  <?php
   2  /* 
   3   * phpMyVisites : website statistics and audience measurements
   4   * Copyright (C) 2002 - 2006
   5   * http://www.phpmyvisites.net/ 
   6   * phpMyVisites is free software (license GNU/GPL)
   7   * Authors : phpMyVisites team
   8  */
   9  
  10  // $Id: FormSiteIpExclude.class.php 29 2006-08-18 07:35:21Z matthieu_ $
  11  
  12  
  13  
  14  require_once  INCLUDE_PATH . "/core/forms/Form.class.php";
  15  require_once  INCLUDE_PATH . "/core/include/SiteConfigDb.class.php";
  16  
  17  class FormSiteIpExclude extends Form
  18  {
  19      
  20      var $a_ips;
  21      
  22  	function FormSiteIpExclude( &$template, $siteAdmin )
  23      {
  24          parent::Form( $template );
  25          
  26          $this->siteAdmin = $siteAdmin;
  27          
  28          $o_site = new Site( $siteAdmin );
  29          
  30          $this->a_ips = $o_site->getIpArray();
  31      }
  32      
  33  	function process()
  34      {    
  35          
  36          // general input
  37          $formElements = array();
  38          
  39          for($i = 0; $i < NB_IPS_RANGE_AVAILABLE; $i++)
  40          {
  41              $formElements[] = array('text', 'form_ipa'.$i, '', 'value="'.long2ip(@$this->a_ips[$i][0]).'"');
  42              $formElements[] = array('text', 'form_ipb'.$i, '', 'value="'.long2ip(@$this->a_ips[$i][1]).'"');
  43          }
  44          $this->addElements( $formElements , 'General');
  45  
  46          // validation rules
  47          $formRules = array(
  48              array('__ALL__',
  49                  sprintf($GLOBALS['lang']['admin_error_ip'], IP_EXAMPLE), 
  50                  'checkCorrectIp'),
  51          );
  52          $this->addRules( $formRules );
  53          
  54          // launche process
  55          return parent::process( 'admin_ip_exclude_title' );
  56      }
  57      
  58  	function postProcess()
  59      {
  60          $ipFinal = array();
  61          for($i = 0; $i < NB_IPS_RANGE_AVAILABLE; $i++)
  62          {
  63              $ipa = ip2long($this->getSubmitValue('form_ipa'.$i));
  64              $ipb = ip2long($this->getSubmitValue('form_ipb'.$i));
  65              
  66              if($ipa != 0 || $ipb != 0)
  67                  $ipFinal[] = array( $ipa, $ipb, $this->siteAdmin );
  68                  
  69          }
  70  
  71          $ipFinal = array_reverse( $ipFinal, true);
  72          
  73          $confSite = new SiteConfigDb();
  74          $confSite->modIpExclude( $ipFinal, $this->siteAdmin );
  75          
  76      }
  77  }
  78  ?>


Généré le : Mon Nov 26 14:10:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics