From d98e76d9c2d6f0e5ef7ca4f9ef32bc6f7daf8ea2 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 21 Mar 2013 23:47:44 +0400 Subject: [PATCH] remove long deprecated mobile/ --- include/functions.php | 26 +- mobile/article.php | 24 -- mobile/backend.php | 55 ---- mobile/cat.php | 21 -- mobile/feed.php | 25 -- mobile/home.php | 25 -- mobile/image.php | 19 -- mobile/index.php | 82 ------ mobile/login_form.php | 58 ---- mobile/logout.php | 7 - mobile/mobile-functions.php | 546 ------------------------------------ mobile/mobile.css | 38 --- mobile/mobile.js | 163 ----------- mobile/prefs.php | 54 ---- 14 files changed, 6 insertions(+), 1137 deletions(-) delete mode 100644 mobile/article.php delete mode 100644 mobile/backend.php delete mode 100644 mobile/cat.php delete mode 100644 mobile/feed.php delete mode 100644 mobile/home.php delete mode 100644 mobile/image.php delete mode 100644 mobile/index.php delete mode 100644 mobile/login_form.php delete mode 100644 mobile/logout.php delete mode 100644 mobile/mobile-functions.php delete mode 100644 mobile/mobile.css delete mode 100644 mobile/mobile.js delete mode 100644 mobile/prefs.php diff --git a/include/functions.php b/include/functions.php index 535d47674..5d5550059 100644 --- a/include/functions.php +++ b/include/functions.php @@ -75,10 +75,7 @@ $lang = _TRANSLATION_OVERRIDE_DEFAULT; } - /* In login action of mobile version */ - if ($_POST["language"] && defined('MOBILE_VERSION')) { - $lang = $_POST["language"]; - } else if ($_SESSION["language"] && $_SESSION["language"] != "auto") { + if ($_SESSION["language"] && $_SESSION["language"] != "auto") { $lang = $_SESSION["language"]; } @@ -89,11 +86,7 @@ _setlocale(LC_ALL, $lang); } - if (defined('MOBILE_VERSION')) { - _bindtextdomain("messages", "../locale"); - } else { - _bindtextdomain("messages", "locale"); - } + _bindtextdomain("messages", "locale"); _textdomain("messages"); _bind_textdomain_codeset("messages", "UTF-8"); @@ -753,7 +746,7 @@ } } - function login_sequence($link, $login_form = 0) { + function login_sequence($link) { $_SESSION["prefs_cache"] = false; if (SINGLE_USER_MODE) { @@ -769,7 +762,7 @@ authenticate_user($link, null, null, true); } - if (!$_SESSION["uid"]) render_login_form($link, $login_form); + if (!$_SESSION["uid"]) render_login_form($link); } else { /* bump login timestamp */ @@ -2816,15 +2809,8 @@ return true; } - function render_login_form($link, $form_id = 0) { - switch ($form_id) { - case 0: - require_once "login_form.php"; - break; - case 1: - require_once "mobile/login_form.php"; - break; - } + function render_login_form($link) { + require_once "login_form.php"; exit; } diff --git a/mobile/article.php b/mobile/article.php deleted file mode 100644 index 345767fbd..000000000 --- a/mobile/article.php +++ /dev/null @@ -1,24 +0,0 @@ - - diff --git a/mobile/backend.php b/mobile/backend.php deleted file mode 100644 index 98e30bd13..000000000 --- a/mobile/backend.php +++ /dev/null @@ -1,55 +0,0 @@ - - diff --git a/mobile/cat.php b/mobile/cat.php deleted file mode 100644 index 74d488e1f..000000000 --- a/mobile/cat.php +++ /dev/null @@ -1,21 +0,0 @@ - - diff --git a/mobile/feed.php b/mobile/feed.php deleted file mode 100644 index f7b7443d3..000000000 --- a/mobile/feed.php +++ /dev/null @@ -1,25 +0,0 @@ - - diff --git a/mobile/home.php b/mobile/home.php deleted file mode 100644 index 71194da0a..000000000 --- a/mobile/home.php +++ /dev/null @@ -1,25 +0,0 @@ - diff --git a/mobile/image.php b/mobile/image.php deleted file mode 100644 index 765fcc240..000000000 --- a/mobile/image.php +++ /dev/null @@ -1,19 +0,0 @@ - diff --git a/mobile/index.php b/mobile/index.php deleted file mode 100644 index edbf586e0..000000000 --- a/mobile/index.php +++ /dev/null @@ -1,82 +0,0 @@ - - - - - -Tiny Tiny RSS - - - - - - - - - - - - - - -
-

- - Preferences -
- - - - - diff --git a/mobile/login_form.php b/mobile/login_form.php deleted file mode 100644 index 98c0bfdbc..000000000 --- a/mobile/login_form.php +++ /dev/null @@ -1,58 +0,0 @@ - - - - -Tiny Tiny RSS - - - - - - - - - - - - - -
-

- - -
- -
" - method="post"> - - - -
- -
- - -
- -
- - -
- -
- -
- - - - - - - diff --git a/mobile/logout.php b/mobile/logout.php deleted file mode 100644 index 46d7ec8ee..000000000 --- a/mobile/logout.php +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/mobile/mobile-functions.php b/mobile/mobile-functions.php deleted file mode 100644 index 39b89fa9c..000000000 --- a/mobile/mobile-functions.php +++ /dev/null @@ -1,546 +0,0 @@ - 0; - } - - function render_flat_feed_list($link, $offset) { - $owner_uid = $_SESSION["uid"]; - $limit = 0; - - if (!$offset) $offset = 0; - - if (mobile_get_pref($link, "SORT_FEEDS_UNREAD")) { - $order_by = "unread DESC, title"; - } else { - $order_by = "title"; - } - - if ($limit > 0) { - $limit_qpart = "LIMIT $limit OFFSET $offset"; - } else { - $limit_qpart = ""; - } - - $result = db_query($link, "SELECT id, - title, - (SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries - WHERE feed_id = ttrss_feeds.id AND unread = true - AND ttrss_user_entries.ref_id = ttrss_entries.id - AND owner_uid = '$owner_uid') AS unread - FROM ttrss_feeds - WHERE - ttrss_feeds.owner_uid = '$owner_uid' - ORDER BY $order_by $limit_qpart"); - - if (!$offset) print '
    '; - - - // print "
  • ".__('Actions...')."
  • "; - - $num_feeds = 0; - - while ($line = db_fetch_assoc($result)) { - $id = $line["id"]; - $unread = $line["unread"]; - - // $unread = rand(0, 100); - - if ($unread > 0) { - $line["title"] = $line["title"] . " ($unread)"; - $class = ''; - } else { - $class = 'oldItem'; - } - - if (mobile_feed_has_icon($id)) { - $icon_url = "../".ICONS_URL."/$id.ico"; - } else { - $icon_url = "../images/blank_icon.gif"; - } - - if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) { - print "
  • " . - "". - $line["title"] . "
  • "; - } - - ++$num_feeds; - } - -/* $next_offset = $offset + $num_feeds; - - print "
  • Show more feeds...
  • "; */ - - if (!$offset) print "
"; - - } - - function render_category($link, $cat_id, $offset) { - $owner_uid = $_SESSION["uid"]; - - if ($cat_id >= 0) { - - if ($cat_id != 0) { - $cat_query = "cat_id = '$cat_id'"; - } else { - $cat_query = "cat_id IS NULL"; - } - - if (mobile_get_pref($link, "SORT_FEEDS_UNREAD")) { - $order_by = "unread DESC, title"; - } else { - $order_by = "title"; - } - - $result = db_query($link, "SELECT id, - title, - (SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries - WHERE feed_id = ttrss_feeds.id AND unread = true - AND ttrss_user_entries.ref_id = ttrss_entries.id - AND owner_uid = '$owner_uid') as unread - FROM ttrss_feeds - WHERE - ttrss_feeds.owner_uid = '$owner_uid' AND - $cat_query - ORDER BY $order_by"); - - $title = getCategoryTitle($link, $cat_id); - - print "
    "; - - // print "
  • ".__('Actions...')."
  • "; - - while ($line = db_fetch_assoc($result)) { - $id = $line["id"]; - $unread = $line["unread"]; - - // $unread = rand(0, 100); - - if ($unread > 0) { - $line["title"] = $line["title"] . " ($unread)"; - $class = ''; - } else { - $class = 'oldItem'; - } - - if (mobile_feed_has_icon($id)) { - $icon_url = "../".ICONS_URL."/$id.ico"; - } else { - $icon_url = "../images/blank_icon.gif"; - } - - if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) { - print "
  • " . - "". - $line["title"] . "
  • "; - } - } - - print "
"; - } else if ($cat_id == -1) { - - $title = __('Special'); - - print "
    "; - - foreach (array(-4, -3, -1, -2, 0) as $id) { - $title = getFeedTitle($link, $id); - $unread = getFeedUnread($link, $id, false); - $icon = getFeedIcon($id); - - if ($unread > 0) { - $title = $title . " ($unread)"; - $class = ''; - } else { - $class = 'oldItem'; - } - - if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) { - print "
  • - - $title
  • "; - } - } - - print "
"; - } else if ($cat_id == -2) { - - $title = __('Labels'); - - print "
    "; - - $result = db_query($link, "SELECT id, caption FROM ttrss_labels2 - WHERE owner_uid = '$owner_uid'"); - - $label_data = array(); - - while ($line = db_fetch_assoc($result)) { - - $id = -$line["id"] - 11; - - $unread = getFeedUnread($link, $id); - $title = $line["caption"]; - - if ($unread > 0) { - $title = $title . " ($unread)"; - $class = ''; - } else { - $class = 'oldItem'; - } - - if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) { - print "
  • - $title
  • "; - } - } - print "
"; - } - } - - function render_categories_list($link) { - $owner_uid = $_SESSION["uid"]; - - $cat_browse = mobile_get_pref($link, "BROWSE_CATS"); - - print '
    '; - -// print "
  • Search...
  • "; - - foreach (array(-1, -2) as $id) { - $title = getCategoryTitle($link, $id); - $unread = getFeedUnread($link, $id, true); - if ($unread > 0) { - $title = $title . " ($unread)"; - $class = ''; - } else { - $class = 'oldItem'; - } - - if ($cat_browse) - print "
  • $title
  • "; - else - print "
  • $title
  • "; - } - - $result = db_query($link, "SELECT - ttrss_feed_categories.id, - ttrss_feed_categories.title, - COUNT(ttrss_feeds.id) AS num_feeds - FROM ttrss_feed_categories, ttrss_feeds - WHERE ttrss_feed_categories.owner_uid = $owner_uid - AND ttrss_feed_categories.id = cat_id - GROUP BY ttrss_feed_categories.id, - ttrss_feed_categories.title - ORDER BY ttrss_feed_categories.title"); - - while ($line = db_fetch_assoc($result)) { - - if ($line["num_feeds"] > 0) { - - $unread = getFeedUnread($link, $line["id"], true); - $id = $line["id"]; - - if ($unread > 0) { - $line["title"] = $line["title"] . " ($unread)"; - $class = ''; - } else { - $class = 'oldItem'; - } - - if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) { - - if ($cat_browse) - print "
  • " . - $line["title"] . "
  • "; - else - print "
  • ". - $line["title"] . "
  • "; - } - } - } - - - $result = db_query($link, "SELECT COUNT(*) AS nf FROM ttrss_feeds WHERE - cat_id IS NULL and owner_uid = '$owner_uid'"); - - $num_feeds = db_fetch_result($result, 0, "nf"); - - if ($num_feeds > 0) { - $unread = getFeedUnread($link, 0, true); - $title = "Uncategorized"; - - if ($unread > 0) { - $title = "$title ($unread)"; - $class = ''; - } else { - $class = 'oldItem'; - } - - if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) { - if ($cat_browse) - print "
  • $title
  • "; - else - print "
  • $title
  • "; - - } - } - - print "
"; - } - - function render_headlines_list($link, $feed_id, $cat_id, $offset, $search, - $is_cat = false) { - - $feed_id = $feed_id; - $limit = 15; - $filter = ''; - - if (!mobile_get_pref($link, "HIDE_READ")) - $view_mode = "all_articles"; - else - $view_mode = 'adaptive'; - - if ($search) { - $search_mode = 'this_feed'; - } else { - $search_mode = ''; - } - - $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit, - $view_mode, $is_cat, $search, $search_mode, - "score DESC, date_entered ".(mobile_get_pref($link, 'REVERSE_HEADLINES') ? 'ASC' : 'DESC'), $offset); - - $result = $qfh_ret[0]; - $feed_title = $qfh_ret[1]; - - if (!$offset) { - - print "
- - - - -
-

Search

- Cancel - Search - - - -
-
"; - - if ($cat_id) { - $cat_title = getCategoryTitle($link, $cat_id); - - print "
    "; - } else { - print "
      "; - } - - print "
    • Search...
    • "; - } - - $num_headlines = 0; - - while ($line = db_fetch_assoc($result)) { - $id = $line["id"]; - $real_feed_id = $line["feed_id"]; - - if (sql_bool_to_bool($line["unread"])) { - $class = ''; - } else { - $class = 'oldItem'; - } - - if (mobile_feed_has_icon($real_feed_id)) { - $icon_url = "../".ICONS_URL."/$real_feed_id.ico"; - } else { - $icon_url = "../images/blank_icon.gif"; - } - - print "
    • - "; - print $line["title"]; - print "
    • "; - - ++$num_headlines; - - } - - if ($num_headlines == 0 && $search) { - $articles_url = "feed.php?id=$feed_id&cat=$cat_id&skip=$next_offset"; - - print "
    • " . __("Nothing found (click to reload feed).") . "
    • "; - - } - -// print "Next $limit articles..."; - - $next_offset = $offset + $num_headlines; - $num_unread = getFeedUnread($link, $feed_id, $is_cat); - - /* FIXME needs normal implementation */ - - if ($num_headlines > 0 && ($num_unread == 0 || $num_unread > $next_offset)) { - - if ($is_cat) { - $articles_url = "feed.php?id=$feed_id&skip=$next_offset". - "&search=$search&is_cat=true"; - } else { - $articles_url = "feed.php?id=$feed_id&cat=$cat_id&skip=$next_offset". - "&search=$search"; - } - - print "
    • Get more articles...
    • "; - } - - if (!$offset) print "
    "; - - } - - function render_article($link, $id, $feed_id, $cat_id, $is_cat) { - - $query = "SELECT title,link,content,feed_id,comments,int_id, - marked,unread,published, - ".SUBSTRING_FOR_DATE."(updated,1,16) as updated, - author - FROM ttrss_entries,ttrss_user_entries - WHERE id = '$id' AND ref_id = id AND owner_uid = " . - $_SESSION["uid"] ; - - $result = db_query($link, $query); - - if (db_num_rows($result) != 0) { - - $line = db_fetch_assoc($result); - - $tmp_result = db_query($link, "UPDATE ttrss_user_entries - SET unread = false,last_read = NOW() - WHERE ref_id = '$id' - AND owner_uid = " . $_SESSION["uid"]); - - $updated_fmt = make_local_datetime($link, $line['updated'], false); - - $title = $line["title"]; - $article_link = $line["link"]; - - if (!$is_cat) - $feed_title = getFeedTitle($link, $feed_id); - else - $feed_title = getCategoryTitle($link, $feed_id); - - print "
    "; - - if ($line['feed_id'] != $feed_id) { - $real_feed_title = getFeedTitle($link, $line['feed_id']); - $real_feed_id = $line['feed_id']; - $feed_link = "($real_feed_title)"; - } -// print "
    "; - - print "
    ($updated_fmt)
    "; - - print "

    $title $feed_link

    "; - - print "
    "; - -/* print "
    "; - print ""; - print "
    "; */ - - $is_starred = (sql_bool_to_bool($line["marked"])) ? "true" : "false"; - $is_published = (sql_bool_to_bool($line["published"])) ? "true" : "false"; - - //print "
    "; - //print ""; - //print ""; - //print "
    "; - -// print "
    "; - - $content = sanitize($link, $line["content"]); - $content = preg_replace("/href=/i", "target=\"_blank\" href=", $content); - - if (!mobile_get_pref($link, "SHOW_IMAGES")) { - $content = preg_replace('/]+>/is', '', $content); - } - - print "

    $content

    "; - - print ""; - - print "
    "; - - print "
    - -
    ONOFF
    -
    "; - - print "
    - -
    ONOFF
    -
    "; - - print "
    - -
    ONOFF
    -
    "; - - - print "
    "; - - print "
    "; - - } - } -?> diff --git a/mobile/mobile.css b/mobile/mobile.css deleted file mode 100644 index 8068e3d38..000000000 --- a/mobile/mobile.css +++ /dev/null @@ -1,38 +0,0 @@ -div.nav { - height: 40px; - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - background-color: #ffffff; - border: 1px solid #999999; - text-align: center; - margin-bottom: 1em; -} -div.nav label { - line-height: 40px; - color: black; - font-weight: bold; -} -div.nav .button { - position: static; - margin: 5px 10px; - -webkit-border-image: url(../lib/iui/whiteButton.png) 0 12 0 12; - text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; - color: black; - cursor: pointer; /* On a touch screen ? */ -} -div.nav .button.left { - float: left; -} -div.nav .button.right { - float: right; -} - -ul li a.read { - color: #666666; -} - -ul li span.browse { - color : #909090; - text-align : right; - float : right; -} diff --git a/mobile/mobile.js b/mobile/mobile.js deleted file mode 100644 index 3fed3a1d7..000000000 --- a/mobile/mobile.js +++ /dev/null @@ -1,163 +0,0 @@ -var backend = "backend.php"; - -function toggleMarked(id, elem) { - - var toggled = false; - - if (elem.getAttribute("toggled") == "true") { - toggled = 1; - } else { - toggled = 0; - } - - var query = "op=toggleMarked&id=" + id + "&mark=" + toggled; - - new Ajax.Request(backend, { - parameters: query, - onComplete: function (transport) { - // - } }); -} - -function togglePublished(id, elem) { - - var toggled = false; - - if (elem.getAttribute("toggled") == "true") { - toggled = 1; - } else { - toggled = 0; - } - - var query = "op=togglePublished&id=" + id + "&pub=" + toggled; - - new Ajax.Request(backend, { - parameters: query, - onComplete: function (transport) { - // - } }); - -} - -function toggleUnread(id, elem) { - - var toggled = false; - - if (elem.getAttribute("toggled") == "true") { - toggled = 1; - } else { - toggled = 0; - } - - var query = "op=toggleUnread&id=" + id + "&unread=" + toggled; - - new Ajax.Request(backend, { - parameters: query, - onComplete: function (transport) { - // - } }); - -} - -function setPref(elem) { - var toggled = false; - var id = elem.id; - - if (elem.getAttribute("toggled") == "true") { - toggled = 1; - } else { - toggled = 0; - } - - var query = "op=setPref&id=" + id + "&to=" + toggled; - - new Ajax.Request(backend, { - parameters: query, - onComplete: function (transport) { - // - } }); - -} - -// Go directly to another item in the same feed -function goToSibling(article_id, feed_id, link, step) { - var links = linksInFeed(feed_id); - for (var i=0 ; i= links.length) { - showRestOfFeed(feed_id); - return false; - } - console.log(links[index]); - var match = links[index].href.match(/.*article\.php\?(.*)/); - var qs = match[1]; - var backwards = false; - if (step < 0) backwards = true; - link.setAttribute("selected", "progress"); - function unselect() { link.removeAttribute("selected"); } - iui.showPageByHref("article.php?"+qs, null, null, null, unselect, backwards); - return false; - } - return false; -} -function goPrev(article_id, feed_id, link) { - return goToSibling(article_id, feed_id, link, -1); -} -function goNext(article_id, feed_id, link) { - return goToSibling(article_id, feed_id, link, 1); -} - -// Get all the links in the feed. The all_links variable includes the "get more article" link -function linksInFeed(feed_id, all_links) { - var feed_content = $("feed-"+feed_id); - var links_raw = feed_content.getElementsByTagName("a"); - if (all_links) return links_raw; - var links = []; - // filter the array to remove the "get more articles" link - // and the "search" link (which is always first) - for (var i=1 ; i - -
    - -
    - -
    - -
    ">
    -
    - -
    - -
    ">
    -
    - - -
    - -
    ">
    -
    - -
    - -
    ">
    -
    - -
    - -
    ">
    -
    - -
    - -
    ">
    -
    - -