Frontend elements to SugoiMusic, including CSS and public/private headers.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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