viewstory.php: Undefined variable warnings while trying to access a nonexistent chapter for an existing story better dirty fix for PHP 8 users
viewstory.php: Undefined variable warnings while trying to access a nonexistent chapter for an existing story better dirty fix for PHP 8 users

--- a/viewstory.php
+++ b/viewstory.php
@@ -345,12 +345,8 @@
 		}
 		$printicon = "<img src='".(isset($printer) ? $printer : "images/print.gif")."' border='0' alt='"._PRINTER."'> <a href=\"viewstory.php?action=printable&amp;sid=$sid&amp;textsize=$textsize&amp;chapter=1\" target=\"_blank\">"._STORY."</a>";
 	}
-	$chapterauthor = '';
-	$chapid = '';
-	$inorder = '';
-	$valid = '';
 	// if the *CHAPTER* hasn't been validated and the viewer isn't an admin or the author throw them a warning.  
-	if(!$valid && !isADMIN && USERUID != $chapterauthor && !in_array($chapterauthor, $storyinfo['coauthors'])) {
+	if(!isset($valid) && !isADMIN && USERUID != isset($chapterauthor) && !in_array(isset($chapterauthor), isset($storyinfo['coauthors']))) {
 		$warning = accessDenied( );
 	}
 	$stories = $storyinfo;