forked from oheil/NOCC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_img.php
37 lines (32 loc) · 1.04 KB
/
get_img.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* File for viewing the images
*
* This file is part of NVLL. NVLL is free software under the terms of the
* GNU General Public License. You should have received a copy of the license
* along with NVLL. If not, see <http://www.gnu.org/licenses>.
*/
require_once dirname(__FILE__) . '/common.php';
try {
$pop = new NVLL_IMAP();
$mail = $_REQUEST['mail'];
$num = $_REQUEST['num'];
$transfer = $_REQUEST['transfer'];
$mime = $_REQUEST['mime'];
$img = $pop->fetchbody($mail, $num);
$img = NVLL_IMAP::decode(removeUnicodeBOM($img), $transfer);
$pop->close();
if (preg_match("/^image/", $mime)) {
header('Content-type: ' . $mime);
} else {
header('Content-type: image/' . $mime);
}
echo $img;
} catch (Exception $ex) {
//TODO: Show error without NVLL_Exception!
$ev = new NVLL_Exception($ex->getMessage());
require dirname(__FILE__) . '/html/header.php';
require dirname(__FILE__) . '/html/error.php';
require dirname(__FILE__) . '/html/footer.php';
return;
}