aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-10-19 21:41:17 +0200
committerLaria Carolin Chabowski <laria@laria.me>2020-10-19 21:41:17 +0200
commit1deb6a003e09181fad5d64e775af37d95e7447f7 (patch)
treeaf503c0b97a6d5b9bf6a65bbbe4716d71596d3c3
parentd9cc14da27631945f74e4ce75a68f8d10c85010a (diff)
downloadratatoeskr-cms-1deb6a003e09181fad5d64e775af37d95e7447f7.tar.gz
ratatoeskr-cms-1deb6a003e09181fad5d64e775af37d95e7447f7.tar.bz2
ratatoeskr-cms-1deb6a003e09181fad5d64e775af37d95e7447f7.zip
Image: Fix referencing undefined property
-rw-r--r--ratatoeskr/sys/models.php18
1 files 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");