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.
 
 
 

558 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. <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'), 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 = [];
  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_home"<?=
  148. Format::add_class($PageID, ['home'], 'active', true)?>>
  149. <a href="index.php">Home</a>
  150. </li>
  151. <li id="nav_torrents"<?=
  152. Format::add_class($PageID, ['torrents', false, false], 'active', true)?>>
  153. <a href="torrents.php">Torrents</a>
  154. </li>
  155. <li id="nav_collages"<?=
  156. Format::add_class($PageID, ['collages'], 'active', true)?>>
  157. <a href="collages.php">Collections</a>
  158. </li>
  159. <li id="nav_requests"<?=
  160. Format::add_class($PageID, ['requests'], 'active', true)?>>
  161. <a href="requests.php">Requests</a>
  162. </li>
  163. <li id="nav_forums"<?=
  164. Format::add_class($PageID, ['forums'], 'active', true)?>>
  165. <a href="forums.php">Forums</a>
  166. </li>
  167. <li id="nav_irc"<?=
  168. Format::add_class($PageID, ['chat'], 'active', true)?>>
  169. <a href="chat.php">Discord</a>
  170. </li>
  171. <li id="nav_top10"<?=
  172. Format::add_class($PageID, ['top10'], 'active', true)?>>
  173. <a href="top10.php">Top 10</a>
  174. </li>
  175. <li id="nav_rules"<?=
  176. Format::add_class($PageID, ['rules'], 'active', true)?>>
  177. <a href="rules.php">Rules</a>
  178. </li>
  179. <li id="nav_wiki"<?=
  180. Format::add_class($PageID, ['wiki'], 'active', true)?>>
  181. <a href="wiki.php">Wiki</a>
  182. </li>
  183. <li id="nav_user" class="nav_dropdown" <?=Format::add_class($PageID, ['user', false, false], 'active', true, 'id')?>>
  184. <a href="user.php?id=<?=G::$LoggedUser['ID']?>" class="username"><?=G::$LoggedUser['Username']?></a>
  185. <div id="user_menu">
  186. <a href="user.php?action=edit&amp;userid=<?=G::$LoggedUser['ID']?>">Edit</a>
  187. <a href="logout.php?auth=<?=G::$LoggedUser['AuthKey']?>">Logout</a>
  188. </div>
  189. </li>
  190. <li id="nav_links" class="nav_dropdown<?=$NewSubscriptions ? ' highlite' : ''?>">
  191. <a>▾</a>
  192. <div id="links_menu">
  193. <a href="<?=Inbox::get_inbox_link(); ?>">Inbox</a>
  194. <a href="staffpm.php">Staff Inbox</a>
  195. <a href="torrents.php?type=uploaded&amp;userid=<?=G::$LoggedUser['ID']?>">Uploads</a>
  196. <a href="bookmarks.php?type=torrents">Bookmarks</a>
  197. <? if (check_perms('site_torrents_notify')) { ?>
  198. <a href="user.php?action=notify">Notifications</a>
  199. <? } ?>
  200. <a href="userhistory.php?action=subscriptions">Subscriptions</a>
  201. <a href="comments.php">Comments</a>
  202. <a href="friends.php">Friends</a>
  203. <a href="better.php">Better</a>
  204. </div>
  205. </li>
  206. </ul>
  207. </div>
  208. <?
  209. if (isset(G::$LoggedUser['SearchType']) && G::$LoggedUser['SearchType']) { // Advanced search
  210. $UseAdvancedSearch = true;
  211. } else {
  212. $UseAdvancedSearch = false;
  213. }
  214. ?>
  215. <div id="searchbars">
  216. <form class="search_form" name="torrents" action="torrents.php" method="get">
  217. <? if ($UseAdvancedSearch) { ?>
  218. <input type="hidden" name="action" value="advanced" />
  219. <? } ?>
  220. <input id="torrentssearch" accesskey="t" spellcheck="false"
  221. onfocus="if (this.value == 'Torrents') { this.value = ''; }"
  222. onblur="if (this.value == '') { this.value = 'Torrents'; }"
  223. value="Torrents" placeholder="Torrents" type="text" name="<?=$UseAdvancedSearch ? 'advgroupname' : 'searchstr' ?>" size="17" />
  224. </form>
  225. <form class="search_form" name="artists" action="artist.php" method="get">
  226. <input id="artistsearch"<?=Users::has_autocomplete_enabled('search');
  227. ?> accesskey="a"
  228. spellcheck="false" autocomplete="off"
  229. onfocus="if (this.value == 'Artists') { this.value = ''; }"
  230. onblur="if (this.value == '') { this.value = 'Artists'; }"
  231. value="Artists" placeholder="Artists" type="text" name="artistname" size="17" />
  232. </form>
  233. <form class="search_form" name="requests" action="requests.php" method="get">
  234. <input id="requestssearch" spellcheck="false"
  235. onfocus="if (this.value == 'Requests') { this.value = ''; }"
  236. onblur="if (this.value == '') { this.value = 'Requests'; }"
  237. value="Requests" placeholder="Requests" type="text" name="search" size="17" />
  238. </form>
  239. <form class="search_form" name="forums" action="forums.php" method="get">
  240. <input value="search" type="hidden" name="action" />
  241. <input id="forumssearch"
  242. onfocus="if (this.value == 'Forums') { this.value = ''; }"
  243. onblur="if (this.value == '') { this.value = 'Forums'; }"
  244. value="Forums" placeholder="Forums" type="text" name="search" size="17" />
  245. </form>
  246. <!--
  247. <form class="search_form" name="wiki" action="wiki.php" method="get">
  248. <input type="hidden" name="action" value="search" />
  249. <input
  250. onfocus="if (this.value == 'Wiki') { this.value = ''; }"
  251. onblur="if (this.value == '') { this.value = 'Wiki'; }"
  252. value="Wiki" placeholder="Wiki" type="text" name="search" size="17" />
  253. </form>
  254. -->
  255. <form class="search_form" name="log" action="log.php" method="get">
  256. <input id="logsearch"
  257. onfocus="if (this.value == 'Log') { this.value = ''; }"
  258. onblur="if (this.value == '') { this.value = 'Log'; }"
  259. value="Log" placeholder="Log" type="text" name="search" size="17" />
  260. </form>
  261. <form class="search_form" name="users" action="user.php" method="get">
  262. <input type="hidden" name="action" value="search" />
  263. <input
  264. id="userssearch"
  265. onfocus="if (this.value == 'Users') { this.value = ''; }"
  266. onblur="if (this.value == '') { this.value = 'Users'; }"
  267. value="Users" placeholder="Users" type="text" name="search" size="20" />
  268. </form>
  269. </div>
  270. <div id="userinfo">
  271. <ul id="userinfo_major">
  272. <li id="nav_upload" class="brackets<?=Format::add_class($PageID, array('upload'), 'active', false)?>">
  273. <a href="upload.php">Upload</a>
  274. </li>
  275. <?
  276. if (check_perms('site_send_unlimited_invites')) {
  277. $Invites = ' (∞)';
  278. } elseif (G::$LoggedUser['Invites'] > 0) {
  279. $Invites = ' ('.G::$LoggedUser['Invites'].')';
  280. } else {
  281. $Invites = '';
  282. }
  283. ?>
  284. <li id="nav_invite" class="brackets<?=Format::add_class($PageID, array('user','invite'), 'active', false)?>">
  285. <a href="user.php?action=invite">Invite<?=$Invites?></a>
  286. </li>
  287. <? if (FEATURE_DONATE) { ?>
  288. <li id="nav_donate" class="brackets<?=Format::add_class($PageID, array('donate'), 'active', false)?>">
  289. <a href="donate.php">Donate</a>
  290. </li>
  291. <? } ?>
  292. <li id="nav_staff" class="brackets<?=Format::add_class($PageID, array('staff'), 'active', false)?>">
  293. <a href="staff.php">Staff</a>
  294. </li>
  295. </ul>
  296. <ul id="userinfo_stats">
  297. <li id="stats_seeding">
  298. <a href="torrents.php?type=seeding&amp;userid=<?=G::$LoggedUser['ID']?>">Up</a>:
  299. <span class="stat tooltip" title="<?=Format::get_size(G::$LoggedUser['BytesUploaded'], 5)?>"><?=Format::get_size(G::$LoggedUser['BytesUploaded'])?></span>
  300. </li>
  301. <li id="stats_leeching">
  302. <a href="torrents.php?type=leeching&amp;userid=<?=G::$LoggedUser['ID']?>">Down</a>:
  303. <span class="stat tooltip" title="<?=Format::get_size(G::$LoggedUser['BytesDownloaded'], 5)?>"><?=Format::get_size(G::$LoggedUser['BytesDownloaded'])?></span>
  304. </li>
  305. <li id="stats_ratio">
  306. <a href="rules.php?p=ratio">Ratio</a>: <span class="stat"><?=Format::get_ratio_html(G::$LoggedUser['BytesUploaded'], G::$LoggedUser['BytesDownloaded'])?></span>
  307. </li>
  308. <? if (!empty(G::$LoggedUser['RequiredRatio']) && G::$LoggedUser['RequiredRatio'] > 0) { ?>
  309. <li id="stats_required">
  310. <a href="rules.php?p=ratio">Required</a>:
  311. <span class="stat tooltip" title="<?=number_format(G::$LoggedUser['RequiredRatio'], 5)?>"><?=number_format(G::$LoggedUser['RequiredRatio'], 2)?></span>
  312. </li>
  313. <? }
  314. if (G::$LoggedUser['FLTokens'] > 0) { ?>
  315. <li id="fl_tokens">
  316. <a href="wiki.php?action=article&amp;id=7">Tokens</a>:
  317. <span class="stat">
  318. <a href="userhistory.php?action=token_history&amp;userid=<?=G::$LoggedUser['ID']?>"><?=G::$LoggedUser['FLTokens']?></a>
  319. </span>
  320. </li>
  321. <? }
  322. ?>
  323. <li id="bonus_points">
  324. <a href="wiki.php?action=article&name=Bonus+Points"><?=BONUS_POINTS?></a>:
  325. <span class="stat">
  326. <a href="store.php"><?=number_format(G::$LoggedUser['BonusPoints'])?></a>
  327. </span>
  328. </li>
  329. <? if (G::$LoggedUser['HnR'] > 0) { ?>
  330. <li id="hnr">
  331. <a href="snatchlist.php">HnRs</a>:
  332. <span class="stat">
  333. <a><?=G::$LoggedUser['HnR']?></a>
  334. </span>
  335. </li>
  336. <? }
  337. ?>
  338. </ul>
  339. </div>
  340. </div>
  341. <?
  342. //Start handling alert bars
  343. $Alerts = [];
  344. $ModBar = [];
  345. // Staff blog
  346. if (check_perms('users_mod')) {
  347. global $SBlogReadTime, $LatestSBlogTime;
  348. if (!$SBlogReadTime && ($SBlogReadTime = G::$Cache->get_value('staff_blog_read_'.G::$LoggedUser['ID'])) === false) {
  349. G::$DB->query("
  350. SELECT Time
  351. FROM staff_blog_visits
  352. WHERE UserID = ".G::$LoggedUser['ID']);
  353. if (list($SBlogReadTime) = G::$DB->next_record()) {
  354. $SBlogReadTime = strtotime($SBlogReadTime);
  355. } else {
  356. $SBlogReadTime = 0;
  357. }
  358. G::$Cache->cache_value('staff_blog_read_'.G::$LoggedUser['ID'], $SBlogReadTime, 1209600);
  359. }
  360. if (!$LatestSBlogTime && ($LatestSBlogTime = G::$Cache->get_value('staff_blog_latest_time')) === false) {
  361. G::$DB->query("
  362. SELECT MAX(Time)
  363. FROM staff_blog");
  364. list($LatestSBlogTime) = G::$DB->next_record();
  365. if ($LatestSBlogTime) {
  366. $LatestSBlogTime = strtotime($LatestSBlogTime);
  367. } else {
  368. $LatestSBlogTime = 0;
  369. }
  370. G::$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600);
  371. }
  372. if ($SBlogReadTime < $LatestSBlogTime) {
  373. $Alerts[] = '<a href="staffblog.php">New staff blog post!</a>';
  374. }
  375. }
  376. // Inbox
  377. if ($NotificationsManager->is_traditional(NotificationsManager::INBOX)) {
  378. $NotificationsManager->load_inbox();
  379. $NewMessages = $NotificationsManager->get_notifications();
  380. if (isset($NewMessages[NotificationsManager::INBOX])) {
  381. $Alerts[] = NotificationsManagerView::format_traditional($NewMessages[NotificationsManager::INBOX]);
  382. }
  383. $NotificationsManager->clear_notifications_array();
  384. }
  385. if (G::$LoggedUser['RatioWatch']) {
  386. $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.';
  387. } elseif (G::$LoggedUser['CanLeech'] != 1) {
  388. $Alerts[] = '<a href="rules.php?p=ratio">Ratio Watch</a>: Your downloading privileges are disabled until you meet your required ratio.';
  389. }
  390. // Torrents
  391. if ($NotificationsManager->is_traditional(NotificationsManager::TORRENTS)) {
  392. $NotificationsManager->load_torrent_notifications();
  393. $NewTorrents = $NotificationsManager->get_notifications();
  394. if (isset($NewTorrents[NotificationsManager::TORRENTS])) {
  395. $Alerts[] = NotificationsManagerView::format_traditional($NewTorrents[NotificationsManager::TORRENTS]);
  396. }
  397. $NotificationsManager->clear_notifications_array();
  398. }
  399. // Contests
  400. if ($ContestSettings = G::$Cache->get_value('contest_settings')) {
  401. if (time() > $ContestSettings['start'] && time() < $ContestSettings['end']) {
  402. $Alerts[] = '<a href="/contest.php">A Contest is Underway!</a>';
  403. }
  404. }
  405. if (check_perms('users_mod')) {
  406. $ModBar[] = '<a href="tools.php">Toolbox</a>';
  407. }
  408. if (check_perms('users_mod')) {
  409. $NumStaffPMs = G::$Cache->get_value('num_staff_pms_'.G::$LoggedUser['ID']);
  410. if ($NumStaffPMs === false) {
  411. if (check_perms('users_mod')) {
  412. $LevelCap = 1000;
  413. G::$DB->query("
  414. SELECT COUNT(ID)
  415. FROM staff_pm_conversations
  416. WHERE Status = 'Unanswered'
  417. AND (AssignedToUser = ".G::$LoggedUser['ID']."
  418. OR (LEAST('$LevelCap', Level) <= '".G::$LoggedUser['EffectiveClass']."'
  419. AND Level <= ".G::$LoggedUser['Class']."))");
  420. }
  421. if (G::$LoggedUser['PermissionID'] == FORUM_MOD) {
  422. G::$DB->query("
  423. SELECT COUNT(ID)
  424. FROM staff_pm_conversations
  425. WHERE Status='Unanswered'
  426. AND (AssignedToUser = ".G::$LoggedUser['ID']."
  427. OR Level = '". $Classes[FORUM_MOD]['Level'] . "')");
  428. }
  429. list($NumStaffPMs) = G::$DB->next_record();
  430. G::$Cache->cache_value('num_staff_pms_'.G::$LoggedUser['ID'], $NumStaffPMs , 1000);
  431. }
  432. if ($NumStaffPMs > 0) {
  433. $ModBar[] = '<a href="staffpm.php">'.$NumStaffPMs.' Staff PMs</a>';
  434. }
  435. }
  436. if (check_perms('admin_reports')) {
  437. // Torrent reports code
  438. $NumTorrentReports = G::$Cache->get_value('num_torrent_reportsv2');
  439. if ($NumTorrentReports === false) {
  440. G::$DB->query("
  441. SELECT COUNT(ID)
  442. FROM reportsv2
  443. WHERE Status = 'New'");
  444. list($NumTorrentReports) = G::$DB->next_record();
  445. G::$Cache->cache_value('num_torrent_reportsv2', $NumTorrentReports, 0);
  446. }
  447. $ModBar[] = '<a href="reportsv2.php">'.$NumTorrentReports.(($NumTorrentReports == 1) ? ' Report' : ' Reports').'</a>';
  448. // Other reports code
  449. $NumOtherReports = G::$Cache->get_value('num_other_reports');
  450. if ($NumOtherReports === false) {
  451. G::$DB->query("
  452. SELECT COUNT(ID)
  453. FROM reports
  454. WHERE Status = 'New'");
  455. list($NumOtherReports) = G::$DB->next_record();
  456. G::$Cache->cache_value('num_other_reports', $NumOtherReports, 0);
  457. }
  458. if ($NumOtherReports > 0) {
  459. $ModBar[] = '<a href="reports.php">'.$NumOtherReports.(($NumTorrentReports == 1) ? ' Other report' : ' Other reports').'</a>';
  460. }
  461. } elseif (check_perms('project_team')) {
  462. $NumUpdateReports = G::$Cache->get_value('num_update_reports');
  463. if ($NumUpdateReports === false) {
  464. G::$DB->query("
  465. SELECT COUNT(ID)
  466. FROM reports
  467. WHERE Status = 'New'
  468. AND Type = 'request_update'");
  469. list($NumUpdateReports) = G::$DB->next_record();
  470. G::$Cache->cache_value('num_update_reports', $NumUpdateReports, 0);
  471. }
  472. if ($NumUpdateReports > 0) {
  473. $ModBar[] = '<a href="reports.php">Request update reports</a>';
  474. }
  475. } elseif (check_perms('site_moderate_forums')) {
  476. $NumForumReports = G::$Cache->get_value('num_forum_reports');
  477. if ($NumForumReports === false) {
  478. G::$DB->query("
  479. SELECT COUNT(ID)
  480. FROM reports
  481. WHERE Status = 'New'
  482. AND Type IN('artist_comment', 'collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment')");
  483. list($NumForumReports) = G::$DB->next_record();
  484. G::$Cache->cache_value('num_forum_reports', $NumForumReports, 0);
  485. }
  486. if ($NumForumReports > 0) {
  487. $ModBar[] = '<a href="reports.php">'.$NumForumReports.(($NumForumReports == 1) ? ' Forum report' : ' Forum reports').'</a>';
  488. }
  489. }
  490. if (check_perms('users_mod')) {
  491. $NumDeleteRequests = G::$Cache->get_value('num_deletion_requests');
  492. if ($NumDeleteRequests === false) {
  493. G::$DB->query("SELECT COUNT(*) FROM deletion_requests");
  494. list($NumDeleteRequests) = G::$DB->next_record();
  495. G::$Cache->cache_value('num_deletion_requests', $NumDeleteRequests);
  496. }
  497. if ($NumDeleteRequests > 0) {
  498. $ModBar[] = '<a href="tools.php?action=expunge_requests">' . $NumDeleteRequests . " Expunge request".($NumDeleteRequests > 1 ? 's' : '')."</a>";
  499. }
  500. }
  501. if (check_perms('users_mod') && FEATURE_EMAIL_REENABLE) {
  502. $NumEnableRequests = G::$Cache->get_value(AutoEnable::CACHE_KEY_NAME);
  503. if ($NumEnableRequests === false) {
  504. G::$DB->query("SELECT COUNT(1) FROM users_enable_requests WHERE Outcome IS NULL");
  505. list($NumEnableRequests) = G::$DB->next_record();
  506. G::$Cache->cache_value(AutoEnable::CACHE_KEY_NAME, $NumEnableRequests);
  507. }
  508. if ($NumEnableRequests > 0) {
  509. $ModBar[] = '<a href="tools.php?action=enable_requests">' . $NumEnableRequests . " Enable requests</a>";
  510. }
  511. }
  512. if (!empty($Alerts) || !empty($ModBar)) { ?>
  513. <div id="alerts">
  514. <? foreach ($Alerts as $Alert) { ?>
  515. <div class="alertbar"><?=$Alert?></div>
  516. <?
  517. }
  518. if (!empty($ModBar)) { ?>
  519. <div class="alertbar modbar">
  520. <?=implode(' ', $ModBar); echo "\n"?>
  521. </div>
  522. <? }
  523. if (check_perms('site_debug') && !apcu_exists('DBKEY')) { ?>
  524. <div class="alertbar error">
  525. Warning: <a href="tools.php?action=database_key">no DB key</a>
  526. </div>
  527. <? } ?>
  528. </div>
  529. <?
  530. }
  531. //Done handling alertbars
  532. ?>
  533. <div id="content">