Browse Source

Minor Changes as Referenced in PR https://github.com/OpenGamePanel/OGP-Website/pull/521

own3mall 5 năm trước cách đây
mục cha
commit
e2583d515a

+ 7 - 0
includes/functions.php

@@ -1074,4 +1074,11 @@ function deleteMysqlAddonDatabasesForGameServerHome($home_id){
 	
 	return false;
 }
+
+function get_magic_quotes_gpc_wrapper(){
+	if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()){
+		return true;
+	}
+	return false;
+}
 ?>

+ 3 - 3
modules/ftp/includes/registerglobals.inc.php

@@ -31,7 +31,7 @@ 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) {
+if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() == 1) {
 	remove_magic_quotes($_POST);
 	remove_magic_quotes($_GET);
 	remove_magic_quotes($_COOKIE);
@@ -435,7 +435,7 @@ 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 (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() == 1) {
 
 		if (is_array($x)) {
 			while (list($key,$value) = each($x)) {
@@ -1253,4 +1253,4 @@ function RemoveXSS($val) {
 // **************************************************************************************
 // **************************************************************************************
 
-?>
+?>

+ 2 - 2
modules/gamemanager/cfg_text_replace.php

@@ -249,10 +249,10 @@ foreach($file_replacements as $filepath => $replacements)
 			}
 		}
 	
-		if ( get_magic_quotes_gpc() )
+		if ( get_magic_quotes_gpc_wrapper() )
 			$file_content=stripslashes($file_content);
 	}
 	//echo "<xmp>".$file_content."</xmp>";
 	$remote->remote_writefile($server_home['home_path'] . "/" . $filepath, $file_content);
 }
-?>
+?>

+ 1 - 1
modules/register/register-exec.php

@@ -62,7 +62,7 @@ function exec_ogp_module()
 	//Function to sanitize values received from the form. Prevents SQL injection
 	function clean($str) {
 		$str = @trim($str);
-		if(get_magic_quotes_gpc()) {
+		if(get_magic_quotes_gpc_wrapper()) {
 			$str = stripslashes($str);
 		}
 		return $str;

+ 1 - 1
modules/subusers/add_subuser-exec.php

@@ -41,7 +41,7 @@ function exec_ogp_module()
 	//Function to sanitize values received from the form. Prevents SQL injection
 	function clean($str) {
 		$str = @trim($str);
-		if(get_magic_quotes_gpc()) {
+		if(get_magic_quotes_gpc_wrapper()) {
 			$str = stripslashes($str);
 		}
 		return $str;