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)

View file

@ -63,7 +63,7 @@ function exec_ogp_module() {
$groups = [];
}
$query_groups .= " AND (";
foreach($groups as $group)
foreach ((array)$groups as $group)
$query_groups .= "group_id=".$group['group_id']." OR ";
$query_groups .= "group_id=0 OR group_id IS NULL)";
}
@ -114,7 +114,7 @@ function exec_ogp_module() {
if (!is_array($ip_ports)) {
$ip_ports = [];
}
foreach($ip_ports as $ip_port);
foreach ((array)$ip_ports as $ip_port);
{
$address_owned = $ip_port['ip'].":".$ip_port['port'];
if($address_owned == $address_at_post)
@ -273,7 +273,7 @@ function exec_ogp_module() {
if (!is_array($addons)) {
$addons = [];
}
foreach($addons as $addon)
foreach ((array)$addons as $addon)
{
?>
<option value="<?php echo $addon['addon_id']; ?>"><?php echo $addon['name']; ?></option>

View file

@ -143,7 +143,7 @@ function exec_ogp_module() {
}
echo "<option style='background:black;color:white;' value=''>".get_lang('linux_games')."</option>\n";
foreach ( $game_cfgs as $row )
foreach ((array)$game_cfgs as $row)
{
if ( preg_match("/linux/", $row['game_key']) )
{
@ -154,7 +154,7 @@ function exec_ogp_module() {
}
}
echo "<option style='background:black;color:white;' value=''>".get_lang('windows_games')."</option>\n";
foreach ( $game_cfgs as $row )
foreach ((array)$game_cfgs as $row)
{
if ( preg_match("/win/", $row['game_key']) )
{
@ -175,7 +175,7 @@ function exec_ogp_module() {
<td align="left">
<?php
$types = array( 'plugin', 'mappack', 'config' );
foreach($types as $type)
foreach ((array)$types as $type)
{
$checked = ( isset($addon_type) AND $type == $addon_type) ? 'checked' : '';
echo '<input type="radio" name="addon_type" value="'.$type.'" '.$checked.'>'.get_lang($type);
@ -195,7 +195,7 @@ function exec_ogp_module() {
if (!is_array($groups)) {
$groups = [];
}
foreach($groups as $group)
foreach ((array)$groups as $group)
{
$selected = (isset($group_id) AND $group['group_id'] == $group_id) ? 'selected=selected' : '';
echo "<option value='".$group['group_id']."' $selected>".$group['group_name']."</option>\n";
@ -241,7 +241,7 @@ function exec_ogp_module() {
<b><?php print_lang('game'); ?></b> <select name='home_cfg_id'>
<?php
echo "<option style='background:black;color:white;' value=''>".get_lang('linux_games')."</option>\n";
foreach ( $game_cfgs as $row )
foreach ((array)$game_cfgs as $row)
{
if ( preg_match("/linux/", $row['game_key']) )
{
@ -255,7 +255,7 @@ function exec_ogp_module() {
}
}
echo "<option style='background:black;color:white;' value=''>".get_lang('windows_games')."</option>\n";
foreach ( $game_cfgs as $row )
foreach ((array)$game_cfgs as $row)
{
if(isset($_GET['home_cfg_id']) AND $row['home_cfg_id'] == $_GET['home_cfg_id'])
$selected = "selected='selected'";
@ -276,7 +276,7 @@ function exec_ogp_module() {
<?php
$option = '';
foreach ($addon_types as $k) {
foreach ((array)$addon_types as $k) {
$option .= '<option';
if (isset($_GET['addon_type']) && $_GET['addon_type'] == $k) {
@ -294,7 +294,7 @@ function exec_ogp_module() {
<select name='group_id'>
<option value="0"><?php print_lang('all_groups'); ?></option>
<?php
foreach($groups as $group)
foreach ((array)$groups as $group)
{
$selected = (isset($_GET['group_id']) AND $group['group_id'] == $_GET['group_id']) ? 'selected=selected' : '';
echo "<option value='".$group['group_id']."' $selected>".$group['group_name']."</option>\n";
@ -355,12 +355,12 @@ function exec_ogp_module() {
<table class="center">
<?php
$group_names = array();
foreach($groups as $group)
foreach ((array)$groups as $group)
$group_names[$group['group_id']] = $group['group_name'];
if (isset($result) and is_array($result) and (is_array($result) ? count($result) : 0) > 0)
if (isset($result) and is_array($result) and (is_array($result) ? count((array)$result) : 0) > 0)
{
foreach($result as $row)
foreach ((array)$result as $row)
{
?>
<tr>

View file

@ -30,12 +30,12 @@ if($_SESSION['users_role'] != "admin")
$groups = [];
}
$query_groups .= " AND (";
foreach($groups as $group)
foreach ((array)$groups as $group)
$query_groups .= "group_id=".$group['group_id']." OR ";
$query_groups .= "group_id=0 OR group_id IS NULL)";
}
$addons = $db->resultQuery("SELECT addon_id FROM OGP_DB_PREFIXaddons WHERE home_cfg_id=".$server_home['home_cfg_id'].$query_groups);
$addons_qty = is_array($addons) ? count($addons) : 0;
$addons_qty = is_array($addons) ? count((array)$addons) : 0;
if($addons and $addons_qty >= 1){
$module_buttons = array(
"<a class='monitorbutton' href='?m=addonsmanager&amp;p=user_addons&amp;home_id=".

View file

@ -42,7 +42,7 @@ function exec_ogp_module() {
$groups = [];
}
$query_groups .= " AND (";
foreach($groups as $group)
foreach ((array)$groups as $group)
$query_groups .= "group_id=".$group['group_id']." OR ";
$query_groups .= "group_id=0 OR group_id IS NULL)";
}
@ -57,7 +57,7 @@ function exec_ogp_module() {
"NATURAL JOIN OGP_DB_PREFIXconfig_homes ".
"WHERE addon_type='plugin' ".
"AND home_cfg_id=".$home_cfg_id.$query_groups);
$plugins_qty = is_array($plugins) ? count($plugins) : 0;
$plugins_qty = is_array($plugins) ? count((array)$plugins) : 0;
if($plugins and $plugins_qty >= 1)
echo "<a href='?m=addonsmanager&amp;p=addons&amp;home_id=".$home_id.
"&amp;mod_id=".$mod_id."&amp;addon_type=plugin&amp;ip=".$ip.
@ -68,7 +68,7 @@ function exec_ogp_module() {
"NATURAL JOIN OGP_DB_PREFIXconfig_homes ".
"WHERE addon_type='mappack' ".
"AND home_cfg_id=".$home_cfg_id.$query_groups);
$mappacks_qty = is_array($mappacks) ? count($mappacks) : 0;
$mappacks_qty = is_array($mappacks) ? count((array)$mappacks) : 0;
if($mappacks and $mappacks_qty >= 1){
echo "</td><td>";
echo "<a href='?m=addonsmanager&amp;p=addons&amp;home_id=".$home_id.
@ -80,7 +80,7 @@ function exec_ogp_module() {
"NATURAL JOIN OGP_DB_PREFIXconfig_homes ".
"WHERE addon_type='config' ".
"AND home_cfg_id=".$home_cfg_id.$query_groups);
$configs_qty = is_array($configs) ? count($configs) : 0;
$configs_qty = is_array($configs) ? count((array)$configs) : 0;
if($configs and $configs_qty >= 1){
echo "</td><td>";
echo "<a href='?m=addonsmanager&amp;p=addons&amp;home_id=".$home_id.

View file

@ -32,7 +32,7 @@ function exec_ogp_module()
echo "<tr>\n";
$menus = $db->getMenusForGroup('admin');
foreach ($menus as $key => $row) {
foreach ((array)$menus as $key => $row) {
if ( !empty( $row['subpage'] ) )
$name[$key] = $row['subpage'];
else
@ -44,7 +44,7 @@ function exec_ogp_module()
array_multisort($translation, $name, SORT_DESC, $menus);
$td = 0;
foreach ( $menus as $menu )
foreach ((array)$menus as $menu)
{
$module = $menu['module'];
if ( !empty( $menu['subpage'] ) )
@ -159,7 +159,7 @@ function exec_ogp_module()
$td2 = 0;
if($external_links != 0)
{
foreach ( $external_links as $external_link )
foreach ((array)$external_links as $external_link)
{
$url = $external_link['url'];
@ -185,7 +185,7 @@ function exec_ogp_module()
if ( isset( $_POST['changeOrder'] ) )
{
foreach($_POST as $key => $value)
foreach ((array)$_POST as $key => $value)
{
if( preg_match( "/^change_button/", $key ) )
{
@ -205,7 +205,7 @@ function exec_ogp_module()
$menus = $db->getMenusForGroup('user');
$pos = 0;
foreach ( $menus as $menu )
foreach ((array)$menus as $menu)
{
$module = $menu['module'];
if ( !empty( $menu['subpage'] ) )

View file

@ -31,7 +31,7 @@ function exec_ogp_module()
if(isset($_POST['unban']))
{
unset($_POST['unban']);
foreach($_POST as $name => $ip)
foreach ((array)$_POST as $name => $ip)
{
$ip = $db->real_escape_string($ip);
$db->query("DELETE FROM `OGP_DB_PREFIXban_list` WHERE client_ip = '$ip';");
@ -42,11 +42,11 @@ function exec_ogp_module()
$ban_table = '';
if($ban_list)
{
foreach($ban_list as $ban)
foreach ((array)$ban_list as $ban)
{
if($ban['logging_attempts'] >= $settings["login_attempts_before_banned"])
{
$ban_table .= "<tr><td><input type=checkbox name='".$ban_qty."' value='".$ban['client_ip']."' /></td><td>".$ban['client_ip']."</td><td>".date("r",$ban['banned_until'])."</td></tr>\n";
$ban_table .= "<tr><td><input type=checkbox name='".$ban_qty."' value='".$ban['client_ip']."' /></td><td>".$ban['client_ip']."</td><td>".date("r", is_numeric($ban['banned_until']) ? (int)$ban['banned_until'] : strtotime($ban['banned_until']))."</td></tr>\n";
$ban_qty++;
}
else

View file

@ -82,7 +82,7 @@ function exec_ogp_module() {
if( isset( $_POST['log_id'] ) ){
$db->del_logger_log($_POST['log_id']);
$newLogs = array();
foreach($logs as $log){
foreach ((array)$logs as $log){
if($log['log_id'] != $_POST['log_id']){
$newLogs[] = $log;
}
@ -97,7 +97,7 @@ function exec_ogp_module() {
if($logs)
{
foreach($logs as $log)
foreach ((array)$logs as $log)
{
$user = $db->getUserById($log['user_id']);
$when = $log['date'];
@ -126,7 +126,7 @@ function exec_ogp_module() {
"<table>\n";
$show_values = array( "users_login", "users_lang", "users_role", "users_email", "user_expires");
foreach($user as $key => $value)
foreach ((array)$user as $key => $value)
{
if( in_array( $key, $show_values ) )
echo "<tr><td>".str_replace("_", "", substr($key,5))."</td><td>$value</td></tr>\n";
@ -139,7 +139,7 @@ function exec_ogp_module() {
echo "</tbody>\n";
echo "<tfoot style='border:1px solid grey;'></tfoot>\n";
echo "</table>\n";
$count_logs = $db->get_logger_count($search_field);
$count_logs = $db->get_logger_count((array)$search_field);
if (isset($_GET['search']) && !empty($_GET['search'])) {
$uri = '?m=administration&p=watch_logger&search='.$_GET['search'].'&limit='.$l.'&page=';

View file

@ -20,7 +20,7 @@ function topRow(){
function bottomRow($latestDay,$backupPaths){
echo '<br><div>';
$latest = customSearch($latestDay,$backupPaths);
$length = count($backupPaths);
$length = count((array)$backupPaths);
for ($i = 0; $i < $length; $i++) {
$path = explode("/",$backupPaths[$i]);
$path1 = explode("-",$path[4]);
@ -106,7 +106,7 @@ function backupNow($homeid){
echo '</form>';
echo '<div>';
echo '<textarea readonly id="backup" name="backup" rows="20" cols="30">';
foreach ($output as $line) { echo $line."\n";}
foreach ((array)$output as $line) { echo $line."\n";}
echo '</textarea>';
echo '</div></div></center>';
@ -175,7 +175,7 @@ function restoreNow($homeid, $action){
echo '</form>';
echo '<div>';
echo '<textarea readonly id="backup" name="backup" rows="20" cols="30">';
foreach ($output as $line) { echo $line."\n";}
foreach ((array)$output as $line) { echo $line."\n";}
echo '</textarea>';
echo "</div>";
echo "</div></center>";
@ -217,7 +217,7 @@ function serverINFO($serverid) { // returns serverINFO Array
return $serverINFO;
}
function customSearch($keyword, $arrayToSearch){
foreach($arrayToSearch as $key => $arrayItem){
foreach ((array)$arrayToSearch as $key => $arrayItem){
if( stristr($arrayItem, $keyword)){
return $key;
}

View file

@ -135,7 +135,7 @@ function normalize_messages($messages) {
if (empty($messages['data']) || !is_array($messages['data'])) return $out;
// The API returns newest first by default if not specifying; we request 'asc' in fetch.
foreach ($messages['data'] as $m) {
foreach ((array)$messages['data'] as $m) {
$role = $m['role'] ?? '';
if (!in_array($role, ['user', 'assistant', 'system'], true)) continue;
@ -143,14 +143,14 @@ function normalize_messages($messages) {
$all_text = [];
$refs = [];
foreach ($m['content'] as $part) {
foreach ((array)$m['content'] as $part) {
if (($part['type'] ?? '') === 'text' && !empty($part['text']['value'])) {
$all_text[] = $part['text']['value'];
// Parse annotations for citations (file_citation)
$anns = $part['text']['annotations'] ?? [];
if (is_array($anns)) {
foreach ($anns as $ann) {
foreach ((array)$anns as $ann) {
if (($ann['type'] ?? '') === 'file_citation' && !empty($ann['file_citation']['file_id'])) {
$fid = $ann['file_citation']['file_id'];
$page = null;
@ -263,7 +263,7 @@ include(__DIR__ . '/includes/menu.php');
<?php if (!empty($history) && is_array($history)): ?>
<div style="margin-top:16px; padding:10px; border:1px solid #ccc; border-radius:8px;">
<?php foreach ($history as $msg):
<?php foreach ((array)$history as $msg):
// Label mapping: user => Question, assistant => Answer, system => (optional)
$role = $msg['role'] ?? 'assistant';
if ($role === 'user') $label = 'Question';
@ -280,7 +280,7 @@ include(__DIR__ . '/includes/menu.php');
<div style="margin-top:6px; font-size:12px;">
<em>References:</em>
<ul style="margin:6px 0 0 18px; padding:0;">
<?php foreach ($refs as $r):
<?php foreach ((array)$refs as $r):
$fname = $r['filename'] ?? 'file';
$page = $r['page'] ?? 'n/a';
// If you have your own document links, replace '#' with a real URL.

View file

@ -140,7 +140,7 @@ $game_options = [];
$games_dir = __DIR__ . '/../../config_games/server_configs/';
if (is_dir($games_dir)) {
$files = scandir($games_dir);
foreach ($files as $file) {
foreach ((array)$files as $file) {
if (pathinfo($file, PATHINFO_EXTENSION) === 'xml' && strpos($file, '.bak') === false) {
$game_key = str_replace('.xml', '', $file);
$game_options[] = $game_key;
@ -265,7 +265,7 @@ include(__DIR__ . '/includes/menu.php');
<div id="game_filter_list_container" class="form-group" style="display:none;">
<label>Select Games</label>
<div class="game-checkboxes">
<?php foreach ($game_options as $game): ?>
<?php foreach ((array)$game_options as $game): ?>
<label>
<input type="checkbox" name="game_filter_list[]" value="<?php echo h($game); ?>">
<?php echo h($game); ?>
@ -325,7 +325,7 @@ include(__DIR__ . '/includes/menu.php');
<?php if ($coupon['game_filter_type'] === 'all_games'): ?>
All Games
<?php else: ?>
<?php echo count($games_filtered); ?> specific games
<?php echo count((array)$games_filtered); ?> specific games
<?php endif; ?>
</td>
<td>
@ -397,7 +397,7 @@ include(__DIR__ . '/includes/menu.php');
<div class="form-group" style="display:<?php echo $coupon['game_filter_type'] === 'specific_games' ? 'block' : 'none'; ?>;">
<label>Select Games</label>
<div class="game-checkboxes">
<?php foreach ($game_options as $game): ?>
<?php foreach ((array)$game_options as $game): ?>
<label>
<input type="checkbox" name="game_filter_list[]" value="<?php echo h($game); ?>"
<?php echo in_array($game, $games_filtered) ? 'checked' : ''; ?>>

View file

@ -20,7 +20,7 @@ function exec_ogp_module()
$action = $_POST['bulk_action'];
$selected = $_POST['selected_orders'];
foreach ($selected as $order_id) {
foreach ((array)$selected as $order_id) {
$order_id = $db->realEscapeSingle($order_id);
switch ($action) {
@ -41,7 +41,7 @@ function exec_ogp_module()
}
}
echo "<div class='success'><p>Bulk action completed for ".count($selected)." order(s).</p></div>";
echo "<div class='success'><p>Bulk action completed for ".count((array)$selected)." order(s).</p></div>";
}
// Get filter parameters
@ -125,7 +125,7 @@ function exec_ogp_module()
echo "<th>Actions</th>";
echo "</tr></thead><tbody>";
foreach ($orders as $order) {
foreach ((array)$orders as $order) {
$status_class = '';
switch ($order['status']) {
case 'paid': $status_class = 'label-warning'; break;
@ -191,7 +191,7 @@ function exec_ogp_module()
echo "<table class='tablesorter' style='width: auto;'>";
echo "<thead><tr><th>Status</th><th>Count</th><th>Total Value</th></tr></thead><tbody>";
foreach ($stats as $stat) {
foreach ((array)$stats as $stat) {
echo "<tr>";
echo "<td>".$stat['status']."</td>";
echo "<td>".$stat['count']."</td>";

View file

@ -40,7 +40,7 @@ function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); }
</tr>
</thead>
<tbody>
<?php foreach ($files as $f): $j = json_decode(file_get_contents($f), true) ?: []; ?>
<?php foreach ((array)$files as $f): $j = json_decode(file_get_contents($f), true) ?: []; ?>
<tr>
<td><?php echo h(basename($f)); ?></td>
<td><?php echo h($j['invoice'] ?? ($j['custom'] ?? '')); ?></td>

View file

@ -14,7 +14,7 @@ $errors = [];
$availableFiles = [];
$directoryIterator = new DirectoryIterator($serverConfigDir);
foreach ($directoryIterator as $fileInfo) {
foreach ((array)$directoryIterator as $fileInfo) {
if ($fileInfo->isFile() && strtolower($fileInfo->getExtension()) === 'xml') {
$availableFiles[] = $fileInfo->getFilename();
}
@ -86,7 +86,7 @@ function billing_render_flash(array $items, string $cssClass): void {
return;
}
echo '<div class="panel ' . $cssClass . '" style="margin-bottom:12px">';
foreach ($items as $item) {
foreach ((array)$items as $item) {
echo '<div>' . $item . '</div>';
}
echo '</div>';
@ -134,7 +134,7 @@ function billing_render_flash(array $items, string $cssClass): void {
<?php if (!$availableFiles): ?>
<p style="color:#e5e7eb;">No XML files found.</p>
<?php else: ?>
<?php foreach ($availableFiles as $fileName): ?>
<?php foreach ((array)$availableFiles as $fileName): ?>
<?php $isActive = ($fileName === $selectedFile); ?>
<a href="admin_xml_editor.php?file=<?php echo urlencode($fileName); ?>" class="<?php echo $isActive ? 'active' : ''; ?>"><?php echo htmlspecialchars($fileName, ENT_QUOTES, 'UTF-8'); ?></a>
<?php endforeach; ?>

View file

@ -48,7 +48,7 @@ function col_exists($db, $table, $col){
function parse_id_list($s){
$tokens = preg_split('/\s+/', trim((string)$s));
$out = [];
foreach ($tokens as $t) {
foreach ((array)$tokens as $t) {
if ($t === '') continue;
if (preg_match('/^\d+$/', $t)) $out[] = (int)$t;
}
@ -73,7 +73,7 @@ if (isset($_POST['update_remote_servers'])) {
$enabledIds = array_map('intval', $_POST['rs'] ?? []);
$enabledSet = array_flip($enabledIds);
$allIds = fetch_all_assoc($db, "SELECT remote_server_id FROM {$table_prefix}remote_servers");
foreach ($allIds as $row) {
foreach ((array)$allIds as $row) {
$id = (int)$row['remote_server_id'];
$e = isset($enabledSet[$id]) ? 1 : 0;
$db->query("UPDATE {$table_prefix}remote_servers SET enabled={$e} WHERE remote_server_id={$id}");
@ -134,7 +134,7 @@ if (isset($_POST['update_single']) && isset($_POST['service']) && is_array($_POS
/* B2) BULK UPDATE (single button at bottom) */
if (isset($_POST['bulk_update']) && !empty($_POST['service']) && is_array($_POST['service'])) {
foreach ($_POST['service'] as $sid => $svc) {
foreach ((array)$_POST['service'] as $sid => $svc) {
update_service_row($db, $locationCol, (int)$sid, (array)$svc);
}
$flash[] = "All edited services have been updated.";
@ -153,15 +153,15 @@ $services = fetch_all_assoc($db, "SELECT service_id, service_name, `{$locat
?>
<?php if ($flash): ?>
<div class="panel" style="margin-bottom:12px"><?php foreach($flash as $m) echo "<div>".h($m)."</div>"; ?></div>
<div class="panel mb-12"><?php foreach($flash as $m) echo "<div>".h($m)."</div>"; ?></div>
<div class="panel" style="margin-bottom:12px"><?php foreach ((array)$flash as $m) echo "<div>".h($m)."</div>"; ?></div>
<div class="panel mb-12"><?php foreach ((array)$flash as $m) echo "<div>".h($m)."</div>"; ?></div>
<?php endif; ?>
<h2>Enable/Disable Server Locations (Global)</h2>
<form method="post" action="">
<input type="hidden" name="update_remote_servers" value="1">
<div style="display:flex;flex-wrap:wrap;gap:10px;">
<?php foreach ($remoteServers as $rs): ?>
<?php foreach ((array)$remoteServers as $rs): ?>
<label class="loc-label min-w-240">
<input type="checkbox" name="rs[]" value="<?php echo (int)$rs['remote_server_id']; ?>" <?php echo ((int)$rs['enabled']===1?'checked':''); ?>>
<b><?php echo h($rs['remote_server_name']); ?></b>
@ -199,7 +199,7 @@ $services = fetch_all_assoc($db, "SELECT service_id, service_name, `{$locat
</tr>
</thead>
<tbody>
<?php foreach ($services as $row): ?>
<?php foreach ((array)$services as $row): ?>
<?php
$sid = (int)$row['service_id'];
$selected = parse_id_list($row['locs'] ?? '');
@ -277,7 +277,7 @@ $services = fetch_all_assoc($db, "SELECT service_id, service_name, `{$locat
<tr>
<td colspan="8" style="border-bottom:1px solid #f0f0f0; padding:8px 6px; text-align:left;">
<div class="locs-box" data-sid="<?php echo $sid; ?>" style="display:flex; flex-wrap:wrap; gap:8px;">
<?php foreach ($remoteServers as $rs): ?>
<?php foreach ((array)$remoteServers as $rs): ?>
<?php
$rid = (int)$rs['remote_server_id'];
$isChecked = isset($selSet[$rid]);
@ -317,7 +317,7 @@ $services = fetch_all_assoc($db, "SELECT service_id, service_name, `{$locat
<form method="post" action="" style="display:flex;gap:8px;align-items:center;">
<input type="hidden" name="remove_service" value="1">
<select name="service_id_remove">
<?php foreach ($services as $s): ?>
<?php foreach ((array)$services as $s): ?>
<option value="<?php echo (int)$s['service_id']; ?>">
<?php echo h($s['service_name']); ?> (ID: <?php echo (int)$s['service_id']; ?>)
</option>

View file

@ -135,7 +135,7 @@ function normalize_messages($messages) {
if (empty($messages['data']) || !is_array($messages['data'])) return $out;
// The API returns newest first by default if not specifying; we request 'asc' in fetch.
foreach ($messages['data'] as $m) {
foreach ((array)$messages['data'] as $m) {
$role = $m['role'] ?? '';
if (!in_array($role, ['user', 'assistant', 'system'], true)) continue;
@ -143,14 +143,14 @@ function normalize_messages($messages) {
$all_text = [];
$refs = [];
foreach ($m['content'] as $part) {
foreach ((array)$m['content'] as $part) {
if (($part['type'] ?? '') === 'text' && !empty($part['text']['value'])) {
$all_text[] = $part['text']['value'];
// Parse annotations for citations (file_citation)
$anns = $part['text']['annotations'] ?? [];
if (is_array($anns)) {
foreach ($anns as $ann) {
foreach ((array)$anns as $ann) {
if (($ann['type'] ?? '') === 'file_citation' && !empty($ann['file_citation']['file_id'])) {
$fid = $ann['file_citation']['file_id'];
$page = null;
@ -263,7 +263,7 @@ include(__DIR__ . '/includes/menu.php');
<?php if (!empty($history) && is_array($history)): ?>
<div style="margin-top:16px; padding:10px; border:1px solid #ccc; border-radius:8px;">
<?php foreach ($history as $msg):
<?php foreach ((array)$history as $msg):
// Label mapping: user => Question, assistant => Answer, system => (optional)
$role = $msg['role'] ?? 'assistant';
if ($role === 'user') $label = 'Question';
@ -280,7 +280,7 @@ include(__DIR__ . '/includes/menu.php');
<div style="margin-top:6px; font-size:12px;">
<em>References:</em>
<ul style="margin:6px 0 0 18px; padding:0;">
<?php foreach ($refs as $r):
<?php foreach ((array)$refs as $r):
$fname = $r['filename'] ?? 'file';
$page = $r['page'] ?? 'n/a';
// If you have your own document links, replace '#' with a real URL.

View file

@ -76,14 +76,14 @@ create_order_log('PARSED_INPUT', [
'currency' => $currency,
'invoice_id' => $invoice_id,
'custom_id' => $custom_id,
'items_count' => $items ? count($items) : 0,
'line_invoices_count' => $line_invoices ? count($line_invoices) : 0
'items_count' => $items ? count((array)$items) : 0,
'line_invoices_count' => $line_invoices ? count((array)$line_invoices) : 0
]);
$amount_value = number_format((float)$amount_in, 2, '.', '');
if ($items) {
$sum = 0.00;
foreach ($items as $it) {
foreach ((array)$items as $it) {
$qty = isset($it['quantity']) ? (int)$it['quantity'] : 1;
$val = isset($it['unit_amount']['value']) ? (float)$it['unit_amount']['value'] : 0.00;
$sum += $qty * $val;

View file

@ -72,7 +72,7 @@ if (!$db) {
mysqli_free_result($result);
}
$cart_empty = (count($invoices) === 0);
$cart_empty = (count((array)$invoices) === 0);
}
// Handle coupon application
@ -120,9 +120,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['apply_coupon'])) {
$game_valid = true;
if ($coupon['game_filter_type'] === 'specific_games' && !empty($coupon['game_filter_list'])) {
$allowed_games = json_decode($coupon['game_filter_list'], true);
if (is_array($allowed_games) && count($allowed_games) > 0) {
if (is_array($allowed_games) && count((array)$allowed_games) > 0) {
$has_valid_game = false;
foreach ($invoices as $inv) {
foreach ((array)$invoices as $inv) {
$inv_game_key = isset($inv['game_key']) ? $inv['game_key'] : null;
if ($inv_game_key !== null && in_array($inv_game_key, $allowed_games)) {
$has_valid_game = true;
@ -256,7 +256,7 @@ $client_id = 'AfvY_C2zA_hTHxHq7TIhtOeub4xBdySYrt_Hjj3d_WYQwjWI9NfOAVOTeResx2rgZ_
// Prepare PayPal items
$paypal_items = [];
foreach ($invoices as $inv) {
foreach ((array)$invoices as $inv) {
$game_display = !empty($inv['game_name']) ? $inv['game_name'] : 'Game Server';
$qty = max(1, intval($inv['qty']));
$paypal_items[] = [
@ -550,7 +550,7 @@ $siteBase = $protocol . $host;
</tr>
</thead>
<tbody>
<?php foreach ($invoices as $inv): ?>
<?php foreach ((array)$invoices as $inv): ?>
<tr>
<td>
<div class="game-name"><?php echo htmlspecialchars($inv['game_name'] ?? 'Game Server'); ?></div>

View file

@ -62,7 +62,7 @@ if (mysqli_num_rows($last_result) > 0) {
while ($row = mysqli_fetch_assoc($last_result)) {
echo "<tr>";
foreach ($row as $val) {
foreach ((array)$row as $val) {
echo "<td>" . htmlspecialchars($val ?? 'NULL') . "</td>";
}
echo "</tr>\n";

View file

@ -69,7 +69,7 @@ function exec_ogp_module()
$provisioned_count = 0;
$failed_count = 0;
foreach($orders as $order)
foreach ((array)$orders as $order)
{
$order_id = $order['order_id'];
$processed_orders[] = intval($order_id);
@ -137,7 +137,7 @@ function exec_ogp_module()
If you have any questions or requests, visit our website or contact us directly in our Discord Server.";
$mail = mymail($email, $subject, $message, $settings);
$rundate = date('d/M/y G:i',$now);
$rundate = date('d/M/y G:i', is_numeric($now) ? (int)$now : strtotime($now));
if (!$mail)
$db->logger( "Email FAILED - Server Renewed " . $home_id);
@ -180,7 +180,7 @@ function exec_ogp_module()
//Add IP:Port Pair to the Game Home
//need to get the IP_ID for this remote server.
$result = $db->resultQuery("SELECT ip_id FROM OGP_DB_PREFIXremote_server_ips WHERE remote_server_id=".$ip);
foreach ($result as $rs)
foreach ((array)$result as $rs)
{
$ip_id = $rs['ip_id'];
}
@ -303,7 +303,7 @@ function exec_ogp_module()
You can login to the Game Panel and click on Game Monitor to see your server. <br><br>
Thank you!<br> ";
$mail = mymail($email, $subject, $message, $settings);
$rundate = date('d/M/y G:i',$now);
$rundate = date('d/M/y G:i', is_numeric($now) ? (int)$now : strtotime($now));
if (!$mail)
$db->logger( "Email FAILED - Server Created " . $home_id);

View file

@ -62,7 +62,7 @@ $today = time();
$invoice_date = strtotime('+ 7 days'); // Create invoice 7 days before expiration
$suspend_date = $today; // Suspend immediately when overdue
$removal_date = strtotime('- 7 days'); // Remove 7 days after suspension
$rundate = date('Y-m-d H:i:s', $today);
$rundate = date('Y-m-d H:i:s', is_numeric($today) ? (int)$today : strtotime($today));
$db->logger("BILLING-CRON: Server lifecycle automation running at " . $rundate);
@ -85,7 +85,7 @@ $upcoming_expirations = $db->resultQuery("
");
if (is_array($upcoming_expirations)) {
foreach ($upcoming_expirations as $order) {
foreach ((array)$upcoming_expirations as $order) {
$user_id = $order['user_id'];
$order_id = $order['order_id'];
$home_id = $order['home_id'];
@ -158,7 +158,7 @@ $servers_to_suspend = $db->resultQuery("
");
if (is_array($servers_to_suspend)) {
foreach ($servers_to_suspend as $order) {
foreach ((array)$servers_to_suspend as $order) {
$user_id = $order['user_id'];
$home_id = $order['home_id'];
$order_id = $order['order_id'];
@ -185,7 +185,7 @@ if (is_array($servers_to_suspend)) {
$control_type = isset($server_xml->control_protocol_type) ? $server_xml->control_protocol_type : "";
$addresses = $db->getHomeIpPorts($home_id);
foreach ($addresses as $address) {
foreach ((array)$addresses as $address) {
$remote->remote_stop_server($home_id, $address['ip'], $address['port'],
$server_xml->control_protocol, $home_info['control_password'],
$control_type, $home_info['home_path']);
@ -234,7 +234,7 @@ $servers_to_delete = $db->resultQuery("
");
if (is_array($servers_to_delete)) {
foreach ($servers_to_delete as $order) {
foreach ((array)$servers_to_delete as $order) {
$user_id = $order['user_id'];
$home_id = $order['home_id'];
$order_id = $order['order_id'];
@ -305,7 +305,7 @@ if (!is_array($user_homes))
}
else
{
foreach($user_homes as $user_home)
foreach ((array)$user_homes as $user_home)
{
// Developer note:
@ -358,7 +358,7 @@ if (!is_array($user_homes))
}
else
{
foreach($user_homes as $user_home)
foreach ((array)$user_homes as $user_home)
{
$user_id = $user_home['user_id'];
$home_id = $user_home['home_id'];
@ -371,7 +371,7 @@ else
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$home_info['home_cfg_file']);
if(isset($server_xml->control_protocol_type))$control_type = $server_xml->control_protocol_type; else $control_type = "";
$addresses = $db->getHomeIpPorts($home_id);
foreach($addresses as $address)
foreach ((array)$addresses as $address)
{
$remote->remote_stop_server($home_id,$address['ip'],$address['port'],$server_xml->control_protocol,$home_info['control_password'],$control_type,$home_info['home_path']);
}
@ -412,7 +412,7 @@ if (!is_array($user_homes))
}
else
{
foreach($user_homes as $user_home)
foreach ((array)$user_homes as $user_home)
{
$user_id = $user_home['user_id'];
$home_id = $user_home['home_id'];

View file

@ -32,7 +32,7 @@ function getDocCategories($docsDir) {
$folders = array_diff(scandir($docsDir), ['.', '..']);
foreach ($folders as $folder) {
foreach ((array)$folders as $folder) {
$folderPath = $docsDir . '/' . $folder;
// Skip if not a directory
@ -96,7 +96,7 @@ $categories = getDocCategories($docsDir);
// Group by category
$grouped = [];
foreach ($categories as $cat) {
foreach ((array)$categories as $cat) {
$category = $cat['category'];
if (!isset($grouped[$category])) {
$grouped[$category] = [];
@ -387,20 +387,20 @@ uksort($grouped, function($a, $b) use ($categoryOrder) {
<!-- Navigation Links -->
<div class="nav-links">
<h3>Jump to Section:</h3>
<?php foreach ($grouped as $category => $docs): ?>
<?php foreach ((array)$grouped as $category => $docs): ?>
<a href="#<?php echo htmlspecialchars($category); ?>">
<?php echo htmlspecialchars($categoryLabels[$category] ?? ucfirst($category)); ?>
(<?php echo count($docs); ?>)
(<?php echo count((array)$docs); ?>)
</a>
<?php endforeach; ?>
</div>
<?php foreach ($grouped as $category => $docs): ?>
<?php foreach ((array)$grouped as $category => $docs): ?>
<div class="category-section" id="<?php echo htmlspecialchars($category); ?>">
<h2 class="category-title"><?php echo htmlspecialchars($categoryLabels[$category] ?? ucfirst($category)); ?></h2>
<div class="docs-grid">
<?php foreach ($docs as $doc): ?>
<?php foreach ((array)$docs as $doc): ?>
<a href="docs.php?action=view&doc=<?php echo urlencode($doc['folder']); ?>" class="doc-card">
<div class="doc-icon-wrapper">
<?php if (!empty($doc['icon'])): ?>

View file

@ -14,7 +14,7 @@ function billing_render_markdown($markdown)
$html = '';
$inCode = false;
$inList = false;
foreach ($lines as $line) {
foreach ((array)$lines as $line) {
$trim = trim($line);
if ($trim === '```') {
if ($inCode) {

View file

@ -11,7 +11,7 @@ function get_cart_count() {
return 0;
}
$count = 0;
foreach ($_SESSION['cart'] as $item) {
foreach ((array)$_SESSION['cart'] as $item) {
if (is_array($item) && isset($item['quantity'])) {
$count += (int) $item['quantity'];
} else {

View file

@ -48,7 +48,7 @@ $attempted[] = $localConfig;
$message = "GSP Billing module cannot find config.inc.php.\n";
$message .= "Looked in:\n";
foreach ($attempted as $path) {
foreach ((array)$attempted as $path) {
if (!$path) {
continue;
}

View file

@ -115,7 +115,7 @@ function process_payment_record(array $record) {
$processed_count = 0;
foreach ($invoices_to_process as $inv) {
foreach ((array)$invoices_to_process as $inv) {
$invoice_id = intval($inv['invoice_id']);
$order_id = intval($inv['order_id'] ?? 0);
$user_id = intval($inv['user_id']);

View file

@ -48,7 +48,7 @@ function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); }
</tr>
</thead>
<tbody>
<?php foreach ($records as $r): ?>
<?php foreach ((array)$records as $r): ?>
<tr>
<td><?php echo h($r['invoice'] ?? ($r['custom'] ?? 'NO-ID')); ?></td>
<td><?php echo h(($r['currency'] ?? '') . ' ' . number_format((float)($r['amount'] ?? 0),2)); ?></td>

View file

@ -196,7 +196,7 @@ usort($invoices, function($a, $b) {
// Organize invoices by status
$invoices_by_status = [];
foreach ($invoices as $inv) {
foreach ((array)$invoices as $inv) {
$status = strtolower($inv['status'] ?? 'pending');
if (!isset($invoices_by_status[$status])) {
$invoices_by_status[$status] = [];
@ -355,11 +355,11 @@ $status_config = [
<!-- Invoices Section - Organized by Status -->
<?php if (!empty($invoices_by_status)): ?>
<?php foreach ($status_config as $status_key => $status_info): ?>
<?php foreach ((array)$status_config as $status_key => $status_info): ?>
<?php if (isset($invoices_by_status[$status_key]) && !empty($invoices_by_status[$status_key])): ?>
<div class="account-section">
<h2><?php echo htmlspecialchars($status_info['label']); ?></h2>
<?php foreach ($invoices_by_status[$status_key] as $invoice): ?>
<?php foreach ((array)$invoices_by_status[$status_key] as $invoice): ?>
<div class="invoice-item">
<div>
<div class="invoice-id">Invoice #<?php echo htmlspecialchars($invoice['invoice'] ?? $invoice['custom'] ?? 'N/A'); ?></div>

View file

@ -52,7 +52,7 @@ function exec_ogp_module()
echo "<th>Action</th>";
echo "</tr></thead><tbody>";
foreach ($orders as $order) {
foreach ((array)$orders as $order) {
echo "<tr>";
echo "<td>".$order['order_id']."</td>";
echo "<td>".$order['home_name']."</td>";
@ -75,11 +75,11 @@ function exec_ogp_module()
echo "</tbody></table>";
// Provision all button
if (count($orders) > 1) {
if (count((array)$orders) > 1) {
echo "<div style='margin-top: 20px;'>";
echo "<form method='post' action='home.php?m=billing&p=provision_servers'>";
echo "<input type='hidden' name='provision_all' value='1'>";
echo "<button type='submit' class='btn btn-primary'>Provision All My Servers (".count($orders).")</button>";
echo "<button type='submit' class='btn btn-primary'>Provision All My Servers (".count((array)$orders).")</button>";
echo "</form>";
echo "</div>";
}

View file

@ -75,7 +75,7 @@ THIS IS WHAT WE DISPLAY ON THE SHOP PAGE AT THE TOP
return;
}
foreach ($services as $key => $row) {
foreach ((array)$services as $key => $row) {
$service_ids[$key] = $row['service_id'];
$home_cfg_id[$key] = $row['home_cfg_id'];
$mod_cfg_id[$key] = $row['mod_cfg_id'];
@ -97,7 +97,7 @@ THIS IS WHAT WE DISPLAY ON THE SHOP PAGE AT THE TOP
?>
<div class="clearfix">
<?php
foreach($services as $row)
foreach ((array)$services as $row)
{
if(!isset($_REQUEST['service_id']))
{
@ -196,11 +196,11 @@ if ($row['price_monthly'] == 0.0) {
//get the out of stock into an array and see if the rsID is in that array
$available_server = false;
//loop through each of the assigned servers and see if its disabled
foreach($rsiArray as $rsi)
foreach ((array)$rsiArray as $rsi)
{
$query = "SELECT * FROM {$table_prefix}remote_servers WHERE remote_server_id = ".$rsi;
$result = $db->query($query);
foreach($result as $rs)
foreach ((array)$result as $rs)
{
$rsID =$rs['remote_server_id'];

View file

@ -182,7 +182,7 @@ if ($db && $user_id > 0) {
</ul>
</div>
<?php if (count($orders) > 0): ?>
<?php if (count((array)$orders) > 0): ?>
<h2>Your Orders</h2>
<table class="orders-table">
<thead>
@ -196,7 +196,7 @@ if ($db && $user_id > 0) {
</tr>
</thead>
<tbody>
<?php foreach ($orders as $order): ?>
<?php foreach ((array)$orders as $order): ?>
<tr>
<td>#<?php echo htmlspecialchars($order['order_id']); ?></td>
<td><?php echo htmlspecialchars($order['home_name']); ?></td>

View file

@ -75,7 +75,7 @@ function money_fmt($value, $currency) {
<?php
$currency = $details['currency'] ?? ($items[0]['unit_amount']['currency_code'] ?? '');
$grand = 0.00;
foreach ($items as $it) {
foreach ((array)$items as $it) {
$name = $it['name'] ?? '';
$sku = $it['sku'] ?? '';
$qty = isset($it['quantity']) ? (int)$it['quantity'] : 1;

View file

@ -56,7 +56,7 @@ include(__DIR__ . '/includes/menu.php');
<!-- Services container: clearfix to contain floated service cards so footer clears correctly -->
<div class="clearfix container-wide">
<?php foreach ($services as $row): ?>
<?php foreach ((array)$services as $row): ?>
<?php if (!isset($_REQUEST['service_id'])): ?>
<!-- Service listing (all) -->
<div class="float-left p-30-20">

View file

@ -105,7 +105,7 @@ while ($row = mysqli_fetch_assoc($result)) {
}
$all_present = true;
foreach ($required_columns as $col) {
foreach ((array)$required_columns as $col) {
if (in_array($col, $existing_columns)) {
echo "<p class='success'>✓ Column '$col' exists</p>";
} else {

View file

@ -39,7 +39,7 @@ function exec_ogp_module()
'admin_orders.php' => 'Admin order management'
);
foreach ($pages as $file => $desc) {
foreach ((array)$pages as $file => $desc) {
$path = "modules/billing/".$file;
if (file_exists($path)) {
echo "<div class='success'>✓ $file - $desc</div>";
@ -56,7 +56,7 @@ function exec_ogp_module()
'billing_invoices' => 'Payment records'
);
foreach ($tables as $table => $desc) {
foreach ((array)$tables as $table => $desc) {
$result = $db->query("SHOW TABLES LIKE 'OGP_DB_PREFIX".$table."'");
if ($result && $db->num_rows($result) > 0) {
echo "<div class='success'>✓ $table - $desc</div>";
@ -72,7 +72,7 @@ function exec_ogp_module()
if (!empty($stats)) {
echo "<table class='tablesorter'>";
echo "<thead><tr><th>Status</th><th>Count</th></tr></thead><tbody>";
foreach ($stats as $stat) {
foreach ((array)$stats as $stat) {
echo "<tr><td>".$stat['status']."</td><td>".$stat['count']."</td></tr>";
}
echo "</tbody></table>";

View file

@ -34,6 +34,6 @@ echo "RESPONSE:\n" . $res . "\n";
$dataDir = realpath(__DIR__ . '/../data');
$files = glob($dataDir . '/*.json');
echo "Files in data/ after run: \n";
foreach ($files as $f) echo basename($f) . "\n";
foreach ((array)$files as $f) echo basename($f) . "\n";
?>

View file

@ -99,7 +99,7 @@ if (isset($res['purchase_units'][0]['items']) && is_array($res['purchase_units']
if (!$items && $type === 'PAYMENT.CAPTURE.COMPLETED') {
$orderId = $res['supplementary_data']['related_ids']['order_id'] ?? null;
if (!$orderId && isset($res['links']) && is_array($res['links'])) {
foreach ($res['links'] as $lnk) {
foreach ((array)$res['links'] as $lnk) {
if (!empty($lnk['href']) && !empty($lnk['rel']) && stripos($lnk['href'], '/v2/checkout/orders/') !== false) {
$orderId = basename(parse_url($lnk['href'], PHP_URL_PATH));
break;
@ -157,7 +157,7 @@ if (in_array($type, ['PAYMENT.CAPTURE.COMPLETED','PAYMENT.SALE.COMPLETED'], true
}
}
if (function_exists('site_log_info')) site_log_info('webhook_event',['type'=>$type,'invoice'=>($invoice ?: 'none'),'items_count'=>count($items),'status'=>$status]);
else log_line("EVENT $type invoice=".($invoice ?: 'none')." items_count=".count($items)." status=$status");
if (function_exists('site_log_info')) site_log_info('webhook_event',['type'=>$type,'invoice'=>($invoice ?: 'none'),'items_count'=>count((array)$items),'status'=>$status]);
else log_line("EVENT $type invoice=".($invoice ?: 'none')." items_count=".count((array)$items)." status=$status");
?>

View file

@ -43,7 +43,7 @@ function exec_ogp_module()
{
if(isset($_POST['circulars_ids']) and is_array($_POST['circulars_ids']) and !empty($_POST['circulars_ids']))
{
foreach($_POST['circulars_ids'] as $circular_id)
foreach ((array)$_POST['circulars_ids'] as $circular_id)
{
remove_circular($circular_id, true);
}
@ -67,7 +67,7 @@ function exec_ogp_module()
"<th>".get_lang('users_not_read_circular')."</th>".
"<th>".get_lang('date')."</th></thead>\n";
foreach($circulars as $key => $circular)
foreach ((array)$circulars as $key => $circular)
{
$users_not_readed = get_usernames_not_read_circular($circular['circular_id']);
$users_not_readed = $users_not_readed ? $users_not_readed: "";
@ -104,7 +104,7 @@ function exec_ogp_module()
'<td><select id="select_admins" multiple>'."\n";
if(!empty($users))
{
foreach($users as $user)
foreach ((array)$users as $user)
{
if($user['users_role'] == 'admin')
echo '<option value="'.$user['user_id'].'">'.$user['users_login'].'</option>'."\n";
@ -114,7 +114,7 @@ function exec_ogp_module()
'<td><select id="select_users" multiple>'."\n";
if(!empty($users))
{
foreach($users as $user)
foreach ((array)$users as $user)
{
if($user['users_role'] == 'user')
echo '<option value="'.$user['user_id'].'">'.$user['users_login'].'</option>'."\n";
@ -125,7 +125,7 @@ function exec_ogp_module()
$groups = $db->getGroupList();
if(!empty($groups))
{
foreach($groups as $group)
foreach ((array)$groups as $group)
{
if($db->listUsersInGroup($group['group_id']))
echo '<option value="'.$group['group_id'].'">'.$group['group_name'].'</option>';
@ -136,7 +136,7 @@ function exec_ogp_module()
echo '<td><select id="select_subusers_of_users" multiple>'."\n";
if(!empty($users))
{
foreach($users as $user)
foreach ((array)$users as $user)
{
$sub_users_ids = $db->getUsersSubUsersIds($user['user_id']);
if($user['users_role'] == 'user' and $sub_users_ids)

View file

@ -33,7 +33,7 @@ function get_usernames_not_read_circular($circular_id)
if($users)
{
$user_names = array();
foreach($users as $user)
foreach ((array)$users as $user)
{
$user_info = $db->getUserById($user['user_id']);
$user_names[] = $user_info['users_login'];
@ -98,7 +98,7 @@ function send_to_user($user_id, $circular_id)
function get_user_ids($type, $ids, &$user_ids)
{
global $db;
foreach($ids as $id)
foreach ((array)$ids as $id)
{
if($type == 'admins' or $type == 'users')
{
@ -110,7 +110,7 @@ function get_user_ids($type, $ids, &$user_ids)
$group_users = $db->listUsersInGroup($id);
if($group_users and !empty($group_users))
{
foreach($group_users as $user)
foreach ((array)$group_users as $user)
{
if(!in_array($user['user_id'], $user_ids))
$user_ids[] = $user['user_id'];
@ -122,7 +122,7 @@ function get_user_ids($type, $ids, &$user_ids)
$sub_users_ids = $db->getUsersSubUsersIds($id);
if($sub_users_ids and !empty($sub_users_ids))
{
foreach($sub_users_ids as $user_id)
foreach ((array)$sub_users_ids as $user_id)
{
if(!in_array($user_id, $user_ids))
$user_ids[] = $user_id;
@ -138,13 +138,13 @@ function send_circular($data)
$circular_id = $db->resultInsertId('circular', array('subject' => $data['subject'], 'message' => $data['message']));
$user_ids = array();
unset($data['subject'], $data['message']);
foreach($data as $type => $ids)
foreach ((array)$data as $type => $ids)
{
if(is_array($ids) and !empty($ids))
get_user_ids($type, $ids, $user_ids);
}
$failed_recipients = array();
foreach($user_ids as $user_id)
foreach ((array)$user_ids as $user_id)
{
if(!send_to_user($user_id, $circular_id))
$failed_recipients[] = $user_id;

View file

@ -31,7 +31,7 @@ function exec_ogp_module()
rsort($circulars);
echo "<table id='circular_list'>\n".
"<thead><tr><th>".get_lang('status')."</th><th>".get_lang('subject')."</th><th>".get_lang('date')."</th></tr></thead><tbody>\n";
foreach($circulars as $key => $circular)
foreach ((array)$circulars as $key => $circular)
{
echo '<tr><td><i class="status_'.$circular['status'].'"></i></td><td><a href="?m=circular&p=show_circular&read_circular='.$circular['circular_id'].'">'.$circular['subject']."</a></td><td>".$circular['timestamp']."</td></tr>\n";
}
@ -39,7 +39,7 @@ function exec_ogp_module()
}
elseif(isset($_GET['read_circular']) and is_numeric($_GET['read_circular']))
{
foreach($circulars as $circular)
foreach ((array)$circulars as $circular)
if($circular['circular_id'] == $_GET['read_circular'])
break;
echo '<div id="circular_message">'.$circular['message']."</div>\n".
@ -49,7 +49,7 @@ function exec_ogp_module()
}
else
{
foreach($circulars as $key => $circular)
foreach ((array)$circulars as $key => $circular)
if($circular['status'] == "1")
unset($circulars[$key]);
sort($circulars);

View file

@ -117,9 +117,9 @@ function config_games_render_node(SimpleXMLElement $node, array $ancestors, arra
}
$attributes = $node->attributes();
if ($attributes && count($attributes) > 0) {
if ($attributes && count((array)$attributes) > 0) {
$html .= "<div class='xml-node__attributes'><strong>Attributes</strong>";
foreach ($attributes as $attrName => $attrValue) {
foreach ((array)$attributes as $attrName => $attrValue) {
$attrSafe = htmlspecialchars($attrName, ENT_QUOTES, 'UTF-8');
$valSafe = htmlspecialchars((string)$attrValue, ENT_QUOTES, 'UTF-8');
$html .= "<div class='attr-row'><span>{$attrSafe}</span><input type='text' name=\"nodes[{$safeNodeKey}][attributes][{$attrSafe}]\" value=\"{$valSafe}\" placeholder='Leave blank to remove'></div>";
@ -166,7 +166,7 @@ function config_games_save_xml($db, $home_cfg_id, array $nodesPayload)
return false;
}
$nodes = [];
foreach ($nodesPayload as $key => $data) {
foreach ((array)$nodesPayload as $key => $data) {
$rawPath = isset($data['path']) ? (string)$data['path'] : (string)$key;
$cleanPath = config_games_normalize_path($rawPath);
if ($cleanPath === '') {
@ -188,7 +188,7 @@ function config_games_save_xml($db, $home_cfg_id, array $nodesPayload)
uksort($nodes, function ($a, $b) {
return substr_count($b, '/') <=> substr_count($a, '/');
});
foreach ($nodes as $path => $nodeData) {
foreach ((array)$nodes as $path => $nodeData) {
$query = '/' . $path;
$nodeList = @$xpath->query($query);
if (!$nodeList || $nodeList->length === 0) {
@ -203,7 +203,7 @@ function config_games_save_xml($db, $home_cfg_id, array $nodesPayload)
continue;
}
$hasChildren = !empty($nodeData['has_children']);
if (array_key_exists('value', $nodeData)) {
if (array_key_exists('value', (array)$nodeData)) {
$normalizedValue = config_games_normalize_newlines($nodeData['value']);
while ($domNode->firstChild) {
$domNode->removeChild($domNode->firstChild);
@ -217,7 +217,7 @@ function config_games_save_xml($db, $home_cfg_id, array $nodesPayload)
}
}
if (isset($nodeData['attributes']) && is_array($nodeData['attributes'])) {
foreach ($nodeData['attributes'] as $attrName => $attrValue) {
foreach ((array)$nodeData['attributes'] as $attrName => $attrValue) {
$attrNameClean = preg_replace('/[^A-Za-z0-9_\\-:]/', '', (string)$attrName);
if ($attrNameClean === '') {
continue;
@ -298,7 +298,7 @@ function exec_ogp_module() {
$db->clearGameCfgs($clear_old);
foreach ( $files as $config_file )
foreach ((array)$files as $config_file)
{
$config = read_server_config($config_file);
@ -342,7 +342,7 @@ function exec_ogp_module() {
<td class='left'>\n
<select name='home_cfg_id' onchange=".'"this.form.submit()"'.">\n
<option style='background:black;color:white;' value=''>".get_lang('select_game')."</option>\n";
foreach ( $game_cfgs as $row )
foreach ((array)$game_cfgs as $row)
{
if ( preg_match( "/_win/", $row['game_key'] ) )
$os = "(Windows)";

View file

@ -123,7 +123,7 @@ function exec_ogp_module() {
$_SESSION['mods'][1]['mod_installer_name'] = $key_name;
}
$mods = $_SESSION['mods'];
foreach($mods as $mod)
foreach ((array)$mods as $mod)
{
$template .= "
<mod key='".$mod['mod_key']."'>
@ -139,7 +139,7 @@ function exec_ogp_module() {
$template .= "
<server_params>";
$params = $_SESSION['params'];
foreach($params as $param)
foreach ((array)$params as $param)
{
$template .= "
<param key='".$param['param_key']."' type='".$param['param_type']."'>

View file

@ -72,7 +72,7 @@ if (!function_exists('ogp_format_libxml_errors')) {
return "No additional libxml details are available.";
}
$messages = array();
foreach ($errors as $error) {
foreach ((array)$errors as $error) {
$messages[] = trim($error->message) . " (Line {$error->line}, Column {$error->column})";
}
libxml_clear_errors();

View file

@ -92,7 +92,7 @@ function exec_ogp_module() {
$template = "";
if ($mods)
{
foreach($mods as $mod)
foreach ((array)$mods as $mod)
{
$template .= " ";
$template .= $mod['mod_name'];

View file

@ -97,7 +97,7 @@ function exec_ogp_module() {
if ($params)
{
$template = "";
foreach($params as $param)
foreach ((array)$params as $param)
{
$template .= $param['param_key'];
}

View file

@ -32,7 +32,7 @@ function exec_ogp_module()
require_once 'protocol/lgsl/lgsl_protocol.php';
$lgsl_type_list = lgsl_type_list();
asort($lgsl_type_list);
foreach ($lgsl_type_list as $type => $description) {
foreach ((array)$lgsl_type_list as $type => $description) {
$queryChoices[$type] = $description;
}
$queryLabel = 'LGSL Query Name';
@ -58,7 +58,7 @@ function exec_ogp_module()
}
unset($dir);
ksort($protocols);
foreach ($protocols as $gameq => $info) {
foreach ((array)$protocols as $gameq => $info) {
$queryChoices[$gameq] = $info['name'];
}
$queryLabel = 'GameQ Query Name';
@ -95,7 +95,7 @@ CSS;
'lgsl' => 'LGSL',
'gameq' => 'GameQ',
);
foreach ($protocolOptions as $value => $label) {
foreach ((array)$protocolOptions as $value => $label) {
$safeValue = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
$safeLabel = htmlspecialchars($label, ENT_QUOTES, 'UTF-8');
$selected = ($selectedProtocol === $value) ? "selected='selected'" : '';
@ -115,7 +115,7 @@ CSS;
$label = htmlspecialchars($queryLabel, ENT_QUOTES, 'UTF-8');
echo "<label for='query_name'>{$label}</label>";
echo "<select id='query_name' name='query_name'>";
foreach ($queryChoices as $value => $labelText) {
foreach ((array)$queryChoices as $value => $labelText) {
$safeValue = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
$safeLabelText = htmlspecialchars($labelText, ENT_QUOTES, 'UTF-8');
echo "<option value='{$safeValue}'>{$safeLabelText}</option>";

View file

@ -35,14 +35,14 @@ function exec_ogp_module()
return 0;
}
foreach( $homes as $home )
foreach ((array)$homes as $home)
{
$home['access_rights'] = "ufpet";
$id = $home['home_id']."_".$home['ip']."_".$home['port'];
$server_homes[$id] = $home;
}
foreach($r_servers as $r_server)
foreach ((array)$r_servers as $r_server)
{
$id = $r_server['remote_server_id'];
$remote_servers[$id] = $r_server;
@ -134,7 +134,7 @@ function exec_ogp_module()
$refresh = new refreshed();
if( isset($_POST['r_server_id']) )
{
foreach($server_homes as $key => $server_home)
foreach ((array)$server_homes as $key => $server_home)
{
if($server_home['remote_server_id'] == $_POST['r_server_id'])
{
@ -265,7 +265,7 @@ function exec_ogp_module()
if ( !empty($remote_servers_offline) )
{
$offline_servers = server . " (" . offline . "):";
foreach($remote_servers_offline as $remote_server_offline)
foreach ((array)$remote_servers_offline as $remote_server_offline)
{
$offline_servers .= " " . $remote_server_offline['remote_server_name'] . ",";
}
@ -310,12 +310,12 @@ function exec_ogp_module()
</tr>
<?php
$user_jobs = "";
foreach( $jobsArray as $remote_server_id => $jobs )
foreach ((array)$jobsArray as $remote_server_id => $jobs )
{
foreach($jobs as $jobId => $job)
foreach ((array)$jobs as $jobId => $job)
{
if(isset($job['action'])){
if(array_key_exists('home_id', $job) && array_key_exists('ip', $job) && array_key_exists('port', $job) && hasValue($job['home_id']) && hasValue($job['ip']) && hasValue($job['port'])){
if(array_key_exists('home_id', (array)$job) && array_key_exists('ip', (array)$job) && array_key_exists('port', (array)$job) && hasValue($job['home_id']) && hasValue($job['ip']) && hasValue($job['port'])){
$idStr = $job['home_id']."_".$job['ip']."_".$job['port'];
}else{
$idStr = false;

View file

@ -76,7 +76,7 @@ function exec_ogp_module()
get_lang('refresh_interval').
':<select name="setInterval" onchange="this.form.submit();">';
foreach ($intervals as $interval => $value )
foreach ((array)$intervals as $interval => $value )
{
$selected = "";
if ( isset( $_GET['setInterval'] ) AND $_GET['setInterval'] == $value )

View file

@ -26,7 +26,7 @@ function reloadJobs($server_homes, $remote_servers, $getAllJobs = true)
global $db;
$remote_servers_offline = array();
$jobsArray = array();
foreach( $remote_servers as $rhost_id => $remote_server )
foreach ((array)$remote_servers as $rhost_id => $remote_server )
{
$remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key'], $remote_server['timeout']);
if($remote->status_chk() != 1)
@ -39,7 +39,7 @@ function reloadJobs($server_homes, $remote_servers, $getAllJobs = true)
$jobs = $remote->scheduler_list_tasks();
if($jobs != -1)
{
foreach($jobs as $jobId => $job)
foreach ((array)$jobs as $jobId => $job)
{
list($minute,$hour,$dayOfTheMonth,$month,$dayOfTheWeek,$command) = explode(" ", $job, 6);
if(preg_match('/'.preg_quote('wget -qO- "','/').'([^"]+)'.preg_quote('" --no-check-certificate > /dev/null 2>&1','/').'/', $command))
@ -102,11 +102,11 @@ function reloadJobs($server_homes, $remote_servers, $getAllJobs = true)
function updateCronJobTokens($old_token, $token){
global $db;
$remote_servers = $db->getRemoteServers();
foreach($remote_servers as $remote_server)
foreach ((array)$remote_servers as $remote_server)
{
$remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key'], $remote_server['timeout']);
$jobs = $remote->scheduler_list_tasks();
foreach($jobs as $job_id => $job)
foreach ((array)$jobs as $job_id => $job)
{
if(strstr($job, $old_token))
{
@ -122,11 +122,11 @@ function deleteJobsByHomeServerID($home_id){
$homeInfo = $db->getGameHome($home_id, true);
if($homeInfo){
$remote_servers = $db->getRemoteServers();
foreach($remote_servers as $remote_server)
foreach ((array)$remote_servers as $remote_server)
{
$remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key'], $remote_server['timeout']);
$jobs = $remote->scheduler_list_tasks();
foreach($jobs as $job_id => $job)
foreach ((array)$jobs as $job_id => $job)
{
if(strstr($job, "homeid=" . $home_id))
{
@ -138,7 +138,7 @@ function deleteJobsByHomeServerID($home_id){
}
}
if(is_array($jobIdsToDel) && count($jobIdsToDel) > 0){
if(is_array($jobIdsToDel) && count((array)$jobIdsToDel) > 0){
// Only make one call
$remote->scheduler_del_task(implode(",", $jobIdsToDel));
}
@ -153,7 +153,7 @@ function get_action_selector($action = false, $server_homes = false, $homeid_ip_
$server_actions[] = 'steam_auto_update';
}
$select_action = '<select name="action" style="width: 100%;">';
foreach($server_actions as $server_action)
foreach ((array)$server_actions as $server_action)
{
$selected = ($action and $action == $server_action) ? 'selected="selected"' : '';
$select_action .= '<option value="'.$server_action.'" '.$selected.'>'.get_lang($server_action).'</option>';
@ -166,7 +166,7 @@ function get_server_selector($server_homes, $homeid_ip_port = FALSE, $onchange =
$select_game = "<select style='text-overflow: ellipsis; width: 100%;' name='homeid_ip_port' $onchange_this_form_submit>\n";
if($server_homes != FALSE)
{
foreach ( $server_homes as $server_home )
foreach ((array)$server_homes as $server_home)
{
$selected = ($homeid_ip_port and ($homeid_ip_port == $server_home['home_id']."_".$server_home['ip']."_".$server_home['port'] || trim($homeid_ip_port) == trim($server_home['home_id']))) ? 'selected="selected"' : '';
$select_game .= "<option value='". $server_home['home_id'] . "_" . $server_home['ip'] .
@ -186,7 +186,7 @@ function get_remote_server_selector($r_servers, $remote_servers_offline, $remote
$onchange_this_form_submit = $onchange ? 'onchange="this.form.submit();"' : '';
$select_rserver = "<select id='r_server_id' style='width: 100%;' name='r_server_id' $onchange_this_form_submit>\n";
if($first_empty) $select_rserver .= '<option></option>';
foreach ( $r_servers as $r_server )
foreach ((array)$r_servers as $r_server)
{
$selected = ($remote_server_id and $remote_server_id == $r_server['remote_server_id']) ? 'selected="selected"' : '';
$offline = isset($remote_servers_offline[$r_server['remote_server_id']]) ? ' (' . offline . ')' : '';
@ -201,7 +201,7 @@ function checkCronInput($min, $hour, $day, $month, $dayOfWeek) {
$args = func_get_args();
foreach ($args as $k => $arg) {
foreach ((array)$args as $k => $arg) {
if (strlen($arg) == 0 || strpbrk($arg, $blacklist) || preg_match('/\\s/', $arg)) {
$returns[$k] = false;
}
@ -231,13 +231,13 @@ function updateCronJobsToNewApi()
$regex = '/'.preg_quote('action=','/').'([a-zA-Z]+)'.preg_quote('&homeid=','/').'([0-9]+)'.preg_quote('&controlpass=','/').'([^"]+)/';
$token = $db->getApiToken($_SESSION['user_id']);
$mod_key = '';
foreach($remote_servers as $remote_server)
foreach ((array)$remote_servers as $remote_server)
{
$remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key'], $remote_server['timeout']);
$jobs = $remote->scheduler_list_tasks();
if(!is_array($jobs))
continue;
foreach($jobs as $job_id => $job)
foreach ((array)$jobs as $job_id => $job)
{
if(preg_match($regex, $job, $matches))
{

View file

@ -42,7 +42,7 @@ function exec_ogp_module()
return 0;
}
foreach( $homes as $home )
foreach ((array)$homes as $home)
{
$server_homes[$home['home_id']."_".$home['ip']."_".$home['port']] = $home;
$remote_servers[$home['remote_server_id']] = array( "agent_ip" => $home['agent_ip'],
@ -224,13 +224,13 @@ You can read more on our <a href='http://wiki.iaregamer.com/doku.php?id=cron' ta
</tr>
<?php
$user_jobs = "";
foreach( $jobsArray as $remote_server_id => $jobs )
foreach ((array)$jobsArray as $remote_server_id => $jobs )
{
foreach($jobs as $jobId => $job)
foreach ((array)$jobs as $jobId => $job)
{
if(isset($job['action']))
{
if(array_key_exists('home_id', $job) && array_key_exists('ip', $job) && array_key_exists('port', $job) && hasValue($job['home_id']) && hasValue($job['ip']) && hasValue($job['port'])){
if(array_key_exists('home_id', (array)$job) && array_key_exists('ip', (array)$job) && array_key_exists('port', (array)$job) && hasValue($job['home_id']) && hasValue($job['ip']) && hasValue($job['port'])){
$uniqueStr = $job['home_id']."_".$job['ip']."_".$job['port'];
}else{
$uniqueStr = false;

View file

@ -73,7 +73,7 @@ function exec_ogp_module()
// Recent News
//$xml=simplexml_load_file("modules/news/data/listings.xml");
//$lastnews = count($xml)-1;
//$lastnews = count((array)$xml)-1;
//$title[2] = "Recent News";
//$content[2] = $xml->listing[$lastnews]->title;
//$href[2] = 'home.php?m=news&p=news';
@ -110,9 +110,9 @@ function exec_ogp_module()
$colhtml[1] = '<div class="column one_fourth" id="column1" >';
$colhtml[2] = '<div class="column one_two" id="column2" >';
$colhtml[3] = '<div class="column one_fourth" id="column3" >';
foreach($widgets as $widget)
foreach ((array)$widgets as $widget)
{
if(array_key_exists($widget["widget_id"], $title)){
if(array_key_exists($widget["widget_id"], (array)$title)){
if( (!isset($settings['old_dashboard_behavior']) or $settings['old_dashboard_behavior'] == 0) AND $widget['widget_id'] == "3" )
continue;
$colhtml[$widget['column_id']] .= '<div class="dragbox bloc rounded" id="item'.$widget['widget_id'].'">'.
@ -139,7 +139,7 @@ function exec_ogp_module()
$colhtml[$widget['column_id']] .= '</div></div>';
}
}
foreach($colhtml as $html )
foreach ((array)$colhtml as $html)
echo $html.'</div>';
}
@ -174,7 +174,7 @@ function exec_ogp_module()
<select name='remote_server_id' onchange=".'"this.form.submit()"'.">\n";
$agents_ips = array();
foreach ( $servers as $server_row )
foreach ((array)$servers as $server_row)
{
$agents_ips[$server_row['remote_server_id']] = gethostbyname($server_row['agent_ip']);
if( !empty( $server_row['remote_server_id'] ) and !isset( $_GET['remote_server_id'] ) OR !empty( $server_row['remote_server_id'] ) and empty( $_GET['remote_server_id'] ) )

View file

@ -28,7 +28,7 @@ function print_player_list_ogp_dashboard($player_list,$players,$playersmax,$game
"<tr><td style='text-align:left;'>".
$gamename." [".$players.'/'.$playersmax."] ".
get_lang('players').":</td>\n</tr>";
foreach( $player_list as $player )
foreach ((array)$player_list as $player)
{
$data .= "<tr><td style='text-align:center;color:#".rand(0,5).rand(0,5).rand(0,5).";' >".$player['name']."</td></tr>";
}

View file

@ -57,7 +57,7 @@ function exec_ogp_module(){
else
return;
foreach( $server_homes as $server_home )
foreach ((array)$server_homes as $server_home)
{
if( $server_home['home_id'] == $home_id and
$server_home['mod_id'] == $mod_id and
@ -101,7 +101,7 @@ function exec_ogp_module(){
if(isset($types))
{
include( DSI_BASEPATH.'includes/SimpleImage.php' );
foreach($types as $type)
foreach ((array)$types as $type)
{
if( file_exists(DSI_BASEPATH . "cache/$server_home[ip]_$server_home[port]-$type") )
unlink(DSI_BASEPATH . "cache/$server_home[ip]_$server_home[port]-$type");

View file

@ -50,7 +50,7 @@ function exec_ogp_module(){
$show_all = FALSE;
}
$qty = count($server_homes);
$qty = count((array)$server_homes);
$cols = 1;
@ -74,7 +74,7 @@ function exec_ogp_module(){
"<br>\n" : "";
$servers = 0;
$servers_running = 0;
foreach ( $server_homes as $server_home )
foreach ((array)$server_homes as $server_home)
{
$servers++;

View file

@ -67,7 +67,7 @@ function exec_ogp_module(){
echo "<br /><br />";
foreach( $server_homes as $server_home )
foreach ((array)$server_homes as $server_home)
{
if( $server_home['home_id'] == $home_id and
$server_home['mod_id'] == $mod_id and

View file

@ -39,7 +39,7 @@ function dsi_render_table($ip, $port, $url = false, $use_table = TRUE, $use_rows
$output = "";
if($use_table) $output .= "\n<table class='center' >\n";
$image_td_align = $img_only ? "center" : "left";
foreach($types as $type)
foreach ((array)$types as $type)
{
if($use_rows) $output .= "\t<tr>\n";
if(!$img_only) $output .= "\t\t<td align='right' width=30px >\n".

View file

@ -82,11 +82,11 @@ if (!function_exists('array_column')) {
$resultArray = array();
foreach ($paramsInput as $row) {
foreach ((array)$paramsInput as $row) {
$key = $value = null;
$keySet = $valueSet = false;
if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, (array)$row)) {
$keySet = true;
$key = (string) $row[$paramsIndexKey];
}
@ -94,7 +94,7 @@ if (!function_exists('array_column')) {
if ($paramsColumnKey === null) {
$valueSet = true;
$value = $row;
} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
} elseif (is_array($row) && array_key_exists($paramsColumnKey, (array)$row)) {
$valueSet = true;
$value = $row[$paramsColumnKey];
}

View file

@ -69,7 +69,7 @@ function exec_ogp_module()
<th>'.get_lang('actions').'</th>
</tr>';
foreach ($files as $file) {
foreach ((array)$files as $file) {
echo '<tr>
<td>'. $file['name'] .'</td>
<td>'. ($file['description'] ?: '<i>'.get_lang('no_description').'</i>') .'</td>

View file

@ -76,7 +76,7 @@ function installUpdate($info, $base_dir, $current_blacklist = array())
$result = extractZip( $temp_dwl, $temp_dir . DIRECTORY_SEPARATOR, $info['remove_path'] );
if ( is_array($result['extracted_files']) and count($result['extracted_files']) > 0 )
if ( is_array($result['extracted_files']) and count((array)$result['extracted_files']) > 0 )
{
$nfo_file = DATA_PATH . str_replace(' ','_',$info['title']) . ".nfo";
$install_nfo = $info['timestamp']."\n$nfo_file\n";
@ -85,7 +85,7 @@ function installUpdate($info, $base_dir, $current_blacklist = array())
// Also determines if the file is writable
$filelist = array();
$i = 0;
foreach( $result['extracted_files'] as $file )
foreach ((array)$result['extracted_files'] as $file)
{
if( DIRECTORY_SEPARATOR == '\\')
$filename = str_replace('/', '\\', $file['filename']);
@ -236,7 +236,7 @@ function exec_ogp_module()
if($blacklisted_files !== FALSE)
{
$current_blacklist = array();
foreach($blacklisted_files as $blacklisted_file)
foreach ((array)$blacklisted_files as $blacklisted_file)
{
$current_blacklist[] = $blacklisted_file['file_path'];
}
@ -289,7 +289,7 @@ function exec_ogp_module()
$installed = rglob('*/*/install.nfo');
foreach($installed as $nfo)
foreach ((array)$installed as $nfo)
{
$nfo_new = preg_replace('#^([m|t]{1})(odule|heme){1}s/([^?/]+)/install.nfo#','\3',$nfo);
#echo $nfo_new.'<br>';
@ -358,7 +358,7 @@ function exec_ogp_module()
// Delete lang files too
$langDirs = array_filter(glob('lang/*'), 'is_dir');
foreach($langDirs as $langDir){
foreach ((array)$langDirs as $langDir){
if($langDir != ".." && $langDir != "."){
$langDirPath = $langDir . "/modules/" . strtolower($folderToDelete) . ".php";
if(file_exists($langDirPath)){
@ -391,7 +391,7 @@ function exec_ogp_module()
$m = 0;
$t = 0;
foreach($repos_info_array as $key => $repository)
foreach ((array)$repos_info_array as $key => $repository)
{
if(preg_match('/^(OGP-Website|OGP-Agent-Linux|OGP-Agent-Windows)$/',$repository['name']))
continue;
@ -481,13 +481,13 @@ function exec_ogp_module()
echo get_lang_f('temp_folder_not_writable', $tmpdir);
return;
}
foreach($_POST as $key => $value)
foreach ((array)$_POST as $key => $value)
{
if($key == 'update')continue;
if($key == 'module')
{
foreach($value as $m)
foreach ((array)$value as $m)
{
if(installUpdate($modules[$m], $baseDir, $current_blacklist))
{
@ -503,14 +503,14 @@ function exec_ogp_module()
}
if($key == 'theme')
{
foreach($value as $t)
foreach ((array)$value as $t)
installUpdate($themes[$t], $baseDir, $current_blacklist);
}
}
if(isset($_POST['module']))
{
foreach ( $installed_modules as $installed_module )
foreach ((array)$installed_modules as $installed_module)
{
if(in_array($installed_module['folder'],$uMF))
{
@ -533,18 +533,18 @@ function exec_ogp_module()
"<div class=\"dragbox-content\" >";
if (!empty($moduleErrors['modules'])) {
foreach($moduleErrors['modules'] as $module) {
foreach ((array)$moduleErrors['modules'] as $module) {
echo '<input type="checkbox" disabled><b>',$module,'</b> - <b style="color:red;">Unable to retrieve XML data.</b><br>';
}
}
foreach ( $installed_modules as $installed_module )
foreach ((array)$installed_modules as $installed_module)
{
$folder = $installed_module['folder'];
$installed_modules_by_folder[$folder] = $installed_module['id'];
}
foreach($modules as $key => $module)
foreach ((array)$modules as $key => $module)
{
$local_repo_file = DATA_PATH . $module['reponame'] . '.atom';
$install_nfo = DATA_PATH . str_replace(' ','_',$module['title']) . ".nfo";
@ -552,7 +552,7 @@ function exec_ogp_module()
$is_old = $on_disk && (strtotime('+1 hour', filemtime($local_repo_file)) <= time());
//echo $install_nfo;
$folder = str_replace(' ','_',strtolower($module['title']));
$installed = array_key_exists($folder,$installed_modules_by_folder);
$installed = array_key_exists($folder, (array)$installed_modules_by_folder);
$installed_str = $on_disk ? $installed ? "<a class='uninstall' style='color:blue;' data-module-folder='$folder' data-module-id='".
$installed_modules_by_folder[$folder]."' href='#uninstall_$folder' >".get_lang("uninstall")."</a>" :
@ -585,12 +585,12 @@ function exec_ogp_module()
"<div class=\"dragbox-content\" >";
if (!empty($moduleErrors['themes'])) {
foreach($moduleErrors['themes'] as $theme) {
foreach ((array)$moduleErrors['themes'] as $theme) {
echo '<input type="checkbox" disabled><b>',$theme,'</b> - <b style="color:red;">Unable to retrieve XML data.</b><br>';
}
}
foreach($themes as $key => $theme)
foreach ((array)$themes as $key => $theme)
{
$local_repo_file = DATA_PATH . $theme['reponame'] . '.atom';
$install_nfo = DATA_PATH . str_replace(' ','_',$theme['title']) . ".nfo";

View file

@ -121,7 +121,7 @@ function exec_ogp_module()
$entries = array();
foreach($items as $index => $item)
foreach ((array)$items as $index => $item)
{
$category = $item['category'][0];
$entries[$category][$index]['title'] = $item['title'][0];
@ -129,11 +129,11 @@ function exec_ogp_module()
}
$categories = "";
$accordion_entries = "<div id=\"accordion\">\n";
foreach($entries as $category_name => $category_entries)
foreach ((array)$entries as $category_name => $category_entries)
{
$categories .= "<li class='faqblock'><a class='faqcategory' href=\"#$category_name\">$category_name</a></li>";
$accordion_entries .= "<div class=\"category\" id=\"$category_name\"><img class='headerimage' src='modules/faq/faqlower.png'>$category_name</div>";
foreach($category_entries as $index => $item)
foreach ((array)$category_entries as $index => $item)
{
$accordion_entries .= "\t<div class=\"accordion-toggle\">".
"$item[title]</div>\n".

View file

@ -84,7 +84,7 @@ class rss_php {
if(!$valueBlock) {
$valueBlock = $this->document;
}
foreach($valueBlock as $valueName => $values) {
foreach ((array)$valueBlock as $valueName => $values) {
if(isset($values['value'])) {
$values = $values['value'];
}
@ -99,7 +99,7 @@ class rss_php {
private function extractDOM($nodeList,$parentNodeName=false) {
$itemCounter = 0;
foreach($nodeList as $values) {
foreach ((array)$nodeList as $values) {
if(substr($values->nodeName,0,1) != '#') {
if($values->nodeName == 'item') {
$nodeName = $values->nodeName.':'.$itemCounter;

View file

@ -40,7 +40,7 @@ function exec_ogp_module()
$game_cfgs = $db->getGameCfgs();
$select_game = "<select onchange=".'"this.form.submit()"'." name='home_cfg_id' autofocus='autofocus'>\n".
"<option value='0'>" . get_lang("games_without_specified_rules") . "</option>\n";
foreach ( $game_cfgs as $game_cfg )
foreach ((array)$game_cfgs as $game_cfg)
{
$selected = ( isset( $_GET['home_cfg_id'] ) and
$_GET['home_cfg_id'] == $game_cfg['home_cfg_id'] ) ?
@ -108,7 +108,7 @@ function exec_ogp_module()
echo "<h3>".get_lang("current_access_rules")."</h3>\n";
echo "<table id='servermonitor' class='tablesorter' style='width: 100%;'>\n<thead><tr>".
"<th class='header'>".get_lang("game_name")."</th><th class='header'>".get_lang("match_file_extension")."</th><th class='header'>".get_lang("match_client_ip")."</th></tr></thead>\n<tbody>";
foreach($all_rules as $rule)
foreach ((array)$all_rules as $rule)
{
if($rule['home_cfg_id'] != '0')
{
@ -211,7 +211,7 @@ function exec_ogp_module()
get_lang("select_remote_server").": ".
"<select onchange=".'"this.form.submit()"'." name='remote_server_id'>\n".
"<option></option>\n";
foreach ( $remote_servers as $server )
foreach ((array)$remote_servers as $server)
{
$selected = ( isset( $_GET['remote_server_id'] ) and
$server['remote_server_id'] == $_GET['remote_server_id'] ) ?
@ -275,7 +275,7 @@ function exec_ogp_module()
if( isset( $_POST['delete'] ) )
{
$response_del = $remote->fastdl_del_alias($_POST['aliases']);
foreach($_POST['aliases'] as $alias)
foreach ((array)$_POST['aliases'] as $alias)
{
if( $response_del != -1 and
$remote->rfile_exists($aliases[$alias]['home']) === 1
@ -291,7 +291,7 @@ function exec_ogp_module()
$address = ($fastdl_info['port'] == '80' OR ($fastdl_settings and $fastdl_settings['port_forwarded_to_80'] == '1')) ?
$fastdl_info['ip'] :
$fastdl_info['ip'].":".$fastdl_info['port'];
foreach( $aliases as $alias => $info )
foreach ((array)$aliases as $alias => $info )
{
echo "<input type=checkbox name='aliases[]' value='$alias'/>$alias".
"( <a href='http://$address/$alias' target='_blank' ".
@ -367,7 +367,7 @@ function exec_ogp_module()
$check = check_access_rules_entries();
if(!$check['ip_entry_fail'] and !$check['extension_entry_fail'])
{
if(!array_key_exists($alias , $aliases))
if(!array_key_exists($alias, (array)$aliases))
{
$home = clean_path($server_home['home_path']."/".clean_string($_POST['path']));
$alias = clean_string($_POST['alias']);

View file

@ -16,7 +16,7 @@ function in_array_match($needle, $haystack) {
if (!is_array($haystack))
trigger_error('Argument 2 must be array');
$needle = "#".preg_quote($needle)."#";
foreach ($haystack as $value) {
foreach ((array)$haystack as $value) {
$match = preg_match($needle, $value);
if ($match === 1) {
return true;
@ -30,7 +30,7 @@ function get_alias_by_home_path($home_path, $aliases) {
trigger_error('Argument 2 must be array');
$home_path = "#".preg_quote($home_path)."#";
$alias_info = false;
foreach ($aliases as $alias => $info) {
foreach ((array)$aliases as $alias => $info) {
if( preg_match($home_path, $info['home']) )
{
$alias_info = $aliases[$alias];
@ -114,7 +114,7 @@ function check_access_rules_entries()
{
$entries = explode(",",$_POST['match_file_extension']);
$entries = array_unique(array_filter($entries));
foreach($entries as $key => $entry)
foreach ((array)$entries as $key => $entry)
{
$entry = trim($entry);
if(!preg_match("/^[a-z0-9]+$/i",$entry))
@ -134,7 +134,7 @@ function check_access_rules_entries()
{
$entries = explode(",",$_POST['match_client_ip']);
$entries = array_unique(array_filter($entries));
foreach($entries as $key => $entry)
foreach ((array)$entries as $key => $entry)
{
$entry = trim($entry);
if( !preg_match('#(^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$|'.
@ -169,7 +169,7 @@ function get_fastdl_settings($remote_server_id)
WHERE `remote_server_id`='".$db->realEscapeSingle($remote_server_id)."'");
if(!$result) return FALSE;
$results = array();
foreach($result as $row)
foreach ((array)$result as $row)
{
$results[$row['setting']] = $row['value'];
}
@ -182,7 +182,7 @@ function set_fastdl_settings($remote_server_id, $settings)
global $db;
if( !is_numeric($remote_server_id) ) return FALSE;
if( !is_array($settings) ) return FALSE;
foreach ( $settings as $s_key => $s_value )
foreach ((array)$settings as $s_key => $s_value )
{
$query = 'INSERT INTO `'.OGP_DB_PREFIX.'fastdl_settings` (`remote_server_id`,`setting`,`value`)
VALUES(\''.$db->realEscapeSingle($remote_server_id).'\', \''.$db->realEscapeSingle($s_key).'\', \''.$db->realEscapeSingle($s_value).'\') ON DUPLICATE KEY

View file

@ -55,7 +55,7 @@ function exec_ogp_module()
$ip_ports = $db->getHomeIpPorts($server_home['home_id']);
$is_address_assigned = false;
foreach($ip_ports as $ip_port)
foreach ((array)$ip_ports as $ip_port)
{
if($ip_port['ip'] == $ip and $ip_port['port'] == $port)
{
@ -98,7 +98,7 @@ function exec_ogp_module()
$aliases = $aliases === -1 ? array() : $aliases;
if( isset( $_POST['create'] ) )
{
if(!array_key_exists($alias , $aliases))
if(!array_key_exists($alias, (array)$aliases))
{
$home = clean_path($server_home['home_path']."/".clean_string($_POST['path']));
$alias = clean_string($_POST['alias']);

View file

@ -54,7 +54,7 @@ function exec_ogp_module()
$ftp_accounts_list = $remote->ftp_mgr("list");
$ftp_accounts = explode("\n",$ftp_accounts_list);
$user_exists = FALSE;
foreach($ftp_accounts as $ftp_account)
foreach ((array)$ftp_accounts as $ftp_account)
{
if( $ftp_account != "" )
{
@ -97,7 +97,7 @@ function exec_ogp_module()
$remote = new OGPRemoteLibrary($server_row['agent_ip'],$server_row['agent_port'],$server_row['encryption_key'],$server_row['timeout']);
$ftp_login = strip_real_escape_string($_POST['ftp_login']);
$settings = "";
foreach($_POST as $key => $value)
foreach ((array)$_POST as $key => $value)
{
if ($key != "edit_ftp_user" and $key != "ftp_login" and $key != "remote_server_id")
{
@ -118,7 +118,7 @@ function exec_ogp_module()
<table class='center' style='width:100%' ><tr>
<td>". get_lang("remote_server") ." <select style='width:250px' name='remote_server_id' >";
foreach ( $servers as $server_row )
foreach ((array)$servers as $server_row)
{
$display_ip = checkDisplayPublicIP($server_row['display_public_ip'],$server_row['agent_ip']);
echo "<option value='" . $server_row['remote_server_id'] . "' >" . $server_row['remote_server_name'] . " (" . $display_ip . ":" . $server_row['agent_port'] . ")</option>";
@ -144,7 +144,7 @@ function exec_ogp_module()
</thead>
<tbody>
<?php
foreach ( $servers as $server_row )
foreach ((array)$servers as $server_row)
{
$display_ip = checkDisplayPublicIP($server_row['display_public_ip'],$server_row['agent_ip']);
$remote = new OGPRemoteLibrary($server_row['agent_ip'],$server_row['agent_port'],$server_row['encryption_key'],$server_row['timeout']);
@ -157,7 +157,7 @@ function exec_ogp_module()
{
$ftp_accounts_list = $remote->ftp_mgr("list");
$ftp_accounts = explode("\n", $ftp_accounts_list);
foreach($ftp_accounts as $ftp_account)
foreach ((array)$ftp_accounts as $ftp_account)
{
if( !empty($ftp_account))
{
@ -175,7 +175,7 @@ function exec_ogp_module()
$ftp_account_detail_list = explode("\n",$account_details);
foreach($ftp_account_detail_list as $detail_line)
foreach ((array)$ftp_account_detail_list as $detail_line)
{
if( !empty($detail_line))
{
@ -193,7 +193,7 @@ function exec_ogp_module()
$value_parts = explode(" ", $value);
if(is_numeric($value_parts[0]))
{
if(count($value_parts) > 1)
if(count((array)$value_parts) > 1)
{
$value = array_shift($value_parts);
$advert = implode(" ", $value_parts);
@ -210,7 +210,7 @@ function exec_ogp_module()
}
}
}
if ($key == "Allowed local IPs" or $key == "ul_ratio" or $key == "ForceSsl" or ( count($ftp_account_detail_list) == 4 and $key == "Directory" ) )
if ($key == "Allowed local IPs" or $key == "ul_ratio" or $key == "ForceSsl" or ( count((array)$ftp_account_detail_list) == 4 and $key == "Directory" ) )
echo "</table>\n</td><td>\n<table>\n";
if ($key == "Directory" )
$value = str_replace( "/./", "", $value );

View file

@ -3006,7 +3006,7 @@ function htmlEncode2($string) {
// --------------
// This function HTML-encodes a string with *htmlspecialchars* to print it on a page.
// Only some special characters are encoded, otherwise special characters (e.g. é) appear encoded (&eacute).
// Only some special characters are encoded, otherwise special characters (e.g. ) appear encoded (&eacute).
// --------------
$isocode = __("iso-8859-1");
@ -3377,7 +3377,7 @@ $AttmFiles ... array containing the filenames to attach like array("file1","file
// Attachments
if($AttmFiles){
foreach($AttmFiles as $AttmFile){
foreach ((array)$AttmFiles as $AttmFile){
// $patharray = explode ("/", $AttmFile);
// $FileName=$patharray[sizeof($patharray)-1];
$FileName = "RequestedFile.zip";

View file

@ -13,7 +13,7 @@
// gzip tools and WinZip application.
//
// Description :
// See readme.txt (English & Français) and http://www.phpconcept.net
// See readme.txt (English & Franais) and http://www.phpconcept.net
//
// Warning :
// This library and the associated files are non commercial, non professional
@ -405,7 +405,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
// $p_filelist, in the directory
// $p_path. The relative path of the archived files are keep and become
// relative to $p_path.
// If a directory is spécified in the list, all the files from this directory
// If a directory is spcified in the list, all the files from this directory
// will be extracted.
// If a file with the same name already exists it will be replaced.
// If the path to the file does not exist, it will be created.
@ -1349,7 +1349,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
}
// ----- Loop on the files
for ($j=0; ($j<count($p_list)) && ($v_result==1); $j++)
for ($j=0; ($j<count((array)$p_list)) && ($v_result==1); $j++)
{
// ----- Recuperate the filename
$p_filename = $p_list[$j];
@ -2031,7 +2031,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
// ----- Look if the extracted file is older
else if (filemtime($v_header[filename]) > $v_header[mtime])
{
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is newer (".date("l dS of F Y h:i:s A", filemtime($v_header[filename])).") than the extracted file (".date("l dS of F Y h:i:s A", $v_header[mtime]).")");
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is newer (".date("l dS of F Y h:i:s A", filemtime($v_header[filename])).") than the extracted file (".date("l dS of F Y h:i:s A", is_numeric($v_header[mtime]) ? (int)$v_header[mtime] : strtotime($v_header[mtime])).")");
// ----- Change the file status
$v_header[status] = "newer_exist";
@ -2164,7 +2164,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
else
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512));
TrFctMessage(__FILE__, __LINE__, 4, "Position après jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
TrFctMessage(__FILE__, __LINE__, 4, "Position aprs jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
}
if ($p_tar_mode == "tar")
@ -2395,7 +2395,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
else
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512));
TrFctMessage(__FILE__, __LINE__, 4, "Position après jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
TrFctMessage(__FILE__, __LINE__, 4, "Position aprs jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
}
if ($p_tar_mode == "tar")
@ -2514,7 +2514,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
// ----- Look if the extracted file is older
else if (filemtime($v_header[filename]) > $v_header[mtime])
{
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is newer (".date("l dS of F Y h:i:s A", filemtime($v_header[filename])).") than the extracted file (".date("l dS of F Y h:i:s A", $v_header[mtime]).")");
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is newer (".date("l dS of F Y h:i:s A", filemtime($v_header[filename])).") than the extracted file (".date("l dS of F Y h:i:s A", is_numeric($v_header[mtime]) ? (int)$v_header[mtime] : strtotime($v_header[mtime])).")");
// ----- Change the file status
$v_header[status] = "newer_exist";
@ -2836,7 +2836,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
else
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512));
TrFctMessage(__FILE__, __LINE__, 4, "Position après jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
TrFctMessage(__FILE__, __LINE__, 4, "Position aprs jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
}
// ----- Look for end of file
@ -3058,7 +3058,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
{
TrFctMessage(__FILE__, __LINE__, 3, "File '$v_stored_list[$i]' is present in archive");
TrFctMessage(__FILE__, __LINE__, 3, "File '$v_stored_list[$i]' mtime=".filemtime($p_file_list[$i])." ".date("l dS of F Y h:i:s A", filemtime($p_file_list[$i])));
TrFctMessage(__FILE__, __LINE__, 3, "Archived mtime=".$v_header[mtime]." ".date("l dS of F Y h:i:s A", $v_header[mtime]));
TrFctMessage(__FILE__, __LINE__, 3, "Archived mtime=".$v_header[mtime]." ".date("l dS of F Y h:i:s A", is_numeric($v_header[mtime]) ? (int)$v_header[mtime] : strtotime($v_header[mtime])));
// ----- Store found informations
$v_found_file = TRUE;
@ -3372,7 +3372,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
$v_header[size] = OctDec(trim($v_data[size]));
TrFctMessage(__FILE__, __LINE__, 2, "Size : '$v_header[size]'");
$v_header[mtime] = OctDec(trim($v_data[mtime]));
TrFctMessage(__FILE__, __LINE__, 2, "Date : ".date("l dS of F Y h:i:s A", $v_header[mtime]));
TrFctMessage(__FILE__, __LINE__, 2, "Date : ".date("l dS of F Y h:i:s A", is_numeric($v_header[mtime]) ? (int)$v_header[mtime] : strtotime($v_header[mtime])));
if (($v_header[typeflag] = $v_data[typeflag]) == "5")
{
$v_header[size] = 0;

View file

@ -371,7 +371,7 @@
// ----- Reformat the string list
if (sizeof($v_string_list) != 0) {
foreach ($v_string_list as $v_string) {
foreach ((array)$v_string_list as $v_string) {
if ($v_string != '') {
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
}
@ -389,7 +389,7 @@
,PCLZIP_ATT_FILE_CONTENT => 'optional'
,PCLZIP_ATT_FILE_COMMENT => 'optional'
);
foreach ($v_att_list as $v_entry) {
foreach ((array)$v_att_list as $v_entry) {
$v_result = $this->privFileDescrParseAtt($v_entry,
$v_filedescr_list[],
$v_options,
@ -558,7 +558,7 @@
// ----- Reformat the string list
if (sizeof($v_string_list) != 0) {
foreach ($v_string_list as $v_string) {
foreach ((array)$v_string_list as $v_string) {
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
}
}
@ -572,7 +572,7 @@
,PCLZIP_ATT_FILE_CONTENT => 'optional'
,PCLZIP_ATT_FILE_COMMENT => 'optional'
);
foreach ($v_att_list as $v_entry) {
foreach ((array)$v_att_list as $v_entry) {
$v_result = $this->privFileDescrParseAtt($v_entry,
$v_filedescr_list[],
$v_options,
@ -1872,7 +1872,7 @@
$v_result=1;
// ----- For each file in the list check the attributes
foreach ($p_file_list as $v_key => $v_value) {
foreach ((array)$p_file_list as $v_key => $v_value) {
// ----- Check if the option is supported
if (!isset($v_requested_options[$v_key])) {

View file

@ -156,7 +156,7 @@ function includeLanguageFile() {
$languageArray = getLanguageArray();
// If language exists, include the language file
if (array_key_exists($net2ftp_globals["language"], $languageArray) == true) {
if (array_key_exists($net2ftp_globals["language"], (array)$languageArray) == true) {
$languageFile = glueDirectories($net2ftp_globals["application_languagesdir"], $languageArray[$net2ftp_globals["language"]]["file"]);
require_once($languageFile);
}
@ -217,7 +217,7 @@ function __() {
// -------------------------------------------------------------------------
// Check if the message with that $messagename exists
if (@array_key_exists($messagename, $net2ftp_messages)) { $string_with_percents = $net2ftp_messages[$messagename]; }
if (@array_key_exists($messagename, (array)$net2ftp_messages)) { $string_with_percents = $net2ftp_messages[$messagename]; }
else { return "MESSAGE NOT FOUND $messagename"; }
$sprintf_argument = "\$translated_string = sprintf(\$string_with_percents";

Some files were not shown because too many files have changed in this diff Show more