Changeset 5141 for trunk/phpgwapi


Ignore:
Timestamp:
11/03/11 13:53:15 (12 years ago)
Author:
wmerlotto
Message:

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

Location:
trunk/phpgwapi
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/cron/asyncservices.php

    r86 r5141  
    2424        $_GET['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'default'; 
    2525        $path_to_egroupware = realpath(dirname(__FILE__).'/../..');     //  need to be adapted if this script is moved somewhere else 
    26  
     26        $_SESSION['isCrun'] = true; 
    2727        // remove the comment from one of the following lines to enable loging 
    2828        // define('ASYNC_LOG','C:\\async.log');         // Windows 
  • trunk/phpgwapi/inc/class.accounts.inc.php

    r394 r5141  
    364364                } 
    365365 
    366                 function delete($accountid) 
     366                function delete($accountid = '') 
    367367                { 
    368368                        $this->cache_invalidate($accountid); 
    369                         accounts_::delete($accountid); 
     369                        parent::delete($accountid); 
    370370                         
    371371                        // delete all acl_entries belonging to that user or group 
  • trunk/phpgwapi/inc/class.accounts_ldap.inc.php

    r3456 r5141  
    6464                                /* jakjr: using justthese with ldap_search */ 
    6565                                $justthese = array("uidnumber", "gidnumber", "uid", "cn", "givenname", "sn", "mail", "phpgwaccountstatus", "phpgwaccountexpires", "phpgwaccounttype", "phpgwlastpasswdchange","phpgwagreeterm","telephonenumber","mobile","homephone","datanascimento"); 
    66                                 $sri = @ldap_search($this->ds, $this->user_context, ("(&(uidnumber=" . (int)$this->account_id.")(phpgwaccounttype=u))"), $justthese); 
     66                                $sri = @ldap_search($this->ds, $this->user_context, ("(&(uidnumber=" . (int)$this->account_id.")(|(phpgwaccounttype=u)(phpgwaccounttype=s)))"), $justthese); 
    6767                        } 
    6868                        if(!$sri) 
     
    427427                        if(!$allValues[0]['dn']) 
    428428                        { 
    429                                 $sri = ldap_search($this->ds, $this->user_context, "(&(uid=" . (string)$account_lid.")(phpgwaccounttype=u))"); 
     429                                $sri = ldap_search($this->ds, $this->user_context, "(&(uid=" . (string)$account_lid.")(|(phpgwaccounttype=u)(phpgwaccounttype=s)))"); 
    430430                                if($sri) 
    431431                                { 
     
    477477                        if($_type == 'accounts' || $_type == 'both') 
    478478                        { 
    479                                 $filter = "(&(uidnumber=*)(phpgwaccounttype=u)"; 
     479                                $filter = "(&(uidnumber=*)(|(phpgwaccounttype=u)(phpgwaccounttype=s))"; 
    480480                                if (!empty($query) && $query != '*') 
    481481                                { 
     
    600600                        if (!isset($to_ldap[$which])) return False; 
    601601                         
    602                         $sri = ldap_search($this->ds, $this->user_context, '(&('.$to_ldap[$which].'=' . (string)$name . ')(phpgwaccounttype=u))', array("uidnumber")); 
     602                        $sri = ldap_search($this->ds, $this->user_context, '(&('.$to_ldap[$which].'=' . (string)$name . ')(|(phpgwaccounttype=u)(phpgwaccounttype=s)))', array("uidnumber")); 
    603603                        $allValues = ldap_get_entries($this->ds, $sri); 
    604604 
     
    651651                        /* jakjr: using justthese with ldap_search */ 
    652652                        $justthese = array("uid","mail","surname","cn","phpgwaccounttype"); 
    653                         $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))', $justthese); 
     653                        $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(|(phpgwaccounttype=u)(phpgwaccounttype=s)))', $justthese); 
    654654                        if(!$sri) 
    655655                                return False; 
     
    667667                        $allValues = array(); 
    668668                        /* jakjr: using justthese with ldap_search */ 
    669                         $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))', array("phpgwaccounttype")); 
     669                        $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(|(phpgwaccounttype=u)(phpgwaccounttype=s)))', array("phpgwaccounttype")); 
    670670                        if(!$sri) 
    671671                                return False; 
     
    11151115                        else 
    11161116                        { 
    1117                                 $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwAccountType=u))', $justthese); 
     1117                                $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(|(phpgwaccounttype=u)(phpgwaccounttype=s)))', $justthese); 
    11181118                        } 
    11191119                        if(!$sri) 
     
    11761176                { 
    11771177                        $allValues = array(); 
    1178                         $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))'); 
     1178                        $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(|(phpgwaccounttype=u)(phpgwaccounttype=s)))'); 
    11791179                        if(!$sri) 
    11801180                                return False; 
     
    11901190                { 
    11911191                        $allValues = array(); 
    1192                         $sri = @ldap_search($this->ds, $this->user_context, '(&(mail=' . $mail . ')(phpgwaccounttype=u))'); 
     1192                        $sri = @ldap_search($this->ds, $this->user_context, '(&(mail=' . $mail . ')(|(phpgwaccounttype=u)(phpgwaccounttype=s)))'); 
    11931193                        if(!$sri) 
    11941194                                return False; 
  • trunk/phpgwapi/inc/class.asyncservice.inc.php

    r3395 r5141  
    701701                                                                                  
    702702                                        //$cronline .= $this->php.' -q '.$this->cronline."\n"; 
    703                                         $php_version = preg_match("/5./",phpversion()) ? "php5" : "php4"; 
    704                                         $cronline .= "cd " . PHPGW_SERVER_ROOT . "/phpgwapi/cron/; $php_version -c /etc/$php_version/apache2/php.ini -q " . PHPGW_SERVER_ROOT . "/phpgwapi/cron/asyncservices.php default\n"; 
     703                                        $php_version = preg_match("/5./",phpversion()) ? "php" : "php4"; 
     704                                        $cronline .= "cd " . PHPGW_SERVER_ROOT . "/phpgwapi/cron/; $php_version -c /etc/php.ini -q " . PHPGW_SERVER_ROOT . "/phpgwapi/cron/asyncservices.php default\n"; 
    705705                                        //echo "<p>Installing: '$cronline'</p>\n"; 
    706706                                        fwrite($crontab,$cronline); 
  • trunk/phpgwapi/inc/class.auth_ldap.inc.php

    r4886 r5141  
    5656                        } 
    5757                        /* find the dn for this uid, the uid is not always in the dn */ 
    58                         $attributes     = array('uid','dn','givenName','sn','mail','uidNumber','gidNumber','usercertificate'); 
     58                        $attributes     = array('uid','dn','givenName','sn','mail','uidNumber','gidNumber'); 
     59                         
    5960                        $filter = $GLOBALS['phpgw_info']['server']['ldap_search_filter'] ? $GLOBALS['phpgw_info']['server']['ldap_search_filter'] : '(uid=%user)'; 
    6061                        $filter = str_replace(array('%user','%domain'),array($username,$GLOBALS['phpgw_info']['user']['domain']),$filter); 
     
    7374                                { 
    7475                                        if($allValues[0]['uid'][0] != $username) 
    75                                         { 
    76                                                 return false; 
    77                                         } 
    78                                 } 
    79                                 if($_SESSION['login_certificate']) 
    80                                 { 
    81                                         # certificate not equal, not authenticate. 
    82                                         if($allValues[0]['usercertificate'][0] != $_SESSION['login_certificate']) 
    8376                                        { 
    8477                                                return false; 
  • trunk/phpgwapi/inc/class.browser.inc.php

    r4304 r5141  
    7070                        elseif(ereg('Gecko',$HTTP_USER_AGENT,$log_version)) 
    7171                        { 
     72                                if(isset($log_version[1])) 
    7273                                $this->BROWSER_VER   = $log_version[1]; 
    7374                                $this->BROWSER_AGENT = 'MOZILLA'; 
  • trunk/phpgwapi/inc/class.common.inc.php

    r4935 r5141  
    18391839                                case 46: $s .= lang('Recurrent appointments must have a final date').'.'; 
    18401840                                        break; 
    1841                                 case 47: $s .= lang('End time can not be less than or equal to start time').'.'; 
     1841                                case 47: $s .= lang('The starting time can not be greater than end time').'.'; 
    18421842                                        break; 
    18431843                                case 99: $s .= lang('The attachment is to big').'.'; 
  • trunk/phpgwapi/inc/class.sessions.inc.php

    r4989 r5141  
    5353                */ 
    5454                var $passwd; 
    55 /** 
    56                 * @var string current user certificate, if present 
    57                 */ 
    58                 var $certificate; 
     55 
    5956                /** 
    6057                * @var int current user db/ldap account id 
     
    466463                                $this->passwd_type = $passwd_type; 
    467464                        } 
    468                         if($_SESSION['login_certificate']) 
    469                         { 
    470                                $this->certificate = $_SESSION['login_certificate']; 
    471                         } 
    472                         else 
    473                         { 
    474                                $this->certificate = false; 
    475                         } 
     465 
    476466                        $this->clean_sessions(); 
    477467                        //sessions_::split_login_domain($login,$this->account_lid,$this->account_domain); 
     
    575565 
    576566                        $this->appsession('password','phpgwapi',base64_encode($this->passwd)); 
    577                         $this->appsession('browser_agent','phpgwapi',$GLOBALS['browser']->BROWSER_AGENT); 
    578                         if($this->certificate) $this->appsession('certificate','phpgwapi',$this->certificate); 
    579567                        if ($GLOBALS['phpgw']->acl->check('anonymous',1,'phpgwapi')) 
    580568                        { 
  • trunk/phpgwapi/inc/class.vfs_shared.inc.php

    r5036 r5141  
    419419 
    420420                /*! 
    421                 * @function get_size_all 
    422                 * @abstract Determine size of location 
    423                 * @owner_id string      uid owner 
    424                 */ 
    425                  
    426                 function get_size_all($owner_id) { return 0; } 
    427                  
    428                 /*! 
    429421                 * @function get_size 
    430422                 * @abstract Determine size of location 
  • trunk/phpgwapi/inc/class.vfs_sql.inc.php

    r5036 r5141  
    25132513                } 
    25142514                 
    2515                 function get_size_all($owner_id) 
    2516                 { 
    2517                         $query = $GLOBALS['phpgw']->db->query ("SELECT Sum(size) FROM phpgw_vfs WHERE owner_id = '".$owner_id."'" . 
    2518                                                                                                         $this->extra_sql(array ('query_text' => VFS_SQL_SELECT))); 
    2519                         $GLOBALS['phpgw']->db->next_record (); 
    2520                          
    2521                         $size = $GLOBALS['phpgw']->db->Record[0];                        
    2522                          
    2523                         return $size; 
    2524                 }                
    2525  
    25262515                /*return the total number of files in path*/ 
    25272516                function count_files($data){ 
  • trunk/phpgwapi/inc/csstidy/class.csstidy.php

    r3052 r5141  
    932932 * @version 1.0 
    933933 */ 
    934 function is_important(&$value) 
     934static function is_important(&$value) 
    935935{ 
    936936        return (!strcasecmp(substr(str_replace($GLOBALS['csstidy']['whitespace'],'',$value),-10,10),'!important')); 
  • trunk/phpgwapi/inc/functions.inc.php

    r5036 r5141  
    345345                                } 
    346346                        } 
    347  
    348                         $ifMobile = false; 
    349                         $browser = CreateObject('phpgwapi.browser'); 
    350                         switch ( $browser->get_platform() ) 
    351                         { 
    352                                 case browser::PLATFORM_IPHONE: 
    353                                 case browser::PLATFORM_IPOD: 
    354                                 case browser::PLATFORM_IPAD: 
    355                                 case browser::PLATFORM_BLACKBERRY: 
    356                                 case browser::PLATFORM_NOKIA: 
    357                                 case browser::PLATFORM_ANDROID: 
    358                                         $ifMobile = true;                                                
    359                                         break; 
    360                         } 
    361                          
    362                         if( $ifMobile )                  
    363                         { 
    364                                 Header('Location: '.$GLOBALS['phpgw_info']['server']['webserver_url'].'/login.php?cd=66'); 
    365                                 exit; 
    366                         } 
    367                         else 
    368                         { 
    369347                                // this removes the sessiondata if its saved in the URL 
    370348                                $query = preg_replace('/[&]?sessionid(=|%3D)[^&]+&kp3(=|%3D)[^&]+&domain=.*$/','',$_SERVER['QUERY_STRING']); 
     
    372350                                exit; 
    373351                        } 
    374                 } 
    375352 
    376353                $GLOBALS['phpgw']->datetime = CreateObject('phpgwapi.date_time'); 
  • trunk/phpgwapi/setup/setup.inc.php

    r4186 r5141  
    1414        $setup_info['phpgwapi']['name']      = 'phpgwapi'; 
    1515        $setup_info['phpgwapi']['title']     = 'API'; 
    16         $setup_info['phpgwapi']['version']   = '2.2.1'; 
    17         $setup_info['phpgwapi']['versions']['current_header'] = '2.2'; 
     16        $setup_info['phpgwapi']['version']   = '2.4.0'; 
     17        $setup_info['phpgwapi']['versions']['current_header'] = '2.4.0'; 
    1818        $setup_info['phpgwapi']['enable']    = 3; 
    1919        $setup_info['phpgwapi']['app_order'] = 1; 
  • trunk/phpgwapi/templates/default/css/base.css

    r3019 r5141  
    8383} 
    8484 
    85 ul 
     85#ul 
    8686{ 
    8787        list-style-image: url( "../images/orange-ball.png" ); 
  • trunk/phpgwapi/templates/default/js/listUsers.js

    r4992 r5141  
    5454        function execAction(action){ 
    5555 
    56                 if(window.opener){ 
    57                     try{ 
    58                         doc = window.opener.document; 
    59                         select = doc.getElementById('user_list'); 
    60                     } 
    61                     catch(e){ 
    62                         doc = window.document; 
    63                         } 
    64                 } 
    65                 else{ 
     56                if(!window.opener)                               
    6657                    doc = window.document; 
    67                 } 
     58                else 
     59                        doc = window.opener.document; 
    6860 
    6961                select = doc.getElementById('user_list');                                        
  • trunk/phpgwapi/templates/default/login.tpl

    r4994 r5141  
    1212<script language="Javascript"> 
    1313<!-- 
    14  
    15          
    16         function isCompat(){ 
    17              version = (navigator.userAgent.match( /.+ie\s([\d.]+)/i ) || [])[1]; 
    18              if(parseInt(version)==7 && (/trident\/\d/i.test(navigator.userAgent))) 
    19                 alert("{compatIE8}"); 
    20         } 
    2114 
    2215        function setLogin(){ 
     
    139132</script> 
    140133</HEAD> 
    141 <body scroll="no"  style="overflow:hidden" onLoad="javascript:getLogin();isCompat();" bgcolor="#ffffff"> 
     134<body scroll="no"  style="overflow:hidden" onLoad="javascript:getLogin()" bgcolor="#ffffff"> 
    142135<form id="loginForm" name="flogin" method="post" action="{login_url}" {autocomplete}> 
    143136<div id="conteudo"> 
  • trunk/phpgwapi/templates/default/login_default.php

    r5042 r5141  
    1212        \**************************************************************************/ 
    1313 
    14         function check_logoutcode($code) 
     14function check_logoutcode($code) 
    1515        { 
    1616                switch($code) 
     
    5757                } 
    5858        } 
    59          
    60         $ifMobile = false; 
    61         $browser = CreateObject('phpgwapi.browser'); 
    62         switch ( $browser->get_platform() ) 
    63         { 
    64                 case browser::PLATFORM_IPHONE: 
    65                 case browser::PLATFORM_IPOD: 
    66                 case browser::PLATFORM_IPAD: 
    67                 case browser::PLATFORM_BLACKBERRY: 
    68                 case browser::PLATFORM_NOKIA: 
    69                 case browser::PLATFORM_ANDROID: 
    70                         $ifMobile = true;                                                
    71                         break; 
    72         } 
    73          
    74         if( $ifMobile && $_GET['dont_redirect_if_moble'] != 1 )  
    75         { 
    76                 $GLOBALS['phpgw']->redirect_link('/mobile/login.php'); 
    77         } 
    78         else 
    79         { 
     59        function troca_espaco_por_mais($pem_data) 
     60        { 
     61            $begin = "CERTIFICATE-----"; 
     62            $end   = "-----END"; 
     63            $aux = substr($pem_data, strpos($pem_data, $begin)+strlen($begin)); 
     64            $aux = substr($aux, 0, strpos($aux, $end)); 
     65            $aux = strtr($aux,' ','+'); 
     66            $aux = '-----BEGIN CERTIFICATE-----'.$aux.'-----END CERTIFICATE-----'; 
     67            return $aux; 
     68        } 
    8069        /* Program starts here */ 
     70         
    8171        if($GLOBALS['phpgw_info']['server']['auth_type'] == 'http' && isset($_SERVER['PHP_AUTH_USER'])) 
    8272        { 
     
    124114                unset($sslattributes); 
    125115        } 
    126  
     116        if(isset($_POST['certificado']) && $_POST['certificado']) 
     117        { 
     118 
     119            $_SESSION['login_certificado'] = troca_espaco_por_mais(str_replace(chr(0x0D).chr(0x0A),chr(0x0A),str_replace(chr(0x0A).chr(0x0A),chr(0x0A),$_POST['certificado']))); 
     120        } 
    127121    if( isset( $_GET[ 'cd' ] ) && ( $_GET['cd']=='1' || $_GET['cd'] == 10 ) ) 
    128122        { 
     
    266260                        */ 
    267261                        $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $lang; 
     262 
     263                        if (!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['theme'])) 
     264                        { 
     265                                $prefs2 = CreateObject('phpgwapi.preferences'); 
     266                                $temp_pref = $prefs2->read_repository(); 
     267                                $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] = $temp_pref['common']['theme']; 
     268                        } 
    268269                } 
    269270                #print 'LANG:' . $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] . '<br>'; 
     
    584585 
    585586        $tmpl->pfp('loginout','login_form'); 
    586         } 
    587587 
    588588?> 
  • trunk/phpgwapi/templates/default/navbar.inc.php

    r4886 r5141  
    239239                        } 
    240240                        $now = time(); 
    241                         $var['user_info'] = '<b>'.$GLOBALS['phpgw']->common->display_fullname() . ($GLOBALS['phpgw']->session->appsession('certificate','phpgwapi')?'(' .lang('Identified by Digital Certificate') . ')':'') . '</b>'. ' - ' 
     241                        $var['user_info'] = '<b>'.$GLOBALS['phpgw']->common->display_fullname() .'</b>'. ' - ' 
    242242                        . lang($GLOBALS['phpgw']->common->show_date($now,'l')) . ' ' 
    243243                        . $GLOBALS['phpgw']->common->show_date($now,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']); 
Note: See TracChangeset for help on using the changeset viewer.