Prevent statistics from being loaded outside of admin

closes flarum/core#1311
This commit is contained in:
Toby Zerner 2017-12-19 08:52:13 +10:30
parent d56b792a9d
commit d827fd36fe

View File

@ -49,10 +49,12 @@ class AddStatisticsData
*/
public function addStatisticsData(ConfigureWebApp $event)
{
$event->view->setVariable('statistics', array_merge(
$this->getStatistics(),
['utcOffset' => $this->getUTCOffset()]
));
if ($event->isAdmin()) {
$event->view->setVariable('statistics', array_merge(
$this->getStatistics(),
['timezoneOffset' => $this->getUserTimezone()->getOffset(new DateTime)]
));
}
}
private function getStatistics()