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.

user.php 59KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757
  1. <?php
  2. #declare(strict_types = 1);
  3. if (empty($_GET['id']) || !is_number($_GET['id']) || (!empty($_GET['preview']) && !is_number($_GET['preview']))) {
  4. error(404);
  5. }
  6. $UserID = (int)$_GET['id'];
  7. $Preview = isset($_GET['preview']) ? $_GET['preview'] : 0;
  8. if ($UserID === $LoggedUser['ID']) {
  9. $OwnProfile = true;
  10. if ($Preview === 1) {
  11. $OwnProfile = false;
  12. $ParanoiaString = $_GET['paranoia'];
  13. $CustomParanoia = explode(',', $ParanoiaString);
  14. }
  15. } else {
  16. $OwnProfile = false;
  17. // Don't allow any kind of previewing on others' profiles
  18. $Preview = 0;
  19. }
  20. # Donor rewards (extra profile fields, etc.)
  21. $EnabledRewards = Donations::get_enabled_rewards($UserID);
  22. $ProfileRewards = Donations::get_profile_rewards($UserID);
  23. /**
  24. * Staff view main query
  25. */
  26. if (check_perms('users_mod')) {
  27. $DB->query("
  28. SELECT
  29. m.`Username`,
  30. m.`Email`,
  31. m.`LastAccess`,
  32. m.`IP`,
  33. p.`Level` AS Class,
  34. m.`Uploaded`,
  35. m.`Downloaded`,
  36. m.`RequiredRatio`,
  37. m.`Title`,
  38. m.`torrent_pass`,
  39. m.`Enabled`,
  40. m.`Paranoia`,
  41. m.`Invites`,
  42. m.`can_leech`,
  43. m.`Visible`,
  44. m.`BonusPoints`,
  45. m.`IRCLines`,
  46. i.`JoinDate`,
  47. i.`Info`,
  48. i.`Avatar`,
  49. i.`AdminComment`,
  50. i.`Donor`,
  51. i.`Artist`,
  52. i.`Warned`,
  53. i.`SupportFor`,
  54. i.`RestrictedForums`,
  55. i.`PermittedForums`,
  56. i.`Inviter`,
  57. inviter.`Username`,
  58. COUNT(posts.id) AS ForumPosts,
  59. i.`RatioWatchEnds`,
  60. i.`RatioWatchDownload`,
  61. i.`DisableAvatar`,
  62. i.`DisableInvites`,
  63. i.`DisablePosting`,
  64. i.`DisableForums`,
  65. i.`DisableTagging`,
  66. i.`DisableUpload`,
  67. i.`DisableWiki`,
  68. i.`DisablePM`,
  69. i.`DisablePoints`,
  70. i.`DisablePromotion`,
  71. i.`DisableIRC`,
  72. i.`DisableRequests`,
  73. m.`FLTokens`,
  74. SHA1(i.`AdminComment`),
  75. i.`InfoTitle`,
  76. la.`Type` AS LockedAccount
  77. FROM
  78. `users_main` AS m
  79. JOIN `users_info` AS i
  80. ON
  81. i.`UserID` = m.`ID`
  82. LEFT JOIN `users_main` AS inviter
  83. ON
  84. i.`Inviter` = inviter.`ID`
  85. LEFT JOIN `permissions` AS p
  86. ON
  87. p.`ID` = m.`PermissionID`
  88. LEFT JOIN `forums_posts` AS posts
  89. ON
  90. posts.`AuthorID` = m.`ID`
  91. LEFT JOIN `locked_accounts` AS la
  92. ON
  93. la.`UserID` = m.`ID`
  94. WHERE
  95. m.`ID` = '$UserID'
  96. GROUP BY
  97. `AuthorID`
  98. ");
  99. if (!$DB->has_results()) { // If user doesn't exist
  100. header("Location: log.php?search=User+$UserID");
  101. }
  102. list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded, $RequiredRatio, $CustomTitle, $torrent_pass, $Enabled, $Paranoia, $Invites, $DisableLeech, $Visible, $BonusPoints, $IRCLines, $JoinDate, $Info, $Avatar, $AdminComment, $Donor, $Artist, $Warned, $SupportFor, $RestrictedForums, $PermittedForums, $InviterID, $InviterName, $ForumPosts, $RatioWatchEnds, $RatioWatchDownload, $DisableAvatar, $DisableInvites, $DisablePosting, $DisableForums, $DisableTagging, $DisableUpload, $DisableWiki, $DisablePM, $DisablePoints, $DisablePromotion, $DisableIRC, $DisableRequests, $FLTokens, $CommentHash, $InfoTitle, $LockedAccount) = $DB->next_record(MYSQLI_NUM, array(8, 11));
  103. }
  104. /**
  105. * Normal view main query
  106. */
  107. else { // Person viewing is a normal user
  108. $DB->query("
  109. SELECT
  110. m.`Username`,
  111. m.`Email`,
  112. m.`LastAccess`,
  113. m.`IP`,
  114. p.`Level` AS Class,
  115. m.`Uploaded`,
  116. m.`Downloaded`,
  117. m.`RequiredRatio`,
  118. m.`Enabled`,
  119. m.`Paranoia`,
  120. m.`Invites`,
  121. m.`Title`,
  122. m.`torrent_pass`,
  123. m.`can_leech`,
  124. i.`JoinDate`,
  125. i.`Info`,
  126. i.`Avatar`,
  127. m.`FLTokens`,
  128. m.`BonusPoints`,
  129. m.`IRCLines`,
  130. i.`Donor`,
  131. i.`Warned`,
  132. COUNT(posts.id) AS ForumPosts,
  133. i.`Inviter`,
  134. i.`DisableInvites`,
  135. inviter.`username`,
  136. i.`InfoTitle`
  137. FROM
  138. `users_main` AS m
  139. JOIN `users_info` AS i
  140. ON
  141. i.`UserID` = m.`ID`
  142. LEFT JOIN `permissions` AS p
  143. ON
  144. p.`ID` = m.`PermissionID`
  145. LEFT JOIN `users_main` AS inviter
  146. ON
  147. i.`Inviter` = inviter.`ID`
  148. LEFT JOIN `forums_posts` AS posts
  149. ON
  150. posts.`AuthorID` = m.`ID`
  151. WHERE
  152. m.`ID` = '$UserID'
  153. GROUP BY
  154. `AuthorID`
  155. ");
  156. if (!$DB->has_results()) { // If user doesn't exist
  157. header("Location: log.php?search=User+$UserID");
  158. }
  159. list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded,
  160. $RequiredRatio, $Enabled, $Paranoia, $Invites, $CustomTitle, $torrent_pass,
  161. $DisableLeech, $JoinDate, $Info, $Avatar, $FLTokens, $BonusPoints, $IRCLines, $Donor, $Warned,
  162. $ForumPosts, $InviterID, $DisableInvites, $InviterName, $InfoTitle) = $DB->next_record(MYSQLI_NUM, array(9, 11));
  163. }
  164. $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]';
  165. $DB->query("
  166. SELECT SUM(t.Size)
  167. FROM xbt_files_users AS xfu
  168. JOIN torrents AS t on t.ID = xfu.fid
  169. WHERE
  170. xfu.uid = '$UserID'
  171. AND xfu.active = 1
  172. AND xfu.Remaining = 0");
  173. if ($DB->has_results()) {
  174. list($TotalSeeding) = $DB->next_record(MYSQLI_NUM, false);
  175. }
  176. // Image proxy CTs
  177. $DisplayCustomTitle = $CustomTitle;
  178. if (check_perms('site_proxy_images') && !empty($CustomTitle)) {
  179. $DisplayCustomTitle = preg_replace_callback(
  180. '~src=("?)(http.+?)(["\s>])~',
  181. function ($Matches) {
  182. return 'src=' . $Matches[1] . ImageTools::process($Matches[2]) . $Matches[3];
  183. },
  184. $CustomTitle
  185. );
  186. }
  187. if ($Preview == 1) {
  188. if (strlen($ParanoiaString) == 0) {
  189. $Paranoia = [];
  190. } else {
  191. $Paranoia = $CustomParanoia;
  192. }
  193. } else {
  194. $Paranoia = json_decode($Paranoia, true);
  195. if (!is_array($Paranoia)) {
  196. $Paranoia = [];
  197. }
  198. }
  199. $ParanoiaLevel = 0;
  200. foreach ($Paranoia as $P) {
  201. $ParanoiaLevel++;
  202. if (strpos($P, '+') !== false) {
  203. $ParanoiaLevel++;
  204. }
  205. }
  206. $JoinedDate = time_diff($JoinDate);
  207. $LastAccess = time_diff($LastAccess);
  208. function check_paranoia_here($Setting)
  209. {
  210. global $Paranoia, $Class, $UserID, $Preview;
  211. if ($Preview == 1) {
  212. return check_paranoia($Setting, $Paranoia, $Class);
  213. } else {
  214. return check_paranoia($Setting, $Paranoia, $Class, $UserID);
  215. }
  216. }
  217. View::show_header(
  218. $Username,
  219. 'vendor/imagesloaded.min,user,bbcode,requests,comments,info_paster,wall'
  220. );
  221. ?>
  222. <div>
  223. <div class="header">
  224. <h2>
  225. <?=Users::format_username($UserID, true, true, true, false, true)?>
  226. </h2>
  227. </div>
  228. <div class="linkbox">
  229. <?php
  230. if (!$OwnProfile) {
  231. ?>
  232. <a href="inbox.php?action=compose&amp;to=<?=$UserID?>"
  233. class="brackets">Send message</a>
  234. <?php
  235. $DB->query("
  236. SELECT FriendID
  237. FROM friends
  238. WHERE UserID = '$LoggedUser[ID]'
  239. AND FriendID = '$UserID'");
  240. if (!$DB->has_results()) {
  241. ?>
  242. <a href="friends.php?action=add&amp;friendid=<?=$UserID?>&amp;auth=<?=$LoggedUser['AuthKey']?>"
  243. class="brackets">Add to friends</a>
  244. <?php
  245. } ?>
  246. <a href="reports.php?action=report&amp;type=user&amp;id=<?=$UserID?>"
  247. class="brackets">Report user</a>
  248. <?php
  249. }
  250. if (check_perms('users_edit_profiles', $Class) || $LoggedUser['ID'] == $UserID) {
  251. ?>
  252. <a href="user.php?action=edit&amp;userid=<?=$UserID?>"
  253. class="brackets">Settings</a>
  254. <?php
  255. }
  256. if ($LoggedUser['ID'] == $UserID) {
  257. ?>
  258. <a href="userhistory.php?action=useremail&userid=<?=$UserID?>"
  259. class="brackets">Email History</a>
  260. <a href="userhistory.php?action=userip&userid=<?=$UserID?>"
  261. class="brackets">IP History</a>
  262. <?php
  263. }
  264. if (check_perms('users_view_invites', $Class)) {
  265. ?>
  266. <a href="user.php?action=invite&amp;userid=<?=$UserID?>"
  267. class="brackets">Invites</a>
  268. <?php
  269. }
  270. if (check_perms('admin_manage_permissions', $Class)) {
  271. ?>
  272. <a href="user.php?action=permissions&amp;userid=<?=$UserID?>"
  273. class="brackets">Permissions</a>
  274. <?php
  275. }
  276. if ($LoggedUser['ID'] == $UserID || check_perms('users_view_ips', $Class)) {
  277. ?>
  278. <a href="user.php?action=sessions&amp;userid=<?=$UserID?>"
  279. class="brackets">Sessions</a>
  280. <?php
  281. }
  282. if (check_perms('admin_reports')) {
  283. ?>
  284. <a href="reportsv2.php?view=reporter&amp;id=<?=$UserID?>"
  285. class="brackets">Reports</a>
  286. <?php
  287. }
  288. if (check_perms('users_mod')) {
  289. ?>
  290. <a href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>"
  291. class="brackets">FL tokens</a>
  292. <?php
  293. }
  294. if (check_perms('admin_clear_cache') && check_perms('users_override_paranoia')) {
  295. ?>
  296. <a href="user.php?action=clearcache&amp;id=<?=$UserID?>"
  297. class="brackets">Clear cache</a>
  298. <?php
  299. }
  300. if (check_perms('users_mod')) {
  301. ?>
  302. <a href="#staff_tools" class="brackets">Jump to staff tools</a>
  303. <?php
  304. }
  305. ?>
  306. </div>
  307. <div class="sidebar">
  308. <?php
  309. if ($Avatar && Users::has_avatars_enabled()) {
  310. ?>
  311. <div class="box box_image box_image_avatar">
  312. <div class="head colhead_dark">User</div>
  313. <div class="avatar" align="center">
  314. <?= Users::show_avatar($Avatar, $UserID, $Username, $HeavyInfo['DisableAvatars'])?>
  315. </div>
  316. </div>
  317. <?php
  318. }
  319. $Badges = array_keys(Badges::get_badges($UserID));
  320. if (!empty($Badges)) { ?>
  321. <div class="box">
  322. <div class="head colhead_dark">Badges</div>
  323. <div class="pad">
  324. <?=Badges::display_badges($Badges, true)?>
  325. </div>
  326. </div>
  327. <?php
  328. }
  329. if (!$OwnProfile && !$LoggedUser['DisablePoints']) { ?>
  330. <div class="box point_gift_box">
  331. <div class="head colhead_dark">Send <?=BONUS_POINTS?>
  332. </div>
  333. <div class="pad">
  334. <form action="user.php" method="post">
  335. <input type="hidden" name="action" value="points">
  336. <input type="hidden" name="to" value="<?=$UserID?>">
  337. <div class="flex_input_container">
  338. <input type="text" name="amount" placeholder="Amount">
  339. <input type="submit" value="Send">
  340. </div>
  341. <textarea name="message" rows="2" placeholder="Message"></textarea>
  342. <label><input type="checkbox" name="adjust"> Adjust for tax?</label>
  343. </form>
  344. <p>Note: 10% of your gift is taken as tax.</p>
  345. </div>
  346. </div>
  347. <?php } ?>
  348. <div class="box box_info box_userinfo_stats">
  349. <div class="head colhead_dark">Statistics</div>
  350. <ul class="stats nobullet">
  351. <li>Joined: <?=$JoinedDate?>
  352. </li>
  353. <?php if (($Override = check_paranoia_here('lastseen'))) { ?>
  354. <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Last
  355. seen: <?=$LastAccess?>
  356. </li>
  357. <?php
  358. }
  359. if (($Override = check_paranoia_here('uploaded'))) {
  360. ?>
  361. <li
  362. class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>"
  363. title="<?=Format::get_size($Uploaded, 5)?>">Uploaded:
  364. <?=Format::get_size($Uploaded)?>
  365. </li>
  366. <?php
  367. }
  368. if (($Override = check_paranoia_here('downloaded'))) {
  369. ?>
  370. <li
  371. class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>"
  372. title="<?=Format::get_size($Downloaded, 5)?>">Downloaded:
  373. <?=Format::get_size($Downloaded)?>
  374. </li>
  375. <?php
  376. }
  377. if (($Override = check_paranoia_here('ratio'))) {
  378. ?>
  379. <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Ratio:
  380. <?=Format::get_ratio_html($Uploaded, $Downloaded)?>
  381. </li>
  382. <?php
  383. }
  384. if (($Override = check_paranoia_here('requiredratio')) && isset($RequiredRatio)) {
  385. ?>
  386. <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Required
  387. Ratio: <span class="tooltip"
  388. title="<?=number_format((double)$RequiredRatio, 5)?>"><?=number_format((double)$RequiredRatio, 2)?></span></li>
  389. <?php
  390. }
  391. if (($Override = check_paranoia_here('downloaded'))) {
  392. ?>
  393. <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Total
  394. Seeding: <span class="tooltip"
  395. title="<?=Format::get_size($TotalSeeding)?>"><?=Format::get_size($TotalSeeding)?>
  396. </li>
  397. <?php
  398. }
  399. if ($OwnProfile || ($Override = check_paranoia_here(false)) || check_perms('users_mod')) {
  400. ?>
  401. <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>><a
  402. href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>">Tokens</a>:
  403. <?=number_format($FLTokens)?>
  404. </li>
  405. <?php
  406. }
  407. if (($OwnProfile || check_perms('users_mod')) && $Warned) {
  408. ?>
  409. <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Warning
  410. expires in: <?=time_diff((date('Y-m-d H:i', strtotime($Warned))))?>
  411. </li>
  412. <?php
  413. } ?>
  414. </ul>
  415. </div>
  416. <?php
  417. if (check_paranoia_here('requestsfilled_count') || check_paranoia_here('requestsfilled_bounty')) {
  418. $DB->query("
  419. SELECT
  420. COUNT(DISTINCT r.ID),
  421. SUM(rv.Bounty)
  422. FROM requests AS r
  423. LEFT JOIN requests_votes AS rv ON r.ID = rv.RequestID
  424. WHERE r.FillerID = $UserID");
  425. list($RequestsFilled, $TotalBounty) = $DB->next_record();
  426. } else {
  427. $RequestsFilled = $TotalBounty = 0;
  428. }
  429. if (check_paranoia_here('requestsvoted_count') || check_paranoia_here('requestsvoted_bounty')) {
  430. $DB->query("
  431. SELECT COUNT(RequestID), SUM(Bounty)
  432. FROM requests_votes
  433. WHERE UserID = $UserID");
  434. list($RequestsVoted, $TotalSpent) = $DB->next_record();
  435. $DB->query("
  436. SELECT COUNT(r.ID), SUM(rv.Bounty)
  437. FROM requests AS r
  438. LEFT JOIN requests_votes AS rv ON rv.RequestID = r.ID AND rv.UserID = r.UserID
  439. WHERE r.UserID = $UserID");
  440. list($RequestsCreated, $RequestsCreatedSpent) = $DB->next_record();
  441. } else {
  442. $RequestsVoted = $TotalSpent = $RequestsCreated = $RequestsCreatedSpent = 0;
  443. }
  444. if (check_paranoia_here('uploads+')) {
  445. $DB->query("
  446. SELECT COUNT(ID)
  447. FROM torrents
  448. WHERE UserID = '$UserID'");
  449. list($Uploads) = $DB->next_record();
  450. } else {
  451. $Uploads = 0;
  452. }
  453. if (check_paranoia_here('artistsadded')) {
  454. $DB->query("
  455. SELECT COUNT(DISTINCT ArtistID)
  456. FROM torrents_artists
  457. WHERE UserID = $UserID");
  458. list($ArtistsAdded) = $DB->next_record();
  459. } else {
  460. $ArtistsAdded = 0;
  461. }
  462. //Do the ranks
  463. $UploadedRank = UserRank::get_rank('uploaded', $Uploaded);
  464. $DownloadedRank = UserRank::get_rank('downloaded', $Downloaded);
  465. $UploadsRank = UserRank::get_rank('uploads', $Uploads);
  466. $RequestRank = UserRank::get_rank('requests', $RequestsFilled);
  467. $PostRank = UserRank::get_rank('posts', $ForumPosts);
  468. $BountyRank = UserRank::get_rank('bounty', $TotalSpent);
  469. $ArtistsRank = UserRank::get_rank('artists', $ArtistsAdded);
  470. if ($Downloaded == 0) {
  471. $Ratio = 1;
  472. } elseif ($Uploaded == 0) {
  473. $Ratio = 0.5;
  474. } else {
  475. $Ratio = round($Uploaded / $Downloaded, 2);
  476. }
  477. $OverallRank = UserRank::overall_score($UploadedRank, $DownloadedRank, $UploadsRank, $RequestRank, $PostRank, $BountyRank, $ArtistsRank, $Ratio);
  478. ?>
  479. <div class="box box_info box_userinfo_percentile">
  480. <div class="head colhead_dark">Percentile Rankings (hover for values)</div>
  481. <ul class="stats nobullet">
  482. <?php if (($Override = check_paranoia_here('uploaded'))) { ?>
  483. <li
  484. class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>"
  485. title="<?=Format::get_size($Uploaded)?>">Data uploaded:
  486. <?=$UploadedRank === false ? 'Server busy' : number_format($UploadedRank)?>
  487. </li>
  488. <?php
  489. }
  490. if (($Override = check_paranoia_here('downloaded'))) { ?>
  491. <li
  492. class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>"
  493. title="<?=Format::get_size($Downloaded)?>">Data downloaded:
  494. <?=$DownloadedRank === false ? 'Server busy' : number_format($DownloadedRank)?>
  495. </li>
  496. <?php
  497. }
  498. if (($Override = check_paranoia_here('uploads+'))) { ?>
  499. <li
  500. class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>"
  501. title="<?=number_format($Uploads)?>">Torrents uploaded:
  502. <?=$UploadsRank === false ? 'Server busy' : number_format($UploadsRank)?>
  503. </li>
  504. <?php
  505. }
  506. if (($Override = check_paranoia_here('requestsfilled_count'))) { ?>
  507. <li
  508. class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>"
  509. title="<?=number_format($RequestsFilled)?>">Requests
  510. filled: <?=$RequestRank === false ? 'Server busy' : number_format($RequestRank)?>
  511. </li>
  512. <?php
  513. }
  514. if (($Override = check_paranoia_here('requestsvoted_bounty'))) { ?>
  515. <li
  516. class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>"
  517. title="<?=Format::get_size($TotalSpent)?>">Bounty spent:
  518. <?=$BountyRank === false ? 'Server busy' : number_format($BountyRank)?>
  519. </li>
  520. <?php } ?>
  521. <li class="tooltip" title="<?=number_format($ForumPosts)?>">
  522. Posts made: <?=$PostRank === false ? 'Server busy' : number_format($PostRank)?>
  523. </li>
  524. <?php if (($Override = check_paranoia_here('artistsadded'))) { ?>
  525. <li
  526. class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>"
  527. title="<?=number_format($ArtistsAdded)?>">Artists added:
  528. <?=$ArtistsRank === false ? 'Server busy' : number_format($ArtistsRank)?>
  529. </li>
  530. <?php
  531. }
  532. if (check_paranoia_here(array('uploaded', 'downloaded', 'uploads+', 'requestsfilled_count', 'requestsvoted_bounty', 'artistsadded'))) { ?>
  533. <li><strong>Overall rank: <?=$OverallRank === false ? 'Server busy' : number_format($OverallRank)?></strong>
  534. </li>
  535. <?php } ?>
  536. </ul>
  537. </div>
  538. <?php
  539. if (check_perms('users_mod', $Class) || check_perms('users_view_ips', $Class) || check_perms('users_view_keys', $Class)) {
  540. $DB->query("
  541. SELECT COUNT(*)
  542. FROM users_history_passwords
  543. WHERE UserID = '$UserID'");
  544. list($PasswordChanges) = $DB->next_record();
  545. if (check_perms('users_view_keys', $Class)) {
  546. $DB->query("
  547. SELECT COUNT(*)
  548. FROM users_history_passkeys
  549. WHERE UserID = '$UserID'");
  550. list($PasskeyChanges) = $DB->next_record();
  551. }
  552. if (check_perms('users_view_ips', $Class)) {
  553. $DB->query("
  554. SELECT COUNT(DISTINCT IP)
  555. FROM users_history_ips
  556. WHERE UserID = '$UserID'");
  557. list($IPChanges) = $DB->next_record();
  558. $DB->query("
  559. SELECT COUNT(DISTINCT IP)
  560. FROM xbt_snatched
  561. WHERE uid = '$UserID'
  562. AND IP != ''");
  563. list($TrackerIPs) = $DB->next_record();
  564. }
  565. if (check_perms('users_view_email', $Class)) {
  566. $DB->query("
  567. SELECT COUNT(*)
  568. FROM users_history_emails
  569. WHERE UserID = '$UserID'");
  570. list($EmailChanges) = $DB->next_record();
  571. } ?>
  572. <div class="box box_info box_userinfo_history">
  573. <div class="head colhead_dark">History</div>
  574. <ul class="stats nobullet">
  575. <?php if (check_perms('users_view_email', $Class)) { ?>
  576. <li>Emails: <?=number_format($EmailChanges)?> <a
  577. href="userhistory.php?action=email2&amp;userid=<?=$UserID?>"
  578. class="brackets">View</a>&nbsp;<a
  579. href="userhistory.php?action=email&amp;userid=<?=$UserID?>"
  580. class="brackets">Legacy view</a></li>
  581. <?php
  582. }
  583. if (check_perms('users_view_ips', $Class)) {
  584. ?>
  585. <li>IPs: <?=number_format($IPChanges)?> <a
  586. href="userhistory.php?action=ips&amp;userid=<?=$UserID?>"
  587. class="brackets">View</a>&nbsp;<a
  588. href="userhistory.php?action=ips&amp;userid=<?=$UserID?>&amp;usersonly=1"
  589. class="brackets">View users</a></li>
  590. <?php if (check_perms('users_view_ips', $Class) && check_perms('users_mod', $Class)) { ?>
  591. <li>Tracker IPs: <?=number_format($TrackerIPs)?> <a
  592. href="userhistory.php?action=tracker_ips&amp;userid=<?=$UserID?>"
  593. class="brackets">View</a></li>
  594. <?php
  595. }
  596. }
  597. if (check_perms('users_view_keys', $Class)) {
  598. ?>
  599. <li>Passkeys: <?=number_format($PasskeyChanges)?> <a
  600. href="userhistory.php?action=passkeys&amp;userid=<?=$UserID?>"
  601. class="brackets">View</a></li>
  602. <?php
  603. }
  604. if (check_perms('users_mod', $Class)) {
  605. ?>
  606. <li>Passwords: <?=number_format($PasswordChanges)?> <a
  607. href="userhistory.php?action=passwords&amp;userid=<?=$UserID?>"
  608. class="brackets">View</a></li>
  609. <li>Stats: N/A <a
  610. href="userhistory.php?action=stats&amp;userid=<?=$UserID?>"
  611. class="brackets">View</a></li>
  612. <?php
  613. } ?>
  614. </ul>
  615. </div>
  616. <?php
  617. } ?>
  618. <div class="box box_info box_userinfo_personal">
  619. <div class="head colhead_dark">Personal</div>
  620. <ul class="stats nobullet">
  621. <li>Class: <?=$ClassLevels[$Class]['Name']?>
  622. </li>
  623. <?php
  624. $UserInfo = Users::user_info($UserID);
  625. if (!empty($UserInfo['ExtraClasses'])) {
  626. ?>
  627. <li>
  628. <ul class="stats">
  629. <?php
  630. foreach ($UserInfo['ExtraClasses'] as $PermID => $Val) {
  631. ?>
  632. <li><?=$Classes[$PermID]['Name']?>
  633. </li>
  634. <?php
  635. } ?>
  636. </ul>
  637. </li>
  638. <?php
  639. }
  640. // An easy way for people to measure the paranoia of a user, for e.g. contest eligibility
  641. if ($ParanoiaLevel == 0) {
  642. $ParanoiaLevelText = 'Off';
  643. } elseif ($ParanoiaLevel == 1) {
  644. $ParanoiaLevelText = 'Very Low';
  645. } elseif ($ParanoiaLevel <= 5) {
  646. $ParanoiaLevelText = 'Low';
  647. } elseif ($ParanoiaLevel <= 20) {
  648. $ParanoiaLevelText = 'High';
  649. } else {
  650. $ParanoiaLevelText = 'Very high';
  651. }
  652. ?>
  653. <li>Paranoia level: <span class="tooltip"
  654. title="<?=$ParanoiaLevel?>"><?=$ParanoiaLevelText?></span></li>
  655. <?php if (check_perms('users_view_email', $Class) || $OwnProfile) { ?>
  656. <li>Email: <a href="mailto:<?=display_str($Email)?>"><?=display_str($Email)?></a>
  657. <?php if (check_perms('users_view_email', $Class)) { ?>
  658. <a href="user.php?action=search&amp;email_history=on&amp;email=<?=display_str($Email)?>"
  659. title="Search" class="brackets tooltip">S</a>
  660. <?php } ?>
  661. </li>
  662. <?php }
  663. if (check_perms('users_view_ips', $Class)) {
  664. $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]'; ?>
  665. <li>IP: <?=Tools::display_ip($IP)?>
  666. </li>
  667. <li>Host: <?=Tools::get_host_by_ajax($IP)?>
  668. </li>
  669. <?php
  670. }
  671. if (check_perms('users_view_keys', $Class) || $OwnProfile) {
  672. ?>
  673. <li>Passkey: <a href="#" id="passkey"
  674. onclick="togglePassKey('<?=display_str($torrent_pass)?>'); return false;"
  675. class="brackets">View</a></li>
  676. <?php
  677. }
  678. if (check_perms('users_view_invites')) {
  679. if (!$InviterID) {
  680. $Invited = '<span style="font-style: italic;">Nobody</span>';
  681. } else {
  682. $Invited = "<a href=\"user.php?id=$InviterID\">$InviterName</a>";
  683. } ?>
  684. <li>Invited by: <?=$Invited?>
  685. </li>
  686. <li>Invites:
  687. <?php
  688. $DB->query("
  689. SELECT COUNT(InviterID)
  690. FROM invites
  691. WHERE InviterID = '$UserID'");
  692. list($Pending) = $DB->next_record();
  693. if ($DisableInvites) {
  694. echo 'X';
  695. } else {
  696. echo number_format($Invites);
  697. }
  698. echo " ($Pending)"
  699. ?>
  700. </li>
  701. <?php
  702. }
  703. if (!isset($SupportFor)) {
  704. $DB->query('
  705. SELECT SupportFor
  706. FROM users_info
  707. WHERE UserID = '.$LoggedUser['ID']);
  708. list($SupportFor) = $DB->next_record();
  709. }
  710. if ($Override = check_perms('users_mod') || $OwnProfile || !empty($SupportFor)) {
  711. ?>
  712. <li<?=(($Override === 2 || $SupportFor) ? ' class="paranoia_override"' : '')?>>Clients:
  713. <?php
  714. $DB->query("
  715. SELECT DISTINCT useragent
  716. FROM xbt_files_users
  717. WHERE uid = $UserID");
  718. $Clients = $DB->collect(0);
  719. echo implode('; ', $Clients); ?>
  720. </li>
  721. <?php
  722. }
  723. ?>
  724. </ul>
  725. </div>
  726. <?php
  727. include(SERVER_ROOT.'/sections/user/community_stats.php');
  728. DonationsView::render_donor_stats($UserID);
  729. ?>
  730. </div>
  731. <div class="main_column">
  732. <?php
  733. if ($RatioWatchEnds && (time() < strtotime($RatioWatchEnds)) && ($Downloaded * $RequiredRatio) > $Uploaded) {
  734. ?>
  735. <div class="box">
  736. <div class="head">Ratio watch</div>
  737. <div class="pad">This user is currently on ratio watch and must upload <?=Format::get_size(($Downloaded * $RequiredRatio) - $Uploaded)?> in
  738. the next <?=time_diff($RatioWatchEnds)?>, or their leeching
  739. privileges will be revoked. Amount downloaded while on ratio watch: <?=Format::get_size($Downloaded - $RatioWatchDownload)?>
  740. </div>
  741. </div>
  742. <?php
  743. }
  744. ?>
  745. <div class="box">
  746. <div class="head">
  747. <?=!empty($InfoTitle) ? $InfoTitle : 'Profile';?>
  748. <span class="float_right"><a data-toggle-target="#profilediv" data-toggle-replace="Show"
  749. class="brackets">Hide</a></span>&nbsp;
  750. </div>
  751. <div class="pad profileinfo" id="profilediv">
  752. <?php
  753. if (!$Info) {
  754. ?>
  755. This profile is currently empty.
  756. <?php
  757. } else {
  758. echo Text::full_format($Info);
  759. }
  760. ?>
  761. </div>
  762. </div>
  763. <?php
  764. DonationsView::render_profile_rewards($EnabledRewards, $ProfileRewards);
  765. if (check_paranoia_here('snatched')) {
  766. $RecentSnatches = $Cache->get_value("recent_snatches_$UserID");
  767. if ($RecentSnatches === false) {
  768. $DB->query("
  769. SELECT
  770. g.`id`,
  771. g.`title`,
  772. g.`subject`,
  773. g.`object`,
  774. g.`picture`
  775. FROM xbt_snatched AS s
  776. INNER JOIN torrents AS t ON t.ID = s.fid
  777. INNER JOIN torrents_group AS g ON t.GroupID = g.`id`
  778. WHERE s.uid = '$UserID'
  779. AND g.`picture` != ''
  780. GROUP BY g.`id`,s.tstamp
  781. ORDER BY s.tstamp DESC
  782. LIMIT 5");
  783. $RecentSnatches = $DB->to_array();
  784. $Artists = Artists::get_artists($DB->collect('ID'));
  785. foreach ($RecentSnatches as $Key => $SnatchInfo) {
  786. $RecentSnatches[$Key]['Artist'] = Artists::display_artists($Artists[$SnatchInfo['ID']], false, true);
  787. }
  788. $Cache->cache_value("recent_snatches_$UserID", $RecentSnatches, 0); //inf cache
  789. }
  790. if (!empty($RecentSnatches)) {
  791. ?>
  792. <div class="box" id="recent_snatches">
  793. <div class="head">
  794. Recent Snatches
  795. <span class="float_right"><a
  796. onclick="$('#recent_snatches_images').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); wall('#recent_snatches_images', '.collage_image', [2,3]); return false;"
  797. class="brackets">Show</a></span>&nbsp;
  798. </div>
  799. <div id="recent_snatches_images" class="collage_images hidden">
  800. <?php foreach ($RecentSnatches as $RS) {
  801. $RSName = empty($RS['Name']) ? (empty($RS['Title2']) ? $RS['NameJP'] : $RS['Title2']) : $RS['Name']; ?>
  802. <div style='width: 100px;' class='collage_image'>
  803. <a
  804. href="torrents.php?id=<?=$RS['ID']?>">
  805. <img class="tooltip"
  806. title="<?=display_str($RS['Artist'])?><?=display_str($RSName)?>"
  807. src="<?=ImageTools::process($RS['WikiImage'], 'thumb')?>"
  808. alt="<?=display_str($RS['Artist'])?><?=display_str($RSName)?>"
  809. width="100%" />
  810. </a>
  811. </div>
  812. <?php
  813. } ?>
  814. </div>
  815. </div>
  816. <?php
  817. }
  818. }
  819. if (check_paranoia_here('uploads')) {
  820. $RecentUploads = $Cache->get_value("recent_uploads_$UserID");
  821. if ($RecentUploads === false) {
  822. $DB->query("
  823. SELECT
  824. g.`id`,
  825. g.`title`,
  826. g.`subject`,
  827. g.`object`,
  828. g.`picture`
  829. FROM torrents_group AS g
  830. INNER JOIN torrents AS t ON t.GroupID = g.`id`
  831. WHERE t.UserID = '$UserID'
  832. AND g.`picture` != ''
  833. GROUP BY g.`id`,t.Time
  834. ORDER BY t.Time DESC
  835. LIMIT 5");
  836. $RecentUploads = $DB->to_array();
  837. $Artists = Artists::get_artists($DB->collect('ID'));
  838. foreach ($RecentUploads as $Key => $UploadInfo) {
  839. $RecentUploads[$Key]['Artist'] = Artists::display_artists($Artists[$UploadInfo['ID']], false, true);
  840. }
  841. $Cache->cache_value("recent_uploads_$UserID", $RecentUploads, 0); // inf cache
  842. }
  843. if (!empty($RecentUploads)) {
  844. ?>
  845. <div class="box" id="recent_uploads">
  846. <div class="head">
  847. Recent Uploads
  848. <span class="float_right"><a
  849. onclick="$('#recent_uploads_images').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); wall('#recent_uploads_images', '.collage_image', [2,3]); return false;"
  850. class="brackets">Show</a></span>&nbsp;
  851. </div>
  852. <div id="recent_uploads_images" class="collage_images hidden">
  853. <?php foreach ($RecentUploads as $RU) {
  854. $RUName = empty($RU['Name']) ? (empty($RU['Title2']) ? $RU['NameJP'] : $RU['Title2']) : $RU['Name']; ?>
  855. <div style='width: 100px;' class='collage_image'>
  856. <a
  857. href="torrents.php?id=<?=$RU['ID']?>">
  858. <img class="tooltip"
  859. title="<?=$RU['Artist']?><?=$RUName?>"
  860. src="<?=ImageTools::process($RU['WikiImage'], 'thumb')?>"
  861. alt="<?=$RU['Artist']?><?=$RUName?>"
  862. width="100%" />
  863. </a>
  864. </div>
  865. <?php
  866. } ?>
  867. </div>
  868. </div>
  869. <?php
  870. }
  871. }
  872. $DB->query("
  873. SELECT ID, Name
  874. FROM collages
  875. WHERE UserID = '$UserID'
  876. AND CategoryID = '0'
  877. AND Deleted = '0'
  878. ORDER BY Featured DESC,
  879. Name ASC");
  880. $Collages = $DB->to_array(false, MYSQLI_NUM, false);
  881. foreach ($Collages as $CollageInfo) {
  882. list($CollageID, $CName) = $CollageInfo;
  883. $DB->query("
  884. SELECT ct.GroupID,
  885. tg.`picture`,
  886. tg.`category_id`
  887. FROM collages_torrents AS ct
  888. JOIN torrents_group AS tg ON tg.`id` = ct.GroupID
  889. WHERE ct.CollageID = '$CollageID'
  890. ORDER BY ct.Sort
  891. LIMIT 5");
  892. $Collage = $DB->to_array(false, MYSQLI_ASSOC, false); ?>
  893. <div class="box" id="collage<?=$CollageID?>_box">
  894. <div class="head">
  895. <?=display_str($CName)?> - <a
  896. href="collages.php?id=<?=$CollageID?>" class="brackets">See
  897. full</a>
  898. <span class="float_right">
  899. <a data-toggle-target="#collage<?=$CollageID?>_box .collage_images"
  900. data-toggle-replace="Show" class="brackets">Hide</a>
  901. </span>
  902. </div>
  903. <div id="user_collage_images" class="collage_images" data-wall-child=".collage_image" data-wall-size="5">
  904. <?php foreach ($Collage as $C) {
  905. $Group = Torrents::get_groups(array($C['GroupID']), true, true, false);
  906. extract(Torrents::array_group($Group[$C['GroupID']]));
  907. if (!$C['WikiImage']) {
  908. $C['WikiImage'] = STATIC_SERVER.'common/noartwork/music.png';
  909. }
  910. $Name = '';
  911. $Name .= Artists::display_artists($Artists, false, true);
  912. $Name .= $GroupName; ?>
  913. <div class="collage_image">
  914. <a href="torrents.php?id=<?=$GroupID?>">
  915. <img class="tooltip" title="<?=$Name?>"
  916. src="<?=ImageTools::process($C['WikiImage'], 'thumb')?>"
  917. alt="<?=$Name?>" width="100%" />
  918. </a>
  919. </div>
  920. <?php
  921. } ?>
  922. </div>
  923. </div>
  924. <?php
  925. }
  926. ?>
  927. <!-- for the "jump to staff tools" button -->
  928. <a id="staff_tools"></a>
  929. <?php
  930. // Linked accounts
  931. if (check_perms('users_mod')) {
  932. include(SERVER_ROOT.'/sections/user/linkedfunctions.php');
  933. user_dupes_table($UserID);
  934. }
  935. if ((check_perms('users_view_invites')) && $Invited > 0) {
  936. include(SERVER_ROOT.'/classes/invite_tree.class.php');
  937. $Tree = new INVITE_TREE($UserID, array('visible' => false)); ?>
  938. <div class="box" id="invitetree_box">
  939. <div class="head">
  940. Invite Tree <span class="float_right"><a data-toggle-target="#invitetree" class="brackets">Toggle</a></span>
  941. </div>
  942. <div id="invitetree" class="hidden">
  943. <?php $Tree->make_tree(); ?>
  944. </div>
  945. </div>
  946. </div>
  947. <?php
  948. }
  949. if (check_perms('users_mod')) {
  950. DonationsView::render_donation_history(Donations::get_donation_history($UserID));
  951. }
  952. // Requests
  953. if (empty($LoggedUser['DisableRequests']) && check_paranoia_here('requestsvoted_list')) {
  954. $SphQL = new SphinxqlQuery();
  955. $SphQLResult = $SphQL->select('id, votes, bounty')
  956. ->from('requests, requests_delta')
  957. ->where('userid', $UserID)
  958. ->where('torrentid', 0)
  959. ->order_by('votes', 'desc')
  960. ->order_by('bounty', 'desc')
  961. ->limit(0, 100, 100) // Limit to 100 requests
  962. ->query();
  963. if ($SphQLResult->has_results()) {
  964. $SphRequests = $SphQLResult->to_array('id', MYSQLI_ASSOC); ?>
  965. <div class="box" id="requests_box">
  966. <div class="head">
  967. Requests <span class="float_right"><a data-toggle-target="#requests" class="brackets">Show</a></span>
  968. </div>
  969. <div id="requests" class="hidden">
  970. <table cellpadding="6" cellspacing="1" border="0" width="100%">
  971. <tr class="colhead_dark">
  972. <td style="width: 48%;">
  973. <strong>Request Name</strong>
  974. </td>
  975. <td>
  976. <strong>Vote</strong>
  977. </td>
  978. <td>
  979. <strong>Bounty</strong>
  980. </td>
  981. <td>
  982. <strong>Added</strong>
  983. </td>
  984. </tr>
  985. <?php
  986. $Requests = Requests::get_requests(array_keys($SphRequests));
  987. foreach ($SphRequests as $RequestID => $SphRequest) {
  988. $Request = $Requests[$RequestID];
  989. $VotesCount = $SphRequest['votes'];
  990. $Bounty = $SphRequest['bounty'] * 1024; // Sphinx stores bounty in kB
  991. $CategoryName = $Categories[$Request['CategoryID'] - 1];
  992. if ($CategoryName == 'Music') {
  993. $ArtistForm = Requests::get_artists($RequestID);
  994. $ArtistLink = Artists::display_artists($ArtistForm, true, true);
  995. $FullName = "$ArtistLink<a href=\"requests.php?action=view&amp;id=$RequestID\">$Request[Title] [$Request[Year]]</a>";
  996. } elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
  997. $FullName = "<a href=\"requests.php?action=view&amp;id=$RequestID\">$Request[Title] [$Request[Year]]</a>";
  998. } else {
  999. if (!$Request['Title']) {
  1000. $Request['Title'] = $Request['Title2'];
  1001. }
  1002. if (!$Request['Title']) {
  1003. $Request['Title'] = $Request['TitleJP'];
  1004. }
  1005. $FullName = "<a href=\"requests.php?action=view&amp;id=$RequestID\">$Request[Title]</a>";
  1006. } ?>
  1007. <tr class="row">
  1008. <td>
  1009. <?=$FullName ?>
  1010. <div class="tags">
  1011. <?php
  1012. $Tags = $Request['Tags'];
  1013. $TagList = [];
  1014. foreach ($Tags as $TagID => $TagName) {
  1015. $TagList[] = "<a href=\"requests.php?tags=$TagName\">".display_str($TagName).'</a>';
  1016. }
  1017. $TagList = implode(', ', $TagList); ?>
  1018. <?=$TagList?>
  1019. </div>
  1020. </td>
  1021. <td>
  1022. <span id="vote_count_<?=$RequestID?>"><?=$VotesCount?></span>
  1023. <?php if (check_perms('site_vote')) { ?>
  1024. &nbsp;&nbsp; <a
  1025. href="javascript:Vote(0, <?=$RequestID?>)"
  1026. class="brackets">+</a>
  1027. <?php } ?>
  1028. </td>
  1029. <td>
  1030. <span id="bounty_<?=$RequestID?>"><?=Format::get_size($Bounty)?></span>
  1031. </td>
  1032. <td>
  1033. <?=time_diff($Request['TimeAdded']) ?>
  1034. </td>
  1035. </tr>
  1036. <?php
  1037. } ?>
  1038. </table>
  1039. </div>
  1040. </div>
  1041. <?php
  1042. }
  1043. }
  1044. $IsFLS = isset($LoggedUser['ExtraClasses'][FLS_TEAM]);
  1045. if (check_perms('users_mod', $Class) || $IsFLS) {
  1046. $UserLevel = $LoggedUser['EffectiveClass'];
  1047. $DB->query("
  1048. SELECT
  1049. SQL_CALC_FOUND_ROWS
  1050. ID,
  1051. Subject,
  1052. Status,
  1053. Level,
  1054. AssignedToUser,
  1055. Date,
  1056. ResolverID
  1057. FROM staff_pm_conversations
  1058. WHERE UserID = $UserID
  1059. AND (Level <= $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
  1060. ORDER BY Date DESC");
  1061. if ($DB->has_results()) {
  1062. $StaffPMs = $DB->to_array(); ?>
  1063. <div class="box" id="staffpms_box">
  1064. <div class="head">
  1065. Staff PMs <a data-toggle-target="#staffpms" class="brackets float_right">Toggle</a>
  1066. </div>
  1067. <table width="100%" class="message_table hidden" id="staffpms">
  1068. <tr class="colhead">
  1069. <td>Subject</td>
  1070. <td>Date</td>
  1071. <td>Assigned to</td>
  1072. <td>Resolved by</td>
  1073. </tr>
  1074. <?php
  1075. foreach ($StaffPMs as $StaffPM) {
  1076. list($ID, $Subject, $Status, $Level, $AssignedToUser, $Date, $ResolverID) = $StaffPM;
  1077. // Get assigned
  1078. if ($AssignedToUser == '') {
  1079. // Assigned to class
  1080. $Assigned = ($Level == 0) ? 'First Line Support' : $ClassLevels[$Level]['Name'];
  1081. // No + on Sysops
  1082. if ($Assigned != 'Sysop') {
  1083. $Assigned .= '+';
  1084. }
  1085. } else {
  1086. // Assigned to user
  1087. $Assigned = Users::format_username($UserID, true, true, true, true);
  1088. }
  1089. if ($ResolverID) {
  1090. $Resolver = Users::format_username($ResolverID, true, true, true, true);
  1091. } else {
  1092. $Resolver = '(unresolved)';
  1093. } ?>
  1094. <tr>
  1095. <td><a
  1096. href="staffpm.php?action=viewconv&amp;id=<?=$ID?>"><?=display_str($Subject)?></a></td>
  1097. <td><?=time_diff($Date, 2, true)?>
  1098. </td>
  1099. <td><?=$Assigned?>
  1100. </td>
  1101. <td><?=$Resolver?>
  1102. </td>
  1103. </tr>
  1104. <?php
  1105. } ?>
  1106. </table>
  1107. </div>
  1108. <?php
  1109. }
  1110. }
  1111. // Displays a table of forum warnings viewable only to Forum Moderators
  1112. if ($LoggedUser['Class'] == 650 && check_perms('users_warn', $Class)) {
  1113. $DB->query("
  1114. SELECT Comment
  1115. FROM users_warnings_forums
  1116. WHERE UserID = '$UserID'");
  1117. list($ForumWarnings) = $DB->next_record();
  1118. if ($DB->has_results()) {
  1119. ?>
  1120. <div class="box">
  1121. <div class="head">Forum warnings</div>
  1122. <div class="pad">
  1123. <div id="forumwarningslinks" class="AdminComment" style="width: 98%;"><?=Text::full_format($ForumWarnings)?>
  1124. </div>
  1125. </div>
  1126. </div>
  1127. <?php
  1128. }
  1129. }
  1130. if (check_perms('users_mod', $Class)) { ?>
  1131. <form class="manage_form" name="user" id="form" action="user.php" method="post">
  1132. <input type="hidden" name="action" value="moderate" />
  1133. <input type="hidden" name="userid" value="<?=$UserID?>" />
  1134. <input type="hidden" name="auth"
  1135. value="<?=$LoggedUser['AuthKey']?>" />
  1136. <div class="box" id="staff_notes_box">
  1137. <div class="head">
  1138. Staff Notes
  1139. <a href="#" name="admincommentbutton" onclick="ChangeTo('text'); return false;" class="brackets">Edit</a>
  1140. <span class="float_right">
  1141. <a data-toggle-target="#staffnotes" class="brackets">Toggle</a>
  1142. </span>
  1143. </div>
  1144. <div id="staffnotes" class="pad">
  1145. <input type="hidden" name="comment_hash"
  1146. value="<?=$CommentHash?>" />
  1147. <div id="admincommentlinks" class="AdminComment" style="width: 98%;"><?=Text::full_format($AdminComment)?>
  1148. </div>
  1149. <textarea id="admincomment" onkeyup="resize('admincomment');" class="AdminComment hidden" name="AdminComment"
  1150. cols="65" rows="26"
  1151. style="width: 98%;"><?=display_str($AdminComment)?></textarea>
  1152. <a href="#" name="admincommentbutton" onclick="ChangeTo('text'); return false;" class="brackets">Toggle
  1153. edit</a>
  1154. <script type="text/javascript">
  1155. resize('admincomment');
  1156. </script>
  1157. </div>
  1158. </div>
  1159. <table class="layout box" id="user_info_box">
  1160. <tr class="colhead">
  1161. <td colspan="2">
  1162. User Information
  1163. </td>
  1164. </tr>
  1165. <?php if (check_perms('users_edit_usernames', $Class)) { ?>
  1166. <tr>
  1167. <td class="label">Username:</td>
  1168. <td><input type="text" size="20" name="Username"
  1169. value="<?=display_str($Username)?>" /></td>
  1170. </tr>
  1171. <?php
  1172. }
  1173. if (check_perms('users_edit_titles')) {
  1174. ?>
  1175. <tr>
  1176. <td class="label">Custom title:</td>
  1177. <td><input type="text" class="wide_input_text" name="Title"
  1178. value="<?=display_str($CustomTitle)?>" /></td>
  1179. </tr>
  1180. <?php
  1181. }
  1182. if (check_perms('users_promote_below', $Class) || check_perms('users_promote_to', $Class - 1)) {
  1183. ?>
  1184. <tr>
  1185. <td class="label">Primary class:</td>
  1186. <td>
  1187. <select name="Class">
  1188. <?php
  1189. foreach ($ClassLevels as $CurClass) {
  1190. if (check_perms('users_promote_below', $Class) && $CurClass['ID'] >= $LoggedUser['EffectiveClass']) {
  1191. break;
  1192. }
  1193. if ($CurClass['ID'] > $LoggedUser['EffectiveClass']) {
  1194. break;
  1195. }
  1196. if ($CurClass['Secondary']) {
  1197. continue;
  1198. }
  1199. if ($Class == $CurClass['Level']) {
  1200. $Selected = ' selected="selected"';
  1201. } else {
  1202. $Selected = '';
  1203. } ?>
  1204. <!--
  1205. pcs-comment-start bug
  1206. php-cs-fixer misinterpretation
  1207. -->
  1208. <option
  1209. value="<?=$CurClass['ID']?>"<?=$Selected?>><?=$CurClass['Name'].' ('.$CurClass['Level'].')'?>
  1210. </option>
  1211. <?php
  1212. } ?>
  1213. </select>
  1214. </td>
  1215. </tr>
  1216. <?php
  1217. }
  1218. if (check_perms('users_give_donor')) {
  1219. ?>
  1220. <tr>
  1221. <td class="label">Donor:</td>
  1222. <td><input type="checkbox" name="Donor" <?php if ($Donor==1) { ?> checked="checked"
  1223. <?php } ?> />
  1224. </td>
  1225. </tr>
  1226. <?php
  1227. }
  1228. if (check_perms('users_promote_below') || check_perms('users_promote_to')) { ?>
  1229. <tr>
  1230. <td class="label">Secondary classes:</td>
  1231. <td>
  1232. <?php
  1233. $DB->query("
  1234. SELECT p.ID, p.Name, l.UserID
  1235. FROM permissions AS p
  1236. LEFT JOIN users_levels AS l ON l.PermissionID = p.ID AND l.UserID = '$UserID'
  1237. WHERE p.Secondary = 1
  1238. ORDER BY p.Name");
  1239. $i = 0;
  1240. while (list($PermID, $PermName, $IsSet) = $DB->next_record()) {
  1241. $i++; ?>
  1242. <input type="checkbox" id="perm_<?=$PermID?>"
  1243. name="secondary_classes[]" value="<?=$PermID?>" <?php if ($IsSet) { ?> checked="checked"
  1244. <?php } ?> />&nbsp;<label
  1245. for="perm_<?=$PermID?>"
  1246. style="margin-right: 10px;"><?=$PermName?></label>
  1247. <?php if ($i % 3 == 0) {
  1248. echo "\t\t\t\t<br />\n";
  1249. }
  1250. } ?>
  1251. </td>
  1252. </tr>
  1253. <?php }
  1254. if (check_perms('users_make_invisible')) {
  1255. ?>
  1256. <tr>
  1257. <td class="label">Visible in peer lists:</td>
  1258. <td><input type="checkbox" name="Visible" <?php if ($Visible==1) { ?> checked="checked"
  1259. <?php } ?> />
  1260. </td>
  1261. </tr>
  1262. <?php
  1263. }
  1264. if (check_perms('users_edit_ratio', $Class) || (check_perms('users_edit_own_ratio') && $UserID == $LoggedUser['ID'])) {
  1265. ?>
  1266. <tr>
  1267. <td class="label tooltip" title="Upload amount in bytes. Also accepts e.g. +20GB or -35.6364MB on the end.">
  1268. Uploaded:</td>
  1269. <td>
  1270. <input type="hidden" name="OldUploaded"
  1271. value="<?=$Uploaded?>" />
  1272. <input type="text" size="20" name="Uploaded"
  1273. value="<?=$Uploaded?>" />
  1274. </td>
  1275. </tr>
  1276. <tr>
  1277. <td class="label tooltip" title="Download amount in bytes. Also accepts e.g. +20GB or -35.6364MB on the end.">
  1278. Downloaded:</td>
  1279. <td>
  1280. <input type="hidden" name="OldDownloaded"
  1281. value="<?=$Downloaded?>" />
  1282. <input type="text" size="20" name="Downloaded"
  1283. value="<?=$Downloaded?>" />
  1284. </td>
  1285. </tr>
  1286. <tr>
  1287. <td class="label"><?=BONUS_POINTS?>:</td>
  1288. <td>
  1289. <input type="text" size="20" name="BonusPoints"
  1290. value="<?=$BonusPoints?>" />
  1291. <?php
  1292. if (!$DisablePoints) {
  1293. $PointsRate = 0;
  1294. $getTorrents = $DB->query("
  1295. SELECT COUNT(DISTINCT x.fid) AS Torrents,
  1296. SUM(t.Size) AS Size,
  1297. SUM(xs.seedtime) AS Seedtime,
  1298. SUM(t.Seeders) AS Seeders
  1299. FROM users_main AS um
  1300. LEFT JOIN users_info AS i on um.ID = i.UserID
  1301. LEFT JOIN xbt_files_users AS x ON um.ID=x.uid
  1302. LEFT JOIN torrents AS t ON t.ID=x.fid
  1303. LEFT JOIN xbt_snatched AS xs ON x.uid=xs.uid AND x.fid=xs.fid
  1304. WHERE
  1305. um.ID = $UserID
  1306. AND um.Enabled = '1'
  1307. AND x.active = 1
  1308. AND x.completed = 0
  1309. AND x.Remaining = 0
  1310. GROUP BY um.ID");
  1311. if ($DB->has_results()) {
  1312. list($NumTorr, $TSize, $TTime, $TSeeds) = $DB->next_record();
  1313. $ENV = ENV::go();
  1314. $PointsRate = ($ENV->BP_COEFF + (0.55*($NumTorr * (sqrt(($TSize/$NumTorr)/1073741824) * pow(1.5, ($TTime/$NumTorr)/(24*365))))) / (max(1, sqrt(($TSeeds/$NumTorr)+4)/3)))**0.95;
  1315. }
  1316. $PointsRate = intval(max(min($PointsRate, ($PointsRate * 2) - ($BonusPoints/1440)), 0));
  1317. $PointsPerHour = number_format($PointsRate)." ".BONUS_POINTS."/hour";
  1318. $PointsPerDay = number_format($PointsRate*24)." ".BONUS_POINTS."/day";
  1319. } else {
  1320. $PointsPerHour = "0 ".BONUS_POINTS."/hour";
  1321. $PointsPerDay = BONUS_POINTS." disabled";
  1322. } ?>
  1323. <?=$PointsPerHour?> (<?=$PointsPerDay?>)
  1324. </td>
  1325. </tr>
  1326. <tr>
  1327. <td class="label tooltip" title="Enter a username.">Merge stats <strong>from:</strong></td>
  1328. <td>
  1329. <input type="text" size="40" name="MergeStatsFrom" />
  1330. </td>
  1331. </tr>
  1332. <tr>
  1333. <td class="label">Freeleech tokens:</td>
  1334. <td>
  1335. <input type="text" size="5" name="FLTokens"
  1336. value="<?=$FLTokens?>" />
  1337. </td>
  1338. </tr>
  1339. <?php
  1340. }
  1341. if (check_perms('users_edit_invites')) {
  1342. ?>
  1343. <tr>
  1344. <td class="label tooltip" title="Number of invites">Invites:</td>
  1345. <td><input type="text" size="5" name="Invites"
  1346. value="<?=$Invites?>" /></td>
  1347. </tr>
  1348. <?php
  1349. }
  1350. if (check_perms('admin_manage_fls') || (check_perms('users_mod') && $OwnProfile)) {
  1351. ?>
  1352. <tr>
  1353. <td class="label tooltip" title="This is the message shown in the right-hand column on /staff.php">FLS/Staff
  1354. remark:</td>
  1355. <td><input type="text" class="wide_input_text" name="SupportFor"
  1356. value="<?=display_str($SupportFor)?>" /></td>
  1357. </tr>
  1358. <?php
  1359. }
  1360. if (check_perms('users_edit_reset_keys')) {
  1361. ?>
  1362. <tr>
  1363. <td class="label">Reset:</td>
  1364. <td>
  1365. <input type="checkbox" name="ResetRatioWatch" id="ResetRatioWatch" /> <label for="ResetRatioWatch">Ratio
  1366. watch</label> |
  1367. <input type="checkbox" name="ResetPasskey" id="ResetPasskey" /> <label for="ResetPasskey">Passkey</label> |
  1368. <input type="checkbox" name="ResetAuthkey" id="ResetAuthkey" /> <label for="ResetAuthkey">Authkey</label> |
  1369. <input type="checkbox" name="ResetIPHistory" id="ResetIPHistory" /> <label for="ResetIPHistory">IP
  1370. history</label> |
  1371. <input type="checkbox" name="ResetEmailHistory" id="ResetEmailHistory" /> <label
  1372. for="ResetEmailHistory">Email history</label>
  1373. <br />
  1374. <input type="checkbox" name="ResetSnatchList" id="ResetSnatchList" /> <label for="ResetSnatchList">Snatch
  1375. list</label> |
  1376. <input type="checkbox" name="ResetDownloadList" id="ResetDownloadList" /> <label
  1377. for="ResetDownloadList">Download list</label>
  1378. </td>
  1379. </tr>
  1380. <?php
  1381. }
  1382. if (check_perms('users_edit_password')) {
  1383. ?>
  1384. <tr>
  1385. <td class="label">New password:</td>
  1386. <td>
  1387. <textarea id="password_display" name="password_display" rows="2" cols="50" onclick="this.select();"
  1388. readonly></textarea>
  1389. <button type="button" id="password_create" onclick="pwgen('password_display');">Generate</button>
  1390. </td>
  1391. </tr>
  1392. <?php
  1393. }
  1394. if (check_perms('users_edit_badges')) {
  1395. ?>
  1396. <tr id="user_badge_edit_tr">
  1397. <td class="label">Badges Owned:</td>
  1398. <td>
  1399. <?php
  1400. $AllBadges = Badges::get_all_badges();
  1401. $UserBadgeIDs = [];
  1402. foreach (array_keys(Badges::get_badges($UserID)) as $b) {
  1403. $UserBadgeIDs[] = $b;
  1404. }
  1405. $i = 0;
  1406. foreach (array_keys($AllBadges) as $BadgeID) {
  1407. ?><input type="checkbox" name="badges[]" class="badge_checkbox"
  1408. value="<?=$BadgeID?>" <?=(in_array($BadgeID, $UserBadgeIDs))?" checked":""?>/><?=Badges::display_badge($BadgeID, true)?>
  1409. <?php $i++;
  1410. if ($i % 8 == 0) {
  1411. echo "<br />";
  1412. }
  1413. } ?>
  1414. </td>
  1415. </tr>
  1416. <?php
  1417. } ?>
  1418. </table>
  1419. <?php if (check_perms('users_warn')) { ?>
  1420. <table class="layout box" id="warn_user_box">
  1421. <tr class="colhead">
  1422. <td colspan="2">
  1423. Warnings
  1424. </td>
  1425. </tr>
  1426. <tr>
  1427. <td class="label">Warned:</td>
  1428. <td>
  1429. <input type="checkbox" name="Warned" <?php if ($Warned) { ?> checked="checked"
  1430. <?php } ?> />
  1431. </td>
  1432. </tr>
  1433. <?php if (!$Warned) { ?>
  1434. <tr>
  1435. <td class="label">Expiration:</td>
  1436. <td>
  1437. <select name="WarnLength">
  1438. <option value="">---</option>
  1439. <option value="1">1 week</option>
  1440. <option value="2">2 weeks</option>
  1441. <option value="4">4 weeks</option>
  1442. <option value="8">8 weeks</option>
  1443. </select>
  1444. </td>
  1445. </tr>
  1446. <?php } else { ?>
  1447. <tr>
  1448. <td class="label">Extension:</td>
  1449. <td>
  1450. <select name="ExtendWarning" onchange="ToggleWarningAdjust(this);">
  1451. <option>---</option>
  1452. <option value="1">1 week</option>
  1453. <option value="2">2 weeks</option>
  1454. <option value="4">4 weeks</option>
  1455. <option value="8">8 weeks</option>
  1456. </select>
  1457. </td>
  1458. </tr>
  1459. <tr id="ReduceWarningTR">
  1460. <td class="label">Reduction:</td>
  1461. <td>
  1462. <select name="ReduceWarning">
  1463. <option>---</option>
  1464. <option value="1">1 week</option>
  1465. <option value="2">2 weeks</option>
  1466. <option value="4">4 weeks</option>
  1467. <option value="8">8 weeks</option>
  1468. </select>
  1469. </td>
  1470. </tr>
  1471. <?php } ?>
  1472. <tr>
  1473. <td class="label tooltip" title="This message *will* be sent to the user in the warning PM!">Warning reason:
  1474. </td>
  1475. <td>
  1476. <input type="text" class="wide_input_text" name="WarnReason" />
  1477. </td>
  1478. </tr>
  1479. <?php } ?>
  1480. </table>
  1481. <?php if (check_perms('users_disable_any')) { ?>
  1482. <table class="layout box">
  1483. <tr class="colhead">
  1484. <td colspan="2">
  1485. Lock Account
  1486. </td>
  1487. </tr>
  1488. <tr>
  1489. <td class="label">Lock Account:</td>
  1490. <td>
  1491. <input type="checkbox" name="LockAccount" id="LockAccount" <?php if ($LockedAccount) { ?> checked="checked"
  1492. <?php } ?>/>
  1493. </td>
  1494. </tr>
  1495. <tr>
  1496. <td class="label">Reason:</td>
  1497. <td>
  1498. <select name="LockReason">
  1499. <option value="---">---</option>
  1500. <option value="<?=STAFF_LOCKED?>" <?php if ($LockedAccount==STAFF_LOCKED) { ?> selected
  1501. <?php } ?>>Staff Lock
  1502. </option>
  1503. </select>
  1504. </td>
  1505. </tr>
  1506. </table>
  1507. <?php } ?>
  1508. <table class="layout box" id="user_privs_box">
  1509. <tr class="colhead">
  1510. <td colspan="2">
  1511. User Privileges
  1512. </td>
  1513. </tr>
  1514. <?php if (check_perms('users_disable_posts') || check_perms('users_disable_any')) {
  1515. $DB->query("
  1516. SELECT DISTINCT Email, IP, Time
  1517. FROM users_history_emails
  1518. WHERE UserID = $UserID
  1519. ORDER BY Time ASC");
  1520. $Emails = $DB->to_array(); ?>
  1521. <tr>
  1522. <td class="label">Disable:</td>
  1523. <td>
  1524. <input type="checkbox" name="DisablePosting" id="DisablePosting" <?php if ($DisablePosting==1) { ?>
  1525. checked="checked"
  1526. <?php } ?> /> <label for="DisablePosting">Posting</label>
  1527. <?php if (check_perms('users_disable_any')) { ?>
  1528. |
  1529. <input type="checkbox" name="DisableAvatar" id="DisableAvatar" <?php if ($DisableAvatar==1) { ?>
  1530. checked="checked"
  1531. <?php } ?> /> <label for="DisableAvatar">Avatar</label> |
  1532. <input type="checkbox" name="DisableForums" id="DisableForums" <?php if ($DisableForums==1) { ?>
  1533. checked="checked"
  1534. <?php } ?> /> <label for="DisableForums">Forums</label> |
  1535. <input type="checkbox" name="DisableIRC" id="DisableIRC" <?php if ($DisableIRC==1) { ?> checked="checked"
  1536. <?php } ?> /> <label for="DisableIRC">IRC</label> |
  1537. <input type="checkbox" name="DisablePM" id="DisablePM" <?php if ($DisablePM==1) { ?> checked="checked"
  1538. <?php } ?> /> <label for="DisablePM">PM</label> |
  1539. <br /><br />
  1540. <input type="checkbox" name="DisableLeech" id="DisableLeech" <?php if ($DisableLeech==0) { ?> checked="checked"
  1541. <?php } ?> /> <label for="DisableLeech">Leech</label> |
  1542. <input type="checkbox" name="DisableRequests" id="DisableRequests" <?php if ($DisableRequests==1) { ?>
  1543. checked="checked"
  1544. <?php } ?> /> <label
  1545. for="DisableRequests">Requests</label> |
  1546. <input type="checkbox" name="DisableUpload" id="DisableUpload" <?php if ($DisableUpload==1) { ?>
  1547. checked="checked"
  1548. <?php } ?> /> <label for="DisableUpload">Torrent
  1549. upload</label> |
  1550. <input type="checkbox" name="DisablePoints" id="DisablePoints" <?php if ($DisablePoints==1) { ?>
  1551. checked="checked"
  1552. <?php } ?> /> <label for="DisablePoints"><?=BONUS_POINTS?></label>
  1553. <br /><br />
  1554. <input type="checkbox" name="DisableTagging" id="DisableTagging" <?php if ($DisableTagging==1) { ?>
  1555. checked="checked"
  1556. <?php } ?> /> <label for="DisableTagging" class="tooltip"
  1557. title="This only disables a user's ability to delete tags.">Tagging</label> |
  1558. <input type="checkbox" name="DisableWiki" id="DisableWiki" <?php if ($DisableWiki==1) { ?> checked="checked"
  1559. <?php } ?> /> <label for="DisableWiki">Wiki</label> |
  1560. <input type="checkbox" name="DisablePromotion" id="DisablePromotion" <?php if ($DisablePromotion==1) { ?>
  1561. checked="checked"
  1562. <?php } ?> /> <label
  1563. for="DisablePromotion">Promotions</label> |
  1564. <input type="checkbox" name="DisableInvites" id="DisableInvites" <?php if ($DisableInvites==1) { ?>
  1565. checked="checked"
  1566. <?php } ?> /> <label for="DisableInvites">Invites</label>
  1567. </td>
  1568. </tr>
  1569. <tr>
  1570. <td class="label">Hacked:</td>
  1571. <td>
  1572. <input type="checkbox" name="SendHackedMail" id="SendHackedMail" /> <label for="SendHackedMail">Send hacked
  1573. account email</label> to
  1574. <select name="HackedEmail">
  1575. <?php
  1576. foreach ($Emails as $Email) {
  1577. list($Address, $IP) = $Email;
  1578. $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
  1579. $Address = apcu_exists('DBKEY') ? Crypto::decrypt($Address) : '[Encrypted]'; ?>
  1580. <option value="<?=display_str($Address)?>"><?=display_str($Address)?> - <?=display_str($IP)?>
  1581. </option>
  1582. <?php
  1583. } ?>
  1584. </select>
  1585. </td>
  1586. </tr>
  1587. <?php
  1588. }
  1589. }
  1590. if (check_perms('users_disable_any')) {
  1591. ?>
  1592. <tr>
  1593. <td class="label">Account:</td>
  1594. <td>
  1595. <select name="UserStatus">
  1596. <option value="0" <?php if ($Enabled=='0') { ?>
  1597. selected="selected"
  1598. <?php } ?>>Unconfirmed
  1599. </option>
  1600. <option value="1" <?php if ($Enabled=='1') { ?>
  1601. selected="selected"
  1602. <?php } ?>>Enabled
  1603. </option>
  1604. <option value="2" <?php if ($Enabled=='2') { ?>
  1605. selected="selected"
  1606. <?php } ?>>Disabled
  1607. </option>
  1608. <?php if (check_perms('users_delete_users')) { ?>
  1609. <optgroup label="-- WARNING --">
  1610. <option value="delete">Delete account</option>
  1611. </optgroup>
  1612. <?php } ?>
  1613. </select>
  1614. </td>
  1615. </tr>
  1616. <tr>
  1617. <td class="label">User reason:</td>
  1618. <td>
  1619. <input type="text" class="wide_input_text" name="UserReason" />
  1620. </td>
  1621. </tr>
  1622. <tr>
  1623. <td class="label tooltip" title="Enter a comma-delimited list of forum IDs.">Restricted forums:</td>
  1624. <td>
  1625. <input type="text" class="wide_input_text" name="RestrictedForums"
  1626. value="<?=display_str($RestrictedForums)?>" />
  1627. </td>
  1628. </tr>
  1629. <tr>
  1630. <td class="label tooltip" title="Enter a comma-delimited list of forum IDs.">Extra forums:</td>
  1631. <td>
  1632. <input type="text" class="wide_input_text" name="PermittedForums"
  1633. value="<?=display_str($PermittedForums)?>" />
  1634. </td>
  1635. </tr>
  1636. <?php
  1637. } ?>
  1638. </table>
  1639. <?php if (check_perms('users_logout')) { ?>
  1640. <table class="layout box" id="session_box">
  1641. <tr class="colhead">
  1642. <td colspan="2">
  1643. Session
  1644. </td>
  1645. </tr>
  1646. <tr>
  1647. <td class="label">Reset session:</td>
  1648. <td><input type="checkbox" name="ResetSession" id="ResetSession" /></td>
  1649. </tr>
  1650. <tr>
  1651. <td class="label">Log out:</td>
  1652. <td><input type="checkbox" name="LogOut" id="LogOut" /></td>
  1653. </tr>
  1654. </table>
  1655. <?php
  1656. }
  1657. if (check_perms('users_mod')) {
  1658. DonationsView::render_mod_donations($UserID);
  1659. }
  1660. ?>
  1661. <table class="layout box" id="submit_box">
  1662. <tr class="colhead">
  1663. <td colspan="2">
  1664. Submit
  1665. </td>
  1666. </tr>
  1667. <tr>
  1668. <td class="label tooltip" title="This message will be entered into staff notes only.">Reason:</td>
  1669. <td>
  1670. <textarea rows="2" class="wide_input_text" name="Reason" id="Reason" onkeyup="resize('Reason');"></textarea>
  1671. </td>
  1672. </tr>
  1673. <tr>
  1674. <td class="label">Paste user stats:</td>
  1675. <td>
  1676. <button type="button" id="paster">Paste</button>
  1677. </td>
  1678. </tr>
  1679. <tr>
  1680. <td align="right" colspan="2">
  1681. <input type="submit" value="Save changes" />
  1682. </td>
  1683. </tr>
  1684. </table>
  1685. </form>
  1686. <?php
  1687. }
  1688. ?>
  1689. </div>
  1690. </div>
  1691. <?php View::show_footer();