From ed37021577c01f14f3f4d6f3b5da18f6b56d5be4 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 7 Feb 2010 17:34:35 +0100 Subject: add function to generate file paths Signed-off-by: Florian Pritz --- system/application/models/file_mod.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'system/application/models') diff --git a/system/application/models/file_mod.php b/system/application/models/file_mod.php index 96415bc2f..445ccdce4 100644 --- a/system/application/models/file_mod.php +++ b/system/application/models/file_mod.php @@ -60,6 +60,10 @@ class File_mod extends Model { return $this->config->item('upload_path').'/'.substr($hash, 0, 3); } + function file($hash) { + return $this->folder($hash).'/'.$hash; + } + function hash_password($password) { // TODO: move salt to config @@ -95,7 +99,7 @@ class File_mod extends Model { $query = $this->db->query($sql, array($id, $password)); if($this->unused_file($filedata['hash'])) { - unlink($this->config->item('upload_path').'/'.substr($filedata['hash'], 0, 3).'/'.$filedata['hash']); + unlink($this->file(substr($filedata['hash']))); // TODO: remove empty folders } } -- cgit v1.2.3-24-g4f1b