From 886e13e1af47ba6488ba3c5146d96e48e08403ad Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 19 Jan 2017 16:03:06 +0100 Subject: [statistics_reporting] Overhaul remote reporting structure; default to off --- .../statistics_reporting/page.inc.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'modules-available/statistics_reporting/page.inc.php') diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php index 27d478dc..0309be68 100644 --- a/modules-available/statistics_reporting/page.inc.php +++ b/modules-available/statistics_reporting/page.inc.php @@ -46,15 +46,21 @@ class Page_Statistics_Reporting extends Page protected function doAjax() { - if (!User::isLoggedIn()) { - echo "No."; - } else { - $this->action = Request::any('action', false, 'string'); - if ($this->action === 'setReporting') { - Property::set("reportingStatus", Request::get('reporting', "on", 'string')); - } elseif ($this->action === 'getReporting') { - echo Property::get("reportingStatus", "on"); + $this->action = Request::any('action', false, 'string'); + if ($this->action === 'setReporting') { + if (!User::isLoggedIn()) { + die("No."); + } + $state = Request::post('reporting', false, 'string'); + if ($state === false) { + die('Missing setting value.'); } + RemoteReport::setReportingEnabled($state); + } elseif ($this->action === 'getReporting') { + echo RemoteReport::isReportingEnabled() ? 'on' : ''; + } else { + echo 'Invalid action.'; } } + } -- cgit v1.2.3-55-g7522