Empty commit

This commit is contained in:
Git 2013-07-01 08:01:00 +00:00
parent 649323668c
commit a0a084fe34
33 changed files with 1220 additions and 396 deletions

View File

@ -1,7 +1,4 @@
<?
if (!empty($_GET['action']) && $_GET['action'] === 'autocomplete') {
require('sections/artist/autocomplete.php');
} else {
define('ERROR_EXCEPTION', true);
require('classes/script_start.php');
}
define('ERROR_EXCEPTION', true);
require ('classes/script_start.php');

View File

@ -5,62 +5,115 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?=display_str($PageTitle)?></title>
<meta http-equiv="X-UA-Compatible" content="chrome=1;IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="favicon.ico" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="search" type="application/opensearchdescription+xml" title="<?=SITE_NAME?> Torrents" href="opensearch.php?type=torrents" />
<link rel="search" type="application/opensearchdescription+xml" title="<?=SITE_NAME?> Artists" href="opensearch.php?type=artists" />
<link rel="search" type="application/opensearchdescription+xml" title="<?=SITE_NAME?> Requests" href="opensearch.php?type=requests" />
<link rel="search" type="application/opensearchdescription+xml" title="<?=SITE_NAME?> Forums" href="opensearch.php?type=forums" />
<link rel="search" type="application/opensearchdescription+xml" title="<?=SITE_NAME?> Log" href="opensearch.php?type=log" />
<link rel="search" type="application/opensearchdescription+xml" title="<?=SITE_NAME?> Users" href="opensearch.php?type=users" />
<link rel="search" type="application/opensearchdescription+xml" title="<?=SITE_NAME?> Wiki" href="opensearch.php?type=wiki" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=feed_news&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - News" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=feed_blog&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - Blog" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=feed_changelog&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - Gazelle Change Log" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_notify_<?=$LoggedUser['torrent_pass']?>&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - P.T.N." />
<title><?=display_str($PageTitle)?></title>
<meta http-equiv="X-UA-Compatible" content="chrome=1;IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="favicon.ico" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="search" type="application/opensearchdescription+xml"
title="<?=SITE_NAME?> Torrents" href="opensearch.php?type=torrents" />
<link rel="search" type="application/opensearchdescription+xml"
title="<?=SITE_NAME?> Artists" href="opensearch.php?type=artists" />
<link rel="search" type="application/opensearchdescription+xml"
title="<?=SITE_NAME?> Requests" href="opensearch.php?type=requests" />
<link rel="search" type="application/opensearchdescription+xml"
title="<?=SITE_NAME?> Forums" href="opensearch.php?type=forums" />
<link rel="search" type="application/opensearchdescription+xml"
title="<?=SITE_NAME?> Log" href="opensearch.php?type=log" />
<link rel="search" type="application/opensearchdescription+xml"
title="<?=SITE_NAME?> Users" href="opensearch.php?type=users" />
<link rel="search" type="application/opensearchdescription+xml"
title="<?=SITE_NAME?> Wiki" href="opensearch.php?type=wiki" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=feed_news&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - News" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=feed_blog&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - Blog" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=feed_changelog&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - Gazelle Change Log" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_notify_<?=$LoggedUser['torrent_pass']?>&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - P.T.N." />
<?
if (isset($LoggedUser['Notify'])) {
foreach ($LoggedUser['Notify'] as $Filter) {
list($FilterID, $FilterName) = $Filter;
?>
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_notify_<?=$FilterID?>_<?=$LoggedUser['torrent_pass']?>&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;name=<?=urlencode($FilterName)?>" title="<?=SITE_NAME?> - <?=display_str($FilterName)?>" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_notify_<?=$FilterID?>_<?=$LoggedUser['torrent_pass']?>&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;name=<?=urlencode($FilterName)?>"
title="<?=SITE_NAME?> - <?=display_str($FilterName)?>" />
<?
}
}
?>
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_all&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - All Torrents" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_music&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - Music Torrents" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_apps&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - Application Torrents" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_ebooks&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - E-Book Torrents" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_abooks&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - Audiobooks Torrents" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_evids&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - E-Learning Video Torrents" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_comedy&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - Comedy Torrents" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_comics&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - Comic Torrents" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_mp3&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - MP3 Torrents" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_flac&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - FLAC Torrents" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_vinyl&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - Vinyl Sourced Torrents" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_lossless&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - Lossless Torrents" />
<link rel="alternate" type="application/rss+xml" href="feeds.php?feed=torrents_lossless24&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - 24bit Lossless Torrents" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_all&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - All Torrents" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_music&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - Music Torrents" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_apps&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - Application Torrents" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_ebooks&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - E-Book Torrents" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_abooks&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - Audiobooks Torrents" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_evids&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - E-Learning Video Torrents" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_comedy&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - Comedy Torrents" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_comics&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - Comic Torrents" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_mp3&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - MP3 Torrents" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_flac&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - FLAC Torrents" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_vinyl&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - Vinyl Sourced Torrents" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_lossless&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - Lossless Torrents" />
<link rel="alternate" type="application/rss+xml"
href="feeds.php?feed=torrents_lossless24&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>"
title="<?=SITE_NAME?> - 24bit Lossless Torrents" />
<link href="<?=STATIC_SERVER?>styles/global.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/global.css')?>" rel="stylesheet" type="text/css" />
<link
href="<?=STATIC_SERVER?>styles/global.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/global.css')?>"
rel="stylesheet" type="text/css" />
<? if ($Mobile) { ?>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0, user-scalable=no;" />
<link href="<?=STATIC_SERVER ?>styles/mobile/style.css" rel="stylesheet" type="text/css" />
<meta name="viewport"
content="width=device-width; initial-scale=1.0; maximum-scale=1.0, user-scalable=no;" />
<link href="<?=STATIC_SERVER ?>styles/mobile/style.css" rel="stylesheet"
type="text/css" />
<?
} else {
if (empty($LoggedUser['StyleURL'])) {
?>
<link href="<?=STATIC_SERVER?>styles/<?=$LoggedUser['StyleName']?>/style.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/'.$LoggedUser['StyleName'].'/style.css')?>" title="<?=$LoggedUser['StyleName']?>" rel="stylesheet" type="text/css" media="screen" />
<link
href="<?=STATIC_SERVER?>styles/<?=$LoggedUser['StyleName']?>/style.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/'.$LoggedUser['StyleName'].'/style.css')?>"
title="<?=$LoggedUser['StyleName']?>" rel="stylesheet" type="text/css"
media="screen" />
<? } else { ?>
<link href="<?=$LoggedUser['StyleURL']?>" title="External CSS" rel="stylesheet" type="text/css" media="screen" />
<link href="<?=$LoggedUser['StyleURL']?>" title="External CSS"
rel="stylesheet" type="text/css" media="screen" />
<?
}
if ($LoggedUser['UseOpenDyslexic']) {
// load the OpenDyslexic font ?>
<link rel="stylesheet" href="<?=STATIC_SERVER?>styles/opendyslexic/style.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/opendyslexic/style.css')?>" type="text/css" charset="utf-8" />
<link rel="stylesheet"
href="<?=STATIC_SERVER?>styles/opendyslexic/style.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/opendyslexic/style.css')?>"
type="text/css" charset="utf-8" />
<!--<link href="<?=STATIC_SERVER?>styles/opendyslexic/style.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/opendyslexic/style.css')?>" title="OpenDyslexic" rel="stylesheet" type="text/css" media="screen" />-->
<?
@ -68,14 +121,26 @@
}
?>
<script src="<?=STATIC_SERVER?>functions/jquery.js" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/script_start.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/script_start.js')?>" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/ajax.class.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/ajax.class.js')?>" type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
<script src="<?=STATIC_SERVER?>functions/jquery.js"
type="text/javascript"></script>
<script
src="<?=STATIC_SERVER?>functions/script_start.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/script_start.js')?>"
type="text/javascript"></script>
<script
src="<?=STATIC_SERVER?>functions/ajax.class.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/ajax.class.js')?>"
type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
var authkey = "<?=$LoggedUser['AuthKey']?>";
var userid = <?=$LoggedUser['ID']?>;
//]]></script>
<script src="<?=STATIC_SERVER?>functions/global.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/global.js')?>" type="text/javascript"></script>
<script
src="<?=STATIC_SERVER?>functions/global.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/global.js')?>"
type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/jquery.autocomplete.js"
type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/autocomplete.js"
type="text/javascript"></script>
<?
$Scripts = explode(',', $JSIncludes);
@ -84,29 +149,41 @@
continue;
}
?>
<script src="<?=STATIC_SERVER?>functions/<?=$Script?>.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/'.$Script.'.js')?>" type="text/javascript"></script>
<script
src="<?=STATIC_SERVER?>functions/<?=$Script?>.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/'.$Script.'.js')?>"
type="text/javascript"></script>
<?
}
if ($Mobile) { ?>
<script src="<?=STATIC_SERVER?>styles/mobile/style.js" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>styles/mobile/style.js"
type="text/javascript"></script>
<?
}
?>
</head>
<body id="<?=$Document == 'collages' ? 'collage' : $Document?>">
<div id="wrapper">
<h1 class="hidden"><?=SITE_NAME?></h1>
<div id="wrapper">
<h1 class="hidden"><?=SITE_NAME?></h1>
<div id="header">
<div id="logo"><a href="index.php"></a></div>
<div id="userinfo">
<ul id="userinfo_username">
<li id="nav_userinfo"<?=Format::add_class($PageID, array('user',false,false), 'active', true, 'id')?>><a href="user.php?id=<?=$LoggedUser['ID']?>" class="username"><?=$LoggedUser['Username']?></a></li>
<li id="nav_useredit" class="brackets<?=Format::add_class($PageID, array('user','edit'), 'active', false)?>"><a href="user.php?action=edit&amp;userid=<?=$LoggedUser['ID']?>">Edit</a></li>
<li id="nav_logout" class="brackets"><a href="logout.php?auth=<?=$LoggedUser['AuthKey']?>">Logout</a></li>
</ul>
<ul id="userinfo_major">
<li id="nav_upload" class="brackets<?=Format::add_class($PageID, array('upload'), 'active', false)?>"><a href="upload.php">Upload</a></li>
<div id="header">
<div id="logo">
<a href="index.php"></a>
</div>
<div id="userinfo">
<ul id="userinfo_username">
<li id="nav_userinfo"
<?=Format::add_class($PageID, array('user',false,false), 'active', true, 'id')?>><a
href="user.php?id=<?=$LoggedUser['ID']?>" class="username"><?=$LoggedUser['Username']?></a></li>
<li id="nav_useredit"
class="brackets<?=Format::add_class($PageID, array('user','edit'), 'active', false)?>"><a
href="user.php?action=edit&amp;userid=<?=$LoggedUser['ID']?>">Edit</a></li>
<li id="nav_logout" class="brackets"><a
href="logout.php?auth=<?=$LoggedUser['AuthKey']?>">Logout</a></li>
</ul>
<ul id="userinfo_major">
<li id="nav_upload"
class="brackets<?=Format::add_class($PageID, array('upload'), 'active', false)?>"><a
href="upload.php">Upload</a></li>
<?
if (check_perms('site_send_unlimited_invites')) {
$Invites = ' (∞)';
@ -116,19 +193,33 @@
$Invites = '';
}
?>
<li id="nav_invite" class="brackets<?=Format::add_class($PageID, array('user','invite'), 'active', false)?>"><a href="user.php?action=invite">Invite<?=$Invites?></a></li>
<li id="nav_donate" class="brackets<?=Format::add_class($PageID, array('donate'), 'active', false)?>"><a href="donate.php">Donate</a></li>
</ul>
<ul id="userinfo_stats">
<li id="stats_seeding"><a href="torrents.php?type=seeding&amp;userid=<?=$LoggedUser['ID']?>">Up</a>: <span class="stat" title="<?=Format::get_size($LoggedUser['BytesUploaded'], 5)?>"><?=Format::get_size($LoggedUser['BytesUploaded'])?></span></li>
<li id="stats_leeching"><a href="torrents.php?type=leeching&amp;userid=<?=$LoggedUser['ID']?>">Down</a>: <span class="stat" title="<?=Format::get_size($LoggedUser['BytesDownloaded'], 5)?>"><?=Format::get_size($LoggedUser['BytesDownloaded'])?></span></li>
<li id="stats_ratio">Ratio: <span class="stat"><?=Format::get_ratio_html($LoggedUser['BytesUploaded'], $LoggedUser['BytesDownloaded'])?></span></li>
<li id="nav_invite"
class="brackets<?=Format::add_class($PageID, array('user','invite'), 'active', false)?>"><a
href="user.php?action=invite">Invite<?=$Invites?></a></li>
<li id="nav_donate"
class="brackets<?=Format::add_class($PageID, array('donate'), 'active', false)?>"><a
href="donate.php">Donate</a></li>
</ul>
<ul id="userinfo_stats">
<li id="stats_seeding"><a
href="torrents.php?type=seeding&amp;userid=<?=$LoggedUser['ID']?>">Up</a>:
<span class="stat"
title="<?=Format::get_size($LoggedUser['BytesUploaded'], 5)?>"><?=Format::get_size($LoggedUser['BytesUploaded'])?></span></li>
<li id="stats_leeching"><a
href="torrents.php?type=leeching&amp;userid=<?=$LoggedUser['ID']?>">Down</a>:
<span class="stat"
title="<?=Format::get_size($LoggedUser['BytesDownloaded'], 5)?>"><?=Format::get_size($LoggedUser['BytesDownloaded'])?></span></li>
<li id="stats_ratio">Ratio: <span class="stat"><?=Format::get_ratio_html($LoggedUser['BytesUploaded'], $LoggedUser['BytesDownloaded'])?></span></li>
<? if (!empty($LoggedUser['RequiredRatio'])) { ?>
<li id="stats_required"><a href="rules.php?p=ratio">Required</a>: <span class="stat" title="<?=number_format($LoggedUser['RequiredRatio'], 5)?>"><?=number_format($LoggedUser['RequiredRatio'], 2)?></span></li>
<li id="stats_required"><a href="rules.php?p=ratio">Required</a>: <span
class="stat"
title="<?=number_format($LoggedUser['RequiredRatio'], 5)?>"><?=number_format($LoggedUser['RequiredRatio'], 2)?></span></li>
<? }
if ($LoggedUser['FLTokens'] > 0) { ?>
<li id="fl_tokens"><a href="wiki.php?action=article&amp;id=754">Tokens</a>: <span class="stat"><a href="userhistory.php?action=token_history&amp;userid=<?=$LoggedUser['ID']?>"><?=$LoggedUser['FLTokens']?></a></span></li>
<li id="fl_tokens"><a href="wiki.php?action=article&amp;id=754">Tokens</a>:
<span class="stat"><a
href="userhistory.php?action=token_history&amp;userid=<?=$LoggedUser['ID']?>"><?=$LoggedUser['FLTokens']?></a></span></li>
<? } ?>
</ul>
<?
@ -153,34 +244,77 @@
list($NewSubscriptions) = $DB->next_record();
$Cache->cache_value('subscriptions_user_new_'.$LoggedUser['ID'], $NewSubscriptions, 0);
} ?>
<ul id="userinfo_minor"<?=($NewSubscriptions ? ' class="highlite"' : '')?>>
<li id="nav_inbox"<?=Format::add_class($PageID, array('inbox'), 'active', true)?>><a onmousedown="Stats('inbox');" href="<?=Inbox::get_inbox_link(); ?>">Inbox</a></li>
<li id="nav_staffinbox"<?=Format::add_class($PageID, array('staffpm'), 'active', true)?>><a onmousedown="Stats('staffpm');" href="staffpm.php">Staff Inbox</a></li>
<li id="nav_uploaded"<?=Format::add_class($PageID, array('torrents',false,'uploaded'), 'active', true, 'userid')?>><a onmousedown="Stats('uploads');" href="torrents.php?type=uploaded&amp;userid=<?=$LoggedUser['ID']?>">Uploads</a></li>
<li id="nav_bookmarks"<?=Format::add_class($PageID, array('bookmarks'), 'active', true)?>><a onmousedown="Stats('bookmarks');" href="bookmarks.php?type=torrents">Bookmarks</a></li>
<ul id="userinfo_minor"
<?=($NewSubscriptions ? ' class="highlite"' : '')?>>
<li id="nav_inbox"
<?=Format::add_class($PageID, array('inbox'), 'active', true)?>><a
onmousedown="Stats('inbox');"
href="<?=Inbox::get_inbox_link(); ?>">Inbox</a></li>
<li id="nav_staffinbox"
<?=Format::add_class($PageID, array('staffpm'), 'active', true)?>><a
onmousedown="Stats('staffpm');" href="staffpm.php">Staff Inbox</a></li>
<li id="nav_uploaded"
<?=Format::add_class($PageID, array('torrents',false,'uploaded'), 'active', true, 'userid')?>><a
onmousedown="Stats('uploads');"
href="torrents.php?type=uploaded&amp;userid=<?=$LoggedUser['ID']?>">Uploads</a></li>
<li id="nav_bookmarks"
<?=Format::add_class($PageID, array('bookmarks'), 'active', true)?>><a
onmousedown="Stats('bookmarks');"
href="bookmarks.php?type=torrents">Bookmarks</a></li>
<? if (check_perms('site_torrents_notify')) { ?>
<li id="nav_notifications" <?=Format::add_class($PageID, array(array('torrents','notify'),array('user','notify')), 'active', true, 'userid')?>><a onmousedown="Stats('notifications');" href="user.php?action=notify">Notifications</a></li>
<li id="nav_notifications"
<?=Format::add_class($PageID, array(array('torrents','notify'),array('user','notify')), 'active', true, 'userid')?>><a
onmousedown="Stats('notifications');"
href="user.php?action=notify">Notifications</a></li>
<? } ?>
<li id="nav_subscriptions"<?=Format::add_class($PageID, array('userhistory','subscriptions'), 'active', true)?>><a onmousedown="Stats('subscriptions');" href="userhistory.php?action=subscriptions"<?=($NewSubscriptions ? ' class="new-subscriptions"' : '')?>>Subscriptions</a></li>
<li id="nav_comments"<?=Format::add_class($PageID, array('comments'), 'active', true, 'userid')?>><a onmousedown="Stats('comments');" href="comments.php">Comments</a></li>
<li id="nav_friends"<?=Format::add_class($PageID, array('friends'), 'active', true)?>><a onmousedown="Stats('friends');" href="friends.php">Friends</a></li>
</ul>
</div>
<div id="menu">
<h4 class="hidden">Site Menu</h4>
<ul>
<li id="nav_index"<?=Format::add_class($PageID, array('index'), 'active', true)?>><a href="index.php">Home</a></li>
<li id="nav_torrents"<?=Format::add_class($PageID, array('torrents',false,false), 'active', true)?>><a href="torrents.php">Torrents</a></li>
<li id="nav_collages"<?=Format::add_class($PageID, array('collages'), 'active', true)?>><a href="collages.php">Collages</a></li>
<li id="nav_requests"<?=Format::add_class($PageID, array('requests'), 'active', true)?>><a href="requests.php">Requests</a></li>
<li id="nav_forums"<?=Format::add_class($PageID, array('forums'), 'active', true)?>><a href="forums.php">Forums</a></li>
<li id="nav_irc"<?=Format::add_class($PageID, array('chat'), 'active', true)?>><a href="chat.php">IRC</a></li>
<li id="nav_top10"<?=Format::add_class($PageID, array('top10'), 'active', true)?>><a href="top10.php">Top 10</a></li>
<li id="nav_rules"<?=Format::add_class($PageID, array('rules'), 'active', true)?>><a href="rules.php">Rules</a></li>
<li id="nav_wiki"<?=Format::add_class($PageID, array('wiki'), 'active', true)?>><a href="wiki.php">Wiki</a></li>
<li id="nav_staff"<?=Format::add_class($PageID, array('staff'), 'active', true)?>><a href="staff.php">Staff</a></li>
</ul>
</div>
<li id="nav_subscriptions"
<?=Format::add_class($PageID, array('userhistory','subscriptions'), 'active', true)?>><a
onmousedown="Stats('subscriptions');"
href="userhistory.php?action=subscriptions"
<?=($NewSubscriptions ? ' class="new-subscriptions"' : '')?>>Subscriptions</a></li>
<li id="nav_comments"
<?=Format::add_class($PageID, array('comments'), 'active', true, 'userid')?>><a
onmousedown="Stats('comments');" href="comments.php">Comments</a></li>
<li id="nav_friends"
<?=Format::add_class($PageID, array('friends'), 'active', true)?>><a
onmousedown="Stats('friends');" href="friends.php">Friends</a></li>
</ul>
</div>
<div id="menu">
<h4 class="hidden">Site Menu</h4>
<ul>
<li id="nav_index"
<?=Format::add_class($PageID, array('index'), 'active', true)?>><a
href="index.php">Home</a></li>
<li id="nav_torrents"
<?=Format::add_class($PageID, array('torrents',false,false), 'active', true)?>><a
href="torrents.php">Torrents</a></li>
<li id="nav_collages"
<?=Format::add_class($PageID, array('collages'), 'active', true)?>><a
href="collages.php">Collages</a></li>
<li id="nav_requests"
<?=Format::add_class($PageID, array('requests'), 'active', true)?>><a
href="requests.php">Requests</a></li>
<li id="nav_forums"
<?=Format::add_class($PageID, array('forums'), 'active', true)?>><a
href="forums.php">Forums</a></li>
<li id="nav_irc"
<?=Format::add_class($PageID, array('chat'), 'active', true)?>><a
href="chat.php">IRC</a></li>
<li id="nav_top10"
<?=Format::add_class($PageID, array('top10'), 'active', true)?>><a
href="top10.php">Top 10</a></li>
<li id="nav_rules"
<?=Format::add_class($PageID, array('rules'), 'active', true)?>><a
href="rules.php">Rules</a></li>
<li id="nav_wiki"
<?=Format::add_class($PageID, array('wiki'), 'active', true)?>><a
href="wiki.php">Wiki</a></li>
<li id="nav_staff"
<?=Format::add_class($PageID, array('staff'), 'active', true)?>><a
href="staff.php">Staff</a></li>
</ul>
</div>
<?
//Start handling alert bars
$Alerts = array();
@ -485,67 +619,50 @@
?>
<div id="searchbars">
<ul>
<li id="searchbar_torrents">
<span class="hidden">Torrents: </span>
<form class="search_form" name="torrents" action="torrents.php" method="get">
<ul>
<li id="searchbar_torrents"><span class="hidden">Torrents: </span>
<form class="search_form" name="torrents" action="torrents.php"
method="get">
<? if (isset($LoggedUser['SearchType']) && $LoggedUser['SearchType']) { // Advanced search ?>
<input type="hidden" name="action" value="advanced" />
<? } ?>
<input
id="torrentssearch"
accesskey="t"
spellcheck="false"
onfocus="if (this.value == 'Torrents') this.value='';"
onblur="if (this.value == '') this.value='Torrents';"
<? if (isset($LoggedUser['SearchType']) && $LoggedUser['SearchType']) { // Advanced search ?>
value="Torrents" type="text" name="groupname" size="17"
<? } else { ?>
value="Torrents" type="text" name="searchstr" size="17"
<? } ?>
/>
</form>
</li>
<li id="searchbar_artists">
<span class="hidden">Artist: </span>
<form class="search_form" name="artists" action="artist.php" method="get">
<script type="text/javascript" src="static/functions/autocomplete.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/autocomplete.js')?>"></script>
<input id="artistsearch"
onkeyup="autocomp.keyup(event);"
onkeydown="autocomp.keydown(event);"
accesskey="a" spellcheck="false" autocomplete="off"
onfocus="if (this.value == 'Artists') this.value=''; autocomp.start('artist');"
onblur="if (this.value == '') this.value='Artists';"
value="Artists" type="text" name="artistname" size="17"
/>
<ul id="artistcomplete" style="visibility: hidden;"><li /></ul>
</form>
</li>
<li id="searchbar_requests">
<span class="hidden">Requests: </span>
<form class="search_form" name="requests" action="requests.php" method="get">
<input
id="requestssearch"
spellcheck="false"
onfocus="if (this.value == 'Requests') this.value='';"
onblur="if (this.value == '') this.value='Requests';"
value="Requests" type="text" name="search" size="17"
/>
</form>
</li>
<li id="searchbar_forums">
<span class="hidden">Forums: </span>
<form class="search_form" name="forums" action="forums.php" method="get">
<input value="search" type="hidden" name="action" />
<input
id="forumssearch"
onfocus="if (this.value == 'Forums') this.value='';"
onblur="if (this.value == '') this.value='Forums';"
value="Forums" type="text" name="search" size="17"
/>
</form>
</li>
<!--
<input id="torrentssearch" accesskey="t" spellcheck="false"
onfocus="if (this.value == 'Torrents') this.value='';"
onblur="if (this.value == '') this.value='Torrents';"
<? if (isset($LoggedUser['SearchType']) && $LoggedUser['SearchType']) { // Advanced search ?>
value="Torrents" type="text" name="groupname" size="17"
<? } else { ?> value="Torrents" type="text" name="searchstr"
size="17" <? } ?> />
</form></li>
<li id="searchbar_artists"><span class="hidden">Artist: </span>
<form class="search_form" name="artists" action="artist.php"
method="get">
<input id="artistsearch"
accesskey="a"
spellcheck="false" autocomplete="off"
onfocus="if (this.value == 'Artists') this.value='';"
onblur="if (this.value == '') this.value='Artists';"
value="Artists" type="text" name="artistname" size="17" />
</form>
</li>
<li id="searchbar_requests"><span class="hidden">Requests: </span>
<form class="search_form" name="requests" action="requests.php"
method="get">
<input id="requestssearch" spellcheck="false"
onfocus="if (this.value == 'Requests') this.value='';"
onblur="if (this.value == '') this.value='Requests';"
value="Requests" type="text" name="search" size="17" />
</form></li>
<li id="searchbar_forums"><span class="hidden">Forums: </span>
<form class="search_form" name="forums" action="forums.php"
method="get">
<input value="search" type="hidden" name="action" /> <input
id="forumssearch"
onfocus="if (this.value == 'Forums') this.value='';"
onblur="if (this.value == '') this.value='Forums';"
value="Forums" type="text" name="search" size="17" />
</form></li>
<!--
<li id="searchbar_wiki">
<span class="hidden">Wiki: </span>
<form class="search_form" name="wiki" action="wiki.php" method="get">
@ -558,30 +675,23 @@
</form>
</li>
-->
<li id="searchbar_log">
<span class="hidden">Log: </span>
<form class="search_form" name="log" action="log.php" method="get">
<input
id="logsearch"
onfocus="if (this.value == 'Log') this.value='';"
onblur="if (this.value == '') this.value='Log';"
value="Log" type="text" name="search" size="17"
/>
</form>
</li>
<li id="searchbar_users">
<span class="hidden">Users: </span>
<form class="search_form" name="users" action="user.php" method="get">
<input type="hidden" name="action" value="search" />
<input
id="userssearch"
onfocus="if (this.value == 'Users') this.value='';"
onblur="if (this.value == '') this.value='Users';"
value="Users" type="text" name="search" size="20"
/>
</form>
</li>
</ul>
</div>
</div>
<div id="content">
<li id="searchbar_log"><span class="hidden">Log: </span>
<form class="search_form" name="log" action="log.php" method="get">
<input id="logsearch"
onfocus="if (this.value == 'Log') this.value='';"
onblur="if (this.value == '') this.value='Log';" value="Log"
type="text" name="search" size="17" />
</form></li>
<li id="searchbar_users"><span class="hidden">Users: </span>
<form class="search_form" name="users" action="user.php"
method="get">
<input type="hidden" name="action" value="search" /> <input
id="userssearch"
onfocus="if (this.value == 'Users') this.value='';"
onblur="if (this.value == '') this.value='Users';" value="Users"
type="text" name="search" size="20" />
</form></li>
</ul>
</div>
</div>
<div id="content">

