From 9df7154d044424c945a4b172579acae5e0a6d20b Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Sun, 10 Jul 2005 02:55:03 +0000 Subject: [PATCH] Fix some php bugs in the last modified patch that are breaking screenshots --- appimage.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/appimage.php b/appimage.php index bf441b5..b07a8e7 100644 --- a/appimage.php +++ b/appimage.php @@ -27,12 +27,13 @@ if ($_REQUEST['REQUEST_METHOD']='HEAD') WHERE id = ".$iId." AND type = 'image' LIMIT 1"; if (!($hResult = query_appdb($sQuery) && - $fImage = fopen($_SERVER['DOCUMENT_ROOT']."/data/screenshots/".$iId))) + $fImage = fopen($_SERVER['DOCUMENT_ROOT']."/data/screenshots/".$iId, "rb"))) { header("404 No such image"); exit; } - $iModTime = fstat($fImage)['mtime']; + $fstat_val = fstat($fImage); + $iModTime = $fstat_val['mtime']; $sMagic = fread($fImage,8); fclose($fImage); if (strcmp("\x89PNG\r\n\x1A\n",$sMagic)==0) @@ -54,8 +55,9 @@ $oScreenshot = new screenshot($_REQUEST['id'],$_REQUEST['queued']); /* at this point, we know that .../screenshots/$id and * .../screenshots/thumbnails/$id both exist; normally * they would both be created at the same time. */ -$iModTime = stat($_SERVER['DOCUMENT_ROOT'] - ."/data/screenshots/".$_REQUEST['id'])['mtime']; +$fstat_val = stat($_SERVER['DOCUMENT_ROOT'] + ."/data/screenshots/".$_REQUEST['id']); +$iModTime = $fstat_val['mtime']; header("Cache-Control: public"); header("Expires: ");