Преглед изворни кода

Merge pull request #400 from rocco27/master

November Update
rocco27 пре 7 година
родитељ
комит
f8cc37fb4d

BIN
images/icons/dnl.png


+ 4 - 0
includes/helpers.php

@@ -338,6 +338,10 @@ function removeOldGameConfigs(){ // Wrote this function in-case we rename config
 		'modules/config_games/server_configs/ins_win32.xml',
 		'modules/config_games/server_configs/ins.xml',
 		'modules/config_games/server_configs/insurgency.xml',
+		'modules/config_games/server_configs/left_4_dead.xml',
+		'modules/config_games/server_configs/left_4_dead2.xml',
+		'modules/config_games/server_configs/left_4_dead2_win.xml',
+		'modules/config_games/server_configs/warsow.xml',
 		'modules/config_games/server_configs/big_brother_bot.xml',
 		'modules/config_games/server_configs/big_brother_bot_win.xml',
 		'modules/config_games/server_configs/egs_win64.xml',

+ 1 - 1
lang/English/modules/addonsmanager.php

@@ -49,7 +49,7 @@ define('OGP_LANG_show_addons_for_selected_game', "Show Addons For Selected Game"
 define('OGP_LANG_linux_games', "Linux Games:");
 define('OGP_LANG_windows_games', "Windows Games:");
 define('OGP_LANG_create_addon', "Create Addon");
-define('OGP_LANG_addons_db', "Addons DataBase");
+define('OGP_LANG_addons_db', "Addons Database");
 define('OGP_LANG_addon_has_been_created', "The addon %s has been created.");
 define('OGP_LANG_remove_addon', "Remove Addon");
 define('OGP_LANG_fill_the_url_address_to_a_compressed_file', "Please, fill an URL address for a compressed file.");

+ 1 - 2
lang/English/modules/gamemanager.php

@@ -22,7 +22,6 @@
  *
  */
 
-define('OGP_LANG_game_manager', "Game Manager");
 define('OGP_LANG_no_games_to_monitor', "You do not have any games configured to you that can be monitored.");
 define('OGP_LANG_status', "Status");
 define('OGP_LANG_fail_no_mods', "No mods enabled for this game! You need to ask your OGP admin to add mod(s) for the game assigned for you.");
@@ -73,7 +72,7 @@ define('OGP_LANG_failed_to_start_rsync_update', "Failed to start Rsync update. S
 define('OGP_LANG_update_completed', "Update completed successfully.");
 define('OGP_LANG_update_in_progress', "Update in progress, please wait...");
 define('OGP_LANG_refresh_steam_status', "Refresh Steam status");
-define('OGP_LANG_refresh_rsync_status', "Refresh rsync status");
+define('OGP_LANG_refresh_rsync_status', "Refresh Rsync status");
 define('OGP_LANG_server_running_cant_update', "Server running so update is not possible. Stop the server before update.");
 define('OGP_LANG_xml_steam_error', "Selected server type does not support steam install/update.");
 define('OGP_LANG_mod_key_not_found_from_xml', "Mod key '%s' not found from the XML file.");

+ 1 - 0
modules/config_games/server_configs/arkse_linux64.xml

@@ -144,6 +144,7 @@
         echo "Generating new maplist file in $maplist!"
         touch $maplist
         echo Aberration_P> $maplist
+        echo Extinction>> $maplist
         echo Ragnarok>> $maplist
         echo ScorchedEarth_P>> $maplist
         echo TheCenter>> $maplist

+ 1 - 0
modules/config_games/server_configs/arkse_win64.xml

@@ -144,6 +144,7 @@
         echo "Generating new maplist file in $maplist!"
         touch $maplist
         echo Aberration_P> $maplist
+        echo Extinction>> $maplist
         echo Ragnarok>> $maplist
         echo ScorchedEarth_P>> $maplist
         echo TheCenter>> $maplist

+ 1 - 1
modules/config_games/server_configs/dayz_win64.xml

@@ -5,7 +5,7 @@
   <installer>steamcmd</installer>
   <game_name>DayZ</game_name>
   <server_exec_name>DayZServer_x64.exe</server_exec_name>
-  <query_port type="add">24714</query_port>
+  <query_port type="add">3</query_port>
   <cli_template>-config=serverDZ.cfg %PORT% -profiles="%HOME_PATH%/profiles" -dologs -adminlog -netlog %FC% %NFP% %CC%</cli_template>
   <cli_params>
     <cli_param id="PORT" cli_string="-port=" />

+ 0 - 0
modules/config_games/server_configs/left_4_dead2.xml → modules/config_games/server_configs/left4dead2_linux32.xml


+ 0 - 0
modules/config_games/server_configs/left_4_dead2_win.xml → modules/config_games/server_configs/left4dead2_win32.xml


+ 0 - 0
modules/config_games/server_configs/left_4_dead.xml → modules/config_games/server_configs/left4dead_linux32.xml


+ 1 - 1
modules/config_games/server_configs/warsow.xml → modules/config_games/server_configs/warsow_linux32.xml

@@ -75,4 +75,4 @@
 	  <string>kick %id%</string>
 	</command>
   </player_commands>
-</game_config>
+</game_config>

+ 1 - 1
protocol/TeamSpeak3/Helper/Convert.php

@@ -267,7 +267,7 @@ class TeamSpeak3_Helper_Convert
     }
     else
     {
-      $array["timestamp"] = strtotime(trim($parts[0]));
+      $array["timestamp"] = strtotime(trim($parts[0]) . " UTC");
       $array["level"]     = self::logLevel(trim($parts[1]));
       $array["channel"]   = trim($parts[2]);
       $array["server_id"] = trim($parts[3]);

+ 12 - 2
protocol/TeamSpeak3/Helper/String.php

@@ -26,7 +26,7 @@
  * @class TeamSpeak3_Helper_String
  * @brief Helper class for string handling.
  */
-class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
+class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable, JsonSerializable
 {
   /**
    * Stores the original string.
@@ -457,7 +457,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
     $pattern[] = "[\xF1-\xF3][\x80-\xBF]{3}";         // planes 4-15
     $pattern[] = "\xF4[\x80-\x8F][\x80-\xBF]{2}";     // plane 16
 
-    return boolval(preg_match("%(?:" . implode("|", $pattern) . ")+%xs", $this->string));
+    return (bool) preg_match("%(?:" . implode("|", $pattern) . ")+%xs", $this->string);
   }
 
   /**
@@ -850,6 +850,16 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
     return (string) $this->string;
   }
 
+  /**
+   *  Return UTF-8 encoded string to for serializing to JSON.
+   * 
+   * @return string
+   */
+  public function jsonSerialize()
+  {
+    return $this->toUtf8()->string;
+  }
+
   /**
    * @ignore
    */

+ 27 - 7
protocol/TeamSpeak3/Node/Host.php

@@ -130,6 +130,7 @@ class TeamSpeak3_Node_Host extends TeamSpeak3_Node_Abstract
    *
    * @param  integer $sid
    * @param  boolean $virtual
+   * @todo   remove additional clientupdate call (breaks compatibility with server versions <= 3.4.0)
    * @return void
    */
   public function serverSelect($sid, $virtual = null)
@@ -139,15 +140,22 @@ class TeamSpeak3_Node_Host extends TeamSpeak3_Node_Abstract
     $virtual = ($virtual !== null) ? $virtual : $this->start_offline_virtual;
     $getargs = func_get_args();
 
-    $this->execute("use", array("sid" => $sid, $virtual ? "-virtual" : null));
-
     if($sid != 0 && $this->predefined_query_name !== null)
     {
-      $this->execute("clientupdate", array("client_nickname" => (string) $this->predefined_query_name));
+      $this->execute("use", array("sid" => $sid, "client_nickname" => (string) $this->predefined_query_name, $virtual ? "-virtual" : null));
+    }
+    else
+    {
+      $this->execute("use", array("sid" => $sid, $virtual ? "-virtual" : null));
     }
 
     $this->whoamiReset();
 
+    if($sid != 0 && $this->predefined_query_name !== null && $this->whoamiGet("client_nickname") != $this->predefined_query_name)
+    {
+      $this->execute("clientupdate", array("client_nickname" => (string) $this->predefined_query_name));
+    }
+
     $this->setStorage("_server_use", array(__FUNCTION__, $getargs));
 
     TeamSpeak3_Helper_Signal::getInstance()->emit("notifyServerselected", $this);
@@ -170,6 +178,7 @@ class TeamSpeak3_Node_Host extends TeamSpeak3_Node_Abstract
    *
    * @param  integer $port
    * @param  boolean $virtual
+   * @todo   remove additional clientupdate call (breaks compatibility with server versions <= 3.4.0)
    * @return void
    */
   public function serverSelectByPort($port, $virtual = null)
@@ -179,15 +188,22 @@ class TeamSpeak3_Node_Host extends TeamSpeak3_Node_Abstract
     $virtual = ($virtual !== null) ? $virtual : $this->start_offline_virtual;
     $getargs = func_get_args();
 
-    $this->execute("use", array("port" => $port, $virtual ? "-virtual" : null));
-
     if($port != 0 && $this->predefined_query_name !== null)
     {
-      $this->execute("clientupdate", array("client_nickname" => (string) $this->predefined_query_name));
+      $this->execute("use", array("port" => $port, "client_nickname" => (string) $this->predefined_query_name, $virtual ? "-virtual" : null));
+    }
+    else
+    {
+      $this->execute("use", array("port" => $port, $virtual ? "-virtual" : null));
     }
 
     $this->whoamiReset();
 
+    if($port != 0 && $this->predefined_query_name !== null && $this->whoamiGet("client_nickname") != $this->predefined_query_name)
+    {
+      $this->execute("clientupdate", array("client_nickname" => (string) $this->predefined_query_name));
+    }
+
     $this->setStorage("_server_use", array(__FUNCTION__, $getargs));
 
     TeamSpeak3_Helper_Signal::getInstance()->emit("notifyServerselected", $this);
@@ -332,9 +348,13 @@ class TeamSpeak3_Node_Host extends TeamSpeak3_Node_Abstract
    */
   public function serverDelete($sid)
   {
-    $this->serverListReset();
+    if($sid == $this->serverSelectedId())
+    {
+      $this->serverDeselect();
+    }
 
     $this->execute("serverdelete", array("sid" => $sid));
+    $this->serverListReset();
 
     TeamSpeak3_Helper_Signal::getInstance()->emit("notifyServerdeleted", $this, $sid);
   }

+ 3 - 3
protocol/TeamSpeak3/Node/Server.php

@@ -918,8 +918,8 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
   }
 
   /**
-   * Bans the client specified with ID $clid from the server. Please note that this will create two separate
-   * ban rules for the targeted clients IP address and his unique identifier.
+   * Bans the client specified with ID $clid from the server. Please note that this will create three separate
+   * ban rules for the targeted clients IP address, the unique identifier and the myTeamSpeak ID (if available).
    *
    * @param  integer $clid
    * @param  integer $timeseconds
@@ -1919,7 +1919,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
 
     $detail = $this->request("serversnapshotdeploy -mapping " . $data)->toList();
 
-    if(array_key_exists("sid", $detail[0]))
+    if(isset($detail[0]["sid"]))
     {
       TeamSpeak3_Helper_Signal::getInstance()->emit("notifyServercreated", $this->getParent(), $detail[0]["sid"]);
 

+ 13 - 2
protocol/TeamSpeak3/TeamSpeak3.php

@@ -66,7 +66,7 @@ class TeamSpeak3
   /**
    * TeamSpeak 3 PHP Framework version.
    */
-  const LIB_VERSION = "1.1.33";
+  const LIB_VERSION = "1.1.34";
 
   /*@
    * TeamSpeak 3 protocol separators.
@@ -287,6 +287,8 @@ class TeamSpeak3
    * === Supported Options ===
    *   - timeout
    *   - blocking
+   *   - tls (TeaSpeak only)
+   *   - ssh (TeamSpeak only)
    *   - nickname
    *   - no_query_clients
    *   - use_offline_as_virtual
@@ -302,6 +304,9 @@ class TeamSpeak3
    *
    * === URI Examples ===
    *   - serverquery://127.0.0.1:10011/
+   *   - serverquery://127.0.0.1:10022/?ssh=1 (TeamSpeak ONLY)
+   *   - serverquery://127.0.0.1:10011/?tls=1 (TeaSpeak ONLY)
+   *   - serverquery://127.0.0.1:10022/?ssh=1&server_port=9987
    *   - serverquery://127.0.0.1:10011/?server_port=9987&channel_id=1
    *   - serverquery://127.0.0.1:10011/?server_port=9987&channel_id=1#no_query_clients
    *   - serverquery://127.0.0.1:10011/?server_port=9987&client_name=ScP
@@ -320,10 +325,16 @@ class TeamSpeak3
     $uri = new TeamSpeak3_Helper_Uri($uri);
 
     $adapter = self::getAdapterName($uri->getScheme());
-    $options = array("host" => $uri->getHost(), "port" => $uri->getPort(), "timeout" => (int) $uri->getQueryVar("timeout", 10), "blocking" => (int) $uri->getQueryVar("blocking", 1), "tls" => (int) $uri->getQueryVar("tls", 0));
+    $options = array("host" => $uri->getHost(), "port" => $uri->getPort(), "timeout" => (int) $uri->getQueryVar("timeout", 10), "blocking" => (int) $uri->getQueryVar("blocking", 1), "tls" => (int) $uri->getQueryVar("tls", 0), "ssh" => (int) $uri->getQueryVar("ssh", 0));
 
     self::loadClass($adapter);
 
+    if($options["ssh"])
+    {
+      $options["username"] = $uri->getUser();
+      $options["password"] = $uri->getPass();
+    }
+
     $object = new $adapter($options);
 
     if($object instanceof TeamSpeak3_Adapter_ServerQuery)

+ 7 - 0
protocol/TeamSpeak3/Transport/Abstract.php

@@ -42,6 +42,13 @@ abstract class TeamSpeak3_Transport_Abstract
    */
   protected $stream = null;
 
+  /**
+   * Stores an optional stream session for the connection.
+   * 
+   * @var session
+   */
+  protected $session = null;
+
   /**
    * Stores the TeamSpeak3_Adapter_Abstract object using this transport.
    *

+ 43 - 13
protocol/TeamSpeak3/Transport/TCP.php

@@ -38,27 +38,52 @@ class TeamSpeak3_Transport_TCP extends TeamSpeak3_Transport_Abstract
   {
     if($this->stream !== null) return;
 
-    $host = strval($this->config["host"]);
-    $port = strval($this->config["port"]);
+    $host     = strval($this->config["host"]);
+    $port     = strval($this->config["port"]);
+    $timeout  = intval($this->config["timeout"]);
+    $blocking = intval($this->config["blocking"]);
 
-    $address = "tcp://" . (strstr($host, ":") !== FALSE ? "[" . $host . "]" : $host) . ":" . $port;
-    $options = empty($this->config["tls"]) ? array() : array("ssl" => array("allow_self_signed" => TRUE, "verify_peer" => FALSE, "verify_peer_name" => FALSE));
-    $timeout = (int) $this->config["timeout"];
+    if(empty($this->config["ssh"]))
+    {
+      $address = "tcp://" . (strstr($host, ":") !== FALSE ? "[" . $host . "]" : $host) . ":" . $port;
+      $options = empty($this->config["tls"]) ? array() : array("ssl" => array("allow_self_signed" => TRUE, "verify_peer" => FALSE, "verify_peer_name" => FALSE));
 
-    $this->stream = @stream_socket_client($address, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, stream_context_create($options));
+      $this->stream = @stream_socket_client($address, $errno, $errstr, $this->config["timeout"], STREAM_CLIENT_CONNECT, stream_context_create($options));
 
-    if($this->stream === FALSE)
-    {
-      throw new TeamSpeak3_Transport_Exception(TeamSpeak3_Helper_String::factory($errstr)->toUtf8()->toString(), $errno);
-    }
+      if($this->stream === FALSE)
+      {
+        throw new TeamSpeak3_Transport_Exception(TeamSpeak3_Helper_String::factory($errstr)->toUtf8()->toString(), $errno);
+      }
 
-    if(!empty($this->config["tls"]))
+      if(!empty($this->config["tls"]))
+      {
+        stream_socket_enable_crypto($this->stream, TRUE, STREAM_CRYPTO_METHOD_SSLv23_CLIENT);
+      }
+    }
+    else
     {
-      stream_socket_enable_crypto($this->stream, TRUE, STREAM_CRYPTO_METHOD_SSLv23_CLIENT);
+      $this->session = @ssh2_connect($host, $port);
+
+      if($this->session === FALSE)
+      {
+        throw new TeamSpeak3_Transport_Exception("failed to establish secure shell connection to server '" . $this->config["host"] . ":" . $this->config["port"] . "'");
+      }
+
+      if(!@ssh2_auth_password($this->session, $this->config["username"], $this->config["password"]))
+      {
+        throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid loginname or password", 0x208);
+      }
+
+      $this->stream = @ssh2_shell($this->session, "raw");
+
+      if($this->stream === FALSE)
+      {
+        throw new TeamSpeak3_Transport_Exception("failed to open a secure shell on server '" . $this->config["host"] . ":" . $this->config["port"] . "'");
+      }
     }
 
     @stream_set_timeout($this->stream, $timeout);
-    @stream_set_blocking($this->stream, $this->config["blocking"] ? 1 : 0);
+    @stream_set_blocking($this->stream, $blocking ? 1 : 0);
   }
 
   /**
@@ -72,6 +97,11 @@ class TeamSpeak3_Transport_TCP extends TeamSpeak3_Transport_Abstract
 
     $this->stream = null;
 
+    if(is_resource($this->session))
+    {
+      @ssh2_disconnect($this->session);
+    }
+
     TeamSpeak3_Helper_Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "Disconnected");
   }
 

+ 8 - 4
protocol/lgsl/lgsl_protocol.php

@@ -61,10 +61,11 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
 		"doomzdaemon"	=> "Doom - ZDaemon",
 		"doom3"			=> "Doom 3",
 		"dh2005"		=> "Deer Hunter 2005",
+		"dnl"			=> "Dark and Light",
 		"empyriongs"	=> "Empyrion - Galactic Survival",
 		"farcry"		=> "Far Cry",
 		"fear"			=> "F.E.A.R.",
-		"fivem"			=>	"GTA FiveM",
+		"fivem"			=> "GTA FiveM",
 		"flashpoint"	=> "Operation Flashpoint",
 		"freelancer"	=> "Freelancer",
 		"frontlines"	=> "Frontlines: Fuel Of War",
@@ -212,6 +213,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
 		"doomzdaemon"	=> "28",
 		"doom3"			=> "10",
 		"dh2005"		=> "09",
+		"dnl"			=> "05",
 		"empyriongs"	=> "05",
 		"had2"			=> "03",
 		"halflife"		=> "05",
@@ -324,7 +326,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
 
 		return $lgsl_protocol_list;
 	}
-	 
+
 //------------------------------------------------------------------------------------------------------------+
 //------------------------------------------------------------------------------------------------------------+
 
@@ -371,6 +373,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
 		"doomzdaemon"	=> "http://www.zdaemon.org",
 		"doom3"			=> "qtracker://{IP}:{S_PORT}?game=Doom3&action=show",
 		"dh2005"		=> "http://en.wikipedia.org/wiki/Deer_Hunter_(computer_game)",
+		"dnl"			=> "steam://connect/{IP}:{Q_PORT}",
 		"empyriongs"	=> "steam://connect/{IP}:{Q_PORT}",
 		"farcry"		=> "qtracker://{IP}:{S_PORT}?game=FarCry&action=show",
 		"fear"			=> "qtracker://{IP}:{S_PORT}?game=FEAR&action=show",
@@ -510,10 +513,11 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
 			case "citadelfwf"		: $c_to_q = 19238;	$c_def = 7777;	$q_def = 27015;	$c_to_s = 0;	break;
 			case "conanexiles"		: $c_to_q = 19238;	$c_def = 7777;	$q_def = 27015;	$c_to_s = 0;	break;
 			case "cube"				: $c_to_q = 1;		$c_def = 28785;	$q_def = 28786;	$c_to_s = 0;	break;
-			case "dayz"				: $c_to_q = 24714;	$c_def = 2302;	$q_def = 27016;	$c_to_s = 0;	break;
+			case "dayz"				: $c_to_q = 3;		$c_def = 2302;	$q_def = 2305;	$c_to_s = 0;	break;
 			case "dayzmod"			: $c_to_q = 1;		$c_def = 2302;	$q_def = 2303;	$c_to_s = 0;	break;
-			case "empyriongs"		: $c_to_q = 1;		$c_def = 30000;	$q_def = 30001; $c_to_s = 0;	break;
 			case "dh2005"			: $c_to_q = 0;		$c_def = 23459;	$q_def = 34567;	$c_to_s = 0;	break;
+			case "dnl"				: $c_to_q = 19238;	$c_def = 7777;	$q_def = 27015;	$c_to_s = 0;	break;
+			case "empyriongs"		: $c_to_q = 1;		$c_def = 30000;	$q_def = 30001; $c_to_s = 0;	break;
 			case "farcry"			: $c_to_q = 123;	$c_def = 49001;	$q_def = 49124;	$c_to_s = 0;	break;
 			case "flashpoint"		: $c_to_q = 1;		$c_def = 2302;	$q_def = 2303;	$c_to_s = 0;	break;
 			case "frontlines"		: $c_to_q = 2;		$c_def = 5476;	$q_def = 5478;	$c_to_s = 0;	break;