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.
 
 
 

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