]> git.wh0rd.org - tt-rss.git/blob - mobile/tt-rss.php
db7129042b858615431771cdce0c6ec7d065f889
[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 && $go == "view") {
71 $a_id = db_escape_string($_GET["id"]);
72
73 if ($a_id) {
74
75 if ($sop == "tp") {
76 togglePublished($link, $a_id);
77 }
78
79 if ($sop == "ts") {
80 toggleMarked($link, $a_id);
81 }
82
83 $query_string = preg_replace("/&sop=t[sp]/", "", $_SERVER["QUERY_STRING"]);
84 header("Location: tt-rss.php?$query_string");
85 }
86 }
87
88 ?>
89 <html>
90 <head>
91 <title>Tiny Tiny RSS - Mobile</title>
92 <link rel="stylesheet" type="text/css" href="mobile.css">
93 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
94 <script type="text/javascript" src="tt-rss.js"></script>
95
96 <?php $user_css_url = get_pref($link, 'USER_STYLESHEET_URL'); ?>
97 <?php if ($user_css_url) { ?>
98 <link rel="stylesheet" type="text/css" href="<?php echo $user_css_url ?>"/>
99 <?php } ?>
100 </head>
101 <body id="ttrssMobile">
102
103 <div id="content">
104 <?php
105 if (!$go) {
106 render_feeds_list($link);
107 } else if ($go == "vf") {
108 render_headlines($link);
109 } else if ($go == "view") {
110 render_article($link);
111 } else if ($go == "sform") {
112 render_search_form($link, $_GET["aid"], $_GET["ic"]);
113 } else {
114 print __("Internal error: Function not implemented");
115 }
116
117 ?>
118 </div>
119
120 <?php if (!$go) { ?>
121
122 <div id="footer">
123 <a href="http://tt-rss.org/">Tiny-Tiny RSS</a>
124 <?php if (!defined('HIDE_VERSION')) { ?>
125 v<?php echo VERSION ?>
126 <?php } ?>
127 &copy; 2005-2009 Andrew Dolgov
128 </div>
129
130 <?php } ?>
131
132 </body>
133 </html>