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:
copilot-swe-agent[bot] 2026-04-23 14:01:37 +00:00 committed by GitHub
parent aca850b6cd
commit e44519c030
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
465 changed files with 1716 additions and 1716 deletions

View file

@ -48,7 +48,7 @@ function exec_ogp_module()
<td class='left'>
<select onchange=".'"this.form.submit()"'." name='rserver_id'>
<option></option>\n";
foreach ( $remote_servers as $server )
foreach ((array)$remote_servers as $server)
{
$display_ip = checkDisplayPublicIP($server['display_public_ip'],$server['ip'] != $server['agent_ip'] ? $server['ip'] : $server['agent_ip']);
echo "<option value='".$server['remote_server_id']."'>".
@ -89,7 +89,7 @@ function exec_ogp_module()
if( isset( $_POST['vserver_id'] ) && !$isAdmin )
{
foreach($TS3_list as $TS3)
foreach ((array)$TS3_list as $TS3)
{
if($_POST['vserver_id'] == $TS3['vserver_id'])
{
@ -113,7 +113,7 @@ function exec_ogp_module()
{
echo "<table><tr>";
$counter = 0;
foreach( $TS3_list as $TS3 )
foreach ((array)$TS3_list as $TS3)
{
$counter++;
echo "<td><form action='' method='POST'>

View file

@ -285,7 +285,7 @@ class Config_File {
/* parse file line by line */
preg_match_all('!^.*\r?\n?!m', $contents, $match);
$lines = $match[0];
for ($i=0, $count=count($lines); $i<$count; $i++) {
for ($i=0, $count=count((array)$lines); $i<$count; $i++) {
$line = $lines[$i];
if (empty($line)) continue;

View file

@ -587,7 +587,7 @@ class Smarty
function assign($tpl_var, $value = null)
{
if (is_array($tpl_var)){
foreach ($tpl_var as $key => $val) {
foreach ((array)$tpl_var as $key => $val) {
if ($key != '') {
$this->_tpl_vars[$key] = $val;
}
@ -620,13 +620,13 @@ class Smarty
{
if (is_array($tpl_var)) {
// $tpl_var is an array, ignore $value
foreach ($tpl_var as $_key => $_val) {
foreach ((array)$tpl_var as $_key => $_val) {
if ($_key != '') {
if(!@is_array($this->_tpl_vars[$_key])) {
settype($this->_tpl_vars[$_key],'array');
}
if($merge && is_array($_val)) {
foreach($_val as $_mkey => $_mval) {
foreach ((array)$_val as $_mkey => $_mval) {
$this->_tpl_vars[$_key][$_mkey] = $_mval;
}
} else {
@ -640,7 +640,7 @@ class Smarty
settype($this->_tpl_vars[$tpl_var],'array');
}
if($merge && is_array($value)) {
foreach($value as $_mkey => $_mval) {
foreach ((array)$value as $_mkey => $_mval) {
$this->_tpl_vars[$tpl_var][$_mkey] = $_mval;
}
} else {
@ -663,7 +663,7 @@ class Smarty
settype($this->_tpl_vars[$tpl_var],'array');
}
if ($merge && is_array($value)) {
foreach($value as $_key => $_val) {
foreach ((array)$value as $_key => $_val) {
$this->_tpl_vars[$tpl_var][$_key] = &$value[$_key];
}
} else {
@ -681,7 +681,7 @@ class Smarty
function clear_assign($tpl_var)
{
if (is_array($tpl_var))
foreach ($tpl_var as $curr_var)
foreach ((array)$tpl_var as $curr_var)
unset($this->_tpl_vars[$curr_var]);
else
unset($this->_tpl_vars[$tpl_var]);
@ -813,11 +813,11 @@ class Smarty
*/
function register_resource($type, $functions)
{
if (count($functions)==4) {
if (count((array)$functions)==4) {
$this->_plugins['resource'][$type] =
array($functions, false);
} elseif (count($functions)==5) {
} elseif (count((array)$functions)==5) {
$this->_plugins['resource'][$type] =
array(array(array(&$functions[0], $functions[1])
,array(&$functions[0], $functions[2])
@ -1244,7 +1244,7 @@ class Smarty
// load filters that are marked as autoload
if (count($this->autoload_filters)) {
foreach ($this->autoload_filters as $_filter_type => $_filters) {
foreach ($_filters as $_filter) {
foreach ((array)$_filters as $_filter) {
$this->load_filter($_filter_type, $_filter);
}
}
@ -1625,7 +1625,7 @@ class Smarty
// split tpl_path by the first colon
$_resource_name_parts = explode(':', $params['resource_name'], 2);
if (count($_resource_name_parts) == 1) {
if (count((array)$_resource_name_parts) == 1) {
// no resource type given
$params['resource_type'] = $this->default_resource_type;
$params['resource_name'] = $_resource_name_parts[0];
@ -1688,7 +1688,7 @@ class Smarty
$this->_plugins['modifier'][$_modifier_name];
$_var = $_args[0];
foreach ($_var as $_key => $_val) {
foreach ((array)$_var as $_key => $_val) {
$_args[0] = $_val;
$_var[$_key] = call_user_func_array($_func_name, $_args);
}
@ -1911,7 +1911,7 @@ class Smarty
} else {
/* add a reference to a new set of cache_attrs */
$_cache_attrs[] = array();
return $_cache_attrs[count($_cache_attrs)-1];
return $_cache_attrs[count((array)$_cache_attrs)-1];
}

View file

@ -276,17 +276,17 @@ class Smarty_Compiler extends Smarty {
$text_blocks = preg_split("~{$ldq}.*?{$rdq}~s", $source_content);
/* loop through text blocks */
for ($curr_tb = 0, $for_max = count($text_blocks); $curr_tb < $for_max; $curr_tb++) {
for ($curr_tb = 0, $for_max = count((array)$text_blocks); $curr_tb < $for_max; $curr_tb++) {
/* match anything resembling php tags */
if (preg_match_all('~(<\?(?:\w+|=)?|\?>|language\s*=\s*[\"\']?\s*php\s*[\"\']?)~is', $text_blocks[$curr_tb], $sp_match)) {
/* replace tags with placeholders to prevent recursive replacements */
$sp_match[1] = array_unique($sp_match[1]);
usort($sp_match[1], '_smarty_sort_length');
for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) {
for ($curr_sp = 0, $for_max2 = count((array)$sp_match[1]); $curr_sp < $for_max2; $curr_sp++) {
$text_blocks[$curr_tb] = str_replace($sp_match[1][$curr_sp],'%%%SMARTYSP'.$curr_sp.'%%%',$text_blocks[$curr_tb]);
}
/* process each one */
for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) {
for ($curr_sp = 0, $for_max2 = count((array)$sp_match[1]); $curr_sp < $for_max2; $curr_sp++) {
if ($this->php_handling == SMARTY_PHP_PASSTHRU) {
/* echo php contents */
$text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '<?php echo \''.str_replace("'", "\'", $sp_match[1][$curr_sp]).'\'; ?>'."\n", $text_blocks[$curr_tb]);
@ -307,7 +307,7 @@ class Smarty_Compiler extends Smarty {
/* Compile the template tags into PHP code. */
$compiled_tags = array();
for ($i = 0, $for_max = count($template_tags); $i < $for_max; $i++) {
for ($i = 0, $for_max = count((array)$template_tags); $i < $for_max; $i++) {
$this->_current_line_no += substr_count($text_blocks[$i], "\n");
$compiled_tags[] = $this->_compile_tag($template_tags[$i]);
$this->_current_line_no += substr_count($template_tags[$i], "\n");
@ -321,7 +321,7 @@ class Smarty_Compiler extends Smarty {
/* Reformat $text_blocks between 'strip' and '/strip' tags,
removing spaces, tabs and newlines. */
$strip = false;
for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) {
for ($i = 0, $for_max = count((array)$compiled_tags); $i < $for_max; $i++) {
if ($compiled_tags[$i] == '{strip}') {
$compiled_tags[$i] = '';
$strip = true;
@ -353,7 +353,7 @@ class Smarty_Compiler extends Smarty {
$tag_guard = '%%%SMARTYOTG' . md5(uniqid(rand(), true)) . '%%%';
/* Interleave the compiled contents and text blocks to get the final result. */
for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) {
for ($i = 0, $for_max = count((array)$compiled_tags); $i < $for_max; $i++) {
if ($compiled_tags[$i] == '') {
// tag result empty, remove first newline from following text block
$text_blocks[$i+1] = preg_replace('~^(\r\n|\r|\n)~', '', $text_blocks[$i+1]);
@ -405,7 +405,7 @@ class Smarty_Compiler extends Smarty {
if (count($this->_plugin_info)) {
$_plugins_params = "array('plugins' => array(";
foreach ($this->_plugin_info as $plugin_type => $plugins) {
foreach ($plugins as $plugin_name => $plugin_info) {
foreach ((array)$plugins as $plugin_name => $plugin_info) {
$_plugins_params .= "array('$plugin_type', '$plugin_name', '" . strtr($plugin_info[0], array("'" => "\\'", "\\" => "\\\\")) . "', $plugin_info[1], ";
$_plugins_params .= $plugin_info[2] ? 'true),' : 'false),';
}
@ -560,7 +560,7 @@ class Smarty_Compiler extends Smarty {
$this->_current_line_no += substr_count($block[0], "\n");
/* the number of matched elements in the regexp in _compile_file()
determins the type of folded tag that was found */
switch (count($block)) {
switch (count((array)$block)) {
case 2: /* comment */
return '';
@ -848,9 +848,9 @@ class Smarty_Compiler extends Smarty {
list($object, $obj_comp) = explode('->', $tag_command);
$arg_list = array();
if(count($attrs)) {
if(count((array)$attrs)) {
$_assign_var = false;
foreach ($attrs as $arg_name => $arg_value) {
foreach ((array)$attrs as $arg_name => $arg_value) {
if($arg_name == 'assign') {
$_assign_var = $arg_value;
unset($attrs['assign']);
@ -947,7 +947,7 @@ class Smarty_Compiler extends Smarty {
$delayed_loading = false;
}
foreach ($attrs as $arg_name => $arg_value) {
foreach ((array)$attrs as $arg_name => $arg_value) {
if (is_bool($arg_value))
$arg_value = $arg_value ? 'true' : 'false';
$arg_list[] = "'$arg_name' => $arg_value";
@ -975,7 +975,7 @@ class Smarty_Compiler extends Smarty {
$this->_syntax_error("missing 'file' attribute in include tag", E_USER_ERROR, __FILE__, __LINE__);
}
foreach ($attrs as $arg_name => $arg_value) {
foreach ((array)$attrs as $arg_name => $arg_value) {
if ($arg_name == 'file') {
$include_file = $arg_value;
continue;
@ -1031,7 +1031,7 @@ class Smarty_Compiler extends Smarty {
$once_var = (empty($attrs['once']) || $attrs['once']=='false') ? 'false' : 'true';
$arg_list = array();
foreach($attrs as $arg_name => $arg_value) {
foreach ((array)$attrs as $arg_name => $arg_value) {
if($arg_name != 'file' AND $arg_name != 'once' AND $arg_name != 'assign') {
if(is_bool($arg_value))
$arg_value = $arg_value ? 'true' : 'false';
@ -1065,7 +1065,7 @@ class Smarty_Compiler extends Smarty {
$output .= "unset(\$this->_sections[$section_name]);\n";
$section_props = "\$this->_sections[$section_name]";
foreach ($attrs as $attr_name => $attr_value) {
foreach ((array)$attrs as $attr_name => $attr_value) {
switch ($attr_name) {
case 'loop':
$output .= "{$section_props}['loop'] = is_array(\$_loop=$attr_value) ? count(\$_loop) : max(0, (int)\$_loop); unset(\$_loop);\n";
@ -1279,7 +1279,7 @@ class Smarty_Compiler extends Smarty {
$is_arg_stack = array();
for ($i = 0; $i < count($tokens); $i++) {
for ($i = 0; $i < count((array)$tokens); $i++) {
$token = &$tokens[$i];
@ -1384,7 +1384,7 @@ class Smarty_Compiler extends Smarty {
$new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
/* Replace the old tokens with the new ones. */
array_splice($tokens, $is_arg_start, count($tokens), $new_tokens);
array_splice($tokens, $is_arg_start, count((array)$tokens), $new_tokens);
/* Adjust argument start so that it won't change from the
current position for the next iteration. */
@ -1439,7 +1439,7 @@ class Smarty_Compiler extends Smarty {
$_cache_attrs = null;
}
foreach ($attrs as $arg_name => $arg_value) {
foreach ((array)$attrs as $arg_name => $arg_value) {
if (is_bool($arg_value))
$arg_value = $arg_value ? 'true' : 'false';
if (is_null($arg_value))
@ -1538,7 +1538,7 @@ class Smarty_Compiler extends Smarty {
2 - expecting attribute value (not '=') */
$state = 0;
foreach ($tokens as $token) {
foreach ((array)$tokens as $token) {
switch ($state) {
case 0:
/* If the token is a valid identifier, we set attribute name
@ -1607,7 +1607,7 @@ class Smarty_Compiler extends Smarty {
*/
function _parse_vars_props(&$tokens)
{
foreach($tokens as $key => $val) {
foreach ((array)$tokens as $key => $val) {
$tokens[$key] = $this->_parse_var_props($val);
}
}
@ -1686,7 +1686,7 @@ class Smarty_Compiler extends Smarty {
if(preg_match_all('~(?:\`(?<!\\\\)\$' . $this->_dvar_guts_regexp . '(?:' . $this->_obj_ext_regexp . ')*\`)|(?:(?<!\\\\)\$\w+(\[[a-zA-Z0-9]+\])*)~', $var_expr, $_match)) {
$_match = $_match[0];
$_replace = array();
foreach($_match as $_var) {
foreach ((array)$_match as $_var) {
$_replace[$_var] = '".(' . $this->_parse_var(str_replace('`','',$_var)) . ')."';
}
$var_expr = strtr($var_expr, $_replace);
@ -1711,12 +1711,12 @@ class Smarty_Compiler extends Smarty {
$_has_math = false;
$_math_vars = preg_split('~('.$this->_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', $var_expr, -1, PREG_SPLIT_DELIM_CAPTURE);
if(count($_math_vars) > 1) {
if(count((array)$_math_vars) > 1) {
$_first_var = "";
$_complete_var = "";
$_output = "";
// simple check if there is any math, to stop recursion (due to modifiers with "xx % yy" as parameter)
foreach($_math_vars as $_k => $_math_var) {
foreach ((array)$_math_vars as $_k => $_math_var) {
$_math_var = $_math_vars[$_k];
if(!empty($_math_var) || is_numeric($_math_var)) {
@ -1777,7 +1777,7 @@ class Smarty_Compiler extends Smarty {
}
} elseif(is_numeric($_var_name) && is_numeric(substr($var_expr, 0, 1))) {
// because . is the operator for accessing arrays thru inidizes we need to put it together again for floating point numbers
if(count($_indexes) > 0)
if(count((array)$_indexes) > 0)
{
$_var_name .= implode("", $_indexes);
$_indexes = array();
@ -1787,7 +1787,7 @@ class Smarty_Compiler extends Smarty {
$_output = "\$this->_tpl_vars['$_var_name']";
}
foreach ($_indexes as $_index) {
foreach ((array)$_indexes as $_index) {
if (substr($_index, 0, 1) == '[') {
$_index = substr($_index, 1, -1);
if (is_numeric($_index)) {
@ -1847,7 +1847,7 @@ class Smarty_Compiler extends Smarty {
$orig_vals = $match = $match[0];
$this->_parse_vars_props($match);
$replace = array();
for ($i = 0, $count = count($match); $i < $count; $i++) {
for ($i = 0, $count = count((array)$match); $i < $count; $i++) {
$replace[$orig_vals[$i]] = $match[$i];
}
return strtr($parenth_args, $replace);
@ -1909,7 +1909,7 @@ class Smarty_Compiler extends Smarty {
preg_match_all('~\|(@?\w+)((?>:(?:'. $this->_qstr_regexp . '|[^|]+))*)~', '|' . $modifier_string, $_match);
list(, $_modifiers, $modifier_arg_strings) = $_match;
for ($_i = 0, $_for_max = count($_modifiers); $_i < $_for_max; $_i++) {
for ($_i = 0, $_for_max = count((array)$_modifiers); $_i < $_for_max; $_i++) {
$_modifier_name = $_modifiers[$_i];
if($_modifier_name == 'smarty') {
@ -1949,7 +1949,7 @@ class Smarty_Compiler extends Smarty {
$_modifier_args[0] = '@' . $_modifier_args[0];
}
}
if (count($_modifier_args) > 0)
if (count((array)$_modifier_args) > 0)
$_modifier_args = ', '.implode(', ', $_modifier_args);
else
$_modifier_args = '';
@ -1996,7 +1996,7 @@ class Smarty_Compiler extends Smarty {
{
/* Extract the reference name. */
$_ref = substr($indexes[0], 1);
foreach($indexes as $_index_no=>$_index) {
foreach ((array)$indexes as $_index_no=>$_index) {
if (substr($_index, 0, 1) != '.' && $_index_no<2 || !preg_match('~^(\.|\[|->)~', $_index)) {
$this->_syntax_error('$smarty' . implode('', array_slice($indexes, 0, 2)) . ' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__);
}
@ -2165,7 +2165,7 @@ class Smarty_Compiler extends Smarty {
break;
}
if (isset($_max_index) && count($indexes) > $_max_index) {
if (isset($_max_index) && count((array)$indexes) > $_max_index) {
$this->_syntax_error('$smarty' . implode('', $indexes) .' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__);
}

View file

@ -49,13 +49,13 @@ function smarty_core_create_dir_structure($params, &$smarty)
}
/* all paths use "/" only from here */
foreach ($_dir_parts as $_dir_part) {
foreach ((array)$_dir_parts as $_dir_part) {
$_new_dir .= $_dir_part;
if ($_use_open_basedir) {
// do not attempt to test or make directories outside of open_basedir
$_make_new_dir = false;
foreach ($_open_basedirs as $_open_basedir) {
foreach ((array)$_open_basedirs as $_open_basedir) {
if (substr($_new_dir, 0, strlen($_open_basedir)) == $_open_basedir) {
$_make_new_dir = true;
break;

View file

@ -30,7 +30,7 @@ function smarty_core_get_include_path(&$params, &$smarty)
$_path_array = explode(':',$_ini_include_path);
}
}
foreach ($_path_array as $_include_path) {
foreach ((array)$_path_array as $_include_path) {
if (@is_readable($_include_path . DIRECTORY_SEPARATOR . $params['file_path'])) {
$params['new_file_path'] = $_include_path . DIRECTORY_SEPARATOR . $params['file_path'];
return true;

View file

@ -16,7 +16,7 @@
function smarty_core_load_plugins($params, &$smarty)
{
foreach ($params['plugins'] as $_plugin_info) {
foreach ((array)$params['plugins'] as $_plugin_info) {
list($_type, $_name, $_tpl_file, $_tpl_line, $_delayed_loading) = $_plugin_info;
$_plugin = &$smarty->_plugins[$_type][$_name];

View file

@ -24,9 +24,9 @@ function smarty_core_load_resource_plugin($params, &$smarty)
$_plugin = &$smarty->_plugins['resource'][$params['type']];
if (isset($_plugin)) {
if (!$_plugin[1] && count($_plugin[0])) {
if (!$_plugin[1] && count((array)$_plugin[0])) {
$_plugin[1] = true;
foreach ($_plugin[0] as $_plugin_func) {
foreach ((array)$_plugin[0] as $_plugin_func) {
if (!is_callable($_plugin_func)) {
$_plugin[1] = false;
break;
@ -55,7 +55,7 @@ function smarty_core_load_resource_plugin($params, &$smarty)
*/
$_resource_ops = array('source', 'timestamp', 'secure', 'trusted');
$_resource_funcs = array();
foreach ($_resource_ops as $_op) {
foreach ((array)$_resource_ops as $_op) {
$_plugin_func = 'smarty_resource_' . $params['type'] . '_' . $_op;
if (!function_exists($_plugin_func)) {
$smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", null, null, __FILE__, __LINE__);

View file

@ -17,7 +17,7 @@ function smarty_core_process_cached_inserts($params, &$smarty)
$params['results'], $match);
list($cached_inserts, $insert_args) = $match;
for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) {
for ($i = 0, $for_max = count((array)$cached_inserts); $i < $for_max; $i++) {
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');

View file

@ -38,12 +38,12 @@ function smarty_core_write_cache_file($params, &$smarty)
// this new nocache-tag will be replaced by dynamic contents in
// smarty_core_process_compiled_includes() on a cache-read
$match_count = count($match[0]);
$match_count = count((array)$match[0]);
$results = preg_split('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!', $params['results'], -1, PREG_SPLIT_DELIM_CAPTURE);
$level = 0;
$j = 0;
for ($i=0, $results_count = count($results); $i < $results_count && $j < $match_count; $i++) {
for ($i=0, $results_count = count((array)$results); $i < $results_count && $j < $match_count; $i++) {
if ($results[$i] == $match[0][$j]) {
// nocache tag
if ($match[1][$j]) { // closing tag

View file

@ -22,7 +22,7 @@ function smarty_core_write_compiled_include($params, &$smarty)
$params['compiled_content'], $_match_source, PREG_SET_ORDER);
// no nocache-parts found: done
if (count($_match_source)==0) return;
if (count((array)$_match_source)==0) return;
// convert the matched php-code to functions
$_include_compiled = "<?php /* Smarty version ".$smarty->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
@ -37,7 +37,7 @@ function smarty_core_write_compiled_include($params, &$smarty)
$_include_compiled .= "<?php";
$this_varname = ((double)phpversion() >= 5.0) ? '_smarty' : 'this';
for ($_i = 0, $_for_max = count($_match_source); $_i < $_for_max; $_i++) {
for ($_i = 0, $_for_max = count((array)$_match_source); $_i < $_for_max; $_i++) {
$_match =& $_match_source[$_i];
$source = $_match[4];
if ($this_varname == '_smarty') {
@ -56,7 +56,7 @@ function smarty_core_write_compiled_include($params, &$smarty)
if ($open_tag == '<?php ') break;
}
for ($i=0, $count = count($tokens); $i < $count; $i++) {
for ($i=0, $count = count((array)$tokens); $i < $count; $i++) {
if (is_array($tokens[$i])) {
if ($tokens[$i][0] == T_VARIABLE && $tokens[$i][1] == '$this') {
$tokens[$i] = '$' . $this_varname;

View file

@ -43,7 +43,7 @@ function smarty_block_textformat($params, $content, &$smarty)
$wrap_cut = false;
$assign = null;
foreach ($params as $_key => $_val) {
foreach ((array)$params as $_key => $_val) {
switch ($_key) {
case 'style':
case 'indent_char':
@ -75,7 +75,7 @@ function smarty_block_textformat($params, $content, &$smarty)
$_paragraphs = preg_split('![\r\n][\r\n]!',$content);
$_output = '';
for($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) {
for($_x = 0, $_y = count((array)$_paragraphs); $_x < $_y; $_x++) {
if ($_paragraphs[$_x] == '') {
continue;
}

View file

@ -91,7 +91,7 @@ function smarty_function_cycle($params, &$smarty)
}
if($advance) {
if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) {
if ( $cycle_vars[$name]['index'] >= count((array)$cycle_array) -1 ) {
$cycle_vars[$name]['index'] = 0;
} else {
$cycle_vars[$name]['index']++;

View file

@ -72,7 +72,7 @@ function smarty_function_fetch($params, &$smarty)
$pass = $uri_parts['pass'];
}
// loop through parameters, setup headers
foreach($params as $param_key => $param_value) {
foreach ((array)$params as $param_key => $param_value) {
switch($param_key) {
case "file":
case "assign":
@ -168,7 +168,7 @@ function smarty_function_fetch($params, &$smarty)
fputs($fp, "Referer: $referer\r\n");
}
if(isset($extra_headers) && is_array($extra_headers)) {
foreach($extra_headers as $curr_header) {
foreach ((array)$extra_headers as $curr_header) {
fputs($fp, $curr_header."\r\n");
}
}

View file

@ -52,7 +52,7 @@ function smarty_function_html_checkboxes($params, &$smarty)
$extra = '';
foreach($params as $_key => $_val) {
foreach ((array)$params as $_key => $_val) {
switch($_key) {
case 'name':
case 'separator':
@ -103,12 +103,12 @@ function smarty_function_html_checkboxes($params, &$smarty)
if (isset($options)) {
foreach ($options as $_key=>$_val)
foreach ((array)$options as $_key=>$_val)
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
} else {
foreach ($values as $_i=>$_key) {
foreach ((array)$values as $_i=>$_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
}

View file

@ -48,7 +48,7 @@ function smarty_function_html_image($params, &$smarty)
$path_prefix = '';
$server_vars = ($smarty->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
$basedir = isset($server_vars['DOCUMENT_ROOT']) ? $server_vars['DOCUMENT_ROOT'] : '';
foreach($params as $_key => $_val) {
foreach ((array)$params as $_key => $_val) {
switch($_key) {
case 'file':
case 'height':

View file

@ -39,7 +39,7 @@ function smarty_function_html_options($params, &$smarty)
$extra = '';
foreach($params as $_key => $_val) {
foreach ((array)$params as $_key => $_val) {
switch($_key) {
case 'name':
$$_key = (string)$_val;
@ -75,12 +75,12 @@ function smarty_function_html_options($params, &$smarty)
if (isset($options)) {
foreach ($options as $_key=>$_val)
foreach ((array)$options as $_key=>$_val)
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
} else {
foreach ($values as $_i=>$_key) {
foreach ((array)$values as $_i=>$_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
}
@ -110,7 +110,7 @@ function smarty_function_html_options_optoutput($key, $value, $selected) {
function smarty_function_html_options_optgroup($key, $values, $selected) {
$optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
foreach ($values as $key => $value) {
foreach ((array)$values as $key => $value) {
$optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected);
}
$optgroup_html .= "</optgroup>\n";

View file

@ -52,7 +52,7 @@ function smarty_function_html_radios($params, &$smarty)
$output = null;
$extra = '';
foreach($params as $_key => $_val) {
foreach ((array)$params as $_key => $_val) {
switch($_key) {
case 'name':
case 'separator':
@ -107,12 +107,12 @@ function smarty_function_html_radios($params, &$smarty)
if (isset($options)) {
foreach ($options as $_key=>$_val)
foreach ((array)$options as $_key=>$_val)
$_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
} else {
foreach ($values as $_i=>$_key) {
foreach ((array)$values as $_i=>$_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
}

View file

@ -84,7 +84,7 @@ function smarty_function_html_select_date($params, &$smarty)
$year_empty = null;
$extra_attrs = '';
foreach ($params as $_key=>$_value) {
foreach ((array)$params as $_key=>$_value) {
switch ($_key) {
case 'prefix':
case 'time':
@ -135,7 +135,7 @@ function smarty_function_html_select_date($params, &$smarty)
if (preg_match('!^-\d+$!', $time)) {
// negative timestamp, use date()
$time = date('Y-m-d', $time);
$time = date('Y-m-d', is_numeric($time) ? (int)$time : strtotime($time));
}
// If $time is not in format yyyy-mm-dd
if (preg_match('/^(\d{0,4}-\d{0,2}-\d{0,2})/', $time, $found)) {

View file

@ -46,7 +46,7 @@ function smarty_function_html_select_time($params, &$smarty)
$second_extra = null;
$meridian_extra = null;
foreach ($params as $_key=>$_value) {
foreach ((array)$params as $_key=>$_value) {
switch ($_key) {
case 'prefix':
case 'time':
@ -84,7 +84,7 @@ function smarty_function_html_select_time($params, &$smarty)
if ($display_hours) {
$hours = $use_24_hours ? range(0, 23) : range(1, 12);
$hour_fmt = $use_24_hours ? '%H' : '%I';
for ($i = 0, $for_max = count($hours); $i < $for_max; $i++)
for ($i = 0, $for_max = count((array)$hours); $i < $for_max; $i++)
$hours[$i] = sprintf('%02d', $hours[$i]);
$html_result .= '<select name=';
if (null !== $field_array) {
@ -109,7 +109,7 @@ function smarty_function_html_select_time($params, &$smarty)
if ($display_minutes) {
$all_minutes = range(0, 59);
for ($i = 0, $for_max = count($all_minutes); $i < $for_max; $i+= $minute_interval)
for ($i = 0, $for_max = count((array)$all_minutes); $i < $for_max; $i+= $minute_interval)
$minutes[] = sprintf('%02d', $all_minutes[$i]);
$selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval);
$html_result .= '<select name=';
@ -136,7 +136,7 @@ function smarty_function_html_select_time($params, &$smarty)
if ($display_seconds) {
$all_seconds = range(0, 59);
for ($i = 0, $for_max = count($all_seconds); $i < $for_max; $i+= $second_interval)
for ($i = 0, $for_max = count((array)$all_seconds); $i < $for_max; $i+= $second_interval)
$seconds[] = sprintf('%02d', $all_seconds[$i]);
$selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval);
$html_result .= '<select name=';

View file

@ -65,7 +65,7 @@ function smarty_function_html_table($params, &$smarty)
return;
}
foreach ($params as $_key=>$_value) {
foreach ((array)$params as $_key=>$_value) {
switch ($_key) {
case 'loop':
$$_key = (array)$_value;
@ -74,10 +74,10 @@ function smarty_function_html_table($params, &$smarty)
case 'cols':
if (is_array($_value) && !empty($_value)) {
$cols = $_value;
$cols_count = count($_value);
$cols_count = count((array)$_value);
} elseif (!is_numeric($_value) && is_string($_value) && !empty($_value)) {
$cols = explode(',', $_value);
$cols_count = count($cols);
$cols_count = count((array)$cols);
} elseif (!empty($_value)) {
$cols_count = (int)$_value;
} else {
@ -106,7 +106,7 @@ function smarty_function_html_table($params, &$smarty)
}
}
$loop_count = count($loop);
$loop_count = count((array)$loop);
if (empty($params['rows'])) {
/* no rows specified */
$rows = ceil($loop_count/$cols_count);
@ -165,7 +165,7 @@ function smarty_function_html_table_cycle($name, $var, $no) {
if(!is_array($var)) {
$ret = $var;
} else {
$ret = $var[$no % count($var)];
$ret = $var[$no % count((array)$var)];
}
return ($ret) ? ' '.$ret : '';

View file

@ -65,7 +65,7 @@ function smarty_function_mailto($params, &$smarty)
$search = array('%40', '%2C');
$replace = array('@', ',');
$mail_parms = array();
foreach ($params as $var=>$value) {
foreach ((array)$params as $var=>$value) {
switch ($var) {
case 'cc':
case 'bcc':
@ -88,7 +88,7 @@ function smarty_function_mailto($params, &$smarty)
}
$mail_parm_vals = '';
for ($i=0; $i<count($mail_parms); $i++) {
for ($i=0; $i<count((array)$mail_parms); $i++) {
$mail_parm_vals .= (0==$i) ? '?' : '&';
$mail_parm_vals .= $mail_parms[$i];
}

View file

@ -61,7 +61,7 @@ function smarty_function_math($params, $template)
// match all vars in equation, make sure all are passed
preg_match_all('!(?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)!', $equation, $match);
foreach ($match[ 1 ] as $curr_var) {
foreach ((array)$match[ 1 ] as $curr_var) {
if ($curr_var && !isset($params[ $curr_var ]) && !isset($_allowed_funcs[ $curr_var ])) {
trigger_error("math: function call $curr_var not allowed", E_USER_WARNING);
@ -69,7 +69,7 @@ function smarty_function_math($params, $template)
}
}
foreach ($params as $key => $val) {
foreach ((array)$params as $key => $val) {
if ($key != "equation" && $key != "format" && $key != "assign") {
// make sure value is not empty
if (strlen($val) == 0) {

View file

@ -22,7 +22,7 @@
function smarty_function_popup($params, &$smarty)
{
$append = '';
foreach ($params as $_key=>$_value) {
foreach ((array)$params as $_key=>$_value) {
switch ($_key) {
case 'text':
case 'trigger':

View file

@ -25,7 +25,7 @@ function smarty_modifier_count_words($string)
// count matches that contain alphanumerics
$word_count = preg_grep('/[a-zA-Z0-9\\x80-\\xff]/', $split_array);
return count($word_count);
return count((array)$word_count);
}
/* vim: set expandtab: */

View file

@ -42,11 +42,11 @@ function smarty_modifier_date_format($string, $format = '%b %e, %Y', $default_da
$_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
if (strpos($format, '%e') !== false) {
$_win_from[] = '%e';
$_win_to[] = sprintf('%\' 2d', date('j', $timestamp));
$_win_to[] = sprintf('%\' 2d', date('j', is_numeric($timestamp) ? (int)$timestamp : strtotime($timestamp)));
}
if (strpos($format, '%l') !== false) {
$_win_from[] = '%l';
$_win_to[] = sprintf('%\' 2d', date('h', $timestamp));
$_win_to[] = sprintf('%\' 2d', date('h', is_numeric($timestamp) ? (int)$timestamp : strtotime($timestamp)));
}
$format = str_replace($_win_from, $_win_to, $format);
}

View file

@ -30,8 +30,8 @@ function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
switch (gettype($var)) {
case 'array' :
$results = '<b>Array (' . count($var) . ')</b>';
foreach ($var as $curr_key => $curr_val) {
$results = '<b>Array (' . count((array)$var) . ')</b>';
foreach ((array)$var as $curr_key => $curr_val) {
$results .= '<br>' . str_repeat('&nbsp;', $depth * 2)
. '<b>' . strtr($curr_key, $_replace) . '</b> =&gt; '
. smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
@ -40,8 +40,8 @@ function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
break;
case 'object' :
$object_vars = get_object_vars($var);
$results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>';
foreach ($object_vars as $curr_key => $curr_val) {
$results = '<b>' . get_class($var) . ' Object (' . count((array)$object_vars) . ')</b>';
foreach ((array)$object_vars as $curr_key => $curr_val) {
$results .= '<br>' . str_repeat('&nbsp;', $depth * 2)
. '<b> -&gt;' . strtr($curr_key, $_replace) . '</b> = '
. smarty_modifier_debug_print_var($curr_val, ++$depth, $length);

View file

@ -23,7 +23,7 @@
function smarty_modifier_regex_replace($string, $search, $replace)
{
if(is_array($search)) {
foreach($search as $idx => $s)
foreach ((array)$search as $idx => $s)
$search[$idx] = _smarty_regex_replace_check($s);
} else {
$search = _smarty_regex_replace_check($search);

View file

@ -64,7 +64,7 @@ function smarty_outputfilter_trimwhitespace($source, &$smarty)
function smarty_outputfilter_trimwhitespace_replace($search_str, $replace, &$subject) {
$_len = strlen($search_str);
$_pos = 0;
for ($_i=0, $_count=count($replace); $_i<$_count; $_i++)
for ($_i=0, $_count=count((array)$replace); $_i<$_count; $_i++)
if (($_pos=strpos($subject, $search_str, $_pos))!==false)
$subject = substr_replace($subject, $replace[$_i], $_pos, $_len);
else

View file

@ -203,12 +203,12 @@ class TS3lib
$resultVarsSplitted = explode('|', trim($resultVars[0]));
$count = count($resultVarsSplitted);
$count = count((array)$resultVarsSplitted);
for($i=0; $i<$count; $i++)
{
$resultVarsSplitted[$i] = explode(' ', $resultVarsSplitted[$i]);
$countSub = count($resultVarsSplitted[$i]);
$countSub = count((array)$resultVarsSplitted[$i]);
for($t=0; $t<$countSub; $t++)
{
if( strpos($resultVarsSplitted[$i][$t], '=') === false )
@ -220,7 +220,7 @@ class TS3lib
}
}
//if( count($result) == 1 ) $result = $result[0];
//if( count((array)$result) == 1 ) $result = $result[0];
return $result;
}
@ -239,7 +239,7 @@ class TS3lib
if( is_array($string) )
{
foreach($string as $key => $value )
foreach ((array)$string as $key => $value )
{
if( is_array($string[$key]) )
{
@ -266,7 +266,7 @@ class TS3lib
if( is_array($string) )
{
foreach($string as $key => $value )
foreach ((array)$string as $key => $value )
{
if( is_array($string[$key]) )
{
@ -322,7 +322,7 @@ var_dump($result = $ts3->performResultless('clientmove clid=3 cid=56'));*/
/*$param = "Test String fürs escapen|ziemlich X\\X normal/anders
/*$param = "Test String frs escapen|ziemlich X\\X normal/anders
oder nicht?\nder autor denkt nichts\nziemlich sinnlos ;)";
echo $param.'

View file

@ -134,7 +134,7 @@ class TS3remote extends TS3lib
{
$vServerName = $this->escape($vServerName);
$countProps = count($props);
$countProps = count((array)$props);
for($i=0; $i<$countProps; $i++)
{
$props[$i] = $this->escape($props[$i][0]).'='.$this->escape($props[$i][1]);
@ -178,7 +178,7 @@ class TS3remote extends TS3lib
//$props = $this->escape($props);
//print_r($props);
$countProps = count($props);
$countProps = count((array)$props);
for($i=0; $i<$countProps; $i++)
{
$props[$i] = $this->escape($props[$i][0]).'='.$this->escape($props[$i][1]);
@ -370,7 +370,7 @@ class TS3remote extends TS3lib
$props = $this->escape($props);
}
$countProps = count($props);
$countProps = count((array)$props);
for($i=0; $i<$countProps; $i++)
{
$props[$i] = $props[$i][0].'='.$props[$i][1];
@ -387,7 +387,7 @@ class TS3remote extends TS3lib
$cid = $this->escape($cid);
$props = $this->escape($props);
$countProps = count($props);
$countProps = count((array)$props);
for($i=0; $i<$countProps; $i++)
{
$props[$i] = $props[$i][0].'='.$props[$i][1];
@ -417,7 +417,7 @@ class TS3remote extends TS3lib
$cid = $this->escape($cid);
$perms = $this->escape($perms);
$countPerms = count($perms);
$countPerms = count((array)$perms);
for($i=0; $i<$countPerms; $i++)
{
$perms[$i] = $perms[$i][0].'='.$perms[$i][1].' '.$perms[$i][2].'='.$perms[$i][3];
@ -432,7 +432,7 @@ class TS3remote extends TS3lib
$cid = $this->escape($cid);
$perms = $this->escape($perms);
$countPerms = count($perms);
$countPerms = count((array)$perms);
for($i=0; $i<$countPerms; $i++)
{
$perms[$i] = $perms[$i][0].'='.$perms[$i][1];
@ -475,7 +475,7 @@ class TS3remote extends TS3lib
$cgid = $this->escape($cgid);
$perms = $this->escape($perms);
$countPerms = count($perms);
$countPerms = count((array)$perms);
for($i=0; $i<$countPerms; $i++)
{
$perms[$i] = $perms[$i][0].'='.$perms[$i][1].' '.$perms[$i][2].'='.$perms[$i][3];
@ -490,7 +490,7 @@ class TS3remote extends TS3lib
$cgid = $this->escape($cgid);
$perms = $this->escape($perms);
$countPerms = count($perms);
$countPerms = count((array)$perms);
for($i=0; $i<$countPerms; $i++)
{
$perms[$i] = $perms[$i][0].'='.$perms[$i][1];
@ -555,7 +555,7 @@ class TS3remote extends TS3lib
$clid = $this->escape($clid);
$props = $this->escape($props);
$countProps = count($props);
$countProps = count((array)$props);
for($i=0; $i<$countProps; $i++)
{
$props[$i] = $props[$i][0].'='.$props[$i][1];
@ -582,7 +582,7 @@ class TS3remote extends TS3lib
{
$cldbid = $this->escape($cldbid);
$countProps = count($props);
$countProps = count((array)$props);
for($i=0; $i<$countProps; $i++)
{
$props[$i] = $props[$i][0].'='.$props[$i][1];
@ -636,7 +636,7 @@ class TS3remote extends TS3lib
public function r_clientupdate($props)
{
$countProps = count($props);
$countProps = count((array)$props);
for($i=0; $i<$countProps; $i++)
{
$props[$i] = $this->escape($props[$i][0]).'='.$this->escape($props[$i][1]);
@ -654,7 +654,7 @@ class TS3remote extends TS3lib
if( is_array($clid) )
{
$countClid = count($clid);
$countClid = count((array)$clid);
for($i=0; $i<$countClid; $i++)
{
$clid[$i] = $clid[$i][0].'='.$clid[$i][1];
@ -677,7 +677,7 @@ class TS3remote extends TS3lib
if( is_array($clid) )
{
$countClid = count($clid);
$countClid = count((array)$clid);
for($i=0; $i<$countClid; $i++)
{
$clid[$i] = $clid[$i][0].'='.$clid[$i][1];
@ -699,7 +699,7 @@ class TS3remote extends TS3lib
if( is_array($clid) )
{
$countClid = count($clid);
$countClid = count((array)$clid);
for($i=0; $i<$countClid; $i++)
{
$clid[$i] = $clid[$i][0].'='.$clid[$i][1];
@ -726,7 +726,7 @@ class TS3remote extends TS3lib
$cldbid = $this->escape($cldbid);
$perms = $this->escape($perms);
$countPerms = count($perms);
$countPerms = count((array)$perms);
for($i=0; $i<$countPerms; $i++)
{
$perms[$i] = $perms[$i][0].'='.$perms[$i][1].' '.$perms[$i][2].'='.$perms[$i][3].' '.$perms[$i][4].'='.$perms[$i][5];
@ -741,7 +741,7 @@ class TS3remote extends TS3lib
$cldbid = $this->escape($cldbid);
$perms = $this->escape($perms);
$countPerms = count($perms);
$countPerms = count((array)$perms);
for($i=0; $i<$countPerms; $i++)
{
$perms[$i] = $perms[$i][0].'='.$perms[$i][1];
@ -765,7 +765,7 @@ class TS3remote extends TS3lib
$cldbid = $this->escape($cldbid);
$perms = $this->escape($perms);
$countPerms = count($perms);
$countPerms = count((array)$perms);
for($i=0; $i<$countPerms; $i++)
{
$perms[$i] = $perms[$i][0].'='.$perms[$i][1].' '.$perms[$i][2].'='.$perms[$i][3];
@ -781,7 +781,7 @@ class TS3remote extends TS3lib
$cldbid = $this->escape($cldbid);
$perms = $this->escape($perms);
$countPerms = count($perms);
$countPerms = count((array)$perms);
for($i=0; $i<$countPerms; $i++)
{
$perms[$i] = $perms[$i][0].'='.$perms[$i][1];

View file

@ -33,7 +33,7 @@ function getAssignedServerUsers()
if($ts3vservers != FALSE)
{
$users_assigned = array();
foreach($ts3vservers as $ts3vserver)
foreach ((array)$ts3vservers as $ts3vserver)
{
if($ts3vserver['user_id'] != $_SESSION['user_id'])
$users_assigned[] = $ts3vserver['user_id'];
@ -44,7 +44,7 @@ function getAssignedServerUsers()
$subusers_list = array();
if(is_array($subusers))
{
foreach($subusers as $subuser)
foreach ((array)$subusers as $subuser)
{
if(!in_array($subuser,$users_assigned))
$subusers_list[] = $db->getUserById($subuser);
@ -56,7 +56,7 @@ function getAssignedServerUsers()
if(is_array($users_assigned))
{
$subusers_assigned_list = array();
foreach($users_assigned as $user_assigned)
foreach ((array)$users_assigned as $user_assigned)
{
if(in_array($user_assigned,$subusersb))
$subusers_assigned_list[] = $db->getUserById($user_assigned);
@ -340,7 +340,7 @@ class TS3webinterface
$response = array('OK');
if( !is_array($_POST['serverprop']) ) $_POST['serverprop'] = array($_POST['serverprop']);
for($i=0; $i<count($_POST['serverprop']); $i++)
for($i=0; $i<count((array)$_POST['serverprop']); $i++)
{
if( $_POST['serverprop'][$i] == 'virtualserver_uptime' )
{
@ -730,7 +730,7 @@ class TS3webinterface
$serverGroupList = $this->server->r_servergrouplist();
$serverGroupListNames = array();
for($i=0; $i<count($serverGroupList); $i++)
for($i=0; $i<count((array)$serverGroupList); $i++)
{
$serverGroupListNames[$serverGroupList[$i]['sgid']] = $serverGroupList[$i];
}
@ -739,7 +739,7 @@ class TS3webinterface
$channelGroupList = $this->server->r_channelgrouplist();
$channelGroupListNames = array();
for($i=0; $i<count($channelGroupList); $i++)
for($i=0; $i<count((array)$channelGroupList); $i++)
{
$channelGroupListNames[$channelGroupList[$i]['cgid']] = $channelGroupList[$i];
}
@ -748,7 +748,7 @@ class TS3webinterface
$channelList = $this->server->r_channellist();
$channelListNames = array();
for($i=0; $i<count($channelList); $i++)
for($i=0; $i<count((array)$channelList); $i++)
{
$channelListNames[$channelList[$i]['cid']] = $channelList[$i];
}
@ -914,21 +914,21 @@ class TS3webinterface
$lastLevel = array();
$cidConnection = array();
$channelNum = count($channels);
$channelNum = count((array)$channels);
for($i=0; $i<$channelNum; $i++)
{
$cidConnection[$channels[$i]['cid']] = $i;
$channels[$i]['is_last_channel'] = false;
/*if( $channels[$i]['pid'] != $pidStack[count($pidStack)-1] )
/*if( $channels[$i]['pid'] != $pidStack[count((array)$pidStack)-1] )
{
if( in_array($channels[$i]['pid'], $pidStack) )
{
do
{
array_pop($pidStack);
} while( in_array($channels[$i]['pid'], $pidStack) && count($pidStack) > 1 );
} while( in_array($channels[$i]['pid'], $pidStack) && count((array)$pidStack) > 1 );
//$pidStack[] = $channels[$i]['pid'];
$channels[$i]['is_last_channel'] = true;
}
@ -937,7 +937,7 @@ class TS3webinterface
$pidStack[] = $channels[$i]['pid'];
}
}*/
//$channels[$i]['level'] = count($pidStack)-1;
//$channels[$i]['level'] = count((array)$pidStack)-1;
if( $channels[$i]['pid'] == 0 ) $channels[$i]['level'] = 0;
else $channels[$i]['level'] = $channels[$cidConnection[$channels[$i]['pid']]]['level'] + 1;
@ -949,7 +949,7 @@ class TS3webinterface
$lastLevel[$channels[$i]['level']] = $i;
}
/*$reversedCounter = count($channels)-1;
/*$reversedCounter = count((array)$channels)-1;
do
{
@ -1051,7 +1051,7 @@ class TS3webinterface
}
}
$clientNum = count($clients);
$clientNum = count((array)$clients);
for($i=0; $i<$clientNum; $i++)
{
if( $clients[$i]['client_input_hardware'] == '0' ) $clients[$i]['status_img'] = '16x16_hardware_input_muted';
@ -1090,7 +1090,7 @@ class TS3webinterface
$channels = array();
$cidConnection = array();
$channelNum = count($result);
$channelNum = count((array)$result);
for($i=0; $i<$channelNum; $i++ )
{
$cidConnection[$result[$i]['cid']] = $i;
@ -1135,14 +1135,14 @@ class TS3webinterface
$cidConnection = array();
$backupNum = count($backup);
$backupNum = count((array)$backup);
for($i=0; $i<$backupNum; $i++)
{
$tmpCreate = array();
$channelPropNum = count($backup[$i]);
foreach($backup[$i] as $key => $value)
$channelPropNum = count((array)$backup[$i]);
foreach ((array)$backup[$i] as $key => $value)
{
if( $key == 'pid' || $key == 'channel_order' || $key == 'channel_name' ) continue;
@ -1210,7 +1210,7 @@ class TS3webinterface
{
if( $add != 0 ) $timeSeconds += $add;
return date($format, $timeSeconds);
return date($format, is_numeric($timeSeconds) ? (int)$timeSeconds : strtotime($timeSeconds));
}
public function convertByteToMB($num, $prec=2)