Fix some php bugs in the last modified patch that are breaking screenshots
This commit is contained in:
10
appimage.php
10
appimage.php
@@ -27,12 +27,13 @@ if ($_REQUEST['REQUEST_METHOD']='HEAD')
|
|||||||
WHERE id = ".$iId."
|
WHERE id = ".$iId."
|
||||||
AND type = 'image' LIMIT 1";
|
AND type = 'image' LIMIT 1";
|
||||||
if (!($hResult = query_appdb($sQuery) &&
|
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");
|
header("404 No such image");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$iModTime = fstat($fImage)['mtime'];
|
$fstat_val = fstat($fImage);
|
||||||
|
$iModTime = $fstat_val['mtime'];
|
||||||
$sMagic = fread($fImage,8);
|
$sMagic = fread($fImage,8);
|
||||||
fclose($fImage);
|
fclose($fImage);
|
||||||
if (strcmp("\x89PNG\r\n\x1A\n",$sMagic)==0)
|
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
|
/* at this point, we know that .../screenshots/$id and
|
||||||
* .../screenshots/thumbnails/$id both exist; normally
|
* .../screenshots/thumbnails/$id both exist; normally
|
||||||
* they would both be created at the same time. */
|
* they would both be created at the same time. */
|
||||||
$iModTime = stat($_SERVER['DOCUMENT_ROOT']
|
$fstat_val = stat($_SERVER['DOCUMENT_ROOT']
|
||||||
."/data/screenshots/".$_REQUEST['id'])['mtime'];
|
."/data/screenshots/".$_REQUEST['id']);
|
||||||
|
$iModTime = $fstat_val['mtime'];
|
||||||
|
|
||||||
header("Cache-Control: public");
|
header("Cache-Control: public");
|
||||||
header("Expires: ");
|
header("Expires: ");
|
||||||
|
|||||||
Reference in New Issue
Block a user