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

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