summaryrefslogtreecommitdiff
path: root/mobile/classic/index.php
blob: db2215b24a5e0b5ad924ec0d39ef4f1baa860479 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
	error_reporting(E_ERROR | E_WARNING | E_PARSE);

	define('MOBILE_VERSION', true);

	require_once "../../config.php";
	require_once "functions.php";
	require_once "../../functions.php";

	require_once "../../sessions.php";

	require_once "../../version.php";
	require_once "../../db-prefs.php";

	$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);

	init_connection($link);

	login_sequence($link, 2);

	/* perform various redirect-needing subops */

	$subop = db_escape_string($_GET["subop"]);
	$go = $_GET["go"];

	if ($subop == "tc" && !$go) {

		$cat_id = db_escape_string($_GET["id"]);
		toggle_collapse_cat($link, $cat_id);

		header("Location: index.php");
		return;
	}

	$ts_id = db_escape_string($_GET["ts"]);

	if ($go == "vf" && $ts_id) {

		toggleMarked($link, $ts_id);

		$query_string = preg_replace("/&ts=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
		header("Location: index.php?$query_string");
		return;
	}

	$tp_id = db_escape_string($_GET["tp"]);

	if ($go == "vf" && $tp_id) {

		togglePublished($link, $tp_id);

		$query_string = preg_replace("/&tp=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
		header("Location: index.php?$query_string");
		return;
	}

	$sop = db_escape_string($_GET["sop"]);

	if ($sop) {
		if ($go == "view") {
			$a_id = db_escape_string($_GET["id"]);
		} elseif ($go == "vf") {
			$a_id = db_escape_string($_GET["aid"]);
		}

		if ($a_id) {

			if ($sop == "tp") {
				togglePublished($link, $a_id);
			}

			if ($sop == "ts") {
				toggleMarked($link, $a_id);
			}

			if ($sop == "mu") {
				markUnread($link, $a_id);
			}

			$query_string = str_replace("&sop=$sop", "", $_SERVER["QUERY_STRING"]);
			header("Location: index.php?$query_string");
		}
	}

?>
<html>
<head>
	<title>Tiny Tiny RSS</title>
	<link rel="stylesheet" type="text/css" href="mobile.css">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<script type="text/javascript" src="mobile.js"></script>
	<?php print_user_stylesheet($link) ?>
</head>
<body id="ttrssMobile">

<div id="content">
<?php
	if (!$go) {
		render_feeds_list($link);
	} else if ($go == "vf") {
		render_headlines($link);
	} else if ($go == "view") {
		render_article($link);
	} else if ($go == "sform") {
		render_search_form($link, $_GET["aid"], $_GET["ic"]);
	} else {
		print __("Internal error: Function not implemented");
	}

?>
</div>

</body>
</html>