]>
Commit | Line | Data |
---|---|---|
5fe4848b AD |
1 | <?php |
2 | error_reporting(E_ERROR | E_WARNING | E_PARSE); | |
3 | ||
4 | require_once "functions.php"; | |
5 | require_once "sessions.php"; | |
6 | require_once "sanity_check.php"; | |
7 | require_once "version.php"; | |
8 | require_once "config.php"; | |
9 | require_once "db-prefs.php"; | |
10 | ||
11 | $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); | |
12 | ||
13 | ||
14 | $dt_add = get_script_dt_add(); | |
15 | ||
16 | no_cache_incantation(); | |
17 | ||
18 | header('Content-Type: text/html; charset=utf-8'); | |
19 | ||
20 | ?> | |
21 | ||
22 | <html> | |
23 | <head> | |
24 | <title>Tiny Tiny RSS : Login</title> | |
25 | <link rel="stylesheet" type="text/css" href="tt-rss.css"> | |
26 | <link rel="shortcut icon" type="image/png" href="images/favicon.png"> | |
5fe4848b AD |
27 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
28 | <script type="text/javascript" src="lib/prototype.js"></script> | |
29 | <script type="text/javascript" src="lib/scriptaculous/scriptaculous.js"></script> | |
30 | <script type="text/javascript" src="functions.js"></script> | |
31 | </head> | |
32 | ||
33 | <body> | |
34 | ||
35 | <script type="text/javascript"> | |
36 | function init() { | |
37 | ||
38 | if (arguments.callee.done) return; | |
39 | arguments.callee.done = true; | |
40 | ||
41 | var login = document.forms["loginForm"].login; | |
42 | ||
43 | var limit_set = getCookie("ttrss_bwlimit"); | |
44 | ||
45 | if (limit_set == "true") { | |
46 | document.forms["loginForm"].bw_limit.checked = true; | |
47 | } | |
48 | ||
49 | login.focus(); | |
50 | ||
51 | } | |
52 | function languageChange(elem) { | |
53 | try { | |
54 | document.forms['loginForm']['click'].disabled = true; | |
55 | ||
56 | var lang = elem[elem.selectedIndex].value; | |
57 | setCookie("ttrss_lang", lang, <?php print SESSION_COOKIE_LIFETIME ?>); | |
58 | window.location.reload(); | |
59 | } catch (e) { | |
60 | exception_error("languageChange", e); | |
61 | } | |
62 | } | |
63 | ||
64 | function gotoRegForm() { | |
65 | window.location.href = "register.php"; | |
66 | return false; | |
67 | } | |
68 | ||
69 | function bwLimitChange(elem) { | |
70 | try { | |
71 | var limit_set = elem.checked; | |
72 | ||
73 | setCookie("ttrss_bwlimit", limit_set, | |
74 | <?php print SESSION_COOKIE_LIFETIME ?>); | |
75 | ||
76 | } catch (e) { | |
77 | exception_error("bwLimitChange", e); | |
78 | } | |
79 | } | |
80 | ||
81 | function validateLoginForm(f) { | |
82 | try { | |
83 | ||
84 | if (f.login.value.length == 0) { | |
85 | new Effect.Highlight(f.login); | |
86 | return false; | |
87 | } | |
88 | ||
89 | if (f.password.value.length == 0) { | |
90 | new Effect.Highlight(f.password); | |
91 | return false; | |
92 | } | |
93 | ||
94 | document.forms['loginForm']['click'].disabled = true; | |
95 | ||
96 | return true; | |
97 | } catch (e) { | |
98 | exception_error("validateLoginForm", e); | |
99 | return true; | |
100 | } | |
101 | } | |
102 | </script> | |
103 | ||
104 | <script type="text/javascript"> | |
105 | if (document.addEventListener) { | |
106 | document.addEventListener("DOMContentLoaded", init, null); | |
107 | } | |
108 | window.onload = init; | |
109 | </script> | |
110 | ||
111 | <form action="tt-rss.php" method="POST" name="loginForm" onsubmit="return validateLoginForm(this)"> | |
112 | <input type="hidden" name="login_action" value="do_login"> | |
113 | ||
114 | <table width="100%" class="loginForm2"> | |
115 | <tr> | |
116 | <td class="loginTop" valign="bottom" align="left"> | |
117 | <img src="images/ttrss_logo_big.png" alt="Logo"> | |
118 | </td> | |
119 | </tr><tr> | |
120 | <td align="center" valign="middle" class="loginMiddle" height="100%"> | |
121 | <?php if ($_SESSION['login_error_msg']) { ?> | |
122 | <div class="loginError"><?php echo $_SESSION['login_error_msg'] ?></div> | |
123 | <?php $_SESSION['login_error_msg'] = ""; ?> | |
124 | <?php } ?> | |
125 | <table> | |
126 | <tr><td align="right"><?php echo __("Login:") ?></td> | |
127 | <td align="right"><input name="login" | |
128 | value="<?php echo $_SERVER["REMOTE_USER"] ?>"></td></tr> | |
129 | <tr><td align="right"><?php echo __("Password:") ?></td> | |
130 | <td align="right"><input type="password" name="password" | |
131 | value="<?php echo $_SERVER["REMOTE_USER"] ?>"></td></tr> | |
132 | <?php if (ENABLE_TRANSLATIONS) { ?> | |
133 | <tr><td align="right"><?php echo __("Language:") ?></td> | |
134 | <td align="right"> | |
135 | <?php | |
136 | print_select_hash("language", $_COOKIE["ttrss_lang"], get_translations(), | |
137 | "style='width : 100%' onchange='languageChange(this)'"); | |
138 | ||
139 | ?> | |
140 | </td></tr> | |
141 | <?php } ?> | |
142 | <!-- <tr><td colspan="2"> | |
143 | <input type="checkbox" name="remember_me" id="remember_me"> | |
144 | <label for="remember_me">Remember me on this computer</label> | |
145 | </td></tr> --> | |
146 | ||
147 | <tr><td colspan="2" align="right" class="innerLoginCell"> | |
148 | ||
149 | <input type="submit" class="button" value="<?php echo __('Log in') ?>" name='click'> | |
150 | <?php if (defined('ENABLE_REGISTRATION') && ENABLE_REGISTRATION) { ?> | |
151 | <input type="submit" class="button" onclick="return gotoRegForm()" | |
152 | value="<?php echo __("Create new account") ?>"/> | |
153 | <?php } ?> | |
154 | ||
155 | <input type="hidden" name="action" value="login"> | |
156 | <input type="hidden" name="rt" | |
157 | value="<?php if ($return_to != 'none') { echo $return_to; } ?>"> | |
158 | </td></tr> | |
159 | ||
160 | <tr><td colspan="2" align="right" class="innerLoginCell"> | |
161 | ||
162 | <div class="small"> | |
163 | <input name="bw_limit" id="bw_limit" type="checkbox" | |
164 | onchange="bwLimitChange(this)"> | |
165 | <label for="bw_limit"> | |
166 | <?php echo __("Limit bandwidth usage") ?></label></div> | |
167 | ||
168 | </td></tr> | |
169 | ||
170 | ||
171 | </table> | |
172 | </td> | |
173 | </tr><tr> | |
174 | <td align="center" class="loginBottom"> | |
175 | <a href="http://tt-rss.org/">Tiny Tiny RSS</a> © 2005–2009 <a href="http://bah.org.ru/">Andrew Dolgov</a> | |
176 | </td> | |
177 | </tr> | |
178 | ||
179 | </table> | |
180 | ||
181 | </form> | |
182 | ||
183 | </body></html> |