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

@ -162,14 +162,14 @@ function channel_backup_create($path, $channellist)
else
{
$count=1;
$count_chans=count($channellist);
$count_chans=count((array)$channellist);
foreach($channellist AS $key=>$value)
{
$settings='';
$count2=1;
foreach($value AS $key2=>$value2)
{
$count_settings=count($value);
$count_settings=count((array)$value);
$settings.=$key2."=".str_replace(' ', '\s',$value2);
if($count2!=$count_settings)
{
@ -182,11 +182,11 @@ function channel_backup_create($path, $channellist)
{
$settings.="<perms>";
$count3=1;
$count_perms=count($channelperms['data']);
$count_perms=count((array)$channelperms['data']);
foreach($channelperms['data'] AS $key3=>$value3)
{
$count4=1;
$count_permsettings=count($value3);
$count_permsettings=count((array)$value3);
foreach($value3 AS $key4=>$value4)
{
if($key4!="cid")

View file

@ -437,7 +437,7 @@ class Smarty extends Smarty_Internal_Data {
// fill data if present
if (is_array($data)) {
// set up variable values
foreach ($data as $_key => $_val) {
foreach ((array)$data as $_key => $_val) {
$tpl->tpl_vars[$_key] = new Smarty_variable($_val);
}
}
@ -524,7 +524,7 @@ class Smarty extends Smarty_Internal_Data {
$_plugin_name = strtolower($plugin_name);
$_name_parts = explode('_', $_plugin_name, 3);
// class name must have three parts to be valid plugin
if (count($_name_parts) < 3 || $_name_parts[0] !== 'smarty') {
if (count((array)$_name_parts) < 3 || $_name_parts[0] !== 'smarty') {
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
return false;
}

View file

@ -47,7 +47,7 @@ function smarty_block_textformat($params, $content, $smarty, &$repeat, $template
$wrap_cut = false;
$assign = null;
foreach ($params as $_key => $_val) {
foreach ((array)$params as $_key => $_val) {
switch ($_key) {
case 'style':
case 'indent_char':
@ -78,7 +78,7 @@ function smarty_block_textformat($params, $content, $smarty, &$repeat, $template
$_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

@ -94,7 +94,7 @@ function smarty_function_cycle($params, $smarty, $template)
}
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

@ -70,7 +70,7 @@ function smarty_function_fetch($params, $smarty, $template)
$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":
@ -166,7 +166,7 @@ function smarty_function_fetch($params, $smarty, $template)
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

@ -54,7 +54,7 @@ function smarty_function_html_checkboxes($params, $smarty, $template)
$extra = '';
foreach($params as $_key => $_val) {
foreach ((array)$params as $_key => $_val) {
switch($_key) {
case 'name':
case 'separator':
@ -105,12 +105,12 @@ function smarty_function_html_checkboxes($params, $smarty, $template)
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

@ -49,7 +49,7 @@ function smarty_function_html_image($params, $smarty, $template)
$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

@ -42,7 +42,7 @@ function smarty_function_html_options($params, $smarty, $template)
$extra = '';
foreach($params as $_key => $_val) {
foreach ((array)$params as $_key => $_val) {
switch ($_key) {
case 'name':
$$_key = (string)$_val;
@ -78,10 +78,10 @@ function smarty_function_html_options($params, $smarty, $template)
$_html_result = '';
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);
}
@ -111,7 +111,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

@ -55,7 +55,7 @@ function smarty_function_html_radios($params, $smarty, $template)
$output = null;
$extra = '';
foreach($params as $_key => $_val) {
foreach ((array)$params as $_key => $_val) {
switch ($_key) {
case 'name':
case 'separator':
@ -110,10 +110,10 @@ function smarty_function_html_radios($params, $smarty, $template)
$_html_result = array();
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

@ -91,7 +91,7 @@ function smarty_function_html_select_date($params, $smarty, $template)
$year_empty = null;
$extra_attrs = '';
foreach ($params as $_key => $_value) {
foreach ((array)$params as $_key => $_value) {
switch ($_key) {
case 'prefix':
case 'time':
@ -142,7 +142,7 @@ function smarty_function_html_select_date($params, $smarty, $template)
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

@ -51,7 +51,7 @@ function smarty_function_html_select_time($params, $smarty, $template)
$second_extra = null;
$meridian_extra = null;
foreach ($params as $_key => $_value) {
foreach ((array)$params as $_key => $_value) {
switch ($_key) {
case 'prefix':
case 'time':
@ -89,7 +89,7 @@ function smarty_function_html_select_time($params, $smarty, $template)
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) {
@ -114,7 +114,7 @@ function smarty_function_html_select_time($params, $smarty, $template)
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=';
@ -141,7 +141,7 @@ function smarty_function_html_select_time($params, $smarty, $template)
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

@ -68,7 +68,7 @@ function smarty_function_html_table($params, $smarty, $template)
return;
}
foreach ($params as $_key => $_value) {
foreach ((array)$params as $_key => $_value) {
switch ($_key) {
case 'loop':
$$_key = (array)$_value;
@ -77,10 +77,10 @@ function smarty_function_html_table($params, $smarty, $template)
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 {
@ -109,7 +109,7 @@ function smarty_function_html_table($params, $smarty, $template)
}
}
$loop_count = count($loop);
$loop_count = count((array)$loop);
if (empty($params['rows'])) {
/* no rows specified */
$rows = ceil($loop_count / $cols_count);
@ -169,7 +169,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

@ -66,7 +66,7 @@ function smarty_function_mailto($params, $smarty, $template)
$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':
@ -89,7 +89,7 @@ function smarty_function_mailto($params, $smarty, $template)
}
$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

@ -42,14 +42,14 @@ function smarty_function_math($params, $smarty, $template)
$allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
foreach($match[1] as $curr_var) {
foreach ((array)$match[1] as $curr_var) {
if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
trigger_error("math: function call $curr_var not allowed",E_USER_WARNING);
return;
}
}
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

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

View file

@ -27,7 +27,7 @@ function smarty_modifier_capitalize($string, $uc_digits = false)
// check uc_digits case
if (!$uc_digits) {
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!u", $string, $matches, PREG_OFFSET_CAPTURE)) {
foreach($matches[1] as $match)
foreach ((array)$matches[1] as $match)
$upper_string = substr_replace($upper_string, $match[0], $match[1], strlen($match[0]));
}
}

View file

@ -44,17 +44,17 @@ function smarty_modifier_date_format($string, $format = SMARTY_RESOURCE_DATE_FOR
$_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);
}
return strftime($format, $timestamp);
} else {
return date($format, $timestamp);
return date($format, is_numeric($timestamp) ? (int)$timestamp : strtotime($timestamp));
}
}

View file

@ -29,8 +29,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);
@ -39,8 +39,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

@ -24,7 +24,7 @@ function smarty_modifiercompiler_default ($params, $compiler)
if (!isset($params[1])) {
$params[1] = "''";
}
for ($i = 1, $cnt = count($params); $i < $cnt; $i++) {
for ($i = 1, $cnt = count((array)$params); $i < $cnt; $i++) {
$output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $params[$i] . ' : $tmp)';
}
return $output;

View file

@ -66,7 +66,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

@ -133,9 +133,9 @@ class Smarty_Internal_CacheResource_File {
$_dir_length = strlen($_dir);
if (isset($_cache_id)) {
$_cache_id_parts = explode('|', $_cache_id);
$_cache_id_parts_count = count($_cache_id_parts);
$_cache_id_parts_count = count((array)$_cache_id_parts);
if ($this->smarty->use_sub_dirs) {
foreach ($_cache_id_parts as $id_part) {
foreach ((array)$_cache_id_parts as $id_part) {
$_dir .= $id_part . DS;
}
}
@ -157,7 +157,7 @@ class Smarty_Internal_CacheResource_File {
if (file_exists($_dir)) {
$_cacheDirs = new RecursiveDirectoryIterator($_dir);
$_cache = new RecursiveIteratorIterator($_cacheDirs, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($_cache as $_file) {
foreach ((array)$_cache as $_file) {
if (strpos($_file, '.svn') !== false) continue;
// directory ?
if ($_file->isDir()) {
@ -167,7 +167,7 @@ class Smarty_Internal_CacheResource_File {
}
} else {
$_parts = explode($_dir_sep, str_replace('\\', '/', substr((string)$_file, $_dir_length)));
$_parts_count = count($_parts);
$_parts_count = count((array)$_parts);
// check name
if (isset($resource_name)) {
if ($_parts[$_parts_count-1] != $_resourcename_parts) {

View file

@ -96,8 +96,8 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase {
$compiler->template->has_nocache_code = true;
}
foreach($_tpl->required_plugins as $code => $tmp1) {
foreach($tmp1 as $name => $tmp) {
foreach($tmp as $type => $data) {
foreach ((array)$tmp1 as $name => $tmp) {
foreach ((array)$tmp as $type => $data) {
$compiler->template->required_plugins[$code][$name][$type] = $data;
}
}

View file

@ -43,7 +43,7 @@ class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase {
$_nocache = 'false';
}
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
foreach ((array)$_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} else {

View file

@ -47,7 +47,7 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {
$this->compiler->trigger_template_error('unmatched {block} {/block} pairs');
}
preg_match_all("!{$this->_ldl}block\s(.+?){$this->_rdl}|{$this->_ldl}/block(.*?){$this->_rdl}!", $_content, $_result, PREG_OFFSET_CAPTURE);
$_result_count = count($_result[0]);
$_result_count = count((array)$_result[0]);
$_start = 0;
while ($_start < $_result_count) {
$_end = 0;

View file

@ -48,7 +48,7 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase {
$output = "<?php ";
if (isset($_attr['ifexp'])) {
foreach ($_attr['start'] as $_statement) {
foreach ((array)$_attr['start'] as $_statement) {
$output .= " \$_smarty_tpl->tpl_vars[$_statement[var]] = new Smarty_Variable;";
$output .= " \$_smarty_tpl->tpl_vars[$_statement[var]]->value = $_statement[value];\n";
$compiler->local_var[$_statement['var']] = true;
@ -131,7 +131,7 @@ class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase {
list($_open_tag, $this->compiler->nocache, $local_vars) = $this->_close_tag(array('for', 'forelse'));
foreach ($local_vars as $var) {
foreach ((array)$local_vars as $var) {
unset($compiler->local_var[$var]);
}
if ($_open_tag == 'forelse')

View file

@ -33,7 +33,7 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase {
$_name = trim($_attr['name'], "'\"");
unset($_attr['name']);
$compiler->template->properties['function'][$_name]['parameter'] = array();
foreach ($_attr as $_key => $_data) {
foreach ((array)$_attr as $_key => $_data) {
$compiler->template->properties['function'][$_name]['parameter'][$_key] = $_data;
}
$compiler->smarty->template_functions[$_name]['parameter'] = $compiler->template->properties['function'][$_name]['parameter'];
@ -78,7 +78,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
if (!empty($compiler->template->required_plugins['compiled'])) {
$plugins_string = '<?php ';
foreach($compiler->template->required_plugins['compiled'] as $tmp) {
foreach($tmp as $data) {
foreach ((array)$tmp as $data) {
$plugins_string .= "if (!is_callable('{$data['function']}')) include '{$data['file']}';\n";
}
}
@ -87,7 +87,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
if (!empty($compiler->template->required_plugins['nocache'])) {
$plugins_string .= "<?php echo '/*%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%*/<?php ";
foreach($compiler->template->required_plugins['nocache'] as $tmp) {
foreach($tmp as $data) {
foreach ((array)$tmp as $data) {
$plugins_string .= "if (!is_callable(\'{$data['function']}\')) include \'{$data['file']}\';\n";
}
}

View file

@ -137,7 +137,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
if (!empty($_attr)) {
if ($_parent_scope == SMARTY_LOCAL_SCOPE) {
// create variables
foreach ($_attr as $_key => $_value) {
foreach ((array)$_attr as $_key => $_value) {
$_output .= "\$_template->assign('$_key',$_value);";
}
} else {

View file

@ -94,7 +94,7 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase {
unset($_attr['name'], $_attr['assign'], $_attr['script']);
// convert attributes into parameter array string
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
foreach ((array)$_attr as $_key => $_value) {
$_paramsArray[] = "'$_key' => $_value";
}
$_params = 'array(' . implode(", ", $_paramsArray) . ')';

View file

@ -32,7 +32,7 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi
$_attr = $this->_get_attributes($args);
// convert attributes into parameter array string
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
foreach ((array)$_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} else {

View file

@ -33,7 +33,7 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co
$_attr = $this->_get_attributes($args);
// convert attributes into parameter array string
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
foreach ((array)$_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} else {

View file

@ -29,10 +29,10 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
$_attr = $this->_get_attributes($args);
$output = $_attr['value'];
// loop over list of modifiers
foreach ($_attr['modifierlist'] as $single_modifier) {
foreach ((array)$_attr['modifierlist'] as $single_modifier) {
preg_match_all('/(((\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|[^:"]*"[^"\\\\]*(?:\\\\.[^"\\\\]*)*")[^:]*)+|::?|[^:]+)/', $single_modifier, $mod_array);
$modifier = $mod_array[0][0];
for ($i = 0, $count = count($mod_array[0]);$i < $count;$i++) {
for ($i = 0, $count = count((array)$mod_array[0]);$i < $count;$i++) {
if ($mod_array[0][$i] == ':') {
$mod_array[0][$i] = ',';
}
@ -59,7 +59,7 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
// check for plugin modifiercompiler
} else if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
$plugin = 'smarty_modifiercompiler_' . $modifier;
foreach($mod_array[0] as $key => $value) {
foreach ((array)$mod_array[0] as $key => $value) {
if ($value == ',') {
unset ($mod_array[0][$key]);
}

View file

@ -33,7 +33,7 @@ class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Inter
$_attr = $this->_get_attributes($args);
// convert attributes into parameter array string
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
foreach ((array)$_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} else {

View file

@ -37,7 +37,7 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
// convert attributes into parameter array string
if ($this->compiler->smarty->registered_objects[$tag][2]) {
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
foreach ((array)$_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} else {

View file

@ -32,7 +32,7 @@ class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_C
$_attr = $this->_get_attributes($args);
// convert attributes into parameter array string
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
foreach ((array)$_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} else {

View file

@ -35,7 +35,7 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna
$this->compiler->tag_nocache = !$compiler->smarty->registered_plugins['function'][$tag][1];
// convert attributes into parameter array string
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
foreach ((array)$_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} else {

View file

@ -100,7 +100,7 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
}
if (isset($_index[1])) {
array_shift($_index);
foreach ($_index as $_ind) {
foreach ((array)$_index as $_ind) {
$compiled_ref = $compiled_ref . "[$_ind]";
}
}

View file

@ -39,7 +39,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_CompileBase {
$output .= "unset(\$_smarty_tpl->tpl_vars['smarty']->value['section'][$section_name]);\n";
$section_props = "\$_smarty_tpl->tpl_vars['smarty']->value['section'][$section_name]";
foreach ($_attr as $attr_name => $attr_value) {
foreach ((array)$_attr 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";

View file

@ -37,14 +37,14 @@ abstract class Smarty_Internal_CompileBase
{
// check if all required attributes present
foreach ($this->required_attributes as $attr) {
if (!array_key_exists($attr, $args)) {
if (!array_key_exists($attr, (array)$args)) {
$this->compiler->trigger_template_error("missing \"" . $attr . "\" attribute");
}
}
// check for unallowed attributes
if ($this->optional_attributes != array('_any')) {
$tmp_array = array_merge($this->required_attributes, $this->optional_attributes);
foreach ($args as $key => $dummy) {
foreach ((array)$args as $key => $dummy) {
if (!in_array($key, $tmp_array) && $key !== 0) {
$this->compiler->trigger_template_error("unexpected \"" . $key . "\" attribute");
}

View file

@ -246,7 +246,7 @@ class Smarty_Internal_Config {
$_config_vars = array();
include($this->getCompiledFilepath ());
// copy global config vars
foreach ($_config_vars['vars'] as $variable => $value) {
foreach ((array)$_config_vars['vars'] as $variable => $value) {
if ($this->smarty->config_overwrite || !isset($scope->config_vars[$variable])) {
$scope->config_vars[$variable] = $value;
} else {
@ -254,7 +254,7 @@ class Smarty_Internal_Config {
}
}
// scan sections
foreach ($_config_vars['sections'] as $this_section => $dummy) {
foreach ((array)$_config_vars['sections'] as $this_section => $dummy) {
if ($sections == null || in_array($this_section, (array)$sections)) {
foreach ($_config_vars['sections'][$this_section]['vars'] as $variable => $value) {
if ($this->smarty->config_overwrite || !isset($scope->config_vars[$variable])) {

View file

@ -91,7 +91,7 @@ class Smarty_Internal_Configfilelexer
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
if (!count((array)$yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
'an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state START');
@ -198,7 +198,7 @@ class Smarty_Internal_Configfilelexer
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
if (!count((array)$yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
'an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state VALUE');
@ -319,7 +319,7 @@ class Smarty_Internal_Configfilelexer
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
if (!count((array)$yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
'an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state NAKED_STRING_VALUE');
@ -388,7 +388,7 @@ class Smarty_Internal_Configfilelexer
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
if (!count((array)$yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
'an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state COMMENT');
@ -466,7 +466,7 @@ class Smarty_Internal_Configfilelexer
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
if (!count((array)$yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
'an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state SECTION');

View file

@ -127,7 +127,7 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser
$ss = preg_split('/(\\\\.)/', $escaped_string, -1, PREG_SPLIT_DELIM_CAPTURE);
$str = "";
foreach ($ss as $s) {
foreach ((array)$ss as $s) {
if (strlen($s) === 2 && $s[0] === '\\') {
if (isset(self::$escapes_single[$s[1]])) {
$s = self::$escapes_single[$s[1]];
@ -166,7 +166,7 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser
if (!isset($this->compiler->config_data['vars'])) {
$this->compiler->config_data['vars'] = Array();
}
foreach ($vars as $var) {
foreach ((array)$vars as $var) {
$this->set_var($var, $this->compiler->config_data);
}
}
@ -175,7 +175,7 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser
if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {
$this->compiler->config_data['sections'][$section_name]['vars'] = Array();
}
foreach ($vars as $var) {
foreach ((array)$vars as $var) {
$this->set_var($var, $this->compiler->config_data['sections'][$section_name]);
}
}

View file

@ -28,7 +28,7 @@ class Smarty_Internal_Data {
public function assign($tpl_var, $value = null, $nocache = false, $scope = SMARTY_LOCAL_SCOPE)
{
if (is_array($tpl_var)) {
foreach ($tpl_var as $_key => $_val) {
foreach ((array)$tpl_var as $_key => $_val) {
if ($_key != '') {
$this->tpl_vars[$_key] = new Smarty_variable($_val, $nocache, $scope);
}
@ -93,7 +93,7 @@ class Smarty_Internal_Data {
{
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 (!isset($this->tpl_vars[$_key])) {
$tpl_var_inst = $this->getVariable($_key, null, true, false);
@ -110,7 +110,7 @@ class Smarty_Internal_Data {
settype($this->tpl_vars[$_key]->value, 'array');
}
if ($merge && is_array($_val)) {
foreach($_val as $_mkey => $_mval) {
foreach ((array)$_val as $_mkey => $_mval) {
$this->tpl_vars[$_key]->value[$_mkey] = $_mval;
}
} else {
@ -135,7 +135,7 @@ class Smarty_Internal_Data {
settype($this->tpl_vars[$tpl_var]->value, 'array');
}
if ($merge && is_array($value)) {
foreach($value as $_mkey => $_mval) {
foreach ((array)$value as $_mkey => $_mval) {
$this->tpl_vars[$tpl_var]->value[$_mkey] = $_mval;
}
} else {
@ -162,7 +162,7 @@ class Smarty_Internal_Data {
settype($this->tpl_vars[$tpl_var]->value, 'array');
}
if ($merge && is_array($value)) {
foreach($value as $_key => $_val) {
foreach ((array)$value as $_key => $_val) {
$this->tpl_vars[$tpl_var]->value[$_key] = &$value[$_key];
}
} else {
@ -229,7 +229,7 @@ class Smarty_Internal_Data {
public function clearAssign($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 {
@ -403,7 +403,7 @@ class Smarty_Data extends Smarty_Internal_Data {
$this->parent = $_parent;
} elseif (is_array($_parent)) {
// set up variable values
foreach ($_parent as $_key => $_val) {
foreach ((array)$_parent as $_key => $_val) {
$this->tpl_vars[$_key] = new Smarty_variable($_val);
}
} elseif ($_parent != null) {

View file

@ -206,10 +206,10 @@ class Smarty_Internal_Register {
*/
function resource($resource_type, $function_names)
{
if (count($function_names) == 4) {
if (count((array)$function_names) == 4) {
$this->smarty->_plugins['resource'][$resource_type] =
array($function_names, false);
} elseif (count($function_names) == 5) {
} elseif (count((array)$function_names) == 5) {
$this->smarty->_plugins['resource'][$resource_type] =
array(array(array(&$function_names[0], $function_names[1]),
array(&$function_names[0], $function_names[2]),

View file

@ -55,7 +55,7 @@ class Smarty_Internal_Resource_Extends {
{
$sha1String = '';
$_files = explode('|', $_template->resource_name);
foreach ($_files as $_file) {
foreach ((array)$_files as $_file) {
$_filepath = $_template->buildTemplateFilepath ($_file);
if ($_filepath !== false) {
if ($_template->security) {
@ -92,7 +92,7 @@ class Smarty_Internal_Resource_Extends {
$_files = array_reverse($this->allFilepaths);
$_first = reset($_files);
$_last = end($_files);
foreach ($_files as $_file => $_filepath) {
foreach ((array)$_files as $_file => $_filepath) {
if ($_filepath === false) {
throw new SmartyException("Unable to load template 'file : {$_file}'");
}
@ -108,7 +108,7 @@ class Smarty_Internal_Resource_Extends {
$this->smarty->trigger_error("unmatched {block} {/block} pairs in file '$_filepath'");
}
preg_match_all("!{$this->_ldl}block\s(.+?){$this->_rdl}|{$this->_ldl}/block(.*?){$this->_rdl}!", $_content, $_result, PREG_OFFSET_CAPTURE);
$_result_count = count($_result[0]);
$_result_count = count((array)$_result[0]);
$_start = 0;
while ($_start < $_result_count) {
$_end = 0;
@ -211,7 +211,7 @@ class Smarty_Internal_Resource_Extends {
if (substr($_compile_dir, -1) != DS) {
$_compile_dir .= DS;
}
return $_compile_dir . $_filepath . '.' . $_template->resource_type . '.' . basename($_files[count($_files)-1]) . $_cache . '.php';
return $_compile_dir . $_filepath . '.' . $_template->resource_type . '.' . basename($_files[count((array)$_files)-1]) . $_cache . '.php';
}
}

View file

@ -482,8 +482,8 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
if ($this->parent instanceof Smarty_Template or $this->parent instanceof Smarty_Internal_Template) {
$this->parent->properties['file_dependency'] = array_merge($this->parent->properties['file_dependency'], $this->properties['file_dependency']);
foreach($this->required_plugins as $code => $tmp1) {
foreach($tmp1 as $name => $tmp) {
foreach($tmp as $type => $data) {
foreach ((array)$tmp1 as $name => $tmp) {
foreach ((array)$tmp as $type => $data) {
$this->parent->required_plugins[$code][$name][$type] = $data;
}
}
@ -504,7 +504,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
preg_match_all("!/\*%%SmartyNocache:{$this->properties['nocache_hash']}%%\*\/(.+?)/\*/%%SmartyNocache:{$this->properties['nocache_hash']}%%\*/!s", $this->rendered_content, $cache_parts);
$output = '';
// loop over items, stitch back together
foreach($cache_split as $curr_idx => $curr_split) {
foreach ((array)$cache_split as $curr_idx => $curr_split) {
// escape PHP tags in template content
$output .= preg_replace('/(<%|%>|<\?php|<\?|\?>)/', '<?php echo \'$1\'; ?>', $curr_split);
if (isset($cache_parts[0][$curr_idx])) {
@ -770,7 +770,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
if (!empty($this->required_plugins['compiled'])) {
$plugins_string = '<?php ';
foreach($this->required_plugins['compiled'] as $tmp) {
foreach($tmp as $data) {
foreach ((array)$tmp as $data) {
$plugins_string .= "if (!is_callable('{$data['function']}')) include '{$data['file']}';\n";
}
}
@ -780,7 +780,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
$this->has_nocache_code = true;
$plugins_string .= "<?php echo '/*%%SmartyNocache:{$this->properties['nocache_hash']}%%*/<?php ";
foreach($this->required_plugins['nocache'] as $tmp) {
foreach($tmp as $data) {
foreach ((array)$tmp as $data) {
$plugins_string .= "if (!is_callable(\'{$data['function']}\')) include \'{$data['file']}\';\n";
}
}

View file

@ -163,7 +163,7 @@ class Smarty_Internal_Templatelexer
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
if (!count((array)$yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
'an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state TEXT');
@ -452,7 +452,7 @@ class Smarty_Internal_Templatelexer
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
if (!count((array)$yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
'an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state SMARTY');
@ -898,7 +898,7 @@ class Smarty_Internal_Templatelexer
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
if (!count((array)$yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
'an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state LITERAL');
@ -1022,7 +1022,7 @@ class Smarty_Internal_Templatelexer
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
if (!count((array)$yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
'an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state DOUBLEQUOTEDSTRING');

View file

@ -62,7 +62,7 @@ class Smarty_Internal_Utility {
foreach((array)$this->smarty->template_dir as $_dir) {
$_compileDirs = new RecursiveDirectoryIterator($_dir);
$_compile = new RecursiveIteratorIterator($_compileDirs);
foreach ($_compile as $_fileinfo) {
foreach ((array)$_compile as $_fileinfo) {
if (strpos($_fileinfo, '.svn') !== false) continue;
$_file = $_fileinfo->getFilename();
if (!substr_compare($_file, $extention, - strlen($extention)) == 0) continue;
@ -120,7 +120,7 @@ class Smarty_Internal_Utility {
foreach((array)$this->smarty->config_dir as $_dir) {
$_compileDirs = new RecursiveDirectoryIterator($_dir);
$_compile = new RecursiveIteratorIterator($_compileDirs);
foreach ($_compile as $_fileinfo) {
foreach ((array)$_compile as $_fileinfo) {
if (strpos($_fileinfo, '.svn') !== false) continue;
$_file = $_fileinfo->getFilename();
if (!substr_compare($_file, $extention, - strlen($extention)) == 0) continue;
@ -184,7 +184,7 @@ class Smarty_Internal_Utility {
$_count = 0;
$_compileDirs = new RecursiveDirectoryIterator($_dir);
$_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($_compile as $_file) {
foreach ((array)$_compile as $_file) {
if (strpos($_file, '.svn') !== false) continue;
if ($_file->isDir()) {
if (!$_compile->isDot()) {

View file

@ -106,7 +106,7 @@ class Smarty_Internal_Wrapper {
default:
// convert foo_bar_baz to fooBarBaz style names
$name_parts = explode('_',$name);
foreach($name_parts as $idx=>$part) {
foreach ((array)$name_parts as $idx=>$part) {
if($idx==0)
$name_parts[$idx] = strtolower($part);
else

View file

@ -40,7 +40,7 @@ if (isset($_POST['addban']))
}
else
{
for($i=0; $i+1==count($ban_add['errors']); $i++)
for($i=0; $i+1==count((array)$ban_add['errors']); $i++)
{
$error .= $ban_add['errors'][$i]."<br />";
}

View file

@ -28,7 +28,7 @@ if (isset($_POST['unban']))
}
else
{
for($i=0; $i+1==count($ban_delete['errors']); $i++)
for($i=0; $i+1==count((array)$ban_delete['errors']); $i++)
{
$error .= $ban_delete['errors'][$i]."<br />";
}

View file

@ -31,7 +31,7 @@ if(isset($_POST['addgroup']))
}
else
{
for($i=0; $i+1==count($creategroup['errors']); $i++)
for($i=0; $i+1==count((array)$creategroup['errors']); $i++)
{
$error .= $creategroup['errors'][$i]."<br />";
}
@ -46,7 +46,7 @@ if(isset($_POST['addgroup']))
}
else
{
for($i=0; $i+1==count($creategroup['errors']); $i++)
for($i=0; $i+1==count((array)$creategroup['errors']); $i++)
{
$error .= $creategroup['errors'][$i]."<br />";
}

View file

@ -26,7 +26,7 @@ if(isset($_POST['addclient']))
}
else
{
for($i=0; $i+1==count($setclient_cgroup['errors']); $i++)
for($i=0; $i+1==count((array)$setclient_cgroup['errors']); $i++)
{
$error .= $setclient_cgroup['errors'][$i]."<br />";
}
@ -42,7 +42,7 @@ if(isset($_POST['switchgroup']))
}
else
{
for($i=0; $i+1==count($setclient_cgroup['errors']); $i++)
for($i=0; $i+1==count((array)$setclient_cgroup['errors']); $i++)
{
$error .= $setclient_cgroup['errors'][$i]."<br />";
}

View file

@ -28,7 +28,7 @@ if(isset($_POST['sendname']))
}
else
{
for($i=0; $i+1==count($cgroup_rename['errors']); $i++)
for($i=0; $i+1==count((array)$cgroup_rename['errors']); $i++)
{
$error .= $cgroup_rename['errors'][$i]."<br />";
}
@ -49,7 +49,7 @@ if(isset($_POST['delgroup']))
}
else
{
for($i=0; $i+1==count($cgroup_delete['errors']); $i++)
for($i=0; $i+1==count((array)$cgroup_delete['errors']); $i++)
{
$error .= $cgroup_delete['errors'][$i]."<br />";
}

View file

@ -27,7 +27,7 @@ if(isset($_POST['delete']))
}
else
{
for($i=0; $i+1==count($channel_delete['errors']); $i++)
for($i=0; $i+1==count((array)$channel_delete['errors']); $i++)
{
$error .= $channel_delete['errors'][$i]."<br />";
}

View file

@ -29,7 +29,7 @@ if(isset($_POST['editchannelname']))
}
else
{
for($i=0; $i+1==count($channel_edit['errors']); $i++)
for($i=0; $i+1==count((array)$channel_edit['errors']); $i++)
{
$error .= $channel_edit['errors'][$i]."<br />";
}
@ -67,7 +67,7 @@ if(isset($_POST['editchannel']))
}
else
{
for($i=0; $i+1==count($channel_edit['errors']); $i++)
for($i=0; $i+1==count((array)$channel_edit['errors']); $i++)
{
$error .= $channel_edit['errors'][$i]."<br />";
}
@ -84,7 +84,7 @@ if(isset($_POST['editpw']))
}
else
{
for($i=0; $i+1==count($channel_edit['errors']); $i++)
for($i=0; $i+1==count((array)$channel_edit['errors']); $i++)
{
$error .= $channel_edit['errors'][$i]."<br />";
}
@ -100,7 +100,7 @@ if(isset($_POST['movechan']))
}
else
{
for($i=0; $i+1==count($channel_move['errors']); $i++)
for($i=0; $i+1==count((array)$channel_move['errors']); $i++)
{
$error .= $channel_move['errors'][$i]."<br />";
}

View file

@ -90,7 +90,7 @@ if(isset($_POST['clientdel']))
else
{
echo "<tr><td colspan=\"4\" class=\"green1\">";
for($i=0; $i+1==count($client_delete['errors']); $i++)
for($i=0; $i+1==count((array)$client_delete['errors']); $i++)
{
echo $client_delete['errors'][$i]."<br />";
}
@ -107,7 +107,7 @@ while($getclientdblist=$ts3->getElement('data', $ts3->clientDbList($start, $dura
$clientlist=$ts3->getElement('data', $ts3->clientList());
$countclients=count($clientdblist);
$countclients=count((array)$clientdblist);
$pages=$countclients/$duration;
if(floor($pages)!=0)

View file

@ -27,7 +27,7 @@ if(isset($_POST['delall']))
}
else
{
for($i=0; $i+1==count($complain_delete_all['errors']); $i++)
for($i=0; $i+1==count((array)$complain_delete_all['errors']); $i++)
{
$error .= $complain_delete_all['errors'][$i]."<br />";
}
@ -44,7 +44,7 @@ if(isset($_POST['delete']))
}
else
{
for($i=0; $i+1==count($complain_delete['errors']); $i++)
for($i=0; $i+1==count((array)$complain_delete['errors']); $i++)
{
$error .= $complain_delete['errors'][$i]."<br />";
}

View file

@ -61,7 +61,7 @@ while($clientdblist=$ts3->getElement('data', $ts3->clientDbList($start_while, $d
}
$start_while=$start_while+$duration_while;
}
$totalclients=count($clientstatuslist);
$totalclients=count((array)$clientstatuslist);

View file

@ -45,7 +45,7 @@ if(isset($_POST['createchannel']))
}
else
{
for($i=0; $i+1==count($channel_create['errors']); $i++)
for($i=0; $i+1==count((array)$channel_create['errors']); $i++)
{
$error .= $channel_create['errors'][$i]."<br />";
}

View file

@ -25,7 +25,7 @@ if(isset($_POST['createserver']))
$token=$ts3->serverCreate($_POST['newsettings']);
if($token['success']===false)
{
for($i=0; $i+1==count($token['errors']); $i++)
for($i=0; $i+1==count((array)$token['errors']); $i++)
{
$error .= $token['errors'][$i]."<br />";
}

View file

@ -168,7 +168,7 @@ if(isset($_GET['path']) AND $_GET['path']!="/" AND !empty($_GET['path']))
{
$cid=$_GET['cid'];
$splitpath=explode("/",$_GET['path']);
unset($splitpath[count($splitpath)-1]);
unset($splitpath[count((array)$splitpath)-1]);
$newpath=implode("/", $splitpath);
empty($newpath) ? $newpath="/":'';
$newpath=="/" ? $cid='':'';

View file

@ -28,7 +28,7 @@ if(isset($_GET['deletefile']))
$_GET['path']=="/" ? $_GET['cid']='':'';
if($isdelete['success']===false)
{
for($i=0; $i+1==count($isdelete['errors']); $i++)
for($i=0; $i+1==count((array)$isdelete['errors']); $i++)
{
$error .= $isdelete['errors'][$i]."<br />";
}
@ -45,7 +45,7 @@ if(isset($_POST['createdir']))
$iscreate=$ts3->ftCreateDir($_REQUEST['cid'], $_GET['cpw'], $dirname);
if($iscreate['success']===false)
{
for($i=0; $i+1==count($iscreate['errors']); $i++)
for($i=0; $i+1==count((array)$iscreate['errors']); $i++)
{
$error .= $iscreate['errors'][$i]."<br />";
}
@ -141,7 +141,7 @@ if(isset($_GET['path']) AND $_GET['path']!="/" AND !empty($_GET['path']))
{
$cid=$_GET['cid'];
$splitpath=explode("/",$_GET['path']);
unset($splitpath[count($splitpath)-1]);
unset($splitpath[count((array)$splitpath)-1]);
$newpath=implode("/", $splitpath);
empty($newpath) ? $newpath="/":'';
$newpath=="/" ? $cid='':'';

View file

@ -27,7 +27,7 @@ if(isset($_POST['editinstance']))
else
{
$error .= $lang['editincomplete']."<br />";
for($i=0; $i+1==count($instance_edit['errors']); $i++)
for($i=0; $i+1==count((array)$instance_edit['errors']); $i++)
{
$error .= $instance_edit['errors'][$i]."<br />";
}
@ -45,7 +45,7 @@ if(isset($_POST['editshowlist']))
$server_edit=$ts3->serverEdit($websetting);
if($server_edit['success']===false)
{
for($i=0; $i+1==count($instance_edit['errors']); $i++)
for($i=0; $i+1==count((array)$instance_edit['errors']); $i++)
{
$error .= $server_edit['errors'][$i]."<br />";
}

View file

@ -86,7 +86,7 @@ if(isset($_POST['deploy']))
$snapshot_deploy=$ts3->serverSnapshotDeploy($handler[0]);
if($snapshot_deploy['success']===false)
{
for($i=0; $i+1==count($snapshot_deploy['errors']); $i++)
for($i=0; $i+1==count((array)$snapshot_deploy['errors']); $i++)
{
$error .= $snapshot_deploy['errors'][$i].'<br />';
}
@ -98,7 +98,7 @@ if(isset($_POST['deploy']))
}
else
{
for($i=0; $i+1==count($selectserver['errors']); $i++)
for($i=0; $i+1==count((array)$selectserver['errors']); $i++)
{
$error .= $selectserver['errors'][$i].'<br />';
}
@ -181,7 +181,7 @@ if(!empty($folder[1]))
rsort($folder[1]);
foreach($folder[1] AS $key=>$value)
{
$newdate=date("d-m-Y", $value);
$newdate=date("d-m-Y", is_numeric($value) ? (int)$value : strtotime($value));
$folder[1][$key]=$newdate;
}
}

View file

@ -70,7 +70,7 @@ if(isset($_POST['sendmsg']))
$gm=$ts3->gm($_POST['msgtoall']);
if($gm['success']===false)
{
for($i=0; $i+1==count($gm['errors']); $i++)
for($i=0; $i+1==count((array)$gm['errors']); $i++)
{
$error .= $gm['errors'][$i];
}
@ -96,7 +96,7 @@ if(isset($_POST['massaction']))
$autostart_edit=$ts3->serverEdit(array('virtualserver_autostart'=>$value['auto']));
if($autostart_edit['success']===false)
{
for($i=0; $i+1==count($autostart_edit['errors']); $i++)
for($i=0; $i+1==count((array)$autostart_edit['errors']); $i++)
{
$error .= $autostart_edit['errors'][$i]."<br />";
}
@ -110,7 +110,7 @@ if(isset($_POST['massaction']))
$server_start=$ts3->serverStart($key);
if($server_start['success']===false)
{
for($i=0; $i+1==count($server_start['errors']); $i++)
for($i=0; $i+1==count((array)$server_start['errors']); $i++)
{
$error .= $server_start['errors'][$i]."<br />";
}
@ -126,7 +126,7 @@ if(isset($_POST['massaction']))
$server_stop=$ts3->serverStop($key);
if($server_stop['success']===false)
{
for($i=0; $i+1==count($server_stop['errors']); $i++)
for($i=0; $i+1==count((array)$server_stop['errors']); $i++)
{
$error .= $server_stop['errors'][$i]."<br />";
}
@ -142,7 +142,7 @@ if(isset($_POST['massaction']))
$server_delete=$ts3->serverDelete($key);
if($server_delete['success']===false)
{
for($i=0; $i+1==count($server_delete['errors']); $i++)
for($i=0; $i+1==count((array)$server_delete['errors']); $i++)
{
$error .= $server_delete['errors'][$i]."<br />";
}
@ -183,7 +183,7 @@ if(!empty($serverlist))
$smarty->assign("sortby", $sortby);
$smarty->assign("sorttype", $sorttype);
$smarty->assign("serverstats", sprintf($lang['serverstats'], count($serverlist), $allslots, $allusedslots));
$smarty->assign("serverstats", sprintf($lang['serverstats'], count((array)$serverlist), $allslots, $allusedslots));
$smarty->assign("serverlist", $serverlist);
$smarty->assign("error", $error);
$smarty->assign("noerror", $noerror);

View file

@ -64,7 +64,7 @@ if(isset($_POST['deploy']))
$snapshot_deploy=$ts3->serverSnapshotDeploy($handler[0]);
if($snapshot_deploy['success']===false)
{
for($i=0; $i+1==count($snapshot_deploy['errors']); $i++)
for($i=0; $i+1==count((array)$snapshot_deploy['errors']); $i++)
{
echo $snapshot_deploy['errors'][$i]."<br />";
}
@ -162,7 +162,7 @@ if(!empty($folder[1]))
rsort($folder[1]);
foreach($folder[1] AS $key=>$value)
{
$newdate=date("d-m-Y", $value);
$newdate=date("d-m-Y", is_numeric($value) ? (int)$value : strtotime($value));
$folder[1][$key]=$newdate;
}
}

View file

@ -56,7 +56,7 @@ if(isset($_POST['editserver']))
if($server_edit['success']===false)
{
for($i=0; $i+1==count($server_edit['errors']); $i++)
for($i=0; $i+1==count((array)$server_edit['errors']); $i++)
{
$err_msg .= $server_edit['errors'][$i]."<br />";
}
@ -81,7 +81,7 @@ if(isset($_POST['editpw']))
}
else
{
for($i=0; $i+1==count($server_edit['errors']); $i++)
for($i=0; $i+1==count((array)$server_edit['errors']); $i++)
{
$error .= $server_edit['errors'][$i]."<br />";
}

View file

@ -273,7 +273,7 @@ if(isset($_POST['sendkick']))
$client_kick=$ts3->clientKick($_POST['clid'], 'server', $_POST['kickmsg']);
if($client_kick['success']===false)
{
for($i=0; $i+1==count($client_kick['errors']); $i++)
for($i=0; $i+1==count((array)$client_kick['errors']); $i++)
{
$error .= $client_kick['errors'][$i]."<br />";
}
@ -289,7 +289,7 @@ if(isset($_POST['sendban']))
$client_ban=$ts3->banClient($_POST['clid'], $_POST['bantime'], $_POST['banmsg']);
if($client_ban['success']===false)
{
for($i=0; $i+1==count($client_ban['errors']); $i++)
for($i=0; $i+1==count((array)$client_ban['errors']); $i++)
{
$error .= $client_ban['errors'][$i]."<br />";
}
@ -305,7 +305,7 @@ if(isset($_POST['sendpoke']))
$client_poke=$ts3->clientPoke($_POST['clid'], $_POST['pokemsg']);
if($client_poke['success']===false)
{
for($i=0; $i+1==count($client_poke['errors']); $i++)
for($i=0; $i+1==count((array)$client_poke['errors']); $i++)
{
$error .= $client_poke['errors'][$i]."<br />";
}
@ -321,7 +321,7 @@ if(isset($_POST['sendmove']))
$client_move=$ts3->clientMove($_POST['clid'], $_POST['cid']);
if($client_move['success']===false)
{
for($i=0; $i+1==count($client_move['errors']); $i++)
for($i=0; $i+1==count((array)$client_move['errors']); $i++)
{
$error .= $client_move['errors'][$i]."<br />";
}
@ -338,7 +338,7 @@ if(isset($_POST['sendmsg']))
$send_message=$ts3->sendMessage('3', $_POST['sid'], $_POST['msgtoserver']);
if($send_message['success']===false)
{
for($i=0; $i+1==count($send_message['errors']); $i++)
for($i=0; $i+1==count((array)$send_message['errors']); $i++)
{
$error .= $send_message['errors'][$i]."<br />";
}
@ -354,7 +354,7 @@ if(isset($_POST['start']))
$server_start=$ts3->serverStart($_POST['sid']);
if($server_start['success']===false)
{
for($i=0; $i+1==count($server_start['errors']); $i++)
for($i=0; $i+1==count((array)$server_start['errors']); $i++)
{
$error .= $server_start['errors'][$i]."<br />";
}
@ -370,7 +370,7 @@ if(isset($_POST['stop']))
$server_stop=$ts3->serverStop($_POST['sid']);
if($server_stop['success']===false)
{
for($i=0; $i+1==count($server_stop['errors']); $i++)
for($i=0; $i+1==count((array)$server_stop['errors']); $i++)
{
$error .= $server_stop['errors'][$i]."<br />";
}

View file

@ -31,7 +31,7 @@ if(isset($_POST['addgroup']))
}
else
{
for($i=0; $i+1==count($creategroup['errors']); $i++)
for($i=0; $i+1==count((array)$creategroup['errors']); $i++)
{
$error .= $creategroup['errors'][$i]."<br />";
}
@ -47,7 +47,7 @@ if(isset($_POST['addgroup']))
}
else
{
for($i=0; $i+1==count($creategroup['errors']); $i++)
for($i=0; $i+1==count((array)$creategroup['errors']); $i++)
{
$error .= $creategroup['errors'][$i]."<br />";
}

View file

@ -27,7 +27,7 @@ if(isset($_POST['kickclient']))
}
else
{
for($i=0; $i+1==count($sgroup_del_client['errors']); $i++)
for($i=0; $i+1==count((array)$sgroup_del_client['errors']); $i++)
{
$error .= $sgroup_del_client['errors'][$i]."<br />";
}
@ -42,7 +42,7 @@ if(isset($_POST['addclient']))
}
else
{
for($i=0; $i+1==count($sgroup_add_client['errors']); $i++)
for($i=0; $i+1==count((array)$sgroup_add_client['errors']); $i++)
{
$error .= $sgroup_add_client['errors'][$i]."<br />";
}

View file

@ -30,7 +30,7 @@ if(isset($_POST['sendname']))
}
else
{
for($i=0; $i+1==count($sgroup_rename['errors']); $i++)
for($i=0; $i+1==count((array)$sgroup_rename['errors']); $i++)
{
$error .= $sgroup_rename['errors'][$i]."<br />";
}
@ -50,7 +50,7 @@ if(isset($_POST['delgroup']))
}
else
{
for($i=0; $i+1==count($sgroup_delete['errors']); $i++)
for($i=0; $i+1==count((array)$sgroup_delete['errors']); $i++)
{
$error .= $sgroup_delete['errors'][$i]."<br />";
}

View file

@ -32,7 +32,7 @@ if(isset($_POST['deltoken']))
}
else
{
for($i=0; $i+1==count($token_delete['errors']); $i++)
for($i=0; $i+1==count((array)$token_delete['errors']); $i++)
{
$error .= $token_delete['errors'][$i]."<br />";
}
@ -63,7 +63,7 @@ if(isset($_POST['addtoken']))
}
else
{
for($i=0; $i+1==count($token_add['errors']); $i++)
for($i=0; $i+1==count((array)$token_add['errors']); $i++)
{
$error .= $token_add['errors'][$i]."<br />";
}

View file

@ -158,8 +158,8 @@ function create_tree($pid, $place, $alldata, $sid, $showicons)
$clientinfo .= "<tr><td style=\'width:150px\' class=\'green2 tooltip\'>".$lang['platform']."</td><td style=\'width:150px\' class=\'green2\'>".$u_value['client_platform']."</td></tr>";
$clientinfo .= "<tr><td style=\'width:150px\' class=\'green1 tooltip\'>".$lang['talkpower']."</td><td style=\'width:150px\' class=\'green1\'>".$u_value['client_talk_power']."</td></tr>";
$clientinfo .= "<tr><td style=\'width:150px\' class=\'green2 tooltip\'>".$lang['idle']."</td><td style=\'width:150px\' class=\'green2\'>".$ts3->convertSecondsToStrTime($u_value['client_idle_time']/1000)."</td></tr>";
$clientinfo .= "<tr><td style=\'width:150px\' class=\'green1 tooltip\'>".$lang['lastonline']."</td><td style=\'width:150px\' class=\'green1\'>".date("d.m.Y", $u_value['client_lastconnected'])."</td></tr>";
$clientinfo .= "<tr><td style=\'width:150px\' class=\'green2 tooltip\'>".$lang['created']."</td><td style=\'width:150px\' class=\'green2\'>".date("d.m.Y", $u_value['client_created'])."</td></tr>";
$clientinfo .= "<tr><td style=\'width:150px\' class=\'green1 tooltip\'>".$lang['lastonline']."</td><td style=\'width:150px\' class=\'green1\'>".date("d.m.Y", is_numeric($u_value['client_lastconnected']) ? (int)$u_value['client_lastconnected'] : strtotime($u_value['client_lastconnected']))."</td></tr>";
$clientinfo .= "<tr><td style=\'width:150px\' class=\'green2 tooltip\'>".$lang['created']."</td><td style=\'width:150px\' class=\'green2\'>".date("d.m.Y", is_numeric($u_value['client_created']) ? (int)$u_value['client_created'] : strtotime($u_value['client_created']))."</td></tr>";
$clientinfo .= "<tr><td style=\'width:150px\' class=\'green1 tooltip\'>".$lang['iconid']."</td><td style=\'width:150px\' class=\'green1\'>".$u_value['client_icon_id']."</td></tr>";
$clientinfo .= "</table>";

View file

@ -284,7 +284,7 @@ class ts3admin {
function channelAddPerm($cid, $permissions) {
if(!$this->runtime['selected']) { return $this->checkSelected(); }
if(count($permissions) > 0) {
if(count((array)$permissions) > 0) {
//Permissions given
//Errorcollector
@ -294,12 +294,12 @@ class ts3admin {
$permissions = array_chunk($permissions, 50, true);
//Action for each splitted part of permission
foreach($permissions as $permission_part)
foreach ((array)$permissions as $permission_part)
{
//Create command_string for each command that we could use implode later
$command_string = array();
foreach($permission_part as $key => $value)
foreach ((array)$permission_part as $key => $value)
{
$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value;
}
@ -308,14 +308,14 @@ class ts3admin {
if(!$result['success'])
{
foreach($result['errors'] as $error)
foreach ((array)$result['errors'] as $error)
{
$errors[] = $error;
}
}
}
if(count($errors) == 0)
if(count((array)$errors) == 0)
{
return $this->generateOutput(true, array(), true);
}else{
@ -352,7 +352,7 @@ class ts3admin {
function channelClientAddPerm($cid, $cldbid, $permissions) {
if(!$this->runtime['selected']) { return $this->checkSelected(); }
if(count($permissions) > 0) {
if(count((array)$permissions) > 0) {
//Permissions given
//Errorcollector
@ -362,12 +362,12 @@ class ts3admin {
$permissions = array_chunk($permissions, 50, true);
//Action for each splitted part of permission
foreach($permissions as $permission_part)
foreach ((array)$permissions as $permission_part)
{
//Create command_string for each command that we could use implode later
$command_string = array();
foreach($permission_part as $key => $value)
foreach ((array)$permission_part as $key => $value)
{
$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value;
}
@ -376,14 +376,14 @@ class ts3admin {
if(!$result['success'])
{
foreach($result['errors'] as $error)
foreach ((array)$result['errors'] as $error)
{
$errors[] = $error;
}
}
}
if(count($errors) == 0)
if(count((array)$errors) == 0)
{
return $this->generateOutput(true, array(), true);
}else{
@ -422,7 +422,7 @@ class ts3admin {
if(!$this->runtime['selected']) { return $this->checkSelected(); }
$permissionArray = array();
if(count($permissionIds) > 0) {
if(count((array)$permissionIds) > 0) {
foreach($permissionIds AS $value) {
$permissionArray[] = is_numeric($value) ? 'permid='.$value : 'permsid='.$value;
}
@ -499,7 +499,7 @@ class ts3admin {
$propertiesString = '';
foreach($data as $key => $value) {
foreach ((array)$data as $key => $value) {
$propertiesString .= ' '.$key.'='.$this->escapeText($value);
}
@ -545,7 +545,7 @@ class ts3admin {
if(!$this->runtime['selected']) { return $this->checkSelected(); }
$permissionArray = array();
if(count($permissions) > 0) {
if(count((array)$permissions) > 0) {
foreach($permissions AS $value) {
$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
}
@ -580,7 +580,7 @@ class ts3admin {
$settingsString = '';
foreach($data as $key => $value) {
foreach ((array)$data as $key => $value) {
$settingsString .= ' '.$key.'='.$this->escapeText($value);
}
@ -664,7 +664,7 @@ class ts3admin {
function channelGroupAddPerm($cgid, $permissions) {
if(!$this->runtime['selected']) { return $this->checkSelected(); }
if(count($permissions) > 0) {
if(count((array)$permissions) > 0) {
//Permissions given
//Errorcollector
@ -674,12 +674,12 @@ class ts3admin {
$permissions = array_chunk($permissions, 50, true);
//Action for each splitted part of permission
foreach($permissions as $permission_part)
foreach ((array)$permissions as $permission_part)
{
//Create command_string for each command that we could use implode later
$command_string = array();
foreach($permission_part as $key => $value)
foreach ((array)$permission_part as $key => $value)
{
$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value;
}
@ -688,14 +688,14 @@ class ts3admin {
if(!$result['success'])
{
foreach($result['errors'] as $error)
foreach ((array)$result['errors'] as $error)
{
$errors[] = $error;
}
}
}
if(count($errors) == 0) {
if(count((array)$errors) == 0) {
return $this->generateOutput(true, array(), true);
}else{
return $this->generateOutput(false, $errors, false);
@ -807,7 +807,7 @@ class ts3admin {
if(!$this->runtime['selected']) { return $this->checkSelected(); }
$permissionArray = array();
if(count($permissionIds) > 0) {
if(count((array)$permissionIds) > 0) {
foreach($permissionIds AS $value) {
$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
}
@ -1065,7 +1065,7 @@ class ts3admin {
function clientAddPerm($cldbid, $permissions) {
if(!$this->runtime['selected']) { return $this->checkSelected(); }
if(count($permissions) > 0) {
if(count((array)$permissions) > 0) {
//Permissions given
//Errorcollector
@ -1075,12 +1075,12 @@ class ts3admin {
$permissions = array_chunk($permissions, 50, true);
//Action for each splitted part of permission
foreach($permissions as $permission_part)
foreach ((array)$permissions as $permission_part)
{
//Create command_string for each command that we could use implode later
$command_string = array();
foreach($permission_part as $key => $value)
foreach ((array)$permission_part as $key => $value)
{
$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value;
}
@ -1089,14 +1089,14 @@ class ts3admin {
if(!$result['success'])
{
foreach($result['errors'] as $error)
foreach ((array)$result['errors'] as $error)
{
$errors[] = $error;
}
}
}
if(count($errors) == 0)
if(count((array)$errors) == 0)
{
return $this->generateOutput(true, array(), true);
}else{
@ -1148,7 +1148,7 @@ class ts3admin {
$settingsString = '';
foreach($data as $key => $value) {
foreach ((array)$data as $key => $value) {
$settingsString .= ' '.$key.'='.$this->escapeText($value);
}
@ -1275,7 +1275,7 @@ class ts3admin {
$permissionArray = array();
if(count($permissionIds) > 0) {
if(count((array)$permissionIds) > 0) {
foreach($permissionIds AS $value) {
$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
}
@ -1310,7 +1310,7 @@ class ts3admin {
$settingsString = '';
foreach($data as $key => $value) {
foreach ((array)$data as $key => $value) {
$settingsString .= ' '.$key.'='.$this->escapeText($value);
}
@ -1711,7 +1711,7 @@ class ts3admin {
function clientUpdate($data) {
$settingsString = '';
foreach($data as $key => $value) {
foreach ((array)$data as $key => $value) {
$settingsString .= ' '.$key.'='.$this->escapeText($value);
}
@ -1870,7 +1870,7 @@ class ts3admin {
if(!$this->runtime['selected']) { return $this->checkSelected(); }
$fileArray = array();
if(count($files) > 0) {
if(count((array)$files) > 0) {
foreach($files AS $file) {
$fileArray[] = 'name='.$this->escapeText($file);
}
@ -1941,7 +1941,7 @@ class ts3admin {
if(!$this->runtime['selected']) { return $this->checkSelected(); }
$fileArray = array();
if(count($files) > 0) {
if(count((array)$files) > 0) {
foreach($files AS $file) {
$fileArray[] = 'name='.$this->escapeText($file);
}
@ -2220,10 +2220,10 @@ class ts3admin {
* @return boolean success
*/
function instanceEdit($data) {
if(count($data) > 0) {
if(count((array)$data) > 0) {
$settingsString = '';
foreach($data as $key => $val) {
foreach ((array)$data as $key => $val) {
$settingsString .= ' '.$key.'='.$this->escapeText($val);
}
return $this->getData('boolean', 'instanceedit '.$settingsString);
@ -2385,7 +2385,7 @@ class ts3admin {
function permIdGetByName($permsids) {
$permissionArray = array();
if(count($permsids) > 0) {
if(count((array)$permsids) > 0) {
foreach($permsids AS $value) {
$permissionArray[] = 'permsid='.$value;
}
@ -2495,7 +2495,7 @@ class ts3admin {
$gc = 1;
foreach($response as $field) {
foreach ((array)$response as $field) {
if(isset($field['group_id_end'])) {
$groups[] = array('num' => $gc, 'group_id_end' => $field['group_id_end']);
$gc++;
@ -2506,7 +2506,7 @@ class ts3admin {
$counter = 0;
for($i = 0; $i < count($groups); $i++) {
for($i = 0; $i < count((array)$groups); $i++) {
$rounds = $groups[$i]['group_id_end'] - $counter;
$groups[$i]['pcount'] = $rounds;
for($j = 0; $j < $rounds; $j++) {
@ -2653,10 +2653,10 @@ class ts3admin {
function serverCreate($data = array()) {
$settingsString = '';
if(count($data) == 0) { $data['virtualserver_name'] = 'Teamspeak 3 Server'; }
if(count((array)$data) == 0) { $data['virtualserver_name'] = 'Teamspeak 3 Server'; }
foreach($data as $key => $value) {
foreach ((array)$data as $key => $value) {
if(!empty($value)) { $settingsString .= ' '.$key.'='.$this->escapeText($value); }
}
@ -2701,7 +2701,7 @@ class ts3admin {
$settingsString = '';
foreach($data as $key => $value) {
foreach ((array)$data as $key => $value) {
$settingsString .= ' '.$key.'='.$this->escapeText($value);
}
@ -2770,7 +2770,7 @@ class ts3admin {
function serverGroupAddPerm($sgid, $permissions) {
if(!$this->runtime['selected']) { return $this->checkSelected(); }
if(count($permissions) > 0) {
if(count((array)$permissions) > 0) {
//Permissions given
//Errorcollector
@ -2780,12 +2780,12 @@ class ts3admin {
$permissions = array_chunk($permissions, 50, true);
//Action for each splitted part of permission
foreach($permissions as $permission_part)
foreach ((array)$permissions as $permission_part)
{
//Create command_string for each command that we could use implode later
$command_string = array();
foreach($permission_part as $key => $value)
foreach ((array)$permission_part as $key => $value)
{
$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value[0].' permskip='.$value[1].' permnegated='.$value[2];
}
@ -2794,14 +2794,14 @@ class ts3admin {
if(!$result['success'])
{
foreach($result['errors'] as $error)
foreach ((array)$result['errors'] as $error)
{
$errors[] = $error;
}
}
}
if(count($errors) == 0)
if(count((array)$errors) == 0)
{
return $this->generateOutput(true, array(), true);
}else{
@ -2819,19 +2819,19 @@ class ts3admin {
$error = false;
$results = array();
if(count($permissions) > 0) {
if(count((array)$permissions) > 0) {
$new = array();
$i = 0;
$k = 0;
foreach($permissions as $ke => $va) {
foreach ((array)$permissions as $ke => $va) {
if($i > 149){ $i = 0; $k++; }else{ $i++; }
$new[$k][$ke] = $va;
}
foreach($new as $perms) {
foreach ((array)$new as $perms) {
$permissionArray = array();
foreach($perms as $key => $value) {
foreach ((array)$perms as $key => $value) {
$permissionArray[] = 'permid='.$key.' permvalue='.$value[0].' permskip='.$value[1].' permnegated='.$value[2];
}
$result = $this->getData('boolean', 'servergroupaddperm sgid='.$sgid.' '.implode('|', $permissionArray));
@ -2841,9 +2841,9 @@ class ts3admin {
if($error) {
$returnErrors = array();
foreach($results as $errorResult) {
if(count($errorResult['errors']) > 0) {
foreach($errorResult['errors'] as $errorResultError) {
foreach ((array)$results as $errorResult) {
if(count((array)$errorResult['errors']) > 0) {
foreach ((array)$errorResult['errors'] as $errorResultError) {
$returnErrors[] = $errorResultError;
}
}
@ -2969,7 +2969,7 @@ class ts3admin {
if(!$this->runtime['selected']) { return $this->checkSelected(); }
$permissionArray = array();
if(count($permissionIds) > 0) {
if(count((array)$permissionIds) > 0) {
foreach($permissionIds AS $value) {
$permissionArray[] = is_numeric($value) ? 'permid='.$value : 'permsid='.$this->escapeText($value);
}
@ -3474,10 +3474,10 @@ class ts3admin {
if(!empty($description)) { $description = ' tokendescription=' . $this->escapeText($description); }
if(count($customFieldSet)) {
if(count((array)$customFieldSet)) {
$settingsString = array();
foreach($customFieldSet as $key => $value) {
foreach ((array)$customFieldSet as $key => $value) {
$settingsString[] = 'ident='.$this->escapeText($key).' value='.$this->escapeText($value);
}
@ -3939,9 +3939,9 @@ class ts3admin {
$splittedCommand = str_split($command, 1024);
$splittedCommand[(count($splittedCommand) - 1)] .= "\n";
$splittedCommand[(count((array)$splittedCommand) - 1)] .= "\n";
foreach($splittedCommand as $commandPart) {
foreach ((array)$splittedCommand as $commandPart) {
fputs($this->runtime['socket'], $commandPart);
}
@ -3958,7 +3958,7 @@ class ts3admin {
if(strpos($data, 'error id=0 msg=ok') === false) {
$splittedResponse = explode('error id=', $data);
$chooseEnd = count($splittedResponse) - 1;
$chooseEnd = count((array)$splittedResponse) - 1;
$cutIdAndMsg = explode(' msg=', $splittedResponse[$chooseEnd]);
@ -4012,16 +4012,16 @@ class ts3admin {
$output = array();
foreach($datasets as $dataset) {
foreach ((array)$datasets as $dataset) {
$dataset = explode('=', $dataset);
if(count($dataset) > 2) {
for($i = 2; $i < count($dataset); $i++) {
if(count((array)$dataset) > 2) {
for($i = 2; $i < count((array)$dataset); $i++) {
$dataset[1] .= '='.$dataset[$i];
}
$output[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
}else{
if(count($dataset) == 1) {
if(count((array)$dataset) == 1) {
$output[$this->unEscapeText($dataset[0])] = '';
}else{
$output[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
@ -4037,20 +4037,20 @@ class ts3admin {
$output = array();
foreach($datasets as $datablock) {
foreach ((array)$datasets as $datablock) {
$datablock = explode(' ', $datablock);
$tmpArray = array();
foreach($datablock as $dataset) {
foreach ((array)$datablock as $dataset) {
$dataset = explode('=', $dataset);
if(count($dataset) > 2) {
for($i = 2; $i < count($dataset); $i++) {
if(count((array)$dataset) > 2) {
for($i = 2; $i < count((array)$dataset); $i++) {
$dataset[1] .= '='.$dataset[$i];
}
$tmpArray[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
}else{
if(count($dataset) == 1) {
if(count((array)$dataset) == 1) {
$tmpArray[$this->unEscapeText($dataset[0])] = '';
}else{
$tmpArray[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
@ -4096,7 +4096,7 @@ class ts3admin {
*/
private function ftSendData($data) {
$data = str_split($data, 4096);
foreach($data as $dat) {
foreach ((array)$data as $dat) {
fputs($this->runtime['fileSocket'], $dat);
}
}