Просмотр исходного кода

Merge pull request #411 from own3mall/master

Minor Fix to Prevent Issues
OwN-3m-All 7 лет назад
Родитель
Сommit
25e714165d
2 измененных файлов с 9 добавлено и 7 удалено
  1. 1 1
      includes/database.php
  2. 8 6
      includes/database_mysqli.php

+ 1 - 1
includes/database.php

@@ -241,7 +241,7 @@ abstract class OGPDatabase {
 
     /// \return FALSE if game home does not exist
     /// \return array containing the information of the gamehome.
-    abstract public function getGameHome($home_id);
+    abstract public function getGameHome($home_id, $getIPInfo = false);
 
     /// \return FALSE if game home does not exist or user does not have access to it.
     /// \return array information of the gamehome.

+ 8 - 6
includes/database_mysqli.php

@@ -2453,14 +2453,16 @@ class OGPDatabaseMySQL extends OGPDatabase
 		return $homeid;
 	}
 
-	public function getGameHome($home_id) {
-		$query = sprintf('SELECT *
+	public function getGameHome($home_id, $getIPInfo = false) {
+		$queryStr = 'SELECT *
 			FROM `%1$sremote_servers` 
 			NATURAL JOIN `%1$sserver_homes` 
-			NATURAL JOIN `%1$sconfig_homes`
-			NATURAL JOIN `%1$sremote_server_ips`
-			NATURAL JOIN `%1$shome_ip_ports`
-			WHERE `home_id` = %2$d;',
+			NATURAL JOIN `%1$sconfig_homes`';
+		if($getIPInfo){
+			$queryStr .= ' NATURAL JOIN `%1$sremote_server_ips` NATURAL JOIN `%1$shome_ip_ports`';
+		}
+		$queryStr .= ' WHERE `home_id` = %2$d;';
+		$query = sprintf($queryStr,
 			$this->table_prefix,
 			$this->realEscapeSingle($home_id));
 		++$this->queries_;