X-Git-Url: https://git-public.kairo.at/?p=php-utility-classes.git;a=blobdiff_plain;f=include%2Fclasses%2Frrdstat.php-class;h=00ac8fb52e553780d66aa6fbd9c4f981d0c71c70;hp=3f5e98f920ca49e0dde13dc64a164752774fccff;hb=ac51fa8e5f78b9532d4bf5040442b749aa3173af;hpb=f88289d7985a04283afff5cdaa81b0cd5449091e diff --git a/include/classes/rrdstat.php-class b/include/classes/rrdstat.php-class index 3f5e98f..00ac8fb 100644 --- a/include/classes/rrdstat.php-class +++ b/include/classes/rrdstat.php-class @@ -396,14 +396,15 @@ class rrdstat { $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";'); @@ -411,7 +412,7 @@ class rrdstat { $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`; } @@ -965,7 +966,8 @@ class rrdstat { 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; + $default_num_rows = $GLOBALS['ua']->isMobile()?1:2; + $num_rows = is_numeric($pconf['num_rows'])?$pconf['num_rows']:$default_num_rows; $num_cols = ceil(count($stats)/$num_rows); $out .= ''."\n";