Frontend elements to SugoiMusic, including CSS and public/private headers.
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

552 righe
25 KiB

  1. <?
  2. define('FOOTER_FILE', SERVER_ROOT.'/design/privatefooter.php');
  3. ?>
  4. <!DOCTYPE html>
  5. <html lang="en">
  6. <head>
  7. <title><?=display_str($PageTitle)?></title>
  8. <meta charset="utf-8" />
  9. <meta name="userid" content="<?=G::$LoggedUser['ID']?>" />
  10. <meta name="authkey" content="<?=G::$LoggedUser['AuthKey']?>" />
  11. <link rel="shortcut icon" href="favicon.ico?v=<?=md5_file('favicon.ico')?>" />
  12. <link rel="search" type="application/opensearchdescription+xml" title="<?=SITE_NAME?>" href="<?=STATIC_SERVER?>opensearch.xml">
  13. <link rel="alternate" type="application/rss+xml"
  14. href="feeds.php?feed=feed_news&amp;user=<?=G::$LoggedUser['ID']?>&amp;auth=<?=G::$LoggedUser['RSS_Auth']?>&amp;passkey=<?=G::$LoggedUser['torrent_pass']?>&amp;authkey=<?=G::$LoggedUser['AuthKey']?>"
  15. title="<?=SITE_NAME?> - News" />
  16. <link rel="alternate" type="application/rss+xml"
  17. href="feeds.php?feed=feed_blog&amp;user=<?=G::$LoggedUser['ID']?>&amp;auth=<?=G::$LoggedUser['RSS_Auth']?>&amp;passkey=<?=G::$LoggedUser['torrent_pass']?>&amp;authkey=<?=G::$LoggedUser['AuthKey']?>"
  18. title="<?=SITE_NAME?> - Blog" />
  19. <link rel="alternate" type="application/rss+xml"
  20. href="feeds.php?feed=feed_changelog&amp;user=<?=G::$LoggedUser['ID']?>&amp;auth=<?=G::$LoggedUser['RSS_Auth']?>&amp;passkey=<?=G::$LoggedUser['torrent_pass']?>&amp;authkey=<?=G::$LoggedUser['AuthKey']?>"
  21. title="<?=SITE_NAME?> - Gazelle Change Log" />
  22. <link rel="alternate" type="application/rss+xml"
  23. href="feeds.php?feed=torrents_notify_<?=G::$LoggedUser['torrent_pass']?>&amp;user=<?=G::$LoggedUser['ID']?>&amp;auth=<?=G::$LoggedUser['RSS_Auth']?>&amp;passkey=<?=G::$LoggedUser['torrent_pass']?>&amp;authkey=<?=G::$LoggedUser['AuthKey']?>"
  24. title="<?=SITE_NAME?> - P.T.N." />
  25. <?
  26. if (isset(G::$LoggedUser['Notify'])) {
  27. foreach (G::$LoggedUser['Notify'] as $Filter) {
  28. list($FilterID, $FilterName) = $Filter;
  29. ?>
  30. <link rel="alternate" type="application/rss+xml"
  31. href="feeds.php?feed=torrents_notify_<?=$FilterID?>_<?=G::$LoggedUser['torrent_pass']?>&amp;user=<?=G::$LoggedUser['ID']?>&amp;auth=<?=G::$LoggedUser['RSS_Auth']?>&amp;passkey=<?=G::$LoggedUser['torrent_pass']?>&amp;authkey=<?=G::$LoggedUser['AuthKey']?>&amp;name=<?=urlencode($FilterName)?>"
  32. title="<?=SITE_NAME?> - <?=display_str($FilterName)?>" />
  33. <?
  34. }
  35. }
  36. ?>
  37. <link rel="alternate" type="application/rss+xml"
  38. href="feeds.php?feed=torrents_all&amp;user=<?=G::$LoggedUser['ID']?>&amp;auth=<?=G::$LoggedUser['RSS_Auth']?>&amp;passkey=<?=G::$LoggedUser['torrent_pass']?>&amp;authkey=<?=G::$LoggedUser['AuthKey']?>"
  39. title="<?=SITE_NAME?> - All Torrents" />
  40. <link rel="alternate" type="application/rss+xml"
  41. href="feeds.php?feed=torrents_movies&amp;user=<?=G::$LoggedUser['ID']?>&amp;auth=<?=G::$LoggedUser['RSS_Auth']?>&amp;passkey=<?=G::$LoggedUser['torrent_pass']?>&amp;authkey=<?=G::$LoggedUser['AuthKey']?>"
  42. title="<?=SITE_NAME?> - Movie Torrents" />
  43. <link rel="alternate" type="application/rss+xml"
  44. href="feeds.php?feed=torrents_anime&amp;user=<?=G::$LoggedUser['ID']?>&amp;auth=<?=G::$LoggedUser['RSS_Auth']?>&amp;passkey=<?=G::$LoggedUser['torrent_pass']?>&amp;authkey=<?=G::$LoggedUser['AuthKey']?>"
  45. title="<?=SITE_NAME?> - Anime Torrents" />
  46. <link rel="alternate" type="application/rss+xml"
  47. href="feeds.php?feed=torrents_manga&amp;user=<?=G::$LoggedUser['ID']?>&amp;auth=<?=G::$LoggedUser['RSS_Auth']?>&amp;passkey=<?=G::$LoggedUser['torrent_pass']?>&amp;authkey=<?=G::$LoggedUser['AuthKey']?>"
  48. title="<?=SITE_NAME?> - Manga Torrents" />
  49. <link rel="alternate" type="application/rss+xml"
  50. href="feeds.php?feed=torrents_games&amp;user=<?=G::$LoggedUser['ID']?>&amp;auth=<?=G::$LoggedUser['RSS_Auth']?>&amp;passkey=<?=G::$LoggedUser['torrent_pass']?>&amp;authkey=<?=G::$LoggedUser['AuthKey']?>"
  51. title="<?=SITE_NAME?> - Games Torrents" />
  52. <link rel="alternate" type="application/rss+xml"
  53. href="feeds.php?feed=torrents_other&amp;user=<?=G::$LoggedUser['ID']?>&amp;auth=<?=G::$LoggedUser['RSS_Auth']?>&amp;passkey=<?=G::$LoggedUser['torrent_pass']?>&amp;authkey=<?=G::$LoggedUser['AuthKey']?>"
  54. title="<?=SITE_NAME?> - Other Torrents" />
  55. <link rel="stylesheet" type="text/css"
  56. href="<?=STATIC_SERVER?>styles/global.css?v=<?=filemtime(SERVER_ROOT.STATIC_SERVER.'styles/global.css')?>" />
  57. <link rel="stylesheet" href="<?=STATIC_SERVER?>styles/tooltipster/style.css?v=<?=filemtime(SERVER_ROOT.STATIC_SERVER.'styles/tooltipster/style.css')?>" type="text/css" media="screen" />
  58. <?
  59. if (empty(G::$LoggedUser['StyleURL'])) {
  60. if (($StyleColors = G::$Cache->get_value('stylesheet_colors')) === false) {
  61. G::$DB->query('SELECT LOWER(REPLACE(Name, " ", "_")) AS Name, Color FROM stylesheets WHERE COLOR IS NOT NULL');
  62. while (list($StyleName, $StyleColor) = G::$DB->next_record()) {
  63. $StyleColors[$StyleName] = $StyleColor;
  64. }
  65. G::$Cache->cache_value('stylesheet_colors', $StyleColors, 0);
  66. }
  67. if (isset($StyleColors[G::$LoggedUser['StyleName']])) { ?>
  68. <meta name="theme-color" content="<?=$StyleColors[G::$LoggedUser['StyleName']]?>">
  69. <? } ?>
  70. <link rel="stylesheet" type="text/css" title="<?=G::$LoggedUser['StyleName']?>" media="screen" href="<?=STATIC_SERVER?>styles/<?=G::$LoggedUser['StyleName']?>/style.css?v=<?=filemtime(SERVER_ROOT.STATIC_SERVER.'styles/'.G::$LoggedUser['StyleName'].'/style.css')?>" />
  71. <?
  72. } else {
  73. $StyleURLInfo = parse_url(G::$LoggedUser['StyleURL']);
  74. if (substr(G::$LoggedUser['StyleURL'], -4) == '.css'
  75. && empty($StyleURLInfo['query']) && empty($StyleURLInfo['fragment'])
  76. && ($StyleURLInfo['host'] == SITE_DOMAIN)
  77. && file_exists(SERVER_ROOT.$StyleURLInfo['path'])) {
  78. $StyleURL = G::$LoggedUser['StyleURL'].'?v='.filemtime(SERVER_ROOT.$StyleURLInfo['path']);
  79. } else {
  80. $StyleURL = G::$LoggedUser['StyleURL'];
  81. }
  82. ?>
  83. <link rel="stylesheet" type="text/css" media="screen" href="<?=$StyleURL?>" title="External CSS" />
  84. <?
  85. }
  86. $ExtraCSS = explode(',', $CSSIncludes);
  87. foreach ($ExtraCSS as $CSS) {
  88. if (trim($CSS) == '') {
  89. continue;
  90. }
  91. ?>
  92. <link rel="stylesheet" type="text/css" media="screen" href="<?=STATIC_SERVER."styles/$CSS/style.css?v=".filemtime(SERVER_ROOT.STATIC_SERVER."styles/$CSS/style.css")?>" />
  93. <?
  94. }
  95. $Scripts = array_merge(array('jquery', 'global', 'ajax.class', 'jquery.autocomplete', 'autocomplete', 'tooltipster', 'tooltipster_settings'), explode(',', $JSIncludes));
  96. foreach ($Scripts as $Script) {
  97. if (trim($Script) == '') { continue; }
  98. $Async = (in_array($Script, ['jquery','global','ajax.class'])) ? '' : 'async';
  99. if (($ScriptStats = G::$Cache->get_value("script_stats_$Script")) === false || $ScriptStats['mtime'] != filemtime(SERVER_ROOT.STATIC_SERVER."functions/$Script.js")) {
  100. $ScriptStats['mtime'] = filemtime(SERVER_ROOT.STATIC_SERVER."functions/$Script.js");
  101. $ScriptStats['hash'] = base64_encode(hash_file(INTEGRITY_ALGO, SERVER_ROOT.STATIC_SERVER."functions/$Script.js", true));
  102. $ScriptStats['algo'] = INTEGRITY_ALGO;
  103. G::$Cache->cache_value("script_stats_$Script", $ScriptStats);
  104. }
  105. ?>
  106. <script src="<?=STATIC_SERVER."functions/$Script.js?v=$ScriptStats[mtime]"?>" type="text/javascript" integrity="<?="$ScriptStats[algo]-$ScriptStats[hash]"?>" <?=$Async?>></script>
  107. <?
  108. }
  109. global $ClassLevels;
  110. // Get notifications early to change menu items if needed
  111. global $NotificationSpans;
  112. $NotificationsManager = new NotificationsManager(G::$LoggedUser['ID']);
  113. $Notifications = $NotificationsManager->get_notifications();
  114. $UseNoty = $NotificationsManager->use_noty();
  115. $NewSubscriptions = false;
  116. $NotificationSpans = array();
  117. foreach ($Notifications as $Type => $Notification) {
  118. if ($Type === NotificationsManager::SUBSCRIPTIONS) {
  119. $NewSubscriptions = true;
  120. }
  121. if ($UseNoty) {
  122. $NotificationSpans[] = "<span class=\"noty-notification\" style=\"display: none;\" data-noty-type=\"$Type\" data-noty-id=\"$Notification[id]\" data-noty-importance=\"$Notification[importance]\" data-noty-url=\"$Notification[url]\">$Notification[message]</span>";
  123. }
  124. }
  125. if ($UseNoty && !empty($NotificationSpans)) {
  126. NotificationsManagerView::load_js();
  127. }
  128. if ($NotificationsManager->is_skipped(NotificationsManager::SUBSCRIPTIONS)) {
  129. $NewSubscriptions = Subscriptions::has_new_subscriptions();
  130. }
  131. ?>
  132. </head>
  133. <?
  134. if (!empty(G::$LoggedUser['StyleAdditions'])) {
  135. $BodyStyles = 'style_'.implode(' style_', G::$LoggedUser['StyleAdditions']);
  136. }
  137. ?>
  138. <body id="<?=$Document == 'collages' ? 'collage' : $Document?>" class="<?=($BodyStyles??'')?>">
  139. <div id="wrapper">
  140. <h1 class="hidden"><?=SITE_NAME?></h1>
  141. <div id="header">
  142. <div id="logo">
  143. <a href="index.php"></a>
  144. </div>
  145. <div id="menu">
  146. <ul>
  147. <li id="nav_torrents"<?=
  148. Format::add_class($PageID, ['torrents', false, false], 'active', true)?>>
  149. <a href="torrents.php">Torrents</a>
  150. </li>
  151. <li id="nav_collages"<?=
  152. Format::add_class($PageID, ['collages'], 'active', true)?>>
  153. <a href="collages.php">Collections</a>
  154. </li>
  155. <li id="nav_requests"<?=
  156. Format::add_class($PageID, ['requests'], 'active', true)?>>
  157. <a href="requests.php">Requests</a>
  158. </li>
  159. <li id="nav_forums"<?=
  160. Format::add_class($PageID, ['forums'], 'active', true)?>>
  161. <a href="forums.php">Forums</a>
  162. </li>
  163. <li id="nav_irc"<?=
  164. Format::add_class($PageID, ['chat'], 'active', true)?>>
  165. <a href="chat.php">IRC</a>
  166. </li>
  167. <li id="nav_top10"<?=
  168. Format::add_class($PageID, ['top10'], 'active', true)?>>
  169. <a href="top10.php">Top 10</a>
  170. </li>
  171. <li id="nav_rules"<?=
  172. Format::add_class($PageID, ['rules'], 'active', true)?>>
  173. <a href="rules.php">Rules</a>
  174. </li>
  175. <li id="nav_wiki"<?=
  176. Format::add_class($PageID, ['wiki'], 'active', true)?>>
  177. <a href="wiki.php">Wiki</a>
  178. </li>
  179. <li id="nav_user" class="nav_dropdown" <?=Format::add_class($PageID, ['user', false, false], 'active', true, 'id')?>>
  180. <a href="user.php?id=<?=G::$LoggedUser['ID']?>" class="username"><?=G::$LoggedUser['Username']?></a>
  181. <div id="user_menu">
  182. <a href="user.php?action=edit&amp;userid=<?=G::$LoggedUser['ID']?>">Edit</a>
  183. <a href="logout.php?auth=<?=G::$LoggedUser['AuthKey']?>">Logout</a>
  184. </div>
  185. </li>
  186. <li id="nav_links" class="nav_dropdown<?=$NewSubscriptions ? ' highlite' : ''?>">
  187. <a>▾</a>
  188. <div id="links_menu">
  189. <a href="<?=Inbox::get_inbox_link(); ?>">Inbox</a>
  190. <a href="staffpm.php">Staff Inbox</a>
  191. <a href="torrents.php?type=uploaded&amp;userid=<?=G::$LoggedUser['ID']?>">Uploads</a>
  192. <a href="bookmarks.php?type=torrents">Bookmarks</a>
  193. <? if (check_perms('site_torrents_notify')) { ?>
  194. <a href="user.php?action=notify">Notifications</a>
  195. <? } ?>
  196. <a href="userhistory.php?action=subscriptions">Subscriptions</a>
  197. <a href="comments.php">Comments</a>
  198. <a href="friends.php">Friends</a>
  199. <a href="better.php">Better</a>
  200. </div>
  201. </li>
  202. </ul>
  203. </div>
  204. <?
  205. if (isset(G::$LoggedUser['SearchType']) && G::$LoggedUser['SearchType']) { // Advanced search
  206. $UseAdvancedSearch = true;
  207. } else {
  208. $UseAdvancedSearch = false;
  209. }
  210. ?>
  211. <div id="searchbars">
  212. <form class="search_form" name="torrents" action="torrents.php" method="get">
  213. <? if ($UseAdvancedSearch) { ?>
  214. <input type="hidden" name="action" value="advanced" />
  215. <? } ?>
  216. <input id="torrentssearch" accesskey="t" spellcheck="false"
  217. onfocus="if (this.value == 'Torrents') { this.value = ''; }"
  218. onblur="if (this.value == '') { this.value = 'Torrents'; }"
  219. value="Torrents" placeholder="Torrents" type="text" name="<?=$UseAdvancedSearch ? 'groupname' : 'searchstr' ?>" size="17" />
  220. </form>
  221. <form class="search_form" name="artists" action="artist.php" method="get">
  222. <input id="artistsearch"<?=Users::has_autocomplete_enabled('search');
  223. ?> accesskey="a"
  224. spellcheck="false" autocomplete="off"
  225. onfocus="if (this.value == 'Artists') { this.value = ''; }"
  226. onblur="if (this.value == '') { this.value = 'Artists'; }"
  227. value="Artists" placeholder="Artists" type="text" name="artistname" size="17" />
  228. </form>
  229. <form class="search_form" name="requests" action="requests.php" method="get">
  230. <input id="requestssearch" spellcheck="false"
  231. onfocus="if (this.value == 'Requests') { this.value = ''; }"
  232. onblur="if (this.value == '') { this.value = 'Requests'; }"
  233. value="Requests" placeholder="Requests" type="text" name="search" size="17" />
  234. </form>
  235. <form class="search_form" name="forums" action="forums.php" method="get">
  236. <input value="search" type="hidden" name="action" />
  237. <input id="forumssearch"
  238. onfocus="if (this.value == 'Forums') { this.value = ''; }"
  239. onblur="if (this.value == '') { this.value = 'Forums'; }"
  240. value="Forums" placeholder="Forums" type="text" name="search" size="17" />
  241. </form>
  242. <!--
  243. <form class="search_form" name="wiki" action="wiki.php" method="get">
  244. <input type="hidden" name="action" value="search" />
  245. <input
  246. onfocus="if (this.value == 'Wiki') { this.value = ''; }"
  247. onblur="if (this.value == '') { this.value = 'Wiki'; }"
  248. value="Wiki" placeholder="Wiki" type="text" name="search" size="17" />
  249. </form>
  250. -->
  251. <form class="search_form" name="log" action="log.php" method="get">
  252. <input id="logsearch"
  253. onfocus="if (this.value == 'Log') { this.value = ''; }"
  254. onblur="if (this.value == '') { this.value = 'Log'; }"
  255. value="Log" placeholder="Log" type="text" name="search" size="17" />
  256. </form>
  257. <form class="search_form" name="users" action="user.php" method="get">
  258. <input type="hidden" name="action" value="search" />
  259. <input
  260. id="userssearch"
  261. onfocus="if (this.value == 'Users') { this.value = ''; }"
  262. onblur="if (this.value == '') { this.value = 'Users'; }"
  263. value="Users" placeholder="Users" type="text" name="search" size="20" />
  264. </form>
  265. </div>
  266. <div id="userinfo">
  267. <ul id="userinfo_major">
  268. <li id="nav_upload" class="brackets<?=Format::add_class($PageID, array('upload'), 'active', false)?>">
  269. <a href="upload.php">Upload</a>
  270. </li>
  271. <?
  272. if (check_perms('site_send_unlimited_invites')) {
  273. $Invites = ' (∞)';
  274. } elseif (G::$LoggedUser['Invites'] > 0) {
  275. $Invites = ' ('.G::$LoggedUser['Invites'].')';
  276. } else {
  277. $Invites = '';
  278. }
  279. ?>
  280. <li id="nav_invite" class="brackets<?=Format::add_class($PageID, array('user','invite'), 'active', false)?>">
  281. <a href="user.php?action=invite">Invite<?=$Invites?></a>
  282. </li>
  283. <li id="nav_donate" class="brackets<?=Format::add_class($PageID, array('donate'), 'active', false)?>">
  284. <a href="donate.php">Donate</a>
  285. </li>
  286. <li id="nav_staff" class="brackets<?=Format::add_class($PageID, array('staff'), 'active', false)?>">
  287. <a href="staff.php">Staff</a>
  288. </li>
  289. </ul>
  290. <ul id="userinfo_stats">
  291. <li id="stats_seeding">
  292. <a href="torrents.php?type=seeding&amp;userid=<?=G::$LoggedUser['ID']?>">Up</a>:
  293. <span class="stat tooltip" title="<?=Format::get_size(G::$LoggedUser['BytesUploaded'], 5)?>"><?=Format::get_size(G::$LoggedUser['BytesUploaded'])?></span>
  294. </li>
  295. <li id="stats_leeching">
  296. <a href="torrents.php?type=leeching&amp;userid=<?=G::$LoggedUser['ID']?>">Down</a>:
  297. <span class="stat tooltip" title="<?=Format::get_size(G::$LoggedUser['BytesDownloaded'], 5)?>"><?=Format::get_size(G::$LoggedUser['BytesDownloaded'])?></span>
  298. </li>
  299. <li id="stats_ratio">
  300. Ratio: <span class="stat"><?=Format::get_ratio_html(G::$LoggedUser['BytesUploaded'], G::$LoggedUser['BytesDownloaded'])?></span>
  301. </li>
  302. <? if (!empty(G::$LoggedUser['RequiredRatio']) && G::$LoggedUser['RequiredRatio'] > 0) { ?>
  303. <li id="stats_required">
  304. <a href="rules.php?p=ratio">Required</a>:
  305. <span class="stat tooltip" title="<?=number_format(G::$LoggedUser['RequiredRatio'], 5)?>"><?=number_format(G::$LoggedUser['RequiredRatio'], 2)?></span>
  306. </li>
  307. <? }
  308. if (G::$LoggedUser['FLTokens'] > 0) { ?>
  309. <li id="fl_tokens">
  310. <a href="wiki.php?action=article&amp;id=7">Tokens</a>:
  311. <span class="stat">
  312. <a href="userhistory.php?action=token_history&amp;userid=<?=G::$LoggedUser['ID']?>"><?=G::$LoggedUser['FLTokens']?></a>
  313. </span>
  314. </li>
  315. <? }
  316. ?>
  317. <li id="bonus_points">
  318. <a href="wiki.php?action=article&amp;id=8"><?=BONUS_POINTS?></a>:
  319. <span class="stat">
  320. <a href="store.php"><?=number_format(G::$LoggedUser['BonusPoints'])?></a>
  321. </span>
  322. </li>
  323. <? if (G::$LoggedUser['HnR'] > 0) { ?>
  324. <li id="hnr">
  325. <a href="snatchlist.php">HnRs</a>:
  326. <span class="stat">
  327. <a><?=G::$LoggedUser['HnR']?></a>
  328. </span>
  329. </li>
  330. <? }
  331. ?>
  332. </ul>
  333. </div>
  334. </div>
  335. <?
  336. //Start handling alert bars
  337. $Alerts = array();
  338. $ModBar = array();
  339. // Staff blog
  340. if (check_perms('users_mod')) {
  341. global $SBlogReadTime, $LatestSBlogTime;
  342. if (!$SBlogReadTime && ($SBlogReadTime = G::$Cache->get_value('staff_blog_read_'.G::$LoggedUser['ID'])) === false) {
  343. G::$DB->query("
  344. SELECT Time
  345. FROM staff_blog_visits
  346. WHERE UserID = ".G::$LoggedUser['ID']);
  347. if (list($SBlogReadTime) = G::$DB->next_record()) {
  348. $SBlogReadTime = strtotime($SBlogReadTime);
  349. } else {
  350. $SBlogReadTime = 0;
  351. }
  352. G::$Cache->cache_value('staff_blog_read_'.G::$LoggedUser['ID'], $SBlogReadTime, 1209600);
  353. }
  354. if (!$LatestSBlogTime && ($LatestSBlogTime = G::$Cache->get_value('staff_blog_latest_time')) === false) {
  355. G::$DB->query("
  356. SELECT MAX(Time)
  357. FROM staff_blog");
  358. list($LatestSBlogTime) = G::$DB->next_record();
  359. if ($LatestSBlogTime) {
  360. $LatestSBlogTime = strtotime($LatestSBlogTime);
  361. } else {
  362. $LatestSBlogTime = 0;
  363. }
  364. G::$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600);
  365. }
  366. if ($SBlogReadTime < $LatestSBlogTime) {
  367. $Alerts[] = '<a href="staffblog.php">New staff blog post!</a>';
  368. }
  369. }
  370. // Inbox
  371. if ($NotificationsManager->is_traditional(NotificationsManager::INBOX)) {
  372. $NotificationsManager->load_inbox();
  373. $NewMessages = $NotificationsManager->get_notifications();
  374. if (isset($NewMessages[NotificationsManager::INBOX])) {
  375. $Alerts[] = NotificationsManagerView::format_traditional($NewMessages[NotificationsManager::INBOX]);
  376. }
  377. $NotificationsManager->clear_notifications_array();
  378. }
  379. if (G::$LoggedUser['RatioWatch']) {
  380. $Alerts[] = '<a href="rules.php?p=ratio">Ratio Watch</a>: You have '.time_diff(G::$LoggedUser['RatioWatchEnds'], 3).' to get your ratio over your required ratio or your leeching abilities will be disabled.';
  381. } elseif (G::$LoggedUser['CanLeech'] != 1) {
  382. $Alerts[] = '<a href="rules.php?p=ratio">Ratio Watch</a>: Your downloading privileges are disabled until you meet your required ratio.';
  383. }
  384. // Torrents
  385. if ($NotificationsManager->is_traditional(NotificationsManager::TORRENTS)) {
  386. $NotificationsManager->load_torrent_notifications();
  387. $NewTorrents = $NotificationsManager->get_notifications();
  388. if (isset($NewTorrents[NotificationsManager::TORRENTS])) {
  389. $Alerts[] = NotificationsManagerView::format_traditional($NewTorrents[NotificationsManager::TORRENTS]);
  390. }
  391. $NotificationsManager->clear_notifications_array();
  392. }
  393. // Contests
  394. if ($ContestSettings = G::$Cache->get_value('contest_settings')) {
  395. if (time() > $ContestSettings['start'] && time() < $ContestSettings['end']) {
  396. $Alerts[] = '<a href="/contest.php">A Contest is Underway!</a>';
  397. }
  398. }
  399. if (check_perms('users_mod')) {
  400. $ModBar[] = '<a href="tools.php">Toolbox</a>';
  401. }
  402. if (check_perms('users_mod')) {
  403. $NumStaffPMs = G::$Cache->get_value('num_staff_pms_'.G::$LoggedUser['ID']);
  404. if ($NumStaffPMs === false) {
  405. if (check_perms('users_mod')) {
  406. $LevelCap = 1000;
  407. G::$DB->query("
  408. SELECT COUNT(ID)
  409. FROM staff_pm_conversations
  410. WHERE Status = 'Unanswered'
  411. AND (AssignedToUser = ".G::$LoggedUser['ID']."
  412. OR (LEAST('$LevelCap', Level) <= '".G::$LoggedUser['EffectiveClass']."'
  413. AND Level <= ".G::$LoggedUser['Class']."))");
  414. }
  415. if (G::$LoggedUser['PermissionID'] == FORUM_MOD) {
  416. G::$DB->query("
  417. SELECT COUNT(ID)
  418. FROM staff_pm_conversations
  419. WHERE Status='Unanswered'
  420. AND (AssignedToUser = ".G::$LoggedUser['ID']."
  421. OR Level = '". $Classes[FORUM_MOD]['Level'] . "')");
  422. }
  423. list($NumStaffPMs) = G::$DB->next_record();
  424. G::$Cache->cache_value('num_staff_pms_'.G::$LoggedUser['ID'], $NumStaffPMs , 1000);
  425. }
  426. if ($NumStaffPMs > 0) {
  427. $ModBar[] = '<a href="staffpm.php">'.$NumStaffPMs.' Staff PMs</a>';
  428. }
  429. }
  430. if (check_perms('admin_reports')) {
  431. // Torrent reports code
  432. $NumTorrentReports = G::$Cache->get_value('num_torrent_reportsv2');
  433. if ($NumTorrentReports === false) {
  434. G::$DB->query("
  435. SELECT COUNT(ID)
  436. FROM reportsv2
  437. WHERE Status = 'New'");
  438. list($NumTorrentReports) = G::$DB->next_record();
  439. G::$Cache->cache_value('num_torrent_reportsv2', $NumTorrentReports, 0);
  440. }
  441. $ModBar[] = '<a href="reportsv2.php">'.$NumTorrentReports.(($NumTorrentReports == 1) ? ' Report' : ' Reports').'</a>';
  442. // Other reports code
  443. $NumOtherReports = G::$Cache->get_value('num_other_reports');
  444. if ($NumOtherReports === false) {
  445. G::$DB->query("
  446. SELECT COUNT(ID)
  447. FROM reports
  448. WHERE Status = 'New'");
  449. list($NumOtherReports) = G::$DB->next_record();
  450. G::$Cache->cache_value('num_other_reports', $NumOtherReports, 0);
  451. }
  452. if ($NumOtherReports > 0) {
  453. $ModBar[] = '<a href="reports.php">'.$NumOtherReports.(($NumTorrentReports == 1) ? ' Other report' : ' Other reports').'</a>';
  454. }
  455. } elseif (check_perms('project_team')) {
  456. $NumUpdateReports = G::$Cache->get_value('num_update_reports');
  457. if ($NumUpdateReports === false) {
  458. G::$DB->query("
  459. SELECT COUNT(ID)
  460. FROM reports
  461. WHERE Status = 'New'
  462. AND Type = 'request_update'");
  463. list($NumUpdateReports) = G::$DB->next_record();
  464. G::$Cache->cache_value('num_update_reports', $NumUpdateReports, 0);
  465. }
  466. if ($NumUpdateReports > 0) {
  467. $ModBar[] = '<a href="reports.php">Request update reports</a>';
  468. }
  469. } elseif (check_perms('site_moderate_forums')) {
  470. $NumForumReports = G::$Cache->get_value('num_forum_reports');
  471. if ($NumForumReports === false) {
  472. G::$DB->query("
  473. SELECT COUNT(ID)
  474. FROM reports
  475. WHERE Status = 'New'
  476. AND Type IN('artist_comment', 'collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment')");
  477. list($NumForumReports) = G::$DB->next_record();
  478. G::$Cache->cache_value('num_forum_reports', $NumForumReports, 0);
  479. }
  480. if ($NumForumReports > 0) {
  481. $ModBar[] = '<a href="reports.php">'.$NumForumReports.(($NumForumReports == 1) ? ' Forum report' : ' Forum reports').'</a>';
  482. }
  483. }
  484. if (check_perms('users_mod')) {
  485. $NumEmailDeleteRequests = G::$Cache->get_value('num_email_delete_requests');
  486. if ($NumEmailDeleteRequests === false) {
  487. G::$DB->query("SELECT COUNT(*) FROM email_delete_requests");
  488. list($NumEmailDeleteRequests) = G::$DB->next_record();
  489. G::$Cache->cache_value('num_email_delete_requests', $NumEmailDeleteRequests);
  490. }
  491. if ($NumEmailDeleteRequests > 0) {
  492. $ModBar[] = '<a href="tools.php?action=delete_email">' . $NumEmailDeleteRequests . " Email deletion request(s)</a>";
  493. }
  494. }
  495. if (check_perms('users_mod') && FEATURE_EMAIL_REENABLE) {
  496. $NumEnableRequests = G::$Cache->get_value(AutoEnable::CACHE_KEY_NAME);
  497. if ($NumEnableRequests === false) {
  498. G::$DB->query("SELECT COUNT(1) FROM users_enable_requests WHERE Outcome IS NULL");
  499. list($NumEnableRequests) = G::$DB->next_record();
  500. G::$Cache->cache_value(AutoEnable::CACHE_KEY_NAME, $NumEnableRequests);
  501. }
  502. if ($NumEnableRequests > 0) {
  503. $ModBar[] = '<a href="tools.php?action=enable_requests">' . $NumEnableRequests . " Enable requests</a>";
  504. }
  505. }
  506. if (!empty($Alerts) || !empty($ModBar)) { ?>
  507. <div id="alerts">
  508. <? foreach ($Alerts as $Alert) { ?>
  509. <div class="alertbar"><?=$Alert?></div>
  510. <?
  511. }
  512. if (!empty($ModBar)) { ?>
  513. <div class="alertbar blend">
  514. <?=implode(' | ', $ModBar); echo "\n"?>
  515. </div>
  516. <? }
  517. if (check_perms('site_debug') && !apcu_exists('DBKEY')) { ?>
  518. <div class="alertbar" style="color: white; background: #B53939;">
  519. Warning: <a href="tools.php?action=database_key">no DB key</a>
  520. </div>
  521. <? } ?>
  522. </div>
  523. <?
  524. }
  525. //Done handling alertbars
  526. ?>
  527. <div id="content">