Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

email_history_userview.php 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?
  2. $UserID = $_GET['userid'];
  3. if (!is_number($UserID)) {
  4. error(404);
  5. }
  6. $Self = ($UserID == $LoggedUser['ID']);
  7. if (!check_perms('users_mod') && !$Self) {
  8. error(403);
  9. }
  10. if (!apc_exists('DBKEY')) {
  11. error('The site is currently running with partial database access. Please wait for staff to fully decrypt it');
  12. }
  13. $DB->query("
  14. SELECT DISTINCT h.email
  15. FROM users_history_emails AS h
  16. WHERE h.UserID = '$UserID'");
  17. $EncEmails = $DB->collect("email");
  18. $Emails = array();
  19. foreach ($EncEmails as $Enc) {
  20. if (!isset($Emails[DBCrypt::decrypt($Enc)])) {
  21. $Emails[DBCrypt::decrypt($Enc)] = array();
  22. }
  23. $Emails[DBCrypt::decrypt($Enc)][] = $Enc;
  24. }
  25. $DB->query("
  26. SELECT email
  27. FROM users_main
  28. WHERE ID = '$UserID'");
  29. list($Curr) = $DB->next_record();
  30. $Curr = DBCrypt::decrypt($Curr);
  31. if ($Self) {
  32. $DB->query("SELECT Username FROM users_main WHERE ID = '$UserID'");
  33. list($Username) = $DB->next_record();
  34. View::show_header("Email history for $Username");
  35. } else {
  36. View::show_header("Your email history");
  37. }
  38. ?>
  39. <div class="header">
  40. <? if ($Self) { ?>
  41. <h2>Your email history</h2>
  42. <? } else { ?>
  43. <h2>Email history for <a href="user.php?id=<?=$UserID ?>"><?=$Username ?></a></h2>
  44. <? } ?>
  45. </div>
  46. <table width="100%">
  47. <tr class="colhead">
  48. <td>Email</td>
  49. <td>Delete</td>
  50. </tr>
  51. <? foreach ($Emails as $Email => $Encs) { ?>
  52. <tr class="row">
  53. <td><?=display_str($Email)?></td>
  54. <td>
  55. <? if ($Email != $Curr) { ?>
  56. <a href="delete.php?action=email&emails[]=<?=implode('&emails[]=', array_map('urlencode', $Encs))?>" class="brackets">X</a>
  57. <? } ?>
  58. </td>
  59. </tr>
  60. <? } ?>
  61. </table>
  62. <? View::show_footer(); ?>