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.
 
 
 

613 lines
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 (empty(G::$LoggedUser['StyleURL'])) {
  62. ?>
  63. <link rel="stylesheet" type="text/css" title="<?=G::$LoggedUser['StyleName']?>" media="screen"
  64. href="<?=STATIC_SERVER?>styles/<?=G::$LoggedUser['StyleName']?>/style.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/'.G::$LoggedUser['StyleName'].'/style.css')?>" />
  65. <?
  66. } else {
  67. $StyleURLInfo = parse_url(G::$LoggedUser['StyleURL']);
  68. if (substr(G::$LoggedUser['StyleURL'], -4) == '.css'
  69. && empty($StyleURLInfo['query']) && empty($StyleURLInfo['fragment'])
  70. && ($StyleURLInfo['host'] == SITE_DOMAIN)
  71. && file_exists(SERVER_ROOT.$StyleURLInfo['path'])) {
  72. $StyleURL = G::$LoggedUser['StyleURL'].'?v='.filemtime(SERVER_ROOT.$StyleURLInfo['path']);
  73. } else {
  74. $StyleURL = G::$LoggedUser['StyleURL'];
  75. }
  76. ?>
  77. <link rel="stylesheet" type="text/css" media="screen" href="<?=$StyleURL?>" title="External CSS" />
  78. <?
  79. }
  80. $ExtraCSS = explode(',', $CSSIncludes);
  81. foreach ($ExtraCSS as $CSS) {
  82. if (trim($CSS) == '') {
  83. continue;
  84. }
  85. ?>
  86. <link rel="stylesheet" type="text/css" media="screen" href="<?=STATIC_SERVER."styles/$CSS/style.css?v=".filemtime(SERVER_ROOT."/static/styles/$CSS/style.css")?>" />
  87. <?
  88. }
  89. ?>
  90. <script type="text/javascript">
  91. var authkey = "<?=G::$LoggedUser['AuthKey']?>";
  92. var userid = <?=G::$LoggedUser['ID']?>;
  93. </script>
  94. <?
  95. $Scripts = array_merge(array('jquery', 'script_start', 'ajax.class', 'global', 'jquery.autocomplete', 'autocomplete'), explode(',', $JSIncludes));
  96. if ($UseTooltipster) {
  97. $Scripts[] = 'tooltipster';
  98. $Scripts[] = 'tooltipster_settings';
  99. }
  100. foreach ($Scripts as $Script) {
  101. if (trim($Script) == '') {
  102. continue;
  103. }
  104. if (($ScriptStats = G::$Cache->get_value("script_stats_$Script")) === false || $ScriptStats['mtime'] != filemtime(STATIC_SERVER."functions/$Script.js")) {
  105. $ScriptStats['mtime'] = filemtime(STATIC_SERVER."functions/$Script.js");
  106. $ScriptStats['hash'] = base64_encode(hash_file(INTEGRITY_ALGO, STATIC_SERVER."functions/$Script.js", true));
  107. $ScriptStats['algo'] = INTEGRITY_ALGO;
  108. G::$Cache->cache_value("script_stats_$Script", $ScriptStats);
  109. }
  110. ?>
  111. <script src="<?=STATIC_SERVER."functions/$Script.js?v=$ScriptStats[mtime]"?>" type="text/javascript" integrity="<?="$ScriptStats[algo]-$ScriptStats[hash]"?>"></script>
  112. <?
  113. }
  114. global $ClassLevels;
  115. // Get notifications early to change menu items if needed
  116. global $NotificationSpans;
  117. $NotificationsManager = new NotificationsManager(G::$LoggedUser['ID']);
  118. $Notifications = $NotificationsManager->get_notifications();
  119. $UseNoty = $NotificationsManager->use_noty();
  120. $NewSubscriptions = false;
  121. $NotificationSpans = array();
  122. foreach ($Notifications as $Type => $Notification) {
  123. if ($Type === NotificationsManager::SUBSCRIPTIONS) {
  124. $NewSubscriptions = true;
  125. }
  126. if ($UseNoty) {
  127. $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>";
  128. }
  129. }
  130. if ($UseNoty && !empty($NotificationSpans)) {
  131. NotificationsManagerView::load_js();
  132. }
  133. if ($NotificationsManager->is_skipped(NotificationsManager::SUBSCRIPTIONS)) {
  134. $NewSubscriptions = Subscriptions::has_new_subscriptions();
  135. }
  136. ?>
  137. </head>
  138. <body id="<?=$Document == 'collages' ? 'collage' : $Document?>">
  139. <div id="wrapper">
  140. <h1 class="hidden"><?=SITE_NAME?></h1>
  141. <div id="header">
  142. <div id="logo">
  143. <a href="index.php"></a>
  144. </div>
  145. <?
  146. if (isset(G::$LoggedUser['SearchType']) && G::$LoggedUser['SearchType']) { // Advanced search
  147. $UseAdvancedSearch = true;
  148. } else {
  149. $UseAdvancedSearch = false;
  150. }
  151. ?>
  152. <div id="searchbars">
  153. <ul>
  154. <li id="searchbar_torrents">
  155. <span class="hidden">Torrents: </span>
  156. <form class="search_form" name="torrents" action="torrents.php" method="get">
  157. <? if ($UseAdvancedSearch) { ?>
  158. <input type="hidden" name="action" value="advanced" />
  159. <? } ?>
  160. <input id="torrentssearch" accesskey="t" spellcheck="false"
  161. onfocus="if (this.value == 'Torrents') { this.value = ''; }"
  162. onblur="if (this.value == '') { this.value = 'Torrents'; }"
  163. value="Torrents" placeholder="Torrents" type="text" name="<?=$UseAdvancedSearch ? 'groupname' : 'searchstr' ?>" size="17" />
  164. </form>
  165. </li>
  166. <li id="searchbar_artists">
  167. <span class="hidden">Artist: </span>
  168. <form class="search_form" name="artists" action="artist.php" method="get">
  169. <input id="artistsearch"<?=Users::has_autocomplete_enabled('search');
  170. ?> accesskey="a"
  171. spellcheck="false" autocomplete="off"
  172. onfocus="if (this.value == 'Artists') { this.value = ''; }"
  173. onblur="if (this.value == '') { this.value = 'Artists'; }"
  174. value="Artists" placeholder="Artists" type="text" name="artistname" size="17" />
  175. </form>
  176. </li>
  177. <li id="searchbar_requests">
  178. <span class="hidden">Requests: </span>
  179. <form class="search_form" name="requests" action="requests.php" method="get">
  180. <input id="requestssearch" spellcheck="false"
  181. onfocus="if (this.value == 'Requests') { this.value = ''; }"
  182. onblur="if (this.value == '') { this.value = 'Requests'; }"
  183. value="Requests" placeholder="Requests" type="text" name="search" size="17" />
  184. </form>
  185. </li>
  186. <li id="searchbar_forums">
  187. <span class="hidden">Forums: </span>
  188. <form class="search_form" name="forums" action="forums.php" method="get">
  189. <input value="search" type="hidden" name="action" />
  190. <input id="forumssearch"
  191. onfocus="if (this.value == 'Forums') { this.value = ''; }"
  192. onblur="if (this.value == '') { this.value = 'Forums'; }"
  193. value="Forums" placeholder="Forums" type="text" name="search" size="17" />
  194. </form>
  195. </li>
  196. <!--
  197. <li id="searchbar_wiki">
  198. <span class="hidden">Wiki: </span>
  199. <form class="search_form" name="wiki" action="wiki.php" method="get">
  200. <input type="hidden" name="action" value="search" />
  201. <input
  202. onfocus="if (this.value == 'Wiki') { this.value = ''; }"
  203. onblur="if (this.value == '') { this.value = 'Wiki'; }"
  204. value="Wiki" placeholder="Wiki" type="text" name="search" size="17" />
  205. </form>
  206. </li>
  207. -->
  208. <li id="searchbar_log">
  209. <span class="hidden">Log: </span>
  210. <form class="search_form" name="log" action="log.php" method="get">
  211. <input id="logsearch"
  212. onfocus="if (this.value == 'Log') { this.value = ''; }"
  213. onblur="if (this.value == '') { this.value = 'Log'; }"
  214. value="Log" placeholder="Log" type="text" name="search" size="17" />
  215. </form>
  216. </li>
  217. <li id="searchbar_users">
  218. <span class="hidden">Users: </span>
  219. <form class="search_form" name="users" action="user.php" method="get">
  220. <input type="hidden" name="action" value="search" />
  221. <input
  222. id="userssearch"
  223. onfocus="if (this.value == 'Users') { this.value = ''; }"
  224. onblur="if (this.value == '') { this.value = 'Users'; }"
  225. value="Users" placeholder="Users" type="text" name="search" size="20" />
  226. </form>
  227. </li>
  228. </ul>
  229. </div>
  230. <div id="menu">
  231. <h4 class="hidden">Site Menu</h4>
  232. <ul>
  233. <li id="nav_index"<?=
  234. Format::add_class($PageID, array('index'), 'active', true)?>>
  235. <a href="index.php">Home</a>
  236. </li>
  237. <li id="nav_torrents"<?=
  238. Format::add_class($PageID, array('torrents', false, false), 'active', true)?>>
  239. <a href="torrents.php">Torrents</a>
  240. </li>
  241. <li id="nav_collages"<?=
  242. Format::add_class($PageID, array('collages'), 'active', true)?>>
  243. <a href="collages.php">Collections</a>
  244. </li>
  245. <li id="nav_requests"<?=
  246. Format::add_class($PageID, array('requests'), 'active', true)?>>
  247. <a href="requests.php">Requests</a>
  248. </li>
  249. <li id="nav_forums"<?=
  250. Format::add_class($PageID, array('forums'), 'active', true)?>>
  251. <a href="forums.php">Forums</a>
  252. </li>
  253. <li id="nav_irc"<?=
  254. Format::add_class($PageID, array('chat'), 'active', true)?>>
  255. <a href="chat.php">IRC</a>
  256. </li>
  257. <li id="nav_top10"<?=
  258. Format::add_class($PageID, array('top10'), 'active', true)?>>
  259. <a href="top10.php">Top 10</a>
  260. </li>
  261. <li id="nav_rules"<?=
  262. Format::add_class($PageID, array('rules'), 'active', true)?>>
  263. <a href="rules.php">Rules</a>
  264. </li>
  265. <li id="nav_wiki"<?=
  266. Format::add_class($PageID, array('wiki'), 'active', true)?>>
  267. <a href="wiki.php">Wiki</a>
  268. </li>
  269. <li id="nav_staff"<?=
  270. Format::add_class($PageID, array('staff'), 'active', true)?>>
  271. <a href="staff.php">Staff</a>
  272. </li>
  273. </ul>
  274. </div>
  275. <div id="userinfo">
  276. <ul id="userinfo_username">
  277. <li id="nav_userinfo" <?=Format::add_class($PageID, array('user', false, false), 'active', true, 'id')?>>
  278. <a href="user.php?id=<?=G::$LoggedUser['ID']?>" class="username"><?=G::$LoggedUser['Username']?></a>
  279. </li>
  280. <li id="nav_userclass">
  281. <span class="hidden userclass"><?=$ClassLevels[G::$LoggedUser['Class']]['Name']?></span>
  282. </li>
  283. <li id="nav_useredit" class="brackets<?=Format::add_class($PageID, array('user','edit'), 'active', false)?>">
  284. <a href="user.php?action=edit&amp;userid=<?=G::$LoggedUser['ID']?>">Edit</a>
  285. </li>
  286. <li id="nav_logout" class="brackets">
  287. <a href="logout.php?auth=<?=G::$LoggedUser['AuthKey']?>">Logout</a>
  288. </li>
  289. </ul>
  290. <ul id="userinfo_major">
  291. <li id="nav_upload" class="brackets<?=Format::add_class($PageID, array('upload'), 'active', false)?>">
  292. <a href="upload.php">Upload</a>
  293. </li>
  294. <?
  295. if (check_perms('site_send_unlimited_invites')) {
  296. $Invites = ' (∞)';
  297. } elseif (G::$LoggedUser['Invites'] > 0) {
  298. $Invites = ' ('.G::$LoggedUser['Invites'].')';
  299. } else {
  300. $Invites = '';
  301. }
  302. ?>
  303. <li id="nav_invite" class="brackets<?=Format::add_class($PageID, array('user','invite'), 'active', false)?>">
  304. <a href="user.php?action=invite">Invite<?=$Invites?></a>
  305. </li>
  306. <li id="nav_donate" class="brackets<?=Format::add_class($PageID, array('donate'), 'active', false)?>">
  307. <a href="donate.php">Donate</a>
  308. </li>
  309. </ul>
  310. <ul id="userinfo_stats">
  311. <li id="stats_seeding">
  312. <a href="torrents.php?type=seeding&amp;userid=<?=G::$LoggedUser['ID']?>">Up</a>:
  313. <span class="stat tooltip" title="<?=Format::get_size(G::$LoggedUser['BytesUploaded'], 5)?>"><?=Format::get_size(G::$LoggedUser['BytesUploaded'])?></span>
  314. </li>
  315. <li id="stats_leeching">
  316. <a href="torrents.php?type=leeching&amp;userid=<?=G::$LoggedUser['ID']?>">Down</a>:
  317. <span class="stat tooltip" title="<?=Format::get_size(G::$LoggedUser['BytesDownloaded'], 5)?>"><?=Format::get_size(G::$LoggedUser['BytesDownloaded'])?></span>
  318. </li>
  319. <li id="stats_ratio">
  320. Ratio: <span class="stat"><?=Format::get_ratio_html(G::$LoggedUser['BytesUploaded'], G::$LoggedUser['BytesDownloaded'])?></span>
  321. </li>
  322. <? if (!empty(G::$LoggedUser['RequiredRatio']) && G::$LoggedUser['RequiredRatio'] > 0) { ?>
  323. <li id="stats_required">
  324. <a href="rules.php?p=ratio">Required</a>:
  325. <span class="stat tooltip" title="<?=number_format(G::$LoggedUser['RequiredRatio'], 5)?>"><?=number_format(G::$LoggedUser['RequiredRatio'], 2)?></span>
  326. </li>
  327. <? }
  328. if (G::$LoggedUser['FLTokens'] > 0) { ?>
  329. <li id="fl_tokens">
  330. <a href="wiki.php?action=article&amp;id=7">Tokens</a>:
  331. <span class="stat">
  332. <a href="userhistory.php?action=token_history&amp;userid=<?=G::$LoggedUser['ID']?>"><?=G::$LoggedUser['FLTokens']?></a>
  333. </span>
  334. </li>
  335. <? }
  336. ?>
  337. <li id="bonus_points">
  338. <a href="wiki.php?action=article&amp;id=8">Nips</a>:
  339. <span class="stat">
  340. <a href="store.php"><?=number_format(G::$LoggedUser['BonusPoints'])?></a>
  341. </span>
  342. </li>
  343. <? if (G::$LoggedUser['HnR'] > 0) { ?>
  344. <li id="hnr">
  345. <a href="snatchlist.php">HnRs</a>:
  346. <span class="stat">
  347. <a><?=G::$LoggedUser['HnR']?></a>
  348. </span>
  349. </li>
  350. <? }
  351. ?>
  352. </ul>
  353. <ul id="userinfo_minor"<?=$NewSubscriptions ? ' class="highlite"' : ''?>>
  354. <li>
  355. <span id="header_links_menu" class="brackets">Links ▾</span>
  356. <ul>
  357. <li id="nav_inbox"<?=
  358. Format::add_class($PageID, array('inbox'), 'active', true)?>>
  359. <a href="<?=Inbox::get_inbox_link(); ?>">Inbox</a>
  360. </li>
  361. <li id="nav_staffinbox"<?=
  362. Format::add_class($PageID, array('staffpm'), 'active', true)?>>
  363. <a href="staffpm.php">Staff Inbox</a>
  364. </li>
  365. <li id="nav_uploaded"<?=
  366. Format::add_class($PageID, array('torrents', false, 'uploaded'), 'active', true, 'userid')?>>
  367. <a href="torrents.php?type=uploaded&amp;userid=<?=G::$LoggedUser['ID']?>">Uploads</a>
  368. </li>
  369. <li id="nav_bookmarks"<?=
  370. Format::add_class($PageID, array('bookmarks'), 'active', true)?>>
  371. <a href="bookmarks.php?type=torrents">Bookmarks</a>
  372. </li>
  373. <? if (check_perms('site_torrents_notify')) { ?>
  374. <li id="nav_notifications"<?=
  375. Format::add_class($PageID, array(array('torrents', 'notify'), array('user', 'notify')), 'active', true, 'userid')?>>
  376. <a href="user.php?action=notify">Notifications</a>
  377. </li>
  378. <? }
  379. $ClassNames = $NewSubscriptions ? 'new-subscriptions' : '';
  380. $ClassNames = trim($ClassNames.Format::add_class($PageID, array('userhistory', 'subscriptions'), 'active', false));
  381. ?>
  382. <li id="nav_subscriptions"<?=$ClassNames ? " class=\"$ClassNames\"" : ''?>>
  383. <a href="userhistory.php?action=subscriptions">Subscriptions</a>
  384. </li>
  385. <li id="nav_comments"<?=
  386. Format::add_class($PageID, array('comments'), 'active', true, 'userid')?>>
  387. <a href="comments.php">Comments</a></li>
  388. <li id="nav_friends"<?=
  389. Format::add_class($PageID, array('friends'), 'active', true)?>>
  390. <a href="friends.php">Friends</a></li>
  391. </ul>
  392. </li>
  393. </ul>
  394. </div>
  395. </div>
  396. <?
  397. //Start handling alert bars
  398. $Alerts = array();
  399. $ModBar = array();
  400. // Staff blog
  401. if (check_perms('users_mod')) {
  402. global $SBlogReadTime, $LatestSBlogTime;
  403. if (!$SBlogReadTime && ($SBlogReadTime = G::$Cache->get_value('staff_blog_read_'.G::$LoggedUser['ID'])) === false) {
  404. G::$DB->query("
  405. SELECT Time
  406. FROM staff_blog_visits
  407. WHERE UserID = ".G::$LoggedUser['ID']);
  408. if (list($SBlogReadTime) = G::$DB->next_record()) {
  409. $SBlogReadTime = strtotime($SBlogReadTime);
  410. } else {
  411. $SBlogReadTime = 0;
  412. }
  413. G::$Cache->cache_value('staff_blog_read_'.G::$LoggedUser['ID'], $SBlogReadTime, 1209600);
  414. }
  415. if (!$LatestSBlogTime && ($LatestSBlogTime = G::$Cache->get_value('staff_blog_latest_time')) === false) {
  416. G::$DB->query("
  417. SELECT MAX(Time)
  418. FROM staff_blog");
  419. list($LatestSBlogTime) = G::$DB->next_record();
  420. if ($LatestSBlogTime) {
  421. $LatestSBlogTime = strtotime($LatestSBlogTime);
  422. } else {
  423. $LatestSBlogTime = 0;
  424. }
  425. G::$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600);
  426. }
  427. if ($SBlogReadTime < $LatestSBlogTime) {
  428. $Alerts[] = '<a href="staffblog.php">New staff blog post!</a>';
  429. }
  430. }
  431. // Inbox
  432. if ($NotificationsManager->is_traditional(NotificationsManager::INBOX)) {
  433. $NotificationsManager->load_inbox();
  434. $NewMessages = $NotificationsManager->get_notifications();
  435. if (isset($NewMessages[NotificationsManager::INBOX])) {
  436. $Alerts[] = NotificationsManagerView::format_traditional($NewMessages[NotificationsManager::INBOX]);
  437. }
  438. $NotificationsManager->clear_notifications_array();
  439. }
  440. if (G::$LoggedUser['RatioWatch']) {
  441. $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.';
  442. } elseif (G::$LoggedUser['CanLeech'] != 1) {
  443. $Alerts[] = '<a href="rules.php?p=ratio">Ratio Watch</a>: Your downloading privileges are disabled until you meet your required ratio.';
  444. }
  445. // Torrents
  446. if ($NotificationsManager->is_traditional(NotificationsManager::TORRENTS)) {
  447. $NotificationsManager->load_torrent_notifications();
  448. $NewTorrents = $NotificationsManager->get_notifications();
  449. if (isset($NewTorrents[NotificationsManager::TORRENTS])) {
  450. $Alerts[] = NotificationsManagerView::format_traditional($NewTorrents[NotificationsManager::TORRENTS]);
  451. }
  452. $NotificationsManager->clear_notifications_array();
  453. }
  454. // Contests
  455. if ($ContestSettings = G::$Cache->get_value('contest_settings')) {
  456. if (time() > $ContestSettings['start'] && time() < $ContestSettings['end']) {
  457. $Alerts[] = '<a href="/contest.php">A Contest is Underway!</a>';
  458. }
  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">