Frontend elements to SugoiMusic, including CSS and public/private headers.
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

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