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.

friends.php 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. /************************************************************************
  3. //------------// Main friends page //----------------------------------//
  4. This page lists a user's friends.
  5. There's no real point in caching this page. I doubt users load it that
  6. much.
  7. ************************************************************************/
  8. // Number of users per page
  9. define('FRIENDS_PER_PAGE', '20');
  10. include_once(SERVER_ROOT.'/classes/paranoia.class.php');
  11. View::show_header('Friends');
  12. $UserID = $LoggedUser['ID'];
  13. list($Page, $Limit) = Format::page_limit(FRIENDS_PER_PAGE);
  14. // Main query
  15. $DB->query("
  16. SELECT
  17. SQL_CALC_FOUND_ROWS
  18. f.FriendID,
  19. f.Comment,
  20. m.Username,
  21. m.Uploaded,
  22. m.Downloaded,
  23. m.PermissionID,
  24. m.Paranoia,
  25. m.LastAccess,
  26. i.Avatar
  27. FROM friends AS f
  28. JOIN users_main AS m ON f.FriendID = m.ID
  29. JOIN users_info AS i ON f.FriendID = i.UserID
  30. WHERE f.UserID = '$UserID'
  31. ORDER BY Username
  32. LIMIT $Limit");
  33. $Friends = $DB->to_array(false, MYSQLI_BOTH, array(6, 'Paranoia'));
  34. // Number of results (for pagination)
  35. $DB->query('SELECT FOUND_ROWS()');
  36. list($Results) = $DB->next_record();
  37. // Start printing stuff
  38. ?>
  39. <div class="thin">
  40. <div class="header">
  41. <h2>Friends List</h2>
  42. </div>
  43. <div class="linkbox">
  44. <?
  45. // Pagination
  46. $Pages = Format::get_pages($Page, $Results, FRIENDS_PER_PAGE, 9);
  47. echo $Pages;
  48. ?>
  49. </div>
  50. <div class="box pad">
  51. <?
  52. if ($Results == 0) {
  53. echo '<p>You have no friends! :(</p>';
  54. }
  55. // Start printing out friends
  56. foreach ($Friends as $Friend) {
  57. list($FriendID, $Comment, $Username, $Uploaded, $Downloaded, $Class, $Paranoia, $LastAccess, $Avatar) = $Friend;
  58. ?>
  59. <form class="manage_form" name="friends" action="friends.php" method="post">
  60. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  61. <table class="friends_table vertical_margin">
  62. <tr class="colhead">
  63. <td colspan="<?=(Users::has_avatars_enabled() ? 3 : 2)?>">
  64. <span style="float: left;"><?=Users::format_username($FriendID, true, true, true, true)?>
  65. <? if (check_paranoia('ratio', $Paranoia, $Class, $FriendID)) { ?>
  66. &nbsp;Ratio: <strong><?=Format::get_ratio_html($Uploaded, $Downloaded)?></strong>
  67. <?
  68. }
  69. if (check_paranoia('uploaded', $Paranoia, $Class, $FriendID)) {
  70. ?>
  71. &nbsp;Up: <strong><?=Format::get_size($Uploaded)?></strong>
  72. <?
  73. }
  74. if (check_paranoia('downloaded', $Paranoia, $Class, $FriendID)) {
  75. ?>
  76. &nbsp;Down: <strong><?=Format::get_size($Downloaded)?></strong>
  77. <? } ?>
  78. </span>
  79. <? if (check_paranoia('lastseen', $Paranoia, $Class, $FriendID)) { ?>
  80. <span style="float: right;"><?=time_diff($LastAccess)?></span>
  81. <? } ?>
  82. </td>
  83. </tr>
  84. <tr>
  85. <? if (Users::has_avatars_enabled()) { ?>
  86. <td class="col_avatar avatar" valign="top">
  87. <?=Users::show_avatar($Avatar, $FriendID, $Username, $HeavyInfo['DisableAvatars'])?>
  88. </td>
  89. <? } ?>
  90. <td valign="top">
  91. <input type="hidden" name="friendid" value="<?=$FriendID?>" />
  92. <textarea name="comment" rows="4" cols="65"><?=$Comment?></textarea>
  93. </td>
  94. <td class="left" valign="top">
  95. <input type="submit" name="action" value="Update" /><br />
  96. <input type="submit" name="action" value="Remove friend" /><br />
  97. <input type="submit" name="action" value="Contact" /><br />
  98. </td>
  99. </tr>
  100. </table>
  101. </form>
  102. <?
  103. } // while
  104. // close <div class="box pad">
  105. ?>
  106. </div>
  107. <div class="linkbox">
  108. <?=$Pages?>
  109. </div>
  110. <? // close <div class="thin"> ?>
  111. </div>
  112. <?
  113. View::show_footer();
  114. ?>