$upvals[$ds['name']] = $val;
}
}
- $key_names = (!is_numeric(array_shift(array_keys($upvals))));
+ $upval_keys = array_keys($upvals);
+ $keys_have_names = !is_numeric(array_shift($upval_keys));
if (in_array('L', $upvals, true)) {
// for at least one value, we need to set the same as the last recorded value
$fvals = $this->fetch();
$rowids = array_shift($fvals);
$lastvals = array_shift($fvals);
foreach (array_keys($upvals, 'L') as $akey) {
- $upvals[$akey] = $key_names?$lastvals[$akey]:$lastvals[$rowids[$akey]];
+ $upvals[$akey] = $keys_have_names?$lastvals[$akey]:$lastvals[$rowids[$akey]];
}
}
$walkfunc = create_function('&$val,$key', '$val = is_numeric(trim($val))?trim($val):"U";');
$return = null;
if (count($upvals)) {
$update_cmd = $this->rrdtool_bin.' update '.$this->rrd_file
- .($key_names?' --template '.implode(':', array_keys($upvals)):'').' N:'.implode(':', $upvals);
+ .($keys_have_names?' --template '.implode(':', array_keys($upvals)):'').' N:'.implode(':', $upvals);
$return = `$update_cmd 2>&1`;
}
if (isset($pconf['stats_url_add'])) { $sURL_add = $pconf['stats_url_add']; }
else { $sURL_add = '&sub=%s'; }
- $num_rows = is_numeric($pconf['num_rows'])?$pconf['num_rows']:2;
- $num_cols = ceil(count($stats)/$num_rows);
+ $default_num_cols = $GLOBALS['ua']->isMobile()?1:2;
+ $num_cols = is_numeric($pconf['num_rows'])?$pconf['num_rows']:$default_num_cols;
+ $num_rows = ceil(count($stats)/$num_cols);
$out .= '<table class="overview">'."\n";
- for ($col = 0; $col < $num_cols; $col++) {
+ for ($row = 0; $row < $num_rows; $row++) {
$out .= '<tr>'."\n";
- for ($row = 0; $row < $num_rows; $row++) {
- $idx = $col * $num_rows + $row;
+ for ($col = 0; $col < $num_cols; $col++) {
+ $idx = $row * $num_cols + $col;
$out .= '<td>'."\n";
if ($idx < count($stats)) {
@list($sname, $s_psub) = explode('|', $stats[$idx]['name'], 2);