index.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?
  2. # Include the TV functions
  3. require_once 'includes/main.php';
  4. # Send our headers early
  5. header('Content-type: text/html; charset=utf-8');
  6. # Did the user request a specific show?
  7. $show = false;
  8. if (isset($_REQUEST['show'])) {
  9. # This is not a great filter, but it should make the string safe for use as a quoted path
  10. $show = preg_replace('/[\0\n\r]/', '', $_REQUEST['show']);
  11. $show = basename($show);
  12. }
  13. # Did the user request an update?
  14. if ($show !== false && isset($_POST['Save'])) {
  15. echo '<h4 style="color: red;">Saving not yet implemented</h4>';
  16. # Grab the current settings for comparison
  17. global $TV_PATH;
  18. $series_path = $TV_PATH . '/'. $show;
  19. $series_last = readFlags($series_path);
  20. $seasons_last = findSeasons($series_path);
  21. saveFlags($series_path, $_POST, $series_last, $seasons_last);
  22. saveSeasons($series_path, $_POST, $series_last, $seasons_last);
  23. }
  24. #=========================================================================================
  25. # Generic XHTML 1.1 header
  26. print <<<ENDOLA
  27. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  28. "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  29. <html xmlns="http://www.w3.org/1999/xhtml">
  30. <head>
  31. <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
  32. <title>UberZach TV</title>
  33. </head>
  34. <body>
  35. ENDOLA;
  36. if ($show === false) {
  37. printAllShows();
  38. } else {
  39. printShow($show);
  40. }
  41. # Generic XHTML 1.1 footer
  42. print <<<ENDOLA
  43. </body>
  44. </html>
  45. ENDOLA;
  46. ?>