]> git.wh0rd.org Git - tt-rss.git/blob - mobile/classic/index.php
obsolete cookie storage for collapsed status of feedlist and special categories ...
[tt-rss.git] / mobile / classic / index.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, 2);
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                         $pref_name = '';
36
37                         switch ($cat_id) {
38                         case -1:
39                                 $pref_name = '_COLLAPSED_SPECIAL';
40                                 break;
41                         case -2:
42                                 $pref_name = '_COLLAPSED_LABELS';
43                                 break;
44                         case 0:
45                                 $pref_name = '_COLLAPSED_UNCAT';
46                                 break;
47                         }
48
49                         if ($pref_name) {
50                                 if (get_pref($link, $pref_name)) {
51                                         set_pref($link, $pref_name, 'false');
52                                 } else {
53                                         set_pref($link, $pref_name, 'true');
54                                 }
55                         }
56                 }
57
58                 header("Location: index.php");
59                 return;
60         }
61
62         $ts_id = db_escape_string($_GET["ts"]);
63
64         if ($go == "vf" && $ts_id) {
65
66                 toggleMarked($link, $ts_id);
67
68                 $query_string = preg_replace("/&ts=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
69                 header("Location: index.php?$query_string");
70                 return;
71         }
72
73         $tp_id = db_escape_string($_GET["tp"]);
74
75         if ($go == "vf" && $tp_id) {
76
77                 togglePublished($link, $tp_id);
78
79                 $query_string = preg_replace("/&tp=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
80                 header("Location: index.php?$query_string");
81                 return;
82         }
83
84         $sop = db_escape_string($_GET["sop"]);
85
86         if ($sop) {
87                 if ($go == "view") {
88                         $a_id = db_escape_string($_GET["id"]);
89                 } elseif ($go == "vf") {
90                         $a_id = db_escape_string($_GET["aid"]);
91                 }
92
93                 if ($a_id) {
94
95                         if ($sop == "tp") {
96                                 togglePublished($link, $a_id);
97                         }
98
99                         if ($sop == "ts") {
100                                 toggleMarked($link, $a_id);
101                         }
102
103                         if ($sop == "mu") {
104                                 markUnread($link, $a_id);
105                         }
106
107                         $query_string = str_replace("&sop=$sop", "", $_SERVER["QUERY_STRING"]);
108                         header("Location: index.php?$query_string");
109                 }
110         }
111
112 ?>
113 <html>
114 <head>
115         <title>Tiny Tiny RSS</title>
116         <link rel="stylesheet" type="text/css" href="mobile.css">
117         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
118         <script type="text/javascript" src="mobile.js"></script>
119
120         <?php $user_css_url = get_pref($link, 'USER_STYLESHEET_URL'); ?>
121         <?php if ($user_css_url) { ?>
122                 <link rel="stylesheet" type="text/css" href="<?php echo $user_css_url ?>"/> 
123         <?php } ?>
124 </head>
125 <body id="ttrssMobile">
126
127 <div id="content">
128 <?php
129         if (!$go) {
130                 render_feeds_list($link);
131         } else if ($go == "vf") {
132                 render_headlines($link);        
133         } else if ($go == "view") {
134                 render_article($link);
135         } else if ($go == "sform") {
136                 render_search_form($link, $_GET["aid"], $_GET["ic"]);
137         } else {
138                 print __("Internal error: Function not implemented");
139         }
140
141 ?>
142 </div>
143
144 <?php if (!$go) { ?>
145
146 <!-- <div id="footer">
147         <a href="http://tt-rss.org/">Tiny-Tiny RSS</a>
148         &copy; 2005-2009 Andrew Dolgov
149 </div> -->
150
151 <?php } ?>
152
153 </body>
154 </html>