display.php 2.4 KB

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