Browse code

blocks/menu/- admin.php, menu.php: further PHP fixes - undefined index notices (PHP 7.x)/undefined array key warnings (PHP 8.x), assumed unserialize() index/array warning and deprecation of false to array conversion in admin panel - this occurs in two scenarios: an entirely new install (menu entry's block_variables are empty on a new install), and with some skins that do not utilize a menu block array in their variables.php file (or don't even have a variables.php file at all)

Clarissa Walker authored on 2026/11/11 04:08:02
Showing 2 changed files
... ...
@@ -54,7 +54,10 @@ else include("blocks/menu/en.php");
54 54
 	if($admin){
55 55
 		$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = '$admin'");
56 56
 		while($block = dbassoc($blockquery)) {
57
-			$blocks[$block['block_name']] = unserialize($block['block_variables']);
57
+			if ($block['block_variables'])
58
+			{
59
+				$blocks[$block['block_name']] = unserialize($block['block_variables']);
60
+			}
58 61
 			$blocks[$block['block_name']]['title'] = $block['block_title'];
59 62
 			$blocks[$block['block_name']]['file'] = $block['block_file'];
60 63
 			$blocks[$block['block_name']]['status'] = $block['block_status'];
... ...
@@ -84,4 +87,4 @@ else include("blocks/menu/en.php");
84 87
 			<option value=\"0\"".(empty($blocks['menu']['style']) ? " selected" : "").">"._LISTFORMAT."</option>
85 88
 			</select><br /><br /><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></div></form></div>";
86 89
 	}
87
-?>
88 90
\ No newline at end of file
91
+?>
... ...
@@ -14,7 +14,7 @@ $content = '';
14 14
 	else {
15 15
 		$pages = array('home', 'recent', 'titles', 'catslink', 'series', 'members', 'authors', 'challenges', 'search', 'tens', 'featured', 'help', 'contactus', 'login', 'logout', 'adminarea');
16 16
 		foreach($pages as $page) {
17
-			if(!is_null($pagelinks[$page]) || empty($pagelinks[$page])) continue;
17
+			if(!is_null($page) || empty($pagelinks[$page])) continue;
18 18
 			if(empty($blocks[$block]['style'])) $content .= "<li ".($current == $page ? "id=\"menu_current\"" : "").">".$pagelinks[$page]['link']."</li>";
19 19
 			else $content .= $pagelinks[$page]['link'];
20 20
 		}