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:21
Showing 1 changed files
... ...
@@ -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
 		}
Browse code

blocks/menu/menu.php: PHP 8.5.x deprecations fix

Clarissa Walker authored on 2026/11/09 15:45:26
Showing 1 changed files
... ...
@@ -3,7 +3,7 @@ if(!defined("_CHARSET")) exit( );
3 3
 
4 4
 $content = '';
5 5
 
6
-	if(isset($blocks[$block]['content'])) {
6
+	if(!is_null($block) && isset($blocks[$block]['content'])) {
7 7
 		foreach($blocks[$block]['content'] as $page) {
8 8
 			if(isset($pagelinks[$page]['link'])) {
9 9
 				if(empty($blocks[$block]['style'])) $content .= "<li ".($current == $page ? "id=\"menu_current\"" : "").">".$pagelinks[$page]['link']."</li>";
... ...
@@ -14,11 +14,11 @@ $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(empty($pagelinks[$page])) continue;
17
+			if(!is_null($pagelinks[$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
 		}
21 21
 	}
22
-	if(empty($blocks[$block]['style'])) $content = "<ul>$content</ul>";
22
+	if(!is_null($block) && empty($blocks[$block]['style'])) $content = "<ul>$content</ul>";
23 23
 	$content = "<div id=\"$block\">$content</div>";
24 24
 ?>
Browse code

blocks/menu/menu.php: fix array to string conversion warning for PHP 8 - proper fix

Clarissa Walker authored on 2026/09/15 06:55:16
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 <?php
2 2
 if(!defined("_CHARSET")) exit( );
3 3
 
4
-$content = (int) $content;
4
+$content = '';
5 5
 
6 6
 	if(isset($blocks[$block]['content'])) {
7 7
 		foreach($blocks[$block]['content'] as $page) {
Browse code

blocks/menu/menu.php: fix array to string conversion warning for PHP 8 - remove temp error suppression

Clarissa Walker authored on 2026/09/15 06:48:18
Showing 1 changed files
... ...
@@ -1,7 +1,8 @@
1 1
 <?php
2
-error_reporting(0);
3 2
 if(!defined("_CHARSET")) exit( );
4 3
 
4
+$content = (int) $content;
5
+
5 6
 	if(isset($blocks[$block]['content'])) {
6 7
 		foreach($blocks[$block]['content'] as $page) {
7 8
 			if(isset($pagelinks[$page]['link'])) {
Browse code

blocks/menu/menu.php: temp error suppression

Clarissa Walker authored on 2026/09/14 20:11:16
Showing 1 changed files
... ...
@@ -1,4 +1,5 @@
1 1
 <?php
2
+error_reporting(0);
2 3
 if(!defined("_CHARSET")) exit( );
3 4
 
4 5
 	if(isset($blocks[$block]['content'])) {
... ...
@@ -19,4 +20,4 @@ if(!defined("_CHARSET")) exit( );
19 20
 	}
20 21
 	if(empty($blocks[$block]['style'])) $content = "<ul>$content</ul>";
21 22
 	$content = "<div id=\"$block\">$content</div>";
22
-?>
23 23
\ No newline at end of file
24
+?>
Browse code

3.5.6 efiction version

Jimako authored on 2024/03/09 16:09:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,22 @@
1
+<?php
2
+if(!defined("_CHARSET")) exit( );
3
+
4
+	if(isset($blocks[$block]['content'])) {
5
+		foreach($blocks[$block]['content'] as $page) {
6
+			if(isset($pagelinks[$page]['link'])) {
7
+				if(empty($blocks[$block]['style'])) $content .= "<li ".($current == $page ? "id=\"menu_current\"" : "").">".$pagelinks[$page]['link']."</li>";
8
+				else $content .= $pagelinks[$page]['link'];
9
+			}
10
+		}
11
+	}
12
+	else {
13
+		$pages = array('home', 'recent', 'titles', 'catslink', 'series', 'members', 'authors', 'challenges', 'search', 'tens', 'featured', 'help', 'contactus', 'login', 'logout', 'adminarea');
14
+		foreach($pages as $page) {
15
+			if(empty($pagelinks[$page])) continue;
16
+			if(empty($blocks[$block]['style'])) $content .= "<li ".($current == $page ? "id=\"menu_current\"" : "").">".$pagelinks[$page]['link']."</li>";
17
+			else $content .= $pagelinks[$page]['link'];
18
+		}
19
+	}
20
+	if(empty($blocks[$block]['style'])) $content = "<ul>$content</ul>";
21
+	$content = "<div id=\"$block\">$content</div>";
22
+?>
0 23
\ No newline at end of file