-
Notifications
You must be signed in to change notification settings - Fork 183
/
SpotPage_getimage.php
executable file
·45 lines (35 loc) · 1.38 KB
/
SpotPage_getimage.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
38
39
40
41
42
43
44
45
<?php
class SpotPage_getimage extends SpotPage_Abs {
private $_messageid;
private $_image;
function __construct(SpotDb $db, SpotSettings $settings, $currentSession, $params) {
parent::__construct($db, $settings, $currentSession);
$this->_messageid = $params['messageid'];
$this->_image = $params['image'];
} # ctor
function render() {
$spotnntp_hdr = new SpotNntp($this->_settings->get('nntp_hdr'));
# Haal de volledige spotinhoud op
$spotsOverview = new SpotsOverview($this->_db, $this->_settings);
$fullSpot = $spotsOverview->getFullSpot($this->_messageid, $this->_currentSession['user']['userid'], $spotnntp_hdr);
# sluit de connectie voor de header, en open een nieuwe connectie voor de nzb
$spotnntp_hdr->quit();
$spotnntp_img = new SpotNntp($this->_settings->get('nntp_nzb'));
#
# is het een array met een segment nummer naar de image, of is het
# een string met de URL naar de image?
#
if (is_array($fullSpot['image'])) {
Header("Content-Type: image/jpeg");
echo $spotnntp_img->getImage($fullSpot['image']['segment']);
} else {
$x = file_get_contents($fullSpot['image']);
foreach($http_response_header as $hdr) {
if (substr($hdr, 0, strlen('Content-Type: ')) == 'Content-Type: ') {
header($hdr);
} # if
} # foreach
echo $x;
} # else
} # render
} # SpotPage_getimage