diff options
Diffstat (limited to 'cgi')
-rw-r--r-- | cgi/modapi.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cgi/modapi.py b/cgi/modapi.py index b05410d..c1f6319 100644 --- a/cgi/modapi.py +++ b/cgi/modapi.py @@ -88,6 +88,20 @@ def api_process(self, path_split): values['posts'] = posts elif method == 'login': values['token'] = token + elif method == 'members': + members = FetchAll( + "SELECT * FROM `staff` ORDER BY lastactive DESC") + values['members'] = members + elif method == 'stats': + report_count = FetchOne("SELECT COUNT(id) FROM `reports`") + values['reportCount'] = report_count + try: + with open('stats.json', 'r') as f: + out = json.load(f) + values['stats'] = out + except ValueError: + values['stats'] = None + raise APIError, "Stats error" else: raise APIError, "Invalid method" |