Frontend elements to SugoiMusic, including CSS and public/private headers.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

612 wiersze
27 KiB

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