| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?
- # 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 series?
- $series = false;
- if (isset($_REQUEST['series'])) {
- # This is not a great filter, but it should make the string safe for use as a quoted path
- $series = preg_replace('/[\0\n\r]/', '', $_REQUEST['series']);
- $series = basename($series);
- }
- # Did the user request an update?
- if ($series !== false && isset($_POST['Save'])) {
- # Require auth (or for the time being, specific IP addresses)
- if (preg_match('/^(?:172\.19\.[17]\.|2602:3f:e50d:76|74\.93\.97\.65)/', $_SERVER['REMOTE_ADDR'])) {
- # Grab the current settings for comparison
- $series_last = readFlags($series);
- $seasons_last = findSeasons($series);
- # Save series and season data
- saveFlags($series, $_POST, $series_last, $seasons_last);
- saveSeasons($series, $_POST, $series_last, $seasons_last);
- } else {
- echo '<h4 style="color: red;">Cannot save: User not authenticated</h4>';
- }
- }
- # Did the user add a season?
- if ($series !== false && isset($_POST['AddSeason'])) {
- # Require auth (or for the time being, specific IP addresses)
- if (preg_match('/^(?:172\.19\.[17]\.|2602:3f:e50d:76|74\.93\.97\.65)/', $_SERVER['REMOTE_ADDR'])) {
- # Add a season folder
- $new_season = intval($_POST['season_new']);
- addSeason($series, $new_season);
- } else {
- echo '<h4 style="color: red;">Cannot save: User not authenticated</h4>';
- }
- }
- #=========================================================================================
- # Generic XHTML 1.1 header
- print <<<ENDOLA
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
- "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
- <title>UberZach TV</title>
- </head>
- <body>
- ENDOLA;
- if ($series === false) {
- printAllSeries();
- } else {
- printSeries($series);
- }
- # Generic XHTML 1.1 footer
- print <<<ENDOLA
- </body>
- </html>
- ENDOLA;
- ?>
|