diff --git a/system/controllers/accounts.php b/system/controllers/accounts.php index fbf290f6..1c40cef8 100644 --- a/system/controllers/accounts.php +++ b/system/controllers/accounts.php @@ -241,25 +241,24 @@ switch ($action) { case 'language-update-post': global $root_path; - if (!empty($_POST['language'])) { - $selected_language = $_POST['language']; + $selected_language = _req('lang', 'english'); - $_SESSION['user_language'] = $selected_language; + $_SESSION['user_language'] = $selected_language; - $lan_file = $root_path . File::pathFixer('system/lan/' . $selected_language . '.json'); + $lan_file = $root_path . File::pathFixer('system/lan/' . $selected_language . '.json'); - if (file_exists($lan_file)) { - $_L = json_decode(file_get_contents($lan_file), true); - $_SESSION['Lang'] = $_L; - } else { - $_L['author'] = 'Auto Generated by iBNuX Script'; - $_SESSION['Lang'] = $_L; - file_put_contents($lan_file, json_encode($_L)); - } - - r2($_SERVER['HTTP_REFERER'], 's', Lang::T('Languge set to ' . $selected_language)); + if (file_exists($lan_file)) { + $_L = json_decode(file_get_contents($lan_file), true); + $_SESSION['Lang'] = $_L; + } else { + $_L['author'] = 'Auto Generated by iBNuX Script'; + $_SESSION['Lang'] = $_L; + file_put_contents($lan_file, json_encode($_L)); } + r2($_SERVER['HTTP_REFERER'], 's', ucwords($selected_language)); + + break; default: diff --git a/system/controllers/autoload_user.php b/system/controllers/autoload_user.php index 78b51c14..be1fc66b 100644 --- a/system/controllers/autoload_user.php +++ b/system/controllers/autoload_user.php @@ -21,7 +21,7 @@ switch ($action) { $p = ORM::for_table('tbl_plans')->find_one($bill['plan_id']); $dvc = Package::getDevice($p); if ($_app_stage != 'demo') { - try{ + try { if (file_exists($dvc)) { require_once $dvc; if ((new $p['device'])->online_customer($user, $bill['routers'])) { @@ -36,7 +36,7 @@ switch ($action) { } else { die(Lang::T('-')); } - }catch (Exception $e) { + } catch (Exception $e) { die(Lang::T('Failed to connect to device')); } } @@ -47,14 +47,31 @@ switch ($action) { break; case 'inbox_unread': $count = ORM::for_table('tbl_customers_inbox')->where('customer_id', $user['id'])->whereRaw('date_read is null')->count('id'); - if($count>0){ + if ($count > 0) { echo $count; } die(); case 'inbox': $inboxs = ORM::for_table('tbl_customers_inbox')->selects(['id', 'subject', 'date_created'])->where('customer_id', $user['id'])->whereRaw('date_read is null')->order_by_desc('date_created')->limit(10)->find_many(); - foreach($inboxs as $inbox){ - echo '
  • '.$inbox['subject'].'
    '.Lang::dateTimeFormat($inbox['date_created']).'
  • '; + foreach ($inboxs as $inbox) { + echo '
  • ' . $inbox['subject'] . '
    ' . Lang::dateTimeFormat($inbox['date_created']) . '
  • '; + } + die(); + case 'language': + $select = _get('select'); + $folders = []; + $files = scandir('system/lan/'); + foreach ($files as $file) { + if (is_file('system/lan/' . $file) && !in_array($file, ['index.html', 'country.json', '.DS_Store'])) { + $file = str_replace(".json", "", $file); + if(!empty($file)){ + echo '
  • '; + if($select == $file){ + echo ' '; + } + echo ucwords($file) . '
  • '; + } + } } die(); default: diff --git a/system/lan/english.json b/system/lan/english.json index 0ceb54a5..b1e78a05 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -723,5 +723,6 @@ "Empty_this_to_use_internal_mail___PHP": "Empty this to use internal mail() PHP", "Mail_Reply_To": "Mail Reply To", "Customer_will_reply_email_to_this_address__empty_if_you_want_to_use_From_Address": "Customer will reply email to this address, empty if you want to use From Address", - "You_will_get_Payment_and_Error_notification": "You will get Payment and Error notification" + "You_will_get_Payment_and_Error_notification": "You will get Payment and Error notification", + "Languge_set_to_english": "Bahasa diatur ke bahasa Inggris" } \ No newline at end of file diff --git a/system/lan/indonesia.json b/system/lan/indonesia.json index 962c844a..1b5413b3 100644 --- a/system/lan/indonesia.json +++ b/system/lan/indonesia.json @@ -567,5 +567,6 @@ "Hotspot_Auth_Method": "Metode Otentikasi Hotspot", "Api": "Api", "Http_Chap": "Http-Bab", - "Hotspot_Authentication_Method__Make_sure_you_have_changed_your_hotspot_login_page_": "Metode Otentikasi Hotspot. Pastikan Anda telah mengubah halaman login hotspot Anda." + "Hotspot_Authentication_Method__Make_sure_you_have_changed_your_hotspot_login_page_": "Metode Otentikasi Hotspot. Pastikan Anda telah mengubah halaman login hotspot Anda.", + "Languge_set_to_indonesia": "Language set to indonesia" } \ No newline at end of file diff --git a/system/lan/spanish.json b/system/lan/spanish.json index de937f54..44f8d904 100644 --- a/system/lan/spanish.json +++ b/system/lan/spanish.json @@ -373,5 +373,6 @@ "Hotspot": "Hotspot", "Monthly_Registered_Customers": "Monthly Registered Customers", "Total_Monthly_Sales": "Total Monthly Sales", - "Active_Users": "Active Users" + "Active_Users": "Active Users", + "Languge_set_to_spanish": "Bahasa disetel ke bahasa Spanyol" } \ No newline at end of file diff --git a/ui/ui/sections/user-header.tpl b/ui/ui/sections/user-header.tpl index 93ad6459..eef5a52b 100644 --- a/ui/ui/sections/user-header.tpl +++ b/ui/ui/sections/user-header.tpl @@ -98,52 +98,20 @@