Remove lang() and lang2() and rewrite references
This commit is contained in:
parent
deca0d330d
commit
3763d0d485
64
api.php
64
api.php
@ -48,27 +48,27 @@ switch ($VARS['action']) {
|
|||||||
$errmsg = "";
|
$errmsg = "";
|
||||||
if (authenticate_user($VARS['username'], $VARS['password'], $errmsg)) {
|
if (authenticate_user($VARS['username'], $VARS['password'], $errmsg)) {
|
||||||
insertAuthLog(12, null, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
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 {
|
} else {
|
||||||
insertAuthLog(13, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
insertAuthLog(13, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
||||||
if (!is_empty($errmsg)) {
|
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'])) {
|
if (user_exists($VARS['username'])) {
|
||||||
switch (get_account_status($VARS['username'])) {
|
switch (get_account_status($VARS['username'])) {
|
||||||
case "LOCKED_OR_DISABLED":
|
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":
|
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":
|
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":
|
case "NORMAL":
|
||||||
break;
|
break;
|
||||||
default:
|
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;
|
break;
|
||||||
case "userinfo":
|
case "userinfo":
|
||||||
@ -78,7 +78,7 @@ switch ($VARS['action']) {
|
|||||||
$data['pin'] = (is_null($data['pin']) || $data['pin'] == "" ? false : true);
|
$data['pin'] = (is_null($data['pin']) || $data['pin'] == "" ? false : true);
|
||||||
exit(json_encode(["status" => "OK", "data" => $data]));
|
exit(json_encode(["status" => "OK", "data" => $data]));
|
||||||
} else {
|
} 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'])) {
|
} else if (!is_empty($VARS['uid'])) {
|
||||||
if ($database->has('accounts', ['uid' => $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);
|
$data['pin'] = (is_null($data['pin']) || $data['pin'] == "" ? false : true);
|
||||||
exit(json_encode(["status" => "OK", "data" => $data]));
|
exit(json_encode(["status" => "OK", "data" => $data]));
|
||||||
} else {
|
} else {
|
||||||
exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)]));
|
exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("login incorrect", false)]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
@ -119,7 +119,7 @@ switch ($VARS['action']) {
|
|||||||
exit(json_encode(["status" => "OK", "valid" => true]));
|
exit(json_encode(["status" => "OK", "valid" => true]));
|
||||||
} else {
|
} else {
|
||||||
insertAuthLog(7, null, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
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;
|
break;
|
||||||
case "acctstatus":
|
case "acctstatus":
|
||||||
@ -133,13 +133,13 @@ switch ($VARS['action']) {
|
|||||||
switch (get_account_status($VARS['username'])) {
|
switch (get_account_status($VARS['username'])) {
|
||||||
case "LOCKED_OR_DISABLED":
|
case "LOCKED_OR_DISABLED":
|
||||||
insertAuthLog(5, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
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":
|
case "TERMINATED":
|
||||||
insertAuthLog(5, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
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":
|
case "CHANGE_PASSWORD":
|
||||||
insertAuthLog(5, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
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":
|
case "NORMAL":
|
||||||
insertAuthLog(4, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
insertAuthLog(4, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
||||||
exit(json_encode(["status" => "OK"]));
|
exit(json_encode(["status" => "OK"]));
|
||||||
@ -149,14 +149,14 @@ switch ($VARS['action']) {
|
|||||||
exit(json_encode(["status" => "OK", "alert" => true]));
|
exit(json_encode(["status" => "OK", "alert" => true]));
|
||||||
default:
|
default:
|
||||||
insertAuthLog(5, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
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 {
|
} else {
|
||||||
insertAuthLog(5, null, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
insertAuthLog(5, null, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
||||||
if (!is_empty($errmsg)) {
|
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;
|
break;
|
||||||
case "ismanagerof":
|
case "ismanagerof":
|
||||||
@ -166,10 +166,10 @@ switch ($VARS['action']) {
|
|||||||
$managerid = $VARS['manager'];
|
$managerid = $VARS['manager'];
|
||||||
$employeeid = $VARS['employee'];
|
$employeeid = $VARS['employee'];
|
||||||
} else {
|
} 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 {
|
} 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 {
|
} else {
|
||||||
if (user_exists_local($VARS['manager'])) {
|
if (user_exists_local($VARS['manager'])) {
|
||||||
@ -177,10 +177,10 @@ switch ($VARS['action']) {
|
|||||||
$managerid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['manager'])]);
|
$managerid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['manager'])]);
|
||||||
$employeeid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['employee'])]);
|
$employeeid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['employee'])]);
|
||||||
} else {
|
} 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 {
|
} 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]])) {
|
if ($database->has('managers', ['AND' => ['managerid' => $managerid, 'employeeid' => $employeeid]])) {
|
||||||
@ -194,13 +194,13 @@ switch ($VARS['action']) {
|
|||||||
if ($database->has("accounts", ['uid' => $VARS['uid']])) {
|
if ($database->has("accounts", ['uid' => $VARS['uid']])) {
|
||||||
$managerid = $VARS['uid'];
|
$managerid = $VARS['uid'];
|
||||||
} else {
|
} 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']) {
|
} else if ($VARS['username']) {
|
||||||
if ($database->has("accounts", ['username' => strtolower($VARS['username'])])) {
|
if ($database->has("accounts", ['username' => strtolower($VARS['username'])])) {
|
||||||
$managerid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['username'])]);
|
$managerid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['username'])]);
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
@ -218,13 +218,13 @@ switch ($VARS['action']) {
|
|||||||
if ($database->has("accounts", ['uid' => $VARS['uid']])) {
|
if ($database->has("accounts", ['uid' => $VARS['uid']])) {
|
||||||
$empid = $VARS['uid'];
|
$empid = $VARS['uid'];
|
||||||
} else {
|
} 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']) {
|
} else if ($VARS['username']) {
|
||||||
if ($database->has("accounts", ['username' => strtolower($VARS['username'])])) {
|
if ($database->has("accounts", ['username' => strtolower($VARS['username'])])) {
|
||||||
$empid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['username'])]);
|
$empid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['username'])]);
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
@ -250,13 +250,13 @@ switch ($VARS['action']) {
|
|||||||
if ($database->has("accounts", ['uid' => $VARS['uid']])) {
|
if ($database->has("accounts", ['uid' => $VARS['uid']])) {
|
||||||
$user = $database->select('accounts', ['username'], ['uid' => $VARS['uid']])[0]['username'];
|
$user = $database->select('accounts', ['username'], ['uid' => $VARS['uid']])[0]['username'];
|
||||||
} else {
|
} 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']) {
|
} else if ($VARS['username']) {
|
||||||
if ($database->has("accounts", ['username' => strtolower($VARS['username'])])) {
|
if ($database->has("accounts", ['username' => strtolower($VARS['username'])])) {
|
||||||
$user = $VARS['username'];
|
$user = $VARS['username'];
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
http_response_code(400);
|
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']]);
|
$user = $database->get("onetimekeys", ["[>]accounts" => ["uid" => "uid"]], ["username", "realname", "accounts.uid"], ["key" => $VARS['code']]);
|
||||||
exit(json_encode(["status" => "OK", "user" => $user]));
|
exit(json_encode(["status" => "OK", "user" => $user]));
|
||||||
} else {
|
} 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":
|
case "listapps":
|
||||||
$apps = EXTERNAL_APPS;
|
$apps = EXTERNAL_APPS;
|
||||||
@ -312,7 +312,7 @@ switch ($VARS['action']) {
|
|||||||
if ($database->has("groups", ['groupid' => $VARS['gid']])) {
|
if ($database->has("groups", ['groupid' => $VARS['gid']])) {
|
||||||
$groupid = $VARS['gid'];
|
$groupid = $VARS['gid'];
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
@ -339,13 +339,13 @@ switch ($VARS['action']) {
|
|||||||
if ($database->has("accounts", ['uid' => $VARS['uid']])) {
|
if ($database->has("accounts", ['uid' => $VARS['uid']])) {
|
||||||
$empid = $VARS['uid'];
|
$empid = $VARS['uid'];
|
||||||
} else {
|
} 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']) {
|
} else if ($VARS['username']) {
|
||||||
if ($database->has("accounts", ['username' => strtolower($VARS['username'])])) {
|
if ($database->has("accounts", ['username' => strtolower($VARS['username'])])) {
|
||||||
$empid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['username'])]);
|
$empid = $database->select('accounts', 'uid', ['username' => strtolower($VARS['username'])]);
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
@ -375,13 +375,13 @@ switch ($VARS['action']) {
|
|||||||
if (user_exists_local($VARS['username'])) {
|
if (user_exists_local($VARS['username'])) {
|
||||||
$pin = $database->get("accounts", "pin", ["username" => strtolower($VARS['username'])]);
|
$pin = $database->get("accounts", "pin", ["username" => strtolower($VARS['username'])]);
|
||||||
} else {
|
} 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'])) {
|
} else if (!is_empty($VARS['uid'])) {
|
||||||
if ($database->has('accounts', ['uid' => $VARS['uid']])) {
|
if ($database->has('accounts', ['uid' => $VARS['uid']])) {
|
||||||
$pin = $database->get("accounts", "pin", ["uid" => strtolower($VARS['uid'])]);
|
$pin = $database->get("accounts", "pin", ["uid" => strtolower($VARS['uid'])]);
|
||||||
} else {
|
} else {
|
||||||
exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)]));
|
exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("login incorrect", false)]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
dieifnotloggedin();
|
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"]["icon"] = "times";
|
||||||
$APPS["404_error"]["type"] = "warning";
|
$APPS["404_error"]["type"] = "warning";
|
||||||
$APPS["404_error"]["content"] = "<h4>" . lang("page not found", false) . "</h4>";
|
$APPS["404_error"]["content"] = "<h4>" . $Strings->get("page not found", false) . "</h4>";
|
||||||
?>
|
?>
|
@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
dieifnotloggedin();
|
dieifnotloggedin();
|
||||||
|
|
||||||
$oldpass = lang("current password", false);
|
$oldpass = $Strings->get("current password", false);
|
||||||
$newpass = lang("new password", false);
|
$newpass = $Strings->get("new password", false);
|
||||||
$conpass = lang("confirm password", false);
|
$conpass = $Strings->get("confirm password", false);
|
||||||
$change = lang("change 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"]["icon"] = "key";
|
||||||
$APPS["change_password"]["content"] = <<<CONTENTEND
|
$APPS["change_password"]["content"] = <<<CONTENTEND
|
||||||
<form action="action.php" method="POST">
|
<form action="action.php" method="POST">
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
|
|
||||||
dieifnotloggedin();
|
dieifnotloggedin();
|
||||||
|
|
||||||
$newpin = lang("new pin", false);
|
$newpin = $Strings->get("new pin", false);
|
||||||
$conpin = lang("confirm pin", false);
|
$conpin = $Strings->get("confirm pin", false);
|
||||||
$change = lang("change pin", false);
|
$change = $Strings->get("change pin", false);
|
||||||
$pinexp = lang("pin explanation", 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"]["icon"] = "th";
|
||||||
$APPS["change_pin"]["content"] = <<<CONTENTEND
|
$APPS["change_pin"]["content"] = <<<CONTENTEND
|
||||||
<div class="alert alert-info"><i class="fa fa-info-circle"></i> $pinexp</div>
|
<div class="alert alert-info"><i class="fa fa-info-circle"></i> $pinexp</div>
|
||||||
|
@ -13,12 +13,12 @@ use Endroid\QrCode\QrCode;
|
|||||||
// extra login utils
|
// extra login utils
|
||||||
require_once __DIR__ . "/../lib/login.php";
|
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";
|
$APPS["setup_2fa"]["icon"] = "lock";
|
||||||
if (userHasTOTP($_SESSION['username'])) {
|
if (userHasTOTP($_SESSION['username'])) {
|
||||||
$APPS["setup_2fa"]["content"] = '<div class="alert alert-info"><i class="fa fa-info-circle"></i> ' . lang("2fa active", false) . '</div>'
|
$APPS["setup_2fa"]["content"] = '<div class="alert alert-info"><i class="fa fa-info-circle"></i> ' . $Strings->get("2fa active", false) . '</div>'
|
||||||
. '<a href="action.php?action=rm2fa&source=security" class="btn btn-warning btn-sm btn-block">'
|
. '<a href="action.php?action=rm2fa&source=security" class="btn btn-warning btn-sm btn-block">'
|
||||||
. lang("remove 2fa", false) . '</a>';
|
. $Strings->get("remove 2fa", false) . '</a>';
|
||||||
} else if ($_GET['2fa'] == "generate") {
|
} else if ($_GET['2fa'] == "generate") {
|
||||||
$codeuri = newTOTP($_SESSION['username']);
|
$codeuri = newTOTP($_SESSION['username']);
|
||||||
$userdata = $database->select('accounts', ['email', 'authsecret', 'realname'], ['username' => $_SESSION['username']])[0];
|
$userdata = $database->select('accounts', ['email', 'authsecret', 'realname'], ['username' => $_SESSION['username']])[0];
|
||||||
@ -32,12 +32,12 @@ if (userHasTOTP($_SESSION['username'])) {
|
|||||||
$totp = Factory::loadFromProvisioningUri($codeuri);
|
$totp = Factory::loadFromProvisioningUri($codeuri);
|
||||||
$codesecret = $totp->getSecret();
|
$codesecret = $totp->getSecret();
|
||||||
$chunk_secret = trim(chunk_split($codesecret, 4, ' '));
|
$chunk_secret = trim(chunk_split($codesecret, 4, ' '));
|
||||||
$lang_manualsetup = lang("manual setup", false);
|
$lang_manualsetup = $Strings->get("manual setup", false);
|
||||||
$lang_secretkey = lang("secret key", false);
|
$lang_secretkey = $Strings->get("secret key", false);
|
||||||
$lang_label = lang("label", false);
|
$lang_label = $Strings->get("label", false);
|
||||||
$lang_issuer = lang("issuer", false);
|
$lang_issuer = $Strings->get("issuer", false);
|
||||||
$lang_entercode = lang("enter otp code", false);
|
$lang_entercode = $Strings->get("enter otp code", false);
|
||||||
$APPS["setup_2fa"]["content"] = '<div class="alert alert-info"><i class="fa fa-info-circle"></i> ' . lang("scan 2fa qrcode", false) . '</div>' . <<<END
|
$APPS["setup_2fa"]["content"] = '<div class="alert alert-info"><i class="fa fa-info-circle"></i> ' . $Strings->get("scan 2fa qrcode", false) . '</div>' . <<<END
|
||||||
<style nonce="$SECURE_NONCE">
|
<style nonce="$SECURE_NONCE">
|
||||||
.margintop-15px {
|
.margintop-15px {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
@ -57,7 +57,7 @@ if (userHasTOTP($_SESSION['username'])) {
|
|||||||
<input type="hidden" name="secret" value="$codesecret" />
|
<input type="hidden" name="secret" value="$codesecret" />
|
||||||
<button type="submit" class="btn btn-success btn-sm btn-block">
|
<button type="submit" class="btn btn-success btn-sm btn-block">
|
||||||
END
|
END
|
||||||
. lang("confirm 2fa", false) . <<<END
|
. $Strings->get("confirm 2fa", false) . <<<END
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="panel panel-default margintop-15px">
|
<div class="panel panel-default margintop-15px">
|
||||||
@ -73,7 +73,7 @@ END
|
|||||||
</div>
|
</div>
|
||||||
END;
|
END;
|
||||||
} else {
|
} else {
|
||||||
$APPS["setup_2fa"]["content"] = '<div class="alert alert-info"><i class="fa fa-info-circle"></i> ' . lang("2fa explained", false) . '</div>'
|
$APPS["setup_2fa"]["content"] = '<div class="alert alert-info"><i class="fa fa-info-circle"></i> ' . $Strings->get("2fa explained", false) . '</div>'
|
||||||
. '<a class="btn btn-success btn-sm btn-block" href="home.php?page=security&2fa=generate">'
|
. '<a class="btn btn-success btn-sm btn-block" href="home.php?page=security&2fa=generate">'
|
||||||
. lang("enable 2fa", false) . '</a>';
|
. $Strings->get("enable 2fa", false) . '</a>';
|
||||||
}
|
}
|
@ -11,7 +11,7 @@ use Endroid\QrCode\QrCode;
|
|||||||
|
|
||||||
if (MOBILE_ENABLED) {
|
if (MOBILE_ENABLED) {
|
||||||
|
|
||||||
$APPS["sync_mobile"]["title"] = lang("sync mobile", false);
|
$APPS["sync_mobile"]["title"] = $Strings->get("sync mobile", false);
|
||||||
$APPS["sync_mobile"]["icon"] = "mobile";
|
$APPS["sync_mobile"]["icon"] = "mobile";
|
||||||
|
|
||||||
if (!is_empty($_GET['delsynccode'])) {
|
if (!is_empty($_GET['delsynccode'])) {
|
||||||
@ -40,9 +40,9 @@ if (MOBILE_ENABLED) {
|
|||||||
$qrCode->setErrorCorrectionLevel(ErrorCorrectionLevel::HIGH);
|
$qrCode->setErrorCorrectionLevel(ErrorCorrectionLevel::HIGH);
|
||||||
$qrcode = $qrCode->writeDataUri();
|
$qrcode = $qrCode->writeDataUri();
|
||||||
$chunk_code = trim(chunk_split($code, 5, ' '));
|
$chunk_code = trim(chunk_split($code, 5, ' '));
|
||||||
$lang_done = lang("done adding sync code", false);
|
$lang_done = $Strings->get("done adding sync code", false);
|
||||||
$APPS["sync_mobile"]["content"] = '<div class="alert alert-info"><i class="fa fa-info-circle"></i> '
|
$APPS["sync_mobile"]["content"] = '<div class="alert alert-info"><i class="fa fa-info-circle"></i> '
|
||||||
. lang("scan sync qrcode", false)
|
. $Strings->get("scan sync qrcode", false)
|
||||||
. '</div>'
|
. '</div>'
|
||||||
. <<<END
|
. <<<END
|
||||||
<style nonce="$SECURE_NONCE">
|
<style nonce="$SECURE_NONCE">
|
||||||
@ -59,13 +59,13 @@ if (MOBILE_ENABLED) {
|
|||||||
<div class="panel panel-default margintop-15px">
|
<div class="panel panel-default margintop-15px">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
END
|
END
|
||||||
. "<b>" . lang("manual setup", false) . "</b><br /><label>" . lang("username", false) . ":</label>"
|
. "<b>" . $Strings->get("manual setup", false) . "</b><br /><label>" . $Strings->get("username", false) . ":</label>"
|
||||||
. '<div class="well well-sm mono-chunk">' . $_SESSION['username'] . '</div>'
|
. '<div class="well well-sm mono-chunk">' . $_SESSION['username'] . '</div>'
|
||||||
. "<label>" . lang("sync key", false) . "</label>"
|
. "<label>" . $Strings->get("sync key", false) . "</label>"
|
||||||
. <<<END
|
. <<<END
|
||||||
<div class="well well-sm mono-chunk">$chunk_code</div>
|
<div class="well well-sm mono-chunk">$chunk_code</div>
|
||||||
END
|
END
|
||||||
. "<label>" . lang("url", false) . "</label>"
|
. "<label>" . $Strings->get("url", false) . "</label>"
|
||||||
. <<<END
|
. <<<END
|
||||||
<div class="well well-sm mono-chunk">$url</div>
|
<div class="well well-sm mono-chunk">$url</div>
|
||||||
</div>
|
</div>
|
||||||
@ -74,17 +74,17 @@ END
|
|||||||
END;
|
END;
|
||||||
} else {
|
} else {
|
||||||
$activecodes = $database->select("mobile_codes", ["codeid", "code"], ["uid" => $_SESSION['uid']]);
|
$activecodes = $database->select("mobile_codes", ["codeid", "code"], ["uid" => $_SESSION['uid']]);
|
||||||
$content = '<div class="alert alert-info"><i class="fa fa-info-circle"></i> ' . lang("sync explained", false) . '</div>'
|
$content = '<div class="alert alert-info"><i class="fa fa-info-circle"></i> ' . $Strings->get("sync explained", false) . '</div>'
|
||||||
. '<a class="btn btn-success btn-sm btn-block" href="home.php?page=sync&mobilecode=generate">'
|
. '<a class="btn btn-success btn-sm btn-block" href="home.php?page=sync&mobilecode=generate">'
|
||||||
. lang("generate sync", false) . '</a>';
|
. $Strings->get("generate sync", false) . '</a>';
|
||||||
$content .= "<br /><b>" . lang("active sync codes", false) . ":</b><br />";
|
$content .= "<br /><b>" . $Strings->get("active sync codes", false) . ":</b><br />";
|
||||||
$content .= "<div class='list-group'>";
|
$content .= "<div class='list-group'>";
|
||||||
if (count($activecodes) > 0) {
|
if (count($activecodes) > 0) {
|
||||||
foreach ($activecodes as $c) {
|
foreach ($activecodes as $c) {
|
||||||
$content .= "<div class='list-group-item mobilekey'><span id=\"mobilecode\">" . trim(chunk_split($c['code'], 5, ' ')) . "</span> <span class='tinybuttons'><a class='btn btn-primary btn-sm' href='home.php?page=sync&mobilecode=generate&showsynccode=" . $c['codeid'] . "'><i class='fa fa-qrcode'></i></a> <a class='btn btn-danger btn-sm' href='home.php?page=sync&delsynccode=" . $c['codeid'] . "'><i class='fa fa-trash'></i></a></span></div>";
|
$content .= "<div class='list-group-item mobilekey'><span id=\"mobilecode\">" . trim(chunk_split($c['code'], 5, ' ')) . "</span> <span class='tinybuttons'><a class='btn btn-primary btn-sm' href='home.php?page=sync&mobilecode=generate&showsynccode=" . $c['codeid'] . "'><i class='fa fa-qrcode'></i></a> <a class='btn btn-danger btn-sm' href='home.php?page=sync&delsynccode=" . $c['codeid'] . "'><i class='fa fa-trash'></i></a></span></div>";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$content .= "<div class='list-group-item'>" . lang("no active codes", false) . "</div>";
|
$content .= "<div class='list-group-item'>" . $Strings->get("no active codes", false) . "</div>";
|
||||||
}
|
}
|
||||||
$content .= "</div>";
|
$content .= "</div>";
|
||||||
$content .= <<<END
|
$content .= <<<END
|
||||||
|
14
home.php
14
home.php
@ -98,7 +98,7 @@ if (!is_empty($_GET['page'])) {
|
|||||||
if (isset($pg['icon'])) {
|
if (isset($pg['icon'])) {
|
||||||
$item .= '<i class="fa fa-' . $pg['icon'] . ' fa-fw"></i>';
|
$item .= '<i class="fa fa-' . $pg['icon'] . ' fa-fw"></i>';
|
||||||
}
|
}
|
||||||
$item .= lang($pg['title'], false) . '</a>';
|
$item .= $Strings->get($pg['title'], false) . '</a>';
|
||||||
echo '<li class="hidden-sm hidden-md">' . $item . "</li>";
|
echo '<li class="hidden-sm hidden-md">' . $item . "</li>";
|
||||||
$more .= '<li>' . $item . "</li>";
|
$more .= '<li>' . $item . "</li>";
|
||||||
} else {
|
} else {
|
||||||
@ -117,7 +117,7 @@ if (!is_empty($_GET['page'])) {
|
|||||||
?>
|
?>
|
||||||
<i class="fa fa-<?php echo $pg['icon']; ?> fa-fw"></i>
|
<i class="fa fa-<?php echo $pg['icon']; ?> fa-fw"></i>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php lang($pg['title']) ?>
|
<?php $Strings->get($pg['title']) ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php
|
<?php
|
||||||
@ -128,14 +128,14 @@ if (!is_empty($_GET['page'])) {
|
|||||||
if ($counter > 4) {
|
if ($counter > 4) {
|
||||||
?>
|
?>
|
||||||
<li class="dropdown hidden-lg hidden-xs">
|
<li class="dropdown hidden-lg hidden-xs">
|
||||||
<a href="" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-ellipsis-v fa-fw"></i> <?php lang("more"); ?></a>
|
<a href="" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-ellipsis-v fa-fw"></i> <?php $Strings->get("more"); ?></a>
|
||||||
<ul class="dropdown-menu"><?php echo $more; ?></ul>
|
<ul class="dropdown-menu"><?php echo $more; ?></ul>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
<li><a href="home.php"><i class="fa fa-user fa-fw"></i> <span class=""><?php echo $_SESSION['realname'] ?></span></a></li>
|
<li><a href="home.php"><i class="fa fa-user fa-fw"></i> <span class=""><?php echo $_SESSION['realname'] ?></span></a></li>
|
||||||
<li><a href="action.php?action=signout"><i class="fa fa-sign-out fa-fw"></i> <span class=""><?php lang("sign out") ?></span></a></li>
|
<li><a href="action.php?action=signout"><i class="fa fa-sign-out fa-fw"></i> <span class=""><?php $Strings->get("sign out") ?></span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
@ -177,9 +177,9 @@ if (!is_empty($_GET['page'])) {
|
|||||||
if (!is_empty($_GET['msg']) && array_key_exists($_GET['msg'], MESSAGES)) {
|
if (!is_empty($_GET['msg']) && array_key_exists($_GET['msg'], MESSAGES)) {
|
||||||
// optional string generation argument
|
// optional string generation argument
|
||||||
if (is_empty($_GET['arg'])) {
|
if (is_empty($_GET['arg'])) {
|
||||||
$alertmsg = lang(MESSAGES[$_GET['msg']]['string'], false);
|
$alertmsg = $Strings->get(MESSAGES[$_GET['msg']]['string'], false);
|
||||||
} else {
|
} else {
|
||||||
$alertmsg = lang2(MESSAGES[$_GET['msg']]['string'], ["arg" => $_GET['arg']], false);
|
$alertmsg = $Strings->build(MESSAGES[$_GET['msg']]['string'], ["arg" => $_GET['arg']], false);
|
||||||
}
|
}
|
||||||
$alerttype = MESSAGES[$_GET['msg']]['type'];
|
$alerttype = MESSAGES[$_GET['msg']]['type'];
|
||||||
$alerticon = "square-o";
|
$alerticon = "square-o";
|
||||||
@ -242,7 +242,7 @@ END;
|
|||||||
if (!isset($APPS[$app])) {
|
if (!isset($APPS[$app])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$apptitle = ($APPS[$app]['i18n'] === TRUE ? lang($APPS[$app]['title'], false) : $APPS[$app]['title']);
|
$apptitle = ($APPS[$app]['i18n'] === TRUE ? $Strings->get($APPS[$app]['title'], false) : $APPS[$app]['title']);
|
||||||
$appicon = (is_empty($APPS[$app]['icon']) ? "" : "fa fa-fw fa-" . $APPS[$app]['icon']);
|
$appicon = (is_empty($APPS[$app]['icon']) ? "" : "fa fa-fw fa-" . $APPS[$app]['icon']);
|
||||||
$apptype = (is_empty($APPS[$app]['type']) ? "default" : $APPS[$app]['type']);
|
$apptype = (is_empty($APPS[$app]['type']) ? "default" : $APPS[$app]['type']);
|
||||||
$appcontent = $APPS[$app]['content'];
|
$appcontent = $APPS[$app]['content'];
|
||||||
|
38
index.php
38
index.php
@ -13,7 +13,7 @@ if ($_SESSION['loggedin'] && !is_empty($_SESSION['password'])) {
|
|||||||
die();
|
die();
|
||||||
// This branch will likely run if the user signed in from a different app.
|
// This branch will likely run if the user signed in from a different app.
|
||||||
} else if ($_SESSION['loggedin'] && is_empty($_SESSION['password'])) {
|
} else if ($_SESSION['loggedin'] && is_empty($_SESSION['password'])) {
|
||||||
$alert = lang("sign in again", false);
|
$alert = $Strings->get("sign in again", false);
|
||||||
$alerttype = "info";
|
$alerttype = "info";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,13 +29,13 @@ if ($VARS['progress'] == "1") {
|
|||||||
$status = get_account_status($VARS['username'], $error);
|
$status = get_account_status($VARS['username'], $error);
|
||||||
switch ($status) {
|
switch ($status) {
|
||||||
case "LOCKED_OR_DISABLED":
|
case "LOCKED_OR_DISABLED":
|
||||||
$alert = lang("account locked", false);
|
$alert = $Strings->get("account locked", false);
|
||||||
break;
|
break;
|
||||||
case "TERMINATED":
|
case "TERMINATED":
|
||||||
$alert = lang("account terminated", false);
|
$alert = $Strings->get("account terminated", false);
|
||||||
break;
|
break;
|
||||||
case "CHANGE_PASSWORD":
|
case "CHANGE_PASSWORD":
|
||||||
$alert = lang("password expired", false);
|
$alert = $Strings->get("password expired", false);
|
||||||
$alerttype = "info";
|
$alerttype = "info";
|
||||||
$_SESSION['username'] = strtolower($VARS['username']);
|
$_SESSION['username'] = strtolower($VARS['username']);
|
||||||
$_SESSION['uid'] = $database->get('accounts', 'uid', ['username' => strtolower($VARS['username'])]);
|
$_SESSION['uid'] = $database->get('accounts', 'uid', ['username' => strtolower($VARS['username'])]);
|
||||||
@ -55,7 +55,7 @@ if ($VARS['progress'] == "1") {
|
|||||||
if (!is_empty($error)) {
|
if (!is_empty($error)) {
|
||||||
$alert = $error;
|
$alert = $error;
|
||||||
} else {
|
} else {
|
||||||
$alert = lang("login error", false);
|
$alert = $Strings->get("login error", false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -76,17 +76,17 @@ if ($VARS['progress'] == "1") {
|
|||||||
$alert = $autherror;
|
$alert = $autherror;
|
||||||
insertAuthLog(2, null, "Username: " . $VARS['username']);
|
insertAuthLog(2, null, "Username: " . $VARS['username']);
|
||||||
} else {
|
} else {
|
||||||
$alert = lang("login incorrect", false);
|
$alert = $Strings->get("login incorrect", false);
|
||||||
insertAuthLog(2, null, "Username: " . $VARS['username']);
|
insertAuthLog(2, null, "Username: " . $VARS['username']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // User does not exist anywhere
|
} else { // User does not exist anywhere
|
||||||
$alert = lang("login incorrect", false);
|
$alert = $Strings->get("login incorrect", false);
|
||||||
insertAuthLog(2, null, "Username: " . $VARS['username']);
|
insertAuthLog(2, null, "Username: " . $VARS['username']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$alert = lang("captcha error", false);
|
$alert = $Strings->get("captcha error", false);
|
||||||
insertAuthLog(8, null, "Username: " . $VARS['username']);
|
insertAuthLog(8, null, "Username: " . $VARS['username']);
|
||||||
}
|
}
|
||||||
} else if ($VARS['progress'] == "2") {
|
} else if ($VARS['progress'] == "2") {
|
||||||
@ -101,7 +101,7 @@ if ($VARS['progress'] == "1") {
|
|||||||
header('Location: home.php');
|
header('Location: home.php');
|
||||||
die("Logged in, go to home.php");
|
die("Logged in, go to home.php");
|
||||||
} else {
|
} else {
|
||||||
$alert = lang("2fa incorrect", false);
|
$alert = $Strings->get("2fa incorrect", false);
|
||||||
insertAuthLog(6, null, "Username: " . $VARS['username']);
|
insertAuthLog(6, null, "Username: " . $VARS['username']);
|
||||||
}
|
}
|
||||||
} else if ($VARS['progress'] == "chpasswd") {
|
} else if ($VARS['progress'] == "chpasswd") {
|
||||||
@ -110,22 +110,22 @@ if ($VARS['progress'] == "1") {
|
|||||||
$error = [];
|
$error = [];
|
||||||
$result = change_password($VARS['oldpass'], $VARS['newpass'], $VARS['conpass'], $error);
|
$result = change_password($VARS['oldpass'], $VARS['newpass'], $VARS['conpass'], $error);
|
||||||
if ($result === TRUE) {
|
if ($result === TRUE) {
|
||||||
$alert = lang(MESSAGES["password_updated"]["string"], false);
|
$alert = $Strings->get(MESSAGES["password_updated"]["string"], false);
|
||||||
$alerttype = MESSAGES["password_updated"]["type"];
|
$alerttype = MESSAGES["password_updated"]["type"];
|
||||||
}
|
}
|
||||||
switch (count($error)) {
|
switch (count($error)) {
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$alert = lang(MESSAGES[$error[0]]["string"], false);
|
$alert = $Strings->get(MESSAGES[$error[0]]["string"], false);
|
||||||
$alerttype = MESSAGES[$error[0]]["type"];
|
$alerttype = MESSAGES[$error[0]]["type"];
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$alert = lang2(MESSAGES[$error[0]]["string"], ["arg" => $error[1]], false);
|
$alert = $Strings->build(MESSAGES[$error[0]]["string"], ["arg" => $error[1]], false);
|
||||||
$alerttype = MESSAGES[$error[0]]["type"];
|
$alerttype = MESSAGES[$error[0]]["type"];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$alert = lang(MESSAGES["generic_op_error"]["string"], false);
|
$alert = $Strings->get(MESSAGES["generic_op_error"]["string"], false);
|
||||||
$alerttype = MESSAGES["generic_op_error"]["type"];
|
$alerttype = MESSAGES["generic_op_error"]["type"];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -165,7 +165,7 @@ if ($VARS['progress'] == "1") {
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel panel-orange">
|
<div class="panel panel-orange">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title"><?php lang("sign in"); ?></h3>
|
<h3 class="panel-title"><?php $Strings->get("sign in"); ?></h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
@ -199,8 +199,8 @@ if ($VARS['progress'] == "1") {
|
|||||||
|
|
||||||
if (!$multiauth && !$change_password) {
|
if (!$multiauth && !$change_password) {
|
||||||
?>
|
?>
|
||||||
<input type="text" class="form-control" name="username" placeholder="<?php lang("username"); ?>" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" autofocus /><br />
|
<input type="text" class="form-control" name="username" placeholder="<?php $Strings->get("username"); ?>" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" autofocus /><br />
|
||||||
<input type="password" class="form-control" name="password" placeholder="<?php lang("password"); ?>" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" /><br />
|
<input type="password" class="form-control" name="password" placeholder="<?php $Strings->get("password"); ?>" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" /><br />
|
||||||
<?php if (CAPTCHA_ENABLED) { ?>
|
<?php if (CAPTCHA_ENABLED) { ?>
|
||||||
<div class="captcheck_container" data-stylenonce="<?php echo $SECURE_NONCE; ?>"></div>
|
<div class="captcheck_container" data-stylenonce="<?php echo $SECURE_NONCE; ?>"></div>
|
||||||
<br />
|
<br />
|
||||||
@ -210,9 +210,9 @@ if ($VARS['progress'] == "1") {
|
|||||||
} else if ($multiauth) {
|
} else if ($multiauth) {
|
||||||
?>
|
?>
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
<?php lang("2fa prompt"); ?>
|
<?php $Strings->get("2fa prompt"); ?>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="authcode" placeholder="<?php lang("authcode"); ?>" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" autofocus /><br />
|
<input type="text" class="form-control" name="authcode" placeholder="<?php $Strings->get("authcode"); ?>" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" autofocus /><br />
|
||||||
<input type="hidden" name="progress" value="2" />
|
<input type="hidden" name="progress" value="2" />
|
||||||
<input type="hidden" name="username" value="<?php echo $VARS['username']; ?>" />
|
<input type="hidden" name="username" value="<?php echo $VARS['username']; ?>" />
|
||||||
<?php
|
<?php
|
||||||
@ -226,7 +226,7 @@ if ($VARS['progress'] == "1") {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="submit" class="btn btn-primary">
|
||||||
<?php lang("continue"); ?>
|
<?php $Strings->get("continue"); ?>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -325,8 +325,8 @@ function sendLoginAlertEmail($username, $appname = SITE_TITLE) {
|
|||||||
$mail->setFrom(FROM_EMAIL, 'Account Alerts');
|
$mail->setFrom(FROM_EMAIL, 'Account Alerts');
|
||||||
$mail->addAddress(ADMIN_EMAIL, "System Admin");
|
$mail->addAddress(ADMIN_EMAIL, "System Admin");
|
||||||
$mail->isHTML(false);
|
$mail->isHTML(false);
|
||||||
$mail->Subject = lang("admin alert email subject", false);
|
$mail->Subject = $Strings->get("admin alert email subject", false);
|
||||||
$mail->Body = lang2("admin alert email message", ["username" => $username, "datetime" => date("Y-m-d H:i:s"), "ipaddr" => getClientIP(), "appname" => $appname], false);
|
$mail->Body = $Strings->build("admin alert email message", ["username" => $username, "datetime" => date("Y-m-d H:i:s"), "ipaddr" => getClientIP(), "appname" => $appname], false);
|
||||||
|
|
||||||
if (!$mail->send()) {
|
if (!$mail->send()) {
|
||||||
return $mail->ErrorInfo;
|
return $mail->ErrorInfo;
|
||||||
|
@ -21,7 +21,7 @@ if ($VARS['action'] == "ping") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (MOBILE_ENABLED !== TRUE) {
|
if (MOBILE_ENABLED !== TRUE) {
|
||||||
exit(json_encode(["status" => "ERROR", "msg" => lang("mobile login disabled", false)]));
|
exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("mobile login disabled", false)]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we have a username and access key
|
// Make sure we have a username and access key
|
||||||
@ -60,7 +60,7 @@ switch ($VARS['action']) {
|
|||||||
engageRateLimit();
|
engageRateLimit();
|
||||||
if (get_account_status($username) != "NORMAL") {
|
if (get_account_status($username) != "NORMAL") {
|
||||||
insertAuthLog(20, null, "Username: " . $username . ", Key: " . $key);
|
insertAuthLog(20, null, "Username: " . $username . ", Key: " . $key);
|
||||||
exit(json_encode(["status" => "ERROR", "msg" => lang("login failed try on web", false)]));
|
exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("login failed try on web", false)]));
|
||||||
}
|
}
|
||||||
if (authenticate_user($username, $VARS['password'], $autherror)) {
|
if (authenticate_user($username, $VARS['password'], $autherror)) {
|
||||||
$uid = $database->get("accounts", "uid", ["username" => $username]);
|
$uid = $database->get("accounts", "uid", ["username" => $username]);
|
||||||
@ -72,14 +72,14 @@ switch ($VARS['action']) {
|
|||||||
exit(json_encode(["status" => "ERROR", "msg" => $autherror]));
|
exit(json_encode(["status" => "ERROR", "msg" => $autherror]));
|
||||||
} else {
|
} else {
|
||||||
insertAuthLog(20, null, "Username: " . $username . ", Key: " . $key);
|
insertAuthLog(20, null, "Username: " . $username . ", Key: " . $key);
|
||||||
exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)]));
|
exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("login incorrect", false)]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "user_info":
|
case "user_info":
|
||||||
engageRateLimit();
|
engageRateLimit();
|
||||||
if (get_account_status($username) != "NORMAL") {
|
if (get_account_status($username) != "NORMAL") {
|
||||||
insertAuthLog(20, null, "Username: " . $username . ", Key: " . $key);
|
insertAuthLog(20, null, "Username: " . $username . ", Key: " . $key);
|
||||||
exit(json_encode(["status" => "ERROR", "msg" => lang("login failed try on web", false)]));
|
exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("login failed try on web", false)]));
|
||||||
}
|
}
|
||||||
if (authenticate_user($username, $VARS['password'], $autherror)) {
|
if (authenticate_user($username, $VARS['password'], $autherror)) {
|
||||||
$userinfo = $database->get("accounts", ["uid", "username", "realname", "email"], ["username" => $username]);
|
$userinfo = $database->get("accounts", ["uid", "username", "realname", "email"], ["username" => $username]);
|
||||||
@ -91,7 +91,7 @@ switch ($VARS['action']) {
|
|||||||
exit(json_encode(["status" => "ERROR", "msg" => $autherror]));
|
exit(json_encode(["status" => "ERROR", "msg" => $autherror]));
|
||||||
} else {
|
} else {
|
||||||
insertAuthLog(20, null, "Username: " . $username . ", Key: " . $key);
|
insertAuthLog(20, null, "Username: " . $username . ", Key: " . $key);
|
||||||
exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)]));
|
exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("login incorrect", false)]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "start_session":
|
case "start_session":
|
||||||
@ -107,7 +107,7 @@ switch ($VARS['action']) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
insertAuthLog(20, null, "Username: " . $username . ", Key: " . $key);
|
insertAuthLog(20, null, "Username: " . $username . ", Key: " . $key);
|
||||||
exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)]));
|
exit(json_encode(["status" => "ERROR", "msg" => $Strings->get("login incorrect", false)]));
|
||||||
case "listapps":
|
case "listapps":
|
||||||
$apps = EXTERNAL_APPS;
|
$apps = EXTERNAL_APPS;
|
||||||
// Format paths as absolute URLs
|
// Format paths as absolute URLs
|
||||||
|
40
required.php
40
required.php
@ -131,46 +131,6 @@ function is_empty($str) {
|
|||||||
return (is_null($str) || !isset($str) || $str == '');
|
return (is_null($str) || !isset($str) || $str == '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* I18N string getter. If the key doesn't exist, outputs the key itself.
|
|
||||||
* @param string $key I18N string key
|
|
||||||
* @param boolean $echo whether to echo the result or return it (default echo)
|
|
||||||
*/
|
|
||||||
function lang($key, $echo = true) {
|
|
||||||
global $Strings;
|
|
||||||
return $Strings->get($key, $echo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* I18N string getter (with builder). If the key doesn't exist, outputs the key itself.
|
|
||||||
* @param string $key I18N string key
|
|
||||||
* @param array $replace key-value array of replacements.
|
|
||||||
* If the string value is "hello {abc}" and you give ["abc" => "123"], the
|
|
||||||
* result will be "hello 123".
|
|
||||||
* @param boolean $echo whether to echo the result or return it (default echo)
|
|
||||||
*/
|
|
||||||
function lang2($key, $replace, $echo = true) {
|
|
||||||
global $Strings;
|
|
||||||
return $Strings->build($key, $replace, $echo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add strings to the i18n global array.
|
|
||||||
* @param array $strings ['key' => 'value']
|
|
||||||
*/
|
|
||||||
function addLangStrings($strings) {
|
|
||||||
$GLOBALS['STRINGS'] = array_merge($GLOBALS['STRINGS'], $strings);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add strings to the i18n global array. Accepts an array of language code
|
|
||||||
* keys, with the values a key-value array of strings.
|
|
||||||
* @param array $strings ['en_us' => ['key' => 'value']]
|
|
||||||
*/
|
|
||||||
function addMultiLangStrings($strings) {
|
|
||||||
throw new Exception("Calling broken function addMultiLangStrings()");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if an email address is valid.
|
* Checks if an email address is valid.
|
||||||
* @param string $email Email to check
|
* @param string $email Email to check
|
||||||
|
Loading…
x
Reference in New Issue
Block a user