Changeset 3089


Ignore:
Timestamp:
09/26/11 19:46:51 (3 years ago)
Author:
benjamin
Message:

adding missing error messages for dom class + check the validity of domain type names

Location:
alternc/branches/stable-1.0/bureau
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • alternc/branches/stable-1.0/bureau/class/m_dom.php

    r3082 r3089  
    187187    global $err,$cuid,$db; 
    188188    $id=intval($id); 
     189    // The name MUST contain only letter and digits, it's an identifier after all ... 
     190    if (!preg_match("#^[a-z0-9]+$#",$name)) { 
     191      $err->raise("dom", 26); 
     192      return false; 
     193    } 
    189194    $name=mysql_real_escape_string($name); 
    190195    $description=mysql_real_escape_string($description); 
     
    800805 
    801806 
     807  /* ----------------------------------------------------------------- */ 
     808  /** 
     809   * Check the compatibility of the POSTed parameters with the chosen 
     810   * domain type 
     811   * 
     812   * @param string $dom FQDN of the domain name 
     813   * @param string $sub SUBdomain  
     814   * @return boolean tell you if the subdomain can be installed there  
     815   */ 
    802816  function can_create_subdomain($dom,$sub,$type,$type_old='', $value_old='') { 
    803817    global $db,$err,$cuid; 
    804818    $err->log("dom","can_create_subdomain",$dom."/".$sub); 
    805819 
    806     # Get the compatibility list for this domain type 
     820    // Get the compatibility list for this domain type 
    807821    $db->query("select upper(compatibility) as compatibility from domaines_type where upper(name)=upper('$type');"); 
    808822    if (!$db->next_record()) return false; 
    809823    $compatibility_lst = explode(",",$db->f('compatibility')); 
    810824 
    811     # Get the list of type of subdomains already here who have the same name 
     825    // Get the list of type of subdomains already here who have the same name 
    812826    $db->query("select * from sub_domaines where sub='$sub' and domaine='$dom' and not (type='$type_old' and valeur='$value_old') and web_action != 'DELETE'"); 
    813827    #$db->query("select * from sub_domaines where sub='$sub' and domaine='$dom';"); 
    814828    while ($db->next_record()) { 
    815       # And if there is a domain with a incompatible type, return false 
     829      // And if there is a domain with a incompatible type, return false 
    816830      if (! in_array(strtoupper($db->f('type')),$compatibility_lst)) return false; 
    817831    } 
    818832     
    819     # All is right, go ! Create ur domain ! 
     833    // All is right, go ! Create ur domain ! 
    820834    return true; 
    821835  } 
     
    837851   * @return boolean Retourne FALSE si une erreur s'est produite, TRUE sinon. 
    838852   */ 
    839    // TODO : j'ai viré le type action, valider que plus personne ne l'utilise (quatrieme argument) 
    840853  function set_sub_domain($dom,$sub,$type,$dest, $type_old=null,$sub_old=null,$value_old=null) { 
    841854    global $db,$err,$cuid; 
     
    860873 
    861874    if (! $this->check_type_value($type,$dest)) { 
    862       # TODO have a real err code 
    863       $err->raise("dom",667); 
     875      // Invalid domain type selected, please check. 
     876      $err->raise("dom",27); 
    864877      return false; 
    865878    } 
     
    872885 
    873886    if (! $this->can_create_subdomain($dom,$sub,$type,$type_old,$value_old)) { 
    874       # TODO have a real error code 
    875       $err->raise("dom", 654); 
     887      // The parameters for this subdomain and domain type are invalid. Please check for subdomain entries incompatibility 
     888      $err->raise("dom", 28); 
    876889      return false; 
    877890    } 
  • alternc/branches/stable-1.0/bureau/locales/fr_FR/LC_MESSAGES/manual.po

    r3035 r3089  
    196196"d'héberger le mail ici." 
    197197 
     198#. The name of the domain type MUST contain only digits and letters 
     199msgid "err_dom_26" 
     200msgstr "Le nom des types de domaines ne doit être composé que de chiffres ou de lettres." 
     201 
     202#. Invalid domain type selected, please check. 
     203msgid "err_dom_27" 
     204msgstr "Un type de domaine invalide a été sélectionné, merci de vérifier." 
     205 
     206#. The parameters for this subdomain and domain type are invalid. Please check for subdomain entries incompatibility 
     207msgid "err_dom_28" 
     208msgstr "Les paramètres pour ce sous-domaine et ce type de domaine sont invalide. Vérifiez qu'aucune incompatibilité n'existe sur ce sous-domaine." 
     209 
    198210#. - Entrez le nom du domaine que vous souhaitez héberger. Le nom de domaine  
    199211#. doit être complet, mais <b>sans le www.</b><br /> IMPORTANT : Si vous voulez  
Note: See TracChangeset for help on using the changeset viewer.