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.

edit.php 45KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451
  1. <?php
  2. #declare(strict_types = 1);
  3. require_once SERVER_ROOT.'/classes/twofa.class.php';
  4. $UserID = $_REQUEST['userid'];
  5. if (!is_number($UserID)) {
  6. error(404);
  7. }
  8. $DB->query("
  9. SELECT
  10. m.Username,
  11. m.TwoFactor,
  12. m.PublicKey,
  13. m.Email,
  14. m.IRCKey,
  15. m.Paranoia,
  16. i.Info,
  17. i.Avatar,
  18. i.StyleID,
  19. i.StyleURL,
  20. i.SiteOptions,
  21. i.UnseededAlerts,
  22. p.Level AS Class,
  23. i.InfoTitle
  24. FROM users_main AS m
  25. JOIN users_info AS i ON i.UserID = m.ID
  26. LEFT JOIN permissions AS p ON p.ID = m.PermissionID
  27. WHERE m.ID = ?", $UserID);
  28. list($Username, $TwoFactor, $PublicKey, $Email, $IRCKey, $Paranoia, $Info, $Avatar, $StyleID, $StyleURL, $SiteOptions, $UnseededAlerts, $Class, $InfoTitle) = $DB->next_record(MYSQLI_NUM, [5, 10]);
  29. $TwoFA = new TwoFactorAuth();
  30. $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]';
  31. if ((int) $UserID !== $LoggedUser['ID'] && !check_perms('users_edit_profiles', $Class)) {
  32. error(403);
  33. }
  34. $Paranoia = json_decode($Paranoia, true);
  35. if (!is_array($Paranoia)) {
  36. $Paranoia = [];
  37. }
  38. function paranoia_level($Setting)
  39. {
  40. global $Paranoia;
  41. // 0: very paranoid; 1: stats allowed, list disallowed; 2: not paranoid
  42. return (in_array($Setting . '+', $Paranoia)) ? 0 : (in_array($Setting, $Paranoia) ? 1 : 2);
  43. }
  44. function display_paranoia($FieldName)
  45. {
  46. $Level = paranoia_level($FieldName);
  47. echo "<label><input type='checkbox' name='p_{$FieldName}_c'" . checked($Level >= 1) . " onchange='AlterParanoia()' /> Show count</label>&nbsp;";
  48. echo "<label><input type='checkbox' name='p_{$FieldName}_l'" . checked($Level >= 2) . " onchange='AlterParanoia()' /> Show list</label>&nbsp;";
  49. }
  50. function checked($Checked)
  51. {
  52. return ($Checked ? ' checked="checked"' : '');
  53. }
  54. if ($SiteOptions) {
  55. $SiteOptions = json_decode($SiteOptions, true) ?? [];
  56. } else {
  57. $SiteOptions = [];
  58. }
  59. /**
  60. * Show header
  61. */
  62. View::show_header(
  63. "$Username $ENV->CRUMB Settings",
  64. 'user,password_validate,validate,cssgallery,preview_paranoia,bbcode,user_settings,donor_titles,vendor/easymde.min',
  65. 'vendor/easymde.min'
  66. );
  67. $DonorRank = Donations::get_rank($UserID);
  68. $DonorIsVisible = Donations::is_visible($UserID);
  69. if ($DonorIsVisible === null) {
  70. $DonorIsVisible = true;
  71. }
  72. extract(Donations::get_enabled_rewards($UserID));
  73. $Rewards = Donations::get_rewards($UserID);
  74. $ProfileRewards = Donations::get_profile_rewards($UserID);
  75. $DonorTitles = Donations::get_titles($UserID);
  76. ?>
  77. <div>
  78. <div class="header">
  79. <h2>
  80. <?=Users::format_username($UserID, false, false, false)?>
  81. <?=$ENV->CRUMB?> Settings
  82. </h2>
  83. </div>
  84. <!-- Side menu / settings filter -->
  85. <form class="edit_form" name="user" id="userform" method="post" autocomplete="off">
  86. <div class="sidebar">
  87. <div class="box" id="settings_sections">
  88. <div class="head">
  89. <strong>Sections</strong>
  90. </div>
  91. <ul class="nobullet">
  92. <li data-gazelle-section-id="all_settings">
  93. <h2>
  94. <a href="#">All Settings</a>
  95. </h2>
  96. </li>
  97. <li data-gazelle-section-id="site_appearance">
  98. <h2>
  99. <a href="#">Site Appearance</a>
  100. </h2>
  101. </li>
  102. <li data-gazelle-section-id="torrent_settings">
  103. <h2>
  104. <a href="#">Torrents</a>
  105. </h2>
  106. </li>
  107. <li data-gazelle-section-id="community_settings">
  108. <h2>
  109. <a href="#">Community</a>
  110. </h2>
  111. </li>
  112. <li data-gazelle-section-id="notification_settings">
  113. <h2>
  114. <a href="#">Notifications</a>
  115. </h2>
  116. </li>
  117. <li data-gazelle-section-id="profile_settings">
  118. <h2>
  119. <a href="#">Profile</a>
  120. </h2>
  121. </li>
  122. <li data-gazelle-section-id="paranoia_settings">
  123. <h2>
  124. <a href="#">Paranoia</a>
  125. </h2>
  126. </li>
  127. <li data-gazelle-section-id="security_settings">
  128. <h2>
  129. <a href="#">Security</a>
  130. </h2>
  131. </li>
  132. <li data-gazelle-section-id="live_search">
  133. <input type="text" id="settings_search" placeholder="Filter settings" />
  134. </li>
  135. <li>
  136. <input type="submit" id="submit" value="Save profile" />
  137. </li>
  138. </ul>
  139. </div>
  140. </div>
  141. <div class="main_column">
  142. <div>
  143. <input type="hidden" name="action" value="take_edit" />
  144. <input type="hidden" name="userid" value="<?=$UserID?>" />
  145. <input type="hidden" name="auth"
  146. value="<?=$LoggedUser['AuthKey']?>" />
  147. </div>
  148. <!-- Site Appearance -->
  149. <table cellpadding="6" cellspacing="1" border="0" width="100%" class="layout border user_options"
  150. id="site_appearance">
  151. <tr class="colhead_dark">
  152. <td colspan="2">
  153. <strong>Site Appearance</strong>
  154. </td>
  155. </tr>
  156. <!-- Stylesheet -->
  157. <tr id="site_style_tr">
  158. <td class="label">
  159. <strong>Stylesheet</strong>
  160. </td>
  161. <td>
  162. <select name="stylesheet" id="stylesheet">
  163. <?php foreach ($Stylesheets as $Style) { ?>
  164. <option value="<?=($Style['ID'])?>"
  165. <?=(int) $Style['ID'] === $StyleID ? ' selected="selected"' : ''?>><?=($Style['ProperName'])?>
  166. </option>
  167. <?php } ?>
  168. </select>
  169. &ensp;
  170. <a data-toggle-target="#css_gallery" class="brackets">Show gallery</a>
  171. <div id="css_gallery" class="hidden">
  172. <?php foreach ($Stylesheets as $Style) { ?>
  173. <div class="preview_wrapper">
  174. <div class="preview_image"
  175. name="<?=($Style['Name'])?>">
  176. <img
  177. src="<?=STATIC_SERVER.'styles/preview/thumb_'.$Style['Name'].'.png'?>"
  178. alt="<?=$Style['Name']?>" />
  179. <p class="preview_name">
  180. <label><input type="radio" name="stylesheet_gallery"
  181. value="<?=($Style['ID'])?>" />
  182. <?=($Style['ProperName'])?></label>
  183. </p>
  184. </div>
  185. </div>
  186. <?php } ?>
  187. </div>
  188. </td>
  189. </tr>
  190. <!-- Stylesheet additions -->
  191. <tr id="style_additions_tr"
  192. class="<?=($Stylesheets[$LoggedUser['StyleID']]['Additions'][0] ?? false)?'':'hidden'?>">
  193. <td class="label">
  194. <strong>Stylesheet additions</strong>
  195. </td>
  196. <td>
  197. <?php
  198. foreach ($Stylesheets as $Style) {
  199. $StyleAdditions = explode(';', $Style['Additions']);
  200. # Main ul
  201. echo '<ul class="nobullet style_addition'; # open quote
  202. echo ($Style['ID'] === $Stylesheets[$LoggedUser['StyleID']]['ID'])
  203. ? '"'
  204. : ' hidden"';
  205. echo ' id="style_addition_' . $Style['Name'] . '">';
  206. $Checked = (in_array('default_font', $SiteOptions['StyleAdditions'] ?? [])
  207. ? 'checked'
  208. : '');
  209. echo <<<HTML
  210. <li>
  211. <input type="radio" name="style_additions[]" value="default_font"
  212. id="default_font" $Checked />
  213. <label for="default_font">default_font</label>
  214. </li>
  215. HTML;
  216. # For each style addition
  217. foreach ($StyleAdditions as $i => $Addition) {
  218. # Radio options, e.g., fonts
  219. if (preg_match('/radio/', $Addition)) {
  220. $Addition = explode('=', $Addition)[1];
  221. $Checked = (in_array($Addition, $SiteOptions['StyleAdditions'] ?? [])
  222. ? 'checked'
  223. : '');
  224. echo <<<HTML
  225. <li>
  226. <input type="radio" name="style_additions[]" value="$Addition"
  227. id="addition_$Addition" $Checked />
  228. <label for="addition_$Addition">$Addition</label>
  229. </li>
  230. HTML;
  231. }
  232. # Checkbox options, e.g., pink and haze
  233. if (preg_match('/checkbox/', $Addition)) {
  234. $Addition = explode('=', $Addition)[1];
  235. $Checked = (in_array($Addition, $SiteOptions['StyleAdditions'] ?? [])
  236. ? 'checked'
  237. : '');
  238. echo <<<HTML
  239. <li>
  240. <input type="checkbox" name="style_additions[]" value="$Addition"
  241. id="addition_$Addition" $Checked />
  242. <label for="addition_$Addition">$Addition</label>
  243. </li>
  244. HTML;
  245. }
  246. }
  247. echo '</ul>';
  248. } ?>
  249. </td>
  250. </tr>
  251. <!-- External stylesheet URL -->
  252. <tr id="site_extstyle_tr">
  253. <td class="label">
  254. <strong>External stylesheet URL</strong>
  255. </td>
  256. <td>
  257. <input type="text" size="40" name="styleurl" id="styleurl"
  258. value="<?=display_str($StyleURL)?>" />
  259. </td>
  260. </tr>
  261. <!-- Profile stats -->
  262. <?php if (check_perms('users_mod')) { ?>
  263. <tr id="site_autostats_tr">
  264. <td class="label tooltip" title="Staff Only">
  265. <strong>Profile stats</strong>
  266. </td>
  267. <td>
  268. <label>
  269. <input type="checkbox" name="autoload_comm_stats" <?Format::selected(
  270. 'AutoloadCommStats' ,
  271. 1,
  272. 'checked',
  273. $SiteOptions
  274. ); ?>
  275. />
  276. Automatically fetch the snatch and peer stats on profile pages
  277. </label>
  278. </td>
  279. </tr>
  280. <?php } ?>
  281. </table>
  282. <!-- Torrents -->
  283. <table cellpadding="6" cellspacing="1" border="0" width="100%" class="layout border user_options"
  284. id="torrent_settings">
  285. <tr class="colhead_dark">
  286. <td colspan="2">
  287. <strong>Torrents</strong>
  288. </td>
  289. </tr>
  290. <!-- Default search type -->
  291. <?php if (check_perms('site_advanced_search')) { ?>
  292. <tr id="tor_searchtype_tr">
  293. <td class="label">
  294. <strong>Default search type</strong>
  295. </td>
  296. <td>
  297. <ul class="options_list nobullet">
  298. <li>
  299. <input type="radio" name="searchtype" id="search_type_simple" value="0" <?=(int)$SiteOptions['SearchType']===0?' checked="checked"':''?>
  300. />
  301. <label for="search_type_simple">Simple</label>
  302. </li>
  303. <li>
  304. <input type="radio" name="searchtype" id="search_type_advanced" value="1" <?=(int)$SiteOptions['SearchType']===1?' checked="checked"':''?>
  305. />
  306. <label for="search_type_advanced">Advanced</label>
  307. </li>
  308. </ul>
  309. </td>
  310. </tr>
  311. <?php } ?>
  312. <!-- Torrent grouping -->
  313. <tr id="tor_group_tr">
  314. <td class="label">
  315. <strong>Torrent grouping</strong>
  316. </td>
  317. <td>
  318. <div class="option_group">
  319. <input type="checkbox" name="disablegrouping" id="disablegrouping" <?=$SiteOptions['DisableGrouping2'] === 0 ? ' checked="checked"' : ''?>
  320. />
  321. <label for="disablegrouping">Enable torrent grouping</label>
  322. </div>
  323. </td>
  324. </tr>
  325. <!-- Torrent group display -->
  326. <tr id="tor_gdisp_search_tr">
  327. <td class="label">
  328. <strong>Torrent group display</strong>
  329. </td>
  330. <td>
  331. <div class="option_group">
  332. <ul class="options_list nobullet">
  333. <li>
  334. <input type="radio" name="torrentgrouping" id="torrent_grouping_open" value="0" <?=$SiteOptions['TorrentGrouping'] === 0 ? ' checked="checked"' : ''?>
  335. />
  336. <label for="torrent_grouping_open">Open</label>
  337. </li>
  338. <li>
  339. <input type="radio" name="torrentgrouping" id="torrent_grouping_closed" value="1" <?=$SiteOptions['TorrentGrouping'] === 1 ? ' checked="checked"' : ''?>
  340. />
  341. <label for="torrent_grouping_closed">Closed</label>
  342. </li>
  343. </ul>
  344. </div>
  345. </td>
  346. </tr>
  347. <!-- Snatched torrents indicator -->
  348. <tr id="tor_snatched_tr">
  349. <td class="label">
  350. <strong>Snatched torrents indicator</strong>
  351. </td>
  352. <td>
  353. <input type="checkbox" name="showsnatched" id="showsnatched" <?=!empty($SiteOptions['ShowSnatched']) ? ' checked="checked"' : ''?>
  354. />
  355. <label for="showsnatched">Enable snatched torrents indicator</label>
  356. </td>
  357. </tr>
  358. <!-- Cover art (torrents) -->
  359. <tr id="tor_cover_tor_tr">
  360. <td class="label">
  361. <strong>Cover art (torrents)</strong>
  362. </td>
  363. <td>
  364. <ul class="options_list nobullet">
  365. <li>
  366. <input type="hidden" name="coverart" value="" />
  367. <input type="checkbox" name="coverart" id="coverart" <?=!isset($SiteOptions['CoverArt']) || $SiteOptions['CoverArt'] ? ' checked="checked"' : ''?>
  368. />
  369. <label for="coverart">Enable cover artwork</label>
  370. </li>
  371. <li>
  372. <input type="checkbox" name="show_extra_covers" id="show_extra_covers" <?=$SiteOptions['ShowExtraCovers'] ? ' checked="checked"' : ''?>
  373. />
  374. <label for="show_extra_covers">Enable additional cover artwork</label>
  375. </li>
  376. </ul>
  377. </td>
  378. </tr>
  379. <!-- Cover art (collections) -->
  380. <tr id="tor_cover_coll_tr">
  381. <td class="label">
  382. <strong>Cover art (collections)</strong>
  383. </td>
  384. <td>
  385. <select name="collagecovers" id="collagecovers">
  386. <option value="10" <?=$SiteOptions['CollageCovers'] === 10 ? ' selected="selected"' : ''?>>10
  387. </option>
  388. <option value="25" <?=($SiteOptions['CollageCovers'] === 25 || !isset($SiteOptions['CollageCovers'])) ? ' selected="selected"' : ''?>>25
  389. (default)</option>
  390. <option value="50" <?=$SiteOptions['CollageCovers'] === 50 ? ' selected="selected"' : ''?>>50
  391. </option>
  392. <option value="100" <?=$SiteOptions['CollageCovers'] === 100 ? ' selected="selected"' : ''?>>100
  393. </option>
  394. <option value="1000000" <?=$SiteOptions['CollageCovers'] === 1000000 ? ' selected="selected"' : ''?>>All
  395. </option>
  396. <option value="0" <?=($SiteOptions['CollageCovers'] === 0 || (!isset($SiteOptions['CollageCovers']) && $SiteOptions['HideCollage'])) ? ' selected="selected"' : ''?>>None
  397. </option>
  398. </select>
  399. covers per page
  400. </td>
  401. </tr>
  402. <!-- Torrent search filters -->
  403. <tr id="tor_showfilt_tr">
  404. <td class="label">
  405. <strong>Torrent search filters</strong>
  406. </td>
  407. <td>
  408. <ul class="options_list nobullet">
  409. <li>
  410. <input type="checkbox" name="showtfilter" id="showtfilter" <?=(!isset($SiteOptions['ShowTorFilter']) || $SiteOptions['ShowTorFilter'] ? ' checked="checked"' : '')?>
  411. />
  412. <label for="showtfilter">Display filter controls</label>
  413. </li>
  414. <li>
  415. <input type="checkbox" name="showtags" id="showtags" <?php Format::selected('ShowTags', 1, 'checked', $SiteOptions); ?>
  416. />
  417. <label for="showtags">Display official tag filters</label>
  418. </li>
  419. </ul>
  420. </td>
  421. </tr>
  422. <!-- Autocompletion -->
  423. <tr id="tor_autocomp_tr">
  424. <td class="label">
  425. <strong>Autocompletion</strong>
  426. </td>
  427. <td>
  428. <select name="autocomplete">
  429. <option value="0" <?=empty($SiteOptions['AutoComplete']) ? ' selected="selected"' : ''?>>Everywhere
  430. </option>
  431. <option value="2" <?=$SiteOptions['AutoComplete'] === 2 ? ' selected="selected"' : ''?>>Searches
  432. only</option>
  433. <option value="1" <?=$SiteOptions['AutoComplete'] === 1 ? ' selected="selected"' : ''?>>Disable
  434. </option>
  435. </select>
  436. </td>
  437. </tr>
  438. </table>
  439. <!-- Community -->
  440. <table cellpadding="6" cellspacing="1" border="0" width="100%" class="layout border user_options"
  441. id="community_settings">
  442. <tr class="colhead_dark">
  443. <td colspan="2">
  444. <strong>Community</strong>
  445. </td>
  446. </tr>
  447. <!-- Posts per page (forums) -->
  448. <tr id="comm_ppp_tr">
  449. <td class="label">
  450. <strong>Posts per page (forums)</strong>
  451. </td>
  452. <td>
  453. <select name="postsperpage" id="postsperpage">
  454. <option value="25" <?=$SiteOptions['PostsPerPage'] === 25 ? ' selected="selected"' : ''?>>25
  455. (default)</option>
  456. <option value="50" <?=$SiteOptions['PostsPerPage'] === 50 ? ' selected="selected"' : ''?>>50
  457. </option>
  458. <option value="100" <?=$SiteOptions['PostsPerPage'] === 100 ? ' selected="selected"' : ''?>>100
  459. </option>
  460. </select>
  461. posts per page
  462. </td>
  463. </tr>
  464. <!-- Inbox sorting -->
  465. <tr id="comm_inbsort_tr">
  466. <td class="label">
  467. <strong>Inbox sorting</strong>
  468. </td>
  469. <td>
  470. <input type="checkbox" name="list_unread_pms_first" id="list_unread_pms_first" <?=!empty($SiteOptions['ListUnreadPMsFirst']) ? ' checked="checked"' : ''?>
  471. />
  472. <label for="list_unread_pms_first">List unread private messages first</label>
  473. </td>
  474. </tr>
  475. <!-- Emoticons -->
  476. <tr id="comm_emot_tr">
  477. <td class="label">
  478. <strong>Emoticons</strong>
  479. </td>
  480. <td>
  481. <input type="checkbox" name="disablesmileys" id="disablesmileys" <?=!empty($SiteOptions['DisableSmileys']) ? ' checked="checked"' : ''?>
  482. />
  483. <label for="disablesmileys">Disable emoticons</label>
  484. </td>
  485. </tr>
  486. <!-- Avatar display (posts) -->
  487. <tr id="comm_avatars_tr">
  488. <td class="label">
  489. <strong>Avatar display (posts)</strong>
  490. </td>
  491. <td>
  492. <select name="disableavatars" id="disableavatars">
  493. <option value="1" <?=(int)$SiteOptions['DisableAvatars'] === 1 ? ' selected="selected"' : ''?>>Disable
  494. avatars</option>
  495. <option value="0" <?=(int)$SiteOptions['DisableAvatars'] === 0 ? ' selected="selected"' : ''?>>Show
  496. avatars</option>
  497. </select>
  498. </td>
  499. </tr>
  500. <!-- Auto-save reply text -->
  501. <tr id="comm_autosave_tr">
  502. <td class="label">
  503. <strong>Auto-save reply text</strong>
  504. </td>
  505. <td>
  506. <input type="checkbox" name="disableautosave" id="disableautosave" <?=!empty($SiteOptions['DisableAutoSave']) ? ' checked="checked"' : ''?>
  507. />
  508. <label for="disableautosave">Disable text auto-saving</label>
  509. </td>
  510. </tr>
  511. <!-- Displayed badges -->
  512. <tr id="comm_badge_tr">
  513. <td class="label">
  514. <strong>Displayed badges</strong>
  515. </td>
  516. <td>
  517. <?php
  518. $Badges = Badges::get_badges($UserID);
  519. if (empty($Badges)) {
  520. ?><span>You have no badges :(</span><?php
  521. } else {
  522. $Count = 0;
  523. foreach ($Badges as $BadgeID => $Displayed) { ?>
  524. <input type="checkbox" name="badges[]" class="badge_checkbox"
  525. value="<?=$BadgeID?>" <?=($Displayed)?"checked ":""?>/>
  526. <?=Badges::display_badge($BadgeID, true)?>
  527. <?php
  528. $Count++;
  529. echo ($Count % 8) ? '' : '<br>';
  530. }
  531. } ?>
  532. </td>
  533. </tr>
  534. </table>
  535. <!-- Notifications -->
  536. <table cellpadding="6" cellspacing="1" border="0" width="100%" class="layout border user_options"
  537. id="notification_settings">
  538. <tr class="colhead_dark">
  539. <td colspan="2">
  540. <strong>Notifications</strong>
  541. </td>
  542. </tr>
  543. <!-- Automatic thread subscriptions -->
  544. <tr id="notif_autosubscribe_tr">
  545. <td class="label">
  546. <strong>Automatic thread subscriptions</strong>
  547. </td>
  548. <td>
  549. <input type="checkbox" name="autosubscribe" id="autosubscribe" <?=!empty($SiteOptions['AutoSubscribe']) ? ' checked="checked"' : ''?>
  550. />
  551. <label for="autosubscribe">Enable automatic thread subscriptions</label>
  552. </td>
  553. </tr>
  554. <!-- Unseeded torrent alerts -->
  555. <tr id="notif_unseeded_tr">
  556. <td class="label">
  557. <strong>Unseeded torrent alerts</strong>
  558. </td>
  559. <td>
  560. <input type="checkbox" name="unseededalerts" id="unseededalerts" <?=checked($UnseededAlerts)?> />
  561. <label for="unseededalerts">Enable unseeded torrent alerts</label>
  562. </td>
  563. </tr>
  564. <?php NotificationsManagerView::render_settings(NotificationsManager::get_settings($UserID)); ?>
  565. </table>
  566. <!-- Profile -->
  567. <table cellpadding="6" cellspacing="1" border="0" width="100%" class="layout border user_options"
  568. id="profile_settings">
  569. <tr class="colhead_dark">
  570. <td colspan="2">
  571. <strong>Profile</strong>
  572. </td>
  573. </tr>
  574. <!-- Avatar URL -->
  575. <tr id="pers_avatar_tr">
  576. <td class="label tooltip" title="512 KiB max size / 600 px max height">
  577. <strong>Avatar URL</strong>
  578. </td>
  579. <td>
  580. <input type="text" size="50" name="avatar" id="avatar"
  581. value="<?=display_str($Avatar)?>" />
  582. </td>
  583. </tr>
  584. <!-- Second avatar URL -->
  585. <?php if ($HasSecondAvatar) { ?>
  586. <tr id="pers_avatar2_tr">
  587. <td class="label">
  588. <strong>Second avatar URL</strong>
  589. </td>
  590. <td>
  591. <input type="text" size="50" name="second_avatar" id="second_avatar"
  592. value="<?=$Rewards['SecondAvatar']?>" />
  593. </td>
  594. </tr>
  595. <?php }
  596. # Avatar mouseover text
  597. if ($HasAvatarMouseOverText) { ?>
  598. <tr id="pers_avatarhover_tr">
  599. <td class="label">
  600. <strong>Avatar mouseover text</strong>
  601. </td>
  602. <td>
  603. <input type="text" size="50" name="avatar_mouse_over_text" id="avatar_mouse_over_text"
  604. value="<?=$Rewards['AvatarMouseOverText']?>" />
  605. </td>
  606. </tr>
  607. <?php }
  608. # Donor icon mouseover text
  609. if ($HasDonorIconMouseOverText) { ?>
  610. <tr id="pers_donorhover_tr">
  611. <td class="label">
  612. <strong>Donor icon mouseover text</strong>
  613. </td>
  614. <td>
  615. <input type="text" size="50" name="donor_icon_mouse_over_text" id="donor_icon_mouse_over_text"
  616. value="<?=$Rewards['IconMouseOverText']?>" />
  617. </td>
  618. </tr>
  619. <?php }
  620. # Donor icon link
  621. if ($HasDonorIconLink) { ?>
  622. <tr id="pers_donorlink_tr">
  623. <td class="label">
  624. <strong>Donor icon link</strong>
  625. </td>
  626. <td>
  627. <input type="text" size="50" name="donor_icon_link" id="donor_icon_link"
  628. value="<?=$Rewards['CustomIconLink']?>" />
  629. </td>
  630. </tr>
  631. <?php }
  632. # Custom donor icon URL
  633. if ($HasCustomDonorIcon) { ?>
  634. <tr id="pers_donoricon_tr">
  635. <td class="label">
  636. <strong>Custom donor icon URL</strong>
  637. </td>
  638. <td>
  639. <input type="text" size="50" name="donor_icon_custom_url" id="donor_icon_custom_url"
  640. value="<?=$Rewards['CustomIcon']?>" />
  641. </td>
  642. </tr>
  643. <?php }
  644. # Donor forum honorific
  645. if ($HasDonorForum) { ?>
  646. <tr id="pers_donorforum_tr">
  647. <td class="label">
  648. <strong>Donor forum honorific</strong>
  649. </td>
  650. <td>
  651. <div>
  652. <label>
  653. <strong>Prefix</strong>
  654. <input type="text" size="30" maxlength="30" name="donor_title_prefix" id="donor_title_prefix"
  655. value="<?=$DonorTitles['Prefix']?>" />
  656. </label>
  657. </div>
  658. <div>
  659. <label>
  660. <strong>Suffix</strong>
  661. <input type="text" size="30" maxlength="30" name="donor_title_suffix" id="donor_title_suffix"
  662. value="<?=$DonorTitles['Suffix']?>" />
  663. </label>
  664. </div>
  665. <div>
  666. <label>
  667. <strong>Hide comma</strong>
  668. <input type="checkbox" id="donor_title_comma" name="donor_title_comma" <?=!$DonorTitles['UseComma'] ? ' checked="checked"' : '' ?>
  669. />
  670. </label>
  671. </div>
  672. <strong>Preview</strong>
  673. <span id="donor_title_prefix_preview"></span>
  674. <?=$Username?>
  675. <span id="donor_title_comma_preview">,</span>
  676. <span id="donor_title_suffix_preview"></span>
  677. </td>
  678. </tr>
  679. <?php } ?>
  680. <!-- Profile title 1 -->
  681. <tr id="pers_proftitle_tr">
  682. <td class="label">
  683. <strong>Profile title 1</strong>
  684. </td>
  685. <td>
  686. <input type="text" size="50" name="profile_title" id="profile_title"
  687. value="<?=display_str($InfoTitle)?>" />
  688. </td>
  689. </tr>
  690. <!-- Profile info 1 -->
  691. <tr id="pers_profinfo_tr">
  692. <td class="label">
  693. <strong>Profile info 1</strong>
  694. </td>
  695. <td>
  696. <?php
  697. $textarea = new TEXTAREA_PREVIEW(
  698. $Name = 'info',
  699. $ID = 'info',
  700. $Value = display_str($Info) ?? '',
  701. ); ?>
  702. </td>
  703. </tr>
  704. <!-- Excuse this numbering confusion, we start numbering our profile info/titles at 1 in the donor_rewards table -->
  705. <?php if ($HasProfileInfo1) { ?>
  706. <tr id="pers_proftitle2_tr">
  707. <td class="label">
  708. <strong>Profile title 2</strong>
  709. </td>
  710. <td>
  711. <input type="text" size="50" name="profile_title_1" id="profile_title_1"
  712. value="<?=display_str($ProfileRewards['ProfileInfoTitle1'])?>" />
  713. </td>
  714. </tr>
  715. <!-- 2 -->
  716. <tr id="pers_profinfo2_tr">
  717. <td class="label">
  718. <strong>Profile info 2</strong>
  719. </td>
  720. <td>
  721. <?php
  722. $textarea = new TEXTAREA_PREVIEW(
  723. $Name = 'profile_info_1',
  724. $ID = 'profile_info_1',
  725. $Value = display_str($ProfileRewards['ProfileInfo1']) ?? '',
  726. ); ?>
  727. </td>
  728. </tr>
  729. <?php }
  730. # 3
  731. if ($HasProfileInfo2) { ?>
  732. <tr id="pers_proftitle3_tr">
  733. <td class="label">
  734. <strong>Profile title 3</strong>
  735. </td>
  736. <td>
  737. <input type="text" size="50" name="profile_title_2" id="profile_title_2"
  738. value="<?=display_str($ProfileRewards['ProfileInfoTitle2'])?>" />
  739. </td>
  740. </tr>
  741. <!-- 3 -->
  742. <tr id="pers_profinfo3_tr">
  743. <td class="label">
  744. <strong>Profile info 3</strong>
  745. </td>
  746. <td>
  747. <?php
  748. $textarea = new TEXTAREA_PREVIEW(
  749. $Name = 'profile_info_2',
  750. $ID = 'profile_info_2',
  751. $Value = display_str($ProfileRewards['ProfileInfo2']) ?? '',
  752. ); ?>
  753. </td>
  754. </tr>
  755. <?php }
  756. # 4
  757. if ($HasProfileInfo3) { ?>
  758. <tr id="pers_proftitle4_tr">
  759. <td class="label">
  760. <strong>Profile title 4</strong>
  761. </td>
  762. <td>
  763. <input type="text" size="50" name="profile_title_3" id="profile_title_3"
  764. value="<?=display_str($ProfileRewards['ProfileInfoTitle3'])?>" />
  765. </td>
  766. </tr>
  767. <!-- 4 -->
  768. <tr id="pers_profinfo4_tr">
  769. <td class="label">
  770. <strong>Profile info 4</strong>
  771. </td>
  772. <td>
  773. <?php
  774. $textarea = new TEXTAREA_PREVIEW(
  775. $Name = 'profile_info_3',
  776. $ID = 'profile_info_3',
  777. $Value = display_str($ProfileRewards['ProfileInfo3']) ?? '',
  778. ); ?>
  779. </td>
  780. </tr>
  781. <?php }
  782. # 5
  783. if ($HasProfileInfo4) { ?>
  784. <tr id="pers_proftitle5_tr">
  785. <td class="label">
  786. <strong>Profile title 5</strong>
  787. </td>
  788. <td>
  789. <input type="text" size="50" name="profile_title_4" id="profile_title_4"
  790. value="<?=display_str($ProfileRewards['ProfileInfoTitle4'])?>" />
  791. </td>
  792. </tr>
  793. <!-- 5 -->
  794. <tr id="pers_profinfo5_tr">
  795. <td class="label">
  796. <strong>Profile info 5</strong>
  797. </td>
  798. <td>
  799. <?php
  800. $textarea = new TEXTAREA_PREVIEW(
  801. $Name = 'profile_info_4',
  802. $ID = 'profile_info_4',
  803. $Value = display_str($ProfileRewards['ProfileInfo4']) ?? '',
  804. ); ?>
  805. </td>
  806. </tr>
  807. <?php } ?>
  808. </table>
  809. <!-- Paranoia -->
  810. <table cellpadding="6" cellspacing="1" border="0" width="100%" class="layout border user_options"
  811. id="paranoia_settings">
  812. <tr class="colhead_dark">
  813. <td colspan="2">
  814. <strong>Paranoia</strong>
  815. </td>
  816. </tr>
  817. <tr>
  818. <td class="label">&nbsp;</td>
  819. <td>
  820. <p>
  821. <strong>Select the profile elements you wish to display to other users.</strong>
  822. </p>
  823. <p>
  824. For example, if you select "Show count" for "Requests (filled)," the number of requests you have filled
  825. will be visible.
  826. If you select "Show bounty," the amount of request bounty you have received will be visible.
  827. If you select "Show list," the full list of requests you have filled will be visible.
  828. </p>
  829. <p>
  830. <span class="warning">
  831. Note: Paranoia has nothing to do with your security on this site.
  832. These settings only determine if others can view your site activity.
  833. Some information will remain available in the site log.
  834. </span>
  835. </p>
  836. </td>
  837. </tr>
  838. <!-- Recent activity -->
  839. <tr id="para_lastseen_tr">
  840. <td class="label">
  841. <strong>Recent activity</strong>
  842. </td>
  843. <td>
  844. <label>
  845. <input type="checkbox" name="p_lastseen" <?=checked(!in_array('lastseen', $Paranoia))?>
  846. />
  847. Last seen
  848. </label>
  849. </td>
  850. </tr>
  851. <!-- Presets -->
  852. <tr id="para_presets_tr">
  853. <td class="label">
  854. <strong>Presets</strong>
  855. </td>
  856. <td>
  857. <input type="button" onclick="ParanoiaResetOff();" value="Everything" />
  858. <input type="button" onclick="ParanoiaResetStats();" value="Stats Only" />
  859. <input type="button" onclick="ParanoiaResetOn();" value="Nothing" />
  860. </td>
  861. </tr>
  862. <!-- Donations -->
  863. <tr id="para_donations_tr">
  864. <td class="label">
  865. <strong>Donations</strong>
  866. </td>
  867. <td>
  868. <input type="checkbox" id="p_donor_stats" name="p_donor_stats" onchange="AlterParanoia();" <?=$DonorIsVisible ? ' checked="checked"' : ''?>
  869. />
  870. <label for="p_donor_stats">Show donor stats</label>
  871. <input type="checkbox" id="p_donor_heart" name="p_donor_heart" onchange="AlterParanoia();" <?=checked(!in_array('hide_donor_heart', $Paranoia))?>
  872. />
  873. <label for="p_donor_heart">Show donor heart</label>
  874. </td>
  875. </tr>
  876. <!-- Statistics -->
  877. <tr id="para_stats_tr">
  878. <td class="label">
  879. <strong>Statistics</strong>
  880. </td>
  881. <td>
  882. <?php
  883. $UploadChecked = checked(!in_array('uploaded', $Paranoia));
  884. $DownloadChecked = checked(!in_array('downloaded', $Paranoia));
  885. $RatioChecked = checked(!in_array('ratio', $Paranoia));
  886. ?>
  887. <label><input type="checkbox" name="p_uploaded" onchange="AlterParanoia();" <?=$UploadChecked?> /> Uploaded</label>&ensp;
  888. <label><input type="checkbox" name="p_downloaded" onchange="AlterParanoia();" <?=$DownloadChecked?> /> Downloaded</label>&ensp;
  889. <label><input type="checkbox" name="p_ratio" onchange="AlterParanoia();" <?=$RatioChecked?> /> Ratio</label>
  890. </td>
  891. </tr>
  892. <!-- Required Ratio -->
  893. <tr id="para_reqratio_tr">
  894. <td class="label">
  895. <strong>Required Ratio</strong>
  896. </td>
  897. <td>
  898. <label>
  899. <input type="checkbox" name="p_requiredratio" <?=checked(!in_array('requiredratio', $Paranoia))?>
  900. /> Required Ratio
  901. </label>
  902. </td>
  903. </tr>
  904. <!-- Comments (torrents) -->
  905. <tr id="para_comments_tr">
  906. <td class="label">
  907. <strong>Comments (torrents)</strong>
  908. </td>
  909. <td>
  910. <?php display_paranoia('torrentcomments'); ?>
  911. </td>
  912. </tr>
  913. <!-- Collections (started) -->
  914. <tr id="para_collstart_tr">
  915. <td class="label">
  916. <strong>Collections (started)</strong>
  917. </td>
  918. <td>
  919. <?php display_paranoia('collages'); ?>
  920. </td>
  921. </tr>
  922. <!-- Collections (contributed to) -->
  923. <tr id="para_collcontr_tr">
  924. <td class="label">
  925. <strong>Collections (contributed to)</strong>
  926. </td>
  927. <td>
  928. <?php display_paranoia('collagecontribs'); ?>
  929. </td>
  930. </tr>
  931. <!-- Requests (filled) -->
  932. <tr id="para_reqfill_tr">
  933. <td class="label">
  934. <strong>Requests (filled)</strong>
  935. </td>
  936. <td>
  937. <?php
  938. $RequestsFilledCountChecked = checked(!in_array('requestsfilled_count', $Paranoia));
  939. $RequestsFilledBountyChecked = checked(!in_array('requestsfilled_bounty', $Paranoia));
  940. $RequestsFilledListChecked = checked(!in_array('requestsfilled_list', $Paranoia));
  941. ?>
  942. <label><input type="checkbox" name="p_requestsfilled_count" onchange="AlterParanoia();" <?=$RequestsFilledCountChecked?> /> Show
  943. count</label>&nbsp;
  944. <label><input type="checkbox" name="p_requestsfilled_bounty" onchange="AlterParanoia();" <?=$RequestsFilledBountyChecked?> /> Show
  945. bounty</label>&nbsp;
  946. <label><input type="checkbox" name="p_requestsfilled_list" onchange="AlterParanoia();" <?=$RequestsFilledListChecked?> /> Show list</label>
  947. </td>
  948. </tr>
  949. <!-- Requests (voted for) -->
  950. <tr id="para_reqvote_tr">
  951. <td class="label">
  952. <strong>Requests (voted for)</strong>
  953. </td>
  954. <td>
  955. <?php
  956. $RequestsVotedCountChecked = checked(!in_array('requestsvoted_count', $Paranoia));
  957. $RequestsVotedBountyChecked = checked(!in_array('requestsvoted_bounty', $Paranoia));
  958. $RequestsVotedListChecked = checked(!in_array('requestsvoted_list', $Paranoia));
  959. ?>
  960. <label><input type="checkbox" name="p_requestsvoted_count" onchange="AlterParanoia();" <?=$RequestsVotedCountChecked?> /> Show
  961. count</label>&nbsp;
  962. <label><input type="checkbox" name="p_requestsvoted_bounty" onchange="AlterParanoia();" <?=$RequestsVotedBountyChecked?> /> Show
  963. bounty</label>&nbsp;
  964. <label><input type="checkbox" name="p_requestsvoted_list" onchange="AlterParanoia();" <?=$RequestsVotedListChecked?> /> Show list</label>
  965. </td>
  966. </tr>
  967. <!-- Uploaded torrents -->
  968. <tr id="para_upltor_tr">
  969. <td class="label">
  970. <strong>Uploaded torrents</strong>
  971. </td>
  972. <td>
  973. <?php display_paranoia('uploads'); ?>
  974. </td>
  975. </tr>
  976. <!-- Uploaded torrents (unique groups) -->
  977. <tr id="para_uplunique_tr">
  978. <td class="label">
  979. <strong>Uploaded torrents (unique groups)</strong>
  980. </td>
  981. <td>
  982. <?php display_paranoia('uniquegroups'); ?>
  983. </td>
  984. </tr>
  985. <!-- Torrents (seeding) -->
  986. <tr id="para_torseed_tr">
  987. <td class="label">
  988. <strong>Torrents (seeding)</strong>
  989. </td>
  990. <td>
  991. <?php display_paranoia('seeding'); ?>
  992. </td>
  993. </tr>
  994. <!-- Torrents (leeching) -->
  995. <tr id="para_torleech_tr">
  996. <td class="label">
  997. <strong>Torrents (leeching)</strong>
  998. </td>
  999. <td>
  1000. <?php display_paranoia('leeching'); ?>
  1001. </td>
  1002. </tr>
  1003. <!-- Torrents (snatched) -->
  1004. <tr id="para_torsnatch_tr">
  1005. <td class="label">
  1006. <strong>Torrents (snatched)</strong>
  1007. </td>
  1008. <td>
  1009. <?php display_paranoia('snatched'); ?>
  1010. </td>
  1011. </tr>
  1012. <!-- Torrents (upload subscriptions) -->
  1013. <tr id="para_torsubscr_tr">
  1014. <td class="label tooltip" title="Can others subscribe to your uploads?">
  1015. <strong>Torrents (upload subscriptions)</strong>
  1016. </td>
  1017. <td>
  1018. <label>
  1019. <input type="checkbox" name="p_notifications" <?=checked(!in_array('notifications', $Paranoia))?>
  1020. /> Allow torrent upload subscriptions
  1021. </label>
  1022. </td>
  1023. </tr>
  1024. <?php
  1025. $DB->query("
  1026. SELECT COUNT(UserID)
  1027. FROM users_info
  1028. WHERE Inviter = ?", $UserID);
  1029. list($Invited) = $DB->next_record();
  1030. ?>
  1031. <!-- Invitees -->
  1032. <tr id="para_invited_tr">
  1033. <td class="label">
  1034. <strong>Invitees</strong>
  1035. </td>
  1036. <td>
  1037. <label>
  1038. <input type="checkbox" name="p_invitedcount" <?=checked(!in_array('invitedcount', $Paranoia))?>
  1039. /> Show count
  1040. </label>
  1041. </td>
  1042. </tr>
  1043. <?php
  1044. $DB->query("
  1045. SELECT COUNT(ArtistID)
  1046. FROM torrents_artists
  1047. WHERE UserID = ?", $UserID);
  1048. list($ArtistsAdded) = $DB->next_record();
  1049. ?>
  1050. <!-- Artists added -->
  1051. <tr id="para_artistsadded_tr">
  1052. <td class="label">
  1053. <strong>Artists added</strong>
  1054. </td>
  1055. <td>
  1056. <label>
  1057. <input type="checkbox" name="p_artistsadded" <?=checked(!in_array('artistsadded', $Paranoia))?>
  1058. /> Show count
  1059. </label>
  1060. </td>
  1061. </tr>
  1062. <!-- Preview paranoia -->
  1063. <tr id="para_preview_tr">
  1064. <td></td>
  1065. <td><a href="#" id="preview_paranoia" class="brackets">Preview paranoia</a></td>
  1066. </tr>
  1067. </table>
  1068. <!-- Security -->
  1069. <table cellpadding="6" cellspacing="1" border="0" width="100%" class="layout border user_options"
  1070. id="security_settings">
  1071. <tr class="colhead_dark">
  1072. <td colspan="2">
  1073. <strong>Security</strong>
  1074. </td>
  1075. </tr>
  1076. <!-- 2FA, U2F, and PGP -->
  1077. <tr id="acc_2fa_tr">
  1078. <td class="label">
  1079. <strong>2FA, U2F, and PGP</strong>
  1080. </td>
  1081. <td>
  1082. <a href="user.php?action=2fa">Click here to view additional account security options</a>
  1083. </td>
  1084. </tr>
  1085. <!-- Current password -->
  1086. <tr id="acc_currentpassword_tr">
  1087. <td class="label">
  1088. <strong>Current password</strong>
  1089. </td>
  1090. <td>
  1091. <div>
  1092. <input type="password" size="40" name="cur_pass" id="cur_pass" maxlength="307200" value="" />
  1093. </div>
  1094. <strong class="important_text">
  1095. When changing any of the settings below, you must enter your current password here
  1096. </strong>
  1097. </td>
  1098. </tr>
  1099. <tr id="acc_resetpk_tr">
  1100. <td class="label">
  1101. <strong>Reset passkey</strong>
  1102. </td>
  1103. <td>
  1104. <div>
  1105. <label>
  1106. <input type="checkbox" name="resetpasskey" id="resetpasskey" />
  1107. Reset your passkey?
  1108. </label>
  1109. </div>
  1110. <p class="setting_description">
  1111. Any active torrents must be downloaded again to continue leeching/seeding
  1112. </p>
  1113. </td>
  1114. </tr>
  1115. <!-- IRC key -->
  1116. <tr id="acc_irckey_tr">
  1117. <td class="label">
  1118. <strong>IRC key</strong>
  1119. </td>
  1120. <td>
  1121. <div>
  1122. <input type="text" size="50" name="irckey" id="irckey"
  1123. value="<?=display_str($IRCKey)?>" />
  1124. </div>
  1125. <p class="setting_description">
  1126. This key will be used when authenticating with <?=BOT_NICK?> on the
  1127. <a href="wiki.php?action=article&name=IRC">IRC network</a>.
  1128. <ul>
  1129. <li>This value is stored in plaintext and should not be your password</li>
  1130. <li>IRC keys must be between 6 and 32 characters</li>
  1131. </ul>
  1132. </td>
  1133. </tr>
  1134. <!-- API keys -->
  1135. <tr id="acc_api_keys_tr">
  1136. <td class="label">
  1137. <strong>API Keys</strong>
  1138. </td>
  1139. <td>
  1140. <p>
  1141. API keys can be generated to access our
  1142. <a href="https://docs.biotorrents.de" target="_blank">JSON API</a>.
  1143. Please rememeber to revoke tokens you no longer use.
  1144. </p>
  1145. <p>
  1146. <strong class="important_text">
  1147. Treat your tokens like passwords and keep them secret.
  1148. </strong>
  1149. </p>
  1150. <table class="api_keys">
  1151. <tr class="colhead">
  1152. <th>Name</th>
  1153. <th>Created</th>
  1154. <th>Revoke</th>
  1155. </tr>
  1156. <?php
  1157. $DB->query("
  1158. SELECT
  1159. `ID`,
  1160. `Name`,
  1161. `Token`,
  1162. `Created`
  1163. FROM
  1164. `api_user_tokens`
  1165. WHERE
  1166. `UserID` = '$UserID'
  1167. AND `Revoked` = '0'
  1168. ORDER BY
  1169. `Created`
  1170. DESC
  1171. ");
  1172. foreach ($DB->to_array(false, MYSQLI_ASSOC, false) as $row) { ?>
  1173. <tr>
  1174. <td>
  1175. <?= $row['Name'] ?>
  1176. </td>
  1177. <td>
  1178. <?= time_diff($row['Created']) ?>
  1179. </td>
  1180. <td style='text-align: center'>
  1181. <a
  1182. href='user.php?action=token&amp;do=revoke&amp;user_id=<?=$LoggedUser['ID'] ?>&amp;token_id=<?= $row['ID'] ?>'>Revoke</a>
  1183. </tr>
  1184. <?php
  1185. } /* foreach */ ?>
  1186. </table>
  1187. <p>
  1188. <a
  1189. href='user.php?action=token&amp;user_id=<?= $LoggedUser['ID'] ?>'>Click
  1190. here to create a new token</a>
  1191. </p>
  1192. </td>
  1193. </tr>
  1194. <!-- Email address -->
  1195. <tr id="acc_email_tr">
  1196. <td class="label">
  1197. <strong>Email address</strong>
  1198. </td>
  1199. <td>
  1200. <div>
  1201. <input type="email" size="50" name="email" id="email"
  1202. value="<?=display_str($Email)?>" />
  1203. </div>
  1204. </td>
  1205. </tr>
  1206. <!-- Password -->
  1207. <tr id="acc_password_tr">
  1208. <td class="label">
  1209. <strong>Password</strong>
  1210. </td>
  1211. <td>
  1212. <div>
  1213. <label>
  1214. <input type="password" minlength="15" size="40" name="new_pass_1" id="new_pass_1" maxlength="307200"
  1215. value="" placeholder="New password" />
  1216. <strong id="pass_strength"></strong>
  1217. </label>
  1218. </div>
  1219. <div>
  1220. <label>
  1221. <input type="password" minlength="15" size="40" name="new_pass_2" id="new_pass_2" maxlength="307200"
  1222. value="" placeholder="Confirm new password" />
  1223. <strong id="pass_match"></strong>
  1224. </label>
  1225. </div>
  1226. <div>
  1227. <textarea id="password_display" name="password_display" rows="2" cols="50" onclick="this.select();"
  1228. readonly></textarea>
  1229. <button type="button" id="password_create" onclick="pwgen('password_display');">Generate</button>
  1230. </div>
  1231. <p class="setting_description">
  1232. <?= $ENV->PASSWORD_ADVICE ?>
  1233. </p>
  1234. </td>
  1235. </tr>
  1236. </table>
  1237. </div>
  1238. </form>
  1239. </div>
  1240. <?php View::show_footer();