diff --git a/system/controllers/accounts.php b/system/controllers/accounts.php index 29e76e1b..d68e0623 100644 --- a/system/controllers/accounts.php +++ b/system/controllers/accounts.php @@ -95,19 +95,72 @@ switch ($action) { $msg .= 'Phone Number must be a number' . '
'; } - $user->fullname = $fullname; - $user->address = $address; - if ($_c['allow_phone_otp'] != 'yes') { - $user->phonenumber = $phonenumber; - } - if ($_c['allow_email_otp'] != 'yes') { - $user->email = $email; - } + if (empty($msg)) { + if (!empty($_FILES['photo']['name'])) { + if (function_exists('imagecreatetruecolor')) { + $hash = md5_file($_FILES['photo']['tmp_name']); + $subfolder = substr($hash, 0, 2); + $folder = $UPLOAD_PATH . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR; + if (!file_exists($folder)) { + mkdir($folder); + } + $folder = $UPLOAD_PATH . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR . $subfolder . DIRECTORY_SEPARATOR; + if (!file_exists($folder)) { + mkdir($folder); + } + $imgPath = $folder . $hash . '.jpg'; + if (!file_exists($imgPath)) { + File::resizeCropImage($_FILES['photo']['tmp_name'], $imgPath, 1600, 1600, 100); + } + if (!file_exists($imgPath . '.thumb.jpg')) { + if (_post('faceDetect') == 'yes') { + try { + $detector = new svay\FaceDetector(); + $detector->setTimeout(5000); + $detector->faceDetect($imgPath); + $detector->cropFaceToJpeg($imgPath . '.thumb.jpg', false); + } catch (Exception $e) { + File::makeThumb($imgPath, $imgPath . '.thumb.jpg', 200); + } catch (Throwable $e) { + File::makeThumb($imgPath, $imgPath . '.thumb.jpg', 200); + } + } else { + File::makeThumb($imgPath, $imgPath . '.thumb.jpg', 200); + } + } + if (file_exists($imgPath)) { + if ($user['photo'] != '') { + if (file_exists($UPLOAD_PATH . $d['photo'])) { + unlink($UPLOAD_PATH . $d['photo']); + if (file_exists($UPLOAD_PATH . $d['photo'] . '.thumb.jpg')) { + unlink($UPLOAD_PATH . $d['photo'] . '.thumb.jpg'); + } + } + } + $user->photo = '/photos/' . $subfolder . '/' . $hash . '.jpg'; + } + if (file_exists($_FILES['photo']['tmp_name'])) unlink($_FILES['photo']['tmp_name']); + } else { + r2(U . 'settings/app', 'e', 'PHP GD is not installed'); + } + } - $user->save(); + $user->fullname = $fullname; + $user->address = $address; + if ($_c['allow_phone_otp'] != 'yes') { + $user->phonenumber = $phonenumber; + } + if ($_c['allow_email_otp'] != 'yes') { + $user->email = $email; + } - _log('[' . $user['username'] . ']: ' . Lang::T('User Updated Successfully'), 'User', $user['id']); - r2(U . 'accounts/profile', 's', Lang::T('User Updated Successfully')); + $user->save(); + + _log('[' . $user['username'] . ']: ' . Lang::T('User Updated Successfully'), 'User', $user['id']); + r2(U . 'accounts/profile', 's', Lang::T('User Updated Successfully')); + }else{ + r2(U . 'accounts/profile', 'e', $msg); + } break; diff --git a/system/lan/indonesia.json b/system/lan/indonesia.json index 7de73140..90731721 100644 --- a/system/lan/indonesia.json +++ b/system/lan/indonesia.json @@ -776,5 +776,7 @@ "When_Expired__customer_will_be_move_to_selected_internet_package": "Jika masa berlaku habis, pelanggan akan dipindahkan ke paket internet yang dipilih", "Data_Change": "Perubahan Data", "Home_Address": "Alamat Rumah", - "Email_Address": "Alamat Email" + "Email_Address": "Alamat Email", + "Custom_Balance": "Saldo Kustom", + "Input_Desired_Amount": "Masukkan Jumlah yang Diinginkan" } \ No newline at end of file diff --git a/ui/ui/admin-edit.tpl b/ui/ui/admin-edit.tpl index 71944adf..4aaad2e4 100644 --- a/ui/ui/admin-edit.tpl +++ b/ui/ui/admin-edit.tpl @@ -19,7 +19,7 @@
- +
diff --git a/ui/ui/customer/profile.tpl b/ui/ui/customer/profile.tpl index 106389a4..7475a416 100644 --- a/ui/ui/customer/profile.tpl +++ b/ui/ui/customer/profile.tpl @@ -2,16 +2,30 @@
-
+
{Lang::T('Data Change')}
-
+ +
+ Foto +

- -
+ +
+ +
+
+ +
+
+
+ +
{if $_c['registration_username'] == 'phone'}
- -
+ +
- -
+ +
{if $_c['allow_phone_otp'] != 'yes'}
- -
+ +
{else}
- -
+ +
- -
+ +
{else}
- -
+ +
{/if}
-
- - Or {Lang::T('Cancel')} +
+ {Lang::T('Cancel')}
diff --git a/ui/ui/customers-edit.tpl b/ui/ui/customers-edit.tpl index 6f4f4f31..a62726bf 100644 --- a/ui/ui/customers-edit.tpl +++ b/ui/ui/customers-edit.tpl @@ -17,7 +17,7 @@
- +
diff --git a/version.json b/version.json index cb9f8861..a69b849f 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "2024.10.23" + "version": "2024.10.31" } \ No newline at end of file