From 936c2d03446e3a9e5ad0155869a12f4e2a0d5ce4 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 20 Jul 2014 16:45:30 +0200 Subject: [PATCH] Calculate checksum before adding it to the database --- php/modules/Photo.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/php/modules/Photo.php b/php/modules/Photo.php index 764edda..506f5d6 100755 --- a/php/modules/Photo.php +++ b/php/modules/Photo.php @@ -113,6 +113,10 @@ class Photo extends Module { } } + # Calculate checksum + $checksum = sha1_file($path); + if ($checksum===false) $checksum = ''; + # Read infos $info = $this->getInfo($path); @@ -159,7 +163,7 @@ class Photo extends Module { '" . $albumID . "', '" . $public . "', '" . $star . "', - '" . sha1_file($path) . "');"; + '" . $checksum . "');"; $result = $this->database->query($query); if (!$result) {