View File

@ -1,5 +1,11 @@
CHANGELOG
2013-07-01 by Ajax
Moved autocomplete logic to jquery plugin, introduced artist autocompletes on rest of site
2013-06-30 by Ajax
Give custom ordering to stickied threads
2013-06-24 by Ajax
Added user recents to API. ajax.php?action=user_recents&userid=<ID>&limit=<LIMIT> the limit defaults to 15 if empty and maxes out at 50

View File

@ -391,6 +391,7 @@ CREATE TABLE `forums_topics` (
`LastPostTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`LastPostAuthorID` int(10) NOT NULL,
`StickyPostID` int(10) NOT NULL DEFAULT '0',
`Ranking` tinyint(2) DEFAULT '0',
PRIMARY KEY (`ID`),
KEY `AuthorID` (`AuthorID`),
KEY `ForumID` (`ForumID`),

View File

@ -193,9 +193,10 @@ function compare($X, $Y) {
$SortOrder = $ReleaseTypes;
}
// If the $SortOrder array doesn't have all release types, put the missing ones at the end
if (count($SortOrder) != count($ReleaseTypes)) {
$MissingTypes = array_diff_key($ReleaseTypes, $SortOrder);
if (!empty($MissingTypes)) {
$MaxOrder = max($SortOrder);
foreach (array_keys(array_diff_key($ReleaseTypes, $SortOrder)) as $Missing) {
foreach (array_keys($MissingTypes) as $Missing) {
$SortOrder[$Missing] = ++$MaxOrder;
}
}

View File

@ -1,12 +1,7 @@
<?
header('Content-type: application/x-suggestions+json');
require('classes/ajax_start.php');
header('Content-Type: application/json; charset=utf-8');
if (empty($_GET['name'])) {
die('["",[],[],[]]');
}
$FullName = rawurldecode($_GET['name']);
$FullName = rawurldecode($_GET['query']);
$MaxKeySize = 4;
if (strtolower(substr($FullName,0,4)) == 'the ') {
@ -16,23 +11,19 @@
$Letters = strtolower(substr($FullName,0,$KeySize));
$AutoSuggest = $Cache->get('autocomplete_artist_'.$KeySize.'_'.$Letters);
if (!is_array($AutoSuggest)) {
if (!isset($DB) || !is_object($DB)) {
require(SERVER_ROOT.'/classes/mysql.class.php'); //Require the database wrapper
$DB = NEW DB_MYSQL; //Load the database wrapper
}
if (!$AutoSuggest) {
$Limit = (($KeySize === $MaxKeySize) ? 250 : 10);
$DB->query("
SELECT
a.ArtistID,
a.Name,
SUM(t.Snatched) AS Snatches
a.Name
FROM artists_group AS a
INNER JOIN torrents_artists AS ta ON ta.ArtistID=a.ArtistID
INNER JOIN torrents AS t ON t.GroupID=ta.GroupID
WHERE a.Name LIKE '".db_string(str_replace('\\','\\\\',$Letters),true)."%'
GROUP BY ta.ArtistID
ORDER BY Snatches DESC
ORDER BY t.Snatched DESC
LIMIT $Limit");
$AutoSuggest = $DB->to_array(false,MYSQLI_NUM,false);
$Cache->cache_value('autocomplete_artist_'.$KeySize.'_'.$Letters,$AutoSuggest,1800 + 7200 * ($MaxKeySize - $KeySize)); // Can't cache things for too long in case names are edited
@ -40,17 +31,16 @@
$Matched = 0;
$Suggestions = array();
$Snatches = array();
$ArtistIDs = array();
$Response = array();
$Response['query'] = $FullName;
foreach ($AutoSuggest as $Suggestion) {
list($ID,$Name, $Snatch) = $Suggestion;
if (stripos($Name,$FullName) === 0) {
$Suggestions[] = display_str($Name);
$Snatches[] = number_format($Snatch).' snatches';
$ArtistIDs[] = $ID;
list($ID, $Name) = $Suggestion;
if (stripos($Name, $FullName) === 0) {
$Response['suggestions'][] = array('value' => display_str($Name), 'data' => $ID);
if (++$Matched > 9) {
break;
}
}
}
echo json_encode(array(display_str($FullName),$Suggestions,$Snatches,$ArtistIDs));
echo json_encode($Response);

View File

@ -98,6 +98,9 @@
}
} elseif (!empty($_GET['action'])) {
switch ($_GET['action']) {
case 'autocomplete':
require('sections/artist/autocomplete.php');
break;
case 'get_post':
if (!$_GET['post'] || !is_number($_GET['post'])) {
error(0);

View File

@ -180,7 +180,7 @@
<tr id="tagfilter">
<td class="label">Tags (comma-separated):</td>
<td>
<input type="text" name="tags" size="70" value="<?=(!empty($_GET['tags']) ? display_str($_GET['tags']) : '')?>" />&nbsp;
<input type="text" id="tags" name="tags" size="70" value="<?=(!empty($_GET['tags']) ? display_str($_GET['tags']) : '')?>" />&nbsp;
<input type="radio" name="tags_type" id="tags_type0" value="0"<?Format::selected('tags_type',0,'checked')?> /><label for="tags_type0"> Any</label>&nbsp;&nbsp;
<input type="radio" name="tags_type" id="tags_type1" value="1"<?Format::selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label>
</td>

View File

@ -45,7 +45,7 @@
t.LastPostAuthorID
FROM forums_topics AS t
WHERE t.ForumID = '$ForumID'
ORDER BY t.IsSticky DESC, t.LastPostTime DESC
ORDER BY t.Ranking = 0, t.Ranking ASC, t.IsSticky DESC, t.LastPostTime DESC
LIMIT $Limit"); // Can be cached until someone makes a new post
$Forum = $DB->to_array('ID',MYSQLI_ASSOC, false);

View File

@ -12,7 +12,8 @@ function get_thread_info($ThreadID, $Return = true, $SelectiveCache = false, $Ap
t.LastPostAuthorID,
ISNULL(p.TopicID) AS NoPoll,
t.StickyPostID,
t.AuthorID as OP
t.AuthorID as OP,
t.Ranking
FROM forums_topics AS t
JOIN forums_posts AS fp ON fp.TopicID = t.ID
LEFT JOIN forums_polls AS p ON p.TopicID=t.ID

View File

@ -30,6 +30,12 @@
$TopicID = (int)$_POST['threadid'];
$Sticky = (isset($_POST['sticky'])) ? 1 : 0;
$Locked = (isset($_POST['locked'])) ? 1 : 0;
$Ranking = (int) $_POST['ranking'];
if(!$Sticky && $Ranking > 0) {
$Ranking = 0;
} elseif(0 > $Ranking) {
error("Ranking cannot be a negative value");
}
$Title = db_string($_POST['title']);
$RawTitle = $_POST['title'];
$ForumID = (int)$_POST['forumid'];
@ -131,6 +137,7 @@
$Cache->begin_transaction('thread_'.$TopicID.'_info');
$UpdateArray = array(
'IsSticky' => $Sticky,
'Ranking' => $Ranking,
'IsLocked' => $Locked,
'Title' => Format::cut_string($RawTitle, 150, 1, 0),
'ForumID' => $ForumID
@ -142,6 +149,7 @@
UPDATE forums_topics
SET
IsSticky = '$Sticky',
Ranking = '$Ranking',
IsLocked = '$Locked',
Title = '$Title',
ForumID ='$ForumID'
@ -178,14 +186,15 @@
JOIN forums_topics AS tt ON pp.TopicID=tt.ID
WHERE tt.ForumID='$OldForumID'),
t.IsLocked,
t.IsSticky
t.IsSticky,
t.Ranking
FROM forums_topics AS t
JOIN forums_posts AS p ON p.ID=t.LastPostID
LEFT JOIN users_main AS um ON um.ID=p.AuthorID
WHERE t.ForumID='$OldForumID'
ORDER BY t.LastPostID DESC
LIMIT 1");
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts, $NewLocked, $NewSticky) = $DB->next_record(MYSQLI_NUM, false);
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts, $NewLocked, $NewSticky, $NewRanking) = $DB->next_record(MYSQLI_NUM, false);
$DB->query("
UPDATE forums
@ -208,7 +217,8 @@
'LastPostTime' => $NewLastAddedTime,
'Title' => $NewLastTitle,
'IsLocked' => $NewLocked,
'IsSticky' => $NewSticky
'IsSticky' => $NewSticky,
'Ranking' => $NewRanking
);
@ -268,7 +278,8 @@
$UpdateArray = array(
'Title' => $RawTitle,
'IsLocked' => $Locked,
'IsSticky' => $Sticky
'IsSticky' => $Sticky,
'Ranking' => $Ranking
);
$Cache->begin_transaction('forums_list');
$Cache->update_row($ForumID, $UpdateArray);
@ -286,5 +297,4 @@
$Cache->delete_value('polls_'.$TopicID);
}
header('Location: forums.php?action=viewthread&threadid='.$TopicID.'&page='.$Page);
}

View File

@ -550,7 +550,13 @@
<tr>
<td class="label">Sticky</td>
<td>
<input type="checkbox" name="sticky"<? if ($ThreadInfo['IsSticky']) { echo ' checked="checked"'; } ?> tabindex="2" />
<input type="checkbox" onclick="$('#ranking_row').gtoggle();" name="sticky"<? if ($ThreadInfo['IsSticky']) { echo ' checked="checked"'; } ?> tabindex="2" />
</td>
</tr>
<tr id="ranking_row" <?=!$ThreadInfo['IsSticky'] ? 'class="hidden"' : ''?>>
<td class="label">Ranking</td>
<td>
<input type="text" name="ranking" value="<?=$ThreadInfo['Ranking']?>" tabindex="2" />
</td>
</tr>
<tr>

View File

@ -1,6 +1,6 @@
<?php
if (!check_perms('site_moderate_forums') || empty($_GET['id'])) {
if (!check_perms('site_moderate_forums') || empty($_POST['id'])) {
print
json_encode(
array(
@ -10,9 +10,9 @@
die();
}
$ID = (int) $_GET['id'];
$ID = (int) $_POST['id'];
$Notes = str_replace("<br />", "\n", $_GET['notes']);
$Notes = str_replace("<br />", "\n", $_POST['notes']);
$Notes = db_string($Notes);
$DB->query("UPDATE reports SET Notes = '$Notes' WHERE ID = '$ID'");

View File

@ -1,6 +1,6 @@
<?php
if (!check_perms('site_moderate_forums') || empty($_GET['id'])) {
if (!check_perms('site_moderate_forums') || empty($_POST['id'])) {
print
json_encode(
array(
@ -10,7 +10,7 @@
die();
}
$ID = (int)$_GET['id'];
$ID = (int)$_POST['id'];
$DB->query("SELECT ClaimerID FROM reports WHERE ID = '$ID'");
list($ClaimerID) = $DB->next_record();
if ($ClaimerID) {

View File

@ -1,6 +1,6 @@
<?php
if (!check_perms('site_moderate_forums') || empty($_GET['id']) || empty($_GET['remove'])) {
if (!check_perms('site_moderate_forums') || empty($_POST['id']) || empty($_POST['remove'])) {
print
json_encode(
array(
@ -9,7 +9,7 @@
);
die();
}
$ID = (int)$_GET['id'];
$ID = (int)$_POST['id'];
$DB->query("UPDATE reports SET ClaimerID = '0' WHERE ID = '$ID'");
print
json_encode(

View File

@ -389,7 +389,7 @@
<tr id="tagfilter">
<td class="label">Tags (comma-separated):</td>
<td>
<input type="text" name="tags" size="60" value="<?= (!empty($TagNames) ? display_str(implode(', ', $TagNames)) : '') ?>" />&nbsp;
<input type="text" name="tags" id="tags" size="60" value="<?= (!empty($TagNames) ? display_str(implode(', ', $TagNames)) : '') ?>" />&nbsp;
<input type="radio" name="tags_type" id="tags_type0" value="0"<? Format::selected('tags_type',0,'checked')?> /><label for="tags_type0"> Any</label>&nbsp;&nbsp;
<input type="radio" name="tags_type" id="tags_type1" value="1"<? Format::selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label>
</td>

View File

@ -68,7 +68,7 @@
<tr id="tagfilter">
<td class="label">Tags (comma-separated):</td>
<td class="ft_taglist">
<input type="text" name="tags" size="75" value="<? if (!empty($_GET['tags'])) { echo display_str($_GET['tags']);} ?>" />&nbsp;
<input type="text" name="tags" id="tags" size="75" value="<? if (!empty($_GET['tags'])) { echo display_str($_GET['tags']);} ?>" />&nbsp;
<input type="radio" id="rdoAll" name="anyall" value="all"<?=($_GET['anyall']!='any'?' checked="checked"':'')?> /><label for="rdoAll"> All</label>&nbsp;&nbsp;
<input type="radio" id="rdoAny" name="anyall" value="any"<?=($_GET['anyall']=='any'?' checked="checked"':'')?> /><label for="rdoAny"> Any</label>
</td>

View File

@ -0,0 +1,46 @@
<?
header('Content-Type: application/json; charset=utf-8');
$FullName = rawurldecode($_GET['query']);
$MaxKeySize = 4;
$KeySize = min($MaxKeySize,max(1,strlen($FullName)));
$Letters = strtolower(substr($FullName,0,$KeySize));
$AutoSuggest = $Cache->get('autocomplete_tags_'.$KeySize.'_'.$Letters);
if (!$AutoSuggest) {
$Limit = (($KeySize === $MaxKeySize) ? 250 : 10);
$DB->query("
SELECT
Name
FROM tags
WHERE
Name != ''
AND
Name LIKE '".db_string(str_replace('\\','\\\\',$Letters),true)."%'
AND
(Uses > 700 OR TagType = 'genre')
ORDER BY
TagType = 'genre' DESC,
Uses DESC
LIMIT $Limit");
$AutoSuggest = $DB->to_array(false,MYSQLI_NUM,false);
$Cache->cache_value('autocomplete_tags_'.$KeySize.'_'.$Letters,$AutoSuggest,1800 + 7200 * ($MaxKeySize - $KeySize)); // Can't cache things for too long in case names are edited
}
$Matched = 0;
$Suggestions = array();
$ArtistIDs = array();
$Response = array();
$Response['query'] = $FullName;
foreach ($AutoSuggest as $Suggestion) {
list($Name) = $Suggestion;
if (stripos($Name, $FullName) === 0) {
$Response['suggestions'][] = array('value' => display_str($Name));
if (++$Matched > 9) {
break;
}
}
}
echo json_encode($Response);

View File

@ -409,7 +409,7 @@ function compare($X, $Y) {
<input type="hidden" name="action" value="add_alias" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
<input type="text" name="aliasname[]" size="17" />
<input type="text" id="artist" name="aliasname[]" size="17" />
<select name="importance[]">
<option value="1">Main</option>
<option value="2">Guest</option>
@ -490,7 +490,7 @@ function compare($X, $Y) {
<input type="hidden" name="action" value="add_tag" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
<input type="text" name="tagname" size="20" />
<input type="text" name="tagname" id="tagname" size="20" />
<input type="submit" value="+" />
</form>
<br /><br />

View File

@ -381,6 +381,9 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
case 'remove_cover_art':
include(SERVER_ROOT.'/sections/torrents/remove_cover_art.php');
break;
case 'autocomplete_tags':
include(SERVER_ROOT.'/sections/torrents/autocomplete_tags.php');
break;
default:
enforce_login();

View File

@ -1,157 +1,32 @@
/*
Spent hours debugging opera, turns out they reserve the global variable autocomplete. Bitches.
*/
"use strict";
var autocomp = {
id: "",
value: "",
artistid: null,
timer: null,
input: null,
list: null,
pos: -1,
cache: [],
start: function (id) {
this.id = id;
this.cache[id] = ["",[],[],[]];
this.input = document.getElementById(id + "search");
this.list = document.getElementById(id + "complete");
listener.set(document.body,'click',function() {
autocomp.value = autocomp.input.value;
autocomp.end();
var ARTIST_AUTOCOMPLETE_URL = 'artist.php?action=autocomplete';
var TAGS_AUTOCOMPLETE_URL = 'torrents.php?action=autocomplete_tags';
$(document).ready(function() {
var url = new URL();
$('#artistsearch').autocomplete({
serviceUrl : ARTIST_AUTOCOMPLETE_URL,
onSelect : function(suggestion) {
window.location = 'artist.php?id=' + suggestion['data'];
},
});
if (url.path == 'torrents' || url.path == 'upload' || url.path == 'artist') {
$("#artist").autocomplete({
serviceUrl : ARTIST_AUTOCOMPLETE_URL
});
},
end: function () {
//this.input.value = this.value;
this.artistid = null;
this.highlight(-1);
this.list.style.visibility = 'hidden';
clearTimeout(this.timer);
},
keyup: function (e) {
clearTimeout(this.timer);
var key = (window.event) ? window.event.keyCode : e.keyCode;
switch (key) {
case 27: //esc
break;
case 8: //backspace
this.artistid = null;
this.list.style.visibility = 'hidden';
this.timer = setTimeout("autocomp.get('" + escape(this.input.value) + "');",500);
break;
case 38: //up
case 40: //down
this.highlight(key);
if (this.pos !== -1) {
this.artistid = this.list.children[this.pos].artistid;
this.input.value = this.list.children[this.pos].textContent || this.list.children[this.pos].value;
}
break;
case 13:
if (this.artistid != null) {
window.location = this.id + '.php?id='+this.artistid;
}
return 0;
default:
this.artistid = null;
this.timer = setTimeout("autocomp.get('" + escape(this.input.value) + "');",300);
return 1;
}
return 0;
},
keydown: function (e) {
switch ((window.event)?window.event.keyCode:e.keyCode) {
case 9: //tab
this.value = this.input.value;
case 27: //esc
this.end();
break;
case 38:
e.preventDefault();
break;
case 13: //enter
return 0;
}
return 1;
},
highlight: function(change) {
//No highlights on no list
if (this.list.children.length === 0) {
return;
}
//Show me the
this.list.style.visibility = 'visible';
//Remove the previous highlight
if (this.pos !== -1) {
this.list.children[this.pos].className = "";
}
//Change position
if (change === 40) {
++this.pos;
} else if (change === 38) {
--this.pos;
} else {
this.pos = change;
}
//Wrap arounds
if (this.pos >= this.list.children.length) {
this.pos = -1;
} else if (this.pos < -1) {
this.pos = this.list.children.length - 1;
}
if (this.pos !== -1) {
this.list.children[this.pos].className = "highlight";
} else {
this.artistid = null;
this.input.value = this.value;
}
},
get: function (value) {
this.pos = -1;
this.value = unescape(value);
if (typeof this.cache[this.id + value] === 'object') {
this.display(this.cache[this.id + value]);
return;
}
ajax.get(this.id + '.php?action=autocomplete&name=' + this.input.value, function(jstr) {
var data = json.decode(jstr);
autocomp.cache[autocomp.id + data[0]] = data;
autocomp.display(data);
$("#artistsimilar").autocomplete({
serviceUrl : ARTIST_AUTOCOMPLETE_URL
});
},
display: function (data) {
var i, il, li;
this.list.innerHTML = '';
for (i = 0, il = data[1].length; i < il; ++i) {
li = document.createElement('li');
li.innerHTML = data[1][i];
li.i = i;
li.artistid = data[3][i];
listener.set(li,'mouseover',function() {
autocomp.highlight(this.i);
});
listener.set(li,'click',function(e) {
var location = autocomp.id + '.php?id=' + this.artistid;
if (e.button == 0) {
window.open(location, '_self');
} else if (e.button == 1) {
var win = window.open(location, '_blank');
win.focus();
}
});
this.list.appendChild(li);
}
if (i > 0) {
this.list.style.visibility = 'visible';
} else {
this.list.style.visibility = 'hidden';
}
}
};
if (url.path == 'torrents' || url.path == 'upload' || url.path == 'collages' || url.path == 'requests' || url.path == 'top10' || (url.path == 'requests' && url.query['action'] == 'new')) {
$("#tags").autocomplete({
serviceUrl : TAGS_AUTOCOMPLETE_URL,
delimiter: ','
});
$("#tagname").autocomplete({
serviceUrl : TAGS_AUTOCOMPLETE_URL,
});
}
});

View File

@ -222,6 +222,11 @@ function AddArtistField() {
Importance.name = "importance[]";
Importance.innerHTML = '<option value="1">Main</option><option value="2">Guest</option><option value="4">Composer</option><option value="5">Conductor</option><option value="6">DJ / Compiler</option><option value="3">Remixer</option><option value="7">Producer</option>';
x.appendChild(Importance);
$(ArtistField).live('focus', function() {
$(ArtistField).autocomplete({
serviceUrl : 'artist.php?action=autocomplete'
});
});
ArtistFieldCount++;
}

View File

@ -1,14 +1,7 @@
$(document).ready(function() {
var parts = window.location.pathname.split('/');
var page = parts[parts.length - 1].split(".")[0];
var splitted = window.location.search.substr(1).split("&");
var query = {};
for (var i = 0; i < splitted.length; i++) {
var q = splitted[i].split("=");
query[q[0]] = q[1];
};
switch (page) {
var url = new URL();
var query = url.query;
switch (url.path ) {
case "forums":
if (query['action'] == "new") {
$("#newthreadform").validate();

View File

@ -0,0 +1,730 @@
/**
* Ajax Autocomplete for jQuery, version 1.2.7
* (c) 2013 Tomas Kirda
*
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
* For details, see the web site: http://www.devbridge.com/projects/autocomplete/jquery/
*
*/
/*jslint browser: true, white: true, plusplus: true */
/*global define, window, document, jQuery */
// Expose plugin as an AMD module if AMD loader is present:
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
'use strict';
var
utils = (function () {
return {
escapeRegExChars: function (value) {
return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
},
createNode: function (html) {
var div = document.createElement('div');
div.innerHTML = html;
return div.firstChild;
}
};
}()),
keys = {
ESC: 27,
TAB: 9,
RETURN: 13,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40
};
function Autocomplete(el, options) {
var noop = function () { },
that = this,
defaults = {
autoSelectFirst: false,
appendTo: 'body',
serviceUrl: null,
lookup: null,
onSelect: null,
width: 'auto',
minChars: 1,
maxHeight: 300,
deferRequestBy: 0,
params: {},
formatResult: Autocomplete.formatResult,
delimiter: null,
zIndex: 9999,
type: 'GET',
noCache: false,
onSearchStart: noop,
onSearchComplete: noop,
containerClass: 'autocomplete-suggestions',
tabDisabled: false,
dataType: 'text',
lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
},
paramName: 'query',
transformResult: function (response) {
return typeof response === 'string' ? $.parseJSON(response) : response;
}
};
// Shared variables:
that.element = el;
that.el = $(el);
that.suggestions = [];
that.badQueries = [];
that.selectedIndex = -1;
that.currentValue = that.element.value;
that.intervalId = 0;
that.cachedResponse = [];
that.onChangeInterval = null;
that.onChange = null;
that.isLocal = false;
that.suggestionsContainer = null;
that.options = $.extend({}, defaults, options);
that.classes = {
selected: 'autocomplete-selected',
suggestion: 'autocomplete-suggestion'
};
that.hint = null;
that.hintValue = '';
that.selection = null;
// Initialize and set options:
that.initialize();
that.setOptions(options);
}
Autocomplete.utils = utils;
$.Autocomplete = Autocomplete;
Autocomplete.formatResult = function (suggestion, currentValue) {
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
return suggestion.value.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
};
Autocomplete.prototype = {
killerFn: null,
initialize: function () {
var that = this,
suggestionSelector = '.' + that.classes.suggestion,
selected = that.classes.selected,
options = that.options,
container;
// Remove autocomplete attribute to prevent native suggestions:
that.element.setAttribute('autocomplete', 'off');
that.killerFn = function (e) {
if ($(e.target).closest('.' + that.options.containerClass).length === 0) {
that.killSuggestions();
that.disableKillerFn();
}
};
that.suggestionsContainer = Autocomplete.utils.createNode('<div class="' + options.containerClass + '" style="position: absolute; display: none;"></div>');
container = $(that.suggestionsContainer);
container.appendTo(options.appendTo);
// Only set width if it was provided:
if (options.width !== 'auto') {
container.width(options.width);
}
// Listen for mouse over event on suggestions list:
container.on('mouseover.autocomplete', suggestionSelector, function () {
that.activate($(this).data('index'));
});
// Deselect active element when mouse leaves suggestions container:
container.on('mouseout.autocomplete', function () {
that.selectedIndex = -1;
container.children('.' + selected).removeClass(selected);
});
// Listen for click event on suggestions list:
container.on('click.autocomplete', suggestionSelector, function () {
that.select($(this).data('index'));
});
that.fixPosition();
that.fixPositionCapture = function () {
if (that.visible) {
that.fixPosition();
}
};
$(window).on('resize', that.fixPositionCapture);
that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); });
that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); });
that.el.on('blur.autocomplete', function () { that.onBlur(); });
that.el.on('focus.autocomplete', function () { that.fixPosition(); });
that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); });
},
onBlur: function () {
this.enableKillerFn();
},
setOptions: function (suppliedOptions) {
var that = this,
options = that.options;
$.extend(options, suppliedOptions);
that.isLocal = $.isArray(options.lookup);
if (that.isLocal) {
options.lookup = that.verifySuggestionsFormat(options.lookup);
}
// Adjust height, width and z-index:
$(that.suggestionsContainer).css({
'max-height': options.maxHeight + 'px',
'width': options.width + 'px',
'z-index': options.zIndex
});
},
clearCache: function () {
this.cachedResponse = [];
this.badQueries = [];
},
clear: function () {
this.clearCache();
this.currentValue = '';
this.suggestions = [];
},
disable: function () {
this.disabled = true;
},
enable: function () {
this.disabled = false;
},
fixPosition: function () {
var that = this,
offset;
// Don't adjsut position if custom container has been specified:
if (that.options.appendTo !== 'body') {
return;
}
offset = that.el.offset();
$(that.suggestionsContainer).css({
top: (offset.top + that.el.outerHeight()) + 'px',
left: offset.left + 'px'
});
},
enableKillerFn: function () {
var that = this;
$(document).on('click.autocomplete', that.killerFn);
},
disableKillerFn: function () {
var that = this;
$(document).off('click.autocomplete', that.killerFn);
},
killSuggestions: function () {
var that = this;
that.stopKillSuggestions();
that.intervalId = window.setInterval(function () {
that.hide();
that.stopKillSuggestions();
}, 300);
},
stopKillSuggestions: function () {
window.clearInterval(this.intervalId);
},
isCursorAtEnd: function () {
var that = this,
valLength = that.el.val().length,
selectionStart = that.element.selectionStart,
range;
if (typeof selectionStart === 'number') {
return selectionStart === valLength;
}
if (document.selection) {
range = document.selection.createRange();
range.moveStart('character', -valLength);
return valLength === range.text.length;
}
return true;
},
onKeyPress: function (e) {
var that = this;
// If suggestions are hidden and user presses arrow down, display suggestions:
if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) {
that.suggest();
return;
}
if (that.disabled || !that.visible) {
return;
}
switch (e.which) {
case keys.ESC:
that.el.val(that.currentValue);
that.hide();
break;
case keys.RIGHT:
if (that.hint && that.options.onHint && that.isCursorAtEnd()) {
that.selectHint();
break;
}
return;
case keys.TAB:
case keys.RETURN:
if (e.which === keys.TAB && that.hint) {
that.selectHint();
return;
}
if (that.selectedIndex === -1) {
that.hide();
return;
}
that.select(that.selectedIndex);
if (e.which === keys.TAB && that.options.tabDisabled === false) {
return;
}
break;
case keys.UP:
that.moveUp();
break;
case keys.DOWN:
that.moveDown();
break;
default:
return;
}
// Cancel event if function did not return:
e.stopImmediatePropagation();
e.preventDefault();
},
onKeyUp: function (e) {
var that = this;
if (that.disabled) {
return;
}
switch (e.which) {
case keys.UP:
case keys.DOWN:
return;
}
clearInterval(that.onChangeInterval);
if (that.currentValue !== that.el.val()) {
that.findBestHint();
if (that.options.deferRequestBy > 0) {
// Defer lookup in case when value changes very quickly:
that.onChangeInterval = setInterval(function () {
that.onValueChange();
}, that.options.deferRequestBy);
} else {
that.onValueChange();
}
}
},
onValueChange: function () {
var that = this,
q;
if (that.selection) {
that.selection = null;
(that.options.onInvalidateSelection || $.noop)();
}
clearInterval(that.onChangeInterval);
that.currentValue = that.el.val();
q = that.getQuery(that.currentValue);
that.selectedIndex = -1;
if (q.length < that.options.minChars) {
that.hide();
} else {
that.getSuggestions(q);
}
},
getQuery: function (value) {
var delimiter = this.options.delimiter,
parts;
if (!delimiter) {
return $.trim(value);
}
parts = value.split(delimiter);
return $.trim(parts[parts.length - 1]);
},
getSuggestionsLocal: function (query) {
var that = this,
queryLowerCase = query.toLowerCase(),
filter = that.options.lookupFilter;
return {
suggestions: $.grep(that.options.lookup, function (suggestion) {
return filter(suggestion, query, queryLowerCase);
})
};
},
getSuggestions: function (q) {
var response,
that = this,
options = that.options,
serviceUrl = options.serviceUrl;
response = that.isLocal ? that.getSuggestionsLocal(q) : that.cachedResponse[q];
if (response && $.isArray(response.suggestions)) {
that.suggestions = response.suggestions;
that.suggest();
} else if (!that.isBadQuery(q)) {
options.params[options.paramName] = q;
if (options.onSearchStart.call(that.element, options.params) === false) {
return;
}
if ($.isFunction(options.serviceUrl)) {
serviceUrl = options.serviceUrl.call(that.element, q);
}
$.ajax({
url: serviceUrl,
data: options.ignoreParams ? null : options.params,
type: options.type,
dataType: options.dataType
}).done(function (data) {
that.processResponse(data, q);
options.onSearchComplete.call(that.element, q);
});
}
},
isBadQuery: function (q) {
var badQueries = this.badQueries,
i = badQueries.length;
while (i--) {
if (q.indexOf(badQueries[i]) === 0) {
return true;
}
}
return false;
},
hide: function () {
var that = this;
that.visible = false;
that.selectedIndex = -1;
$(that.suggestionsContainer).hide();
that.signalHint(null);
},
suggest: function () {
if (this.suggestions.length === 0) {
this.hide();
return;
}
var that = this,
formatResult = that.options.formatResult,
value = that.getQuery(that.currentValue),
className = that.classes.suggestion,
classSelected = that.classes.selected,
container = $(that.suggestionsContainer),
html = '',
width;
// Build suggestions inner HTML:
$.each(that.suggestions, function (i, suggestion) {
html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value) + '</div>';
});
// If width is auto, adjust width before displaying suggestions,
// because if instance was created before input had width, it will be zero.
// Also it adjusts if input width has changed.
// -2px to account for suggestions border.
if (that.options.width === 'auto') {
width = that.el.outerWidth() - 2;
container.width(width > 0 ? width : 300);
}
container.html(html).show();
that.visible = true;
// Select first value by default:
if (that.options.autoSelectFirst) {
that.selectedIndex = 0;
container.children().first().addClass(classSelected);
}
that.findBestHint();
},
findBestHint: function () {
var that = this,
value = that.el.val().toLowerCase(),
bestMatch = null;
if (!value) {
return;
}
$.each(that.suggestions, function (i, suggestion) {
var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0;
if (foundMatch) {
bestMatch = suggestion;
}
return !foundMatch;
});
that.signalHint(bestMatch);
},
signalHint: function (suggestion) {
var hintValue = '',
that = this;
if (suggestion) {
hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
}
if (that.hintValue !== hintValue) {
that.hintValue = hintValue;
that.hint = suggestion;
(this.options.onHint || $.noop)(hintValue);
}
},
verifySuggestionsFormat: function (suggestions) {
// If suggestions is string array, convert them to supported format:
if (suggestions.length && typeof suggestions[0] === 'string') {
return $.map(suggestions, function (value) {
return { value: value, data: null };
});
}
return suggestions;
},
processResponse: function (response, originalQuery) {
var that = this,
options = that.options,
result = options.transformResult(response, originalQuery);
result.suggestions = that.verifySuggestionsFormat(result.suggestions);
// Cache results if cache is not disabled:
if (!options.noCache) {
that.cachedResponse[result[options.paramName]] = result;
if (result.suggestions.length === 0) {
that.badQueries.push(result[options.paramName]);
}
}
// Display suggestions only if returned query matches current value:
if (originalQuery === that.getQuery(that.currentValue)) {
that.suggestions = result.suggestions;
that.suggest();
}
},
activate: function (index) {
var that = this,
activeItem,
selected = that.classes.selected,
container = $(that.suggestionsContainer),
children = container.children();
container.children('.' + selected).removeClass(selected);
that.selectedIndex = index;
if (that.selectedIndex !== -1 && children.length > that.selectedIndex) {
activeItem = children.get(that.selectedIndex);
$(activeItem).addClass(selected);
return activeItem;
}
return null;
},
selectHint: function () {
var that = this,
i = $.inArray(that.hint, that.suggestions);
that.select(i);
},
select: function (i) {
var that = this;
that.hide();
that.onSelect(i);
},
moveUp: function () {
var that = this;
if (that.selectedIndex === -1) {
return;
}
if (that.selectedIndex === 0) {
$(that.suggestionsContainer).children().first().removeClass(that.classes.selected);
that.selectedIndex = -1;
that.el.val(that.currentValue);
that.findBestHint();
return;
}
that.adjustScroll(that.selectedIndex - 1);
},
moveDown: function () {
var that = this;
if (that.selectedIndex === (that.suggestions.length - 1)) {
return;
}
that.adjustScroll(that.selectedIndex + 1);
},
adjustScroll: function (index) {
var that = this,
activeItem = that.activate(index),
offsetTop,
upperBound,
lowerBound,
heightDelta = 25;
if (!activeItem) {
return;
}
offsetTop = activeItem.offsetTop;
upperBound = $(that.suggestionsContainer).scrollTop();
lowerBound = upperBound + that.options.maxHeight - heightDelta;
if (offsetTop < upperBound) {
$(that.suggestionsContainer).scrollTop(offsetTop);
} else if (offsetTop > lowerBound) {
$(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta);
}
that.el.val(that.getValue(that.suggestions[index].value));
that.signalHint(null);
},
onSelect: function (index) {
var that = this,
onSelectCallback = that.options.onSelect,
suggestion = that.suggestions[index];
that.currentValue = that.getValue(suggestion.value);
that.el.val(that.currentValue);
that.signalHint(null);
that.suggestions = [];
that.selection = suggestion;
if ($.isFunction(onSelectCallback)) {
onSelectCallback.call(that.element, suggestion);
}
},
getValue: function (value) {
var that = this,
delimiter = that.options.delimiter,
currentValue,
parts;
if (!delimiter) {
return value;
}
currentValue = that.currentValue;
parts = currentValue.split(delimiter);
if (parts.length === 1) {
return value;
}
return currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + value;
},
dispose: function () {
var that = this;
that.el.off('.autocomplete').removeData('autocomplete');
that.disableKillerFn();
$(window).off('resize', that.fixPositionCapture);
$(that.suggestionsContainer).remove();
}
};
// Create chainable jQuery plugin:
$.fn.autocomplete = function (options, args) {
var dataKey = 'autocomplete';
// If function invoked without argument return
// instance of the first matched element:
if (arguments.length === 0) {
return this.first().data(dataKey);
}
return this.each(function () {
var inputElement = $(this),
instance = inputElement.data(dataKey);
if (typeof options === 'string') {
if (instance && typeof instance[options] === 'function') {
instance[options](args);
}
} else {
// If instance already exists, destroy it:
if (instance && instance.dispose) {
instance.dispose();
}
instance = new Autocomplete(this, options);
inputElement.data(dataKey, instance);
}
});
};
}));

View File

@ -11,7 +11,10 @@ function toggleNotes(id) {
function saveNotes(id) {
var notes = $('#notes_' + id).raw().value;
notes = notes.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '<br />');
ajax.get('reports.php?action=add_notes&id=' + id + '&notes=' + notes, function (response) {
var post = new Array();
post['id'] = id;
post['notes'] = notes;
ajax.post('reports.php?action=add_notes', post, function (response) {
if (JSON.parse(response)['status'] != 'success') {
alert("Error, could not save notes");
}
@ -20,7 +23,9 @@ function saveNotes(id) {
}
function claim(id) {
ajax.get('reports.php?action=claim&id=' + id, function (response) {
var post = new Array();
post['id'] = id;
ajax.post('reports.php?action=claim', post, function (response) {
var json = JSON.parse(response);
if (json['status'] == 'failure') {
alert("Error, could not claim.");
@ -36,7 +41,10 @@ function claim(id) {
}
function unClaim(id) {
ajax.get('reports.php?action=unclaim&remove=1&id=' + id, function (response) {
var post = new Array();
post['id'] = id;
post['remove'] = '1';
ajax.post('reports.php?action=unclaim', post, function (response) {
var json = JSON.parse(response);
if (json['status'] == 'success') {
$('#claimed_' + id).raw().innerHTML = '<a href="#" id="claim_' + id + '" onclick="claim(' + id + '); return false;" class="brackets">Claim</a>';

View File

@ -194,6 +194,22 @@ var util = function (selector, context) {
return new util.fn.init(selector, context);
}
function URL() {
var path = window.location.pathname.split('/');
var path = path[path.length - 1].split(".")[0];
var splitted = window.location.search.substr(1).split("&");
var query = {};
for (var i = 0; i < splitted.length; i++) {
var q = splitted[i].split("=");
query[q[0]] = q[1];
};
var response = new Array();
response['path'] = path;
response['query'] = query;
return response;
}
jQuery.extend(jQuery.prototype, {
results: function () {
return this.size();

View File

@ -214,7 +214,7 @@ function AddArtistField() {
}
var ArtistField = document.createElement("input");
ArtistField.type = "text";
ArtistField.id = "artist";
ArtistField.id = "artist_" + ArtistCount;
ArtistField.name = "artists[]";
ArtistField.size = 45;
@ -223,7 +223,7 @@ function AddArtistField() {
ImportanceField.name = "importance[]";
ImportanceField.options[0] = new Option("Main", "1");
ImportanceField.options[1] = new Option("Guest", "2");
ImportanceField.options[2] = new Option("Composer", "4");
ImportanceField.options[2] = new Option("Composer ", "4");
ImportanceField.options[3] = new Option("Conductor", "5");
ImportanceField.options[4] = new Option("DJ / Compiler", "6");
ImportanceField.options[5] = new Option("Remixer", "3");
@ -234,6 +234,13 @@ function AddArtistField() {
x.appendChild(ArtistField);
x.appendChild(document.createTextNode('\n'));
x.appendChild(ImportanceField);
$(ArtistField).live('focus', function() {
$(ArtistField).autocomplete({
serviceUrl : 'artist.php?action=autocomplete'
});
});
ArtistCount++;
}

View File

@ -828,3 +828,4 @@ ul .invitetree {
.edit_changelog textarea {
width: 600px;
}
.autocomplete-suggestions { background: #F1E6CC; }

View File

@ -2012,3 +2012,7 @@ tr.torrent .bookmark > a:after { content:""; }
.edit_changelog textarea {
width: 600px;
}
.autocomplete-suggestions { background: #3f3f3f; }
.autocomplete-suggestion { padding: 2px 5px; white-space: nowrap; overflow: hidden; cursor: pointer; color: #ffffff; }

View File

@ -499,4 +499,9 @@ tr.torrent .bookmark>a:after {
}
.option_group:last-child {
margin-bottom: 0px;
}
}
.autocomplete-suggestions { margin-top: 5px; border: 1px solid #999; background: #FFF; overflow: auto; }
.autocomplete-suggestion { padding: 2px 5px; white-space: nowrap; overflow: hidden; cursor: pointer; }
.autocomplete-selected { background: #F0F0F0; }
.autocomplete-suggestions strong { font-weight: normal; color: #3399FF; }

View File

@ -922,3 +922,4 @@ tr.torrent .bookmark > a:after { color:#999; }
.edit_changelog textarea {
width: 600px;
}
.autocomplete-suggestions { background: #222; }

View File

@ -562,3 +562,5 @@ tr.torrent .bookmark > a:after { content: ""; }
.edit_changelog textarea {
width: 600px;
}
.autocomplete-suggestions { background: #3f3f3f; }
.autocomplete-selected { background: #666; }

View File

@ -1083,3 +1083,6 @@ tr.torrent .bookmark > a:after {
.edit_changelog textarea {
width: 600px;
}
.autocomplete-suggestions { background: #111; }
.autocomplete-selected { background: #444; }