summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xssn.at>2010-03-16 17:31:20 +0100
committerFlorian Pritz <bluewind@xssn.at>2010-03-16 18:03:31 +0100
commit3715f4a81a22232ce268efced31e1893eff7d043 (patch)
tree18fabab277ca6a718f8fbe0c823b114ed117f804
parent298af46f9e95a7ab5bc7ce0a519e9a930a9c8bfa (diff)
fix message when delete password is wrong
Signed-off-by: Florian Pritz <bluewind@xssn.at>
-rw-r--r--system/application/controllers/file.php3
-rw-r--r--system/application/models/file_mod.php7
2 files changed, 7 insertions, 3 deletions
diff --git a/system/application/controllers/file.php b/system/application/controllers/file.php
index 1d4a369f7..0c670f11d 100644
--- a/system/application/controllers/file.php
+++ b/system/application/controllers/file.php
@@ -36,8 +36,7 @@ class File extends Controller {
{
$id = $this->uri->segment(3);
$password = $this->input->post('password');
- if ($password !== false && $this->file_mod->id_exists($id)) {
- $this->file_mod->delete_id($id, $password);
+ if ($password !== false && $this->file_mod->id_exists($id) && $this->file_mod->delete_id($id, $password)) {
echo $id." deleted\n";
} else {
echo 'Couldn\'t delete '.$id."\n";
diff --git a/system/application/models/file_mod.php b/system/application/models/file_mod.php
index 0bc12c5b2..2d7574a60 100644
--- a/system/application/models/file_mod.php
+++ b/system/application/models/file_mod.php
@@ -98,12 +98,17 @@ class File_mod extends Model {
WHERE `id` = ?
AND password = ?
LIMIT 1';
- $query = $this->db->query($sql, array($id, $password));
+ $this->db->query($sql, array($id, $password));
+
+ if($this->id_exists($id)) {
+ return false;
+ }
if($this->unused_file($filedata['hash'])) {
unlink($this->file($filedata['hash']));
@rmdir($this->folder($filedata['hash']));
}
+ return true;
}
private function random_id($min_length, $max_length)