index.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. error_reporting(E_ERROR | E_WARNING | E_PARSE);
  3. define('MOBILE_VERSION', true);
  4. require_once "../../config.php";
  5. require_once "functions.php";
  6. require_once "../../functions.php";
  7. require_once "../../sessions.php";
  8. require_once "../../version.php";
  9. require_once "../../db-prefs.php";
  10. $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
  11. init_connection($link);
  12. login_sequence($link, 2);
  13. /* perform various redirect-needing subops */
  14. $subop = db_escape_string($_GET["subop"]);
  15. $go = $_GET["go"];
  16. if ($subop == "tc" && !$go) {
  17. $cat_id = db_escape_string($_GET["id"]);
  18. toggle_collapse_cat($link, $cat_id);
  19. header("Location: index.php");
  20. return;
  21. }
  22. $ts_id = db_escape_string($_GET["ts"]);
  23. if ($go == "vf" && $ts_id) {
  24. toggleMarked($link, $ts_id);
  25. $query_string = preg_replace("/&ts=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
  26. header("Location: index.php?$query_string");
  27. return;
  28. }
  29. $tp_id = db_escape_string($_GET["tp"]);
  30. if ($go == "vf" && $tp_id) {
  31. togglePublished($link, $tp_id);
  32. $query_string = preg_replace("/&tp=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
  33. header("Location: index.php?$query_string");
  34. return;
  35. }
  36. $sop = db_escape_string($_GET["sop"]);
  37. if ($sop) {
  38. if ($go == "view") {
  39. $a_id = db_escape_string($_GET["id"]);
  40. } elseif ($go == "vf") {
  41. $a_id = db_escape_string($_GET["aid"]);
  42. }
  43. if ($a_id) {
  44. if ($sop == "tp") {
  45. togglePublished($link, $a_id);
  46. }
  47. if ($sop == "ts") {
  48. toggleMarked($link, $a_id);
  49. }
  50. if ($sop == "mu") {
  51. markUnread($link, $a_id);
  52. }
  53. $query_string = str_replace("&sop=$sop", "", $_SERVER["QUERY_STRING"]);
  54. header("Location: index.php?$query_string");
  55. }
  56. }
  57. ?>
  58. <html>
  59. <head>
  60. <title>Tiny Tiny RSS</title>
  61. <link rel="stylesheet" type="text/css" href="mobile.css">
  62. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  63. <script type="text/javascript" src="mobile.js"></script>
  64. <?php print_user_stylesheet($link) ?>
  65. </head>
  66. <body id="ttrssMobile">
  67. <div id="content">
  68. <?php
  69. if (!$go) {
  70. render_feeds_list($link);
  71. } else if ($go == "vf") {
  72. render_headlines($link);
  73. } else if ($go == "view") {
  74. render_article($link);
  75. } else if ($go == "sform") {
  76. render_search_form($link, $_GET["aid"], $_GET["ic"]);
  77. } else {
  78. print __("Internal error: Function not implemented");
  79. }
  80. ?>
  81. </div>
  82. </body>
  83. </html>