BioTorrents.de’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.

community_stats.php 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <?php
  2. declare(strict_types=1);
  3. $DB->query("
  4. SELECT Page, COUNT(1)
  5. FROM comments
  6. WHERE AuthorID = $UserID
  7. GROUP BY Page");
  8. $Comments = $DB->to_array('Page');
  9. $NumComments = isset($Comments['torrents']) ? $Comments['torrents'][1]:0;
  10. $NumArtistComments = isset($Comments['artist']) ? $Comments['artist'][1]:0;
  11. $NumCollageComments = isset($Comments['collages']) ? $Comments['collages'][1]:0;
  12. $NumRequestComments = isset($Comments['requests']) ? $Comments['requests'][1]:0;
  13. $DB->query("
  14. SELECT COUNT(ID)
  15. FROM collages
  16. WHERE Deleted = '0'
  17. AND UserID = '$UserID'");
  18. list($NumCollages) = $DB->next_record();
  19. $DB->query("
  20. SELECT COUNT(DISTINCT CollageID)
  21. FROM collages_torrents AS ct
  22. JOIN collages ON CollageID = ID
  23. WHERE Deleted = '0'
  24. AND ct.UserID = '$UserID'");
  25. list($NumCollageContribs) = $DB->next_record();
  26. $DB->query("
  27. SELECT COUNT(DISTINCT GroupID)
  28. FROM torrents
  29. WHERE UserID = '$UserID'");
  30. list($UniqueGroups) = $DB->next_record();
  31. ?>
  32. <div class="box box_info box_userinfo_community">
  33. <div class="head colhead_dark">Community</div>
  34. <ul class="stats nobullet">
  35. <li id="comm_posts">Forum posts: <?=number_format($ForumPosts)?> <a
  36. href="userhistory.php?action=posts&amp;userid=<?=$UserID?>"
  37. class="brackets">View</a></li>
  38. <li id="comm_irc">IRC lines: <?=number_format($IRCLines)?>
  39. </li>
  40. <?php if ($Override = check_paranoia_here('torrentcomments+')) { ?>
  41. <li id="comm_torrcomm" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Torrent
  42. comments: <?=number_format($NumComments)?>
  43. <?php if ($Override = check_paranoia_here('torrentcomments')) { ?>
  44. <a href="comments.php?id=<?=$UserID?>"
  45. class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
  46. <?php } ?>
  47. </li>
  48. <li id="comm_artcomm" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Artist
  49. comments: <?=number_format($NumArtistComments)?>
  50. <?php if ($Override = check_paranoia_here('torrentcomments')) { ?>
  51. <a href="comments.php?id=<?=$UserID?>&amp;action=artist"
  52. class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
  53. <?php } ?>
  54. </li>
  55. <li id="comm_collcomm" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Collage
  56. comments: <?=number_format($NumCollageComments)?>
  57. <?php if ($Override = check_paranoia_here('torrentcomments')) { ?>
  58. <a href="comments.php?id=<?=$UserID?>&amp;action=collages"
  59. class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
  60. <?php } ?>
  61. </li>
  62. <li id="comm_reqcomm" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Request
  63. comments: <?=number_format($NumRequestComments)?>
  64. <?php if ($Override = check_paranoia_here('torrentcomments')) { ?>
  65. <a href="comments.php?id=<?=$UserID?>&amp;action=requests"
  66. class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
  67. <?php } ?>
  68. </li>
  69. <?php
  70. }
  71. if (($Override = check_paranoia_here('collages+'))) { ?>
  72. <li id="comm_collstart" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Collages
  73. started: <?=number_format($NumCollages)?>
  74. <?php if ($Override = check_paranoia_here('collages')) { ?>
  75. <a href="collages.php?userid=<?=$UserID?>"
  76. class="brackets<?=(($Override === 2) ? ' paranoia_override' : '')?>">View</a>
  77. <?php } ?>
  78. </li>
  79. <?php
  80. }
  81. if (($Override = check_paranoia_here('collagecontribs+'))) { ?>
  82. <li id="comm_collcontrib" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Collages
  83. contributed to:
  84. <?php echo number_format($NumCollageContribs); ?>
  85. <?php if ($Override = check_paranoia_here('collagecontribs')) { ?>
  86. <a href="collages.php?userid=<?=$UserID?>&amp;contrib=1"
  87. class="brackets<?=(($Override === 2) ? ' paranoia_override' : '')?>">View</a>
  88. <?php } ?>
  89. </li>
  90. <?php
  91. }
  92. //Let's see if we can view requests because of reasons
  93. $ViewAll = check_paranoia_here('requestsfilled_list');
  94. $ViewCount = check_paranoia_here('requestsfilled_count');
  95. $ViewBounty = check_paranoia_here('requestsfilled_bounty');
  96. if ($ViewCount && !$ViewBounty && !$ViewAll) { ?>
  97. <li>Requests filled: <?=number_format($RequestsFilled)?>
  98. </li>
  99. <?php } elseif (!$ViewCount && $ViewBounty && !$ViewAll) { ?>
  100. <li>Requests filled: <?=Format::get_size($TotalBounty)?> collected</li>
  101. <?php } elseif ($ViewCount && $ViewBounty && !$ViewAll) { ?>
  102. <li>Requests filled: <?=number_format($RequestsFilled)?> for <?=Format::get_size($TotalBounty)?>
  103. </li>
  104. <?php } elseif ($ViewAll) { ?>
  105. <li>
  106. <span<?=($ViewCount === 2 ? ' class="paranoia_override"' : '')?>>Requests
  107. filled: <?=number_format($RequestsFilled)?></span>
  108. <span<?=($ViewBounty === 2 ? ' class="paranoia_override"' : '')?>>
  109. for <?=Format::get_size($TotalBounty) ?></span>
  110. <a href="requests.php?type=filled&amp;userid=<?=$UserID?>"
  111. class="brackets<?=(($ViewAll === 2) ? ' paranoia_override' : '')?>">View</a>
  112. </li>
  113. <?php
  114. }
  115. //Let's see if we can view requests because of reasons
  116. $ViewAll = check_paranoia_here('requestsvoted_list');
  117. $ViewCount = check_paranoia_here('requestsvoted_count');
  118. $ViewBounty = check_paranoia_here('requestsvoted_bounty');
  119. if ($ViewCount && !$ViewBounty && !$ViewAll) { ?>
  120. <li>Requests created: <?=number_format($RequestsCreated)?>
  121. </li>
  122. <li>Requests voted: <?=number_format($RequestsVoted)?>
  123. </li>
  124. <?php } elseif (!$ViewCount && $ViewBounty && !$ViewAll) { ?>
  125. <li>Requests created: <?=Format::get_size($RequestsCreatedSpent)?> spent
  126. </li>
  127. <li>Requests voted: <?=Format::get_size($TotalSpent)?> spent</li>
  128. <?php } elseif ($ViewCount && $ViewBounty && !$ViewAll) { ?>
  129. <li>Requests created: <?=number_format($RequestsCreated)?> for <?=Format::get_size($RequestsCreatedSpent)?>
  130. </li>
  131. <li>Requests voted: <?=number_format($RequestsVoted)?> for <?=Format::get_size($TotalSpent)?>
  132. </li>
  133. <?php } elseif ($ViewAll) { ?>
  134. <li>
  135. <span<?=($ViewCount === 2 ? ' class="paranoia_override"' : '')?>>Requests
  136. created: <?=number_format($RequestsCreated)?></span>
  137. <span<?=($ViewBounty === 2 ? ' class="paranoia_override"' : '')?>>
  138. for <?=Format::get_size($RequestsCreatedSpent)?></span>
  139. <a href="requests.php?type=created&amp;userid=<?=$UserID?>"
  140. class="brackets<?=($ViewAll === 2 ? ' paranoia_override' : '')?>">View</a>
  141. </li>
  142. <li>
  143. <span<?=($ViewCount === 2 ? ' class="paranoia_override"' : '')?>>Requests
  144. voted: <?=number_format($RequestsVoted)?></span>
  145. <span<?=($ViewBounty === 2 ? ' class="paranoia_override"' : '')?>>
  146. for <?=Format::get_size($TotalSpent)?></span>
  147. <a href="requests.php?type=voted&amp;userid=<?=$UserID?>"
  148. class="brackets<?=($ViewAll === 2 ? ' paranoia_override' : '')?>">View</a>
  149. </li>
  150. <?php
  151. }
  152. if ($Override = check_paranoia_here('screenshotcount')) {
  153. $DB->query("
  154. SELECT COUNT(*)
  155. FROM `literature`
  156. WHERE user_id = '$UserID'");
  157. list($Screenshots) = $DB->next_record(); ?>
  158. <li id="comm_screenshots">Screenshots added: <?=number_format($Screenshots)?>
  159. </li>
  160. <?php
  161. }
  162. if ($Override = check_paranoia_here('uploads+')) { ?>
  163. <li id="comm_upload" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Uploaded:
  164. <?=number_format($Uploads)?>
  165. <?php if ($Override = check_paranoia_here('uploads')) { ?>
  166. <a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>"
  167. class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
  168. <?php if (check_perms('zip_downloader')) { ?>
  169. <a href="torrents.php?action=redownload&amp;type=uploads&amp;userid=<?=$UserID?>"
  170. onclick="return confirm('If you no longer have the content, your ratio WILL be affected; be sure to check the size of all torrents before redownloading.');"
  171. class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">Download</a>
  172. <?php
  173. }
  174. }
  175. ?>
  176. </li>
  177. <?php
  178. }
  179. if ($Override = check_paranoia_here('uniquegroups+')) { ?>
  180. <li id="comm_uniquegroup" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Unique
  181. groups: <?=number_format($UniqueGroups)?>
  182. <?php if ($Override = check_paranoia_here('uniquegroups')) { ?>
  183. <a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>&amp;filter=uniquegroup"
  184. class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
  185. <?php } ?>
  186. </li>
  187. <?php
  188. }
  189. if ($Override = check_paranoia_here('seeding+')) {
  190. ?>
  191. <li id="comm_seeding" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Seeding:
  192. <span class="user_commstats" id="user_commstats_seeding"><a href="#" class="brackets"
  193. onclick="commStats(<?=$UserID?>); return false;">Show
  194. stats</a></span>
  195. <?php if ($Override = check_paranoia_here('snatched+')) { ?>
  196. <span<?=($Override === 2 ? ' class="paranoia_override"' : '')?>
  197. id="user_commstats_seedingperc"></span>
  198. <?php
  199. }
  200. if ($Override = check_paranoia_here('seeding')) {
  201. ?>
  202. <a href="torrents.php?type=seeding&amp;userid=<?=$UserID?>"
  203. class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
  204. <?php if (check_perms('zip_downloader')) { ?>
  205. <a href="torrents.php?action=redownload&amp;type=seeding&amp;userid=<?=$UserID?>"
  206. onclick="return confirm('If you no longer have the content, your ratio WILL be affected; be sure to check the size of all torrents before redownloading.');"
  207. class="brackets">Download</a>
  208. <?php
  209. }
  210. } ?>
  211. </li>
  212. <?php
  213. }
  214. if ($Override = check_paranoia_here('leeching+')) {
  215. ?>
  216. <li id="comm_leeching" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Leeching:
  217. <span class="user_commstats" id="user_commstats_leeching"><a href="#" class="brackets"
  218. onclick="commStats(<?=$UserID?>); return false;">Show
  219. stats</a></span>
  220. <?php if ($Override = check_paranoia_here('leeching')) { ?>
  221. <a href="torrents.php?type=leeching&amp;userid=<?=$UserID?>"
  222. class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
  223. <?php
  224. }
  225. if ($DisableLeech == 0 && check_perms('users_view_ips')) {
  226. ?>
  227. <strong>(Disabled)</strong>
  228. <?php
  229. } ?>
  230. </li>
  231. <?php
  232. }
  233. if ($Override = check_paranoia_here('snatched+')) { ?>
  234. <li id="comm_snatched" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Snatched:
  235. <span class="user_commstats" id="user_commstats_snatched"><a href="#" class="brackets"
  236. onclick="commStats(<?=$UserID?>); return false;">Show
  237. stats</a></span>
  238. <?php if ($Override = check_perms('site_view_torrent_snatchlist', $Class)) { ?>
  239. <span id="user_commstats_usnatched" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>></span>
  240. <?php
  241. }
  242. }
  243. if ($Override = check_paranoia_here('snatched')) { ?>
  244. <a href="torrents.php?type=snatched&amp;userid=<?=$UserID?>"
  245. class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
  246. <?php if (check_perms('zip_downloader')) { ?>
  247. <a href="torrents.php?action=redownload&amp;type=snatches&amp;userid=<?=$UserID?>"
  248. onclick="return confirm('If you no longer have the content, your ratio WILL be affected, be sure to check the size of all torrents before redownloading.');"
  249. class="brackets">Download</a>
  250. <?php } ?>
  251. </li>
  252. <?php
  253. }
  254. if (check_perms('site_view_torrent_snatchlist', $Class)) {
  255. ?>
  256. <li id="comm_downloaded">Downloaded:
  257. <span class="user_commstats" id="user_commstats_downloaded"><a href="#" class="brackets"
  258. onclick="commStats(<?=$UserID?>); return false;">Show
  259. stats</a></span>
  260. <span id="user_commstats_udownloaded"></span>
  261. <a href="torrents.php?type=downloaded&amp;userid=<?=$UserID?>"
  262. class="brackets">View</a>
  263. </li>
  264. <?php
  265. }
  266. if ($Override = check_paranoia_here('invitedcount')) {
  267. $DB->query("
  268. SELECT COUNT(UserID)
  269. FROM users_info
  270. WHERE Inviter = '$UserID'");
  271. list($Invited) = $DB->next_record(); ?>
  272. <li id="comm_invited">Invited: <?=number_format($Invited)?>
  273. </li>
  274. <?php
  275. }
  276. ?>
  277. </ul>
  278. <?php if ($LoggedUser['AutoloadCommStats']) { ?>
  279. <script type="text/javascript">
  280. commStats( <?=$UserID?> );
  281. </script>
  282. <?php } ?>
  283. </div>