From b95bf5360d0805afa577bdb3386c30f0584e5fa8 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 7 Oct 2023 17:19:54 -0400 Subject: [PATCH] PORTRAIT --- www-api/app/Controllers/WrenchMedia.php | 8 +++++++ www-api/app/Models/UploadManager.php | 30 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/www-api/app/Controllers/WrenchMedia.php b/www-api/app/Controllers/WrenchMedia.php index a61a1fa0..838bdc77 100644 --- a/www-api/app/Controllers/WrenchMedia.php +++ b/www-api/app/Controllers/WrenchMedia.php @@ -61,6 +61,14 @@ class WrenchMedia extends BaseController * VERIFY ALL PARAMETERS ARE GOOD */ + if( $this->sessionCheckString($sessionId)== PHP_API_OK ){ + + } + else{ + return 0; + } + + //We can check cache for the file or // OR // WE need to ask backend for this file now / diff --git a/www-api/app/Models/UploadManager.php b/www-api/app/Models/UploadManager.php index 45d058de..c881fb0c 100644 --- a/www-api/app/Models/UploadManager.php +++ b/www-api/app/Models/UploadManager.php @@ -31,7 +31,37 @@ class UploadManager extends Model $out= $in; switch ($action){ + case WRENCHBOARD_PICTURE_PROFILE: + + if ( trim($in["uid"]) == ''){ + $out["error_msg"] = "invalid_upload_call"; + $out["call_backend"] = false; // something went bad + return -1; + } + // MAKE SURE FOLDER AS PER PROCESS IS AVAILABLE + $thisProfileFolder = $this->savePath.'PROFILE/'.$in["uid"]; + if (!file_exists($thisProfileFolder)) { + mkdir($thisProfileFolder, 0777, true); + } + if (!file_exists($thisProfileFolder."/PORTRAIT")) { + mkdir($thisProfileFolder."/PORTRAIT", 0777, true); + } + + $myFilesFolder = $thisProfileFolder."/PORTRAIT"; + + if (file_exists($myFilesFolder)) { + $tt_d = date('hisjmy'); + $out["message"] = $tt_d."-".$in['file_name']; + $myFilesFolderFileName = $myFilesFolder.'/'.$out["message"]; + $myfile = fopen($myFilesFolderFileName, "w") or die("Unable to open file!"); + $file_data = base64_decode($in["file_data"]); + fwrite($myfile, $file_data); + fclose($myfile); + $out["call_backend"] = true; // flag ready to save data entry + } + break; + case WRENCHBOARD_PICTURE_FAMMEMBER: case WRENCHBOARD_RESOURCE_MYFILES: