Apply automated PHP8 safety transforms
Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/89922108-1604-44ae-949d-358d32b9d70a Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
aca850b6cd
commit
e44519c030
465 changed files with 1716 additions and 1716 deletions
|
|
@ -275,7 +275,7 @@ class Buffer
|
|||
|
||||
// Get position of delimiters
|
||||
$pos = [];
|
||||
foreach ($delims as $delim) {
|
||||
foreach ((array)$delims as $delim) {
|
||||
if ($p = strpos($this->data, $delim, min($this->index, $this->length))) {
|
||||
$pos[] = $p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,9 +61,9 @@ class Normalize extends Base
|
|||
$result = array_merge($result, $this->check('general', $result));
|
||||
|
||||
// Do player information
|
||||
if (isset($result['players']) && count($result['players']) > 0) {
|
||||
if (isset($result['players']) && count((array)$result['players']) > 0) {
|
||||
// Iterate
|
||||
foreach ($result['players'] as $key => $player) {
|
||||
foreach ((array)$result['players'] as $key => $player) {
|
||||
$result['players'][$key] = array_merge($player, $this->check('player', $player));
|
||||
}
|
||||
} else {
|
||||
|
|
@ -71,9 +71,9 @@ class Normalize extends Base
|
|||
}
|
||||
|
||||
// Do team information
|
||||
if (isset($result['teams']) && count($result['teams']) > 0) {
|
||||
if (isset($result['teams']) && count((array)$result['teams']) > 0) {
|
||||
// Iterate
|
||||
foreach ($result['teams'] as $key => $team) {
|
||||
foreach ((array)$result['teams'] as $key => $team) {
|
||||
$result['teams'][$key] = array_merge($team, $this->check('team', $team));
|
||||
}
|
||||
} else {
|
||||
|
|
@ -111,15 +111,15 @@ class Normalize extends Base
|
|||
|
||||
if (is_array($raw)) {
|
||||
// Iterate over the raw property we want to use
|
||||
foreach ($raw as $check) {
|
||||
if (array_key_exists($check, $data)) {
|
||||
foreach ((array)$raw as $check) {
|
||||
if (array_key_exists($check, (array)$data)) {
|
||||
$value = $data[$check];
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// String
|
||||
if (array_key_exists($raw, $data)) {
|
||||
if (array_key_exists($raw, (array)$data)) {
|
||||
$value = $data[$raw];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class Secondstohuman extends Base
|
|||
public function __construct(array $options = [])
|
||||
{
|
||||
// Check for passed keys
|
||||
if (!array_key_exists(self::OPTION_TIMEKEYS, $options)) {
|
||||
if (!array_key_exists(self::OPTION_TIMEKEYS, (array)$options)) {
|
||||
// Use default
|
||||
$options[self::OPTION_TIMEKEYS] = $this->timeKeysDefault;
|
||||
} else {
|
||||
|
|
@ -98,7 +98,7 @@ class Secondstohuman extends Base
|
|||
protected function iterate(array &$result)
|
||||
{
|
||||
// Iterate over the results
|
||||
foreach ($result as $key => $value) {
|
||||
foreach ((array)$result as $key => $value) {
|
||||
// Offload to itself if we have another array
|
||||
if (is_array($value)) {
|
||||
// Iterate and update the result
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ class GameQ
|
|||
{
|
||||
|
||||
// Loop through all the servers and add them
|
||||
foreach ($servers as $server_info) {
|
||||
foreach ((array)$servers as $server_info) {
|
||||
$this->addServer($server_info);
|
||||
}
|
||||
|
||||
|
|
@ -230,7 +230,7 @@ class GameQ
|
|||
}
|
||||
|
||||
// Iterate over the file(s) and add them
|
||||
foreach ($files as $file) {
|
||||
foreach ((array)$files as $file) {
|
||||
// Check to make sure the file exists and we can read it
|
||||
if (!file_exists($file) || !is_readable($file)) {
|
||||
continue;
|
||||
|
|
@ -442,7 +442,7 @@ class GameQ
|
|||
);
|
||||
|
||||
// Iterate over the challenge responses
|
||||
foreach ($responses as $socket_id => $response) {
|
||||
foreach ((array)$responses as $socket_id => $response) {
|
||||
// Back out the server_id we need to update the challenge response for
|
||||
$server_id = $sockets[$socket_id]['server_id'];
|
||||
|
||||
|
|
@ -484,7 +484,7 @@ class GameQ
|
|||
// Get all the non-challenge packets we need to send
|
||||
$packets = $server->protocol()->getPacket('!' . Protocol::PACKET_CHALLENGE);
|
||||
|
||||
if (count($packets) == 0) {
|
||||
if (count((array)$packets) == 0) {
|
||||
// Skip nothing else to do for some reason.
|
||||
continue;
|
||||
}
|
||||
|
|
@ -505,7 +505,7 @@ class GameQ
|
|||
|
||||
try {
|
||||
// Iterate over all the packets we need to send
|
||||
foreach ($packets as $packet_data) {
|
||||
foreach ((array)$packets as $packet_data) {
|
||||
// Now write the packet to the socket.
|
||||
$socket->write($packet_data);
|
||||
|
||||
|
|
@ -540,7 +540,7 @@ class GameQ
|
|||
);
|
||||
|
||||
// Iterate over the responses
|
||||
foreach ($responses as $socket_id => $response) {
|
||||
foreach ((array)$responses as $socket_id => $response) {
|
||||
// Back out the server_id
|
||||
$server_id = $sockets[$socket_id]['server_id'];
|
||||
|
||||
|
|
@ -555,7 +555,7 @@ class GameQ
|
|||
}
|
||||
|
||||
// Now we need to close all of the sockets
|
||||
foreach ($sockets as $socketInfo) {
|
||||
foreach ((array)$sockets as $socketInfo) {
|
||||
/* @var $socket \GameQ\Query\Core */
|
||||
$socket = $socketInfo['socket'];
|
||||
|
||||
|
|
@ -594,7 +594,7 @@ class GameQ
|
|||
$results = $server->protocol()->processResponse();
|
||||
|
||||
// Check for online before we do anything else
|
||||
$results['gq_online'] = (count($results) > 0);
|
||||
$results['gq_online'] = (count((array)$results) > 0);
|
||||
} catch (ProtocolException $e) {
|
||||
// Check to see if we are in debug, if so bubble up the exception
|
||||
if ($this->debug) {
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ class Bf3 extends Protocol
|
|||
unset($buffer, $sequence_id_last, $sequence_id);
|
||||
|
||||
// Iterate over the combined packets and do some work
|
||||
foreach ($processed as $sequence_id => $data) {
|
||||
foreach ((array)$processed as $sequence_id => $data) {
|
||||
// Create a new buffer
|
||||
$buffer = new Buffer($data);
|
||||
|
||||
|
|
@ -338,7 +338,7 @@ class Bf3 extends Protocol
|
|||
// Iterate over the index until we run out of players
|
||||
for ($i = 0, $x = $numTags + 3; $i < $playerCount; $i++, $x += $numTags) {
|
||||
// Loop over the player tags and extract the info for that tag
|
||||
foreach ($tags as $index => $tag) {
|
||||
foreach ((array)$tags as $index => $tag) {
|
||||
$result->addPlayer($tag, $items[($x + $index)]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ class Bfbc2 extends Protocol
|
|||
// Iterate over the index until we run out of players
|
||||
for ($i = 0, $x = $numTags + 3; $i < $playerCount; $i++, $x += $numTags) {
|
||||
// Loop over the player tags and extract the info for that tag
|
||||
foreach ($tags as $index => $tag) {
|
||||
foreach ((array)$tags as $index => $tag) {
|
||||
$result->addPlayer($tag, $items[($x + $index)]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class Cs2d extends Protocol
|
|||
$responses = explode(substr($this->packets[$packet], 2), $buffer->getData());
|
||||
|
||||
// Try to rebuild the second packet to the same as if it was sent as two separate responses
|
||||
$responses[1] = $this->packets[$packet] . ((count($responses) === 2) ? $responses[1] : "");
|
||||
$responses[1] = $this->packets[$packet] . ((count((array)$responses) === 2) ? $responses[1] : "");
|
||||
|
||||
unset($buffer);
|
||||
} else {
|
||||
|
|
@ -142,7 +142,7 @@ class Cs2d extends Protocol
|
|||
$packets = [];
|
||||
|
||||
// We need to pre-sort these for split packets so we can do extra work where needed
|
||||
foreach ($responses as $response) {
|
||||
foreach ((array)$responses as $response) {
|
||||
$buffer = new Buffer($response);
|
||||
|
||||
// Pull out the header
|
||||
|
|
@ -157,7 +157,7 @@ class Cs2d extends Protocol
|
|||
$results = [];
|
||||
|
||||
// Now let's iterate and process
|
||||
foreach ($packets as $header => $packetGroup) {
|
||||
foreach ((array)$packets as $header => $packetGroup) {
|
||||
// Figure out which packet response this is
|
||||
if (!array_key_exists($header, $this->responses)) {
|
||||
throw new Exception(__METHOD__ . " response type '" . bin2hex($header) . "' is not valid");
|
||||
|
|
|
|||
|
|
@ -138,10 +138,10 @@ class Gamespy extends Protocol
|
|||
$numPlayers = 0;
|
||||
$numTeams = 0;
|
||||
|
||||
$itemCount = count($data);
|
||||
$itemCount = count((array)$data);
|
||||
|
||||
// Check to make sure we have more than 1 item in the array before trying to loop
|
||||
if (count($data) > 1) {
|
||||
if (count((array)$data) > 1) {
|
||||
// Now lets loop the array since we have items
|
||||
for ($x = 0; $x < $itemCount; $x += 2) {
|
||||
// Set some local vars
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ class Gamespy2 extends Protocol
|
|||
$results = [];
|
||||
|
||||
// Now let's iterate and process
|
||||
foreach ($packets as $header => $packetGroup) {
|
||||
foreach ((array)$packets as $header => $packetGroup) {
|
||||
// Figure out which packet response this is
|
||||
if (!array_key_exists($header, $this->responses)) {
|
||||
throw new Exception(__METHOD__ . " response type '" . bin2hex($header) . "' is not valid");
|
||||
|
|
@ -255,7 +255,7 @@ class Gamespy2 extends Protocol
|
|||
|
||||
// Get the values
|
||||
while ($buffer->getLength() > 4) {
|
||||
foreach ($varNames as $varName) {
|
||||
foreach ((array)$varNames as $varName) {
|
||||
$result->addSub($dataType, utf8_encode($varName), utf8_encode($buffer->readString()));
|
||||
}
|
||||
if ($buffer->lookAhead() === "\x00") {
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ class Gamespy3 extends Protocol
|
|||
$this->processDetails($buffer, $result);
|
||||
|
||||
// The rest should be the player and team information, if it exists
|
||||
if (array_key_exists(1, $split)) {
|
||||
if (array_key_exists(1, (array)$split)) {
|
||||
$buffer = new Buffer($split[1], Buffer::NUMBER_TYPE_BIGENDIAN);
|
||||
$this->processPlayersAndTeams($buffer, $result);
|
||||
}
|
||||
|
|
@ -194,7 +194,7 @@ class Gamespy3 extends Protocol
|
|||
{
|
||||
|
||||
// Get the number of packets
|
||||
$packetCount = count($packets);
|
||||
$packetCount = count((array)$packets);
|
||||
|
||||
// Compare last var of current packet with first var of next packet
|
||||
// On a partial match, remove last var from current packet,
|
||||
|
|
@ -282,7 +282,7 @@ class Gamespy3 extends Protocol
|
|||
$item_type = '';
|
||||
|
||||
// Save count as variable
|
||||
$count = count($data);
|
||||
$count = count((array)$data);
|
||||
|
||||
// Loop through all of the $data for information and pull it out into the result
|
||||
for ($x = 0; $x < $count - 1; $x++) {
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ class Gta5m extends Protocol
|
|||
// No longer needed
|
||||
unset($buffer);
|
||||
|
||||
$itemCount = count($data);
|
||||
$itemCount = count((array)$data);
|
||||
|
||||
// Now lets loop the array
|
||||
for ($x = 0; $x < $itemCount; $x += 2) {
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class Lhmp extends Protocol
|
|||
$results = [];
|
||||
|
||||
// Now let's iterate and process
|
||||
foreach ($packets as $header => $packetGroup) {
|
||||
foreach ((array)$packets as $header => $packetGroup) {
|
||||
// Figure out which packet response this is
|
||||
if (!array_key_exists($header, $this->responses)) {
|
||||
throw new Exception(__METHOD__ . " response type '{$header}' is not valid");
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ class Mumble extends Protocol
|
|||
$result->add('dedicated', 1);
|
||||
|
||||
// Let's iterate over the response items, there are a lot
|
||||
foreach ($data as $key => $value) {
|
||||
foreach ((array)$data as $key => $value) {
|
||||
// Ignore root for now, that is where all of the channel/player info is housed
|
||||
if (in_array($key, ['root'])) {
|
||||
continue;
|
||||
|
|
@ -168,7 +168,7 @@ class Mumble extends Protocol
|
|||
{
|
||||
|
||||
// Let's add all of the channel information
|
||||
foreach ($data as $key => $value) {
|
||||
foreach ((array)$data as $key => $value) {
|
||||
// We will handle these later
|
||||
if (in_array($key, ['channels', 'users'])) {
|
||||
// skip
|
||||
|
|
@ -180,14 +180,14 @@ class Mumble extends Protocol
|
|||
}
|
||||
|
||||
// Itereate over the users in this channel
|
||||
foreach ($data['users'] as $user) {
|
||||
foreach ($user as $key => $value) {
|
||||
foreach ((array)$data['users'] as $user) {
|
||||
foreach ((array)$user as $key => $value) {
|
||||
$result->addPlayer($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
// Offload more channels to parse
|
||||
foreach ($data['channels'] as $channel) {
|
||||
foreach ((array)$data['channels'] as $channel) {
|
||||
$this->processChannelsAndUsers($channel, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ class Source extends Protocol
|
|||
unset($response, $packet_id, $buffer, $header);
|
||||
|
||||
// Now that we have the packets sorted we need to iterate and process them
|
||||
foreach ($packets as $packet_id => $packet) {
|
||||
foreach ((array)$packets as $packet_id => $packet) {
|
||||
// We first need to off load split packets to combine them
|
||||
if (is_array($packet)) {
|
||||
$buffer = new Buffer($this->processPackets($packet_id, $packet));
|
||||
|
|
@ -244,7 +244,7 @@ class Source extends Protocol
|
|||
$packs = [];
|
||||
|
||||
// We have multiple packets so we need to get them and order them
|
||||
foreach ($packets as $i => $packet) {
|
||||
foreach ((array)$packets as $i => $packet) {
|
||||
// Make a buffer so we can read this info
|
||||
$buffer = new Buffer($packet);
|
||||
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ class Teamspeak2 extends Protocol
|
|||
$result = new Result();
|
||||
|
||||
// Now we need to iterate over the sections and off load the processing
|
||||
foreach ($sections as $section) {
|
||||
foreach ((array)$sections as $section) {
|
||||
// Grab a snip of the data so we can figure out what it is
|
||||
$check = substr($section, 0, 7);
|
||||
|
||||
|
|
@ -247,7 +247,7 @@ class Teamspeak2 extends Protocol
|
|||
// Explode and merge the data with the columns, then parse
|
||||
$data = array_combine($columns, explode("\t", $row, 9));
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
foreach ((array)$data as $key => $value) {
|
||||
// Now add the data to the result
|
||||
$result->addTeam($key, utf8_encode($value));
|
||||
}
|
||||
|
|
@ -279,7 +279,7 @@ class Teamspeak2 extends Protocol
|
|||
// Explode and merge the data with the columns, then parse
|
||||
$data = array_combine($columns, explode("\t", $row, 16));
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
foreach ((array)$data as $key => $value) {
|
||||
// Now add the data to the result
|
||||
$result->addPlayer($key, utf8_encode($value));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ class Teamspeak3 extends Protocol
|
|||
$result = new Result();
|
||||
|
||||
// Iterate over the sections and offload the parsing
|
||||
foreach ($sections as $section) {
|
||||
foreach ((array)$sections as $section) {
|
||||
// Grab a snip of the data so we can figure out what it is
|
||||
$check = substr(trim($section), 0, 4);
|
||||
|
||||
|
|
@ -226,7 +226,7 @@ class Teamspeak3 extends Protocol
|
|||
$items = explode(' ', $data);
|
||||
|
||||
// Iterate over the items
|
||||
foreach ($items as $item) {
|
||||
foreach ((array)$items as $item) {
|
||||
// Explode and make sure we always have 2 items in the array
|
||||
list($key, $value) = array_pad(explode('=', $item, 2), 2, '');
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ class Teamspeak3 extends Protocol
|
|||
$result->add('dedicated', 1);
|
||||
|
||||
// Iterate over the properties
|
||||
foreach ($properties as $key => $value) {
|
||||
foreach ((array)$properties as $key => $value) {
|
||||
$result->add($key, $value);
|
||||
}
|
||||
|
||||
|
|
@ -287,12 +287,12 @@ class Teamspeak3 extends Protocol
|
|||
$channels = explode('|', $data);
|
||||
|
||||
// Iterate over the channels
|
||||
foreach ($channels as $channel) {
|
||||
foreach ((array)$channels as $channel) {
|
||||
// Offload the parsing for these values
|
||||
$properties = $this->processProperties($channel);
|
||||
|
||||
// Iterate over the properties
|
||||
foreach ($properties as $key => $value) {
|
||||
foreach ((array)$properties as $key => $value) {
|
||||
$result->addTeam($key, $value);
|
||||
}
|
||||
}
|
||||
|
|
@ -313,12 +313,12 @@ class Teamspeak3 extends Protocol
|
|||
$players = explode('|', $data);
|
||||
|
||||
// Iterate over the channels
|
||||
foreach ($players as $player) {
|
||||
foreach ((array)$players as $player) {
|
||||
// Offload the parsing for these values
|
||||
$properties = $this->processProperties($player);
|
||||
|
||||
// Iterate over the properties
|
||||
foreach ($properties as $key => $value) {
|
||||
foreach ((array)$properties as $key => $value) {
|
||||
$result->addPlayer($key, $value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class Unreal2 extends Protocol
|
|||
$results = [];
|
||||
|
||||
// Now let's iterate and process
|
||||
foreach ($packets as $header => $packetGroup) {
|
||||
foreach ((array)$packets as $header => $packetGroup) {
|
||||
// Figure out which packet response this is
|
||||
if (!array_key_exists($header, $this->responses)) {
|
||||
throw new Exception(__METHOD__ . " response type '" . bin2hex($header) . "' is not valid");
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ class Ut3 extends Gamespy3
|
|||
protected function deleteResult(array &$result, array $array)
|
||||
{
|
||||
|
||||
foreach ($array as $key) {
|
||||
foreach ((array)$array as $key) {
|
||||
unset($result[$key]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ class Ventrilo extends Protocol
|
|||
$playerFields = 7;
|
||||
|
||||
// Iterate over the lines
|
||||
foreach ($lines as $line) {
|
||||
foreach ((array)$lines as $line) {
|
||||
// Trim all the outlying space
|
||||
$line = trim($line);
|
||||
|
||||
|
|
@ -754,7 +754,7 @@ class Ventrilo extends Protocol
|
|||
// This will be returned
|
||||
$decrypted = [];
|
||||
|
||||
foreach ($packets as $packet) {
|
||||
foreach ((array)$packets as $packet) {
|
||||
# Header :
|
||||
$header = substr($packet, 0, 20);
|
||||
|
||||
|
|
@ -775,7 +775,7 @@ class Ventrilo extends Protocol
|
|||
|
||||
$table = $this->head_encrypt_table;
|
||||
|
||||
$characterCount = count($chars);
|
||||
$characterCount = count((array)$chars);
|
||||
|
||||
$key = 0;
|
||||
for ($i = 1; $i <= $characterCount; $i++) {
|
||||
|
|
@ -801,7 +801,7 @@ class Ventrilo extends Protocol
|
|||
], $header_items);
|
||||
|
||||
// Check to make sure the number of packets match
|
||||
if ($header_items['totpck'] != count($packets)) {
|
||||
if ($header_items['totpck'] != count((array)$packets)) {
|
||||
throw new Exception(__METHOD__ . ": Too few packets received");
|
||||
}
|
||||
|
||||
|
|
@ -816,7 +816,7 @@ class Ventrilo extends Protocol
|
|||
|
||||
$chars = unpack("C*", substr($packet, 20));
|
||||
$data = "";
|
||||
$characterCount = count($chars);
|
||||
$characterCount = count((array)$chars);
|
||||
|
||||
for ($i = 1; $i <= $characterCount; $i++) {
|
||||
$chars[$i] -= ($table[$a2] + (($i - 1) % 72)) & 0xFF;
|
||||
|
|
@ -845,7 +845,7 @@ class Ventrilo extends Protocol
|
|||
$items = explode(",", $data, $fieldCount);
|
||||
|
||||
// Iterate over the items for this channel
|
||||
foreach ($items as $item) {
|
||||
foreach ((array)$items as $item) {
|
||||
// Split the key=value pair
|
||||
list($key, $value) = explode("=", $item, 2);
|
||||
|
||||
|
|
@ -867,7 +867,7 @@ class Ventrilo extends Protocol
|
|||
$items = explode(",", $data, $fieldCount);
|
||||
|
||||
// Iterate over the items for this player
|
||||
foreach ($items as $item) {
|
||||
foreach ((array)$items as $item) {
|
||||
// Split the key=value pair
|
||||
list($key, $value) = explode("=", $item, 2);
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ class Native extends Core
|
|||
$sockets_tmp = [];
|
||||
|
||||
// Loop and pull out all the actual sockets we need to listen on
|
||||
foreach ($sockets as $socket_id => $socket_data) {
|
||||
foreach ((array)$sockets as $socket_id => $socket_data) {
|
||||
// Get the socket
|
||||
/* @var $socket \GameQ\Query\Core */
|
||||
$socket = $socket_data['socket'];
|
||||
|
|
@ -189,7 +189,7 @@ class Native extends Core
|
|||
}
|
||||
|
||||
// Loop the sockets that received data back
|
||||
foreach ($read as $socket) {
|
||||
foreach ((array)$read as $socket) {
|
||||
/* @var $socket resource */
|
||||
|
||||
// See if we have a response
|
||||
|
|
|
|||
|
|
@ -108,12 +108,12 @@ class Server
|
|||
{
|
||||
|
||||
// Check for server type
|
||||
if (!array_key_exists(self::SERVER_TYPE, $server_info) || empty($server_info[self::SERVER_TYPE])) {
|
||||
if (!array_key_exists(self::SERVER_TYPE, (array)$server_info) || empty($server_info[self::SERVER_TYPE])) {
|
||||
throw new Exception("Missing server info key '" . self::SERVER_TYPE . "'!");
|
||||
}
|
||||
|
||||
// Check for server host
|
||||
if (!array_key_exists(self::SERVER_HOST, $server_info) || empty($server_info[self::SERVER_HOST])) {
|
||||
if (!array_key_exists(self::SERVER_HOST, (array)$server_info) || empty($server_info[self::SERVER_HOST])) {
|
||||
throw new Exception("Missing server info key '" . self::SERVER_HOST . "'!");
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ class Server
|
|||
$this->checkAndSetIpPort($server_info[self::SERVER_HOST]);
|
||||
|
||||
// Check for server id
|
||||
if (array_key_exists(self::SERVER_ID, $server_info) && !empty($server_info[self::SERVER_ID])) {
|
||||
if (array_key_exists(self::SERVER_ID, (array)$server_info) && !empty($server_info[self::SERVER_ID])) {
|
||||
// Set the server id
|
||||
$this->id = $server_info[self::SERVER_ID];
|
||||
} else {
|
||||
|
|
@ -130,7 +130,7 @@ class Server
|
|||
}
|
||||
|
||||
// Check and set server options
|
||||
if (array_key_exists(self::SERVER_OPTIONS, $server_info)) {
|
||||
if (array_key_exists(self::SERVER_OPTIONS, (array)$server_info)) {
|
||||
// Set the options
|
||||
$this->options = $server_info[self::SERVER_OPTIONS];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ function print_player_list_gameq($player_list,$numplayers,$numplayersmax)
|
|||
|
||||
$data = "<table class='player_monitor'>";
|
||||
$data .= "<thead><tr>";
|
||||
foreach($player_list as $id => $player)
|
||||
foreach ((array)$player_list as $id => $player)
|
||||
{
|
||||
$maxcount = 0;
|
||||
foreach($player as $td => $column)
|
||||
foreach ((array)$player as $td => $column)
|
||||
{
|
||||
if($column != null)
|
||||
{
|
||||
|
|
@ -43,7 +43,7 @@ function print_player_list_gameq($player_list,$numplayers,$numplayersmax)
|
|||
}
|
||||
}
|
||||
|
||||
foreach($player_list[$maxid] as $td => $column)
|
||||
foreach ((array)$player_list[$maxid] as $td => $column)
|
||||
{
|
||||
if($column != "" )
|
||||
{
|
||||
|
|
@ -54,9 +54,9 @@ function print_player_list_gameq($player_list,$numplayers,$numplayersmax)
|
|||
}
|
||||
$data .= "</tr></thead>";
|
||||
$data .= "<tbody>";
|
||||
foreach ( $player_list as $player ){
|
||||
foreach ((array)$player_list as $player){
|
||||
$data .= "<tr>";
|
||||
foreach($player_list[$maxid] as $maxtd => $maxcolumn)
|
||||
foreach ((array)$player_list[$maxid] as $maxtd => $maxcolumn)
|
||||
{
|
||||
if(isset($player[$maxtd]))
|
||||
$data .= "<td>".htmlentities($player[$maxtd])."</td>";
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ class GameQ_Buffer
|
|||
{
|
||||
// Get position of delimiters
|
||||
$pos = array();
|
||||
foreach ($delims as $delim) {
|
||||
foreach ((array)$delims as $delim) {
|
||||
if ($p = strpos($this->data, $delim, min($this->index, $this->length))) {
|
||||
$pos[] = $p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ abstract class GameQ_Filters_Core
|
|||
{
|
||||
if(is_array($params))
|
||||
{
|
||||
foreach ($params as $key => $param)
|
||||
foreach ((array)$params as $key => $param)
|
||||
{
|
||||
$this->params[$key] = $param;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,12 +90,12 @@ class GameQ_Filters_Normalise extends GameQ_Filters
|
|||
// Don't rename the players array
|
||||
$result['players'] = $result['gq_players'];
|
||||
|
||||
foreach ($result['players'] as $key => $player)
|
||||
foreach ((array)$result['players'] as $key => $player)
|
||||
{
|
||||
$result['players'][$key] = array_merge($player, $this->normalize($player, 'player'));
|
||||
}
|
||||
|
||||
$result['gq_numplayers'] = count($result['players']);
|
||||
$result['gq_numplayers'] = count((array)$result['players']);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -108,12 +108,12 @@ class GameQ_Filters_Normalise extends GameQ_Filters
|
|||
// Don't rename the teams array
|
||||
$result['teams'] = $result['gq_teams'];
|
||||
|
||||
foreach ($result['teams'] as $key => $team)
|
||||
foreach ((array)$result['teams'] as $key => $team)
|
||||
{
|
||||
$result['teams'][$key] = array_merge($team, $this->normalize($team, 'team'));
|
||||
}
|
||||
|
||||
$result['gq_numteams'] = count($result['teams']);
|
||||
$result['gq_numteams'] = count((array)$result['teams']);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -153,12 +153,12 @@ class GameQ_Filters_Normalise extends GameQ_Filters
|
|||
// Create a new array, with all the specified variables
|
||||
$new = $this->fill($props);
|
||||
|
||||
foreach ($data as $var => $value)
|
||||
foreach ((array)$data as $var => $value)
|
||||
{
|
||||
// normalize values
|
||||
$stripped = strtolower(str_replace('_', '', $var));
|
||||
|
||||
foreach ($props as $target => $sources)
|
||||
foreach ((array)$props as $target => $sources)
|
||||
{
|
||||
if ($target == $stripped or in_array($stripped, $sources))
|
||||
{
|
||||
|
|
@ -183,7 +183,7 @@ class GameQ_Filters_Normalise extends GameQ_Filters
|
|||
{
|
||||
$data = array();
|
||||
|
||||
foreach ($vars as $target => $source)
|
||||
foreach ((array)$vars as $target => $source)
|
||||
{
|
||||
$data['gq_' . $target] = $val;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ class GameQ_Protocols_Aa3pre32 extends GameQ_Protocols
|
|||
}
|
||||
|
||||
// We only got one packet
|
||||
if(count($packets) == 1)
|
||||
if(count((array)$packets) == 1)
|
||||
{
|
||||
// @todo: Looking for example to test and verify
|
||||
|
||||
|
|
@ -228,7 +228,7 @@ class GameQ_Protocols_Aa3pre32 extends GameQ_Protocols
|
|||
{
|
||||
$team = $value;
|
||||
}
|
||||
elseif ($matches[1] == 'TeamIndex' && !array_key_exists($value, $teams))
|
||||
elseif ($matches[1] == 'TeamIndex' && !array_key_exists($value, (array)$teams))
|
||||
{
|
||||
$teams[$value] = $team;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ class GameQ_Protocols_Bf3 extends GameQ_Protocols
|
|||
}
|
||||
|
||||
// Count the number of words and figure out the highest index.
|
||||
$words_total = count($words)-1;
|
||||
$words_total = count((array)$words)-1;
|
||||
|
||||
// The number of player info points
|
||||
$num_tags = $words[1];
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class GameQ_Protocols_Bf4 extends GameQ_Protocols_Bf3
|
|||
}
|
||||
|
||||
// Count the number of words and figure out the highest index.
|
||||
$words_total = count($words)-1;
|
||||
$words_total = count((array)$words)-1;
|
||||
|
||||
// The number of player info points
|
||||
$num_tags = $words[1];
|
||||
|
|
|
|||
|
|
@ -610,7 +610,7 @@ abstract class GameQ_Protocols_Core
|
|||
}
|
||||
|
||||
// Now add some default stuff
|
||||
$results['gq_online'] = (count($results) > 0);
|
||||
$results['gq_online'] = (count((array)$results) > 0);
|
||||
$results['gq_address'] = $this->ip;
|
||||
$results['gq_port'] = $this->port;
|
||||
$results['gq_protocol'] = $this->protocol;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class GameQ_Protocols_Etqw extends GameQ_Protocols
|
|||
protected function preProcess_status($packets)
|
||||
{
|
||||
// Should only be one packet
|
||||
if (count($packets) > 1)
|
||||
if (count((array)$packets) > 1)
|
||||
{
|
||||
throw new GameQ_ProtocolsException('Enemy Territor: Quake Wars status has more than 1 packet');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class GameQ_Protocols_Gamespy extends GameQ_Protocols
|
|||
protected function preProcess($packets)
|
||||
{
|
||||
// Only one packet so its in order
|
||||
if (count($packets) == 1)
|
||||
if (count((array)$packets) == 1)
|
||||
{
|
||||
return $packets[0];
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ class GameQ_Protocols_Gamespy extends GameQ_Protocols
|
|||
$packets_ordered = array();
|
||||
|
||||
// Loop thru the packets
|
||||
foreach ($packets as $packet)
|
||||
foreach ((array)$packets as $packet)
|
||||
{
|
||||
// Check to see if we had a preg_match error
|
||||
if(preg_match("#^(.*)\\\\queryid\\\\([^\\\\]+)(\\\\|$)#", $packet, $matches) === FALSE)
|
||||
|
|
@ -173,7 +173,7 @@ class GameQ_Protocols_Gamespy extends GameQ_Protocols
|
|||
$num_teams = 0;
|
||||
|
||||
// Now lets loop the array
|
||||
for($x=0;$x<count($data);$x+=2)
|
||||
for($x=0;$x<count((array)$data);$x+=2)
|
||||
{
|
||||
// Set some local vars
|
||||
$key = $data[$x];
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ class GameQ_Protocols_Gamespy2 extends GameQ_Protocols
|
|||
// Get the values
|
||||
while ($buf->getLength() > 4)
|
||||
{
|
||||
foreach ($varnames as $varname)
|
||||
foreach ((array)$varnames as $varname)
|
||||
{
|
||||
$result->addSub($type, $varname, $buf->readString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ class GameQ_Protocols_Gamespy3 extends GameQ_Protocols
|
|||
$return = array();
|
||||
|
||||
// Get packet index, remove header
|
||||
foreach ($packets as $index => $packet)
|
||||
foreach ((array)$packets as $index => $packet)
|
||||
{
|
||||
// Make new buffer
|
||||
$buf = new GameQ_Buffer($packet);
|
||||
|
|
@ -138,7 +138,7 @@ class GameQ_Protocols_Gamespy3 extends GameQ_Protocols
|
|||
// Compare last var of current packet with first var of next packet
|
||||
// On a partial match, remove last var from current packet,
|
||||
// variable header from next packet
|
||||
for ($i = 0, $x = count($return); $i < $x - 1; $i++)
|
||||
for ($i = 0, $x = count((array)$return); $i < $x - 1; $i++)
|
||||
{
|
||||
// First packet
|
||||
$fst = substr($return[$i], 0, -1);
|
||||
|
|
@ -162,7 +162,7 @@ class GameQ_Protocols_Gamespy3 extends GameQ_Protocols
|
|||
}
|
||||
|
||||
// Now let's loop the return and remove any dupe prefixes
|
||||
for($x = 1; $x < count($return); $x++)
|
||||
for($x = 1; $x < count((array)$return); $x++)
|
||||
{
|
||||
$buf = new GameQ_Buffer($return[$x]);
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ class GameQ_Protocols_Gamespy3 extends GameQ_Protocols
|
|||
|
||||
protected function delete_result(&$result, $array)
|
||||
{
|
||||
foreach($array as $key)
|
||||
foreach ((array)$array as $key)
|
||||
{
|
||||
unset($result[$key]);
|
||||
}
|
||||
|
|
@ -268,7 +268,7 @@ class GameQ_Protocols_Gamespy3 extends GameQ_Protocols
|
|||
$item_type = '';
|
||||
|
||||
// Loop through all of the $data for information and pull it out into the result
|
||||
for($x=0; $x < count($data)-1; $x++)
|
||||
for($x=0; $x < count((array)$data)-1; $x++)
|
||||
{
|
||||
// Pull out the item
|
||||
$item = $data[$x];
|
||||
|
|
@ -413,7 +413,7 @@ class GameQ_Protocols_Gamespy3 extends GameQ_Protocols
|
|||
print_r($items);
|
||||
|
||||
// Loop through all of the items
|
||||
for($x = 0; $x < count($items); $x += 2)
|
||||
for($x = 0; $x < count((array)$items); $x += 2)
|
||||
{
|
||||
// $x is always the key for the item (i.e. player_, ping_, team_, score_, etc...)
|
||||
$item_type = rtrim($items[$x], '_,_t');
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class GameQ_Protocols_Quake2 extends GameQ_Protocols
|
|||
protected function preProcess_status($packets)
|
||||
{
|
||||
// Should only be one packet
|
||||
if (count($packets) > 1)
|
||||
if (count((array)$packets) > 1)
|
||||
{
|
||||
throw new GameQ_ProtocolsException('Quake 2 status has more than 1 packet');
|
||||
}
|
||||
|
|
@ -175,7 +175,7 @@ class GameQ_Protocols_Quake2 extends GameQ_Protocols
|
|||
array_pop($players);
|
||||
|
||||
// Add total number of players
|
||||
$result->add('num_players', count($players));
|
||||
$result->add('num_players', count((array)$players));
|
||||
|
||||
// Loop the players
|
||||
foreach($players AS $player_info)
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class GameQ_Protocols_Quake3 extends GameQ_Protocols
|
|||
protected function preProcess_status($packets)
|
||||
{
|
||||
// Should only be one packet
|
||||
if (count($packets) > 1)
|
||||
if (count((array)$packets) > 1)
|
||||
{
|
||||
throw new GameQ_ProtocolsException('Quake 3 status has more than 1 packet');
|
||||
}
|
||||
|
|
@ -176,7 +176,7 @@ class GameQ_Protocols_Quake3 extends GameQ_Protocols
|
|||
array_pop($players);
|
||||
|
||||
// Add total number of players
|
||||
$result->add('num_players', count($players));
|
||||
$result->add('num_players', count((array)$players));
|
||||
|
||||
// Loop the players
|
||||
foreach($players AS $player_info)
|
||||
|
|
|
|||
|
|
@ -374,13 +374,13 @@ class GameQ_Protocols_Teamspeak3 extends GameQ_Protocols
|
|||
|
||||
$return = array();
|
||||
|
||||
foreach ($data as $part)
|
||||
foreach ((array)$data as $part)
|
||||
{
|
||||
$variables = explode (' ', $part);
|
||||
|
||||
$info = array();
|
||||
|
||||
foreach ($variables as $variable)
|
||||
foreach ((array)$variables as $variable)
|
||||
{
|
||||
// Explode and make sure we always have 2 items in the array
|
||||
list($key, $value) = array_pad(explode('=', $variable, 2), 2, '');
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ abstract class GameQ_Protocols_Unreal2 extends GameQ_Protocols
|
|||
protected function preProcess_details($packets=array())
|
||||
{
|
||||
// Only one return so no need for work
|
||||
if(count($packets) == 1)
|
||||
if(count((array)$packets) == 1)
|
||||
{
|
||||
return substr($packets[0], 5);
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ abstract class GameQ_Protocols_Unreal2 extends GameQ_Protocols
|
|||
protected function preProcess_rules($packets=array())
|
||||
{
|
||||
// Only one return so no need for work
|
||||
if(count($packets) == 1)
|
||||
if(count((array)$packets) == 1)
|
||||
{
|
||||
return substr($packets[0], 5);
|
||||
}
|
||||
|
|
@ -207,7 +207,7 @@ abstract class GameQ_Protocols_Unreal2 extends GameQ_Protocols
|
|||
protected function preProcess_players($packets=array())
|
||||
{
|
||||
// Only one return so no need for work
|
||||
if(count($packets) == 1)
|
||||
if(count((array)$packets) == 1)
|
||||
{
|
||||
return substr($packets[0], 5);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ class GameQ_Protocols_Ventrilo extends GameQ_Protocols
|
|||
|
||||
|
||||
$key = 0;
|
||||
for( $i = 1; $i <= count( $chars ); $i++ )
|
||||
for( $i = 1; $i <= count((array)$chars); $i++ )
|
||||
{
|
||||
$chars[$i] -= ( $table[$a2] + (( $i - 1 ) % 5 )) & 0xFF;
|
||||
$a2 = ($a2 + $a1) & 0xFF;
|
||||
|
|
@ -221,7 +221,7 @@ class GameQ_Protocols_Ventrilo extends GameQ_Protocols
|
|||
), $header_items);
|
||||
|
||||
// Check to make sure the number of packets match
|
||||
if ($header_items['totpck'] != count($packets))
|
||||
if ($header_items['totpck'] != count((array)$packets))
|
||||
{
|
||||
throw new GameQ_ProtocolsException(__METHOD__.": Too less packets recieved");
|
||||
}
|
||||
|
|
@ -239,7 +239,7 @@ class GameQ_Protocols_Ventrilo extends GameQ_Protocols
|
|||
|
||||
$chars = unpack( "C*", substr ($packet, 20) );
|
||||
$data = "";
|
||||
for( $i = 1; $i <= count( $chars ); $i++ )
|
||||
for( $i = 1; $i <= count((array)$chars); $i++ )
|
||||
{
|
||||
$chars[$i] -= ($table[$a2] + (( $i - 1 ) % 72 )) & 0xFF;
|
||||
$a2 = ($a2 + $a1) & 0xFF;
|
||||
|
|
@ -372,7 +372,7 @@ class GameQ_Protocols_Ventrilo extends GameQ_Protocols
|
|||
protected function channel($data, GameQ_Result &$result)
|
||||
{
|
||||
$items = explode (",", $data);
|
||||
foreach ($items as $item)
|
||||
foreach ((array)$items as $item)
|
||||
{
|
||||
$temp = explode("=", $item);
|
||||
$key = strtolower($temp[0]);
|
||||
|
|
@ -391,7 +391,7 @@ class GameQ_Protocols_Ventrilo extends GameQ_Protocols
|
|||
{
|
||||
$items = explode(",", $data);
|
||||
|
||||
foreach ($items as $item)
|
||||
foreach ((array)$items as $item)
|
||||
{
|
||||
$temp = explode("=", $item);
|
||||
$key = strtolower($temp[0]);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class GameQ_Protocols_Warsow extends GameQ_Protocols_Quake3
|
|||
array_pop($players);
|
||||
|
||||
// Add total number of players
|
||||
$result->add('num_players', count($players));
|
||||
$result->add('num_players', count((array)$players));
|
||||
|
||||
// Loop the players
|
||||
foreach($players AS $player_info)
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class TeamSpeak3_Adapter_Blacklist extends TeamSpeak3_Adapter_Abstract
|
|||
$repl = $this->getTransport()->read(1);
|
||||
$this->getTransport()->disconnect();
|
||||
|
||||
if(!count($repl))
|
||||
if(!count((array)$repl))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ class TeamSpeak3_Adapter_FileTransfer extends TeamSpeak3_Adapter_Abstract
|
|||
$size = intval($size);
|
||||
$pack = 4096;
|
||||
|
||||
TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferDownloadStarted", $ftkey, count($buff), $size);
|
||||
TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferDownloadStarted", $ftkey, count((array)$buff), $size);
|
||||
|
||||
for($seek = 0;$seek < $size;)
|
||||
{
|
||||
|
|
@ -152,16 +152,16 @@ class TeamSpeak3_Adapter_FileTransfer extends TeamSpeak3_Adapter_Abstract
|
|||
|
||||
$buff->append($data);
|
||||
|
||||
TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferDownloadProgress", $ftkey, count($buff), $size);
|
||||
TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferDownloadProgress", $ftkey, count((array)$buff), $size);
|
||||
}
|
||||
|
||||
$this->getProfiler()->stop();
|
||||
|
||||
TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferDownloadFinished", $ftkey, count($buff), $size);
|
||||
TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferDownloadFinished", $ftkey, count((array)$buff), $size);
|
||||
|
||||
if(strlen($buff) != $size)
|
||||
{
|
||||
throw new TeamSpeak3_Adapter_FileTransfer_Exception("incomplete file download (" . count($buff) . " of " . $size . " bytes)");
|
||||
throw new TeamSpeak3_Adapter_FileTransfer_Exception("incomplete file download (" . count((array)$buff) . " of " . $size . " bytes)");
|
||||
}
|
||||
|
||||
return $buff;
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ class TeamSpeak3_Adapter_ServerQuery extends TeamSpeak3_Adapter_Abstract
|
|||
$args = array();
|
||||
$cells = array();
|
||||
|
||||
foreach($params as $ident => $value)
|
||||
foreach ((array)$params as $ident => $value)
|
||||
{
|
||||
$ident = is_numeric($ident) ? "" : strtolower($ident) . TeamSpeak3::SEPARATOR_PAIR;
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ class TeamSpeak3_Adapter_ServerQuery extends TeamSpeak3_Adapter_Abstract
|
|||
{
|
||||
$value = array_values($value);
|
||||
|
||||
for($i = 0; $i < count($value); $i++)
|
||||
for($i = 0; $i < count((array)$value); $i++)
|
||||
{
|
||||
if($value[$i] === null) continue;
|
||||
elseif($value[$i] === FALSE) $value[$i] = 0x00;
|
||||
|
|
@ -207,8 +207,8 @@ class TeamSpeak3_Adapter_ServerQuery extends TeamSpeak3_Adapter_Abstract
|
|||
|
||||
foreach(array_keys($cells) as $ident) $cells[$ident] = implode(TeamSpeak3::SEPARATOR_CELL, $cells[$ident]);
|
||||
|
||||
if(count($args)) $cmd .= " " . implode(TeamSpeak3::SEPARATOR_CELL, $args);
|
||||
if(count($cells)) $cmd .= " " . implode(TeamSpeak3::SEPARATOR_LIST, $cells);
|
||||
if(count((array)$args)) $cmd .= " " . implode(TeamSpeak3::SEPARATOR_CELL, $args);
|
||||
if(count((array)$cells)) $cmd .= " " . implode(TeamSpeak3::SEPARATOR_LIST, $cells);
|
||||
|
||||
return trim($cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class TeamSpeak3_Adapter_ServerQuery_Reply
|
|||
|
||||
if(!func_num_args())
|
||||
{
|
||||
for($i = 0; $i < count($list); $i++) $list[$i]->unescape();
|
||||
for($i = 0; $i < count((array)$list); $i++) $list[$i]->unescape();
|
||||
}
|
||||
|
||||
return $list;
|
||||
|
|
@ -133,7 +133,7 @@ class TeamSpeak3_Adapter_ServerQuery_Reply
|
|||
|
||||
if(!func_num_args())
|
||||
{
|
||||
for($i = 0; $i < count($pairs); $i++) $pairs[$i]->unescape();
|
||||
for($i = 0; $i < count((array)$pairs); $i++) $pairs[$i]->unescape();
|
||||
}
|
||||
|
||||
$table[] = $pairs;
|
||||
|
|
@ -152,11 +152,11 @@ class TeamSpeak3_Adapter_ServerQuery_Reply
|
|||
$array = array();
|
||||
$table = $this->toTable(1);
|
||||
|
||||
for($i = 0; $i < count($table); $i++)
|
||||
for($i = 0; $i < count((array)$table); $i++)
|
||||
{
|
||||
foreach($table[$i] as $pair)
|
||||
foreach ((array)$table[$i] as $pair)
|
||||
{
|
||||
if(!count($pair))
|
||||
if(!count((array)$pair))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -189,7 +189,7 @@ class TeamSpeak3_Adapter_ServerQuery_Reply
|
|||
$nodes = (func_num_args() > 1) ? $this->toArray(1) : $this->toArray();
|
||||
$array = array();
|
||||
|
||||
foreach($nodes as $node)
|
||||
foreach ((array)$nodes as $node)
|
||||
{
|
||||
if(isset($node[$ident]))
|
||||
{
|
||||
|
|
@ -213,7 +213,7 @@ class TeamSpeak3_Adapter_ServerQuery_Reply
|
|||
{
|
||||
$array = func_num_args() ? $this->toArray(1) : $this->toArray();
|
||||
|
||||
if(count($array) == 1)
|
||||
if(count((array)$array) == 1)
|
||||
{
|
||||
return array_shift($array);
|
||||
}
|
||||
|
|
@ -230,7 +230,7 @@ class TeamSpeak3_Adapter_ServerQuery_Reply
|
|||
{
|
||||
$array = (func_num_args() > 1) ? $this->toArray(1) : $this->toArray();
|
||||
|
||||
for($i = 0; $i < count($array); $i++)
|
||||
for($i = 0; $i < count((array)$array); $i++)
|
||||
{
|
||||
$array[$i] = (object) $array[$i];
|
||||
}
|
||||
|
|
@ -325,7 +325,7 @@ class TeamSpeak3_Adapter_ServerQuery_Reply
|
|||
*/
|
||||
protected function fetchReply($rpl)
|
||||
{
|
||||
foreach($rpl as $key => $val)
|
||||
foreach ((array)$rpl as $key => $val)
|
||||
{
|
||||
if($val->startsWith(TeamSpeak3::TS3_MOTD_PREFIX) || $val->startsWith(TeamSpeak3::TEA_MOTD_PREFIX) || (defined("CUSTOM_MOTD_PREFIX") && $val->startsWith(CUSTOM_MOTD_PREFIX)))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ class TeamSpeak3_Helper_Convert
|
|||
$parts = explode("|", $entry, 5);
|
||||
$array = array();
|
||||
|
||||
if(count($parts) != 5)
|
||||
if(count((array)$parts) != 5)
|
||||
{
|
||||
$array["timestamp"] = 0;
|
||||
$array["level"] = TeamSpeak3::LOGLEVEL_ERROR;
|
||||
|
|
@ -324,7 +324,7 @@ class TeamSpeak3_Helper_Convert
|
|||
|
||||
$buildno = $version->section("[", 1)->filterDigits()->toInt();
|
||||
|
||||
return ($buildno <= 15001) ? $version : $version->section("[")->append("(" . date($format, $buildno) . ")");
|
||||
return ($buildno <= 15001) ? $version : $version->section("[")->append("(" . date($format, is_numeric($buildno) ? (int)$buildno : strtotime($buildno)) . ")");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -365,6 +365,6 @@ class TeamSpeak3_Helper_Convert
|
|||
6 => "image/x-ilbm",
|
||||
);
|
||||
|
||||
return $type[count($matches)-1];
|
||||
return $type[count((array)$matches)-1];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable, Json
|
|||
{
|
||||
$args = array_reverse($args, TRUE);
|
||||
|
||||
foreach($args as $key => $val)
|
||||
foreach ((array)$args as $key => $val)
|
||||
{
|
||||
$args[$char . $key] = $val;
|
||||
unset($args[$key]);
|
||||
|
|
@ -219,7 +219,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable, Json
|
|||
{
|
||||
$parts = explode($separator, $this->string, ($limit) ? intval($limit) : $this->count());
|
||||
|
||||
foreach($parts as $key => $val)
|
||||
foreach ((array)$parts as $key => $val)
|
||||
{
|
||||
$parts[$key] = new self($val);
|
||||
}
|
||||
|
|
@ -265,7 +265,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable, Json
|
|||
{
|
||||
$sections = explode($separator, $this->string);
|
||||
|
||||
$total = count($sections);
|
||||
$total = count((array)$sections);
|
||||
$first = intval($first);
|
||||
$last = intval($last);
|
||||
|
||||
|
|
@ -505,7 +505,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable, Json
|
|||
{
|
||||
$hex = "";
|
||||
|
||||
foreach($this as $char)
|
||||
foreach ((array)$this as $char)
|
||||
{
|
||||
$hex .= $char->toHex();
|
||||
}
|
||||
|
|
@ -810,7 +810,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable, Json
|
|||
throw new TeamSpeak3_Helper_Exception("cannot call undefined function '" . $function . "' on this object");
|
||||
}
|
||||
|
||||
if(count($args))
|
||||
if(count((array)$args))
|
||||
{
|
||||
if(($key = array_search($this, $args, TRUE)) !== FALSE)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -519,7 +519,7 @@ class TeamSpeak3_Helper_Uri
|
|||
|
||||
parse_str($this->query, $queryArray);
|
||||
|
||||
return array_key_exists($key, $queryArray) ? TRUE : FALSE;
|
||||
return array_key_exists($key, (array)$queryArray) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -535,7 +535,7 @@ class TeamSpeak3_Helper_Uri
|
|||
|
||||
parse_str(rawurldecode($this->query), $queryArray);
|
||||
|
||||
if(array_key_exists($key, $queryArray))
|
||||
if(array_key_exists($key, (array)$queryArray))
|
||||
{
|
||||
$val = $queryArray[$key];
|
||||
|
||||
|
|
@ -616,7 +616,7 @@ class TeamSpeak3_Helper_Uri
|
|||
*/
|
||||
public static function getUserParam($key, $default = null)
|
||||
{
|
||||
return (array_key_exists($key, $_REQUEST) && !empty($_REQUEST[$key])) ? self::stripslashesRecursive($_REQUEST[$key]) : $default;
|
||||
return (array_key_exists($key, (array)$_REQUEST) && !empty($_REQUEST[$key])) ? self::stripslashesRecursive($_REQUEST[$key]) : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -628,7 +628,7 @@ class TeamSpeak3_Helper_Uri
|
|||
*/
|
||||
public static function getHostParam($key, $default = null)
|
||||
{
|
||||
return (array_key_exists($key, $_SERVER) && !empty($_SERVER[$key])) ? $_SERVER[$key] : $default;
|
||||
return (array_key_exists($key, (array)$_SERVER) && !empty($_SERVER[$key])) ? $_SERVER[$key] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -640,7 +640,7 @@ class TeamSpeak3_Helper_Uri
|
|||
*/
|
||||
public static function getSessParam($key, $default = null)
|
||||
{
|
||||
return (array_key_exists($key, $_SESSION) && !empty($_SESSION[$key])) ? $_SESSION[$key] : $default;
|
||||
return (array_key_exists($key, (array)$_SESSION) && !empty($_SESSION[$key])) ? $_SESSION[$key] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -710,7 +710,7 @@ class TeamSpeak3_Helper_Uri
|
|||
return stripslashes(strval($var));
|
||||
}
|
||||
|
||||
foreach($var as $key => $val)
|
||||
foreach ((array)$var as $key => $val)
|
||||
{
|
||||
$var[$key] = (is_array($val)) ? stripslashesRecursive($val) : stripslashes(strval($val));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
|
|||
|
||||
$iterator = new RecursiveIteratorIterator($this, RecursiveIteratorIterator::SELF_FIRST);
|
||||
|
||||
foreach($iterator as $node)
|
||||
foreach ((array)$iterator as $node)
|
||||
{
|
||||
$siblings = array();
|
||||
|
||||
|
|
@ -225,14 +225,14 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
|
|||
{
|
||||
if(!empty($rules))
|
||||
{
|
||||
foreach($nodes as $node)
|
||||
foreach ((array)$nodes as $node)
|
||||
{
|
||||
if(!$node instanceof TeamSpeak3_Node_Abstract) continue;
|
||||
|
||||
$props = $node->getInfo(FALSE);
|
||||
$props = array_intersect_key($props, $rules);
|
||||
|
||||
foreach($props as $key => $val)
|
||||
foreach ((array)$props as $key => $val)
|
||||
{
|
||||
if($val instanceof TeamSpeak3_Helper_String)
|
||||
{
|
||||
|
|
@ -273,7 +273,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
|
|||
{
|
||||
$info = $this->nodeInfo;
|
||||
|
||||
foreach($info as $key => $val)
|
||||
foreach ((array)$info as $key => $val)
|
||||
{
|
||||
$key = TeamSpeak3_Helper_String::factory($key);
|
||||
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ class TeamSpeak3_Node_Channelgroup extends TeamSpeak3_Node_Abstract
|
|||
*/
|
||||
public function message($msg)
|
||||
{
|
||||
foreach($this as $client)
|
||||
foreach ((array)$this as $client)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ class TeamSpeak3_Node_Host extends TeamSpeak3_Node_Abstract
|
|||
|
||||
$this->serverList = array();
|
||||
|
||||
foreach($servers as $sid => $server)
|
||||
foreach ((array)$servers as $sid => $server)
|
||||
{
|
||||
$this->serverList[$sid] = new TeamSpeak3_Node_Server($this, $server);
|
||||
}
|
||||
|
|
@ -931,7 +931,7 @@ class TeamSpeak3_Node_Host extends TeamSpeak3_Node_Abstract
|
|||
{
|
||||
$servers = $this->serverList();
|
||||
|
||||
foreach($servers as $server)
|
||||
foreach ((array)$servers as $server)
|
||||
{
|
||||
$this->nodeList[] = $server;
|
||||
}
|
||||
|
|
@ -959,9 +959,9 @@ class TeamSpeak3_Node_Host extends TeamSpeak3_Node_Abstract
|
|||
$this->permissionEnds = array();
|
||||
$this->permissionList = array();
|
||||
|
||||
foreach($reply as $line)
|
||||
foreach ((array)$reply as $line)
|
||||
{
|
||||
if(array_key_exists("group_id_end", $line))
|
||||
if(array_key_exists("group_id_end", (array)$line))
|
||||
{
|
||||
$this->permissionEnds[] = $line["group_id_end"];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
|
||||
$this->channelList = array();
|
||||
|
||||
foreach($channels as $cid => $channel)
|
||||
foreach ((array)$channels as $cid => $channel)
|
||||
{
|
||||
$this->channelList[$cid] = new TeamSpeak3_Node_Channel($this, $channel);
|
||||
}
|
||||
|
|
@ -477,7 +477,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
public function channelFileList($cid, $cpw = "", $path = "/", $recursive = FALSE)
|
||||
{
|
||||
$files = $this->execute("ftgetfilelist", array("cid" => $cid, "cpw" => $cpw, "path" => $path))->toArray();
|
||||
$count = count($files);
|
||||
$count = count((array)$files);
|
||||
|
||||
for($i = 0; $i < $count; $i++)
|
||||
{
|
||||
|
|
@ -648,7 +648,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
|
||||
$this->clientList = array();
|
||||
|
||||
foreach($clients as $clid => $client)
|
||||
foreach ((array)$clients as $clid => $client)
|
||||
{
|
||||
if($this->getParent()->getExcludeQueryClients() && $client["client_type"]) continue;
|
||||
|
||||
|
|
@ -1101,7 +1101,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
$this->serverGroupRename($tsgid, $name);
|
||||
}
|
||||
|
||||
return count($sgid) ? $sgid["sgid"] : intval($tsgid);
|
||||
return count((array)$sgid) ? $sgid["sgid"] : intval($tsgid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1322,7 +1322,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
$grant = null;
|
||||
}
|
||||
|
||||
foreach($perms as $permsid => $perm)
|
||||
foreach ((array)$perms as $permsid => $perm)
|
||||
{
|
||||
if(in_array($permsid, array_keys($profiles[$sgid])))
|
||||
{
|
||||
|
|
@ -1429,7 +1429,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
$this->channelGroupRename($tcgid, $name);
|
||||
}
|
||||
|
||||
return count($cgid) ? $cgid["cgid"] : intval($tcgid);
|
||||
return count((array)$cgid) ? $cgid["cgid"] : intval($tcgid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1585,7 +1585,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
|
||||
if($resolve)
|
||||
{
|
||||
foreach($result as $k => $v)
|
||||
foreach ((array)$result as $k => $v)
|
||||
{
|
||||
$result[$k] = array_merge($v, $this->clientInfoDb($v["cldbid"]));
|
||||
}
|
||||
|
|
@ -1620,7 +1620,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
{
|
||||
$assignments = $this->permissionFind($permid);
|
||||
|
||||
foreach($assignments as $assignment)
|
||||
foreach ((array)$assignments as $assignment)
|
||||
{
|
||||
switch($assignment["t"])
|
||||
{
|
||||
|
|
@ -1649,7 +1649,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
}
|
||||
}
|
||||
|
||||
return count($assignments);
|
||||
return count((array)$assignments);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1669,7 +1669,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
{
|
||||
$upload = $this->execute("ftinitupload", array("clientftfid" => $clientftfid, "cid" => $cid, "name" => $name, "cpw" => $cpw, "size" => $size, "overwrite" => $overwrite, "resume" => $resume))->toList();
|
||||
|
||||
if(array_key_exists("status", $upload) && $upload["status"] != 0x00)
|
||||
if(array_key_exists("status", (array)$upload) && $upload["status"] != 0x00)
|
||||
{
|
||||
throw new TeamSpeak3_Adapter_ServerQuery_Exception($upload["msg"], $upload["status"]);
|
||||
}
|
||||
|
|
@ -1677,7 +1677,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
$upload["cid"] = $cid;
|
||||
$upload["file"] = $name;
|
||||
|
||||
if(!array_key_exists("ip", $upload) || $upload["ip"]->startsWith("0.0.0.0"))
|
||||
if(!array_key_exists("ip", (array)$upload) || $upload["ip"]->startsWith("0.0.0.0"))
|
||||
{
|
||||
$upload["ip"] = $this->getParent()->getAdapterHost();
|
||||
$upload["host"] = $upload["ip"];
|
||||
|
|
@ -1708,7 +1708,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
{
|
||||
$download = $this->execute("ftinitdownload", array("clientftfid" => $clientftfid, "cid" => $cid, "name" => $name, "cpw" => $cpw, "seekpos" => $seekpos))->toList();
|
||||
|
||||
if(array_key_exists("status", $download) && $download["status"] != 0x00)
|
||||
if(array_key_exists("status", (array)$download) && $download["status"] != 0x00)
|
||||
{
|
||||
throw new TeamSpeak3_Adapter_ServerQuery_Exception($download["msg"], $download["status"]);
|
||||
}
|
||||
|
|
@ -1716,7 +1716,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
$download["cid"] = $cid;
|
||||
$download["file"] = $name;
|
||||
|
||||
if(!array_key_exists("ip", $download) || $download["ip"]->startsWith("0.0.0.0"))
|
||||
if(!array_key_exists("ip", (array)$download) || $download["ip"]->startsWith("0.0.0.0"))
|
||||
{
|
||||
$download["ip"] = $this->getParent()->getAdapterHost();
|
||||
$download["host"] = $download["ip"];
|
||||
|
|
@ -1984,7 +1984,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
|
||||
if($resolve)
|
||||
{
|
||||
foreach($tokens as $token => $array)
|
||||
foreach ((array)$tokens as $token => $array)
|
||||
{
|
||||
$func = $array["token_type"] ? "channelGroupGetById" : "serverGroupGetById";
|
||||
|
||||
|
|
@ -2242,7 +2242,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
|
||||
if($resolve)
|
||||
{
|
||||
foreach($passwords as $password => $array)
|
||||
foreach ((array)$passwords as $password => $array)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -2380,7 +2380,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
{
|
||||
$this->execute("clientupdate", $properties);
|
||||
|
||||
foreach($properties as $ident => $value)
|
||||
foreach ((array)$properties as $ident => $value)
|
||||
{
|
||||
$this->whoamiSet($ident, $value);
|
||||
}
|
||||
|
|
@ -2514,7 +2514,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
|
|||
*/
|
||||
protected static function sortFileList(array $a, array $b)
|
||||
{
|
||||
if(!array_key_exists("src", $a) || !array_key_exists("src", $b) || !array_key_exists("type", $a) || !array_key_exists("type", $b))
|
||||
if(!array_key_exists("src", (array)$a) || !array_key_exists("src", (array)$b) || !array_key_exists("type", (array)$a) || !array_key_exists("type", (array)$b))
|
||||
{
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ class TeamSpeak3_Node_Servergroup extends TeamSpeak3_Node_Abstract
|
|||
*/
|
||||
public function message($msg)
|
||||
{
|
||||
foreach($this as $client)
|
||||
foreach ((array)$this as $client)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -77,11 +77,11 @@ if(isset($server_home['control_password']) && $server_home['control_password'] !
|
|||
$ts3['ip'] = $cfg["host"];
|
||||
$ts3['port'] = $cfg["voice"];
|
||||
$clients = $ts3_ServerInstance->clientList();
|
||||
$ts3['players'] = count($clients);
|
||||
$ts3['players'] = count((array)$clients);
|
||||
if( $ts3['players'] >= 1 )
|
||||
{
|
||||
$i=0;
|
||||
foreach($clients as $key => $value)
|
||||
foreach ((array)$clients as $key => $value)
|
||||
{
|
||||
/* $playerarray[$i]= */
|
||||
$ts3['playersList'][$i]['name'] = trim($value);
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ class TeamSpeak3
|
|||
$path = self::getFilePath($namespace);
|
||||
$scan = scandir($path);
|
||||
|
||||
foreach($scan as $node)
|
||||
foreach ((array)$scan as $node)
|
||||
{
|
||||
$file = TeamSpeak3_Helper_String::factory($node)->toLower();
|
||||
|
||||
|
|
@ -686,7 +686,7 @@ class TeamSpeak3
|
|||
* $arr_ClientList = $ts3_VirtualServer->clientList(array("client_platform" => "Android"));
|
||||
*
|
||||
* // walk through list of clients
|
||||
* foreach($arr_ClientList as $ts3_Client)
|
||||
* foreach ((array)$arr_ClientList as $ts3_Client)
|
||||
* {
|
||||
* echo $ts3_Client . " is using " . $ts3_Client["client_platform"] . "<br />\n";
|
||||
* }
|
||||
|
|
@ -701,7 +701,7 @@ class TeamSpeak3
|
|||
* $ts3_ServerInstance = TeamSpeak3::factory("serverquery://username:password@127.0.0.1:10011/");
|
||||
*
|
||||
* // walk through list of virtual servers
|
||||
* foreach($ts3_ServerInstance as $ts3_VirtualServer)
|
||||
* foreach ((array)$ts3_ServerInstance as $ts3_VirtualServer)
|
||||
* {
|
||||
* // modify the virtual servers hostbanner URL only using the ArrayAccess interface
|
||||
* $ts3_VirtualServer["virtualserver_hostbanner_gfx_url"] = "http://www.example.com/banners/banner01_468x60.jpg";
|
||||
|
|
@ -742,7 +742,7 @@ class TeamSpeak3
|
|||
* $ts3_ServerInstance = TeamSpeak3::factory("serverquery://username:password@127.0.0.1:10011/");
|
||||
*
|
||||
* // walk through list of virtual servers
|
||||
* foreach($ts3_ServerInstance as $ts3_VirtualServer)
|
||||
* foreach ((array)$ts3_ServerInstance as $ts3_VirtualServer)
|
||||
* {
|
||||
* // identify the most powerful group on the virtual server
|
||||
* $ts3_ServerGroup = $ts3_VirtualServer->serverGroupIdentify();
|
||||
|
|
|
|||
|
|
@ -65,22 +65,22 @@ abstract class TeamSpeak3_Transport_Abstract
|
|||
*/
|
||||
public function __construct(array $config)
|
||||
{
|
||||
if(!array_key_exists("host", $config))
|
||||
if(!array_key_exists("host", (array)$config))
|
||||
{
|
||||
throw new TeamSpeak3_Transport_Exception("config must have a key for 'host' which specifies the server host name");
|
||||
}
|
||||
|
||||
if(!array_key_exists("port", $config))
|
||||
if(!array_key_exists("port", (array)$config))
|
||||
{
|
||||
throw new TeamSpeak3_Transport_Exception("config must have a key for 'port' which specifies the server port number");
|
||||
}
|
||||
|
||||
if(!array_key_exists("timeout", $config))
|
||||
if(!array_key_exists("timeout", (array)$config))
|
||||
{
|
||||
$config["timeout"] = 10;
|
||||
}
|
||||
|
||||
if(!array_key_exists("blocking", $config))
|
||||
if(!array_key_exists("blocking", (array)$config))
|
||||
{
|
||||
$config["blocking"] = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ try
|
|||
<option> </option>";
|
||||
|
||||
$users = $db->getUserList();
|
||||
foreach ( $users as $user )
|
||||
foreach ((array)$users as $user)
|
||||
{
|
||||
$add_remove_virtual .= "<option value='".$user['user_id']."'>".$user['users_login']."</option>\n";
|
||||
}
|
||||
|
|
@ -178,7 +178,7 @@ try
|
|||
if($ts3vservers != 0)
|
||||
{
|
||||
$ts3vuserlist = "<b>TeamSpeak 3</b><br>";
|
||||
foreach($ts3vservers as $ts3vserver)
|
||||
foreach ((array)$ts3vservers as $ts3vserver)
|
||||
{
|
||||
$ts3vuser = $db->getUserById($ts3vserver['user_id']);
|
||||
|
||||
|
|
|
|||
|
|
@ -74,10 +74,10 @@
|
|||
{
|
||||
if(is_array($host))
|
||||
{
|
||||
$this->host = array_key_exists('host', $host) ? $host['host'] : '';
|
||||
$this->port = array_key_exists('port', $host) ? $host['port'] : $port;
|
||||
$this->timeout = array_key_exists('timeout', $host) ? $host['timeout'] : $timeout;
|
||||
$this->format = array_key_exists('format', $host) ? $host['format'] : $format;
|
||||
$this->host = array_key_exists('host', (array)$host) ? $host['host'] : '';
|
||||
$this->port = array_key_exists('port', (array)$host) ? $host['port'] : $port;
|
||||
$this->timeout = array_key_exists('timeout', (array)$host) ? $host['timeout'] : $timeout;
|
||||
$this->format = array_key_exists('format', (array)$host) ? $host['format'] : $format;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -340,7 +340,7 @@
|
|||
private function _parse_channels($channels)
|
||||
{
|
||||
// We'll have to deal with the root channel separately
|
||||
if(array_key_exists('root', $channels))
|
||||
if(array_key_exists('root', (array)$channels))
|
||||
{
|
||||
if(count($channels['root']['users']) > 0)
|
||||
{
|
||||
|
|
@ -356,13 +356,13 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
if(count($channels) > 0)
|
||||
if(count((array)$channels) > 0)
|
||||
{
|
||||
foreach($channels as $channel)
|
||||
foreach ((array)$channels as $channel)
|
||||
{
|
||||
if(count($channel['users']) > 0)
|
||||
if(count((array)$channel['users']) > 0)
|
||||
{
|
||||
foreach($channel['users'] as $user) $this->users[] = $user;
|
||||
foreach ((array)$channel['users'] as $user) $this->users[] = $user;
|
||||
}
|
||||
|
||||
if($channel['users'] > 0) unset($channel['users']);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ function print_player_list($player_list,$players,$playersmax)
|
|||
$data = "<table class='player_monitor' style='border:none;'><thead>";
|
||||
$data .= "<tr><th>".get_lang('player_name')."</th><th>".get_lang('score')."</th><th>".get_lang('time')."</th></tr>";
|
||||
$data .= "</thead><tbody>";
|
||||
foreach ($player_list as $key => $row) {
|
||||
foreach ((array)$player_list as $key => $row) {
|
||||
$name[$key] = $row['name'];
|
||||
$score[$key] = $row['score'];
|
||||
$time[$key] = $row['time'];
|
||||
|
|
@ -15,7 +15,7 @@ function print_player_list($player_list,$players,$playersmax)
|
|||
$time,
|
||||
$name, $player_list);
|
||||
$i = 0;
|
||||
foreach( $player_list as $player ){
|
||||
foreach ((array)$player_list as $player){
|
||||
$data .= "<tr";
|
||||
if($i%2 == 0) $data .= 'class="odd"';
|
||||
$data .="><td>".htmlentities(@$player['name'])."</td><td>".@$player['score']."</td><td>".@$player['time']."</td></tr>";
|
||||
|
|
|
|||
|
|
@ -879,7 +879,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
array_pop($part); // REMOVE FOOTER WHICH IS EITHER NULL OR "\challenge\"
|
||||
$item = explode("\\", $part[1]); // SPLIT PART INTO ITEMS
|
||||
|
||||
foreach ($item as $item_key => $data_key)
|
||||
foreach ((array)$item as $item_key => $data_key)
|
||||
{
|
||||
if (!($item_key % 2)) { continue; } // SKIP EVEN KEYS
|
||||
|
||||
|
|
@ -895,7 +895,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
if (isset($server['e']['gamename'])) { $server['s']['game'] = $server['e']['gamename']; }
|
||||
if (isset($server['e']['mapname'])) { $server['s']['map'] = $server['e']['mapname']; }
|
||||
|
||||
$server['s']['players'] = empty($part['2']) ? 0 : count($part) - 2;
|
||||
$server['s']['players'] = empty($part['2']) ? 0 : count((array)$part) - 2;
|
||||
|
||||
if (isset($server['e']['maxclients'])) { $server['s']['playersmax'] = $server['e']['maxclients']; } // QUAKE 2
|
||||
if (isset($server['e']['sv_maxclients'])) { $server['s']['playersmax'] = $server['e']['sv_maxclients']; }
|
||||
|
|
@ -936,13 +936,13 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
|
||||
//---------------------------------------------------------+
|
||||
|
||||
foreach ($part as $player_key => $data)
|
||||
foreach ((array)$part as $player_key => $data)
|
||||
{
|
||||
if (!$data) { continue; }
|
||||
|
||||
preg_match($pattern, $data, $match);
|
||||
|
||||
foreach ($fields as $match_key => $field_name)
|
||||
foreach ((array)$fields as $match_key => $field_name)
|
||||
{
|
||||
if (isset($match[$match_key])) { $server['p'][$player_key][$field_name] = trim($match[$match_key]); }
|
||||
}
|
||||
|
|
@ -1060,7 +1060,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
// OPERATION FLASHPOINT BUG: 'GHOST' PLAYERS IN UN-USED 'TEAM' FIELD
|
||||
if ($server['b']['type'] == "flashpoint")
|
||||
{
|
||||
foreach ($server['p'] as $key => $value)
|
||||
foreach ((array)$server['p'] as $key => $value)
|
||||
{
|
||||
unset($server['p'][$key]['team']);
|
||||
}
|
||||
|
|
@ -1069,7 +1069,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
// AVP2 BUG: PLAYER NUMBER PREFIXED TO NAMES
|
||||
if ($server['b']['type'] == "avp2")
|
||||
{
|
||||
foreach ($server['p'] as $key => $value)
|
||||
foreach ((array)$server['p'] as $key => $value)
|
||||
{
|
||||
$server['p'][$key]['name'] = preg_replace("/[0-9]+~/", "", $server['p'][$key]['name']);
|
||||
}
|
||||
|
|
@ -1078,7 +1078,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
// CHANGE TEAM NUMBERS TO TEAM NAMES IF POSSIBLE
|
||||
if (isset($server['t'][0]['name']))
|
||||
{
|
||||
foreach ($server['p'] as $key => $value)
|
||||
foreach ((array)$server['p'] as $key => $value)
|
||||
{
|
||||
$team_key = $server['p'][$key]['team'] - 1;
|
||||
$server['p'][$key]['team'] = $server['t'][$team_key]['name'];
|
||||
|
|
@ -1147,7 +1147,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
|
||||
$item = explode("\xB6", $buffer);
|
||||
|
||||
foreach ($item as $data_value)
|
||||
foreach ((array)$item as $data_value)
|
||||
{
|
||||
$tmp = explode(" ", $data_value, 2);
|
||||
$data_key = isset($lgsl_ravenshield_key[$tmp[0]]) ? $lgsl_ravenshield_key[$tmp[0]] : $tmp[0]; // CONVERT TO DESCRIPTIVE KEYS
|
||||
|
|
@ -1173,7 +1173,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
$player_ping = isset($server['e']['players_ping']) ? explode("/", substr($server['e']['players_ping'], 1)) : array(); unset($server['e']['players_ping']);
|
||||
$player_score = isset($server['e']['players_score']) ? explode("/", substr($server['e']['players_score'], 1)) : array(); unset($server['e']['players_score']);
|
||||
|
||||
foreach ($player_name as $key => $name)
|
||||
foreach ((array)$player_name as $key => $name)
|
||||
{
|
||||
$server['p'][$key]['name'] = $player_name[$key];
|
||||
$server['p'][$key]['time'] = $player_time[$key];
|
||||
|
|
@ -1255,7 +1255,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
|
||||
$buffer = array();
|
||||
|
||||
foreach ($packet_temp as $packet)
|
||||
foreach ((array)$packet_temp as $packet)
|
||||
{
|
||||
if ($packet_type == 1) { $packet_order = 0; }
|
||||
elseif ($packet_type == 2) { $packet_order = ord($packet[8]) >> 4; $packet = substr($packet, 9); } // ( INDEX IS UPPER NIBBLE OF BYTE )
|
||||
|
|
@ -1441,7 +1441,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
//---------------------------------------------------------+
|
||||
// PROCESS AND SORT PACKETS
|
||||
|
||||
foreach ($buffer as $key => $packet)
|
||||
foreach ((array)$buffer as $key => $packet)
|
||||
{
|
||||
$packet = substr($packet, 0, -1); // REMOVE END NULL FOR JOINING
|
||||
|
||||
|
|
@ -1484,7 +1484,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
}
|
||||
|
||||
$lgsl_conversion = array("name"=>"hostname", "game"=>"gamename", "map"=>"mapname", "players"=>"numplayers", "playersmax"=>"maxplayers", "password"=>"password");
|
||||
foreach ($lgsl_conversion as $s => $e) { if (isset($server['e'][$e])) { $server['s'][$s] = $server['e'][$e]; unset($server['e'][$e]); } } // LGSL STANDARD
|
||||
foreach ((array)$lgsl_conversion as $s => $e) { if (isset($server['e'][$e])) { $server['s'][$s] = $server['e'][$e]; unset($server['e'][$e]); } } // LGSL STANDARD
|
||||
|
||||
if ($server['b']['type'] == "bf2" || $server['b']['type'] == "bf2142") { $server['s']['map'] = ucwords(str_replace("_", " ", $server['s']['map'])); } // MAP NAME CONSISTENCY
|
||||
|
||||
|
|
@ -1511,7 +1511,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
$value_list = lgsl_cut_string($buffer, 0, "\x00\x00");
|
||||
$value_list = explode("\x00", $value_list);
|
||||
|
||||
foreach ($value_list as $key => $value)
|
||||
foreach ((array)$value_list as $key => $value)
|
||||
{
|
||||
$server['p'][$key][$field] = $value;
|
||||
}
|
||||
|
|
@ -1535,7 +1535,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
$value_list = lgsl_cut_string($buffer, 0, "\x00\x00");
|
||||
$value_list = explode("\x00", $value_list);
|
||||
|
||||
foreach ($value_list as $key => $value)
|
||||
foreach ((array)$value_list as $key => $value)
|
||||
{
|
||||
$server['t'][$key][$field] = $value;
|
||||
}
|
||||
|
|
@ -1546,7 +1546,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
|
||||
if ($server['p'] && isset($server['t'][0]['name']) && $server['t'][0]['name'] != "Team")
|
||||
{
|
||||
foreach ($server['p'] as $key => $value)
|
||||
foreach ((array)$server['p'] as $key => $value)
|
||||
{
|
||||
if (empty($server['p'][$key]['team'])) { continue; }
|
||||
|
||||
|
|
@ -1585,7 +1585,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
|
||||
$item = explode("\\", $part[0]);
|
||||
|
||||
foreach ($item as $item_key => $data_key)
|
||||
foreach ((array)$item as $item_key => $data_key)
|
||||
{
|
||||
if ($item_key % 2) { continue; } // SKIP ODD KEYS
|
||||
|
||||
|
|
@ -1597,7 +1597,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
|
||||
array_shift($part); // REMOVE SETTINGS
|
||||
|
||||
foreach ($part as $key => $data)
|
||||
foreach ((array)$part as $key => $data)
|
||||
{
|
||||
preg_match("/(.*) (.*) (.*) (.*) \"(.*)\" \"(.*)\" (.*) (.*)/s", $data, $match); // GREEDY MATCH FOR SKINS
|
||||
|
||||
|
|
@ -1616,7 +1616,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
$server['s']['game'] = $server['e']['*gamedir'];
|
||||
$server['s']['name'] = $server['e']['hostname'];
|
||||
$server['s']['map'] = $server['e']['map'];
|
||||
$server['s']['players'] = $server['p'] ? count($server['p']) : 0;
|
||||
$server['s']['players'] = $server['p'] ? count((array)$server['p']) : 0;
|
||||
$server['s']['playersmax'] = $server['e']['maxclients'];
|
||||
$server['s']['password'] = isset($server['e']['needpass']) && $server['e']['needpass'] > 0 && $server['e']['needpass'] < 4 ? 1 : 0;
|
||||
|
||||
|
|
@ -1676,7 +1676,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
elseif ($server['b']['type'] == "painkiller") { $field_list = array("name", "", "skin", "score", "ping", "" ); }
|
||||
elseif ($server['b']['type'] == "soldat") { $field_list = array("name", "team", "", "score", "ping", "time"); }
|
||||
|
||||
foreach ($field_list as $item_key)
|
||||
foreach ((array)$field_list as $item_key)
|
||||
{
|
||||
$item_value = lgsl_cut_pascal($buffer, 1, -1);
|
||||
|
||||
|
|
@ -1721,7 +1721,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
|
||||
$item = explode("\x00", $buffer);
|
||||
|
||||
foreach ($item as $item_key => $data_key)
|
||||
foreach ((array)$item as $item_key => $data_key)
|
||||
{
|
||||
if ($item_key % 2) { continue; } // SKIP EVEN KEYS
|
||||
|
||||
|
|
@ -1774,12 +1774,12 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
$item = explode("\x00",$buffer[1]); // SPLIT UP ITEMS
|
||||
|
||||
$item_position = 0;
|
||||
$item_total = count($item);
|
||||
$item_total = count((array)$item);
|
||||
$player_key = 0;
|
||||
|
||||
do
|
||||
{
|
||||
foreach ($field_list as $field)
|
||||
foreach ((array)$field_list as $field)
|
||||
{
|
||||
$server['p'][$player_key][$field] = $item[$item_position];
|
||||
|
||||
|
|
@ -1936,7 +1936,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
$server['s']['game'] = $server['e']['gamename'];
|
||||
$server['s']['name'] = $server['e']['si_name'];
|
||||
$server['s']['map'] = $server['e']['si_map'];
|
||||
$server['s']['players'] = $server['p'] ? count($server['p']) : 0;
|
||||
$server['s']['players'] = $server['p'] ? count((array)$server['p']) : 0;
|
||||
$server['s']['playersmax'] = $server['e']['si_maxplayers'];
|
||||
|
||||
if ($server['b']['type'] == "wolf2009" || $server['b']['type'] == "quakewars")
|
||||
|
|
@ -1988,7 +1988,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
"p1073741827" => "description",
|
||||
"p1073741828" => "mutators_custom");
|
||||
|
||||
foreach ($lgsl_ut3_key as $old => $new)
|
||||
foreach ((array)$lgsl_ut3_key as $old => $new)
|
||||
{
|
||||
if (!isset($server['e'][$old])) { continue; }
|
||||
$server['e'][$new] = $server['e'][$old];
|
||||
|
|
@ -2841,7 +2841,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
$team_field = "?".lgsl_cut_pascal($buffer);
|
||||
$team_field = explode("\t", $team_field);
|
||||
|
||||
foreach ($team_field as $key => $value)
|
||||
foreach ((array)$team_field as $key => $value)
|
||||
{
|
||||
$value = substr($value, 1);
|
||||
$value = strtolower($value);
|
||||
|
|
@ -2853,7 +2853,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
$player_field = "?".lgsl_cut_pascal($buffer);
|
||||
$player_field = explode("\t", $player_field);
|
||||
|
||||
foreach ($player_field as $key => $value)
|
||||
foreach ((array)$player_field as $key => $value)
|
||||
{
|
||||
$value = substr($value, 1);
|
||||
$value = strtolower($value);
|
||||
|
|
@ -2878,7 +2878,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
$team_info = str_replace("%t", $team_name, $team_info);
|
||||
$team_info = explode("\t", $team_info);
|
||||
|
||||
foreach ($team_info as $key => $value)
|
||||
foreach ((array)$team_info as $key => $value)
|
||||
{
|
||||
$field = $team_field[$key];
|
||||
$value = trim($value);
|
||||
|
|
@ -2905,7 +2905,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
$player_info = str_replace(array("%p","%l","%t","%n"), $player_bits, $player_info);
|
||||
$player_info = explode("\t", $player_info);
|
||||
|
||||
foreach ($player_info as $key => $value)
|
||||
foreach ((array)$player_info as $key => $value)
|
||||
{
|
||||
$field = $player_field[$key];
|
||||
$value = trim($value);
|
||||
|
|
@ -3248,7 +3248,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
|
||||
//---------------------------------------------------------+
|
||||
|
||||
foreach ($raw['attributeNames'] as $key => $field)
|
||||
foreach ((array)$raw['attributeNames'] as $key => $field)
|
||||
{
|
||||
$field = strtolower($field);
|
||||
|
||||
|
|
@ -3276,7 +3276,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
}
|
||||
|
||||
$lgsl_conversion = array("gamename"=>"name","mapname"=>"map","playercount"=>"players","maxplayers"=>"playersmax","flagpassword"=>"password");
|
||||
foreach ($lgsl_conversion as $e => $s) { $server['s'][$s] = $server['e'][$e]; unset($server['ea'][$e]); } // LGSL STANDARD
|
||||
foreach ((array)$lgsl_conversion as $e => $s) { $server['s'][$s] = $server['e'][$e]; unset($server['ea'][$e]); } // LGSL STANDARD
|
||||
$server['s']['playersmax'] += intval($server['e']['maxspectators']); // ADD SPECTATOR SLOTS TO MAX PLAYERS
|
||||
|
||||
//---------------------------------------------------------+
|
||||
|
|
@ -3336,7 +3336,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
|
||||
while ($packet_binary)
|
||||
{
|
||||
foreach ($huffman_table as $ascii => $huffman_binary)
|
||||
foreach ((array)$huffman_table as $ascii => $huffman_binary)
|
||||
{
|
||||
$huffman_length = strlen($huffman_binary);
|
||||
|
||||
|
|
@ -3726,7 +3726,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
|
||||
for ($i=0; $i<$player_total; $i++)
|
||||
{
|
||||
foreach ($field_list as $field)
|
||||
foreach ((array)$field_list as $field)
|
||||
{
|
||||
$value = lgsl_cut_pascal($buffer, 4, 0, 1);
|
||||
|
||||
|
|
@ -3898,7 +3898,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
|
||||
for ($i=0; $i<$player_total; $i++)
|
||||
{
|
||||
foreach ($field_list as $field)
|
||||
foreach ((array)$field_list as $field)
|
||||
{
|
||||
$value = lgsl_cut_pascal($buffer, 4, 0, 1);
|
||||
switch ($field)
|
||||
|
|
@ -3955,12 +3955,12 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
// Get the channels array
|
||||
$channels = $murmur->get_channels();
|
||||
|
||||
if(count($users) > 0)
|
||||
if(count((array)$users) > 0)
|
||||
{
|
||||
$server['s']['players'] = count($users);
|
||||
$server['s']['players'] = count((array)$users);
|
||||
|
||||
$i=0;
|
||||
foreach($users as $user)
|
||||
foreach ((array)$users as $user)
|
||||
{
|
||||
$server['p'][$i]['name'] = $user['name'];
|
||||
$server['p'][$i]['score'] = $user['idlesecs'];
|
||||
|
|
@ -3998,7 +3998,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
curl_close($ch);
|
||||
//Parser
|
||||
preg_match_all("(<tr><td style=\"vertical-align:top;\">(.*)</tr>)siU", $result, $matches);
|
||||
foreach ( $matches[1] as $servers )
|
||||
foreach ((array)$matches[1] as $servers)
|
||||
{
|
||||
if (preg_match("/$ip:$port/",$servers))
|
||||
{
|
||||
|
|
@ -4033,12 +4033,12 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
//players list
|
||||
preg_match_all("(<td style=\"vertical-align:top;font-size:0.9em;\"><span style=\"color:#888888;\">(.*)</td>)siU", $servers, $playerslist);
|
||||
$players_array[0] = "";
|
||||
foreach ( $playerslist[1] as $player_row )
|
||||
foreach ((array)$playerslist[1] as $player_row)
|
||||
{
|
||||
preg_match_all("(</span>(.*) <)siU", $player_row, $player_name);
|
||||
$i = 0;
|
||||
|
||||
foreach ( $player_name[1] as $player )
|
||||
foreach ((array)$player_name[1] as $player)
|
||||
{
|
||||
trim($player);
|
||||
$server['p'][$i]['name'] = $player;
|
||||
|
|
@ -4074,13 +4074,13 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
preg_match_all("(\| INFO\|(.*)\\n)siU", $data, $matches);
|
||||
$matches = array_reverse($matches);
|
||||
$rows = "";
|
||||
foreach ( $matches[1] as $info_row )
|
||||
foreach ((array)$matches[1] as $info_row)
|
||||
{
|
||||
$rows .= $info_row;
|
||||
$info_row = $info_row."INFO<br>";
|
||||
if (preg_match_all("(servername:(.*)INFO)siU", $info_row, $info))
|
||||
{
|
||||
foreach ( $info[1] as $value )
|
||||
foreach ((array)$info[1] as $value)
|
||||
{
|
||||
$value = trim($value);
|
||||
$remote->remote_writefile($home_info['home_path'].'/servername.txt',$value);
|
||||
|
|
@ -4090,7 +4090,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
}
|
||||
if (preg_match_all("(terrain:(.*)INFO)siU", $info_row, $info))
|
||||
{
|
||||
foreach ( $info[1] as $value )
|
||||
foreach ((array)$info[1] as $value)
|
||||
{
|
||||
$value = trim($value);
|
||||
$remote->remote_writefile($home_info['home_path'].'/terrain.txt',$value);
|
||||
|
|
@ -4099,7 +4099,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
}
|
||||
if (preg_match_all("(maxclients:(.*)INFO)siU", $info_row, $info))
|
||||
{
|
||||
foreach ( $info[1] as $value )
|
||||
foreach ((array)$info[1] as $value)
|
||||
{
|
||||
$value = trim($value);
|
||||
$remote->remote_writefile($home_info['home_path'].'/maxclients.txt',$value);
|
||||
|
|
@ -4127,7 +4127,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
if (preg_match_all("(FO\|(.*)\|.IN)siU", $info_row, $info))
|
||||
{
|
||||
$i = 0;
|
||||
foreach ( $info[1] as $value )
|
||||
foreach ((array)$info[1] as $value)
|
||||
{
|
||||
$value = trim($value);
|
||||
$value = str_replace('|', "", $value);
|
||||
|
|
@ -4201,7 +4201,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
{
|
||||
$settings = explode("\n", $data);
|
||||
$i = 0;
|
||||
foreach ( $settings as $setting )
|
||||
foreach ((array)$settings as $setting)
|
||||
{
|
||||
$setting = trim($setting);
|
||||
$setting = explode(":", $setting);
|
||||
|
|
@ -4274,7 +4274,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
if( $server_data['players'] > 0)
|
||||
{
|
||||
$i=0;
|
||||
foreach($users as $user)
|
||||
foreach ((array)$users as $user)
|
||||
{
|
||||
$server['p'][$i]['name'] = $user;
|
||||
$i++;
|
||||
|
|
@ -4329,7 +4329,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
|
|||
|
||||
$data = explode('\\', $buffer);
|
||||
|
||||
for ($i = 0; $i < count($data); $i += 2) {
|
||||
for ($i = 0; $i < count((array)$data); $i += 2) {
|
||||
if ($data[$i] == 'sv_maxclients') {
|
||||
$server['s']['playersmax'] = $data[$i + 1];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue