display.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. if ($file == 'skip' || !$flags['skip']) {
  26. $file_html = htmlspecialchars($file);
  27. echo '<label><input value="1" type="checkbox" name="' . $file_html . '" ';
  28. if ($flags[ $file ]) {
  29. echo 'checked="checked"';
  30. }
  31. echo '/> ' . $file_html . '</label><br/>';
  32. }
  33. }
  34. if (!$flags['skip']) {
  35. foreach ($CONTENT_FILES as $file) {
  36. $file_html = htmlspecialchars($file);
  37. echo '<label><input type="text" size="40" name="' . $file_html . '" ';
  38. if ($flags[ $file ]) {
  39. echo 'value="' . htmlspecialchars($flags[ $file ]) . '"';
  40. }
  41. echo '/> ' . $file_html . '</label><br/>';
  42. }
  43. echo '</p>';
  44. }
  45. # TVDB URL
  46. echo '<h2>The TVDB URL</h2>';
  47. echo '<p><a href="' . htmlspecialchars($flags['url']) . '">' . htmlspecialchars($flags['url']) . '</a></p>';
  48. # Seasons
  49. if (!$flags['skip']) {
  50. echo '<h2>Season Parameters</h2>';
  51. echo '<p>';
  52. foreach ($seasons as $season => $monitored) {
  53. $season_html = htmlspecialchars($season);
  54. echo '<label>Season ' . $season_html . ' ';
  55. echo '<input type="checkbox" value="1" name="season_' . $season_html . '" ';
  56. if ($monitored !== false) {
  57. echo 'checked="checked"';
  58. }
  59. echo '/></label>';
  60. echo '<input type="text" size="150" name="url_' . $season_html . '" value="';
  61. if ($monitored !== false && $monitored !== true) {
  62. echo htmlspecialchars($monitored);
  63. }
  64. echo '"/><br/>';
  65. }
  66. echo '</p>';
  67. }
  68. # Footer
  69. echo '<p><input type="submit" name="Save" value="Save"/></p>';
  70. echo '</form>';
  71. }
  72. # Print a DL of all shows and note the available and monitored seasons
  73. function printAllShows() {
  74. global $TV_PATH;
  75. global $MEDIA_PATH;
  76. $shows = allShows($TV_PATH);
  77. echo "<dl>\n";
  78. foreach ($shows as $show => $seasons) {
  79. echo '<dt><a href="?show=' . urlencode($show) . '">' . htmlspecialchars($show) . "</a></dt>\n";
  80. foreach ($seasons as $season => $monitored) {
  81. echo '<dd>Season ' . htmlspecialchars($season);
  82. if ($monitored) {
  83. echo ' (monitored)';
  84. }
  85. echo "</dd>\n";
  86. }
  87. }
  88. echo "</dl>\n";
  89. }
  90. ?>