index.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. # Save series and season data
  22. saveFlags($series_path, $_POST, $series_last, $seasons_last);
  23. saveSeasons($series_path, $_POST, $series_last, $seasons_last);
  24. }
  25. #=========================================================================================
  26. # Generic XHTML 1.1 header
  27. print <<<ENDOLA
  28. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  29. "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  30. <html xmlns="http://www.w3.org/1999/xhtml">
  31. <head>
  32. <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
  33. <title>UberZach TV</title>
  34. </head>
  35. <body>
  36. ENDOLA;
  37. if ($show === false) {
  38. printAllShows();
  39. } else {
  40. printShow($show);
  41. }
  42. # Generic XHTML 1.1 footer
  43. print <<<ENDOLA
  44. </body>
  45. </html>
  46. ENDOLA;
  47. ?>