Fix Lang function again

This commit is contained in:
Ibnu Maksum 2024-10-10 10:24:01 +07:00
parent 2522f3112e
commit b1919555e5
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
6 changed files with 77 additions and 32 deletions

View File

@ -143,23 +143,16 @@ if (!empty($_SESSION['user_language'])) {
}
}
if (empty($_SESSION['Lang'])) {
if (empty($config['language'])) {
$config['language'] = 'english';
}
$lan_file = $root_path . File::pathFixer('system/lan/' . $config['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));
}
} else {
$_L = $_SESSION['Lang'];
}
function safedata($value)
{

View File

@ -10,15 +10,8 @@ class Lang
{
public static function T($key)
{
global $_L, $lan_file, $root_path, $config;
global $_L, $lan_file, $config;
if (empty($lan_file)) {
$lan_file = $root_path . File::pathFixer('system/lan/' . $config['language'] . '.json');
}
if (is_array($_SESSION['Lang'])) {
$_L = array_merge($_L, $_SESSION['Lang']);
}
$key = preg_replace('/\s+/', ' ', $key);
if (!empty($_L[$key])) {
return $_L[$key];
@ -41,8 +34,7 @@ class Lang
}
}
$_L[$key] = $val;
$_SESSION['Lang'][$key] = $val;
file_put_contents($lan_file, json_encode($_SESSION['Lang'], JSON_PRETTY_PRINT));
file_put_contents($lan_file, json_encode($_L, JSON_PRETTY_PRINT));
return $val;
}
}

View File

@ -321,10 +321,8 @@ switch ($action) {
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));
}
User::setAttribute("Language", $selected_language);

View File

@ -314,7 +314,6 @@ switch ($action) {
$d = ORM::for_table('tbl_appconfig')->where('setting', 'language')->find_one();
$d->value = $lan;
$d->save();
unset($_SESSION['Lang']);
_log('[' . $admin['username'] . ']: ' . 'Settings Saved Successfully', $admin['user_type'], $admin['id']);
r2(U . 'settings/localisation', 's', 'Settings Saved Successfully');
}

View File

@ -730,5 +730,53 @@
"Send_your_balance___": "Send your balance ?",
"Search_Users": "Search Users",
"Theme_Voucher": "Theme Voucher",
"Payment_Info": "Payment Info"
"Payment_Info": "Payment Info",
"Radius_Package": "Radius Package",
"Hotspot_Package": "Hotspot Package",
"PPPOE_Package": "PPPOE Package",
"VPN_Package": "VPN Package",
"Application_Name___Company_Name": "Application Name \/ Company Name",
"Print_Max_Char": "Print Max Char",
"Redirect_URL_after_Activation": "Redirect URL after Activation",
"Enable_Radius": "Enable Radius",
"Customer_Balance_System": "Customer Balance System",
"Telegram_User_Channel_Group_ID": "Telegram User\/Channel\/Group ID",
"Test_SMS": "Test SMS",
"SMS_Server_URL": "SMS Server URL",
"Select_Router": "Select Router",
"Free_Server": "Free Server",
"WhatsApp_Server_URL": "WhatsApp Server URL",
"SMTP_Username": "SMTP Username",
"SMTP_Password": "SMTP Password",
"SMTP_Security": "SMTP Security",
"None": "None",
"By_WhatsApp": "By WhatsApp",
"By_SMS": "By SMS",
"By_Email": "By Email",
"From_Direct_Chat_Link_": "From Direct Chat Link.",
"Access_Token": "Access Token",
"Empty_this_to_randomly_created_API_key": "Empty this to randomly created API key",
"Router_Check": "Router Check",
"If_enabled__the_system_will_notify_Admin_when_router_goes_Offline__If_admin_have_10_or_more_router_and_many_customers__it_will_get_overlapping__you_can_disabled": "If enabled, the system will notify Admin when router goes Offline, If admin have 10 or more router and many customers, it will get overlapping, you can disabled",
"Phone_OTP_Required": "Phone OTP Required",
"OTP_is_required_when_user_want_to_change_phone_number_and_registration": "OTP is required when user want to change phone number and registration",
"by_WhatsApp": "by WhatsApp",
"By_WhatsApp_and_SMS": "By WhatsApp and SMS",
"Email_OTP_Required": "Email OTP Required",
"OTP_is_required_when_user_want_to_change_Email_Address": "OTP is required when user want to change Email Address",
"Show_Bandwidth_Plan": "Show Bandwidth Plan",
"_for_Customer": "for Customer",
"Custome": "Custom",
"Custome_Tax_Rate": "Custome Tax Rate",
"Enter_Custome_Tax_Rate": "Enter Custome Tax Rate",
"Authentication": "Authentication",
"Github_Username": "Github Username",
"Github_Token": "Github Token",
"Create_GitHub_personal_access_token": "Create GitHub personal access token",
"only_need_repo_scope": "only need repo scope",
"This_will_allow_you_to_download_plugin_from_private_paid_repository": "This will allow you to download plugin from private\/paid repository",
"Expired_Cronjob_Every_5_Minutes": "Expired Cronjob Every 5 Minutes",
"Expired_Cronjob_Every_1_Hour": "Expired Cronjob Every 1 Hour",
"Reminder_Cronjob_Every_7_AM": "Reminder Cronjob Every 7 AM",
"Force_Logout_": "Force Logout:"
}

View File

@ -574,5 +574,20 @@
"Registration_code": "Kod3 R3g1str@s1",
"TX": "TX",
"RX": "RX",
"Database": "Database"
"Database": "Database",
"Additional_Billing": "Penagihan Tambahan",
"paid_off": "terbayar lunas",
"Sync_account_if_you_failed_login_to_internet": "Sinkronkan akun jika Anda gagal masuk ke internet",
"_Are_You_Sure_": "Apa kamu yakin?",
"Send_your_balance___": "Kirim saldo Anda?",
"_": "-",
"Search_Users": "Pencarian Pengguna",
"Routers_Maps": "Peta Router",
"Theme_Voucher": "Voucher Tema",
"Payment_Info": "Info Pembayaran",
"Documentation": "Dokumentasi",
"Customers": "Pelanggan",
"Package_Name": "Nama Paket",
"Routers_Offline": "Router Offline",
"Cron_appear_not_been_setup__please_check_your_cron_setup_": "Cron tampaknya belum disiapkan, silakan periksa pengaturan cron Anda."
}