Ignore:
Timestamp:
11/03/11 13:24:14 (12 years ago)
Author:
wmerlotto
Message:

Ticket #2305 - Enviando alteracoes, desenvolvidas internamente na Prognus, do modulo ExpressoAdmin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoAdmin1_2/inc/class.bosectors.inc.php

    r3915 r5133  
    4848                        $sector_info['objectClass'][1]  = 'organizationalUnit'; 
    4949 
    50                         if( isset($_POST['associated_domain']) ) 
    51                         { 
    52                                 if ( $_POST['associated_domain'] != "") { 
    53                                         $sector_info['objectClass'][2]  = 'domainRelatedObject'; 
    54                                         $sector_info['associatedDomain'] = trim($_POST['associated_domain']); 
    55                                 } 
    56                         } 
    57  
    5850                        $systemName = $GLOBALS['phpgw_info']['server']['system_name']; 
    5951                        if ($systemName != '') 
     
    6658                        } 
    6759                         
    68                          
    69                         /* 
    70                          Insere as informações sobre quota total por usuários e por gigabytes de espaço em disco  
    71                          Se não vierem os dados, ele coloca 0 (Caso não exista controle de cota). 
    72                         */ 
    73                          
    74                         $controlled_by_quota = false; 
    75  
    76                         if( isset($_POST['disk_quota']) ) 
    77                         { 
    78                                 $controlled_by_quota = true; 
    79                                 $sector_info['diskQuota'] = (trim($_POST['disk_quota']) != "") ? $_POST['disk_quota'] : "0"; 
    80                         } 
    81                          
    82                         if( isset($_POST['users_quota']) ) 
    83                         { 
    84                                 $controlled_by_quota = true; 
    85                                 $sector_info['usersQuota'] = (trim($_POST['users_quota']) != "") ? $_POST['users_quota'] : "0"; 
    86                         } 
    87                          
    88                         if( isset($_POST['file_manager_quota']) ) 
    89                         { 
    90                                 $controlled_by_quota = true; 
    91                                 $sector_info['fileManagerQuota'] = (trim($_POST['file_manager_quota']) != "") ? $_POST['file_manager_quota'] : "0"; 
    92                         } 
    93                          
    94                         if($controlled_by_quota) 
    95                                 $sector_info['objectClass'][]   = 'phpgwQuotaControlled'; 
    96                                  
    9760                        // Chama funcao para escrever no OpenLDAP, case de erro, volta com msg de erro. 
    9861                        if (!$this->so->write_ldap($dn, $sector_info)) 
     
    10366                        } 
    10467                         
    105                         // Escreve no log 
     68                        //Escreve no log 
    10669                        $this->db_functions->write_log("created sector", "$dn"); 
    10770                         
     
    11376        function save_sector() 
    11477                { 
    115                         $sector_info = $this->so->get_info($_POST['context']); 
     78                $context = utf8_encode($_POST['context']); 
     79 
     80                        $sector_info = $this->so->get_info($context); 
    11681                         
    117                         if (($_POST['sector_visible'] == 'on') && ($sector_info[0]['phpgwaccountvisible'][0] != '-1')) 
     82                        if (($_POST['sector_visible'] == 'on') && ($sector_info['phpgwaccountvisible'] != '-1')) 
    11883                        { 
    119                                 $phpgwAccount = $controlled_by_quota = false; 
    12084                                foreach ($sector_info[0]['objectclass'] as $objectClass) 
    12185                                { 
    12286                                        if ($objectClass == 'phpgwAccount') 
    12387                                                $phpgwAccount = true; 
    124                                         if ($objectClass == 'phpgwquotacontrolled') 
    125                                                 $controlled_by_quota = true; 
     88                                        else 
     89                                                $phpgwAccount = false; 
    12690                                } 
    12791                                 
     
    13498                                $this->so->add_attribute($sector_info[0]['dn'], $ldap_mod_add); 
    13599                        } 
    136                         elseif($sector_info[0]['phpgwaccountvisible'][0] == '-1') 
     100                        else 
    137101                        { 
    138102                                $ldap_mod_del['objectClass'] = 'phpgwAccount'; 
     
    141105                        } 
    142106                         
    143                         //Modifica o conteúdo das cotas. 
    144                         if( (isset($_POST['disk_quota']) )  
    145                                 || (isset($_POST['users_quota']) )  
    146                                 || (isset($_POST['file_manager_quota']) )) { //se for passado alguma coisa, lógico 
    147                                  
    148                                 $file_manager_space = $this->functions->get_actual_disk_usage($_POST["context"],'FileManager'); 
    149                                 if($_POST["file_manager_quota"]<$file_manager_space){ 
    150                                         $_POST['error_messages'] = lang("Theres more disk space in use than the quota. It needs to be more than %1 MB",$file_manager_space); 
    151                                         $_GET['context'] = $_POST["context"]; 
    152                                         ExecMethod('expressoAdmin1_2.uisectors.edit_sector'); 
    153                                         return false; 
    154                                 } 
    155                                  
    156                                 if(!$controlled_by_quota) { 
    157                                         $ldap_mod_add['objectClass'][] = 'phpgwQuotaControlled'; 
    158                                         $this->so->add_attribute($sector_info[0]['dn'], $ldap_mod_add); 
    159                                 } 
    160                                  
    161                                 $ldap_mod_replace = array(); 
    162                                 $ldap_mod_replace['diskQuota'] = $_POST['disk_quota']; 
    163                                 $ldap_mod_replace['usersQuota'] = $_POST['users_quota']; 
    164                                 $ldap_mod_replace['fileManagerQuota'] = $_POST['file_manager_quota']; 
    165                                 $this->so->replace_attribute($sector_info[0]['dn'], $ldap_mod_replace); 
    166                         } 
    167                                  
    168107                        // Volta para o ListSectors 
    169108                        ExecMethod('expressoAdmin1_2.uisectors.list_sectors'); 
     
    184123                        $manager_context = $_POST['manager_context']; 
    185124 
    186                          
     125                        $sector_dn = utf8_encode($sector_dn); 
    187126 
    188127                        $sector_users = $this->so->get_sector_users($sector_dn); 
     128 
    189129                        for ($i=0; $i<count($sector_users)-1; $i++) 
    190130                        { 
Note: See TracChangeset for help on using the changeset viewer.