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.
 
 
 

614 lines
25 KiB

  1. <?
  2. define('FOOTER_FILE', SERVER_ROOT.'/design/privatefooter.php');
  3. $HTTPS = ($_SERVER['SERVER_PORT'] == 443) ? 'ssl_' : '';
  4. $UseTooltipster = !isset(G::$LoggedUser['Tooltipster']) || G::$LoggedUser['Tooltipster'];
  5. ?>
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html>
  8. <head>
  9. <title><?=display_str($PageTitle)?></title>
  10. <meta charset="utf-8" />
  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/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/styles/global.css')?>" />
  57. <?
  58. if ($UseTooltipster) { ?>
  59. <link rel="stylesheet" href="<?=STATIC_SERVER?>styles/tooltipster/style.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/tooltipster/style.css')?>" type="text/css" media="screen" />
  60. <?
  61. }
  62. if ($Mobile) { ?>
  63. <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0, user-scalable=no;" />
  64. <link rel="stylesheet" type="text/css" href="<?=STATIC_SERVER ?>styles/mobile/style.css" />
  65. <?
  66. } else {
  67. if (empty(G::$LoggedUser['StyleURL'])) {
  68. ?>
  69. <link rel="stylesheet" type="text/css" title="<?=G::$LoggedUser['StyleName']?>" media="screen"
  70. href="<?=STATIC_SERVER?>styles/<?=G::$LoggedUser['StyleName']?>/style.css?v=<?=filemtime(SERVER_ROOT.'/static/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. && in_array($StyleURLInfo['host'], array(NONSSL_SITE_URL, SSL_SITE_URL))
  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. }
  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/styles/$CSS/style.css")?>" />
  94. <?
  95. }
  96. ?>
  97. <script type="text/javascript">
  98. var authkey = "<?=G::$LoggedUser['AuthKey']?>";
  99. var userid = <?=G::$LoggedUser['ID']?>;
  100. </script>
  101. <?
  102. $Scripts = array_merge(array('jquery', 'script_start', 'ajax.class', 'global', 'jquery.autocomplete', 'autocomplete'), explode(',', $JSIncludes));
  103. if ($UseTooltipster) {
  104. $Scripts[] = 'tooltipster';
  105. $Scripts[] = 'tooltipster_settings';
  106. }
  107. foreach ($Scripts as $Script) {
  108. if (trim($Script) == '') {
  109. continue;
  110. }
  111. ?>
  112. <script
  113. src="<?=STATIC_SERVER?>functions/<?=$Script?>.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/'.$Script.'.js')?>"
  114. type="text/javascript"></script>
  115. <?
  116. }
  117. if ($Mobile) { ?>
  118. <script src="<?=STATIC_SERVER?>styles/mobile/style.js" type="text/javascript"></script>
  119. <?
  120. }
  121. global $ClassLevels;
  122. // Get notifications early to change menu items if needed
  123. global $NotificationSpans;
  124. $NotificationsManager = new NotificationsManager(G::$LoggedUser['ID']);
  125. $Notifications = $NotificationsManager->get_notifications();
  126. $UseNoty = $NotificationsManager->use_noty();
  127. $NewSubscriptions = false;
  128. $NotificationSpans = array();
  129. foreach ($Notifications as $Type => $Notification) {
  130. if ($Type === NotificationsManager::SUBSCRIPTIONS) {
  131. $NewSubscriptions = true;
  132. }
  133. if ($UseNoty) {
  134. $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>";
  135. }
  136. }
  137. if ($UseNoty && !empty($NotificationSpans)) {
  138. NotificationsManagerView::load_js();
  139. }
  140. if ($NotificationsManager->is_skipped(NotificationsManager::SUBSCRIPTIONS)) {
  141. $NewSubscriptions = Subscriptions::has_new_subscriptions();
  142. }
  143. ?>
  144. </head>
  145. <body id="<?=$Document == 'collages' ? 'collage' : $Document?>" onclick="hide_header_links()">
  146. <div id="wrapper">
  147. <h1 class="hidden"><?=SITE_NAME?></h1>
  148. <div id="header">
  149. <div id="logo">
  150. <a href="index.php"></a>
  151. </div>
  152. <?
  153. if (isset(G::$LoggedUser['SearchType']) && G::$LoggedUser['SearchType']) { // Advanced search
  154. $UseAdvancedSearch = true;
  155. } else {
  156. $UseAdvancedSearch = false;
  157. }
  158. ?>
  159. <div id="searchbars">
  160. <ul>
  161. <li id="searchbar_torrents">
  162. <span class="hidden">Torrents: </span>
  163. <form class="search_form" name="torrents" action="torrents.php" method="get">
  164. <? if ($UseAdvancedSearch) { ?>
  165. <input type="hidden" name="action" value="advanced" />
  166. <? } ?>
  167. <input id="torrentssearch" accesskey="t" spellcheck="false"
  168. onfocus="if (this.value == 'Torrents') { this.value = ''; }"
  169. onblur="if (this.value == '') { this.value = 'Torrents'; }"
  170. value="Torrents" placeholder="Torrents" type="text" name="<?=$UseAdvancedSearch ? 'groupname' : 'searchstr' ?>" size="17" />
  171. </form>
  172. </li>
  173. <li id="searchbar_artists">
  174. <span class="hidden">Artist: </span>
  175. <form class="search_form" name="artists" action="artist.php" method="get">
  176. <input id="artistsearch"<?=Users::has_autocomplete_enabled('search');
  177. ?> accesskey="a"
  178. spellcheck="false" autocomplete="off"
  179. onfocus="if (this.value == 'Artists') { this.value = ''; }"
  180. onblur="if (this.value == '') { this.value = 'Artists'; }"
  181. value="Artists" placeholder="Artists" type="text" name="artistname" size="17" />
  182. </form>
  183. </li>
  184. <li id="searchbar_requests">
  185. <span class="hidden">Requests: </span>
  186. <form class="search_form" name="requests" action="requests.php" method="get">
  187. <input id="requestssearch" spellcheck="false"
  188. onfocus="if (this.value == 'Requests') { this.value = ''; }"
  189. onblur="if (this.value == '') { this.value = 'Requests'; }"
  190. value="Requests" placeholder="Requests" type="text" name="search" size="17" />
  191. </form>
  192. </li>
  193. <li id="searchbar_forums">
  194. <span class="hidden">Forums: </span>
  195. <form class="search_form" name="forums" action="forums.php" method="get">
  196. <input value="search" type="hidden" name="action" />
  197. <input id="forumssearch"
  198. onfocus="if (this.value == 'Forums') { this.value = ''; }"
  199. onblur="if (this.value == '') { this.value = 'Forums'; }"
  200. value="Forums" placeholder="Forums" type="text" name="search" size="17" />
  201. </form>
  202. </li>
  203. <!--
  204. <li id="searchbar_wiki">
  205. <span class="hidden">Wiki: </span>
  206. <form class="search_form" name="wiki" action="wiki.php" method="get">
  207. <input type="hidden" name="action" value="search" />
  208. <input
  209. onfocus="if (this.value == 'Wiki') { this.value = ''; }"
  210. onblur="if (this.value == '') { this.value = 'Wiki'; }"
  211. value="Wiki" placeholder="Wiki" type="text" name="search" size="17" />
  212. </form>
  213. </li>
  214. -->
  215. <li id="searchbar_log">
  216. <span class="hidden">Log: </span>
  217. <form class="search_form" name="log" action="log.php" method="get">
  218. <input id="logsearch"
  219. onfocus="if (this.value == 'Log') { this.value = ''; }"
  220. onblur="if (this.value == '') { this.value = 'Log'; }"
  221. value="Log" placeholder="Log" type="text" name="search" size="17" />
  222. </form>
  223. </li>
  224. <li id="searchbar_users">
  225. <span class="hidden">Users: </span>
  226. <form class="search_form" name="users" action="user.php" method="get">
  227. <input type="hidden" name="action" value="search" />
  228. <input
  229. id="userssearch"
  230. onfocus="if (this.value == 'Users') { this.value = ''; }"
  231. onblur="if (this.value == '') { this.value = 'Users'; }"
  232. value="Users" placeholder="Users" type="text" name="search" size="20" />
  233. </form>
  234. </li>
  235. </ul>
  236. </div>
  237. <div id="menu">
  238. <h4 class="hidden">Site Menu</h4>
  239. <ul>
  240. <li id="nav_index"<?=
  241. Format::add_class($PageID, array('index'), 'active', true)?>>
  242. <a href="index.php">Home</a>
  243. </li>
  244. <li id="nav_torrents"<?=
  245. Format::add_class($PageID, array('torrents', false, false), 'active', true)?>>
  246. <a href="torrents.php">Torrents</a>
  247. </li>
  248. <li id="nav_collages"<?=
  249. Format::add_class($PageID, array('collages'), 'active', true)?>>
  250. <a href="collages.php">Collections</a>
  251. </li>
  252. <li id="nav_requests"<?=
  253. Format::add_class($PageID, array('requests'), 'active', true)?>>
  254. <a href="requests.php">Requests</a>
  255. </li>
  256. <li id="nav_forums"<?=
  257. Format::add_class($PageID, array('forums'), 'active', true)?>>
  258. <a href="forums.php">Forums</a>
  259. </li>
  260. <li id="nav_irc"<?=
  261. Format::add_class($PageID, array('chat'), 'active', true)?>>
  262. <a href="chat.php">IRC</a>
  263. </li>
  264. <li id="nav_top10"<?=
  265. Format::add_class($PageID, array('top10'), 'active', true)?>>
  266. <a href="top10.php">Top 10</a>
  267. </li>
  268. <li id="nav_rules"<?=
  269. Format::add_class($PageID, array('rules'), 'active', true)?>>
  270. <a href="rules.php">Rules</a>
  271. </li>
  272. <li id="nav_wiki"<?=
  273. Format::add_class($PageID, array('wiki'), 'active', true)?>>
  274. <a href="wiki.php">Wiki</a>
  275. </li>
  276. <li id="nav_staff"<?=
  277. Format::add_class($PageID, array('staff'), 'active', true)?>>
  278. <a href="staff.php">Staff</a>
  279. </li>
  280. </ul>
  281. </div>
  282. <div id="userinfo">
  283. <ul id="userinfo_username">
  284. <li id="nav_userinfo" <?=Format::add_class($PageID, array('user', false, false), 'active', true, 'id')?>>
  285. <a href="user.php?id=<?=G::$LoggedUser['ID']?>" class="username"><?=G::$LoggedUser['Username']?></a>
  286. </li>
  287. <li id="nav_userclass">
  288. <span class="hidden userclass"><?=$ClassLevels[G::$LoggedUser['Class']]['Name']?></span>
  289. </li>
  290. <li id="nav_useredit" class="brackets<?=Format::add_class($PageID, array('user','edit'), 'active', false)?>">
  291. <a href="user.php?action=edit&amp;userid=<?=G::$LoggedUser['ID']?>">Edit</a>
  292. </li>
  293. <li id="nav_logout" class="brackets">
  294. <a href="logout.php?auth=<?=G::$LoggedUser['AuthKey']?>">Logout</a>
  295. </li>
  296. </ul>
  297. <ul id="userinfo_major">
  298. <li id="nav_upload" class="brackets<?=Format::add_class($PageID, array('upload'), 'active', false)?>">
  299. <a href="upload.php">Upload</a>
  300. </li>
  301. <?
  302. if (check_perms('site_send_unlimited_invites')) {
  303. $Invites = ' (∞)';
  304. } elseif (G::$LoggedUser['Invites'] > 0) {
  305. $Invites = ' ('.G::$LoggedUser['Invites'].')';
  306. } else {
  307. $Invites = '';
  308. }
  309. ?>
  310. <li id="nav_invite" class="brackets<?=Format::add_class($PageID, array('user','invite'), 'active', false)?>">
  311. <a href="user.php?action=invite">Invite<?=$Invites?></a>
  312. </li>
  313. <li id="nav_donate" class="brackets<?=Format::add_class($PageID, array('donate'), 'active', false)?>">
  314. <a href="donate.php">Donate</a>
  315. </li>
  316. </ul>
  317. <ul id="userinfo_stats">
  318. <li id="stats_seeding">
  319. <a href="torrents.php?type=seeding&amp;userid=<?=G::$LoggedUser['ID']?>">Up</a>:
  320. <span class="stat tooltip" title="<?=Format::get_size(G::$LoggedUser['BytesUploaded'], 5)?>"><?=Format::get_size(G::$LoggedUser['BytesUploaded'])?></span>
  321. </li>
  322. <li id="stats_leeching">
  323. <a href="torrents.php?type=leeching&amp;userid=<?=G::$LoggedUser['ID']?>">Down</a>:
  324. <span class="stat tooltip" title="<?=Format::get_size(G::$LoggedUser['BytesDownloaded'], 5)?>"><?=Format::get_size(G::$LoggedUser['BytesDownloaded'])?></span>
  325. </li>
  326. <li id="stats_ratio">
  327. Ratio: <span class="stat"><?=Format::get_ratio_html(G::$LoggedUser['BytesUploaded'], G::$LoggedUser['BytesDownloaded'])?></span>
  328. </li>
  329. <? if (!empty(G::$LoggedUser['RequiredRatio']) && G::$LoggedUser['RequiredRatio'] > 0) { ?>
  330. <li id="stats_required">
  331. <a href="rules.php?p=ratio">Required</a>:
  332. <span class="stat tooltip" title="<?=number_format(G::$LoggedUser['RequiredRatio'], 5)?>"><?=number_format(G::$LoggedUser['RequiredRatio'], 2)?></span>
  333. </li>
  334. <? }
  335. if (G::$LoggedUser['FLTokens'] > 0) { ?>
  336. <li id="fl_tokens">
  337. <a href="wiki.php?action=article&amp;id=7">Tokens</a>:
  338. <span class="stat">
  339. <a href="userhistory.php?action=token_history&amp;userid=<?=G::$LoggedUser['ID']?>"><?=G::$LoggedUser['FLTokens']?></a>
  340. </span>
  341. </li>
  342. <? }
  343. ?>
  344. <li id="bonus_points">
  345. <a href="wiki.php?action=article&amp;id=8">Nips</a>:
  346. <span class="stat">
  347. <a href="store.php"><?=number_format(G::$LoggedUser['BonusPoints'])?></a>
  348. </span>
  349. </li>
  350. <? if (G::$LoggedUser['HnR'] > 0) { ?>
  351. <li id="hnr">
  352. <a href="snatchlist.php">HnRs</a>:
  353. <span class="stat">
  354. <a><?=G::$LoggedUser['HnR']?></a>
  355. </span>
  356. </li>
  357. <? }
  358. ?>
  359. </ul>
  360. <ul id="userinfo_minor"<?=$NewSubscriptions ? ' class="highlite"' : ''?>>
  361. <li>
  362. <span class="brackets" onclick="toggle_header_links(event)">Links ▾</span>
  363. <ul>
  364. <li id="nav_inbox"<?=
  365. Format::add_class($PageID, array('inbox'), 'active', true)?>>
  366. <a href="<?=Inbox::get_inbox_link(); ?>">Inbox</a>
  367. </li>
  368. <li id="nav_staffinbox"<?=
  369. Format::add_class($PageID, array('staffpm'), 'active', true)?>>
  370. <a href="staffpm.php">Staff Inbox</a>
  371. </li>
  372. <li id="nav_uploaded"<?=
  373. Format::add_class($PageID, array('torrents', false, 'uploaded'), 'active', true, 'userid')?>>
  374. <a href="torrents.php?type=uploaded&amp;userid=<?=G::$LoggedUser['ID']?>">Uploads</a>
  375. </li>
  376. <li id="nav_bookmarks"<?=
  377. Format::add_class($PageID, array('bookmarks'), 'active', true)?>>
  378. <a href="bookmarks.php?type=torrents">Bookmarks</a>
  379. </li>
  380. <? if (check_perms('site_torrents_notify')) { ?>
  381. <li id="nav_notifications"<?=
  382. Format::add_class($PageID, array(array('torrents', 'notify'), array('user', 'notify')), 'active', true, 'userid')?>>
  383. <a href="user.php?action=notify">Notifications</a>
  384. </li>
  385. <? }
  386. $ClassNames = $NewSubscriptions ? 'new-subscriptions' : '';
  387. $ClassNames = trim($ClassNames.Format::add_class($PageID, array('userhistory', 'subscriptions'), 'active', false));
  388. ?>
  389. <li id="nav_subscriptions"<?=$ClassNames ? " class=\"$ClassNames\"" : ''?>>
  390. <a href="userhistory.php?action=subscriptions">Subscriptions</a>
  391. </li>
  392. <li id="nav_comments"<?=
  393. Format::add_class($PageID, array('comments'), 'active', true, 'userid')?>>
  394. <a href="comments.php">Comments</a></li>
  395. <li id="nav_friends"<?=
  396. Format::add_class($PageID, array('friends'), 'active', true)?>>
  397. <a href="friends.php">Friends</a></li>
  398. </ul>
  399. </li>
  400. </ul>
  401. </div>
  402. </div>
  403. <?
  404. //Start handling alert bars
  405. $Alerts = array();
  406. $ModBar = array();
  407. // Staff blog
  408. if (check_perms('users_mod')) {
  409. global $SBlogReadTime, $LatestSBlogTime;
  410. if (!$SBlogReadTime && ($SBlogReadTime = G::$Cache->get_value('staff_blog_read_'.G::$LoggedUser['ID'])) === false) {
  411. G::$DB->query("
  412. SELECT Time
  413. FROM staff_blog_visits
  414. WHERE UserID = ".G::$LoggedUser['ID']);
  415. if (list($SBlogReadTime) = G::$DB->next_record()) {
  416. $SBlogReadTime = strtotime($SBlogReadTime);
  417. } else {
  418. $SBlogReadTime = 0;
  419. }
  420. G::$Cache->cache_value('staff_blog_read_'.G::$LoggedUser['ID'], $SBlogReadTime, 1209600);
  421. }
  422. if (!$LatestSBlogTime && ($LatestSBlogTime = G::$Cache->get_value('staff_blog_latest_time')) === false) {
  423. G::$DB->query("
  424. SELECT MAX(Time)
  425. FROM staff_blog");
  426. list($LatestSBlogTime) = G::$DB->next_record();
  427. if ($LatestSBlogTime) {
  428. $LatestSBlogTime = strtotime($LatestSBlogTime);
  429. } else {
  430. $LatestSBlogTime = 0;
  431. }
  432. G::$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600);
  433. }
  434. if ($SBlogReadTime < $LatestSBlogTime) {
  435. $Alerts[] = '<a href="staffblog.php">New staff blog post!</a>';
  436. }
  437. }
  438. // Inbox
  439. if ($NotificationsManager->is_traditional(NotificationsManager::INBOX)) {
  440. $NotificationsManager->load_inbox();
  441. $NewMessages = $NotificationsManager->get_notifications();
  442. if (isset($NewMessages[NotificationsManager::INBOX])) {
  443. $Alerts[] = NotificationsManagerView::format_traditional($NewMessages[NotificationsManager::INBOX]);
  444. }
  445. $NotificationsManager->clear_notifications_array();
  446. }
  447. if (G::$LoggedUser['RatioWatch']) {
  448. $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.';
  449. } elseif (G::$LoggedUser['CanLeech'] != 1) {
  450. $Alerts[] = '<a href="rules.php?p=ratio">Ratio Watch</a>: Your downloading privileges are disabled until you meet your required ratio.';
  451. }
  452. // Torrents
  453. if ($NotificationsManager->is_traditional(NotificationsManager::TORRENTS)) {
  454. $NotificationsManager->load_torrent_notifications();
  455. $NewTorrents = $NotificationsManager->get_notifications();
  456. if (isset($NewTorrents[NotificationsManager::TORRENTS])) {
  457. $Alerts[] = NotificationsManagerView::format_traditional($NewTorrents[NotificationsManager::TORRENTS]);
  458. }
  459. $NotificationsManager->clear_notifications_array();
  460. }
  461. if (check_perms('users_mod')) {
  462. $ModBar[] = '<a href="tools.php">Toolbox</a>';
  463. }
  464. if (check_perms('users_mod')) {
  465. $NumStaffPMs = G::$Cache->get_value('num_staff_pms_'.G::$LoggedUser['ID']);
  466. if ($NumStaffPMs === false) {
  467. if (check_perms('users_mod')) {
  468. $LevelCap = 1000;
  469. G::$DB->query("
  470. SELECT COUNT(ID)
  471. FROM staff_pm_conversations
  472. WHERE Status = 'Unanswered'
  473. AND (AssignedToUser = ".G::$LoggedUser['ID']."
  474. OR (LEAST('$LevelCap', Level) <= '".G::$LoggedUser['EffectiveClass']."'
  475. AND Level <= ".G::$LoggedUser['Class']."))");
  476. }
  477. if (G::$LoggedUser['PermissionID'] == FORUM_MOD) {
  478. G::$DB->query("
  479. SELECT COUNT(ID)
  480. FROM staff_pm_conversations
  481. WHERE Status='Unanswered'
  482. AND (AssignedToUser = ".G::$LoggedUser['ID']."
  483. OR Level = '". $Classes[FORUM_MOD]['Level'] . "')");
  484. }
  485. list($NumStaffPMs) = G::$DB->next_record();
  486. G::$Cache->cache_value('num_staff_pms_'.G::$LoggedUser['ID'], $NumStaffPMs , 1000);
  487. }
  488. if ($NumStaffPMs > 0) {
  489. $ModBar[] = '<a href="staffpm.php">'.$NumStaffPMs.' Staff PMs</a>';
  490. }
  491. }
  492. if (check_perms('admin_reports')) {
  493. // Torrent reports code
  494. $NumTorrentReports = G::$Cache->get_value('num_torrent_reportsv2');
  495. if ($NumTorrentReports === false) {
  496. G::$DB->query("
  497. SELECT COUNT(ID)
  498. FROM reportsv2
  499. WHERE Status = 'New'");
  500. list($NumTorrentReports) = G::$DB->next_record();
  501. G::$Cache->cache_value('num_torrent_reportsv2', $NumTorrentReports, 0);
  502. }
  503. $ModBar[] = '<a href="reportsv2.php">'.$NumTorrentReports.(($NumTorrentReports == 1) ? ' Report' : ' Reports').'</a>';
  504. // Other reports code
  505. $NumOtherReports = G::$Cache->get_value('num_other_reports');
  506. if ($NumOtherReports === false) {
  507. G::$DB->query("
  508. SELECT COUNT(ID)
  509. FROM reports
  510. WHERE Status = 'New'");
  511. list($NumOtherReports) = G::$DB->next_record();
  512. G::$Cache->cache_value('num_other_reports', $NumOtherReports, 0);
  513. }
  514. if ($NumOtherReports > 0) {
  515. $ModBar[] = '<a href="reports.php">'.$NumOtherReports.(($NumTorrentReports == 1) ? ' Other report' : ' Other reports').'</a>';
  516. }
  517. } elseif (check_perms('project_team')) {
  518. $NumUpdateReports = G::$Cache->get_value('num_update_reports');
  519. if ($NumUpdateReports === false) {
  520. G::$DB->query("
  521. SELECT COUNT(ID)
  522. FROM reports
  523. WHERE Status = 'New'
  524. AND Type = 'request_update'");
  525. list($NumUpdateReports) = G::$DB->next_record();
  526. G::$Cache->cache_value('num_update_reports', $NumUpdateReports, 0);
  527. }
  528. if ($NumUpdateReports > 0) {
  529. $ModBar[] = '<a href="reports.php">Request update reports</a>';
  530. }
  531. } elseif (check_perms('site_moderate_forums')) {
  532. $NumForumReports = G::$Cache->get_value('num_forum_reports');
  533. if ($NumForumReports === false) {
  534. G::$DB->query("
  535. SELECT COUNT(ID)
  536. FROM reports
  537. WHERE Status = 'New'
  538. AND Type IN('artist_comment', 'collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment')");
  539. list($NumForumReports) = G::$DB->next_record();
  540. G::$Cache->cache_value('num_forum_reports', $NumForumReports, 0);
  541. }
  542. if ($NumForumReports > 0) {
  543. $ModBar[] = '<a href="reports.php">'.$NumForumReports.(($NumForumReports == 1) ? ' Forum report' : ' Forum reports').'</a>';
  544. }
  545. }
  546. if (check_perms('users_mod')) {
  547. $NumEmailDeleteRequests = G::$Cache->get_value('num_email_delete_requests');
  548. if ($NumEmailDeleteRequests === false) {
  549. G::$DB->query("SELECT COUNT(*) FROM email_delete_requests");
  550. list($NumEmailDeleteRequests) = G::$DB->next_record();
  551. G::$Cache->cache_value('num_email_delete_request', $NumEmailDeleteRequests);
  552. }
  553. if ($NumEmailDeleteRequests > 0) {
  554. $ModBar[] = '<a href="tools.php?action=delete_email">' . $NumEmailDeleteRequests . " Email deletion request(s)</a>";
  555. }
  556. }
  557. if (check_perms('users_mod') && FEATURE_EMAIL_REENABLE) {
  558. $NumEnableRequests = G::$Cache->get_value(AutoEnable::CACHE_KEY_NAME);
  559. if ($NumEnableRequests === false) {
  560. G::$DB->query("SELECT COUNT(1) FROM users_enable_requests WHERE Outcome IS NULL");
  561. list($NumEnableRequests) = G::$DB->next_record();
  562. G::$Cache->cache_value(AutoEnable::CACHE_KEY_NAME, $NumEnableRequests);
  563. }
  564. if ($NumEnableRequests > 0) {
  565. $ModBar[] = '<a href="tools.php?action=enable_requests">' . $NumEnableRequests . " Enable requests</a>";
  566. }
  567. }
  568. if (!empty($Alerts) || !empty($ModBar)) { ?>
  569. <div id="alerts">
  570. <? foreach ($Alerts as $Alert) { ?>
  571. <div class="alertbar"><?=$Alert?></div>
  572. <?
  573. }
  574. if (!empty($ModBar)) { ?>
  575. <div class="alertbar blend">
  576. <?=implode(' | ', $ModBar); echo "\n"?>
  577. </div>
  578. <? }
  579. if (check_perms('site_debug') && !apc_exists('DBKEY')) { ?>
  580. <div class="alertbar" style="color: white; background: #B53939;">
  581. Warning: <a href="tools.php?action=database_key">no DB key</a>
  582. </div>
  583. <? } ?>
  584. </div>
  585. <?
  586. }
  587. //Done handling alertbars
  588. ?>
  589. <div id="content">