From 92147fa2d0d3f5f223e5e7d7eddd4e5362b4407f Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 7 Dec 2010 17:09:10 +0100 Subject: remove all ids if the file doesn't exist Signed-off-by: Florian Pritz --- system/application/models/file_mod.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system/application/models/file_mod.php b/system/application/models/file_mod.php index ec85ebb5a..83834f7f1 100644 --- a/system/application/models/file_mod.php +++ b/system/application/models/file_mod.php @@ -158,7 +158,7 @@ class File_mod extends Model { $filedata = $this->get_filedata($id); $file = $this->file($filedata['hash']); - if ($this->id_exists($id) && file_exists($file)) { + if (file_exists($file)) { $oldest_time = (time()-$this->config->item('upload_max_age')); if (filesize($file) > $this->config->item("small_upload_size") && $filedata["date"] < $oldest_time) { if (filemtime($file) < $oldest_time) { @@ -273,10 +273,10 @@ class File_mod extends Model { } exit(); } else { - // TODO: remove -controller function has been removed - $this->load->view('file/header'); - $this->load->view('file/non_existant'); - $this->load->view('file/footer'); + if (isset($filedata["hash"])) { + $this->db->query('DELETE FROM files WHERE hash = ?', array($filedata['hash'])); + } + $this->non_existent(); } } -- cgit v1.2.3-24-g4f1b