diff --git a/functions.php b/functions.php index bb8586719..38b11c665 100644 --- a/functions.php +++ b/functions.php @@ -53,6 +53,12 @@ $lang = $_COOKIE["ttrss_lang"]; } + /* In login action of mobile version */ + if ($_POST["language"] && defined('MOBILE_VERSION')) { + $lang = $_POST["language"]; + $_COOKIE["ttrss_lang"] = $lang; + } + if ($lang) { if (defined('LC_MESSAGES')) { _setlocale(LC_MESSAGES, $lang); @@ -61,7 +67,13 @@ } else { die("can't setlocale(): please set ENABLE_TRANSLATIONS to false in config.php"); } - _bindtextdomain("messages", "locale"); + + if (defined('MOBILE_VERSION')) { + _bindtextdomain("messages", "../locale"); + } else { + _bindtextdomain("messages", "locale"); + } + _textdomain("messages"); _bind_textdomain_codeset("messages", "UTF-8"); } diff --git a/mobile/login_form.php b/mobile/login_form.php index 567d1aa97..dd5b4acdc 100644 --- a/mobile/login_form.php +++ b/mobile/login_form.php @@ -3,14 +3,50 @@ Tiny Tiny RSS : Login + + + + + +
Tiny Tiny RSS
-
+ @@ -23,8 +59,16 @@ + + + + - +
diff --git a/mobile/mobile.js b/mobile/mobile.js new file mode 100644 index 000000000..64d581410 --- /dev/null +++ b/mobile/mobile.js @@ -0,0 +1,48 @@ +function debug(msg) { + // no-op +} + +function setCookie(name, value, lifetime, path, domain, secure) { + + var d = false; + + if (lifetime) { + d = new Date(); + d.setTime(d.getTime() + (lifetime * 1000)); + } + + debug("setCookie: " + name + " => " + value + ": " + d); + + int_setCookie(name, value, d, path, domain, secure); + +} + +function int_setCookie(name, value, expires, path, domain, secure) { + document.cookie= name + "=" + escape(value) + + ((expires) ? "; expires=" + expires.toGMTString() : "") + + ((path) ? "; path=" + path : "") + + ((domain) ? "; domain=" + domain : "") + + ((secure) ? "; secure" : ""); +} + +function exception_error(location, e, silent) { + var msg; + + if (e.fileName) { + var base_fname = e.fileName.substring(e.fileName.lastIndexOf("/") + 1); + + msg = "Exception: " + e.name + ", " + e.message + + "\nFunction: " + location + "()" + + "\nLocation: " + base_fname + ":" + e.lineNumber; + + } else if (e.description) { + msg = "Exception: " + e.description + "\nFunction: " + location + "()"; + } else { + msg = "Exception: " + e + "\nFunction: " + location + "()"; + } + + if (!silent) { + alert(msg); + } +} + diff --git a/mobile/tt-rss.php b/mobile/tt-rss.php index a23bc8b6a..9521e66dc 100644 --- a/mobile/tt-rss.php +++ b/mobile/tt-rss.php @@ -1,6 +1,8 @@