summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2012-11-22 15:33:29 +0400
committerAndrew Dolgov <[email protected]>2012-11-22 15:33:29 +0400
commitafc3cf5522e27258fe725569e54c3c19a3f6dfed (patch)
tree95889e05c804d6a3e02cc1adf77e9ac7f3d0454f
parentb77d0c4a12119ce0a9c747376adb9fab94018217 (diff)
fix default language not saved in the login form
-rw-r--r--include/functions.php91
1 files changed, 6 insertions, 85 deletions
diff --git a/include/functions.php b/include/functions.php
index 33a83b08a..821e314f6 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -70,14 +70,11 @@
$lang = _TRANSLATION_OVERRIDE_DEFAULT;
}
- if ($_COOKIE["ttrss_lang"] && $_COOKIE["ttrss_lang"] != "auto") {
- $lang = $_COOKIE["ttrss_lang"];
- }
-
/* In login action of mobile version */
if ($_POST["language"] && defined('MOBILE_VERSION')) {
$lang = $_POST["language"];
- $_COOKIE["ttrss_lang"] = $lang;
+ } else {
+ $lang = $_SESSION["language"];
}
if ($lang) {
@@ -735,90 +732,14 @@
/* bump login timestamp */
db_query($link, "UPDATE ttrss_users SET last_login = NOW() WHERE id = " .
$_SESSION["uid"]);
-
- if ($_SESSION["language"] && SESSION_COOKIE_LIFETIME > 0) {
- setcookie("ttrss_lang", $_SESSION["language"],
- time() + SESSION_COOKIE_LIFETIME);
- }
- }
- }
- }
-
-
- /* function login_sequence($link, $mobile = false) {
- $_SESSION["prefs_cache"] = array();
-
- if (!SINGLE_USER_MODE) {
-
- $login_action = $_POST["login_action"];
-
- # try to authenticate user if called from login form
- if ($login_action == "do_login") {
- $login = db_escape_string($_POST["login"]);
- $password = $_POST["password"];
- $remember_me = $_POST["remember_me"];
-
- if (authenticate_user($link, $login, $password)) {
- $_POST["password"] = "";
-
- $_SESSION["language"] = $_POST["language"];
- $_SESSION["ref_schema_version"] = get_schema_version($link, true);
- $_SESSION["bw_limit"] = !!$_POST["bw_limit"];
-
- if ($_POST["profile"]) {
-
- $profile = db_escape_string($_POST["profile"]);
-
- $result = db_query($link, "SELECT id FROM ttrss_settings_profiles
- WHERE id = '$profile' AND owner_uid = " . $_SESSION["uid"]);
-
- if (db_num_rows($result) != 0) {
- $_SESSION["profile"] = $profile;
- $_SESSION["prefs_cache"] = array();
- }
- }
-
- if ($_REQUEST['return']) {
- header("Location: " . $_REQUEST['return']);
- } else {
- header("Location: " . $_SERVER["REQUEST_URI"]);
- }
-
- exit;
-
- return;
- } else {
- $_SESSION["login_error_msg"] = __("Incorrect username or password");
- }
}
- if (!$_SESSION["uid"] || !validate_session($link)) {
-
- if (AUTH_AUTO_LOGIN && authenticate_user($link, null, null)) {
- $_SESSION["ref_schema_version"] = get_schema_version($link, true);
- } else {
- authenticate_user($link, null, null, true);
- render_login_form($link, $mobile);
- exit;
- }
- } else {
- // bump login timestamp
- db_query($link, "UPDATE ttrss_users SET last_login = NOW() WHERE id = " .
- $_SESSION["uid"]);
-
- if ($_SESSION["language"] && SESSION_COOKIE_LIFETIME > 0) {
- setcookie("ttrss_lang", $_SESSION["language"],
- time() + SESSION_COOKIE_LIFETIME);
- }
-
- // try to remove possible duplicates from feed counter cache
-// ccache_cleanup($link, $_SESSION["uid"]);
+ if ($_SESSION["uid"] && $_SESSION["language"] && SESSION_COOKIE_LIFETIME > 0) {
+ setcookie("ttrss_lang", $_SESSION["language"],
+ time() + SESSION_COOKIE_LIFETIME);
}
-
- } else {
- return authenticate_user($link, "admin", null);
}
- } */
+ }
function truncate_string($str, $max_len, $suffix = '&hellip;') {
if (mb_strlen($str, "utf-8") > $max_len - 3) {