summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2016-04-27 23:38:49 -0400
committerMalf Furious <m@lfurio.us>2016-05-01 01:34:23 -0400
commit423fa09e3f524c8139d18c3e8652f542bcf2cd44 (patch)
treea457fe768bbfe35c19a38948a4a0e6c209e6d831
parent0ad5c4d29ca5d4109a7fe33cdfc9b8e6b01ace6b (diff)
downloadscrott-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 '')
-rw-r--r--app/controller/dashboard.control.php2
-rw-r--r--app/model/common.mod.php17
-rw-r--r--app/view/common/setting.modal.view.php4
3 files changed, 14 insertions, 9 deletions
diff --git a/app/controller/dashboard.control.php b/app/controller/dashboard.control.php
index 53ca160..aa1c0bd 100644
--- a/app/controller/dashboard.control.php
+++ b/app/controller/dashboard.control.php
@@ -14,7 +14,7 @@ class Dashboard extends Controller
function handle($argv)
{
$mod = new DashboardModel();
- $mod->common_handleFormSubmissions($_REQUEST['input']);
+ $mod->common_handleFormSubmissions($_REQUEST['input'], $_FILES['attachment']);
$mod->common_deflt();
$this->action_default($mod);
}
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);
}
/*
diff --git a/app/view/common/setting.modal.view.php b/app/view/common/setting.modal.view.php
index 19bcf5c..1d7951a 100644
--- a/app/view/common/setting.modal.view.php
+++ b/app/view/common/setting.modal.view.php
@@ -27,7 +27,7 @@
<div class="tab-pane fade in active" id="settUserTab">
<p>&nbsp;</p>
- <form method="post" action="<?=$mod->ap()?>">
+ <form method="post" action="<?=$mod->ap()?>" enctype="multipart/form-data">
<input type="hidden" name="input[action]" value="common-setting-user" />
<div class="row">
@@ -65,7 +65,7 @@
<div class="collapse" id="inputUserImageCollapse">
<div class="form-group">
<label>User Image</label>
- <input type="file" name="inputf[image]" />
+ <input type="file" name="attachment" />
</div>
</div>