]> git.wh0rd.org Git - tt-rss.git/commitdiff
mobile: sync login stuff and such with desktop version
authorAndrew Dolgov <fox@bah.spb.su>
Mon, 5 Mar 2007 16:27:48 +0000 (17:27 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Mon, 5 Mar 2007 16:27:48 +0000 (17:27 +0100)
functions.php
mobile/functions.php
mobile/login.php [deleted file]
mobile/login_form.php [new file with mode: 0644]
mobile/logout.php
mobile/tt-rss.php

index 14c68e86447aa3206568d822a80036fb377bfe4c..4c5059d14af38c8e01d558bf0ee1b44ae940228a 100644 (file)
                return true;
        }
 
-       function login_sequence($link) {
+       function login_sequence($link, $mobile = false) {
                if (!SINGLE_USER_MODE) {
 
                        if (defined('_DEBUG_USER_SWITCH') && $_SESSION["uid"]) {
 //                     print_r($_SESSION);
 
                        if (!$_SESSION["uid"] || !validate_session($link)) {
-                               render_login_form($link);
+                               render_login_form($link, $mobile);
                                exit;
                        }
 
                return true;
        }
 
-       function render_login_form($link) {
-               require_once "login_form.php";
+       function render_login_form($link, $mobile = false) {
+               if (!$mobile) {
+                       require_once "login_form.php";
+               } else {
+                       require_once "mobile/login_form.php";
+               }
        }
 
        // from http://developer.apple.com/internet/safari/faq.html
index 1d50767e44c5f51ab5f4a129a6e718486cbb2464..86a07bd1014a6e55dcf024cdc756ca84b3272784 100644 (file)
@@ -2,6 +2,8 @@
        define('MOBILE_FEEDLIST_ENABLE_ICONS', false);
        define('TTRSS_SESSION_NAME', 'ttrss_m_sid');
 
+       require_once "../gettext/gettext.inc";
+
        function render_feeds_list($link) {
 
                $tags = $_GET["tags"];
diff --git a/mobile/login.php b/mobile/login.php
deleted file mode 100644 (file)
index a9ee69b..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-       require_once "functions.php";
-
-       require_once "../version.php"; 
-       require_once "../config.php";
-       require_once "../functions.php";
-
-       $url_path = get_script_urlpath();
-       $redirect_base = "http://" . $_SERVER["SERVER_NAME"] . $url_path;
-
-       if (SINGLE_USER_MODE) {
-               header("Location: $redirect_base/tt-rss.php");
-               exit;
-       }
-
-       $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
-
-       $login = $_POST["login"];
-       $password = $_POST["password"];
-       $return_to = $_POST["rt"];
-       $action = $_POST["action"];
-
-       if ($_COOKIE[get_session_cookie_name()]) {
-               require_once "../sessions.php";
-               if ($_SESSION["uid"]) {
-                       initialize_user_prefs($link, $_SESSION["uid"]); 
-                       header("Location: $redirect_base/tt-rss.php");
-                       exit;
-               }
-       }
-
-       if ($login && $password) {
-
-               if ($_POST["remember_me"]) {
-                       session_set_cookie_params(SESSION_COOKIE_LIFETIME_REMEMBER);
-               } else {
-                       session_set_cookie_params(SESSION_COOKIE_LIFETIME);
-               }
-                       
-               require_once "../sessions.php";
-
-               if (authenticate_user($link, $login, $password)) {
-                       initialize_user_prefs($link, $_SESSION["uid"]); 
-
-                       if ($_POST["remember_me"]) {
-                               $_SESSION["cookie_lifetime"] = time() + SESSION_COOKIE_LIFETIME_REMEMBER;
-                       } else {
-                               $_SESSION["cookie_lifetime"] = time() + SESSION_COOKIE_LIFETIME;
-                       }
-
-                       if (!$return_to) {
-                               $return_to = "tt-rss.php";
-                       }
-                       header("Location: $redirect_base/$return_to");
-                       exit;
-               } else {
-                       $error_msg = "Error: Unable to authenticate user. Please check login and password.";
-               }
-
-       } else if ($action) {
-               $error_msg = "Error: Either login or password is blank.";
-       }
-
-?>
-<html>
-<head>
-       <title>Tiny Tiny RSS : Login</title>
-       <link rel="stylesheet" type="text/css" href="mobile.css">
-       <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-</head>
-
-<body>
-
-       <div id="content">
-       <div id="heading">Tiny Tiny RSS</div>
-
-       <form action="login.php" method="POST">
-       <input type="hidden" name="rt" value="<?php echo $_GET['rt'] ?>">
-       <input type="hidden" name="action" value="login">
-
-       <?php if ($error_msg) { ?>
-               <div class="loginError"><?php echo $error_msg ?></div>
-       <?php } ?>
-
-       <table>
-               <tr><td align='right'>Login:</td><td><input name="login"></td>
-               <tr><td align='right'>Password:</td><td><input type="password" name="password"></tr>
-
-               <tr><td colspan='2'>
-                       <input type="submit" class="button" value="Login">
-                       <input type="checkbox" name="remember_me" id="remember_me">
-                       <label for="remember_me">Remember me</label></td></tr>
-               </table>
-
-       </form>
-
-       </div>
-
-</body>
-</html>
-
-<?php db_close($link); ?>
-
diff --git a/mobile/login_form.php b/mobile/login_form.php
new file mode 100644 (file)
index 0000000..567d1aa
--- /dev/null
@@ -0,0 +1,35 @@
+<html>
+<head>
+       <title>Tiny Tiny RSS : Login</title>
+       <link rel="stylesheet" type="text/css" href="mobile.css">
+       <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+</head>
+
+<body>
+
+       <div id="content">
+       <div id="heading">Tiny Tiny RSS</div>
+
+       <form action="tt-rss.php" method="POST">
+       <input type="hidden" name="rt" value="<?php echo $_GET['rt'] ?>">
+       <input type="hidden" name="login_action" value="do_login">
+
+       <?php if ($_SESSION['login_error_msg']) { ?>
+               <div class="loginError"><?php echo $_SESSION['login_error_msg'] ?></div>
+               <?php $_SESSION['login_error_msg'] = ""; ?>
+       <?php } ?>
+
+       <table>
+               <tr><td align='right'><?php echo __("Login:") ?></td><td><input name="login"></td>
+               <tr><td align='right'><?php echo __("Password:") ?></td><td><input type="password" name="password"></tr>
+
+               <tr><td colspan='2'>
+                       <input type="submit" class="button" value="Login">
+               </td></tr>
+               </table>
+       </form>
+       </div>
+
+</body>
+</html>
+
index 76641467ddfb6d66500753840812f71faaa8c0d8..89db68464654d4fcbaa4e0f9e1d2c885695c8604 100644 (file)
@@ -1,40 +1,9 @@
-<?php
+<?php  
        require_once "functions.php";
-
-       require_once "../config.php";
-       require_once "../functions.php";
        require_once "../sessions.php";
+       require_once "../functions.php";
 
        logout_user();
 
-       if (!USE_HTTP_AUTH) {
-               $url_path = get_script_urlpath();
-
-               if (ENABLE_LOGIN_SSL) {
-                       $protocol = "https";
-               } else {
-                       $protocol = "http";
-               }               
-
-               $redirect_base = "$protocol://" . $_SERVER["SERVER_NAME"] . $url_path;
-
-               header("Location: $redirect_base/login.php");
-       } else { ?>
-       
-       <html>
-               <head>
-                       <title>Tiny Tiny RSS : Logout</title>
-                       <link rel="stylesheet" type="text/css" href="tt-rss.css">
-               <body>
-                       <h1>You have been logged out.</h1>
-
-                       <p><b>Warning:</b>
-                       As there is no way to reliably clear HTTP Authentication 
-                       credentials from your browser, it is recommended for you to close
-                       this browser window, otherwise your browser could automatically
-                       authenticate again using previously supplied credentials, which
-                       is a security risk.</p>
-                       
-       </body>
-       </html>
-<?php  } ?>
+       header("Location: tt-rss.php");
+?>
index 890c1e0a1d61b222fc98ed6d44cd7d3251649272..d75796a39ab0afd7146ef891a7719852bb40ab7b 100644 (file)
@@ -1,4 +1,6 @@
 <?php
+       error_reporting(E_ERROR | E_WARNING | E_PARSE);
+
        require_once "../config.php";
        require_once "functions.php";
        require_once "../functions.php"; 
@@ -11,7 +13,7 @@
 
        $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
 
-       login_sequence($link);
+       login_sequence($link, true);
 
        /* perform various redirect-needing subops */
 
@@ -65,7 +67,7 @@
        } else if ($go == "view") {
                render_article($link);
        } else {
-               print "Function not implemented";
+               print __("Internal error: Function not implemented");
        }
 
 ?>