display.php 2.5 KB

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