display.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?
  2. require 'config.php';
  3. function printSeries($series) {
  4. global $EXISTS_FILES;
  5. global $CONTENT_FILES;
  6. # Ensure our series name is reasonable
  7. $series_html = htmlspecialchars($series);
  8. if (!seriesExists($series)) {
  9. die('Unknown series: ' . $series_html);
  10. }
  11. # Grab the flag and season data
  12. $flags = readFlags($series);
  13. $seasons = findSeasons($series);
  14. # Header
  15. echo '<h1>' . $series_html . '</h1>';
  16. echo '<form action="' . $_SERVER['PHP_SELF'] . '?series=' . urlencode($series) . '" method="post">';
  17. echo '<input type="hidden" name="series" value="' . $series_html . '"/>';
  18. # Series flags
  19. echo '<h2>Series Parameters</h2>';
  20. echo '<p>';
  21. foreach ($EXISTS_FILES as $file) {
  22. if ($file == 'skip' || !$flags['skip']) {
  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. }
  31. if (!$flags['skip']) {
  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. }
  42. # Seasons
  43. if (!$flags['skip']) {
  44. echo '<h2>Season Parameters</h2>';
  45. # Existing seasons
  46. echo '<dl>';
  47. foreach ($seasons as $season => $monitored) {
  48. $season_html = htmlspecialchars($season);
  49. $episodes = findEpisodes($series, $season);
  50. echo '<dt>Season ' . $season_html . '</dt>';
  51. echo '<dd><label>Monitored: <input type="checkbox" value="1" name="season_' . $season_html . '" ';
  52. if ($monitored !== false) {
  53. echo 'checked="checked"';
  54. }
  55. echo '/></label><br/>';
  56. echo '<label>Search URL: <input type="text" size="150" name="url_' . $season_html . '" value="';
  57. if ($monitored !== false && $monitored !== true) {
  58. echo htmlspecialchars($monitored);
  59. }
  60. echo '"/></label><br/>';
  61. echo '<input type="submit" name="season_del_' . $season_html . '" value="Delete"><br/>';
  62. echo 'Episode count: ' . count($episodes) . '<br/>';
  63. echo 'Highest episode number: ' . @max(array_keys($episodes)) . '<br/>';
  64. echo '</dd>';
  65. }
  66. echo '</dl>';
  67. # Add a season
  68. $next_season = @max(array_keys($seasons)) + 1;
  69. echo '<p>Add season: ';
  70. echo '<input type="text" size="2" name="season_add" value="' . htmlspecialchars($next_season) . '"/>';
  71. echo '<input type="submit" name="AddSeason" value="Add Season">';
  72. echo '</p>';
  73. }
  74. # Save button
  75. echo '<p><input type="submit" name="Save" value="Save"/></p>';
  76. # Footer
  77. echo '</form>';
  78. # TheTVDB Frame
  79. $url_html = htmlspecialchars(TVDBURL($flags['tvdb-id'], $flags['tvdb-lid']));
  80. echo '<h2>The TVDB</h2>';
  81. echo '<p><a target="_blank" href="' . $url_html . '">' . $url_html . '</a></p>';
  82. echo '<iframe height="5000" style="width: 90%; display: block; margin: 0 auto;" src="' . $url_html . '">';
  83. echo '</iframe>';
  84. }
  85. # Print a DL of all series and note the available and monitored seasons
  86. function printAllSeries() {
  87. global $TV_PATH;
  88. $all_series = allSeries($TV_PATH);
  89. # Display all series
  90. echo '<dl>';
  91. foreach ($all_series as $series => $seasons) {
  92. echo '<dt><a href="?series=' . urlencode($series) . '">' . htmlspecialchars($series) . '</a></dt>';
  93. foreach ($seasons as $season => $monitored) {
  94. echo '<dd>Season ' . htmlspecialchars($season);
  95. if ($monitored) {
  96. echo ' (monitored)';
  97. }
  98. echo '</dd>';
  99. }
  100. }
  101. echo '</dl>';
  102. # Add a series
  103. echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
  104. echo '<p>';
  105. echo '<label>TheTVDB ID or URL: <input type="text" name="series_add"/></label>';
  106. echo '<input type="submit" name="AddSeries" value="Add Series"/>';
  107. echo '</p>';
  108. echo '</form>';
  109. }
  110. ?>