Frontend elements to SugoiMusic, including CSS and public/private headers.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

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