Fix all PHP 8 deprecated/removed function usage across the repository

Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/209fe796-9a38-47c1-a6b7-992ce11d038b

Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-30 13:47:38 +00:00 committed by GitHub
parent 73319ffeed
commit c0bd0a0bb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 198 additions and 471 deletions

View file

@ -225,14 +225,14 @@ function net2ftp_module_printBody() {
// ------------------------------------
// Connect
// ------------------------------------
$mydb = mysql_connect($dbserver2, $dbusername2, $dbpassword2);
$mydb = mysqli_connect($dbserver2, $dbusername2, $dbpassword2);
if ($mydb == false) { $net2ftp_output["admin_createtables"][] = __("The connection to the server <b>%1\$s</b> could not be set up. Please check the database settings you've entered.", $dbserver2_html) . "\n"; }
// ------------------------------------
// Select
// ------------------------------------
if ($mydb != false) {
$mysql_select_db_result = mysql_select_db($dbname2);
$mysql_select_db_result = mysqli_select_db($mydb, $dbname2);
if ($mysql_select_db_result == false) { $net2ftp_output["admin_createtables"][] = __("Unable to select the database <b>%1\$s</b>.", $dbserver2_html) . "\n"; }
}
@ -241,7 +241,7 @@ function net2ftp_module_printBody() {
// ------------------------------------
if ($mydb != false && $mysql_select_db_result != false) {
for ($i=0; $i<sizeof($sqlquerypieces); $i++) {
$mysql_query_results[$i] = mysql_query($sqlquerypieces[$i]);
$mysql_query_results[$i] = mysqli_query($mydb, $sqlquerypieces[$i]);
if ($mysql_query_results[$i] == false) { $net2ftp_output["admin_createtables"][] = __("The SQL query nr <b>%1\$s</b> could not be executed.", $i+1) . "\n"; }
else { $net2ftp_output["admin_createtables"][] = __("The SQL query nr <b>%1\$s</b> was executed successfully.", $i+1) . "\n"; }
}

View file

@ -237,14 +237,14 @@ function printTable($sqlquery) {
// -------------------------------------------------------------------------
// Execute the SQL query
// -------------------------------------------------------------------------
$result = mysql_query("$sqlquery");
$result = mysqli_query($mydb, "$sqlquery");
if ($result == false) {
$errormessage = __("Unable to execute the SQL query <b>%1\$s</b>.", $sqlquery);
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
$nrofrows = mysql_num_rows($result);
$nrofcolumns_withindex = mysql_num_fields($result) + 1;
$nrofrows = mysqli_num_rows($result);
$nrofcolumns_withindex = mysqli_num_fields($result) + 1;
// -------------------------------------------------------------------------
@ -260,19 +260,19 @@ function printTable($sqlquery) {
if ($nrofrows != 0) {
// Second row: header
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
$output .= "<tr>\n";
$output .= "<td>Index</td>\n";
while(list($fieldname, $fieldvalue) = each($row) ) { $output .= "<td>$fieldname</td>\n"; }
foreach ($row as $fieldname => $fieldvalue) { $output .= "<td>$fieldname</td>\n"; }
$output .= "</tr>\n";
mysql_data_seek($result, 0); // reset row pointer to the first row
mysqli_data_seek($result, 0); // reset row pointer to the first row
// 3rd and next rows: data
$rowcounter = 1;
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
$output .= "<tr>\n";
$output .= "<td>$rowcounter</td>\n";
while(list($fieldname, $fieldvalue) = each($row) ) { $output .= "<td>" . htmlEncode2($fieldvalue) . "</td>\n"; }
foreach ($row as $fieldname => $fieldvalue) { $output .= "<td>" . htmlEncode2($fieldvalue) . "</td>\n"; }
$output .= "</tr>\n";
$rowcounter++;
}
@ -289,7 +289,7 @@ function printTable($sqlquery) {
// -------------------------------------------------------------------------
// Free the $result
// -------------------------------------------------------------------------
mysql_free_result($result);
mysqli_free_result($result);
return $output;

View file

@ -160,7 +160,7 @@ function net2ftp_module_printBody() {
// -------------------------------------------------------------------------
// For each sample
// -------------------------------------------------------------------------
while(list($sampleName, $sampleLines) = each($list_samples)) {
foreach ($list_samples as $sampleName => $sampleLines) {
$net2ftp_output["advanced_parsing"][] = "<span style=\"font-size: 120%; font-weight: bold;\">" . $sampleName . "</span><br />\n";
// ------------------------------------
// Input
@ -179,9 +179,9 @@ function net2ftp_module_printBody() {
// Scan the sample
$outputArray = ftp_scanline("", $sampleLines[$i]);
while(list($fieldName, $fieldValue) = each($outputArray)) {
foreach ($outputArray as $fieldName => $fieldValue) {
$net2ftp_output["advanced_parsing"][] = "Line $i: " . $fieldName . ": " . htmlEncode2($fieldValue) . "<br />\n";
} // end while
} // end foreach
$net2ftp_output["advanced_parsing"][] = "<br />\n";
}
$net2ftp_output["advanced_parsing"][] = "<br /><br />\n";

View file

@ -347,7 +347,7 @@ function net2ftp_module_printBody() {
$icon_directory = $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/images/mime";
// Loop over all the sort possibilities
while(list($key, $value) = each($sortArray)) {
foreach ($sortArray as $key => $value) {
// The list is sorted by the current $key
// Print the icon representing the current sortorder
@ -549,7 +549,7 @@ function sort_list($list) {
// Fill the $return array
// -------------------------------------------------------------------------
$i=1;
while(list($tname, $tvalue) = each($temp)) {
foreach ($temp as $tname => $tvalue) {
$return[$i] = $list[$tname];
$i++;
}

View file

@ -480,7 +480,7 @@ function printTextareaSelect($onchange) {
if ($textareaType == "" || $textareaType == "plain") { $plainselected = "selected=\"selected\""; }
echo "<option value=\"plain\" $plainselected>Normal textarea</option>\n";
while(list($pluginName, $value) = each($pluginProperties)) {
foreach ($pluginProperties as $pluginName => $value) {
// Print only the plugins which have 'use' set to yes
// which are textareas
// which are suitable for this browser
@ -490,7 +490,7 @@ function printTextareaSelect($onchange) {
else { $selected = ""; }
echo "<option value=\"$pluginName\" $selected>" . $pluginProperties[$pluginName]["label"] . "</option>\n";
} // end if
} // end while
} // end foreach
echo "</select>\n";

View file

@ -240,7 +240,7 @@ function net2ftp_module_printBody() {
'xml' => array('xml')
);
while(list($language, $extensions) = each($list_language_extensions)) {
foreach ($list_language_extensions as $language => $extensions) {
if (in_array($filename_extension, $extensions)) {
$luminous_language = $language;
break;