1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-12-22 13:45:02 +00:00

Make stats-update admin-only - site secret support still needs to be added.

This commit is contained in:
Starbeamrainbowlabs 2017-07-13 22:12:12 +01:00
parent 9021afe851
commit dc2aaf2854
3 changed files with 9 additions and 3 deletions

View file

@ -4039,7 +4039,10 @@ register_module([
* ██ ██ ██ ██ ███ ███
*/
add_action("stats-update", function() {
global $env, $paths;
global $env, $paths, $settings;
if(!$env->is_admin)
exit(page_renderer::render_main("Error - Recalculating Statistics - $settings->sitename", "<p>You need to be logged in as a moderator or better to get $settings->sitename to recalculate it's statistics. If you're logged in, try <a href='?action=logout'>logging out</a> and logging in again as a moderator. If you aren't logged in, try <a href='?action=login&returnto=%3Faction%3Dstats-update'>logging in</a>.</p>"));
update_statistics(true);
header("content-type: application/json");

View file

@ -113,7 +113,7 @@
"author": "Starbeamrainbowlabs",
"description": "An extensible statistics calculation system. Comes with a range of built-in statistics, but can be extended by other modules too.",
"id": "feature-stats",
"lastupdate": 1499974908,
"lastupdate": 1499980292,
"optional": false
},
{

View file

@ -24,7 +24,10 @@ register_module([
* ██ ██ ██ ██ ███ ███
*/
add_action("stats-update", function() {
global $env, $paths;
global $env, $paths, $settings;
if(!$env->is_admin)
exit(page_renderer::render_main("Error - Recalculating Statistics - $settings->sitename", "<p>You need to be logged in as a moderator or better to get $settings->sitename to recalculate it's statistics. If you're logged in, try <a href='?action=logout'>logging out</a> and logging in again as a moderator. If you aren't logged in, try <a href='?action=login&returnto=%3Faction%3Dstats-update'>logging in</a>.</p>"));
update_statistics(true);
header("content-type: application/json");