From ac51fa8e5f78b9532d4bf5040442b749aa3173af Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Thu, 9 Jul 2015 00:35:44 +0200 Subject: [PATCH] on mobile devices, default to a single row --- include/classes/rrdstat.php-class | 3 ++- testbed/rrd/rrd-stat.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/classes/rrdstat.php-class b/include/classes/rrdstat.php-class index f0cf864..00ac8fb 100644 --- a/include/classes/rrdstat.php-class +++ b/include/classes/rrdstat.php-class @@ -966,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"; diff --git a/testbed/rrd/rrd-stat.php b/testbed/rrd/rrd-stat.php index 8dfbb6c..ed93974 100644 --- a/testbed/rrd/rrd-stat.php +++ b/testbed/rrd/rrd-stat.php @@ -10,6 +10,10 @@ if (getcwd() != dirname($myfile)) { include_once('rrdstat.php-class'); +// $GLOBALS['ua'] is required by some page generation routines +include_once('useragent.php-class'); +$ua = new userAgent(); + $rrd_config_file = 'rrd-config/'.php_uname('n').'.inc.php'; if (!file_exists($rrd_config_file)) { $rrd_config_file = 'rrd-config.inc.php'; } include_once($rrd_config_file); -- 2.43.0