display.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?
  2. require 'config.php';
  3. function printShow($show) {
  4. global $TV_PATH;
  5. global $EXISTS_FILES;
  6. global $CONTENT_FILES;
  7. # Construct our show path and make sure it's reasonable
  8. $path = $TV_PATH . '/' . $show;
  9. $show_html = htmlspecialchars($show);
  10. if (!is_dir($path)) {
  11. die('Unknown show: ' . $show_html);
  12. }
  13. # Check the flags
  14. $flags = readFlags($path);
  15. # Check the seasons
  16. $seasons = findSeasons($path);
  17. # Header
  18. echo '<h1>' . $show_html . '</h1>';
  19. echo '<form action="' . $_SERVER['PHP_SELF'] . '?show=' . urlencode($show) . '" method="post">';
  20. echo '<input type="hidden" name="show" value="' . $show_html . '"/>';
  21. # Exists and content flags
  22. echo '<h2>Series Parameters</h2>';
  23. echo '<p>';
  24. foreach ($EXISTS_FILES as $file) {
  25. $file_html = htmlspecialchars($file);
  26. echo '<label><input value="1" type="checkbox" name="' . $file_html . '" ';
  27. if ($flags[ $file ]) {
  28. echo 'checked="checked"';
  29. }
  30. echo '/> ' . $file_html . '</label><br/>';
  31. }
  32. foreach ($CONTENT_FILES as $file) {
  33. $file_html = htmlspecialchars($file);
  34. echo '<label><input type="text" size="40" name="' . $file_html . '" ';
  35. if ($flags[ $file ]) {
  36. echo 'value="' . htmlspecialchars($flags[ $file ]) . '"';
  37. }
  38. echo '/> ' . $file_html . '</label><br/>';
  39. }
  40. echo '</p>';
  41. # TVDB URL
  42. echo '<h2>The TVDB URL</h2>';
  43. echo '<p><a href="' . htmlspecialchars($flags['url']) . '">' . htmlspecialchars($flags['url']) . '</a></p>';
  44. # Seasons
  45. echo '<h2>Season Parameters</h2>';
  46. echo '<p>';
  47. foreach ($seasons as $season => $monitored) {
  48. $season_html = htmlspecialchars($season);
  49. echo '<label>Season ' . $season_html . ' ';
  50. echo '<input type="checkbox" value="1" name="season_' . $season_html . '" ';
  51. if ($monitored !== false) {
  52. echo 'checked="checked"';
  53. }
  54. echo '/></label>';
  55. echo '<input type="text" size="150" name="url_' . $season_html . '" value="';
  56. if ($monitored !== false && $monitored !== true) {
  57. echo htmlspecialchars($monitored);
  58. }
  59. echo '"/><br/>';
  60. }
  61. echo '</p>';
  62. # Footer
  63. echo '<p><input type="submit" name="Save" value="Save"/></p>';
  64. echo '</form>';
  65. }
  66. # Print a DL of all shows and note the available and monitored seasons
  67. function printAllShows() {
  68. global $TV_PATH;
  69. global $MEDIA_PATH;
  70. $shows = allShows($TV_PATH);
  71. echo "<dl>\n";
  72. foreach ($shows as $show => $seasons) {
  73. echo '<dt><a href="?show=' . urlencode($show) . '">' . htmlspecialchars($show) . "</a></dt>\n";
  74. foreach ($seasons as $season => $monitored) {
  75. echo '<dd>Season ' . htmlspecialchars($season);
  76. if ($monitored) {
  77. echo ' (monitored)';
  78. }
  79. echo "</dd>\n";
  80. }
  81. }
  82. echo "</dl>\n";
  83. }
  84. ?>