Răsfoiți Sursa

More jquery improvements

Zachary Kotlarek 13 ani în urmă
părinte
comite
6c18e71976
3 a modificat fișierele cu 13 adăugiri și 9 ștergeri
  1. 4 6
      web/includes/display.php
  2. 7 1
      web/includes/series.php
  3. 2 2
      web/index.php

+ 4 - 6
web/includes/display.php

@@ -150,14 +150,12 @@ function printAllSeries() {
 	echo '</div>';
 
 	# Add a series
-	echo '<div data-role="footer">';
-	echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
-	echo '<p>';
+	echo '<div data-role="footer"><p>';
+	echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" data-ajax="false">';
 	echo '<label>TheTVDB ID or URL: <input type="text" name="series_add"/></label>';
-	echo '<input type="submit" name="AddSeries" value="Add Series"/>';
-	echo '</p>';
+	echo '<input type="submit" value="Add Series"/>';
 	echo '</form>';
-	echo '</div>';
+	echo '</p></div>';
 
 	# End the jquery section
 	echo '</div>';

+ 7 - 1
web/includes/series.php

@@ -185,12 +185,18 @@ function addSeries($str) {
 		die('Series already exists: ' . htmlspecialchars($series) . "\n");
 	}
 
+	# Return the series name or FALSE on failure
+	$retval = false;
+
 	# If all is well, create the folder and webloc file
 	$series_path = seriesPath($series);
-	if(@mkdir($series_path)) {
+	if (@mkdir($series_path)) {
 		writeWebloc(TVDBURL($id, $lid), $series_path . '/' . $series . '.webloc');
 		addSeason($series, 1);
+		$retval = $series;
 	}
+
+	return $retval;
 }
 
 ?>

+ 2 - 2
web/index.php

@@ -65,12 +65,12 @@ if ($series !== false) {
 }
 
 # Did the user add a series?
-if ($series === false && isset($_POST['AddSeries'])) {
+if ($series === false && isset($_POST['series_add'])) {
 	# 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 series folder
-		addSeries($_POST['series_add']);
+		$series = addSeries($_POST['series_add']);
 	} else {
 		echo '<h4 style="color: red;">Cannot save: User not authenticated</h4>';
 	}