From 8e818f84d51321bb63e3e32b4696abd2dabfaaba Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Wed, 9 Apr 2014 20:28:14 +0200 Subject: [PATCH] Added __DIR__ to Photo.php --- php/modules/Photo.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/php/modules/Photo.php b/php/modules/Photo.php index 58cddf1..c689a53 100755 --- a/php/modules/Photo.php +++ b/php/modules/Photo.php @@ -84,10 +84,10 @@ class Photo extends Module { # Set headers header("Content-Type: application/octet-stream"); 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 - readfile("../uploads/big/$photo->url"); + readfile(__DIR__ . '/../../uploads/big/' . $photo->url); # Call plugins $this->plugins(__METHOD__, 1, func_get_args()); @@ -283,9 +283,9 @@ class Photo extends Module { $thumbUrl2x = $thumbUrl2x[0] . '@2x.' . $thumbUrl2x[1]; # Delete files - if (!unlink('../uploads/big/' . $photo->url)) return false; - if (!unlink('../uploads/thumb/' . $photo->thumbUrl)) return false; - if (!unlink('../uploads/thumb/' . $thumbUrl2x)) return false; + if (!unlink(__DIR__ . '/../../uploads/big/' . $photo->url)) return false; + if (!unlink(__DIR__ . '/../../uploads/thumb/' . $photo->thumbUrl)) return false; + if (!unlink(__DIR__ . '/../../uploads/thumb/' . $thumbUrl2x)) return false; # Delete db entry $delete = $this->database->query("DELETE FROM lychee_photos WHERE id = '$photo->id';");