Browse code

viewseries.php: Add previously nonexistent check for nonexistent series, otherwise PHP warnings appear - copied from viewstory.php and edited for this page

Clarissa Walker authored on 2026/09/21 20:18:45
Showing 1 changed files
... ...
@@ -39,6 +39,19 @@ include(_BASEDIR."includes/pagesetup.php");
39 39
 $seriesid = (isset($_GET['seriesid']) && is_numeric($_GET['seriesid'])) ? escapestring($_GET['seriesid']) : false;
40 40
 $sresult = dbquery(_SERIESQUERY." AND seriesid = '$seriesid' LIMIT 1");
41 41
 $series = dbassoc($sresult);
42
+if(!$series) {
43
+	$current = "serieserror";
44
+	// load our template files to set up the page.
45
+	if (file_exists("$skindir/default.tpl")) $tpl = new TemplatePower("$skindir/default.tpl");
46
+	else $tpl = new TemplatePower("default_tpls/default.tpl");
47
+	$title = "Series was not found";
48
+	$text  = "Series with ID " . (($seriesid) ?? null) . " is not in database";
49
+	include("includes/pagesetup.php");
50
+	$tpl->assign("output", "<div id='pagetitle'>" . $title . "</div>" . write_error($text));
51
+	$tpl->printToScreen();
52
+	dbclose();
53
+	exit();
54
+}
42 55
 if(file_exists("$skindir/series_title.tpl")) $titleblock = new TemplatePower( "$skindir/series_title.tpl" );
43 56
 else $titleblock = new TemplatePower( "default_tpls/series_title.tpl" );
44 57
 $titleblock->prepare( );
... ...
@@ -154,4 +167,4 @@ $tpl->gotoBlock( "_ROOT" );
154 167
 $tpl->assign("output", $output);
155 168
 $tpl->printToScreen( );
156 169
 
157
-?>
158 170
\ No newline at end of file
171
+?>