]> git.wh0rd.org - tt-rss.git/blob - mobile/tt-rss.php
mobile: allow marking articles as unread (clses #240)
[tt-rss.git] / mobile / tt-rss.php
1 <?php
2 error_reporting(E_ERROR | E_WARNING | E_PARSE);
3
4 define('MOBILE_VERSION', true);
5
6 require_once "../config.php";
7 require_once "functions.php";
8 require_once "../functions.php";
9
10 require_once "../sessions.php";
11
12 require_once "../version.php";
13 require_once "../db-prefs.php";
14
15 $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
16
17 init_connection($link);
18
19 login_sequence($link, true);
20
21 /* perform various redirect-needing subops */
22
23 $subop = db_escape_string($_GET["subop"]);
24 $go = $_GET["go"];
25
26 if ($subop == "tc" && !$go) {
27
28 $cat_id = db_escape_string($_GET["id"]);
29
30 if ($cat_id != 0) {
31 db_query($link, "UPDATE ttrss_feed_categories SET
32 collapsed = NOT collapsed WHERE id = '$cat_id' AND owner_uid = " .
33 $_SESSION["uid"]);
34 } else {
35 if ($_COOKIE["ttrss_vf_uclps"] != 1) {
36 setcookie("ttrss_vf_uclps", 1);
37 } else {
38 setcookie("ttrss_vf_uclps", 0);
39 }
40 }
41
42 header("Location: tt-rss.php");
43 return;
44 }
45
46 $ts_id = db_escape_string($_GET["ts"]);
47
48 if ($go == "vf" && $ts_id) {
49
50 toggleMarked($link, $ts_id);
51
52 $query_string = preg_replace("/&ts=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
53 header("Location: tt-rss.php?$query_string");
54 return;
55 }
56
57 $tp_id = db_escape_string($_GET["tp"]);
58
59 if ($go == "vf" && $tp_id) {
60
61 togglePublished($link, $tp_id);
62
63 $query_string = preg_replace("/&tp=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
64 header("Location: tt-rss.php?$query_string");
65 return;
66 }
67
68 $sop = db_escape_string($_GET["sop"]);
69
70 if ($sop) {
71 if ($go == "view") {
72 $a_id = db_escape_string($_GET["id"]);
73 } elseif ($go == "vf") {
74 $a_id = db_escape_string($_GET["aid"]);
75 }
76
77 if ($a_id) {
78
79 if ($sop == "tp") {
80 togglePublished($link, $a_id);
81 }
82
83 if ($sop == "ts") {
84 toggleMarked($link, $a_id);
85 }
86
87 if ($sop == "mu") {
88 markUnread($link, $a_id);
89 }
90
91 $query_string = str_replace("&sop=$sop", "", $_SERVER["QUERY_STRING"]);
92 header("Location: tt-rss.php?$query_string");
93 }
94 }
95
96 ?>
97 <html>
98 <head>
99 <title>Tiny Tiny RSS - Mobile</title>
100 <link rel="stylesheet" type="text/css" href="mobile.css">
101 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
102 <script type="text/javascript" src="tt-rss.js"></script>
103
104 <?php $user_css_url = get_pref($link, 'USER_STYLESHEET_URL'); ?>
105 <?php if ($user_css_url) { ?>
106 <link rel="stylesheet" type="text/css" href="<?php echo $user_css_url ?>"/>
107 <?php } ?>
108 </head>
109 <body id="ttrssMobile">
110
111 <div id="content">
112 <?php
113 if (!$go) {
114 render_feeds_list($link);
115 } else if ($go == "vf") {
116 render_headlines($link);
117 } else if ($go == "view") {
118 render_article($link);
119 } else if ($go == "sform") {
120 render_search_form($link, $_GET["aid"], $_GET["ic"]);
121 } else {
122 print __("Internal error: Function not implemented");
123 }
124
125 ?>
126 </div>
127
128 <?php if (!$go) { ?>
129
130 <div id="footer">
131 <a href="http://tt-rss.org/">Tiny-Tiny RSS</a>
132 <?php if (!defined('HIDE_VERSION')) { ?>
133 v<?php echo VERSION ?>
134 <?php } ?>
135 &copy; 2005-2009 Andrew Dolgov
136 </div>
137
138 <?php } ?>
139
140 </body>
141 </html>