Ignore:
Timestamp:
05/16/11 11:44:10 (13 years ago)
Author:
airton
Message:

Ticket #1887 - Redefinicao do parser de email - Todas as adequacoes feitas no parser.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.2.0.2/expressoMail1_2/inc/show_img.php

    r3163 r4416  
    11<?php 
     2/* 
     3 * Requieres 
     4 */ 
     5 require_once '../../header.session.inc.php'; 
     6 require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php'; 
     7 //------------------------// 
    28 
    3         require_once '../../header.session.inc.php';  
    4         header("Content-Type: image/jpeg"); 
    5         if($_GET['msg_num'] && $_GET['msg_part'] && $_GET['msg_folder']) { 
    6                 $username = $_SESSION['phpgw_info']['expressomail']['user']['userid']; 
    7                 $password = $_SESSION['phpgw_info']['expressomail']['user']['passwd']; 
    8                 $imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer']; 
    9                 $imap_port      = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort']; 
    10         if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes') 
    11         { 
    12                 $imap_options = '/tls/novalidate-cert'; 
    13         } 
    14         else 
    15         { 
    16                 $imap_options = '/notls/novalidate-cert'; 
    17         } 
    18                  
    19                 $msg_num = $_GET['msg_num']; 
    20                 $msg_part = $_GET['msg_part']; 
    21                 $msg_folder = $_GET['msg_folder']; 
    22                 $msg_folder = mb_convert_encoding($msg_folder,"UTF7-IMAP", mb_detect_encoding($msg_folder, "UTF-8, ISO-8859-1", true)); 
    23                  
    24         $mb = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$msg_folder, $username, $password); 
    25                  
    26                 $image_mail = imap_fetchbody($mb, $msg_num, $msg_part, FT_UID);  
     9 /* 
     10  * Get variables 
     11  */ 
     12$fileType = $_GET['file_type']; 
     13$msgFolder = $_GET['msg_folder']; 
     14$msgNumber = $_GET['msg_num']; 
     15$part = $_GET['msg_part']; 
     16//-------------------------------------// 
    2717 
    28                 header("Content-Disposition: inline"); 
    29                 $image = imap_base64($image_mail); 
    30                 echo $image;             
    31         } 
    32         else{ 
    33                 $expires = 60*60*24*30; /* 30 days */ 
    34                 header("Cache-Control: maxage=".$expires); 
    35                 header("Pragma: public"); 
    36                 header("Expires: ".gmdate('D, d M Y H:i:s', time()+$expires)); 
    37                 if($_SESSION['phpgw_info']['expressomail']['contact_photo']){    
    38                         $data  = $_SESSION['phpgw_info']['expressomail']['contact_photo']; 
     18/* 
     19 * Main 
     20 */ 
     21header("Content-Type: image/jpeg"); 
    3922 
    40                         if($data) { 
     23if($_GET['msg_num'] != null && $_GET['msg_part'] != null && $_GET['msg_folder'] != null) 
     24{ 
     25    $attachmentObj = new attachment(); 
     26    $attachmentObj->setStructureFromMail($msgFolder, $msgNumber); 
     27    $fileContent = $attachmentObj->getAttachment($part); 
     28    header("Content-Disposition: inline"); 
    4129 
    42                                 $photo = imagecreatefromstring($data[0]); 
    43                                 if($photo){ 
    44                                         $width = imagesx($photo); 
    45                                         $height = imagesy($photo); 
    46                                         $twidth = 60; 
    47                                         $theight = 80; 
    48                                         $small_photo = imagecreatetruecolor ($twidth, $theight); 
    49                                         imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height); 
    50                                         imagejpeg($small_photo,'',100); 
    51                                         unset($_SESSION['phpgw_info']['expressomail']['contact_photo']); 
    52                                 } 
    53                         } 
    54                 } 
    55                 else 
    56                         readfile("./../../contactcenter/templates/default/images/photo_celepar.png"); 
    57         } 
     30    echo $fileContent; 
     31} 
     32else if($_SESSION['phpgw_info']['expressomail']['contact_photo']) 
     33{ 
     34    $data  = $_SESSION['phpgw_info']['expressomail']['contact_photo']; 
     35 
     36    if($data) 
     37    { 
     38        $photo = imagecreatefromstring($data[0]); 
     39        if($photo) 
     40        { 
     41                $width = imagesx($photo); 
     42                $height = imagesy($photo); 
     43                $twidth = 60; 
     44                $theight = 80; 
     45                $small_photo = imagecreatetruecolor ($twidth, $theight); 
     46                imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height); 
     47                imagejpeg($small_photo,'',100); 
     48                unset($_SESSION['phpgw_info']['expressomail']['contact_photo']); 
     49        } 
     50    } 
     51} 
     52else 
     53       readfile("./../../contactcenter/templates/default/images/photo_celepar.png"); 
     54//------------------------------------------// 
     55 
    5856?> 
Note: See TracChangeset for help on using the changeset viewer.