From 1deb6a003e09181fad5d64e775af37d95e7447f7 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Mon, 19 Oct 2020 21:41:17 +0200 Subject: Image: Fix referencing undefined property --- ratatoeskr/sys/models.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ratatoeskr/sys/models.php b/ratatoeskr/sys/models.php index dde6791..bd45d2b 100644 --- a/ratatoeskr/sys/models.php +++ b/ratatoeskr/sys/models.php @@ -2142,7 +2142,7 @@ class Image extends BySQLRowEnabled { $this->id = $sqlrow["id"]; $this->name = $sqlrow["name"]; - $this->file = $sqlrow["file"]; + $this->filename = $sqlrow["file"]; } /* @@ -2157,7 +2157,7 @@ class Image extends BySQLRowEnabled } public function get_filename() { - return $this->file; + return $this->filename; } /* @@ -2175,7 +2175,7 @@ class Image extends BySQLRowEnabled { $obj = new self(); $obj->name = $name; - $obj->file = "0"; + $obj->filename = "0"; $tx = new Transaction(); try { @@ -2253,14 +2253,14 @@ class Image extends BySQLRowEnabled if (!isset($imagetype_file_extensions[$imageinfo[2]])) { throw new UnknownFileFormat(); } - if (is_file(SITE_BASE_PATH . "/images/" . $this->file)) { - unlink(SITE_BASE_PATH . "/images/" . $this->file); + if (is_file(SITE_BASE_PATH . "/images/" . $this->filename)) { + unlink(SITE_BASE_PATH . "/images/" . $this->filename); } $new_fn = $this->id . "." . $imagetype_file_extensions[$imageinfo[2]]; if (!move_uploaded_file($file, SITE_BASE_PATH . "/images/" . $new_fn)) { throw new IOError("Can not move file."); } - $this->file = $new_fn; + $this->filename = $new_fn; $this->save(); /* make preview image */ @@ -2297,7 +2297,7 @@ class Image extends BySQLRowEnabled qdb( "UPDATE `PREFIX_images` SET `name` = ?, `file` = ? WHERE `id` = ?", $this->name, - $this->file, + $this->filename, $this->id ); } @@ -2308,8 +2308,8 @@ class Image extends BySQLRowEnabled public function delete() { qdb("DELETE FROM `PREFIX_images` WHERE `id` = ?", $this->id); - if (is_file(SITE_BASE_PATH . "/images/" . $this->file)) { - unlink(SITE_BASE_PATH . "/images/" . $this->file); + if (is_file(SITE_BASE_PATH . "/images/" . $this->filename)) { + unlink(SITE_BASE_PATH . "/images/" . $this->filename); } if (is_file(SITE_BASE_PATH . "/images/previews/{$this->id}.png")) { unlink(SITE_BASE_PATH . "/images/previews/{$this->id}.png"); -- cgit v1.2.3-54-g00ecf