Redesign prototype merge #18
1 changed files with 17 additions and 21 deletions
|
@ -1,11 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use \DateTime;
|
require_once 'datetime.php';
|
||||||
|
|
||||||
require_once('datetime.php');
|
|
||||||
function photo_init(&$a) {
|
|
||||||
|
|
||||||
|
|
||||||
|
function photo_init(App $a) {
|
||||||
switch ($a->argc) {
|
switch ($a->argc) {
|
||||||
case 2:
|
case 2:
|
||||||
$photo = $a->argv[1];
|
$photo = $a->argv[1];
|
||||||
|
@ -17,7 +14,7 @@ function photo_init(&$a) {
|
||||||
|
|
||||||
$profile_id = str_replace('.jpg', '', $photo);
|
$profile_id = str_replace('.jpg', '', $photo);
|
||||||
|
|
||||||
$r = q("SELECT * FROM `photo` WHERE `profile-id` = %d LIMIT 1",
|
$r = q('SELECT * FROM `photo` WHERE `profile-id` = %d LIMIT 1',
|
||||||
intval($profile_id)
|
intval($profile_id)
|
||||||
);
|
);
|
||||||
if (count($r)) {
|
if (count($r)) {
|
||||||
|
@ -34,7 +31,7 @@ function photo_init(&$a) {
|
||||||
$etag = md5($data);
|
$etag = md5($data);
|
||||||
header('Etag: '.$etag);
|
header('Etag: '.$etag);
|
||||||
header('Expires: ' . datetime_convert('UTC', 'UTC', 'now + 1 week', 'D, d M Y H:i:s' . ' GMT'));
|
header('Expires: ' . datetime_convert('UTC', 'UTC', 'now + 1 week', 'D, d M Y H:i:s' . ' GMT'));
|
||||||
header("Cache-Control: max-age=".intval(7*24*3600));
|
header('Cache-Control: max-age=' . intval(7*24*3600));
|
||||||
if (function_exists('header_remove')) {
|
if (function_exists('header_remove')) {
|
||||||
header_remove('Pragma');
|
header_remove('Pragma');
|
||||||
header_remove('pragma');
|
header_remove('pragma');
|
||||||
|
@ -45,8 +42,7 @@ function photo_init(&$a) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Content-type: image/jpeg");
|
header('Content-type: image/jpeg');
|
||||||
echo $data;
|
echo $data;
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue