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