]> git.wh0rd.org Git - tt-rss.git/blob - mobile/tt-rss.php
mobile: add support for publishing articles
[tt-rss.git] / mobile / tt-rss.php
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         if (DB_TYPE == "pgsql") {
17                 pg_query("set client_encoding = 'UTF-8'");
18                 pg_set_client_encoding("UNICODE");
19         } else {
20                 if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) {
21                         db_query($link, "SET NAMES " . MYSQL_CHARSET);
22 //                      db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET);
23                 }
24         }
25
26         login_sequence($link, true);
27
28         /* perform various redirect-needing subops */
29
30         $subop = db_escape_string($_GET["subop"]);
31         $go = $_GET["go"];
32
33         if ($subop == "tc" && !$go) {
34                 
35                 $cat_id = db_escape_string($_GET["id"]);
36                         
37                 if ($cat_id != 0) {                     
38                         db_query($link, "UPDATE ttrss_feed_categories SET
39                                 collapsed = NOT collapsed WHERE id = '$cat_id' AND owner_uid = " . 
40                                 $_SESSION["uid"]);
41                 } else {
42                         if ($_COOKIE["ttrss_vf_uclps"] != 1) {
43                                 setcookie("ttrss_vf_uclps", 1);
44                         } else {
45                                 setcookie("ttrss_vf_uclps", 0);
46                         }
47                 }
48                 
49                 header("Location: tt-rss.php");
50                 return;
51         }
52
53         $ts_id = db_escape_string($_GET["ts"]);
54
55         if ($go == "vf" && $ts_id) {
56                 $result = db_query($link, "UPDATE ttrss_user_entries SET marked = NOT marked
57                         WHERE ref_id = '$ts_id' AND owner_uid = " . $_SESSION["uid"]);
58                 $query_string = preg_replace("/&ts=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
59                 header("Location: tt-rss.php?$query_string");
60                 return;
61         }
62
63         $tp_id = db_escape_string($_GET["tp"]);
64
65         if ($go == "vf" && $tp_id) {
66                 $result = db_query($link, "UPDATE ttrss_user_entries SET published = NOT published
67                         WHERE ref_id = '$tp_id' AND owner_uid = " . $_SESSION["uid"]);
68                 $query_string = preg_replace("/&tp=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
69                 header("Location: tt-rss.php?$query_string");
70                 return;
71         }
72
73 ?>
74 <html>
75 <head>
76         <title>Tiny Tiny RSS - Mobile</title>
77         <link rel="stylesheet" type="text/css" href="mobile.css">
78         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
79 </head>
80 <body>
81
82 <div id="content">
83 <?php
84         if (!$go) {
85                 render_feeds_list($link);
86         } else if ($go == "vf") {
87                 render_headlines($link);        
88         } else if ($go == "view") {
89                 render_article($link);
90         } else if ($go == "sform") {
91                 render_search_form($link, $_GET["aid"], $_GET["ic"]);
92         } else {
93                 print __("Internal error: Function not implemented");
94         }
95
96 ?>
97 </div>
98
99 <div id="footer">
100         <a href="http://tt-rss.spb.ru/">Tiny-Tiny RSS</a> v<?php echo VERSION ?> &copy; 2005-2007 Andrew Dolgov
101 </div>
102
103 </body>
104 </html>