Changeset 1576


Ignore:
Timestamp:
05/04/06 19:08:37 (7 years ago)
Author:
benjamin
Message:

début de formulaire pour hostaliases

Location:
alternc-awstats/trunk/bureau
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • alternc-awstats/trunk/bureau/admin/aws_add.php

    r1566 r1576  
    5656</td></tr> 
    5757<tr><th><?php __("Hostaliases"); ?></th><td> 
    58 // here we put the form to fill the content of the aws.hostaliases FIXME 
     58<?php  // TODO : put them on 2 columns (at least) 
     59$hl=$aws->host_list(); 
     60foreach ($hl as $ho) { 
     61  echo "<input type=\"checkbox\" name=\"hostaliases[]\" id=\"ha_$ho\" value=\"$ho\""; 
     62  if (in_array($_REQUEST["hostaliases"],$ho)) echo " checked=\"checked\""; 
     63  echo " /><label for=\"ha_$ho\">$ho</label><br />\n"; 
     64} 
     65?> 
    5966</td></tr> 
    6067<tr><th><?php __("Allowed Users"); ?></th><td> 
  • alternc-awstats/trunk/bureau/admin/aws_doadd.php

    r1036 r1576  
    3030require_once("../class/config.php"); 
    3131 
    32 $r=$aws->add_stats($hostname,$awsusers); 
     32$r=$aws->add_stats($hostname,$awsusers,$hostaliases); 
    3333if (!$r) { 
    3434        $error=$err->errstr(); 
  • alternc-awstats/trunk/bureau/class/m_aws.php

    r1562 r1576  
    262262   * @return boolean TRUE si le jeu de stats a été créé avec succès, FALSE sinon. 
    263263   */ 
    264   function add_stats($hostname,$users="") { 
     264  function add_stats($hostname,$users="", $hostaliases) { 
    265265    global $db,$err,$quota,$mem,$cuid; 
    266266    $err->log("aws","add_stats",$hostname); 
     
    270270      return false; 
    271271    } 
     272    // Parse the hostaliases array (it should contains valid domains) 
     273    foreach($hostaliases as $ho) { 
     274      if (!in_array($hostname,$r) || $hostname=="") { 
     275        $err->raise("aws",3); // This hostname does not exist 
     276        return false; 
     277      } 
     278    } 
     279     
    272280    if ($quota->cancreate("aws")) { 
    273281      $db->query("INSERT INTO aws (hostname,uid) VALUES ('$hostname','$cuid')"); 
Note: See TracChangeset for help on using the changeset viewer.