Changeset 608


Ignore:
Timestamp:
01/14/09 16:26:13 (15 years ago)
Author:
niltonneto
Message:
  • Correção de traduções;
  • Retirado código que pode gerar overflow no servidor (loop infinito

com while(true);

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/inc/class.uiconfig.inc.php

    r597 r608  
    160160                                $dir = $GLOBALS['phpgw']->common->get_app_dir($appname) . "/inc"; 
    161161                                $options = ' '; 
    162                                 if (is_dir($dir)) { 
    163                                         if ($dh = opendir($dir)) { 
    164                                                 while (($file = readdir($dh)) !== false) { 
     162                                if (is_dir($dir)) 
     163                                { 
     164                                        if ($dh = opendir($dir)) 
     165                                        { 
     166                                                while (($file = readdir($dh)) !== false) 
     167                                                { 
    165168                                                        $temp = explode(".",$file); 
    166                                                         if((substr($temp[1],0,5)=='login') && ($temp[0]=='class')) { 
     169                                                        if( (substr($temp[1],0,5) =='login') && ($temp[0] == 'class') ) 
     170                                                        { 
    167171                                                                $options .= "<option value='".$temp[1]."'"; 
    168172                                                                if($current_config['expressoAdmin_loginGenScript'] == $temp[1]) 
     
    181185                        if($appname=="admin") {                                                  
    182186                                /* 
    183                                  * FCK editor para o termo de aceite 
     187                                 * FCK editor to agree term 
    184188                                 */ 
    185189                                include_once("news_admin/inc/fckeditor.php"); 
    186                                 $texto_termo_aceite = isset($GLOBALS['phpgw_info']['server']['agree_term']) ? $GLOBALS['phpgw_info']['server']['agree_term'] : ''; 
    187190                                $oFCKeditor = new FCKeditor('newsettings[agree_term]');//CreateObject('news_admin.fckeditor','newsettings[agree_term]'); 
    188191                                $oFCKeditor->BasePath = 'news_admin/templates/celepar/fckeditor/';  
    189192                                $oFCKeditor->ToolbarSet = 'Basic'; 
    190                                 $oFCKeditor->Value = $texto_termo_aceite; 
     193                                $oFCKeditor->Value = isset($GLOBALS['phpgw_info']['server']['agree_term']) ? $GLOBALS['phpgw_info']['server']['agree_term'] : ''; 
    191194                                $t->set_var('agree_term_input',$oFCKeditor->Create());                   
    192195                        } 
  • trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php

    r594 r608  
    386386                        $classe = new ReflectionClass($this->current_config['expressoAdmin_loginGenScript']); 
    387387                                         
    388                         if(!$classe->implementsInterface('login')) { 
    389                                 return array("status" => False, "msg" => "A classe geradora de logins não implementa a interface login (Se você for um usuário, contacte o suporte)"); 
    390                         } 
    391  
    392                         $gerador = $classe->newInstance(); 
    393  
    394                         $login = $gerador->generate_login($params["first_name"],$params["second_name"],$this->ldap); 
     388                        if(!$classe->implementsInterface('login')) 
     389                        { 
     390                                return array( 
     391                                        "status" => False, 
     392                                        "msg" => lang("Login interface not implemented (contact suport)") 
     393                                ); 
     394                        } 
     395 
     396                        $login = $classe->newInstance()->generate_login($params["first_name"],$params["second_name"],$this->ldap); 
    395397                         
    396398                        /* 
    397                                 Se o algoritmo gerar um login que já existe, colocamos um número no final do  
    398                                 login gerado, resultando em um login não existente 
    399                         */ 
    400                         while(true) { 
    401                                 $filter = "(uid=$login)";                
    402                                 $search = ldap_search($this->ldap, $context, $filter, $justthese); 
    403                                 $entries = ldap_count_entries($this->ldap,$search); 
    404                                 if($entries==0) 
     399                                If login exists, it concatenates a number to the end. 
     400                                resulting in a new login 
     401                         */ 
     402                        $i = 1; 
     403                        while($i < 1000) // Limit of 1000 equal names 
     404                        { 
     405                                $search = ldap_search($this->ldap, $context, "(uid=".$login.")", $justthese); 
     406                                if (ldap_count_entries($this->ldap,$search) == 0) 
    405407                                        break; 
    406                                 else { 
    407                                         $login.=$i; 
     408                                else 
     409                                { 
     410                                        if ($i > 1) // If login have a number, remove the number and put the new one 
     411                                                $login=substr($login,0,strlen($login)-strlen($i)).$i; 
     412                                        else 
     413                                                $login.=$i; 
    408414                                        $i++; 
    409415                                } 
Note: See TracChangeset for help on using the changeset viewer.