function show_page() { global $use_rel_external_script; // direct page_header to include some javascript that will make links $use_rel_external_script = true; // marked as rel="external" open in a new tab while remaining XHTML-valid page_header('User List'); // Generate code for the different tables of users included in the body $captains_table = generate_user_table('SELECT id, name, email, yog FROM users WHERE permissions="C" ORDER BY yog ASC, name'); $other_admins_table = generate_user_table('SELECT id, name, email, yog FROM users WHERE permissions="A" ORDER BY yog ASC, name'); $members_table = generate_user_table('SELECT id, name, email, yog FROM users WHERE permissions="R" AND approved="1" ORDER BY yog ASC, name'); $alumni_table = generate_user_table('SELECT id, name, email, yog FROM users WHERE permissions="L" ORDER BY yog DESC, name'); $banned_users_table = generate_user_table('SELECT id, name, email, yog, creation_date, DATE_FORMAT(creation_date, "%M %e, %Y") AS formatted_creation FROM users WHERE approved="-1" ORDER BY creation_date DESC'); // The Pending Approval Table is different $pending_approval_table = <<<HEREDOC <table class="contrasting"> <tr> <th>Name</th> <th>Email Address</th> <th>YOG</th> <th>Account Creation</th> <th>Actions</th> </tr> HEREDOC; $query = 'SELECT id, name, email, yog, TIMESTAMPDIFF(DAY, creation_date, CURRENT_TIMESTAMP) AS created_ago FROM users WHERE approved="0" ORDER BY created_ago DESC, name'; $result = DB::queryRaw($query); $row = mysqli_fetch_assoc($result); if (mysqli_num_rows($result) == 0) { $pending_approval_table .= " <tr><td colspan=\"5\" class=\"text-centered\">None</td></tr>\n"; } else { while ($row) { $trimmed_email = trim_email($row['email']); $pending_approval_table .= <<<HEREDOC \t <tr> \t <td><a href="View_User?ID={$row['id']}">{$row['name']}</a></td> \t <td><a href="mailto:{$row['email']}" rel="external">{$trimmed_email}</a></td> \t <td>{$row['yog']}</td> \t <td>{$row['created_ago']} days ago</td> \t <td> \t <a href="Edit_User?Approve&ID={$row['id']}&xsrf_token={$_SESSION['xsrf_token']}&Return=List" class="small">Approve</a><br /> \t <a href="Edit_User?Ban&ID={$row['id']}&xsrf_token={$_SESSION['xsrf_token']}&Return=List" class="small">Ban</a> \t </td> \t </tr> \t HEREDOC; $row = mysqli_fetch_assoc($result); } } $pending_approval_table .= " </table><br />\n"; // Assemble page echo <<<HEREDOC <h1>User List</h1> <span class="b">Captains</span> {$captains_table} <br /> <br /> <span class="b">Other Admins</span> {$other_admins_table} <br /> <br /> <span class="b">Besties (members)</span> {$members_table} <br /> <br /> <span class="b">Alumni</span> {$alumni_table} <br /> <br /> <span class="b">Pending Users</span> {$pending_approval_table} <br /> <br /> <span class="b">Banned Users</span> {$banned_users_table} <br /> <br /> HEREDOC; }
$table_string .= "</table>\n"; return $table_string; } ?> <html> <h1>Absmaster Project Administration</h1> <h2>Users</h2> <?php if (count($USERINVENTORY->get_users()) > 0) { echo 'The following users are currently in the system:'; echo '<p>' . generate_user_table($USERINVENTORY) . '</p>' . "\n"; echo '<p>' . generate_batch_paper_download_link() . '</p>' . "\n"; } else { echo '<p>No users have signed up yet.<p>'; } ?> <h2>Reviewer Assignment</h2> <p> <?php // don't allow assignment of reviewers if everyone hasn't uploaded a paper $disable_review_assignments_string = ''; $papers_not_all_uploaded_yet = false; if (count($USERINVENTORY->get_users()) == 0) {
} if ($Details == 'all' || $Details == 'uls') { if (!($TopUserUploadSpeed = $Cache->get_value('topuser_ulspeed_' . $Limit))) { $DB->query("{$BaseQuery} ORDER BY UpSpeed DESC LIMIT {$Limit};"); $TopUserUploadSpeed = $DB->to_array(); $Cache->cache_value('topuser_ulspeed_' . $Limit, $TopUserUploadSpeed, 3600 * 12); } generate_user_table('Fastest Uploaders', 'uls', $TopUserUploadSpeed, $Limit); } if ($Details == 'all' || $Details == 'dls') { if (!($TopUserDownloadSpeed = $Cache->get_value('topuser_dlspeed_' . $Limit))) { $DB->query("{$BaseQuery} ORDER BY DownSpeed DESC LIMIT {$Limit};"); $TopUserDownloadSpeed = $DB->to_array(); $Cache->cache_value('topuser_dlspeed_' . $Limit, $TopUserDownloadSpeed, 3600 * 12); } generate_user_table('Fastest Downloaders', 'dls', $TopUserDownloadSpeed, $Limit); } echo '</div>'; View::show_footer(); exit; // generate a table based on data from most recent query to $DB function generate_user_table($Caption, $Tag, $Details, $Limit) { global $Time; ?> <h3>Top <?php echo $Limit . ' ' . $Caption; ?> <small class="top10_quantity_links"> <?php switch ($Limit) {
View::show_header('Top 10 Donors'); ?> <div class="thin"> <div class="header"> <h2>Top Donors</h2> <?php Top10View::render_linkbox("donors"); ?> </div> <?php $Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10; $Limit = in_array($Limit, array(10, 100, 250)) ? $Limit : 10; $IsMod = check_perms("users_mod"); $DB->query("\n\tSELECT\n\t\tUserID, TotalRank, Rank, SpecialRank, DonationTime, Hidden\n\tFROM users_donor_ranks\n\tWHERE TotalRank > 0\n\tORDER BY TotalRank DESC\n\tLIMIT {$Limit}"); $Results = $DB->to_array(); generate_user_table('Top Donors', $Results, $Limit); echo '</div>'; View::show_footer(); // generate a table based on data from most recent query to $DB function generate_user_table($Caption, $Results, $Limit) { global $Time, $IsMod; ?> <h3>Top <?php echo "{$Limit} {$Caption}"; ?> <small class="top10_quantity_links"> <?php switch ($Limit) { case 100: ?>