diff options
author | Simon Rettberg | 2017-01-19 16:03:06 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-01-19 16:03:06 +0100 |
commit | 886e13e1af47ba6488ba3c5146d96e48e08403ad (patch) | |
tree | dd0da56ccf6f2e5ae9e4e6b1e5709b911d255164 /modules-available/statistics_reporting/page.inc.php | |
parent | [statistics_reporting] i18n: Move tags used in code to separate file, delete ... (diff) | |
download | slx-admin-886e13e1af47ba6488ba3c5146d96e48e08403ad.tar.gz slx-admin-886e13e1af47ba6488ba3c5146d96e48e08403ad.tar.xz slx-admin-886e13e1af47ba6488ba3c5146d96e48e08403ad.zip |
[statistics_reporting] Overhaul remote reporting structure; default to off
Diffstat (limited to 'modules-available/statistics_reporting/page.inc.php')
-rw-r--r-- | modules-available/statistics_reporting/page.inc.php | 22 |
1 files changed, 14 insertions, 8 deletions
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.'; } } + } |