]> git.wh0rd.org - tt-rss.git/blame - mobile/tt-rss.php
mobile: allow marking articles as unread (clses #240)
[tt-rss.git] / mobile / tt-rss.php
CommitLineData
e9e95dae 1<?php
793185a9
AD
2 error_reporting(E_ERROR | E_WARNING | E_PARSE);
3
7c33dbd4
AD
4 define('MOBILE_VERSION', true);
5
3dd46f19 6 require_once "../config.php";
ca35939d 7 require_once "functions.php";
3dd46f19 8 require_once "../functions.php";
9338b88c 9
9338b88c
AD
10 require_once "../sessions.php";
11
12 require_once "../version.php";
9338b88c
AD
13 require_once "../db-prefs.php";
14
e0142e27 15 $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
ca35939d 16
f29ba148 17 init_connection($link);
da3427a0 18
793185a9 19 login_sequence($link, true);
ca35939d 20
42096f52
AD
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"]);
b750d485
AD
34 } else {
35 if ($_COOKIE["ttrss_vf_uclps"] != 1) {
36 setcookie("ttrss_vf_uclps", 1);
37 } else {
38 setcookie("ttrss_vf_uclps", 0);
39 }
42096f52 40 }
b750d485
AD
41
42 header("Location: tt-rss.php");
43 return;
42096f52
AD
44 }
45
24ac6776
AD
46 $ts_id = db_escape_string($_GET["ts"]);
47
48 if ($go == "vf" && $ts_id) {
f70f7e28
AD
49
50 toggleMarked($link, $ts_id);
51
24ac6776
AD
52 $query_string = preg_replace("/&ts=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
53 header("Location: tt-rss.php?$query_string");
54 return;
55 }
510ac75f
AD
56
57 $tp_id = db_escape_string($_GET["tp"]);
58
59 if ($go == "vf" && $tp_id) {
f70f7e28
AD
60
61 togglePublished($link, $tp_id);
62
510ac75f
AD
63 $query_string = preg_replace("/&tp=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
64 header("Location: tt-rss.php?$query_string");
65 return;
66 }
67
f70f7e28
AD
68 $sop = db_escape_string($_GET["sop"]);
69
4a596be6
AD
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 }
f70f7e28
AD
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
4a596be6
AD
87 if ($sop == "mu") {
88 markUnread($link, $a_id);
89 }
90
91 $query_string = str_replace("&sop=$sop", "", $_SERVER["QUERY_STRING"]);
f70f7e28
AD
92 header("Location: tt-rss.php?$query_string");
93 }
94 }
95
9338b88c
AD
96?>
97<html>
98<head>
99 <title>Tiny Tiny RSS - Mobile</title>
100 <link rel="stylesheet" type="text/css" href="mobile.css">
2f468537 101 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
fc46ab83 102 <script type="text/javascript" src="tt-rss.js"></script>
27f5a18f
AD
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 } ?>
9338b88c 108</head>
27f5a18f 109<body id="ttrssMobile">
9338b88c 110
8e3f7217 111<div id="content">
e9e95dae 112<?php
42096f52 113 if (!$go) {
ca35939d 114 render_feeds_list($link);
2f468537
AD
115 } else if ($go == "vf") {
116 render_headlines($link);
42096f52
AD
117 } else if ($go == "view") {
118 render_article($link);
0809065e
AD
119 } else if ($go == "sform") {
120 render_search_form($link, $_GET["aid"], $_GET["ic"]);
8e3f7217 121 } else {
793185a9 122 print __("Internal error: Function not implemented");
ca35939d
AD
123 }
124
125?>
8e3f7217
AD
126</div>
127
9123c2ef
AD
128<?php if (!$go) { ?>
129
8e3f7217 130<div id="footer">
e0142e27 131 <a href="http://tt-rss.org/">Tiny-Tiny RSS</a>
8865bdc0
AD
132 <?php if (!defined('HIDE_VERSION')) { ?>
133 v<?php echo VERSION ?>
134 <?php } ?>
c4f56bed 135 &copy; 2005-2009 Andrew Dolgov
8e3f7217 136</div>
ca35939d 137
9123c2ef
AD
138<?php } ?>
139
9338b88c
AD
140</body>
141</html>