Frontend elements to SugoiMusic, including CSS and public/private headers.
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.
 
 
 

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