public static function post_controller_constructor() { self::$CI->load->helper('access'); self::$CI->load->helper('remote_user'); $routing =& load_class('Router'); $class = $routing->fetch_class(); $method = $routing->fetch_method(); $action = array('class' => $class, 'method' => $method); $remote_user = get_remote_user(); if ($remote_user !== NULL && isset($_GET["user_id"])) { self::redirect_self(); } if (is_action_public($action)) { return true; } if ($remote_user == NULL && !is_action_public($action)) { self::redirect_login(); return false; } if (can_do($remote_user['access_group'], $action)) { return true; } self::redirect_access_denied(); return false; }
function remote_user_can_do($action) { $remote_user = get_remote_user(); if ($remote_user == NULL) { $remote_user = array('access_group' => 'PUBLIC'); } return can_do($remote_user['access_group'], $action); }
</div> <?php $_SESSION['login_error_msg'] = ""; ?> <?php } ?> <table> <tr><td align="right"><?php echo __("Login:"******"right"><input name="login" onchange="fetchProfiles()" onfocus="fetchProfiles()" value="<?php echo get_remote_user($link); ?> "></td></tr> <tr><td align="right"><?php echo __("Password:"******"right"><input type="password" name="password" onchange="fetchProfiles()" onfocus="fetchProfiles()" value="<?php echo get_remote_fakepass($link); ?> "></td></tr> <tr><td align="right"><?php echo __("Language:"); ?>
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 = $_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\n\t\t\t\t\t\t\tWHERE 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 (get_remote_user($link) && AUTO_LOGIN) { authenticate_user($link, get_remote_user($link), null); $_SESSION["ref_schema_version"] = get_schema_version($link, true); } else { render_login_form($link, $mobile); //header("Location: login.php"); 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"]); } } else { return authenticate_user($link, "admin", null); } }