# Include the TV functions
require_once 'includes/main.php';
# Send our headers early
header('Content-type: text/html; charset=utf-8');
# Did the user request a specific show?
$show = false;
if (isset($_REQUEST['show'])) {
# This is not a great filter, but it should make the string safe for use as a quoted path
$show = preg_replace('/[\0\n\r]/', '', $_REQUEST['show']);
$show = basename($show);
}
# Did the user request an update?
if ($show !== false && isset($_POST['Save'])) {
echo '
Saving not yet implemented
';
# Grab the current settings for comparison
global $TV_PATH;
$series_path = $TV_PATH . '/'. $show;
$series_last = readFlags($series_path);
$seasons_last = findSeasons($series_path);
# Save series and season data
saveFlags($series_path, $_POST, $series_last, $seasons_last);
saveSeasons($series_path, $_POST, $series_last, $seasons_last);
}
#=========================================================================================
# Generic XHTML 1.1 header
print <<
UberZach TV
ENDOLA;
if ($show === false) {
printAllShows();
} else {
printShow($show);
}
# Generic XHTML 1.1 footer
print <<
ENDOLA;
?>