Ignore:
Timestamp:
09/17/12 14:30:47 (12 years ago)
Author:
douglas
Message:

Ticket #0000 - Copiadas as alterações do Trunk. Versão final da 2.4.2.

Location:
branches/2.4
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2.4

  • branches/2.4/expressoMail1_2/inc/class.exporteml.inc.php

    r5934 r7228  
    1616        var $mbox_stream; 
    1717        var $tempDir; 
    18          
     18 
    1919        function ExportEml() { 
    2020            
     
    5050                return $sEMail; 
    5151        } 
    52          
     52 
    5353        // create EML File. 
    5454        // Funcao alterada para tratar a exportacao 
     
    6262            $header    = imap_headerinfo($this->mbox_stream, imap_msgno($this->mbox_stream, $id), 80, 255); 
    6363            $subject = $this->decode_subject($header->fetchsubject); 
    64              
     64                         
    6565            if (strlen($subject) > 60) 
    6666                $subject = substr($subject, 0, 59); 
     
    214214                // se encontram em um mesmo folder 
    215215                if (count($sorted_msgs)==1){ 
    216                                                          
    217216                        $array_names_keys = array_keys($sorted_msgs); 
    218217                        $this->folder = mb_convert_encoding($array_names_keys[0], "UTF7-IMAP","UTF-8, ISO-8859-1, UTF7-IMAP"); 
     
    228227                                $fileName       = $this->CreateFileEml($sEMLData, $tempDir, $msg_number[0]."_".$_SESSION[ 'phpgw_session' ][ 'session_id' ]); 
    229228                 
    230                                  
     229                                $header    = imap_headerinfo($this->mbox_stream, imap_msgno($this->mbox_stream, $msg_number[0]), 80, 255); 
     230                $subject = $this->decode_subject(html_entity_decode($header->fetchsubject)); 
     231 
    231232                                imap_close($this->mbox_stream); 
    232233                                if (!$fileName) { 
    233234                                        return false; 
    234235                                }else{ 
    235                                         return $tempDir.'/'.$fileName; 
     236                                        $return = array(); 
     237                                        $return[] = $tempDir.'/'.$fileName; 
     238                                        $return[] = $subject; 
     239                                        return $return; 
    236240                                } 
    237241                        } 
     
    271275                        } 
    272276 
    273                         return $file; 
     277                        return $file;                    
    274278                 
    275279                //exporta mensagens de diferentes pastas 
     
    362366                                $file = false; 
    363367                        } 
    364  
    365368            return $file; 
    366369                 
     
    369372                { 
    370373                        $this-> folder = $params['folder']; 
    371                                 $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8, ISO-8859-1, UTF7-IMAP"); 
     374                        $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8, ISO-8859-1, UTF7-IMAP"); 
    372375                        $array_ids = explode(',', $params['msgs_to_export']); 
    373376                        $error = False; 
     
    383386                                $sEMLData       = $this->parseEml($header, $body);                      
    384387                                $fileName       = $this->CreateFileEml($sEMLData, $tempDir, $array_ids[0]."_".$_SESSION[ 'phpgw_session' ][ 'session_id' ]); 
     388                         
     389                                $header    = imap_headerinfo($this->mbox_stream, imap_msgno($this->mbox_stream, $array_ids[0]), 80, 255); 
     390                    $subject = $this->decode_subject(html_entity_decode($header->fetchsubject)); 
    385391 
    386392                                imap_close($this->mbox_stream); 
     
    388394                                        return false; 
    389395                                } else { 
    390                                         return $tempDir.'/'.$fileName; 
     396                                        $return = array(); 
     397                                        $return[] = $tempDir.'/'.$fileName; 
     398                                        $return[] = $subject; 
     399                                        return $return; 
    391400                                } 
    392401                        } 
     
    416425                                {                
    417426                                        $file = $tempDir.'/'.$nameFileZip; 
     427                                        $ret[] = $file; 
     428                                    return $ret;   
    418429                                } else { 
    419430                                        $file = false; 
     
    424435                                $file = false; 
    425436                        } 
    426  
    427437                        return $file; 
    428438                } 
     
    453463                        $fileName       = $this->CreateFileEml($sEMLData, $tempDir, $array_ids[0]."_".$_SESSION[ 'phpgw_session' ][ 'session_id' ]); 
    454464 
     465                        $header    = imap_headerinfo($this->mbox_stream, imap_msgno($this->mbox_stream, $array_ids[0]), 80, 255); 
     466            $subject = $this->decode_subject(html_entity_decode($header->fetchsubject)); 
     467 
    455468                        imap_close($this->mbox_stream); 
    456469                        if (!$fileName) { 
    457470                                return false; 
    458471                        } else { 
    459                                 return $tempDir.'/'.$fileName; 
     472                                $return = array(); 
     473                                $return[] = $tempDir.'/'.$fileName; 
     474                                $return[] = $subject; 
     475                                return $return; 
    460476                        } 
    461477                } 
  • branches/2.4/expressoMail1_2/inc/class.imap_functions.inc.php

    r7180 r7228  
    128128                $result = true; 
    129129                if(!imap_renamemailbox($mbox, '{'.$this->imap_server.":".$this->imap_port.$this->imap_options.'}'.$old_folder, '{'.$this->imap_server.":".$this->imap_port.$this->imap_options.'}'.$to_folder.$this->imap_delimiter.$new_folder[count($new_folder)-1])){ 
    130                         $result = false; 
    131                 } 
     130                        $result = imap_last_error(); 
     131                } 
     132 
    132133                imap_close($mbox);  
    133134                return $result; 
     
    10611062                $content = $this->html2txt($content);    
    10621063                $content != "" ? $return['body'] = " - " . $content: $return['body'] = ""; 
    1063         $return['body'] = base64_encode(mb_convert_encoding(substr($return['body'], 0, 305),'UTF-8' , 'UTF-8,ISO-8859-1'));  
     1064                $return['body'] = base64_encode(mb_convert_encoding(substr($return['body'], 0, 305),'UTF-8' , 'UTF-8,ISO-8859-1')); 
    10641065                return $return; 
    10651066        } 
     
    12351236                $return['sender']['name'] = isset($sender[0]->personal) ? $this->decode_string($sender[0]->personal): ''; 
    12361237                $return['sender']['email'] = $this->decode_string($sender[0]->mailbox . "@" . $sender[0]->host); 
    1237                  
     1238 
    12381239                if ($return['sender']['name']) 
    12391240                { 
     
    12561257                                if (!empty($tmp->personal)) 
    12571258                                { 
    1258                                         $personal_tmp = $this->formatMailObject($tmp);  
    1259                         $return['toaddress2'] .= '"' . $personal_tmp['name'] . '"'; 
     1259                                        $personal_tmp = $this->formatMailObject($tmp); 
     1260                                        $return['toaddress2'] .= '"' . $personal_tmp['name'] . '"'; 
    12601261                                        $return['toaddress2'] .= " "; 
    12611262                                        $return['toaddress2'] .= "<"; 
     
    12881289                                if (!empty($tmp_cc->personal)) 
    12891290                                { 
    1290                                         $personal_tmp_cc = $this->formatMailObject($tmp_cc);  
    1291                         $return['cc'] .= '"' . $personal_tmp_cc['name']. '"';  
     1291                                        $personal_tmp_cc = $this->formatMailObject($tmp_cc); 
     1292                                        $return['cc'] .= '"' . $personal_tmp_cc['name']. '"'; 
    12921293                                        $return['cc'] .= " "; 
    12931294                                        $return['cc'] .= "<"; 
     
    13281329                                if (!empty($tmp_bcc->personal)) 
    13291330                                { 
    1330                                         $personal_tmp_bcc = $this->formatMailObject($tmp_bcc);  
    1331                         $return['bcc'] .= '"' . $personal_tmp_bcc['name'] . '"'; 
     1331                                        $personal_tmp_bcc = $this->formatMailObject($tmp_bcc); 
     1332                                        $return['bcc'] .= '"' . $personal_tmp_bcc['name'] . '"'; 
    13321333                                        $return['bcc'] .= " "; 
    13331334                                        $return['bcc'] .= "<"; 
     
    13551356                $reply_to = $header->reply_to; 
    13561357                $return['reply_to'] = ""; 
     1358                 
    13571359                if (is_object($reply_to[0])) 
    13581360                { 
    13591361                        if ($return['from']['email'] != ($reply_to[0]->mailbox."@".$reply_to[0]->host)) 
    13601362                        { 
    1361                                 if (!empty($reply_to[0]->personal)) 
     1363                                foreach ($reply_to as $tmp_reply_to) 
    13621364                                { 
    1363                                         $personal_reply_to = $this->formatMailObject($tmp_reply_to); 
    1364                                         if(!empty($personal_reply_to[0]->text)) { 
    1365                                                 $return['reply_to'] .= '"' . $personal_reply_to['name']. '"'; 
     1365                                        if (!empty($tmp_reply_to->personal)) 
     1366                                        { 
     1367                                                $personal_tmp_reply_to = $this->formatMailObject($tmp_reply_to); 
     1368                                                $return['reply_to'] .= '"' . $personal_tmp_reply_to['name'] . '"'; 
    13661369                                                $return['reply_to'] .= " "; 
    13671370                                                $return['reply_to'] .= "<"; 
    1368                                                 $return['reply_to'] .= $personal_reply_to['email']; 
     1371                                                $return['reply_to'] .= $personal_tmp_reply_to['email']; 
    13691372                                                $return['reply_to'] .= ">"; 
     1373                                                $return['reply_to'] .= ", "; 
    13701374                                        } 
    1371                                         else { 
    1372                                                 $return['reply_to'] .= $reply_to[0]->mailbox . "@" . $reply_to[0]->host; 
     1375                                        else 
     1376                                        { 
     1377                                                if (isset($tmp_reply_to->host) && $tmp_reply_to->host != 'unspecified-domain') 
     1378                                                        $return['reply_to'] .= $tmp_reply_to->mailbox . "@" . $tmp_reply_to->host; 
     1379                                                else 
     1380                                                        $return['reply_to'] .= $tmp_reply_to->mailbox; 
     1381                                                $return['reply_to'] .= ", "; 
    13731382                                        } 
    13741383                                } 
    1375                                 else 
    1376                                 { 
    1377                                         $return['reply_to'] .= $reply_to[0]->mailbox . "@" . $reply_to[0]->host; 
    1378                                 } 
    1379                         } 
    1380                 } 
    1381                 $return['reply_to'] = $this->decode_string($return['reply_to']); 
     1384                                $return['reply_to'] = $this->del_last_two_caracters($return['reply_to']); 
     1385                        } 
     1386                } 
     1387                else 
     1388                { 
     1389                        $return['reply_to'] = ""; 
     1390                } 
     1391 
    13821392                $return['subject'] = ( isset($header->subject) && trim($header->subject) !== '' ) ?  self::decodeMimeString($header->subject) : $this->functions->getLang('(no subject)   '); 
    13831393 
     
    13981408                }   
    13991409                $return['alarm'] = $alarm; 
    1400          
     1410                 
    14011411                return $return; 
    14021412        } 
     
    18961906            $body = str_ireplace('<o:p>&nbsp;</o:p>','<br />', $body);//Qubra de linha do MSO 
    18971907            $body = preg_replace('/<(meta|base|link|html|\/html)[^>]*>/i', '', $body); 
     1908 
     1909 
     1910                        // Malicious Code Remove 
     1911            $dirtyCodePattern = "/(<([\w]+[\w0-9]*)(.*)on(mouse(move|over|down|up)|load|blur|change|error|click|dblclick|focus|key(down|up|press)|select)([\n\ ]*)=([\n\ ]*)[\"'][^>\"']*[\"']([^>]*)>)(.*)(<\/\\2>)?/misU"; 
     1912            preg_match_all($dirtyCodePattern, $body, $rest, PREG_PATTERN_ORDER); 
     1913            foreach ($rest[0] as $i => $val) { 
     1914                if (!(preg_match("/javascript:window\.open\(\"([^'\"]*)\/index\.php\?menuaction=calendar\.uicalendar\.set_action\&cal_id=([^;'\"]+);?['\"]/i", $rest[1][$i]) && strtoupper($rest[4][$i]) == "CLICK" )) //Calendar events 
     1915                    $body = str_replace($rest[1][$i], "<" . $rest[2][$i] . $rest[3][$i] . $rest[7][$i] . ">", $body); 
     1916            } 
    18981917             
    18991918 
     
    19321951            $body = str_ireplace('position:absolute;', '', $body); 
    19331952                 
     1953            $body = str_ireplace('position:absolute;', '', $body); 
     1954 
    19341955            //Remoção de tags <span></span> para correção de erro no firefox 
    19351956            //Comentado pois estes replaces geram erros no html da msg, não se pode garantir que o os </span></span> sejam realmente os fechamentos dos <span><span>. 
     
    21452166                $return['status'] = true; 
    21462167 
    2147                         //Este bloco tem a finalidade de averiguar as permissoes para pastas compartilhadas  
    2148             if (substr($folder,0,4) == 'user'){  
    2149                     $acl = $this->getacltouser($folder, isset($params['decoded']));  
    2150                     /*  
    2151                      * l - lookup (mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox)  
    2152                  * r - read (SELECT the mailbox, perform STATUS)  
    2153                  * s - keep seen/unseen information across sessions (set or clear \SEEN flag via STORE, also set \SEEN during APPEND/COPY/        FETCH BODY[...])  
    2154                  * w - write (set or clear flags other than \SEEN and \DELETED via STORE, also set them during APPEND/COPY)  
    2155                  * i - insert (perform APPEND, COPY into mailbox)  
    2156                  * p - post (send mail to submission address for mailbox, not enforced by IMAP4 itself)  
    2157                  * k - create mailboxes (CREATE new sub-mailboxes in any implementation-defined hierarchy, parent mailbox for the new mailbox name in RENAME)  
    2158                  * x - delete mailbox (DELETE mailbox, old mailbox name in RENAME)  
    2159                  * t - delete messages (set or clear \DELETED flag via STORE, set \DELETED flag during APPEND/COPY)  
    2160                  * e - perform EXPUNGE and expunge as a part of CLOSE  
    2161                  * a - administer (perform SETACL/DELETEACL/GETACL/LISTRIGHTS)  
    2162                  * Os Atributos da ACL para pastas compartilhadas são definidos no arquivo sharemailbox.js, na função setaclfromuser  
    2163                  * Os Atributos da ACL para contas compartilhadas são definidos no arquivo shared_accounts.js, na função setaclfromuser   
    2164                  */  
    2165                             $acl_share_delete = (stripos($acl,'t') !== false && stripos($acl,'e') !== false);  
    2166                   
    2167                                 if (!$acl_share_delete) {   
    2168                                     $return['status'] = false;  
    2169                             }  
    2170             }  
    2171              
     2168                //Este bloco tem a finalidade de averiguar as permissoes para pastas compartilhadas 
     2169        if (substr($folder,0,4) == 'user'){ 
     2170                $acl = $this->getacltouser($folder, isset($params['decoded'])); 
     2171                /* 
     2172                        * l - lookup (mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox) 
     2173                        * r - read (SELECT the mailbox, perform STATUS) 
     2174                        * s - keep seen/unseen information across sessions (set or clear \SEEN flag via STORE, also set \SEEN during APPEND/COPY/        FETCH BODY[...]) 
     2175                        * w - write (set or clear flags other than \SEEN and \DELETED via STORE, also set them during APPEND/COPY) 
     2176                        * i - insert (perform APPEND, COPY into mailbox) 
     2177                        * p - post (send mail to submission address for mailbox, not enforced by IMAP4 itself) 
     2178                        * k - create mailboxes (CREATE new sub-mailboxes in any implementation-defined hierarchy, parent mailbox for the new mailbox name in RENAME) 
     2179                        * x - delete mailbox (DELETE mailbox, old mailbox name in RENAME) 
     2180                        * t - delete messages (set or clear \DELETED flag via STORE, set \DELETED flag during APPEND/COPY) 
     2181                        * e - perform EXPUNGE and expunge as a part of CLOSE 
     2182                        * a - administer (perform SETACL/DELETEACL/GETACL/LISTRIGHTS) 
     2183                        * Atributos da ACL para pastas compartilhadas são definidos no arquivo sharemailbox.js, na função setaclfromuser 
     2184                        * Atributos da ACL para contas compartilhadas são definidos no arquivo shared_accounts.js, na função setaclfromuser 
     2185                        */ 
     2186                        $acl_share_delete = (stripos($acl,'t') !== false && stripos($acl,'e') !== false); 
     2187 
     2188                        if (!$acl_share_delete) { 
     2189                                $return['status'] = false; 
     2190                        } 
     2191        } 
     2192 
    21722193                return $return; 
    21732194        } 
    2174  
    21752195 
    21762196        function refresh($params) 
     
    23672387            foreach ($return as $i => &$vv) 
    23682388            { 
    2369                 if(!is_array($vv)) continue;  
    2370                   
    2371             $vv['folder_id'] = mb_convert_encoding($vv['folder_id'],'ISO-8859-1','UTF7-IMAP');//DECODIFICA ID DAS PASTAS COM ACENTOS  
    2372             $vv['folder_name'] = mb_convert_encoding($vv['folder_name'],'ISO-8859-1','UTF7-IMAP');//DECODIFICA NOME DAS PASTAS COM ACENTOS  
    2373             $vv['folder_parent'] = mb_convert_encoding($vv['folder_parent'],'ISO-8859-1','UTF7-IMAP');//DECODIFICA NOME DAS PASTAS COM ACENTOS 
     2389            if(!is_array($vv)) continue; 
     2390 
     2391            $vv['folder_id'] = mb_convert_encoding($vv['folder_id'],'ISO-8859-1','UTF7-IMAP');//DECODIFICA ID DAS PASTAS COM ACENTOS 
     2392            $vv['folder_name'] = mb_convert_encoding($vv['folder_name'],'ISO-8859-1','UTF7-IMAP');//DECODIFICA NOME DAS PASTAS COM ACENTOS 
     2393            $vv['folder_parent'] = mb_convert_encoding($vv['folder_parent'],'ISO-8859-1','UTF7-IMAP');//DECODIFICA NOME DAS PASTAS COM ACENTOS 
    23742394            } 
    23752395 
     
    24122432                        $decifrada = mb_convert_encoding('INBOX'.$this->imap_delimiter.'decifradas','UTF7-IMAP','ISO-8859-1'); //Ignorar esta pasta decifrada 
    24132433                        $parent = ($nameCount > 1 && $nameArray[($nameCount - 2)] !== 'INBOX') ? implode($this->imap_delimiter, array_slice($nameArray, 0, ($nameCount - 1))): ''; //Pega folder pai 
    2414                         if($nameArray[0] === 'user') 
    2415                                 $folders[$prefixShared.$this->imap_delimiter.$nameArray[1]][] = array('id' => $folderId , 'stream' => $v->name , 'attributes' => $v->attributes , 'name' => $nameArray[($nameCount-1)] , 'user' => $nameArray[1] ,'parent' => $parent); 
    2416                         else if( $folderId !== $decifrada) //Escapa pasta decifrada 
    2417                                 $folders['INBOX'][strtolower($folderId)] =  array('id' => $folderId , 'stream' => $v->name , 'attributes' => $v->attributes ,'name' => $nameArray[($nameCount-1)] , 'parent' => $parent); 
    2418                 } 
     2434 
     2435                        if($nameArray[0] === 'user'){ 
     2436 
     2437                                //variaveis utilizadas para definição das permissões das pastas compartilhadas 
     2438                                $acl_share_create = 0; 
     2439                                $acl_share_rename = 0; 
     2440                                $acl_share_delete = 0; 
     2441 
     2442                                //recuperando as permissões (ACLs) aplicadas na pasta 
     2443                                $imap_getacl = imap_getacl($mboxStream, $folderId); 
     2444 
     2445                                //Se existe ACLs aplicadas a respectiva pasta (para o usuario corrente) 
     2446                                if(isset($imap_getacl[ $this->username ])){ 
     2447                                        $aclImap = $imap_getacl[ $this->username ]; 
     2448 
     2449                                        //A partir dos atributos da ACL definir permissões para cada ação (create, delete e rename): 
     2450                                        //http://www.ietf.org/rfc/rfc4314.txt 
     2451                                        $acl_share_create = (stripos($aclImap,'w') !== false && stripos($aclImap,'i') !== false && stripos($aclImap,'k') !== false) ? 1 : 0; 
     2452                                        $acl_share_delete = (stripos($aclImap,'x') !== false && stripos($aclImap,'t') !== false && stripos($aclImap,'e') !== false) ? 1 : 0; 
     2453 
     2454                                        $acl_share_rename = ($acl_share_create && $acl_share_delete) ? 1 : 0; 
     2455                                } 
     2456 
     2457                                $folders[$prefixShared.$this->imap_delimiter.$nameArray[1]][] = array( 
     2458                                        'id' => $folderId ,  
     2459                                        'stream' => $v->name ,  
     2460                                        'attributes' => $v->attributes ,  
     2461                                        'name' => $nameArray[($nameCount-1)] ,  
     2462                                        'user' => $nameArray[1] , 
     2463                                        'parent' => $parent , 
     2464 
     2465                                        //Acrescentando ACLs configuradas a cada pasta compartilhada 
     2466                                        'acl_share' => array( 
     2467                                                'create' => $acl_share_create, 
     2468                                                'rename' => $acl_share_rename, 
     2469                                                'delete' => $acl_share_delete 
     2470                                        ) 
     2471                                ); 
     2472 
     2473                        }        
     2474                        else if( $folderId !== $decifrada){ //Escapa pasta decifrada 
     2475                                $folders['INBOX'][strtolower($folderId)] = array( 
     2476                                        'id' => $folderId ,  
     2477                                        'stream' => $v->name ,  
     2478                                        'attributes' => $v->attributes , 
     2479                                        'name' => $nameArray[($nameCount-1)] ,  
     2480                                        'parent' => $parent  
     2481                                ); 
     2482                        } 
     2483                } 
     2484 
    24192485                unset($folders_list); //destroy array de objetos desnecessarios 
    24202486                 
     
    24342500                                $append['folder_hasChildren'] = (($vv['attributes'] == 32) && ($vv['name'] != 'INBOX')) ? 1 : 0; 
    24352501                                $append['folder_parent'] = $vv['parent']; 
     2502 
     2503                                //Preparando o array de retorno para conter as ACLs configuradas para cada pasta 
     2504                                if(isset($vv['acl_share'])){ 
     2505                                        $append['acl_share'] = $vv['acl_share']; 
     2506                                } 
    24362507                                $return[] = $append; 
    24372508                        } 
     
    24402511                $quotaInfo =  (!isset($params['noQuotaInfo'])) ? $this->get_quota( array('folder_id' => $currentFolder)) : false; //VERIFICA SE O USUARIO TEM COTA 
    24412512 
    2442                 return ( ( is_array($quotaInfo) ) ?  array_merge($return, $quotaInfo) : $return );         
     2513                return ( ( is_array($quotaInfo) ) ?  array_merge($return, $quotaInfo) : $return ); 
    24432514        } 
    24442515     
     
    24602531                        if(!imap_createmailbox($mbox_stream,"{".$imap_server."}".$namebox)) 
    24612532                        { 
    2462                                 $result = implode("<br />\n", imap_errors()); 
     2533                                $result = imap_last_error(); 
    24632534                        } 
    24642535                }else{ 
     
    24712542                                if(!imap_createmailbox($mbox_stream,"{".$imap_server."}$namebox")) 
    24722543                                { 
    2473                                         $result = implode("<br />\n", imap_errors());                                            
     2544                                        $result = imap_last_error();                                             
    24742545                                } 
    24752546                                $child .=$this->imap_delimiter; 
     
    25132584                if(!imap_deletemailbox($mbox_stream,"{".$imap_server."}$namebox")) 
    25142585                { 
    2515                         $result = implode("<br />\n", imap_errors()); 
     2586                        $result = imap_last_error(); 
    25162587                } 
    25172588                /* 
     
    25362607                if(!imap_renamemailbox($mbox_stream,"{".$imap_server."}$namebox","{".$imap_server."}$new_box")) 
    25372608                { 
    2538                         $result = imap_errors(); 
     2609                        $result = imap_last_error(); 
    25392610                } 
    25402611                if($mbox_stream) 
     
    25932664            } 
    25942665 
    2595             /*Wraps the text dividing the emails as from ">,"*/  
     2666            /*Wraps the text dividing the emails as from ">,"*/ 
    25962667            $toaddress = $db->getAddrs(preg_split('/>,/',preg_replace('/>,/', '>>,', $params['input_to']))); 
    2597                 $ccaddress = $db->getAddrs(preg_split('/>,/',preg_replace('/>,/', '>>,', $params['input_cc'])));  
    2598                 $ccoaddress = $db->getAddrs(preg_split('/>,/',preg_replace('/>,/', '>>,', $params['input_cco'])));  
     2668            $ccaddress = $db->getAddrs(preg_split('/>,/',preg_replace('/>,/', '>>,', $params['input_cc']))); 
     2669            $ccoaddress = $db->getAddrs(preg_split('/>,/',preg_replace('/>,/', '>>,', $params['input_cco']))); 
    25992670 
    26002671            if ($toaddress["False"] || $ccaddress["False"] || $ccoaddress["False"]) { 
     
    26192690            $ccoaddress = preg_replace('/\s+>/', '>', $ccoaddress); 
    26202691 
    2621             $replytoaddress = $params['input_replyto']; 
     2692            $replytoaddress = $params['input_reply_to']; 
    26222693            $subject = $params['input_subject']; 
    26232694            $return_receipt = $params['input_return_receipt']; 
     
    26252696            $encrypt = $params['input_return_cripto']; 
    26262697            $signed = $params['input_return_digital']; 
    2627                          
     2698 
    26282699                        $params['attachments'] = mb_convert_encoding($params['attachments'], "UTF7-IMAP","UTF-8, ISO-8859-1, UTF7-IMAP"); 
    26292700            $message_attachments = $params['message_attachments']; 
     
    28042875            else 
    28052876                $mailService->setFrom('"' . $_SESSION['phpgw_info']['expressomail']['user']['firstname'] . ' ' . $_SESSION['phpgw_info']['expressomail']['user']['lastname'] . '" <' . $_SESSION['phpgw_info']['expressomail']['user']['email'] . '>'); 
     2877             
     2878            $mailService->addHeaderField('Reply-To', $replytoaddress); 
    28062879 
    28072880            $bol = $this->add_recipients('to', $toaddress, $mailService); 
     
    29503023                { 
    29513024                    $value = json_decode($value, true); 
    2952                                      
     3025 
    29533026                    switch ($value['type']) { 
    29543027                        case 'imapPart': 
    29553028                                $att = $this->getForwardingAttachment(mb_convert_encoding($value['folder'] , 'ISO-8859-1' , 'UTF7-IMAP'),$value['uid'], $value['part']); 
    2956                                 if(strstr($body,'src="./inc/get_archive.php?msgFolder='.$value['folder'].'&msgNumber='.$value['uid'].'&indexPart='.$value['part'].'"') !== false)//Embeded IMG  
     3029 
     3030                                if(strstr($body,'src="./inc/get_archive.php?msgFolder='.$value['folder'].'&msgNumber='.$value['uid'].'&indexPart='.$value['part'].'"') !== false)//Embeded IMG 
    29573031                                {     
    29583032                                    $body = str_ireplace('src="./inc/get_archive.php?msgFolder='.$value['folder'].'&msgNumber='.$value['uid'].'&indexPart='.$value['part'].'"' , 'src="'.$att['name'].'"', $body); 
     
    31683242            $attachment = new attachment(); 
    31693243            $attachment->decodeConf['rfc_822bodies'] = $rfc_822bodies; //Forçar a não decodificação de mensagens em anexo. 
    3170                                     $folder = urldecode($folder);  
    3171                                 $attachment->setStructureFromMail($folder, $uid); 
     3244                        $folder = urldecode($folder); 
     3245                $attachment->setStructureFromMail($folder, $uid); 
    31723246             
    31733247            if($info === true) 
     
    34143488 
    34153489                //Este bloco tem a finalidade de averiguar as permissoes para pastas compartilhadas 
    3416                 if (substr($folder,0,4) == 'user'){ 
    3417                         $acl = $this->getacltouser($folder, isset($params['decoded'])); 
    3418  
    3419                         /* 
    3420                          * l - lookup (mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox)  
    3421              * r - read (SELECT the mailbox, perform STATUS)  
    3422              * s - keep seen/unseen information across sessions (set or clear \SEEN flag via STORE, also set \SEEN during APPEND/COPY/        FETCH BODY[...])  
    3423              * w - write (set or clear flags other than \SEEN and \DELETED via STORE, also set them during APPEND/COPY)  
    3424              * i - insert (perform APPEND, COPY into mailbox)  
    3425              * p - post (send mail to submission address for mailbox, not enforced by IMAP4 itself)  
    3426              * k - create mailboxes (CREATE new sub-mailboxes in any implementation-defined hierarchy, parent mailbox for the new mailbox name in RENAME)  
    3427              * x - delete mailbox (DELETE mailbox, old mailbox name in RENAME)  
    3428              * t - delete messages (set or clear \DELETED flag via STORE, set \DELETED flag during APPEND/COPY)  
    3429              * e - perform EXPUNGE and expunge as a part of CLOSE  
    3430              * a - administer (perform SETACL/DELETEACL/GETACL/LISTRIGHTS)  
    3431              * Os Atributos da ACL para pastas compartilhadas são definidos no arquivo sharemailbox.js, na função setaclfromuser  
    3432              * Os Atributos da ACL para contas compartilhadas são definidos no arquivo shared_accounts.js, na função setaclfromuser  
    3433                          */ 
    3434                         $acl_share_delete = (stripos($acl,'t') !== false && stripos($acl,'e') !== false);  
    3435                   
    3436                 if (!$acl_share_delete) {   
     3490        if (substr($folder,0,4) == 'user'){ 
     3491                $acl = $this->getacltouser($folder, isset($params['decoded'])); 
     3492 
     3493                /* 
     3494                        * l - lookup (mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox) 
     3495                        * r - read (SELECT the mailbox, perform STATUS) 
     3496                        * s - keep seen/unseen information across sessions (set or clear \SEEN flag via STORE, also set \SEEN during APPEND/COPY/        FETCH BODY[...]) 
     3497                        * w - write (set or clear flags other than \SEEN and \DELETED via STORE, also set them during APPEND/COPY) 
     3498                        * i - insert (perform APPEND, COPY into mailbox) 
     3499                        * p - post (send mail to submission address for mailbox, not enforced by IMAP4 itself) 
     3500                        * k - create mailboxes (CREATE new sub-mailboxes in any implementation-defined hierarchy, parent mailbox for the new mailbox name in RENAME) 
     3501                        * x - delete mailbox (DELETE mailbox, old mailbox name in RENAME) 
     3502                        * t - delete messages (set or clear \DELETED flag via STORE, set \DELETED flag during APPEND/COPY) 
     3503                        * e - perform EXPUNGE and expunge as a part of CLOSE 
     3504                        * a - administer (perform SETACL/DELETEACL/GETACL/LISTRIGHTS) 
     3505                        * Os Atributos da ACL para pastas compartilhadas são definidos no arquivo sharemailbox.js, na função setaclfromuser 
     3506                        * Os Atributos da ACL para contas compartilhadas são definidos no arquivo shared_accounts.js, na função setaclfromuser 
     3507                        */ 
     3508                        $acl_share_delete = (stripos($acl,'t') !== false && stripos($acl,'e') !== false); 
     3509 
     3510                        if (!$acl_share_delete) { 
    34373511                                $return['status'] = false; 
    34383512                                return $return; 
     
    35143588                                        imap_close($mbox_stream); 
    35153589                                 
    3516                                 $msg_error = "move_messages() line ".__LINE__.": ". imap_last_error()." folder:".$newmailbox;  
    3517                 trigger_error($msg_error);  
    3518                 return $msg_error;  
     3590                                $msg_error = "move_messages() line ".__LINE__.": ". imap_last_error()." folder:".$newmailbox; 
     3591                                trigger_error($msg_error); 
     3592                                return $msg_error; 
    35193593                        } 
    35203594                } 
     
    37313805                        $this->mbox = $this->open_mbox($folder); 
    37323806 
     3807                if($offsetEnd == 0 && $offsetBegin == 0){ 
     3808                        $offsetEnd = imap_num_msg($this->mbox); 
     3809                        $offsetBegin = 1; 
     3810                } 
    37333811                return $this->messages_sort($sort_box_type,$sort_box_reverse, $search_box_type,$offsetBegin,$offsetEnd,$folder); 
    37343812        } 
     
    38783956        function empty_folder($params) 
    38793957        { 
    3880                 $folder = 'INBOX' . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server'][$params['clean_folder']]; 
     3958                $folder = (isset($params['shared']) ? $params['shared'] : 'INBOX') . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server'][$params['clean_folder']]; 
    38813959                $mbox_stream = $this->open_mbox($folder); 
    38823960                $return = imap_delete($mbox_stream,'1:*'); 
     3961                $return = imap_errors(); 
    38833962                if($mbox_stream) 
    38843963                        imap_close($mbox_stream, CL_EXPUNGE); 
     
    43224401                $mbox_acl = imap_getacl($mbox_stream, 'INBOX'); 
    43234402 
    4324                 $oldAcls = array('d' , 'c' , 'a');  
    4325         $newAcls = array('xte','ik', '');  
    4326  
    4327         $return = array();  
     4403                $oldAcls = array('d' , 'c' , 'a'); 
     4404                $newAcls = array('xte','ik', ''); 
     4405 
     4406                $return = array(); 
    43284407                foreach ($mbox_acl as $user => $acl) 
    43294408                { 
    4330                                 if($user == $this->username)   
    4331                             continue;  
    4332  
    4333                     //Compatibiliza acls no padrão antigo para o novo  
    4334                     $acl = str_replace($oldAcls, $oldAcls, $acl);  
    4335  
    4336                     $return[$user] = array(  
    4337                                     'cn' => $this->ldap->uid2cn($user) ,  
    4338                                     'acls' => $acl  
    4339                                     );  
    4340             }  
    4341             return $return;  
    4342     }  
    4343  
    4344     function setacl($params)  
    4345     {  
    4346             $old_users = $this->getacl();  
    4347             $new_users = unserialize($params['acls']);  
    4348  
    4349             $mbox_stream = $this->open_mbox();  
    4350             $serverString = "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}";  
    4351             $mailboxes_list = imap_getmailboxes($mbox_stream, $serverString, "user".$this->imap_delimiter.$this->username."*");                  
     4409                        if($user == $this->username)  
     4410                                continue; 
     4411 
     4412                        //Compatibiliza acls no padrão antigo para o novo 
     4413                        $acl = str_replace($oldAcls, $oldAcls, $acl); 
     4414 
     4415                        $return[$user] = array( 
     4416                                        'cn' => $this->ldap->uid2cn($user) , 
     4417                                        'acls' => $acl 
     4418                                        ); 
     4419                } 
     4420                return $return; 
     4421        } 
     4422 
     4423        function setacl($params) 
     4424        { 
     4425                $old_users = $this->getacl(); 
     4426                $new_users = unserialize($params['acls']); 
    43524427 
    43534428            foreach ($new_users as $user => $value) {  
     
    43584433                    }  
    43594434            }  
    4360  
    4361             foreach ($new_users as $user => $value) 
     4435                $serverString = "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}"; 
     4436                $mailboxes_list = imap_getmailboxes($mbox_stream, $serverString, "user".$this->imap_delimiter.$this->username."*");                 
     4437 
     4438                foreach ($new_users as $user => $value) { 
     4439                        if(isset($old_users[$user]) && $value['acls'] == $old_users[$user]['acls']) 
     4440                        { 
     4441                                unset($old_users[$user]); 
     4442                                unset($new_users[$user]); 
     4443                        } 
     4444                } 
     4445 
     4446                foreach ($new_users as $user => $value) 
    43624447                { 
    4363                         if (is_array($mailboxes_list))  
    4364             {  
    4365                 foreach ($mailboxes_list as $key => $val)  
    4366                 {  
    4367                     $folder = str_replace($serverString, "", imap_utf7_decode($val->name));  
    4368                     //$folder = str_replace("&-", "&", $folder);  
    4369                         $folder = imap_utf7_encode($folder);  
    4370                     imap_setacl ($mbox_stream, $folder, "$user", $value['acls']);  
    4371  
    4372                 }  
    4373             }  
    4374             if(isset($old_users[$user]))  
    4375                     unset($old_users[$user]);  
    4376             }  
    4377  
    4378             foreach ($old_users as $user => $value) 
     4448                if (is_array($mailboxes_list)) 
     4449                { 
     4450                    foreach ($mailboxes_list as $key => $val) 
     4451                    { 
     4452                        $folder = str_replace($serverString, "", imap_utf7_decode($val->name)); 
     4453                        //$folder = str_replace("&-", "&", $folder); 
     4454                                        $folder = imap_utf7_encode($folder); 
     4455                        imap_setacl ($mbox_stream, $folder, "$user", $value['acls']); 
     4456 
     4457                    } 
     4458                } 
     4459                if(isset($old_users[$user])) 
     4460                        unset($old_users[$user]); 
     4461                } 
     4462 
     4463                foreach ($old_users as $user => $value) 
    43794464                { 
    4380                         if (is_array($mailboxes_list))  
    4381             {  
    4382                 foreach ($mailboxes_list as $key => $val)  
    4383                 {  
    4384                     $folder = str_replace($serverString, "", imap_utf7_decode($val->name));  
    4385                     //$folder = str_replace("&-", "&", $folder);  
    4386                         $folder = imap_utf7_encode($folder);  
    4387                     imap_setacl ($mbox_stream, $folder, "$user", "");  
    4388  
    4389                 }  
    4390             }  
    4391             }  
    4392  
     4465                if (is_array($mailboxes_list)) 
     4466                { 
     4467                    foreach ($mailboxes_list as $key => $val) 
     4468                    { 
     4469                        $folder = str_replace($serverString, "", imap_utf7_decode($val->name)); 
     4470                        //$folder = str_replace("&-", "&", $folder); 
     4471                                        $folder = imap_utf7_encode($folder); 
     4472                        imap_setacl ($mbox_stream, $folder, "$user", ""); 
     4473 
     4474                    } 
     4475                } 
     4476                } 
     4477                 
    43934478 
    43944479                return true; 
     
    44074492                //Afim de tratar as pastas compartilhadas, verificandos as permissoes de operacao sobre as mesmas 
    44084493                //No caso de se tratar da caixa do proprio usuario logado, utiliza a sintaxe abaixo 
    4409                 if(substr($user,0,5) != 'user'.$this->imap_delimiter)  
    4410                     $mbox_acl = imap_getacl($mbox_stream, 'user'.$this->imap_delimiter.$user);  
     4494                if(substr($user,0,5) != 'user'.$this->imap_delimiter) 
     4495                        $mbox_acl = imap_getacl($mbox_stream, 'user'.$this->imap_delimiter.$user); 
    44114496                else 
    4412                   $mbox_acl = imap_getacl($mbox_stream, $user);  
    4413                          
    4414             return (isset($mbox_acl[$this->username])) ? $mbox_acl[$this->username] : ''; 
     4497                        $mbox_acl = imap_getacl($mbox_stream, $user); 
     4498                 
     4499                return (isset($mbox_acl[$this->username])) ? $mbox_acl[$this->username] : ''; 
     4500                
    44154501        } 
    44164502 
     
    47234809                $array_params = explode(";;", $params);  
    47244810                $id_msg   = $array_params[0];  
    4725                 $msg_user = $array_params[1];  
     4811                $msg_user = $array_params[1]; 
     4812                $msg_folder = $array_params[2]; 
    47264813            $msg_folder = $array_params[2];  
    47274814                 
     
    52945381                                foreach ($messages as $k => $m) { 
    52955382                                        $headers = imap_fetch_overview($this->mbox, $m, FT_UID); 
     5383 
    52965384                                        $date = explode(" ", $headers[0]->date);  
    52975385                                        $result[$m."_".$folder] = array ( 
     
    53255413                } 
    53265414                $r = $this->get_info_msg(array('msg_number' => $message_number, 'msg_folder' =>urlencode($message_folder), 'alarm' => ($alarm))); 
     5415 
    53275416                return $r; 
    53285417        } 
  • branches/2.4/expressoMail1_2/inc/class.ldap_functions.inc.php

    r7083 r7228  
    8888                $this->ldap_context = $_SESSION['phpgw_info']['expressomail']['server']['ldap_context']; 
    8989 
    90                 if( isset($_SESSION['phpgw_info']['expressomail']['server']['ldap_master_host']) &&  
    91             isset($_SESSION['phpgw_info']['expressomail']['server']['ldap_master_root_dn']) &&  
    92             isset($_SESSION['phpgw_info']['expressomail']['server']['ldap_master_root_pw']) &&  
    93             $_SESSION['phpgw_info']['expressomail']['server']['ldap_master_host'] && 
     90                if( isset($_SESSION['phpgw_info']['expressomail']['server']['ldap_master_host']) && 
     91                        isset($_SESSION['phpgw_info']['expressomail']['server']['ldap_master_root_dn']) && 
     92                        isset($_SESSION['phpgw_info']['expressomail']['server']['ldap_master_root_pw']) && 
     93                        $_SESSION['phpgw_info']['expressomail']['server']['ldap_master_host'] && 
    9494                        $_SESSION['phpgw_info']['expressomail']['server']['ldap_master_root_dn'] && 
    9595                        $_SESSION['phpgw_info']['expressomail']['server']['ldap_master_root_pw']) { 
     
    114114                $ID                     = $params['ID']; 
    115115                 
    116                 $ldapService = ServiceLocator::getService('ldap'); 
    117                 $filter =  $ldapService->getSearchFilter($params['search_for']); 
     116                $ldapService = ServiceLocator::getService('ldap'); 
     117                $filter =  $ldapService->getSearchFilter($params['search_for']); 
    118118 
    119119                $contacts_result = array(); 
     
    132132                if ($this->ds) 
    133133                { 
    134                     $ldapService->connection = $this->ds; 
    135                                 if($extendedinfo) 
    136                                         $justthese = array("cn", "mail", "telephonenumber", "uid","uidNumber", "mobile", "phpgwaccountvisible", "employeenumber", "ou"); 
    137                                 else  
    138                                         $justthese = array("cn", "mail", "telephoneNumber", "phpgwAccountVisible", "uidNumber","uid"); 
    139                 $types = false; 
    140  
    141                 if( $field == 'null' || $ID == 'null' ) 
     134                        $ldapService->connection = $this->ds; 
     135                        if($extendedinfo) 
     136                                $justthese = array("cn", "mail", "telephonenumber", "uid","uidNumber", "mobile", "phpgwaccountvisible", "employeenumber", "ou"); 
     137                        else  
     138                                $justthese = array("cn", "mail", "telephoneNumber", "phpgwAccountVisible", "uidNumber","uid"); 
     139                        $types = false; 
     140 
     141                        if( $field == 'null' || $ID == 'null' ) 
    142142                        { 
    143                     $justthese[] = "jpegphoto"; 
    144                     $types = 'u'; 
    145                 } 
     143                                $justthese[] = "jpegphoto"; 
     144                                $types = 'u'; 
     145                        } 
    146146 
    147147                $filter = $ldapService->getSearchFilter( $params['search_for'], $types ); 
    148148 
    149149                $sr=@ldap_search($this->ds, $this->ldap_context, $filter, $justthese, 0, $this->max_result); 
    150                          
    151                                 if(!$sr) 
    152                                         return null; 
    153  
    154                                 $count_entries = ldap_count_entries($this->ds,$sr); 
    155  
    156                 $info = ldap_get_entries($this->ds, $sr); 
     150 
     151                if(!$sr) 
     152                        return null; 
     153 
     154                $count_entries = ldap_count_entries($this->ds,$sr); 
     155 
     156                $info = ldap_get_entries($this->ds, $sr); 
    157157 
    158158            // New search only on user sector 
    159159            if ($count_entries == $this->max_result) 
    160160            { 
    161                 $overload = $count_entries; 
    162                                 } 
    163                                 else 
    164                                 { 
    165                                 $catalogsNum=count($this->external_srcs); 
    166                 for ($i=0; $i<=$catalogsNum; $i++)      { 
     161                        $overload = $count_entries; 
     162                } 
     163                else 
     164                { 
     165                        $catalogsNum=count($this->external_srcs); 
     166                                for ($i=0; $i<=$catalogsNum; $i++)      { 
    167167                                        if ($this->external_srcs[$i]["quicksearch"]) {  
    168168                                                $this->ldapConnect(true,$i); 
    169169                                                $filter="(|(cn=*$search_for*)(mail=*$search_for*))"; 
    170170                                                if($extendedinfo) 
    171                                         $justthese = array("cn", "mail", "telephonenumber", "uid","uidNumber", "mobile", "phpgwaccountvisible", "employeenumber", "ou"); 
     171                                                        $justthese = array("cn", "mail", "telephonenumber", "uid","uidNumber", "mobile", "phpgwaccountvisible", "employeenumber", "ou"); 
    172172                                                else  
    173173                                                        $justthese = array("cn", "mail", "telephoneNumber", "phpgwAccountVisible","uidNumber", "uid"); 
     
    185185                        } 
    186186 
    187             $tmp = array();  
    188         $tmp_users_from_user_org = array();  
    189  
    190         for ($i=0; $i<$info["count"]; $i++)  
    191         {  
    192                 $key = $info[$i]["mail"][0] . '%' . $info[$i]["telephonenumber"][0] . '%'. $info[$i]["mobile"][0] . '%' . $info[$i]["uid"][0] . '%' . $info[$i]["jpegphoto"]['count'] . '%' . $info[$i]["employeenumber"][0] . '%' .    $info[$i]["ou"][0];  
    193  
    194                 if (/*(!$quickSearch_only_in_userSector) &&*/ preg_match("/$user_sector_dn/i", $info[$i]['dn']))  
     187                $tmp = array(); 
     188                $tmp_users_from_user_org = array(); 
     189 
     190                for ($i=0; $i<$info["count"]; $i++) 
     191                { 
     192                        $key = $info[$i]["mail"][0] . '%' . $info[$i]["telephonenumber"][0] . '%'. $info[$i]["mobile"][0] . '%' . $info[$i]["uid"][0] . '%' . $info[$i]["jpegphoto"]['count'] . '%' . $info[$i]["employeenumber"][0] . '%' .    $info[$i]["ou"][0]; 
     193 
     194                        if (/*(!$quickSearch_only_in_userSector) &&*/ preg_match("/$user_sector_dn/i", $info[$i]['dn'])) 
    195195                        { 
    196                                                 $tmp_users_from_user_org[$key] = utf8_decode($info[$i]["cn"][0]);  
    197                             continue;  
    198                     }  
    199  
    200                     $tmp[$key] = utf8_decode($info[$i]["cn"][0]);  
    201             }  
     196                                $tmp_users_from_user_org[$key] = utf8_decode($info[$i]["cn"][0]); 
     197                                continue; 
     198                        } 
     199 
     200                        $tmp[$key] = utf8_decode($info[$i]["cn"][0]); 
     201                } 
    202202 
    203203                        natcasesort($tmp_users_from_user_org); 
     
    219219                                } 
    220220                                $contacts_result['quickSearch_only_in_userSector'] = $quickSearch_only_in_userSector; 
    221                     $contacts_result['maxResult'] = $ldapService->limit;  
     221                                $contacts_result['maxResult'] = $ldapService->limit; 
    222222                        } 
    223223                        else 
     
    328328                                                        return $this->quickSearch($params); 
    329329                                                else 
    330                                                         return $this->quickSearchAll($params);                                                   
     330                                                        return $this->quickSearchAll($params); 
    331331                } 
    332332            } 
     
    340340        * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    341341        * @sponsor    Caixa Econômica Federal 
    342         * @author     Prognus Software Livre <airton@prognus.com.br | prognus@prognus.com.br> 
     342        * @author     ProgquickSearchAllnus Software Livre <airton@prognus.com.br | prognus@prognus.com.br> 
    343343        * @param      <array> <$param> <parametros vindos do cliente> 
    344344        * @return     <array> <$retorno> <Array com os usuários de todos os catálogos, de acordo com o parâmetro> 
     
    405405        * @return     <array> <$retorno> <Array com os usuários do Catálogo Global, de acordo com o parâmetro> 
    406406        */ 
    407         function quickSearchGlobal($params, $all=false)  
     407        function quickSearchGlobal($params, $all=false) 
    408408        {               
    409409            include_once dirname(__FILE__). '/../../header.inc.php'; 
     
    482482                                        $search = ldap_get_entries($this->ds, $sr); 
    483483                                        for ($j=0; $j<$search["count"]; $j++) { 
    484                                                 $info_return[] = $search[$j]; 
     484                                                $search[$j]['isExternal'] = true; 
     485                        $info_return[] = $search[$j]; 
    485486                                        } 
    486487                                        $info_return["count"] = count($info_return)-1; 
     
    488489                        } 
    489490                        //---------------------------------------------------------------// 
    490                          
     491 
    491492            if($all == false) 
    492493                $info_return['type_catalog'] = "G"; 
     
    494495                        $info_return['extra_ldap_fields'] = $campos_extras;  
    495496                         
    496                         foreach($info_return as &$value){  
    497                     $value['type_contact'] = "G";  
    498  
    499                     //Converte a descrição dos filtros para ISO8859 corrigindo inconsitências com caractéres especiais  
    500                     if(isset($value['vacationinfo']) && isset($value['vacationinfo'][0]) && $value['vacationinfo'][0] != '')  
    501                             $value['vacationinfo'][0] = $this->toISO8859($value['vacationinfo'][0]);  
    502             }  
     497                        foreach($info_return as &$value){ 
     498                                $value['type_contact'] = "G"; 
     499 
     500                                //Converte a descrição dos filtros para ISO8859 corrigindo inconsitências com caractéres especiais 
     501                                if(isset($value['vacationinfo']) && isset($value['vacationinfo'][0]) && $value['vacationinfo'][0] != '') 
     502                                        $value['vacationinfo'][0] = $this->toISO8859($value['vacationinfo'][0]); 
     503                        } 
    503504 
    504505                        $info_return['search_for'] = $params['search_for']; 
    505                          
    506             return $info_return;   
     506            return $info_return;  
    507507        }  
    508508         
     
    898898        function getSharedUsersFrom($params){ 
    899899                $filter = ''; 
    900                 $i = 0;           
    901         //Added to save if must save sent messages in shared folder  
    902         $acl_save_sent_in_shared = array();  
    903          
    904         if($params['uids']) {  
    905                 $uids = explode(";",$params['uids']);  
    906                 $this->imap = new imap_functions();                       
    907                 foreach($uids as $index => $uid){  
    908                         $params = array();  
    909                         //Added to save if user has create permission  
    910                         $acl_create_message = array();  
    911                         $acl = $this->imap->getacltouser($uid ,true);  
    912     
    913                         if ( preg_match("/p/",$acl )){                           
    914                             $filter .= "(uid=$uid)";                                                      
    915                             $acl_save_sent_in_shared[ $i ] =$uid;  
    916                             $i++;  
    917                                                                          
    918                         }                                                         
    919                 }                         
     900        $i = 0;          
     901        //Added to save if must save sent messages in shared folder 
     902        $acl_save_sent_in_shared = array(); 
     903        
     904        if($params['uids']) { 
     905                $uids = explode(";",$params['uids']); 
     906                $this->imap = new imap_functions();                      
     907                foreach($uids as $index => $uid){ 
     908                        $params = array(); 
     909                        //Added to save if user has create permission 
     910                        $acl_create_message = array(); 
     911                        $acl = $this->imap->getacltouser($uid ,true); 
     912   
     913                        if ( preg_match("/p/",$acl )){                          
     914                            $filter .= "(uid=$uid)";                                                     
     915                            $acl_save_sent_in_shared[ $i ] =$uid; 
     916                            $i++; 
     917                                                                        
     918                        }                                                        
     919                }                        
    920920        } 
    921921                 
     
    937937                                } 
    938938                        } 
    939                  
     939 
    940940                        $info['myname'] = $_SESSION['phpgw_info']['expressomail']['user']['fullname']; 
    941941 
     
    953953                                $result = ldap_get_entries($this->ds, $sr); 
    954954                                for ($j = 0;$j < $result["count"]; $j++){ 
    955                                         $result[$j]['cn'][0] = utf8_decode($result[$j]['cn'][0]);  
    956                     $result[$j]['mail'][0] = $result[$j]['mail'][0];  
    957                     $result[$j]['save_shared'][0] = 'n';  
    958                     $info[$info['count']] = $result[$j];  
    959                     $info['count'] = (int)$info['count'] + 1;                                    
     955                                        $result[$j]['cn'][0] = utf8_decode($result[$j]['cn'][0]); 
     956                                        $result[$j]['mail'][0] = $result[$j]['mail'][0]; 
     957                                        $result[$j]['save_shared'][0] = 'n'; 
     958                                        $info[$info['count']] = $result[$j]; 
     959                                        $info['count'] = (int)$info['count'] + 1;                        
    960960                                } 
    961961                        } 
    962962 
    963963                        $_SESSION['phpgw_info']['expressomail']['user']['shared_mailboxes'] = $info; 
    964                          
     964 
    965965                        return $info; 
    966966                } 
  • branches/2.4/expressoMail1_2/inc/hook_settings.inc.php

    r6055 r7228  
    345345create_check_box('Show previous message, after delete actual message?','delete_and_show_previous_message','Enable this option if you want to read the next message everytime you delete a message'); 
    346346create_check_box('Do you wanna receive an alert for new messages?','alert_new_msg','Everytime you receive new messages you will be informed'); 
     347 
     348 
     349create_check_box('Wish you receive notifications for: "New messages", "Filter criteria", "Event alerts"?','notifications','Everytime you receive new messages you will be informed'); 
     350 
     351 
     352 
    347353create_check_box('Show default view on main screen?','mainscreen_showmail','Show unread messages in your home page'); 
    348354create_check_box('Do you want to use remove attachments function?','remove_attachments_function','It allow you to remove attachments from messages'); 
     
    507513} 
    508514 
     515create_check_box('Would you like to have a read receipt option to read messages?','confirm_read_message',''); 
     516 
    509517$default = array( 
    510518        'text' => lang('simple text'), 
Note: See TracChangeset for help on using the changeset viewer.