diff --git a/api.php b/api.php
index 22ee00f..926443b 100644
--- a/api.php
+++ b/api.php
@@ -48,27 +48,27 @@ switch ($VARS['action']) {
$errmsg = "";
if (authenticate_user($VARS['username'], $VARS['password'], $errmsg)) {
insertAuthLog(12, null, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
- exit(json_encode(["status" => "OK", "msg" => lang("login successful", false)]));
+ exit(json_encode(["status" => "OK", "msg" => $Strings->get("login successful", false)]));
} else {
insertAuthLog(13, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
if (!is_empty($errmsg)) {
- exit(json_encode(["status" => "ERROR", "msg" => lang2("ldap error", ['error' => $errmsg], false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->build("ldap error", ['error' => $errmsg], false)]));
}
if (user_exists($VARS['username'])) {
switch (get_account_status($VARS['username'])) {
case "LOCKED_OR_DISABLED":
- exit(json_encode(["status" => "ERROR", "msg" => lang("account locked", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("account locked", false)]));
case "TERMINATED":
- exit(json_encode(["status" => "ERROR", "msg" => lang("account terminated", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("account terminated", false)]));
case "CHANGE_PASSWORD":
- exit(json_encode(["status" => "ERROR", "msg" => lang("password expired", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("password expired", false)]));
case "NORMAL":
break;
default:
- exit(json_encode(["status" => "ERROR", "msg" => lang("account state error", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("account state error", false)]));
}
}
- exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("login incorrect", false)]));
}
break;
case "userinfo":
@@ -78,7 +78,7 @@ switch ($VARS['action']) {
$data['pin'] = (is_null($data['pin']) || $data['pin'] == "" ? false : true);
exit(json_encode(["status" => "OK", "data" => $data]));
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("login incorrect", false)]));
}
} else if (!is_empty($VARS['uid'])) {
if ($database->has('accounts', ['uid' => $VARS['uid']])) {
@@ -86,7 +86,7 @@ switch ($VARS['action']) {
$data['pin'] = (is_null($data['pin']) || $data['pin'] == "" ? false : true);
exit(json_encode(["status" => "OK", "data" => $data]));
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("login incorrect", false)]));
}
} else {
http_response_code(400);
@@ -119,7 +119,7 @@ switch ($VARS['action']) {
exit(json_encode(["status" => "OK", "valid" => true]));
} else {
insertAuthLog(7, null, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
- exit(json_encode(["status" => "ERROR", "msg" => lang("2fa incorrect", false), "valid" => false]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("2fa incorrect", false), "valid" => false]));
}
break;
case "acctstatus":
@@ -133,13 +133,13 @@ switch ($VARS['action']) {
switch (get_account_status($VARS['username'])) {
case "LOCKED_OR_DISABLED":
insertAuthLog(5, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
- exit(json_encode(["status" => "ERROR", "msg" => lang("account locked", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("account locked", false)]));
case "TERMINATED":
insertAuthLog(5, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
- exit(json_encode(["status" => "ERROR", "msg" => lang("account terminated", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("account terminated", false)]));
case "CHANGE_PASSWORD":
insertAuthLog(5, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
- exit(json_encode(["status" => "ERROR", "msg" => lang("password expired", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("password expired", false)]));
case "NORMAL":
insertAuthLog(4, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
exit(json_encode(["status" => "OK"]));
@@ -149,14 +149,14 @@ switch ($VARS['action']) {
exit(json_encode(["status" => "OK", "alert" => true]));
default:
insertAuthLog(5, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
- exit(json_encode(["status" => "ERROR", "msg" => lang("account state error", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("account state error", false)]));
}
} else {
insertAuthLog(5, null, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
if (!is_empty($errmsg)) {
- exit(json_encode(["status" => "ERROR", "msg" => lang2("ldap error", ['error' => $errmsg], false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->build("ldap error", ['error' => $errmsg], false)]));
}
- exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("login incorrect", false)]));
}
break;
case "ismanagerof":
@@ -166,10 +166,10 @@ switch ($VARS['action']) {
$managerid = $VARS['manager'];
$employeeid = $VARS['employee'];
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("user does not exist", false), "user" => $VARS['employee']]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("user does not exist", false), "user" => $VARS['employee']]));
}
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("user does not exist", false), "user" => $VARS['manager']]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("user does not exist", false), "user" => $VARS['manager']]));
}
} else {
if (user_exists_local($VARS['manager'])) {
@@ -177,10 +177,10 @@ switch ($VARS['action']) {
$managerid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['manager'])]);
$employeeid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['employee'])]);
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("user does not exist", false), "user" => strtolower($VARS['employee'])]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("user does not exist", false), "user" => strtolower($VARS['employee'])]));
}
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("user does not exist", false), "user" => strtolower($VARS['manager'])]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("user does not exist", false), "user" => strtolower($VARS['manager'])]));
}
}
if ($database->has('managers', ['AND' => ['managerid' => $managerid, 'employeeid' => $employeeid]])) {
@@ -194,13 +194,13 @@ switch ($VARS['action']) {
if ($database->has("accounts", ['uid' => $VARS['uid']])) {
$managerid = $VARS['uid'];
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("user does not exist", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("user does not exist", false)]));
}
} else if ($VARS['username']) {
if ($database->has("accounts", ['username' => strtolower($VARS['username'])])) {
$managerid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['username'])]);
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("user does not exist", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("user does not exist", false)]));
}
} else {
http_response_code(400);
@@ -218,13 +218,13 @@ switch ($VARS['action']) {
if ($database->has("accounts", ['uid' => $VARS['uid']])) {
$empid = $VARS['uid'];
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("user does not exist", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("user does not exist", false)]));
}
} else if ($VARS['username']) {
if ($database->has("accounts", ['username' => strtolower($VARS['username'])])) {
$empid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['username'])]);
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("user does not exist", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("user does not exist", false)]));
}
} else {
http_response_code(400);
@@ -250,13 +250,13 @@ switch ($VARS['action']) {
if ($database->has("accounts", ['uid' => $VARS['uid']])) {
$user = $database->select('accounts', ['username'], ['uid' => $VARS['uid']])[0]['username'];
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("user does not exist", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("user does not exist", false)]));
}
} else if ($VARS['username']) {
if ($database->has("accounts", ['username' => strtolower($VARS['username'])])) {
$user = $VARS['username'];
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("user does not exist", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("user does not exist", false)]));
}
} else {
http_response_code(400);
@@ -296,7 +296,7 @@ switch ($VARS['action']) {
$user = $database->get("onetimekeys", ["[>]accounts" => ["uid" => "uid"]], ["username", "realname", "accounts.uid"], ["key" => $VARS['code']]);
exit(json_encode(["status" => "OK", "user" => $user]));
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("no such code or code expired", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("no such code or code expired", false)]));
}
case "listapps":
$apps = EXTERNAL_APPS;
@@ -312,7 +312,7 @@ switch ($VARS['action']) {
if ($database->has("groups", ['groupid' => $VARS['gid']])) {
$groupid = $VARS['gid'];
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("group does not exist", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("group does not exist", false)]));
}
} else {
http_response_code(400);
@@ -339,13 +339,13 @@ switch ($VARS['action']) {
if ($database->has("accounts", ['uid' => $VARS['uid']])) {
$empid = $VARS['uid'];
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("user does not exist", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("user does not exist", false)]));
}
} else if ($VARS['username']) {
if ($database->has("accounts", ['username' => strtolower($VARS['username'])])) {
$empid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['username'])]);
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("user does not exist", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("user does not exist", false)]));
}
} else {
http_response_code(400);
@@ -375,13 +375,13 @@ switch ($VARS['action']) {
if (user_exists_local($VARS['username'])) {
$pin = $database->get("accounts", "pin", ["username" => strtolower($VARS['username'])]);
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("login incorrect", false)]));
}
} else if (!is_empty($VARS['uid'])) {
if ($database->has('accounts', ['uid' => $VARS['uid']])) {
$pin = $database->get("accounts", "pin", ["uid" => strtolower($VARS['uid'])]);
} else {
- exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)]));
+ exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("login incorrect", false)]));
}
} else {
http_response_code(400);
diff --git a/apps/404_error.php b/apps/404_error.php
index 917054c..b78699b 100644
--- a/apps/404_error.php
+++ b/apps/404_error.php
@@ -6,8 +6,8 @@
dieifnotloggedin();
-$APPS["404_error"]["title"] = lang("404 error", false);
+$APPS["404_error"]["title"] = $Strings->get("404 error", false);
$APPS["404_error"]["icon"] = "times";
$APPS["404_error"]["type"] = "warning";
-$APPS["404_error"]["content"] = "
" . lang("page not found", false) . "
";
+$APPS["404_error"]["content"] = "" . $Strings->get("page not found", false) . "
";
?>
\ No newline at end of file
diff --git a/apps/change_password.php b/apps/change_password.php
index f012820..44c4c1d 100644
--- a/apps/change_password.php
+++ b/apps/change_password.php
@@ -6,12 +6,12 @@
dieifnotloggedin();
-$oldpass = lang("current password", false);
-$newpass = lang("new password", false);
-$conpass = lang("confirm password", false);
-$change = lang("change password", false);
+$oldpass = $Strings->get("current password", false);
+$newpass = $Strings->get("new password", false);
+$conpass = $Strings->get("confirm password", false);
+$change = $Strings->get("change password", false);
-$APPS["change_password"]["title"] = lang("change password", false);
+$APPS["change_password"]["title"] = $Strings->get("change password", false);
$APPS["change_password"]["icon"] = "key";
$APPS["change_password"]["content"] = <<
diff --git a/apps/change_pin.php b/apps/change_pin.php
index 0e0630c..d59c4d5 100644
--- a/apps/change_pin.php
+++ b/apps/change_pin.php
@@ -6,13 +6,13 @@
dieifnotloggedin();
-$newpin = lang("new pin", false);
-$conpin = lang("confirm pin", false);
-$change = lang("change pin", false);
-$pinexp = lang("pin explanation", false);
+$newpin = $Strings->get("new pin", false);
+$conpin = $Strings->get("confirm pin", false);
+$change = $Strings->get("change pin", false);
+$pinexp = $Strings->get("pin explanation", false);
-$APPS["change_pin"]["title"] = lang("change pin", false);
+$APPS["change_pin"]["title"] = $Strings->get("change pin", false);
$APPS["change_pin"]["icon"] = "th";
$APPS["change_pin"]["content"] = << $pinexp
diff --git a/apps/setup_2fa.php b/apps/setup_2fa.php
index 7b66329..5d840f6 100644
--- a/apps/setup_2fa.php
+++ b/apps/setup_2fa.php
@@ -13,12 +13,12 @@ use Endroid\QrCode\QrCode;
// extra login utils
require_once __DIR__ . "/../lib/login.php";
-$APPS["setup_2fa"]["title"] = lang("setup 2fa", false);
+$APPS["setup_2fa"]["title"] = $Strings->get("setup 2fa", false);
$APPS["setup_2fa"]["icon"] = "lock";
if (userHasTOTP($_SESSION['username'])) {
- $APPS["setup_2fa"]["content"] = ' ' . lang("2fa active", false) . '
'
+ $APPS["setup_2fa"]["content"] = ' ' . $Strings->get("2fa active", false) . '
'
. ''
- . lang("remove 2fa", false) . '';
+ . $Strings->get("remove 2fa", false) . '';
} else if ($_GET['2fa'] == "generate") {
$codeuri = newTOTP($_SESSION['username']);
$userdata = $database->select('accounts', ['email', 'authsecret', 'realname'], ['username' => $_SESSION['username']])[0];
@@ -32,12 +32,12 @@ if (userHasTOTP($_SESSION['username'])) {
$totp = Factory::loadFromProvisioningUri($codeuri);
$codesecret = $totp->getSecret();
$chunk_secret = trim(chunk_split($codesecret, 4, ' '));
- $lang_manualsetup = lang("manual setup", false);
- $lang_secretkey = lang("secret key", false);
- $lang_label = lang("label", false);
- $lang_issuer = lang("issuer", false);
- $lang_entercode = lang("enter otp code", false);
- $APPS["setup_2fa"]["content"] = ' ' . lang("scan 2fa qrcode", false) . '
' . <<get("manual setup", false);
+ $lang_secretkey = $Strings->get("secret key", false);
+ $lang_label = $Strings->get("label", false);
+ $lang_issuer = $Strings->get("issuer", false);
+ $lang_entercode = $Strings->get("enter otp code", false);
+ $APPS["setup_2fa"]["content"] = ' ' . $Strings->get("scan 2fa qrcode", false) . '
' . <<
.margintop-15px {
margin-top: 15px;
@@ -57,7 +57,7 @@ if (userHasTOTP($_SESSION['username'])) {