summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2018-09-19 15:46:26 -0400
committerMalf Furious <m@lfurio.us>2018-09-19 15:46:26 -0400
commit866c16abdce264362edb7f5a3c35e7bab9ddf2a5 (patch)
treeab2ea42f0f87a73294dec3b42608a4821f38fca0 /app
parent77cbdc84d952643163d7086f79a633e5837be76d (diff)
downloadscrott-866c16abdce264362edb7f5a3c35e7bab9ddf2a5.tar.gz
scrott-866c16abdce264362edb7f5a3c35e7bab9ddf2a5.zip
Update all usage of saveFile()
Update all usage of saveFile() to use added saveIfFile() function, forwarding on the convenience to model code. Model code can pass in file field names, rather than $_FILES arrays directly.
Diffstat (limited to 'app')
-rw-r--r--app/class/mesg.class.php4
-rw-r--r--app/class/obj.class.php15
2 files changed, 9 insertions, 10 deletions
diff --git a/app/class/mesg.class.php b/app/class/mesg.class.php
index 1a864c0..2e5c9d6 100644
--- a/app/class/mesg.class.php
+++ b/app/class/mesg.class.php
@@ -246,12 +246,12 @@ class mesg extends obj
* during new message creation and not changed afterward. Returns
* false if there is a problem saving the attachment.
*/
- public function setAttachment(array $file) : bool
+ public function setAttachment(string $file) : bool
{
$path = "dynmic/attach/" . $this->guid;
$origName = "";
- $ret = saveFile($file, $path, self::ATTACH_MAXSIZE, NULL, $origName);
+ $ret = saveIfFile($file, $path, self::ATTACH_MAXSIZE, NULL, $origName);
$this->attachment = $origName;
$this->saveObj();
diff --git a/app/class/obj.class.php b/app/class/obj.class.php
index 003738b..199529b 100644
--- a/app/class/obj.class.php
+++ b/app/class/obj.class.php
@@ -231,14 +231,13 @@ class obj extends table
/*
* Set the head image for this object, overwriting any existing
- * image. $image should be an uploaded file to PHP, still
- * unhandled.
+ * image. $image should be the name of the file formctrl field.
*/
- public function setHeadImg(array $image) : bool
+ public function setHeadImg(string $image) : bool
{
$path = "dynmic/heads/" . $this->guid;
- if (!saveFile($image, $path, self::HEAD_MAXSIZE, self::IMAGE_MIME))
+ if (!saveIfFile($image, $path, self::HEAD_MAXSIZE, self::IMAGE_MIME))
return false;
if (!imageSquareCrop($path))
@@ -276,13 +275,13 @@ class obj extends table
/*
* Set the background image for this object, overwriting any
- * existing image. $image should be an uploaded file to PHP,
- * still unhandled.
+ * existing image. $image should be the name of the file
+ * formctrl field.
*/
- public function setBgImg(array $image) : bool
+ public function setBgImg(string $image) : bool
{
$path = "dynmic/bgs/" . $this->guid;
- return saveFile($image, $path, self::BG_MAXSIZE, self::IMAGE_MIME);
+ return saveIfFile($image, $path, self::BG_MAXSIZE, self::IMAGE_MIME);
}
/*