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 58KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795
  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->prepare_query("
  769. SELECT
  770. g.`id`,
  771. g.`title`,
  772. g.`subject`,
  773. g.`object`,
  774. g.`picture`
  775. FROM
  776. `xbt_snatched` AS s
  777. INNER JOIN `torrents` AS t
  778. ON
  779. t.`ID` = s.`fid`
  780. INNER JOIN `torrents_group` AS g
  781. ON
  782. t.`GroupID` = g.`id`
  783. WHERE
  784. s.`uid` = '$UserID' AND g.`picture` != ''
  785. GROUP BY
  786. g.`id`,
  787. s.`tstamp`
  788. ORDER BY
  789. s.`tstamp`
  790. DESC
  791. LIMIT 5
  792. ");
  793. $DB->exec_prepared_query();
  794. $RecentSnatches = $DB->to_array();
  795. $Artists = Artists::get_artists($DB->collect('ID'));
  796. foreach ($RecentSnatches as $Key => $SnatchInfo) {
  797. $RecentSnatches[$Key]['Artist'] = Artists::display_artists($Artists[$SnatchInfo['ID']], false, true);
  798. }
  799. $Cache->cache_value("recent_snatches_$UserID", $RecentSnatches, 0); //inf cache
  800. }
  801. if (!empty($RecentSnatches)) {
  802. ?>
  803. <div class="box" id="recent_snatches">
  804. <div class="head">
  805. Recent Snatches
  806. <span class="float_right"><a
  807. onclick="$('#recent_snatches_images').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); wall('#recent_snatches_images', '.collage_image', [2,3]); return false;"
  808. class="brackets">Show</a></span>&nbsp;
  809. </div>
  810. <div id="recent_snatches_images" class="collage_images hidden">
  811. <?php foreach ($RecentSnatches as $RS) {
  812. $RSName = empty($RS['Name']) ? (empty($RS['Title2']) ? $RS['NameJP'] : $RS['Title2']) : $RS['Name']; ?>
  813. <div style='width: 100px;' class='collage_image'>
  814. <a
  815. href="torrents.php?id=<?=$RS['ID']?>">
  816. <img class="tooltip"
  817. title="<?=display_str($RS['Artist'])?><?=display_str($RSName)?>"
  818. src="<?=ImageTools::process($RS['WikiImage'], 'thumb')?>"
  819. alt="<?=display_str($RS['Artist'])?><?=display_str($RSName)?>"
  820. width="100%" />
  821. </a>
  822. </div>
  823. <?php
  824. } ?>
  825. </div>
  826. </div>
  827. <?php
  828. }
  829. }
  830. if (check_paranoia_here('uploads')) {
  831. $RecentUploads = $Cache->get_value("recent_uploads_$UserID");
  832. if ($RecentUploads === false) {
  833. $DB->prepare_query("
  834. SELECT
  835. g.`id`,
  836. g.`title`,
  837. g.`subject`,
  838. g.`object`,
  839. g.`picture`
  840. FROM
  841. `torrents_group` AS g
  842. INNER JOIN `torrents` AS t
  843. ON
  844. t.`GroupID` = g.`id`
  845. WHERE
  846. t.`UserID` = '$UserID' AND g.`picture` != ''
  847. GROUP BY
  848. g.`id`,
  849. t.`Time`
  850. ORDER BY
  851. t.`Time`
  852. DESC
  853. LIMIT 5
  854. ");
  855. $DB->exec_prepared_query();
  856. $RecentUploads = $DB->to_array();
  857. $Artists = Artists::get_artists($DB->collect('ID'));
  858. foreach ($RecentUploads as $Key => $UploadInfo) {
  859. $RecentUploads[$Key]['Artist'] = Artists::display_artists($Artists[$UploadInfo['ID']], false, true);
  860. }
  861. $Cache->cache_value("recent_uploads_$UserID", $RecentUploads, 0); // inf cache
  862. }
  863. if (!empty($RecentUploads)) {
  864. ?>
  865. <div class="box" id="recent_uploads">
  866. <div class="head">
  867. Recent Uploads
  868. <span class="float_right"><a
  869. onclick="$('#recent_uploads_images').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); wall('#recent_uploads_images', '.collage_image', [2,3]); return false;"
  870. class="brackets">Show</a></span>&nbsp;
  871. </div>
  872. <div id="recent_uploads_images" class="collage_images hidden">
  873. <?php foreach ($RecentUploads as $RU) {
  874. $RUName = empty($RU['Name']) ? (empty($RU['Title2']) ? $RU['NameJP'] : $RU['Title2']) : $RU['Name']; ?>
  875. <div style='width: 100px;' class='collage_image'>
  876. <a
  877. href="torrents.php?id=<?=$RU['ID']?>">
  878. <img class="tooltip"
  879. title="<?=$RU['Artist']?><?=$RUName?>"
  880. src="<?=ImageTools::process($RU['WikiImage'], 'thumb')?>"
  881. alt="<?=$RU['Artist']?><?=$RUName?>"
  882. width="100%" />
  883. </a>
  884. </div>
  885. <?php
  886. } ?>
  887. </div>
  888. </div>
  889. <?php
  890. }
  891. }
  892. $DB->query("
  893. SELECT ID, Name
  894. FROM collages
  895. WHERE UserID = '$UserID'
  896. AND CategoryID = '0'
  897. AND Deleted = '0'
  898. ORDER BY Featured DESC,
  899. Name ASC");
  900. $Collages = $DB->to_array(false, MYSQLI_NUM, false);
  901. foreach ($Collages as $CollageInfo) {
  902. list($CollageID, $CName) = $CollageInfo;
  903. $DB->prepare_query("
  904. SELECT
  905. ct.GroupID,
  906. tg.`picture`,
  907. tg.`category_id`
  908. FROM
  909. collages_torrents AS ct
  910. JOIN torrents_group AS tg
  911. ON
  912. tg.`id` = ct.GroupID
  913. WHERE
  914. ct.CollageID = '$CollageID'
  915. ORDER BY
  916. ct.Sort
  917. LIMIT 5
  918. ");
  919. $DB->exec_prepared_query();
  920. $Collage = $DB->to_array(false, MYSQLI_ASSOC, false); ?>
  921. <div class="box" id="collage<?=$CollageID?>_box">
  922. <div class="head">
  923. <?=display_str($CName)?> - <a
  924. href="collages.php?id=<?=$CollageID?>" class="brackets">See
  925. full</a>
  926. <span class="float_right">
  927. <a data-toggle-target="#collage<?=$CollageID?>_box .collage_images"
  928. data-toggle-replace="Show" class="brackets">Hide</a>
  929. </span>
  930. </div>
  931. <div id="user_collage_images" class="collage_images" data-wall-child=".collage_image" data-wall-size="5">
  932. <?php foreach ($Collage as $C) {
  933. $Group = Torrents::get_groups(array($C['GroupID']), true, true, false);
  934. extract(Torrents::array_group($Group[$C['GroupID']]));
  935. if (!$C['WikiImage']) {
  936. $C['WikiImage'] = STATIC_SERVER.'common/noartwork/music.png';
  937. }
  938. $Name = '';
  939. $Name .= Artists::display_artists($Artists, false, true);
  940. $Name .= $GroupName; ?>
  941. <div class="collage_image">
  942. <a href="torrents.php?id=<?=$GroupID?>">
  943. <img class="tooltip" title="<?=$Name?>"
  944. src="<?=ImageTools::process($C['WikiImage'], 'thumb')?>"
  945. alt="<?=$Name?>" width="100%" />
  946. </a>
  947. </div>
  948. <?php
  949. } ?>
  950. </div>
  951. </div>
  952. <?php
  953. }
  954. ?>
  955. <!-- for the "jump to staff tools" button -->
  956. <a id="staff_tools"></a>
  957. <?php
  958. // Linked accounts
  959. if (check_perms('users_mod')) {
  960. include(SERVER_ROOT.'/sections/user/linkedfunctions.php');
  961. user_dupes_table($UserID);
  962. }
  963. if ((check_perms('users_view_invites')) && $Invited > 0) {
  964. include(SERVER_ROOT.'/classes/invite_tree.class.php');
  965. $Tree = new INVITE_TREE($UserID, array('visible' => false)); ?>
  966. <div class="box" id="invitetree_box">
  967. <div class="head">
  968. Invite Tree <span class="float_right"><a data-toggle-target="#invitetree" class="brackets">Toggle</a></span>
  969. </div>
  970. <div id="invitetree" class="hidden">
  971. <?php $Tree->make_tree(); ?>
  972. </div>
  973. </div>
  974. </div>
  975. <?php
  976. }
  977. if (check_perms('users_mod')) {
  978. DonationsView::render_donation_history(Donations::get_donation_history($UserID));
  979. }
  980. // Requests
  981. if (empty($LoggedUser['DisableRequests']) && check_paranoia_here('requestsvoted_list')) {
  982. $SphQL = new SphinxqlQuery();
  983. $SphQLResult = $SphQL->select('id, votes, bounty')
  984. ->from('requests, requests_delta')
  985. ->where('userid', $UserID)
  986. ->where('torrentid', 0)
  987. ->order_by('votes', 'desc')
  988. ->order_by('bounty', 'desc')
  989. ->limit(0, 100, 100) // Limit to 100 requests
  990. ->query();
  991. if ($SphQLResult->has_results()) {
  992. $SphRequests = $SphQLResult->to_array('id', MYSQLI_ASSOC); ?>
  993. <div class="box" id="requests_box">
  994. <div class="head">
  995. Requests <span class="float_right"><a data-toggle-target="#requests" class="brackets">Show</a></span>
  996. </div>
  997. <div id="requests" class="hidden">
  998. <table cellpadding="6" cellspacing="1" border="0" width="100%">
  999. <tr class="colhead_dark">
  1000. <td style="width: 48%;">
  1001. <strong>Request Name</strong>
  1002. </td>
  1003. <td>
  1004. <strong>Vote</strong>
  1005. </td>
  1006. <td>
  1007. <strong>Bounty</strong>
  1008. </td>
  1009. <td>
  1010. <strong>Added</strong>
  1011. </td>
  1012. </tr>
  1013. <?php
  1014. $Requests = Requests::get_requests(array_keys($SphRequests));
  1015. foreach ($SphRequests as $RequestID => $SphRequest) {
  1016. $Request = $Requests[$RequestID];
  1017. $VotesCount = $SphRequest['votes'];
  1018. $Bounty = $SphRequest['bounty'] * 1024; // Sphinx stores bounty in kB
  1019. $CategoryName = $Categories[$Request['CategoryID'] - 1];
  1020. if ($CategoryName == 'Music') {
  1021. $ArtistForm = Requests::get_artists($RequestID);
  1022. $ArtistLink = Artists::display_artists($ArtistForm, true, true);
  1023. $FullName = "$ArtistLink<a href=\"requests.php?action=view&amp;id=$RequestID\">$Request[Title] [$Request[Year]]</a>";
  1024. } elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
  1025. $FullName = "<a href=\"requests.php?action=view&amp;id=$RequestID\">$Request[Title] [$Request[Year]]</a>";
  1026. } else {
  1027. if (!$Request['Title']) {
  1028. $Request['Title'] = $Request['Title2'];
  1029. }
  1030. if (!$Request['Title']) {
  1031. $Request['Title'] = $Request['TitleJP'];
  1032. }
  1033. $FullName = "<a href=\"requests.php?action=view&amp;id=$RequestID\">$Request[Title]</a>";
  1034. } ?>
  1035. <tr class="row">
  1036. <td>
  1037. <?=$FullName ?>
  1038. <div class="tags">
  1039. <?php
  1040. $Tags = $Request['Tags'];
  1041. $TagList = [];
  1042. foreach ($Tags as $TagID => $TagName) {
  1043. $TagList[] = "<a href=\"requests.php?tags=$TagName\">".display_str($TagName).'</a>';
  1044. }
  1045. $TagList = implode(', ', $TagList); ?>
  1046. <?=$TagList?>
  1047. </div>
  1048. </td>
  1049. <td>
  1050. <span id="vote_count_<?=$RequestID?>"><?=$VotesCount?></span>
  1051. <?php if (check_perms('site_vote')) { ?>
  1052. &nbsp;&nbsp; <a
  1053. href="javascript:Vote(0, <?=$RequestID?>)"
  1054. class="brackets">+</a>
  1055. <?php } ?>
  1056. </td>
  1057. <td>
  1058. <span id="bounty_<?=$RequestID?>"><?=Format::get_size($Bounty)?></span>
  1059. </td>
  1060. <td>
  1061. <?=time_diff($Request['TimeAdded']) ?>
  1062. </td>
  1063. </tr>
  1064. <?php
  1065. } ?>
  1066. </table>
  1067. </div>
  1068. </div>
  1069. <?php
  1070. }
  1071. }
  1072. $IsFLS = isset($LoggedUser['ExtraClasses'][FLS_TEAM]);
  1073. if (check_perms('users_mod', $Class) || $IsFLS) {
  1074. $UserLevel = $LoggedUser['EffectiveClass'];
  1075. $DB->query("
  1076. SELECT
  1077. SQL_CALC_FOUND_ROWS
  1078. ID,
  1079. Subject,
  1080. Status,
  1081. Level,
  1082. AssignedToUser,
  1083. Date,
  1084. ResolverID
  1085. FROM staff_pm_conversations
  1086. WHERE UserID = $UserID
  1087. AND (Level <= $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
  1088. ORDER BY Date DESC");
  1089. if ($DB->has_results()) {
  1090. $StaffPMs = $DB->to_array(); ?>
  1091. <div class="box" id="staffpms_box">
  1092. <div class="head">
  1093. Staff PMs <a data-toggle-target="#staffpms" class="brackets float_right">Toggle</a>
  1094. </div>
  1095. <table width="100%" class="message_table hidden" id="staffpms">
  1096. <tr class="colhead">
  1097. <td>Subject</td>
  1098. <td>Date</td>
  1099. <td>Assigned to</td>
  1100. <td>Resolved by</td>
  1101. </tr>
  1102. <?php
  1103. foreach ($StaffPMs as $StaffPM) {
  1104. list($ID, $Subject, $Status, $Level, $AssignedToUser, $Date, $ResolverID) = $StaffPM;
  1105. // Get assigned
  1106. if ($AssignedToUser == '') {
  1107. // Assigned to class
  1108. $Assigned = ($Level == 0) ? 'First Line Support' : $ClassLevels[$Level]['Name'];
  1109. // No + on Sysops
  1110. if ($Assigned != 'Sysop') {
  1111. $Assigned .= '+';
  1112. }
  1113. } else {
  1114. // Assigned to user
  1115. $Assigned = Users::format_username($UserID, true, true, true, true);
  1116. }
  1117. if ($ResolverID) {
  1118. $Resolver = Users::format_username($ResolverID, true, true, true, true);
  1119. } else {
  1120. $Resolver = '(unresolved)';
  1121. } ?>
  1122. <tr>
  1123. <td><a
  1124. href="staffpm.php?action=viewconv&amp;id=<?=$ID?>"><?=display_str($Subject)?></a></td>
  1125. <td><?=time_diff($Date, 2, true)?>
  1126. </td>
  1127. <td><?=$Assigned?>
  1128. </td>
  1129. <td><?=$Resolver?>
  1130. </td>
  1131. </tr>
  1132. <?php
  1133. } ?>
  1134. </table>
  1135. </div>
  1136. <?php
  1137. }
  1138. }
  1139. // Displays a table of forum warnings viewable only to Forum Moderators
  1140. if ($LoggedUser['Class'] == 650 && check_perms('users_warn', $Class)) {
  1141. $DB->query("
  1142. SELECT Comment
  1143. FROM users_warnings_forums
  1144. WHERE UserID = '$UserID'");
  1145. list($ForumWarnings) = $DB->next_record();
  1146. if ($DB->has_results()) {
  1147. ?>
  1148. <div class="box">
  1149. <div class="head">Forum warnings</div>
  1150. <div class="pad">
  1151. <div id="forumwarningslinks" class="AdminComment" style="width: 98%;"><?=Text::full_format($ForumWarnings)?>
  1152. </div>
  1153. </div>
  1154. </div>
  1155. <?php
  1156. }
  1157. }
  1158. if (check_perms('users_mod', $Class)) { ?>
  1159. <form class="manage_form" name="user" id="form" action="user.php" method="post">
  1160. <input type="hidden" name="action" value="moderate" />
  1161. <input type="hidden" name="userid" value="<?=$UserID?>" />
  1162. <input type="hidden" name="auth"
  1163. value="<?=$LoggedUser['AuthKey']?>" />
  1164. <div class="box" id="staff_notes_box">
  1165. <div class="head">
  1166. Staff Notes
  1167. <a href="#" name="admincommentbutton" onclick="ChangeTo('text'); return false;" class="brackets">Edit</a>
  1168. <span class="float_right">
  1169. <a data-toggle-target="#staffnotes" class="brackets">Toggle</a>
  1170. </span>
  1171. </div>
  1172. <div id="staffnotes" class="pad">
  1173. <input type="hidden" name="comment_hash"
  1174. value="<?=$CommentHash?>" />
  1175. <div id="admincommentlinks" class="AdminComment" style="width: 98%;"><?=Text::full_format($AdminComment)?>
  1176. </div>
  1177. <textarea id="admincomment" onkeyup="resize('admincomment');" class="AdminComment hidden" name="AdminComment"
  1178. cols="65" rows="26"
  1179. style="width: 98%;"><?=display_str($AdminComment)?></textarea>
  1180. <a href="#" name="admincommentbutton" onclick="ChangeTo('text'); return false;" class="brackets">Toggle
  1181. edit</a>
  1182. <script type="text/javascript">
  1183. resize('admincomment');
  1184. </script>
  1185. </div>
  1186. </div>
  1187. <table class="layout box" id="user_info_box">
  1188. <tr class="colhead">
  1189. <td colspan="2">
  1190. User Information
  1191. </td>
  1192. </tr>
  1193. <?php if (check_perms('users_edit_usernames', $Class)) { ?>
  1194. <tr>
  1195. <td class="label">Username:</td>
  1196. <td><input type="text" size="20" name="Username"
  1197. value="<?=display_str($Username)?>" /></td>
  1198. </tr>
  1199. <?php
  1200. }
  1201. if (check_perms('users_edit_titles')) {
  1202. ?>
  1203. <tr>
  1204. <td class="label">Custom title:</td>
  1205. <td><input type="text" class="wide_input_text" name="Title"
  1206. value="<?=display_str($CustomTitle)?>" /></td>
  1207. </tr>
  1208. <?php
  1209. }
  1210. if (check_perms('users_promote_below', $Class) || check_perms('users_promote_to', $Class - 1)) {
  1211. ?>
  1212. <tr>
  1213. <td class="label">Primary class:</td>
  1214. <td>
  1215. <select name="Class">
  1216. <?php
  1217. foreach ($ClassLevels as $CurClass) {
  1218. if (check_perms('users_promote_below', $Class) && $CurClass['ID'] >= $LoggedUser['EffectiveClass']) {
  1219. break;
  1220. }
  1221. if ($CurClass['ID'] > $LoggedUser['EffectiveClass']) {
  1222. break;
  1223. }
  1224. if ($CurClass['Secondary']) {
  1225. continue;
  1226. }
  1227. if ($Class == $CurClass['Level']) {
  1228. $Selected = ' selected="selected"';
  1229. } else {
  1230. $Selected = '';
  1231. } ?>
  1232. <!--
  1233. pcs-comment-start bug
  1234. php-cs-fixer misinterpretation
  1235. -->
  1236. <option value="<?=$CurClass['ID']?>"
  1237. <?=$Selected?>><?=$CurClass['Name'].' ('.$CurClass['Level'].')'?>
  1238. </option>
  1239. <?php
  1240. } ?>
  1241. </select>
  1242. </td>
  1243. </tr>
  1244. <?php
  1245. }
  1246. if (check_perms('users_give_donor')) {
  1247. ?>
  1248. <tr>
  1249. <td class="label">Donor:</td>
  1250. <td><input type="checkbox" name="Donor" <?php if ($Donor==1) { ?> checked="checked"
  1251. <?php } ?> />
  1252. </td>
  1253. </tr>
  1254. <?php
  1255. }
  1256. if (check_perms('users_promote_below') || check_perms('users_promote_to')) { ?>
  1257. <tr>
  1258. <td class="label">Secondary classes:</td>
  1259. <td>
  1260. <?php
  1261. $DB->query("
  1262. SELECT p.ID, p.Name, l.UserID
  1263. FROM permissions AS p
  1264. LEFT JOIN users_levels AS l ON l.PermissionID = p.ID AND l.UserID = '$UserID'
  1265. WHERE p.Secondary = 1
  1266. ORDER BY p.Name");
  1267. $i = 0;
  1268. while (list($PermID, $PermName, $IsSet) = $DB->next_record()) {
  1269. $i++; ?>
  1270. <input type="checkbox" id="perm_<?=$PermID?>"
  1271. name="secondary_classes[]" value="<?=$PermID?>" <?php if ($IsSet) { ?> checked="checked"
  1272. <?php } ?> />&nbsp;<label
  1273. for="perm_<?=$PermID?>"
  1274. style="margin-right: 10px;"><?=$PermName?></label>
  1275. <?php if ($i % 3 == 0) {
  1276. echo "\t\t\t\t<br />\n";
  1277. }
  1278. } ?>
  1279. </td>
  1280. </tr>
  1281. <?php }
  1282. if (check_perms('users_make_invisible')) {
  1283. ?>
  1284. <tr>
  1285. <td class="label">Visible in peer lists:</td>
  1286. <td><input type="checkbox" name="Visible" <?php if ($Visible==1) { ?> checked="checked"
  1287. <?php } ?> />
  1288. </td>
  1289. </tr>
  1290. <?php
  1291. }
  1292. if (check_perms('users_edit_ratio', $Class) || (check_perms('users_edit_own_ratio') && $UserID == $LoggedUser['ID'])) {
  1293. ?>
  1294. <tr>
  1295. <td class="label tooltip" title="Upload amount in bytes. Also accepts e.g. +20GB or -35.6364MB on the end.">
  1296. Uploaded:</td>
  1297. <td>
  1298. <input type="hidden" name="OldUploaded"
  1299. value="<?=$Uploaded?>" />
  1300. <input type="text" size="20" name="Uploaded"
  1301. value="<?=$Uploaded?>" />
  1302. </td>
  1303. </tr>
  1304. <tr>
  1305. <td class="label tooltip" title="Download amount in bytes. Also accepts e.g. +20GB or -35.6364MB on the end.">
  1306. Downloaded:</td>
  1307. <td>
  1308. <input type="hidden" name="OldDownloaded"
  1309. value="<?=$Downloaded?>" />
  1310. <input type="text" size="20" name="Downloaded"
  1311. value="<?=$Downloaded?>" />
  1312. </td>
  1313. </tr>
  1314. <tr>
  1315. <td class="label"><?=BONUS_POINTS?>:</td>
  1316. <td>
  1317. <input type="text" size="20" name="BonusPoints"
  1318. value="<?=$BonusPoints?>" />
  1319. <?php
  1320. if (!$DisablePoints) {
  1321. $PointsRate = 0;
  1322. $getTorrents = $DB->query("
  1323. SELECT COUNT(DISTINCT x.fid) AS Torrents,
  1324. SUM(t.Size) AS Size,
  1325. SUM(xs.seedtime) AS Seedtime,
  1326. SUM(t.Seeders) AS Seeders
  1327. FROM users_main AS um
  1328. LEFT JOIN users_info AS i on um.ID = i.UserID
  1329. LEFT JOIN xbt_files_users AS x ON um.ID=x.uid
  1330. LEFT JOIN torrents AS t ON t.ID=x.fid
  1331. LEFT JOIN xbt_snatched AS xs ON x.uid=xs.uid AND x.fid=xs.fid
  1332. WHERE
  1333. um.ID = $UserID
  1334. AND um.Enabled = '1'
  1335. AND x.active = 1
  1336. AND x.completed = 0
  1337. AND x.Remaining = 0
  1338. GROUP BY um.ID");
  1339. if ($DB->has_results()) {
  1340. list($NumTorr, $TSize, $TTime, $TSeeds) = $DB->next_record();
  1341. $ENV = ENV::go();
  1342. $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;
  1343. }
  1344. $PointsRate = intval(max(min($PointsRate, ($PointsRate * 2) - ($BonusPoints/1440)), 0));
  1345. $PointsPerHour = number_format($PointsRate)." ".BONUS_POINTS."/hour";
  1346. $PointsPerDay = number_format($PointsRate*24)." ".BONUS_POINTS."/day";
  1347. } else {
  1348. $PointsPerHour = "0 ".BONUS_POINTS."/hour";
  1349. $PointsPerDay = BONUS_POINTS." disabled";
  1350. } ?>
  1351. <?=$PointsPerHour?> (<?=$PointsPerDay?>)
  1352. </td>
  1353. </tr>
  1354. <tr>
  1355. <td class="label tooltip" title="Enter a username.">Merge stats <strong>from:</strong></td>
  1356. <td>
  1357. <input type="text" size="40" name="MergeStatsFrom" />
  1358. </td>
  1359. </tr>
  1360. <tr>
  1361. <td class="label">Freeleech tokens:</td>
  1362. <td>
  1363. <input type="text" size="5" name="FLTokens"
  1364. value="<?=$FLTokens?>" />
  1365. </td>
  1366. </tr>
  1367. <?php
  1368. }
  1369. if (check_perms('users_edit_invites')) {
  1370. ?>
  1371. <tr>
  1372. <td class="label tooltip" title="Number of invites">Invites:</td>
  1373. <td><input type="text" size="5" name="Invites"
  1374. value="<?=$Invites?>" /></td>
  1375. </tr>
  1376. <?php
  1377. }
  1378. if (check_perms('admin_manage_fls') || (check_perms('users_mod') && $OwnProfile)) {
  1379. ?>
  1380. <tr>
  1381. <td class="label tooltip" title="This is the message shown in the right-hand column on /staff.php">FLS/Staff
  1382. remark:</td>
  1383. <td><input type="text" class="wide_input_text" name="SupportFor"
  1384. value="<?=display_str($SupportFor)?>" /></td>
  1385. </tr>
  1386. <?php
  1387. }
  1388. if (check_perms('users_edit_reset_keys')) {
  1389. ?>
  1390. <tr>
  1391. <td class="label">Reset:</td>
  1392. <td>
  1393. <input type="checkbox" name="ResetRatioWatch" id="ResetRatioWatch" /> <label for="ResetRatioWatch">Ratio
  1394. watch</label> |
  1395. <input type="checkbox" name="ResetPasskey" id="ResetPasskey" /> <label for="ResetPasskey">Passkey</label> |
  1396. <input type="checkbox" name="ResetAuthkey" id="ResetAuthkey" /> <label for="ResetAuthkey">Authkey</label> |
  1397. <input type="checkbox" name="ResetIPHistory" id="ResetIPHistory" /> <label for="ResetIPHistory">IP
  1398. history</label> |
  1399. <input type="checkbox" name="ResetEmailHistory" id="ResetEmailHistory" /> <label for="ResetEmailHistory">Email
  1400. history</label>
  1401. <br />
  1402. <input type="checkbox" name="ResetSnatchList" id="ResetSnatchList" /> <label for="ResetSnatchList">Snatch
  1403. list</label> |
  1404. <input type="checkbox" name="ResetDownloadList" id="ResetDownloadList" /> <label
  1405. for="ResetDownloadList">Download list</label>
  1406. </td>
  1407. </tr>
  1408. <?php
  1409. }
  1410. if (check_perms('users_edit_password')) {
  1411. ?>
  1412. <tr>
  1413. <td class="label">New password:</td>
  1414. <td>
  1415. <textarea id="password_display" name="password_display" rows="2" cols="50" onclick="this.select();"
  1416. readonly></textarea>
  1417. <button type="button" id="password_create" onclick="pwgen('password_display');">Generate</button>
  1418. </td>
  1419. </tr>
  1420. <?php
  1421. }
  1422. if (check_perms('users_edit_badges')) {
  1423. ?>
  1424. <tr id="user_badge_edit_tr">
  1425. <td class="label">Badges Owned:</td>
  1426. <td>
  1427. <?php
  1428. $AllBadges = Badges::get_all_badges();
  1429. $UserBadgeIDs = [];
  1430. foreach (array_keys(Badges::get_badges($UserID)) as $b) {
  1431. $UserBadgeIDs[] = $b;
  1432. }
  1433. $i = 0;
  1434. foreach (array_keys($AllBadges) as $BadgeID) {
  1435. ?><input type="checkbox" name="badges[]" class="badge_checkbox"
  1436. value="<?=$BadgeID?>" <?=(in_array($BadgeID, $UserBadgeIDs))?" checked":""?>/><?=Badges::display_badge($BadgeID, true)?>
  1437. <?php $i++;
  1438. if ($i % 8 == 0) {
  1439. echo "<br />";
  1440. }
  1441. } ?>
  1442. </td>
  1443. </tr>
  1444. <?php
  1445. } ?>
  1446. </table>
  1447. <?php if (check_perms('users_warn')) { ?>
  1448. <table class="layout box" id="warn_user_box">
  1449. <tr class="colhead">
  1450. <td colspan="2">
  1451. Warnings
  1452. </td>
  1453. </tr>
  1454. <tr>
  1455. <td class="label">Warned:</td>
  1456. <td>
  1457. <input type="checkbox" name="Warned" <?php if ($Warned) { ?> checked="checked"
  1458. <?php } ?> />
  1459. </td>
  1460. </tr>
  1461. <?php if (!$Warned) { ?>
  1462. <tr>
  1463. <td class="label">Expiration:</td>
  1464. <td>
  1465. <select name="WarnLength">
  1466. <option value="">---</option>
  1467. <option value="1">1 week</option>
  1468. <option value="2">2 weeks</option>
  1469. <option value="4">4 weeks</option>
  1470. <option value="8">8 weeks</option>
  1471. </select>
  1472. </td>
  1473. </tr>
  1474. <?php } else { ?>
  1475. <tr>
  1476. <td class="label">Extension:</td>
  1477. <td>
  1478. <select name="ExtendWarning" onchange="ToggleWarningAdjust(this);">
  1479. <option>---</option>
  1480. <option value="1">1 week</option>
  1481. <option value="2">2 weeks</option>
  1482. <option value="4">4 weeks</option>
  1483. <option value="8">8 weeks</option>
  1484. </select>
  1485. </td>
  1486. </tr>
  1487. <tr id="ReduceWarningTR">
  1488. <td class="label">Reduction:</td>
  1489. <td>
  1490. <select name="ReduceWarning">
  1491. <option>---</option>
  1492. <option value="1">1 week</option>
  1493. <option value="2">2 weeks</option>
  1494. <option value="4">4 weeks</option>
  1495. <option value="8">8 weeks</option>
  1496. </select>
  1497. </td>
  1498. </tr>
  1499. <?php } ?>
  1500. <tr>
  1501. <td class="label tooltip" title="This message *will* be sent to the user in the warning PM!">Warning reason:
  1502. </td>
  1503. <td>
  1504. <input type="text" class="wide_input_text" name="WarnReason" />
  1505. </td>
  1506. </tr>
  1507. <?php } ?>
  1508. </table>
  1509. <?php if (check_perms('users_disable_any')) { ?>
  1510. <table class="layout box">
  1511. <tr class="colhead">
  1512. <td colspan="2">
  1513. Lock Account
  1514. </td>
  1515. </tr>
  1516. <tr>
  1517. <td class="label">Lock Account:</td>
  1518. <td>
  1519. <input type="checkbox" name="LockAccount" id="LockAccount" <?php if ($LockedAccount) { ?> checked="checked"
  1520. <?php } ?>/>
  1521. </td>
  1522. </tr>
  1523. <tr>
  1524. <td class="label">Reason:</td>
  1525. <td>
  1526. <select name="LockReason">
  1527. <option value="---">---</option>
  1528. <option value="<?=STAFF_LOCKED?>" <?php if ($LockedAccount==STAFF_LOCKED) { ?> selected
  1529. <?php } ?>>Staff Lock
  1530. </option>
  1531. </select>
  1532. </td>
  1533. </tr>
  1534. </table>
  1535. <?php } ?>
  1536. <table class="layout box" id="user_privs_box">
  1537. <tr class="colhead">
  1538. <td colspan="2">
  1539. User Privileges
  1540. </td>
  1541. </tr>
  1542. <?php if (check_perms('users_disable_posts') || check_perms('users_disable_any')) {
  1543. $DB->query("
  1544. SELECT DISTINCT Email, IP, Time
  1545. FROM users_history_emails
  1546. WHERE UserID = $UserID
  1547. ORDER BY Time ASC");
  1548. $Emails = $DB->to_array(); ?>
  1549. <tr>
  1550. <td class="label">Disable:</td>
  1551. <td>
  1552. <input type="checkbox" name="DisablePosting" id="DisablePosting" <?php if ($DisablePosting==1) { ?>
  1553. checked="checked"
  1554. <?php } ?> /> <label for="DisablePosting">Posting</label>
  1555. <?php if (check_perms('users_disable_any')) { ?>
  1556. |
  1557. <input type="checkbox" name="DisableAvatar" id="DisableAvatar" <?php if ($DisableAvatar==1) { ?>
  1558. checked="checked"
  1559. <?php } ?> /> <label for="DisableAvatar">Avatar</label> |
  1560. <input type="checkbox" name="DisableForums" id="DisableForums" <?php if ($DisableForums==1) { ?>
  1561. checked="checked"
  1562. <?php } ?> /> <label for="DisableForums">Forums</label> |
  1563. <input type="checkbox" name="DisableIRC" id="DisableIRC" <?php if ($DisableIRC==1) { ?> checked="checked"
  1564. <?php } ?> /> <label for="DisableIRC">IRC</label> |
  1565. <input type="checkbox" name="DisablePM" id="DisablePM" <?php if ($DisablePM==1) { ?> checked="checked"
  1566. <?php } ?> /> <label for="DisablePM">PM</label> |
  1567. <br /><br />
  1568. <input type="checkbox" name="DisableLeech" id="DisableLeech" <?php if ($DisableLeech==0) { ?> checked="checked"
  1569. <?php } ?> /> <label for="DisableLeech">Leech</label> |
  1570. <input type="checkbox" name="DisableRequests" id="DisableRequests" <?php if ($DisableRequests==1) { ?>
  1571. checked="checked"
  1572. <?php } ?> /> <label for="DisableRequests">Requests</label>
  1573. |
  1574. <input type="checkbox" name="DisableUpload" id="DisableUpload" <?php if ($DisableUpload==1) { ?>
  1575. checked="checked"
  1576. <?php } ?> /> <label for="DisableUpload">Torrent
  1577. upload</label> |
  1578. <input type="checkbox" name="DisablePoints" id="DisablePoints" <?php if ($DisablePoints==1) { ?>
  1579. checked="checked"
  1580. <?php } ?> /> <label for="DisablePoints"><?=BONUS_POINTS?></label>
  1581. <br /><br />
  1582. <input type="checkbox" name="DisableTagging" id="DisableTagging" <?php if ($DisableTagging==1) { ?>
  1583. checked="checked"
  1584. <?php } ?> /> <label for="DisableTagging" class="tooltip"
  1585. title="This only disables a user's ability to delete tags.">Tagging</label> |
  1586. <input type="checkbox" name="DisableWiki" id="DisableWiki" <?php if ($DisableWiki==1) { ?> checked="checked"
  1587. <?php } ?> /> <label for="DisableWiki">Wiki</label> |
  1588. <input type="checkbox" name="DisablePromotion" id="DisablePromotion" <?php if ($DisablePromotion==1) { ?>
  1589. checked="checked"
  1590. <?php } ?> /> <label
  1591. for="DisablePromotion">Promotions</label> |
  1592. <input type="checkbox" name="DisableInvites" id="DisableInvites" <?php if ($DisableInvites==1) { ?>
  1593. checked="checked"
  1594. <?php } ?> /> <label for="DisableInvites">Invites</label>
  1595. </td>
  1596. </tr>
  1597. <tr>
  1598. <td class="label">Hacked:</td>
  1599. <td>
  1600. <input type="checkbox" name="SendHackedMail" id="SendHackedMail" /> <label for="SendHackedMail">Send hacked
  1601. account email</label> to
  1602. <select name="HackedEmail">
  1603. <?php
  1604. foreach ($Emails as $Email) {
  1605. list($Address, $IP) = $Email;
  1606. $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
  1607. $Address = apcu_exists('DBKEY') ? Crypto::decrypt($Address) : '[Encrypted]'; ?>
  1608. <option value="<?=display_str($Address)?>"><?=display_str($Address)?> - <?=display_str($IP)?>
  1609. </option>
  1610. <?php
  1611. } ?>
  1612. </select>
  1613. </td>
  1614. </tr>
  1615. <?php
  1616. }
  1617. }
  1618. if (check_perms('users_disable_any')) {
  1619. ?>
  1620. <tr>
  1621. <td class="label">Account:</td>
  1622. <td>
  1623. <select name="UserStatus">
  1624. <option value="0" <?php if ($Enabled=='0') { ?>
  1625. selected="selected"
  1626. <?php } ?>>Unconfirmed
  1627. </option>
  1628. <option value="1" <?php if ($Enabled=='1') { ?>
  1629. selected="selected"
  1630. <?php } ?>>Enabled
  1631. </option>
  1632. <option value="2" <?php if ($Enabled=='2') { ?>
  1633. selected="selected"
  1634. <?php } ?>>Disabled
  1635. </option>
  1636. <?php if (check_perms('users_delete_users')) { ?>
  1637. <optgroup label="-- WARNING --">
  1638. <option value="delete">Delete account</option>
  1639. </optgroup>
  1640. <?php } ?>
  1641. </select>
  1642. </td>
  1643. </tr>
  1644. <tr>
  1645. <td class="label">User reason:</td>
  1646. <td>
  1647. <input type="text" class="wide_input_text" name="UserReason" />
  1648. </td>
  1649. </tr>
  1650. <tr>
  1651. <td class="label tooltip" title="Enter a comma-delimited list of forum IDs.">Restricted forums:</td>
  1652. <td>
  1653. <input type="text" class="wide_input_text" name="RestrictedForums"
  1654. value="<?=display_str($RestrictedForums)?>" />
  1655. </td>
  1656. </tr>
  1657. <tr>
  1658. <td class="label tooltip" title="Enter a comma-delimited list of forum IDs.">Extra forums:</td>
  1659. <td>
  1660. <input type="text" class="wide_input_text" name="PermittedForums"
  1661. value="<?=display_str($PermittedForums)?>" />
  1662. </td>
  1663. </tr>
  1664. <?php
  1665. } ?>
  1666. </table>
  1667. <?php if (check_perms('users_logout')) { ?>
  1668. <table class="layout box" id="session_box">
  1669. <tr class="colhead">
  1670. <td colspan="2">
  1671. Session
  1672. </td>
  1673. </tr>
  1674. <tr>
  1675. <td class="label">Reset session:</td>
  1676. <td><input type="checkbox" name="ResetSession" id="ResetSession" /></td>
  1677. </tr>
  1678. <tr>
  1679. <td class="label">Log out:</td>
  1680. <td><input type="checkbox" name="LogOut" id="LogOut" /></td>
  1681. </tr>
  1682. </table>
  1683. <?php
  1684. }
  1685. if (check_perms('users_mod')) {
  1686. DonationsView::render_mod_donations($UserID);
  1687. }
  1688. ?>
  1689. <table class="layout box" id="submit_box">
  1690. <tr class="colhead">
  1691. <td colspan="2">
  1692. Submit
  1693. </td>
  1694. </tr>
  1695. <tr>
  1696. <td class="label tooltip" title="This message will be entered into staff notes only.">Reason:</td>
  1697. <td>
  1698. <textarea rows="2" class="wide_input_text" name="Reason" id="Reason" onkeyup="resize('Reason');"></textarea>
  1699. </td>
  1700. </tr>
  1701. <tr>
  1702. <td class="label">Paste user stats:</td>
  1703. <td>
  1704. <button type="button" id="paster">Paste</button>
  1705. </td>
  1706. </tr>
  1707. <tr>
  1708. <td align="right" colspan="2">
  1709. <input type="submit" value="Save changes" />
  1710. </td>
  1711. </tr>
  1712. </table>
  1713. </form>
  1714. <?php
  1715. }
  1716. ?>
  1717. </div>
  1718. </div>
  1719. <?php View::show_footer();