Frontend elements to SugoiMusic, including CSS and public/private headers.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

545 líneas
24 KiB

  1. <?
  2. define('FOOTER_FILE', SERVER_ROOT.'/design/privatefooter.php');
  3. ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html>
  6. <head>
  7. <title><?=display_str($PageTitle)?></title>
  8. <meta charset="utf-8" />
  9. <meta id="auth_holder" userid="<?=G::$LoggedUser['ID']?>" authkey="<?=G::$LoggedUser['AuthKey']?>" />
  10. <link rel="shortcut icon" href="favicon.ico?v=<?=md5_file('favicon.ico');?>" />
  11. <link rel="search" type="application/opensearchdescription+xml" title="<?=SITE_NAME?>" href="<?=STATIC_SERVER?>opensearch.xml">
  12. <link rel="alternate" type="application/rss+xml"
  13. 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']?>"
  14. title="<?=SITE_NAME?> - News" />
  15. <link rel="alternate" type="application/rss+xml"
  16. 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']?>"
  17. title="<?=SITE_NAME?> - Blog" />
  18. <link rel="alternate" type="application/rss+xml"
  19. 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']?>"
  20. title="<?=SITE_NAME?> - Gazelle Change Log" />
  21. <link rel="alternate" type="application/rss+xml"
  22. 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']?>"
  23. title="<?=SITE_NAME?> - P.T.N." />
  24. <?
  25. if (isset(G::$LoggedUser['Notify'])) {
  26. foreach (G::$LoggedUser['Notify'] as $Filter) {
  27. list($FilterID, $FilterName) = $Filter;
  28. ?>
  29. <link rel="alternate" type="application/rss+xml"
  30. 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)?>"
  31. title="<?=SITE_NAME?> - <?=display_str($FilterName)?>" />
  32. <?
  33. }
  34. }
  35. ?>
  36. <link rel="alternate" type="application/rss+xml"
  37. 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']?>"
  38. title="<?=SITE_NAME?> - All Torrents" />
  39. <link rel="alternate" type="application/rss+xml"
  40. 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']?>"
  41. title="<?=SITE_NAME?> - Movie Torrents" />
  42. <link rel="alternate" type="application/rss+xml"
  43. 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']?>"
  44. title="<?=SITE_NAME?> - Anime Torrents" />
  45. <link rel="alternate" type="application/rss+xml"
  46. 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']?>"
  47. title="<?=SITE_NAME?> - Manga Torrents" />
  48. <link rel="alternate" type="application/rss+xml"
  49. 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']?>"
  50. title="<?=SITE_NAME?> - Games Torrents" />
  51. <link rel="alternate" type="application/rss+xml"
  52. 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']?>"
  53. title="<?=SITE_NAME?> - Other Torrents" />
  54. <link rel="stylesheet" type="text/css"
  55. href="<?=STATIC_SERVER?>styles/global.css?v=<?=filemtime(SERVER_ROOT.STATIC_SERVER.'styles/global.css')?>" />
  56. <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" />
  57. <?
  58. if (empty(G::$LoggedUser['StyleURL'])) {
  59. ?>
  60. <link rel="stylesheet" type="text/css" title="<?=G::$LoggedUser['StyleName']?>" media="screen"
  61. href="<?=STATIC_SERVER?>styles/<?=G::$LoggedUser['StyleName']?>/style.css?v=<?=filemtime(SERVER_ROOT.STATIC_SERVER.'styles/'.G::$LoggedUser['StyleName'].'/style.css')?>" />
  62. <?
  63. } else {
  64. $StyleURLInfo = parse_url(G::$LoggedUser['StyleURL']);
  65. if (substr(G::$LoggedUser['StyleURL'], -4) == '.css'
  66. && empty($StyleURLInfo['query']) && empty($StyleURLInfo['fragment'])
  67. && ($StyleURLInfo['host'] == SITE_DOMAIN)
  68. && file_exists(SERVER_ROOT.$StyleURLInfo['path'])) {
  69. $StyleURL = G::$LoggedUser['StyleURL'].'?v='.filemtime(SERVER_ROOT.$StyleURLInfo['path']);
  70. } else {
  71. $StyleURL = G::$LoggedUser['StyleURL'];
  72. }
  73. ?>
  74. <link rel="stylesheet" type="text/css" media="screen" href="<?=$StyleURL?>" title="External CSS" />
  75. <?
  76. }
  77. $ExtraCSS = explode(',', $CSSIncludes);
  78. foreach ($ExtraCSS as $CSS) {
  79. if (trim($CSS) == '') {
  80. continue;
  81. }
  82. ?>
  83. <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")?>" />
  84. <?
  85. }
  86. $Scripts = array_merge(array('jquery', 'script_start', 'ajax.class', 'global', 'jquery.autocomplete', 'autocomplete', 'tooltipster', 'tooltipster_settings'), explode(',', $JSIncludes));
  87. foreach ($Scripts as $Script) {
  88. if (trim($Script) == '') {
  89. continue;
  90. }
  91. if (($ScriptStats = G::$Cache->get_value("script_stats_$Script")) === false || $ScriptStats['mtime'] != filemtime(SERVER_ROOT.STATIC_SERVER."functions/$Script.js")) {
  92. $ScriptStats['mtime'] = filemtime(SERVER_ROOT.STATIC_SERVER."functions/$Script.js");
  93. $ScriptStats['hash'] = base64_encode(hash_file(INTEGRITY_ALGO, SERVER_ROOT.STATIC_SERVER."functions/$Script.js", true));
  94. $ScriptStats['algo'] = INTEGRITY_ALGO;
  95. G::$Cache->cache_value("script_stats_$Script", $ScriptStats);
  96. }
  97. ?>
  98. <script src="<?=STATIC_SERVER."functions/$Script.js?v=$ScriptStats[mtime]"?>" type="text/javascript" integrity="<?="$ScriptStats[algo]-$ScriptStats[hash]"?>"></script>
  99. <?
  100. }
  101. global $ClassLevels;
  102. // Get notifications early to change menu items if needed
  103. global $NotificationSpans;
  104. $NotificationsManager = new NotificationsManager(G::$LoggedUser['ID']);
  105. $Notifications = $NotificationsManager->get_notifications();
  106. $UseNoty = $NotificationsManager->use_noty();
  107. $NewSubscriptions = false;
  108. $NotificationSpans = array();
  109. foreach ($Notifications as $Type => $Notification) {
  110. if ($Type === NotificationsManager::SUBSCRIPTIONS) {
  111. $NewSubscriptions = true;
  112. }
  113. if ($UseNoty) {
  114. $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>";
  115. }
  116. }
  117. if ($UseNoty && !empty($NotificationSpans)) {
  118. NotificationsManagerView::load_js();
  119. }
  120. if ($NotificationsManager->is_skipped(NotificationsManager::SUBSCRIPTIONS)) {
  121. $NewSubscriptions = Subscriptions::has_new_subscriptions();
  122. }
  123. ?>
  124. </head>
  125. <?
  126. if (!empty(G::$LoggedUser['StyleAdditions'])) {
  127. $BodyStyles = 'style_'.implode(' style_', G::$LoggedUser['StyleAdditions']);
  128. }
  129. ?>
  130. <body id="<?=$Document == 'collages' ? 'collage' : $Document?>" class="<?=($BodyStyles??'')?>">
  131. <div id="wrapper">
  132. <h1 class="hidden"><?=SITE_NAME?></h1>
  133. <div id="header">
  134. <div id="logo">
  135. <a href="index.php"></a>
  136. </div>
  137. <div id="menu">
  138. <ul>
  139. <li id="nav_torrents"<?=
  140. Format::add_class($PageID, ['torrents', false, false], 'active', true)?>>
  141. <a href="torrents.php">Torrents</a>
  142. </li>
  143. <li id="nav_collages"<?=
  144. Format::add_class($PageID, ['collages'], 'active', true)?>>
  145. <a href="collages.php">Collections</a>
  146. </li>
  147. <li id="nav_requests"<?=
  148. Format::add_class($PageID, ['requests'], 'active', true)?>>
  149. <a href="requests.php">Requests</a>
  150. </li>
  151. <li id="nav_forums"<?=
  152. Format::add_class($PageID, ['forums'], 'active', true)?>>
  153. <a href="forums.php">Forums</a>
  154. </li>
  155. <li id="nav_irc"<?=
  156. Format::add_class($PageID, ['chat'], 'active', true)?>>
  157. <a href="chat.php">IRC</a>
  158. </li>
  159. <li id="nav_top10"<?=
  160. Format::add_class($PageID, ['top10'], 'active', true)?>>
  161. <a href="top10.php">Top 10</a>
  162. </li>
  163. <li id="nav_rules"<?=
  164. Format::add_class($PageID, ['rules'], 'active', true)?>>
  165. <a href="rules.php">Rules</a>
  166. </li>
  167. <li id="nav_wiki"<?=
  168. Format::add_class($PageID, ['wiki'], 'active', true)?>>
  169. <a href="wiki.php">Wiki</a>
  170. </li>
  171. <li id="nav_user" class="nav_dropdown" <?=Format::add_class($PageID, ['user', false, false], 'active', true, 'id')?>>
  172. <a href="user.php?id=<?=G::$LoggedUser['ID']?>" class="username"><?=G::$LoggedUser['Username']?></a>
  173. <div id="user_menu">
  174. <a href="user.php?action=edit&amp;userid=<?=G::$LoggedUser['ID']?>">Edit</a>
  175. <a href="logout.php?auth=<?=G::$LoggedUser['AuthKey']?>">Logout</a>
  176. </div>
  177. </li>
  178. <li id="nav_links" class="nav_dropdown<?=$NewSubscriptions ? ' highlite' : ''?>">
  179. <a>▾</a>
  180. <div id="links_menu">
  181. <a href="<?=Inbox::get_inbox_link(); ?>">Inbox</a>
  182. <a href="staffpm.php">Staff Inbox</a>
  183. <a href="torrents.php?type=uploaded&amp;userid=<?=G::$LoggedUser['ID']?>">Uploads</a>
  184. <a href="bookmarks.php?type=torrents">Bookmarks</a>
  185. <? if (check_perms('site_torrents_notify')) { ?>
  186. <a href="user.php?action=notify">Notifications</a>
  187. <? } ?>
  188. <a href="userhistory.php?action=subscriptions">Subscriptions</a>
  189. <a href="comments.php">Comments</a>
  190. <a href="friends.php">Friends</a>
  191. <a href="better.php">Better</a>
  192. </div>
  193. </li>
  194. </ul>
  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">