display.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. # TVDB URL
  19. $url_html = htmlspecialchars(TVDBURL($flags['tvdb-id'], $flags['tvdb-lid']));
  20. echo '<h2>TVDB</h2>';
  21. echo '<p><a target="_blank" href="' . $url_html . '">' . $url_html . '</a></p>';
  22. # Series flags
  23. echo '<h2>Series Parameters</h2>';
  24. echo '<p>';
  25. foreach ($EXISTS_FILES as $file) {
  26. if ($file == 'skip' || !$flags['skip']) {
  27. $file_html = htmlspecialchars($file);
  28. echo '<label><input value="1" type="checkbox" name="' . $file_html . '" ';
  29. if ($flags[ $file ]) {
  30. echo 'checked="checked"';
  31. }
  32. echo '/> ' . $file_html . '</label><br/>';
  33. }
  34. }
  35. if (!$flags['skip']) {
  36. foreach ($CONTENT_FILES as $file) {
  37. $file_html = htmlspecialchars($file);
  38. echo '<label><input type="text" size="40" name="' . $file_html . '" ';
  39. if ($flags[ $file ]) {
  40. echo 'value="' . htmlspecialchars($flags[ $file ]) . '"';
  41. }
  42. echo '/> ' . $file_html . '</label><br/>';
  43. }
  44. echo '</p>';
  45. }
  46. # Seasons
  47. if (!$flags['skip']) {
  48. echo '<h2>Season Parameters</h2>';
  49. # Existing seasons
  50. echo '<p>';
  51. foreach ($seasons as $season => $monitored) {
  52. $season_html = htmlspecialchars($season);
  53. echo '<label>Season ' . $season_html . ' ';
  54. echo '<input type="checkbox" value="1" name="season_' . $season_html . '" ';
  55. if ($monitored !== false) {
  56. echo 'checked="checked"';
  57. }
  58. echo '/></label>';
  59. echo '<input type="text" size="150" name="url_' . $season_html . '" value="';
  60. if ($monitored !== false && $monitored !== true) {
  61. echo htmlspecialchars($monitored);
  62. }
  63. echo '"/>';
  64. echo '<input type="submit" name="season_del_' . $season_html . '" value="Delete">';
  65. echo '<br/>';
  66. }
  67. echo '</p>';
  68. # Add a season
  69. $next_season = max(array_keys($seasons)) + 1;
  70. echo '<p>Add season: ';
  71. echo '<input type="text" size="2" name="season_add" value="' . htmlspecialchars($next_season) . '"/>';
  72. echo '<input type="submit" name="AddSeason" value="Add Season">';
  73. echo '</p>';
  74. }
  75. # Save button
  76. echo '<p><input type="submit" name="Save" value="Save"/></p>';
  77. # Footer
  78. echo '</form>';
  79. }
  80. # Print a DL of all series and note the available and monitored seasons
  81. function printAllSeries() {
  82. global $TV_PATH;
  83. $all_series = allSeries($TV_PATH);
  84. echo "<dl>\n";
  85. foreach ($all_series as $series => $seasons) {
  86. echo '<dt><a href="?series=' . urlencode($series) . '">' . htmlspecialchars($series) . "</a></dt>\n";
  87. foreach ($seasons as $season => $monitored) {
  88. echo '<dd>Season ' . htmlspecialchars($season);
  89. if ($monitored) {
  90. echo ' (monitored)';
  91. }
  92. echo "</dd>\n";
  93. }
  94. }
  95. echo "</dl>\n";
  96. }
  97. ?>