Browse code

browse/class.php, browse/ratings.php: more PHP 8 warnings fixes, PHP 5.6 (!) support...

Clarissa Walker authored on 2026/10/30 00:22:38
Showing 2 changed files
... ...
@@ -39,12 +39,15 @@ if(!empty($classid)) {
39 39
 }
40 40
 else if(isset($type_id)) {
41 41
 	if(empty($type_id)) $classtypelist[$type_id]['title'] = '';
42
+	if(empty($classtypelist[$type_id]['title'])) $classtypelist[$type_id]['title'] = '';
42 43
 	$output .= "<div id='pagetitle'>".($classtypelist[$type_id]['title'])."</div>";
43 44
 	foreach($classlist as $c => $i) {
44 45
 		if($i['type'] == $type_id) $clist[] = "<a href='browse.php?type=class&amp;type_id=$type_id&amp;classid=$c'>".$i['name']."</a><br />";
45 46
 		else $clist[] = '';
46 47
 	}
47
-	$total = is_countable($clist);
48
+	if(empty($clist)) $clist = array();
49
+	if(empty($total)) $total = null;
50
+	if ($clist) $total = count($clist);
48 51
 	$count = 0;
49 52
 	$column = 1;
50 53
 	$list = floor($total / $displaycolumns);
... ...
@@ -34,7 +34,7 @@ if($rating) {
34 34
 }
35 35
 else {
36 36
 	$output .= "<div id='pagetitle'>"._RATINGS."</div>";
37
-	$total = is_countable(isset($ratingslist) ? $ratingslist : null);
37
+	if ($ratingslist) $total = count(isset($ratingslist) ? $ratingslist : null);
38 38
 	$count = 0;
39 39
 	$column = 1;
40 40
 	$list = floor($total / $displaycolumns);