From eeba015a21c68779b8dcd31febf8eedf9e6ee11d Mon Sep 17 00:00:00 2001 From: Xkeeper Date: Mon, 16 Sep 2024 23:13:31 -0700 Subject: [PATCH] fix some php8.0 showstoppers --- index.php | 4 ++-- lib/function.php | 8 ++++---- lib/layout.php | 4 ++-- lib/mysql_compat.php | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index d06f664..d8e82ec 100644 --- a/index.php +++ b/index.php @@ -33,7 +33,7 @@ require 'lib/function.php'; require 'lib/layout.php'; - if ($x_hacks['smallbrowse'] == 1 and false) { + if (false && $x_hacks['smallbrowse'] == 1) { require 'mobile/index.php'; // alternate markup for mobile clients. } else { if (filter_string($_GET['action']) == 'markforumread' and $log) { @@ -208,7 +208,7 @@ while ($in = $sql->fetch($data, MYSQL_ASSOC)) { $recent_threads .= " $tccell2>". $in['ftitle'] ." - $tccell1l>$newpost". $in['title'] ." + $tccell1l>". $in['title'] ." $tccell1>". $in['uname'] ." $tccell2>". timeunits(ctime() - $in['date']) ." \n"; diff --git a/lib/function.php b/lib/function.php index c2f11aa..849f18f 100644 --- a/lib/function.php +++ b/lib/function.php @@ -52,14 +52,14 @@ // Bad Design Decisions 2001. // :( - if (!get_magic_quotes_gpc()) { + if (!function_exists("get_magic_quotes_gpc")) { $_GET = addslashes_array($_GET); $_POST = addslashes_array($_POST); $_COOKIE = addslashes_array($_COOKIE); } if(!ini_get('register_globals')){ $supers=array('_ENV', '_SERVER', '_GET', '_POST', '_COOKIE',); - foreach($supers as $__s) if (is_array($$__s)) extract($$__s, EXTR_SKIP); + foreach($supers as $__s) if (isset($$__s) && is_array($$__s)) extract($$__s, EXTR_SKIP); unset($supers); } } @@ -188,7 +188,7 @@ $log = 0; } - if ($x_hacks['superadmin']) $loguser['powerlevel'] = 4; + if ($x_hacks['superadmin'] ?? false) $loguser['powerlevel'] = 4; $power = $loguser['powerlevel']; $banned = ($power<0); @@ -382,7 +382,7 @@ function generatenumbergfx($num,$minlen=0,$double=false){ } for($i=0;$i $boardtitle"; $header2=" - ". (!$x_hacks['smallbrowse'] ? " + ". (!($x_hacks['smallbrowse'] ?? false) ? " Views: $dispviews
$headlinks2 diff --git a/lib/mysql_compat.php b/lib/mysql_compat.php index 5461e98..7b0023d 100644 --- a/lib/mysql_compat.php +++ b/lib/mysql_compat.php @@ -55,7 +55,7 @@ namespace { $hash = sha1($hostname . $username . $flags); /* persistent connections start with p: */ - if ($hostname{1} !== ':' && isset(\Dshafik\MySQL::$connections[$hash])) { + if ($hostname[1] !== ':' && isset(\Dshafik\MySQL::$connections[$hash])) { \Dshafik\MySQL::$last_connection = \Dshafik\MySQL::$connections[$hash]['conn']; \Dshafik\MySQL::$connections[$hash]['refcount'] += 1; return \Dshafik\MySQL::$connections[$hash]['conn']; @@ -729,7 +729,7 @@ namespace Dshafik { { $escapedString = ''; for ($i = 0, $max = strlen($unescapedString); $i < $max; $i++) { - $escapedString .= self::escapeChar($unescapedString{$i}); + $escapedString .= self::escapeChar($unescapedString[$i]); } return $escapedString;