diff options
author | Malf Furious <m@lfurio.us> | 2016-04-27 23:38:49 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2016-05-01 01:34:23 -0400 |
commit | 423fa09e3f524c8139d18c3e8652f542bcf2cd44 (patch) | |
tree | a457fe768bbfe35c19a38948a4a0e6c209e6d831 /app/model | |
parent | 0ad5c4d29ca5d4109a7fe33cdfc9b8e6b01ace6b (diff) | |
download | scrott-423fa09e3f524c8139d18c3e8652f542bcf2cd44.tar.gz scrott-423fa09e3f524c8139d18c3e8652f542bcf2cd44.zip |
Update form handler for common/setting-modal, user tab
Now supports file upload to replace the user's head image
Diffstat (limited to 'app/model')
-rw-r--r-- | app/model/common.mod.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/app/model/common.mod.php b/app/model/common.mod.php index b1aa0a0..96326dc 100644 --- a/app/model/common.mod.php +++ b/app/model/common.mod.php @@ -34,21 +34,21 @@ class CommonModel extends MasterModel /* * Handle form submissions from common views */ - function common_handleFormSubmissions($input) + function common_handleFormSubmissions($input, $attachment) { switch ($input['action']) { - case "common-setting-user": $this->saveSettingUser($input); break; - case "common-setting-admin": $this->saveSettingAdmin($input); break; - case "common-setting-allusers-adduser": $this->saveSettingAllusersAdduser($input); break; - case "common-setting-allusers-edituser": $this->saveSettingAllusersEdituser($input); break; + case "common-setting-user": $this->saveSettingUser($input, $attachment); break; + case "common-setting-admin": $this->saveSettingAdmin($input); break; + case "common-setting-allusers-adduser": $this->saveSettingAllusersAdduser($input); break; + case "common-setting-allusers-edituser": $this->saveSettingAllusersEdituser($input); break; } } /* * Save changes to user account settings */ - function saveSettingUser($input) + function saveSettingUser($input, $attachment) { $form = new Form(); $form->field_bool("setPasswd"); @@ -102,6 +102,11 @@ class CommonModel extends MasterModel } $user->saveObj(); + + if ($form->saveFile($attachment, 5242880, array("image/jpg", "image/jpeg"), "assets/img/heads/" . $user->guid)) + $this->logNotice("Image uploaded"); + else + $this->logFormErrors($form); } /* |