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

@ -611,14 +611,14 @@ function getRootdirectory() {
// Get user's home directory
// -------------------------------------------------------------------------
$sqlquery1 = "SELECT homedirectory FROM net2ftp_users WHERE ftpserver = '$net2ftp_ftpserver_safe' AND username = '$net2ftp_username_safe';";
$result1 = mysql_query("$sqlquery1") or die("Unable to execute SQL SELECT query (isAuthorizedDirectory > sqlquery1) <br /> $sqlquery1");
$nrofrows1 = mysql_num_rows($result1);
$result1 = mysqli_query($mydb, "$sqlquery1") or die("Unable to execute SQL SELECT query (isAuthorizedDirectory > sqlquery1) <br /> $sqlquery1");
$nrofrows1 = mysqli_num_rows($result1);
if ($nrofrows1 == 0) {
$net2ftp_globals["homedirectory"] = "/";
}
elseif ($nrofrows1 == 1) {
$resultRow1 = mysql_fetch_row($result1);
$resultRow1 = mysqli_fetch_row($result1);
$net2ftp_globals["homedirectory"] = $resultRow1[0];
}
else {

View file

@ -120,15 +120,15 @@ function getConsumption() {
// Get consumed data volume and execution time by the current IP address
// -------------------------------------------------------------------------
$sqlquery1 = "SELECT datatransfer, executiontime FROM net2ftp_log_consumption_ipaddress WHERE date = '$date' AND ipaddress = '$REMOTE_ADDR_safe';";
$result1 = mysql_query("$sqlquery1") or die("Unable to execute SQL SELECT query (getConsumption > sqlquery1) <br /> $sqlquery1");
$nrofrows1 = mysql_num_rows($result1);
$result1 = mysqli_query($mydb, "$sqlquery1") or die("Unable to execute SQL SELECT query (getConsumption > sqlquery1) <br /> $sqlquery1");
$nrofrows1 = mysqli_num_rows($result1);
if ($nrofrows1 == 0) {
$net2ftp_globals["consumption_ipaddress_datatransfer"] = 0;
$net2ftp_globals["consumption_ipaddress_executiontime"] = 0;
}
elseif ($nrofrows1 == 1) {
$resultRow1 = mysql_fetch_row($result1);
$resultRow1 = mysqli_fetch_row($result1);
$net2ftp_globals["consumption_ipaddress_datatransfer"] = $resultRow1[0];
$net2ftp_globals["consumption_ipaddress_executiontime"] = $resultRow1[1];
}
@ -141,15 +141,15 @@ function getConsumption() {
// Get consumed data volume and execution time to the current FTP server
// -------------------------------------------------------------------------
$sqlquery2 = "SELECT datatransfer, executiontime FROM net2ftp_log_consumption_ftpserver WHERE date = '$date' AND ftpserver = '$net2ftp_ftpserver_safe';";
$result2 = mysql_query("$sqlquery2") or die("Unable to execute SQL SELECT query (getConsumption > sqlquery2) <br /> $sqlquery2");
$nrofrows2 = mysql_num_rows($result2);
$result2 = mysqli_query($mydb, "$sqlquery2") or die("Unable to execute SQL SELECT query (getConsumption > sqlquery2) <br /> $sqlquery2");
$nrofrows2 = mysqli_num_rows($result2);
if ($nrofrows2 == 0) {
$net2ftp_globals["consumption_ftpserver_datatransfer"] = 0;
$net2ftp_globals["consumption_ftpserver_executiontime"] = 0;
}
elseif ($nrofrows2 == 1) {
$resultRow2 = mysql_fetch_row($result2);
$resultRow2 = mysqli_fetch_row($result2);
$net2ftp_globals["consumption_ftpserver_datatransfer"] = $resultRow2[0];
$net2ftp_globals["consumption_ftpserver_executiontime"] = $resultRow2[1];
}
@ -251,13 +251,13 @@ function putConsumption() {
// Put consumed data volume and execution time by the current IP address
// -------------------------------------------------------------------------
$sqlquery1 = "SELECT * FROM net2ftp_log_consumption_ipaddress WHERE date = '$date' AND ipaddress = '$REMOTE_ADDR_safe';";
$result1 = mysql_query("$sqlquery1");
$nrofrows1 = mysql_num_rows($result1);
$result1 = mysqli_query($mydb, "$sqlquery1");
$nrofrows1 = mysqli_num_rows($result1);
if ($nrofrows1 == 1) {
$sqlquery2 = "UPDATE net2ftp_log_consumption_ipaddress SET datatransfer = '" . $net2ftp_globals["consumption_ipaddress_datatransfer"] . "', executiontime = '" . round($net2ftp_globals["consumption_ipaddress_executiontime"]) . "' WHERE date = '$date' AND ipaddress = '$REMOTE_ADDR_safe';";
$result2 = mysql_query("$sqlquery2");
$nrofrows2 = mysql_affected_rows($mydb);
$result2 = mysqli_query($mydb, "$sqlquery2");
$nrofrows2 = mysqli_affected_rows($mydb);
// Don't check on the UPDATE nr of rows, because when the values in the variables and in the table are the same,
// the $nrofrows2 is set to 0. (This happens on the Browse screen, when the loading is fast: the datatransfer is 0
// and the executiontime is the same as in the table.)
@ -268,8 +268,8 @@ function putConsumption() {
}
elseif ($nrofrows1 == 0) {
$sqlquery3 = "INSERT INTO net2ftp_log_consumption_ipaddress VALUES('$date', '$REMOTE_ADDR_safe', '" . $net2ftp_globals["consumption_ipaddress_datatransfer"] . "', '" . round($net2ftp_globals["consumption_ipaddress_executiontime"]) . "');";
$result3 = mysql_query("$sqlquery3");
$nrofrows3 = mysql_affected_rows($mydb);
$result3 = mysqli_query($mydb, "$sqlquery3");
$nrofrows3 = mysqli_affected_rows($mydb);
if ($nrofrows3 != 1) {
setErrorVars(false, __("Table net2ftp_log_consumption_ipaddress could not be updated."), debug_backtrace(), __FILE__, __LINE__);
return false;
@ -288,13 +288,13 @@ function putConsumption() {
// Put consumed data volume and execution time to the current FTP server
// -------------------------------------------------------------------------
$sqlquery4 = "SELECT * FROM net2ftp_log_consumption_ftpserver WHERE date = '$date' AND ftpserver = '$net2ftp_ftpserver_safe';";
$result4 = mysql_query("$sqlquery4");
$nrofrows4 = mysql_num_rows($result4);
$result4 = mysqli_query($mydb, "$sqlquery4");
$nrofrows4 = mysqli_num_rows($result4);
if ($nrofrows4 == 1) {
$sqlquery5 = "UPDATE net2ftp_log_consumption_ftpserver SET datatransfer = '" . $net2ftp_globals["consumption_ftpserver_datatransfer"] . "', executiontime = '" . round($net2ftp_globals["consumption_ftpserver_executiontime"]) . "' WHERE date = '$date' AND ftpserver = '$net2ftp_ftpserver_safe';";
$result5 = mysql_query("$sqlquery5");
$nrofrows5 = mysql_affected_rows($mydb);
$result5 = mysqli_query($mydb, "$sqlquery5");
$nrofrows5 = mysqli_affected_rows($mydb);
// Don't check on the UPDATE nr of rows, because when the values in the variables and in the table are the same,
// the $nrofrows2 is set to 0. (This happens on the Browse screen, when the loading is fast: the datatransfer is 0
// and the executiontime is the same as in the table.)
@ -305,8 +305,8 @@ function putConsumption() {
}
elseif ($nrofrows4 == 0) {
$sqlquery6 = "INSERT INTO net2ftp_log_consumption_ftpserver VALUES('$date', '$net2ftp_ftpserver_safe', '" . $net2ftp_globals["consumption_ftpserver_datatransfer"] . "', '" . round($net2ftp_globals["consumption_ftpserver_executiontime"]) . "');";
$result6 = mysql_query("$sqlquery6");
$nrofrows6 = mysql_affected_rows($mydb);
$result6 = mysqli_query($mydb, "$sqlquery6");
$nrofrows6 = mysqli_affected_rows($mydb);
if ($nrofrows6 != 1) {
setErrorVars(false, __("Table net2ftp_log_consumption_ftpserver could not be updated."), debug_backtrace(), __FILE__, __LINE__);
return false;
@ -321,13 +321,13 @@ function putConsumption() {
// Update the net2ftp_log_access record with the consumed data volume and execution time
// -------------------------------------------------------------------------
$sqlquery7 = "SELECT * FROM net2ftp_log_access WHERE id = '" . $net2ftp_globals["log_access_id"] . "';";
$result7 = mysql_query("$sqlquery7");
$nrofrows7 = mysql_num_rows($result7);
$result7 = mysqli_query($mydb, "$sqlquery7");
$nrofrows7 = mysqli_num_rows($result7);
if ($nrofrows7 == 1) {
$sqlquery8 = "UPDATE net2ftp_log_access SET datatransfer = '" . $net2ftp_globals["consumption_datatransfer"] . "', executiontime = '" . round($net2ftp_globals["consumption_executiontime"]) . "' WHERE id = '" . $net2ftp_globals["log_access_id"] . "'";
$result8 = mysql_query("$sqlquery8");
$nrofrows8 = mysql_affected_rows($mydb);
$result8 = mysqli_query($mydb, "$sqlquery8");
$nrofrows8 = mysqli_affected_rows($mydb);
// Don't check on the UPDATE nr of rows, because when the values in the variables and in the table are the same,
// the $nrofrows2 is set to 0. (This happens on the Browse screen, when the loading is fast: the datatransfer is 0
// and the executiontime is the same as in the table.)
@ -338,8 +338,8 @@ function putConsumption() {
}
elseif ($nrofrows7 == 0) {
$sqlquery9 = "INSERT INTO net2ftp_log_access VALUES('$date', '$REMOTE_ADDR_safe', '" . $net2ftp_globals["consumption_ipaddress_datatransfer"] . "', '" . round($net2ftp_globals["consumption_ipaddress_executiontime"]) . "');";
$result9 = mysql_query("$sqlquery9");
$nrofrows9 = mysql_affected_rows($mydb);
$result9 = mysqli_query($mydb, "$sqlquery9");
$nrofrows9 = mysqli_affected_rows($mydb);
if ($nrofrows9 != 1) {
setErrorVars(false, __("Table net2ftp_log_access could not be updated."), debug_backtrace(), __FILE__, __LINE__);
return false;

View file

@ -28,18 +28,12 @@ function connect2db() {
// -------------------------------------------------------------------------
global $net2ftp_settings;
$mydb = mysql_connect($net2ftp_settings["dbserver"], $net2ftp_settings["dbusername"], $net2ftp_settings["dbpassword"]);
$mydb = mysqli_connect($net2ftp_settings["dbserver"], $net2ftp_settings["dbusername"], $net2ftp_settings["dbpassword"], $net2ftp_settings["dbname"]);
if ($mydb == false) {
setErrorVars(false, __("Unable to connect to the MySQL database. Please check your MySQL database settings in net2ftp's configuration file settings.inc.php."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
$result2 = mysql_select_db($net2ftp_settings["dbname"]);
if ($result2 == false) {
setErrorVars(false, __("Unable to select the MySQL database. Please check your MySQL database settings in net2ftp's configuration file settings.inc.php."), debug_backtrace(), __FILE__, __LINE__);
return false;
}
return $mydb;
} // End connect2db

View file

@ -2953,12 +2953,12 @@ function checkEmailAddress($email) {
// Returns true for valid email addresses, false for non-valid email addresses
// --------------
if (eregi( "^" .
if (preg_match( "/^" .
"[a-z0-9]+([_\.-][a-z0-9]+)*" . //user
"@" .
"([a-z0-9]+([\.-][a-z0-9]+)*)+" . //domain
"\\.[a-z]{2,}" . //sld, tld
"$", $email, $regs)) { return true; }
"$/i", $email, $regs)) { return true; }
else { return false; }
} // end checkEmailAddress
@ -3326,12 +3326,12 @@ $AttmFiles ... array containing the filenames to attach like array("file1","file
}
// Check if the To email address is valid
if (!eregi( "^" .
if (!preg_match( "/^" .
"[a-zA-Z0-9]+([_\.-][a-zA-Z0-9]+)*" . //user
"@" .
"([a-zA-Z0-9]+([\.-][a-zA-Z0-9]+)*)+" . //domain
"\\.[a-zA-Z]{2,}" . //sld, tld
"$", $To, $regs)) {
"$/i", $To, $regs)) {
$errormessage = __("The email address you have entered (%1\$s) does not seem to be valid.<br />Please enter an address in the format <b>username@domain.com</b>", $To);
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;

View file

@ -93,16 +93,16 @@ function logAccess() {
// Add record to the database table
// ----------------------------------------------
$sqlquery1 = "INSERT INTO net2ftp_log_access VALUES(null, '$date', '$time', '$REMOTE_ADDR_safe', '$REMOTE_PORT_safe', '$HTTP_USER_AGENT_safe', '$PHP_SELF_safe', '$consumption_datatransfer_safe', '$consumption_executiontime_safe', '$net2ftp_ftpserver_safe', '$net2ftp_username_safe', '$state_safe', '$state2_safe', '$screen_safe', '$directory_safe', '$entry_safe', '$HTTP_REFERER_safe')";
$result1 = mysql_query($sqlquery1);
$result1 = mysqli_query($mydb, $sqlquery1);
if ($result1 == false) {
$errormessage = __("Unable to execute the SQL query.");
setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
return false;
}
$nrofrows1 = mysql_affected_rows($mydb);
$nrofrows1 = mysqli_affected_rows($mydb);
$net2ftp_globals["log_access_id"] = mysql_insert_id();
$net2ftp_globals["log_access_id"] = mysqli_insert_id($mydb);
} // end if use_database
@ -256,7 +256,7 @@ function logError() {
// Add record to the database table
// ----------------------------------------------
$sqlquerystring = "INSERT INTO net2ftp_log_error VALUES('$date', '$time', '$net2ftp_ftpserver_safe', '$net2ftp_username_safe', '$errormessage', '$debug_backtrace', '$state_safe', '$state2_safe', '$directory_safe', '$REMOTE_ADDR_safe', '$REMOTE_PORT_safe', '$HTTP_USER_AGENT_safe')";
$result_mysql_query = mysql_query($sqlquerystring);
$result_mysql_query = mysqli_query($mydb, $sqlquerystring);
if ($result_mysql_query == false) {
setErrorVars($net2ftp_result_original["success"], $net2ftp_result_original["errormessage"], $net2ftp_result_original["debug_backtrace"], $net2ftp_result_original["file"], $net2ftp_result_original["line"]);
return false;
@ -365,14 +365,14 @@ function getLogStatus() {
// Get log rotation status
// -------------------------------------------------------------------------
$sqlquery1 = "SELECT status FROM net2ftp_log_status WHERE month = '$currentmonth';";
$result1 = mysql_query("$sqlquery1") or die("Unable to execute SQL SELECT query (getLogStatus > sqlquery1) <br /> $sqlquery1");
$nrofrows1 = mysql_num_rows($result1);
$result1 = mysqli_query($mydb, "$sqlquery1") or die("Unable to execute SQL SELECT query (getLogStatus > sqlquery1) <br /> $sqlquery1");
$nrofrows1 = mysqli_num_rows($result1);
if ($nrofrows1 == 0) {
$logStatus = 1;
}
elseif ($nrofrows1 == 1) {
$resultRow1 = mysql_fetch_row($result1);
$resultRow1 = mysqli_fetch_row($result1);
$logStatus = $resultRow1[0];
}
else {
@ -434,25 +434,25 @@ function putLogStatus($logStatus) {
// Put log rotation status
// -------------------------------------------------------------------------
$sqlquery1 = "SELECT status, changelog FROM net2ftp_log_status WHERE month = '$currentmonth';";
$result1 = mysql_query("$sqlquery1");
$nrofrows1 = mysql_num_rows($result1);
$result1 = mysqli_query($mydb, "$sqlquery1");
$nrofrows1 = mysqli_num_rows($result1);
if ($nrofrows1 == 1) {
$resultRow1 = mysql_fetch_row($result1);
$resultRow1 = mysqli_fetch_row($result1);
$logStatus_old = $resultRow1[0];
$changelog_old = $resultRow1[1];
$changelog_new = $changelog_old . "From $logStatus_old to $logStatus on $datetime. ";
$sqlquery2 = "UPDATE net2ftp_log_status SET status = '" . $logStatus . "', changelog = '" . $changelog_new . "' WHERE month = '$currentmonth';";
$result2 = mysql_query("$sqlquery2");
$nrofrows2 = mysql_affected_rows($mydb);
$result2 = mysqli_query($mydb, "$sqlquery2");
$nrofrows2 = mysqli_affected_rows($mydb);
}
// Don't check on the UPDATE nr of rows, because when the values in the variables and in the table are the same,
// the $nrofrows2 is set to 0.
elseif ($nrofrows1 == 0) {
$changelog_new = "Set to $logStatus on $datetime. ";
$sqlquery3 = "INSERT INTO net2ftp_log_status VALUES('$currentmonth', '" . $logStatus . "', '" . $changelog_new . "');";
$result3 = mysql_query("$sqlquery3");
$nrofrows3 = mysql_affected_rows($mydb);
$result3 = mysqli_query($mydb, "$sqlquery3");
$nrofrows3 = mysqli_affected_rows($mydb);
if ($nrofrows3 != 1) {
setErrorVars(false, __("Table net2ftp_log_status could not be updated."), debug_backtrace(), __FILE__, __LINE__);
return false;
@ -516,10 +516,10 @@ function emptyLogs($datefrom, $dateto) {
// -------------------------------------------------------------------------
for ($i=1; $i<=sizeof($tables); $i++) {
$sqlquery_empty = "DELETE FROM $tables[$i] WHERE date BETWEEN '$datefrom' AND '$dateto';";
$result_empty[$i] = mysql_query("$sqlquery_empty");
$result_empty[$i] = mysqli_query($mydb, "$sqlquery_empty");
$sqlquery_optimize = "OPTIMIZE TABLE `" . $tables[$i] . "`;";
$result_optimize[$i] = mysql_query("$sqlquery_optimize");
$result_optimize[$i] = mysqli_query($mydb, "$sqlquery_optimize");
if ($result_empty[$i] == true) {
$net2ftp_output["emptyLogs"][] = __("The table <b>%1\$s</b> was emptied successfully.", $tables[$i]);
@ -641,7 +641,7 @@ function rotateLogs() {
$table_archive_drop = $table . "_" . $dropmonth; // Example: net2ftp_log_access_201106
$sqlquery_rename = "RENAME TABLE $table TO $table_archive";
$result_rename[$i] = mysql_query("$sqlquery_rename");
$result_rename[$i] = mysqli_query($mydb, "$sqlquery_rename");
if ($result_rename[$i] == true) {
$net2ftp_output["rotateLogs"][] = __("The log tables were renamed successfully.");
@ -673,7 +673,7 @@ function rotateLogs() {
$table_archive_drop = $table . "_" . $dropmonth; // Example: net2ftp_log_access_201106
$sqlquery_copy = "CREATE TABLE $table LIKE $table_archive";
$result_copy[$i] = mysql_query("$sqlquery_copy");
$result_copy[$i] = mysqli_query($mydb, "$sqlquery_copy");
if ($result_copy[$i] == true) {
$net2ftp_output["rotateLogs"][] = __("The log tables were copied successfully.");
@ -705,7 +705,7 @@ function rotateLogs() {
$table_archive_drop = $table . "_" . $dropmonth; // Example: net2ftp_log_access_201106
$sqlquery_drop = "DROP TABLE IF EXISTS $table_archive_drop;";
$result_drop[$i] = mysql_query("$sqlquery_drop");
$result_drop[$i] = mysqli_query($mydb, "$sqlquery_drop");
if ($result_drop[$i] == true) {
$net2ftp_output["rotateLogs"][] = __("The oldest log table was dropped successfully.");

View file

@ -5335,24 +5335,9 @@ echo "p entry filename 2 is " . $p_entry['filename'] . " <br />\n";
{
$v_result=1;
// ----- Look if function exists
if ( (!function_exists("get_magic_quotes_runtime"))
|| (!function_exists("set_magic_quotes_runtime"))) {
return $v_result;
}
// ----- Look if already done
if ($this->magic_quotes_status != -1) {
return $v_result;
}
// ----- Get and memorize the magic_quote value
$this->magic_quotes_status = @get_magic_quotes_runtime();
// ----- Disable magic_quotes
if ($this->magic_quotes_status == 1) {
@set_magic_quotes_runtime(0);
}
// get_magic_quotes_runtime() and set_magic_quotes_runtime() were removed
// in PHP 8.0. Magic quotes were always disabled from PHP 5.4 onward,
// so there is nothing to do here.
// ----- Return
return $v_result;
@ -5369,21 +5354,9 @@ echo "p entry filename 2 is " . $p_entry['filename'] . " <br />\n";
{
$v_result=1;
// ----- Look if function exists
if ( (!function_exists("get_magic_quotes_runtime"))
|| (!function_exists("set_magic_quotes_runtime"))) {
return $v_result;
}
// ----- Look if something to do
if ($this->magic_quotes_status != -1) {
return $v_result;
}
// ----- Swap back magic_quotes
if ($this->magic_quotes_status == 1) {
@set_magic_quotes_runtime($this->magic_quotes_status);
}
// get_magic_quotes_runtime() and set_magic_quotes_runtime() were removed
// in PHP 8.0. Magic quotes were always disabled from PHP 5.4 onward,
// so there is nothing to restore here.
// ----- Return
return $v_result;

View file

@ -31,11 +31,8 @@ defined("NET2FTP") or die("Direct access to this location is not allowed.");
// 1 When a variable is submitted, quotes ' are replaced by backslash-quotes \'
// This function removes the extra backslash that is added
// -------------------------------------------------------------------------
if (get_magic_quotes_gpc() == 1) {
remove_magic_quotes($_POST);
remove_magic_quotes($_GET);
remove_magic_quotes($_COOKIE);
}
// Note: get_magic_quotes_gpc() was removed in PHP 8.0; magic quotes are
// always disabled on PHP 5.4+ so no stripping is needed.
// Do not add remove_magic_quotes for $GLOBALS because this would call the same
// function a second time, replacing \' by ' and \" by "
@ -432,28 +429,9 @@ $net2ftp_globals["browser_platform"] = getBrowser("platform");
function remove_magic_quotes(&$x, $keyname="") {
// http://www.php.net/manual/en/configuration.php#ini.magic-quotes-gpc (by the way: gpc = get post cookie)
// if (magic_quotes_gpc == 1), then PHP converts automatically " --> \", ' --> \'
// Has only to be done when getting info from get post cookie
if (get_magic_quotes_gpc() == 1) {
if (is_array($x)) {
while (list($key,$value) = each($x)) {
if ($value) { remove_magic_quotes($x[$key],$key); }
}
}
else {
$quote = "'";
$doublequote = "\"";
$backslash = "\\";
$x = str_replace("$backslash$quote", $quote, $x);
$x = str_replace("$backslash$doublequote", $doublequote, $x);
$x = str_replace("$backslash$backslash", $backslash, $x);
}
} // end if get_magic_quotes_gpc
// get_magic_quotes_gpc() was removed in PHP 8.0; magic quotes are always
// disabled on PHP 5.4+, so this function is now a no-op kept for
// compatibility with any callers that may still reference it.
return $x;
} // end function remove_magic_quotes

View file

@ -119,13 +119,13 @@ function printLanguageSelect($fieldname, $onchange, $style, $class) {
echo "<select name=\"$fieldname\" id=\"$fieldname\" $onchange_full $style_full $class_full>\n";
while (list($key,$value) = each($languageArray)) {
foreach ($languageArray as $key => $value) {
// $key loops over "en", "fr", "nl", ...
// $value will be an array like $value["name"] = "English" and $value["file"] = "en.inc.php"
if ($key == $currentlanguage) { $selected = "selected=\"selected\""; }
else { $selected = ""; }
echo "<option value=\"" . $key . "\" $selected>" . $value["name"] . "</option>\n";
} // end while
} // end foreach
echo "</select>\n";

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;

View file

@ -20,28 +20,28 @@
<input type="hidden" name="url" value="<?php echo htmlEncode2($url); ?>" />
<?php if (is_array($searchoptions) == true) { ?>
<?php while (list($key, $value) = each($searchoptions)) { ?>
<?php foreach ($searchoptions as $key => $value) { ?>
<input type="hidden" name="searchoptions[<?php echo htmlEncode2($key); ?>]" value="<?php echo htmlEncode2($value); ?>" />
<?php } // end while ?>
<?php } // end foreach ?>
<?php } // end if ?>
<?php if (is_array($text_splitted) == true) { ?>
<?php while (list($key, $value) = each($text_splitted)) { ?>
<?php foreach ($text_splitted as $key => $value) { ?>
<input type="hidden" name="text_splitted[<?php echo htmlEncode2($key); ?>]" value="<?php echo htmlEncode2($value); ?>" />
<?php } // end while ?>
<?php } // end foreach ?>
<?php } // end if ?>
<?php if (is_array($zipactions) == true) { ?>
<?php while (list($key, $value) = each($zipactions)) { ?>
<?php foreach ($zipactions as $key => $value) { ?>
<input type="hidden" name="zipactions[<?php echo htmlEncode2($key); ?>]" value="<?php echo htmlEncode2($value); ?>" />
<?php } // end while ?>
<?php } // end foreach ?>
<?php } // end if ?>
<?php if (is_array($zipactions) == true) { ?>
<?php for ($i=1; $i<=sizeof($list["all"]); $i++) { ?>
<?php while (list($key, $value) = each($list["all"][$i])) { ?>
<?php foreach ($list["all"][$i] as $key => $value) { ?>
<input type="hidden" name="list[<?php echo $i; ?>][<?php echo htmlEncode2($key); ?>]" value="<?php echo htmlEncode2($value); ?>" />
<?php } // end while ?>
<?php } // end foreach ?>
<?php } // end for ?>
<?php } // end if ?>

View file

@ -189,13 +189,13 @@ function printSkinSelect($fieldname, $onchange, $style, $class) {
echo "<select name=\"$fieldname\" id=\"$fieldname\" $onchange_full $style_full $class_full>\n";
while (list($key,$value) = each($skinArray)) {
foreach ($skinArray as $key => $value) {
// $key loops over "blue", "pastel", ...
// $value will be an array like $value["name"] = "Blue"
if ($key == $currentskin) { $selected = "selected=\"selected\""; }
else { $selected = ""; }
echo "<option value=\"" . $key . "\" $selected>" . $value["name"] . "</option>\n";
} // end while
} // end foreach
echo "</select>\n";