Added __DIR__ to Photo.php

This commit is contained in:
Tobias Reich 2014-04-09 20:28:14 +02:00
parent 2e82ae64fd
commit 8e818f84d5

View File

@ -84,10 +84,10 @@ class Photo extends Module {
# Set headers # Set headers
header("Content-Type: application/octet-stream"); header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$photo->title.$extension[0]\""); header("Content-Disposition: attachment; filename=\"$photo->title.$extension[0]\"");
header("Content-Length: " . filesize("../uploads/big/$photo->url")); header("Content-Length: " . filesize(__DIR__ . '/../../uploads/big/' . $photo->url));
# Send file # Send file
readfile("../uploads/big/$photo->url"); readfile(__DIR__ . '/../../uploads/big/' . $photo->url);
# Call plugins # Call plugins
$this->plugins(__METHOD__, 1, func_get_args()); $this->plugins(__METHOD__, 1, func_get_args());
@ -283,9 +283,9 @@ class Photo extends Module {
$thumbUrl2x = $thumbUrl2x[0] . '@2x.' . $thumbUrl2x[1]; $thumbUrl2x = $thumbUrl2x[0] . '@2x.' . $thumbUrl2x[1];
# Delete files # Delete files
if (!unlink('../uploads/big/' . $photo->url)) return false; if (!unlink(__DIR__ . '/../../uploads/big/' . $photo->url)) return false;
if (!unlink('../uploads/thumb/' . $photo->thumbUrl)) return false; if (!unlink(__DIR__ . '/../../uploads/thumb/' . $photo->thumbUrl)) return false;
if (!unlink('../uploads/thumb/' . $thumbUrl2x)) return false; if (!unlink(__DIR__ . '/../../uploads/thumb/' . $thumbUrl2x)) return false;
# Delete db entry # Delete db entry
$delete = $this->database->query("DELETE FROM lychee_photos WHERE id = '$photo->id';"); $delete = $this->database->query("DELETE FROM lychee_photos WHERE id = '$photo->id';");