Ignore:
Timestamp:
01/29/11 18:58:19 (2 years ago)
Author:
fufroma
Message:

Update domains, l'aventure continue

File:
1 edited

Legend:

Unmodified
Added
Removed
  • alternc/trunk/bureau/class/m_dom.php

    r2817 r2821  
    647647    $r["nsub"]=$db->Record["cnt"]; 
    648648    $db->free(); 
    649     $db->query("select sd.*, dt.description as type_desc from sub_domaines sd, domaines_type dt where compte='$cuid' and domaine='$dom' and upper(dt.name)=upper(sd.type)"); 
     649    $db->query("select sd.*, dt.description as type_desc, dt.only_dns from sub_domaines sd, domaines_type dt where compte='$cuid' and domaine='$dom' and upper(dt.name)=upper(sd.type)"); 
    650650    // Pas de webmail, on le cochera si on le trouve. 
    651651    $this->webmail=0; 
     
    656656      $r["sub"][$i]["dest"]=$db->Record["valeur"]; 
    657657      $r["sub"][$i]["type"]=$db->Record["type"]; 
     658      $r["sub"][$i]["enable"]=$db->Record["enable"]; 
    658659      $r["sub"][$i]["type_desc"]=$db->Record["type_desc"]; 
     660      $r["sub"][$i]["only_dns"]=$db->Record["only_dns"]; 
     661      $r["sub"][$i]["web_action"]=$db->Record["web_action"]; 
    659662/* 
    660663      if ($db->Record["type"]==3) { // Webmail 
     
    704707    } 
    705708*/ 
    706     $db->query("select sd.*, dt.description as type_desc from sub_domaines sd, domaines_type dt where compte='$cuid' and domaine='$dom' and sub='$sub' and ( length('$type')=0 or type='$type') and (length('$value')=0 or '$value'=valeur) and upper(dt.name)=upper(sd.type);"); 
     709    $db->query("select sd.*, dt.description as type_desc, dt.only_dns from sub_domaines sd, domaines_type dt where compte='$cuid' and domaine='$dom' and sub='$sub' and ( length('$type')=0 or type='$type') and (length('$value')=0 or '$value'=valeur) and upper(dt.name)=upper(sd.type);"); 
    707710    if ($db->num_rows()==0) { 
    708711      $err->raise("dom",14); 
     
    713716    $r["name"]=$db->Record["sub"]; 
    714717    $r["dest"]=$db->Record["valeur"]; 
    715     $r["type"]=$db->Record["type"]; 
     718    $r["enable"]=$db->Record["enable"]; 
    716719    $r["type_desc"]=$db->Record["type_desc"]; 
     720    $r["only_dns"]=$db->Record["only_dns"]; 
     721    $r["web_action"]=$db->Record["web_action"]; 
    717722    $db->free(); 
    718723    return $r; 
     
    738743        return false; 
    739744        } 
     745        return true; 
    740746        break; 
    741747      case 'IP':  
     
    759765 
    760766 
    761   function can_create_subdomain($dom,$sub,$type) { 
     767  function can_create_subdomain($dom,$sub,$type,$value_old='') { 
    762768    global $db,$err,$cuid; 
    763769    $err->log("dom","can_create_subdomain",$dom."/".$sub); 
     
    769775 
    770776    # Get the list of type of subdomains already here who have the same name 
    771     $db->query("select distinct type from sub_domaines where sub='$sub' and domaine='$dom';"); 
     777    $db->query("select * from sub_domaines where sub='$sub' and domaine='$dom' and not (type='$type' and valeur='$value_old')"); 
     778    #$db->query("select * from sub_domaines where sub='$sub' and domaine='$dom';"); 
    772779    while ($db->next_record()) { 
    773780      # And if there is a domain with a incompatible type, return false 
     
    829836    } 
    830837 
    831     if (! $this->can_create_subdomain($dom,$sub,$type)) { 
     838    if (! $this->can_create_subdomain($dom,$sub,$type,$value_old)) { 
    832839      # TODO have a real error code 
    833840      $err->raise("dom", 654); 
Note: See TracChangeset for help on using the changeset viewer.