73 lines
2.7 KiB
PHP
73 lines
2.7 KiB
PHP
|
<?php
|
||
|
require_once '_flashii.php';
|
||
|
|
||
|
ini_set('display_errors', 'on');
|
||
|
error_reporting(-1);
|
||
|
|
||
|
header('Content-Type: text/plain; charset=utf-8');
|
||
|
|
||
|
printf('dataSetVersion = "%s";%s', date('Y-m-d'), PHP_EOL);
|
||
|
printf('dataSet[dataSetVersion] = {};%s', PHP_EOL);
|
||
|
|
||
|
echo PHP_EOL;
|
||
|
|
||
|
printf('dataSet[dataSetVersion].options = [%s', PHP_EOL);
|
||
|
printf(' {%s', PHP_EOL);
|
||
|
printf(' name: "Filter by Role",%s', PHP_EOL);
|
||
|
printf(' key: "role",%s', PHP_EOL);
|
||
|
printf(' tooltip: "Check this to restrict to certain roles",%s', PHP_EOL);
|
||
|
printf(' checked: false,%s', PHP_EOL);
|
||
|
printf(' sub: [%s', PHP_EOL);
|
||
|
|
||
|
$getRoles = $db->prepare('SELECT `role_id`, `role_name` FROM `msz_roles` WHERE `role_hidden` = 0 ORDER BY `role_id` ASC');
|
||
|
$getRoles->execute();
|
||
|
while(($role = $getRoles->fetch()) !== false)
|
||
|
printf(' { name: "%s", key: "R%d" },%s', $role[1], $role[0], PHP_EOL);
|
||
|
|
||
|
printf(' ],%s', PHP_EOL);
|
||
|
printf(' },%s', PHP_EOL);
|
||
|
printf(' {%s', PHP_EOL);
|
||
|
printf(' name: "Remove inactive members",%s', PHP_EOL);
|
||
|
printf(' key: "inactive",%s', PHP_EOL);
|
||
|
printf(' tooltip: "Limits the selection to people who have showed up within the last year.",%s', PHP_EOL);
|
||
|
printf(' },%s', PHP_EOL);
|
||
|
printf(' {%s', PHP_EOL);
|
||
|
printf(' name: "Remove members with no posts",%s', PHP_EOL);
|
||
|
printf(' key: "noposts",%s', PHP_EOL);
|
||
|
printf(' tooltip: "Removes members that have not made any forum posts yet.",%s', PHP_EOL);
|
||
|
printf(' },%s', PHP_EOL);
|
||
|
printf('];%s', PHP_EOL);
|
||
|
|
||
|
echo PHP_EOL;
|
||
|
|
||
|
printf('dataSet[dataSetVersion].characterData = [%s', PHP_EOL);
|
||
|
|
||
|
$getUsers = $db->prepare('SELECT `user_id`, `username`, `user_active` > NOW() - INTERVAL 1 YEAR AS `user_active`, (SELECT COUNT(*) FROM `msz_forum_posts` WHERE `user_id` = u.`user_id` AND `post_deleted` IS NULL) AS `user_posts` FROM `msz_users` AS u WHERE `user_deleted` IS NULL ORDER BY `user_id` ASC');
|
||
|
$getUsers->execute();
|
||
|
while(($user = $getUsers->fetch()) !== false) {
|
||
|
printf(' {%s', PHP_EOL);
|
||
|
printf(' name: "%s",%s', $user[1], PHP_EOL);
|
||
|
printf(' img: "https://flashii.net/assets/avatar/%d?res=300",%s', $user[0], PHP_EOL);
|
||
|
printf(' opts: {%s', PHP_EOL);
|
||
|
printf(' role: [', PHP_EOL);
|
||
|
|
||
|
$getRoles = $db->prepare('SELECT `role_id` FROM `msz_user_roles` WHERE `user_id` = :user');
|
||
|
$getRoles->bindValue('user', $user[0]);
|
||
|
$getRoles->execute();
|
||
|
while(($role = $getRoles->fetchColumn()) !== false)
|
||
|
printf(' "R%d", ', $role);
|
||
|
|
||
|
printf('],%s', PHP_EOL);
|
||
|
|
||
|
if(!$user[2])
|
||
|
printf(' inactive: true,%s', PHP_EOL);
|
||
|
|
||
|
if($user[3] < 1)
|
||
|
printf(' noposts: true,%s', PHP_EOL);
|
||
|
|
||
|
printf(' },%s', PHP_EOL);
|
||
|
printf(' },%s', PHP_EOL);
|
||
|
}
|
||
|
|
||
|
printf('];%s', PHP_EOL);
|