root/mobile/tt-rss.php

Revision 2678, 2.8 kB (checked in by www-ttrss, 2 weeks ago)

[project @ code cleanup, test for db_escape() crazyness in DB sanity check]

Line 
1 <?php
2     error_reporting(E_ERROR | E_WARNING | E_PARSE);
3
4     require_once "../config.php";
5     require_once "functions.php";
6     require_once "../functions.php";
7
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);   
15
16     init_connection($link);
17
18     login_sequence($link, true);
19
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"]);
33         } else {
34             if ($_COOKIE["ttrss_vf_uclps"] != 1) {
35                 setcookie("ttrss_vf_uclps", 1);
36             } else {
37                 setcookie("ttrss_vf_uclps", 0);
38             }
39         }
40         
41         header("Location: tt-rss.php");
42         return;
43     }
44
45     $ts_id = db_escape_string($_GET["ts"]);
46
47     if ($go == "vf" && $ts_id) {
48
49         toggleMarked($link, $ts_id);
50
51         $query_string = preg_replace("/&ts=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
52         header("Location: tt-rss.php?$query_string");
53         return;
54     }
55
56     $tp_id = db_escape_string($_GET["tp"]);
57
58     if ($go == "vf" && $tp_id) {
59
60         togglePublished($link, $tp_id);
61
62         $query_string = preg_replace("/&tp=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
63         header("Location: tt-rss.php?$query_string");
64         return;
65     }
66
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
87 ?>
88 <html>
89 <head>
90     <title>Tiny Tiny RSS - Mobile</title>
91     <link rel="stylesheet" type="text/css" href="mobile.css">
92     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
93     <script type="text/javascript" src="tt-rss.js"></script>
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 } ?>
99 </head>
100 <body id="ttrssMobile">
101
102 <div id="content">
103 <?php
104     if (!$go) {
105         render_feeds_list($link);
106     } else if ($go == "vf") {
107         render_headlines($link);   
108     } else if ($go == "view") {
109         render_article($link);
110     } else if ($go == "sform") {
111         render_search_form($link, $_GET["aid"], $_GET["ic"]);
112     } else {
113         print __("Internal error: Function not implemented");
114     }
115
116 ?>
117 </div>
118
119 <?php if (!$go) { ?>
120
121 <div id="footer">
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
127 </div>
128
129 <?php } ?>
130
131 </body>
132 </html>
133
Note: See TracBrowser for help on using the browser.