source: trunk/expressoMail1_2/inc/show_img.php @ 1036

Revision 1036, 2.0 KB checked in by amuller, 15 years ago (diff)

Ticket #559 - Atualização de segurança

  • Property svn:eol-style set to native
  • Property svn:executable set to *
RevLine 
[1036]1<?php
2        $GLOBALS['phpgw_info']['flags'] = array(
3                'currentapp' => 'expressoMail1_2',
4                'nonavbar'   => true,
5                'noheader'   => true
6        );
7
8        require_once $_SERVER[ 'DOCUMENT_ROOT' ] . '/header.inc.php';
[2]9        header("Content-Type: image/jpeg");
[27]10        if($_GET['msg_num'] && $_GET['msg_part'] && $_GET['msg_folder']) {
11                $username = $_SESSION['phpgw_info']['expressomail']['user']['userid'];
12                $password = $_SESSION['phpgw_info']['expressomail']['user']['passwd'];
13                $imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer'];
14                $imap_port      = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort'];
15        if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes')
16        {
17                $imap_options = '/tls/novalidate-cert';
18        }
19        else
20        {
21                $imap_options = '/notls/novalidate-cert';
22        }
23               
24                $msg_num = $_GET['msg_num'];
25                $msg_part = $_GET['msg_part'];
26                $msg_folder = $_GET['msg_folder'];
[178]27                $msg_folder = mb_convert_encoding($msg_folder,"UTF7-IMAP", mb_detect_encoding($msg_folder, "UTF-8, ISO-8859-1", true));
[27]28               
29        $mb = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$msg_folder, $username, $password);
30               
31                $image_mail = imap_fetchbody($mb, $msg_num, $msg_part, FT_UID);
[2]32
[27]33                header("Content-Disposition: inline");
34                $image = imap_base64($image_mail);
35                echo $image;           
36        }
37        else if($_SESSION['phpgw_info']['expressomail']['contact_photo']){     
38                $data  = $_SESSION['phpgw_info']['expressomail']['contact_photo'];
39                               
40                if($data) {
41                       
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");
[2]57?>
Note: See TracBrowser for help on using the repository browser.