diff --git a/classes/class_reports.php b/classes/class_reports.php new file mode 100644 index 00000000..9d4d2b8c --- /dev/null +++ b/classes/class_reports.php @@ -0,0 +1,27 @@ + - * eg: + * e.g.: * pop (2) * rock (2) * hip.hop (1) @@ -24,8 +24,7 @@ * Each time a new Tags object is instantiated, the tag list is merged with the * overall total amount of tags to provide the top tags. Merging is optional. */ -class Tags -{ +class Tags { /** * Collects all tags processed by the Tags Class * @static @@ -124,12 +123,16 @@ public static function sorted() { /** * Formats tags * @param string $Link Link to a taglist page + * @param string $ArtistName Restrict tag search by this artist * @return string List of tag links */ - public function format($Link = 'torrents.php?taglist=') { + public function format($Link = 'torrents.php?taglist=', $ArtistName = '') { + if (!empty($ArtistName)) { + $ArtistName = "&artistname=" . urlencode($ArtistName) . "&action=advanced&searchsubmit=1"; + } foreach ($this->Tags as $Tag) { if (empty($this->TagLink[$Tag])) { - $this->TagLink[$Tag] = '' . $Tag . ''; + $this->TagLink[$Tag] = '' . $Tag . ''; } } return implode(', ', $this->TagLink); @@ -139,13 +142,17 @@ public function format($Link = 'torrents.php?taglist=') { * Format a list of top tags * @param int $Max Max number of items to get */ - public static function format_top($Max = 5, $Link = 'torrents.php?taglist=') { + public static function format_top($Max = 5, $Link = 'torrents.php?taglist=', $ArtistName = '') { if (empty(self::$All)) { ?>
  • No torrent tags
  • - $Total) { ?> -
  • ()
  • - () + NewTorrent && check_perms('users_mod')) { ?> - Log/Cue: + Log/cue: />
    />
    diff --git a/classes/class_useragent.php b/classes/class_useragent.php index d7bf01a6..ee889878 100644 --- a/classes/class_useragent.php +++ b/classes/class_useragent.php @@ -52,7 +52,11 @@ class USER_AGENT { 'android' => 'Android', 'palm' => 'Palm', 'mot-razr' => 'Motorola Razr', + 'tablet PC' => 'Windows RT', + 'ARM; Trident' => 'Windows RT', //Windows + 'Windows NT 6.2' => 'Windows 8', + 'Windows 8' => 'Windows 8', 'Windows NT 6.1' => 'Windows 7', 'Windows 7' => 'Windows 7', 'Windows NT 6.0' => 'Windows Vista', @@ -110,14 +114,12 @@ public function operating_system(&$UserAgentString) { if (empty($UserAgentString)) { return 'Hidden'; } - $Return = 'Unknown'; foreach ($this->OperatingSystems as $String => $OperatingSystem) { if (stripos($UserAgentString, $String) !== false) { - $Return = $OperatingSystem; - break; + return $OperatingSystem; } } - return $Return; + return 'Unknown'; } public function mobile(&$UserAgentString) { diff --git a/classes/class_view.php b/classes/class_view.php index 1208d40a..15086c6d 100644 --- a/classes/class_view.php +++ b/classes/class_view.php @@ -1,6 +1,5 @@ */ - public static function parse ($TemplateFile, array $Variables = null, $Buffer = false) - { + public static function parse ($TemplateFile, array $Variables = null, $Buffer = false) { $Template = self::IncludePath . $TemplateFile; if (file_exists($Template)) { extract($Variables); diff --git a/classes/class_wiki.php b/classes/class_wiki.php index c15a098e..45ad72f4 100644 --- a/classes/class_wiki.php +++ b/classes/class_wiki.php @@ -44,14 +44,15 @@ function revision_history() { global $DB; $BaseURL = $this->BaseURL; - $DB->query("SELECT + $DB->query(" + SELECT RevisionID, Summary, Time, UserID - FROM ".$this->Table." AS wiki - WHERE wiki.PageID = ".$this->PageID." - ORDER BY RevisionID DESC"); + FROM ".$this->Table." AS wiki + WHERE wiki.PageID = ".$this->PageID." + ORDER BY RevisionID DESC"); //----------------------------------------------- ?> @@ -63,11 +64,11 @@ function revision_history() { next_record()) { - $Row = ($Row == 'a') ? 'b' : 'a'; + $Row = (($Row == 'a') ? 'b' : 'a'); //------------------------------------------------------ ?> - @@ -617,7 +617,7 @@ function compare($X, $Y) {
    Tags
    @@ -967,7 +967,7 @@ function require(file, callback) {
    - #$RevisionID" ?> + #$RevisionID" ?> diff --git a/design/views/generic/reply/quickreply.php b/design/views/generic/reply/quickreply.php index 79d1ded2..10175c94 100644 --- a/design/views/generic/reply/quickreply.php +++ b/design/views/generic/reply/quickreply.php @@ -23,8 +23,7 @@ * Globals are required as this template is included within a * function scope. */ - global $LoggedUser, $HeavyInfo, $UserSubscriptions, $ThreadInfo, - $ForumsDoublePost; + global $LoggedUser, $HeavyInfo, $UserSubscriptions, $ThreadInfo, $ForumsDoublePost; if ($LoggedUser['DisablePosting']) { return; @@ -68,8 +67,8 @@
    -
    #XXXXXX +
    +
    #XXXXXX by Just now
    diff --git a/sections/ajax/request.php b/sections/ajax/request.php index 7d524499..982b54f7 100644 --- a/sections/ajax/request.php +++ b/sections/ajax/request.php @@ -27,8 +27,8 @@ json_die("failure"); } -list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $ReleaseType, - $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled) = $Request; +list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $RecordLabel, $ReleaseType, + $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled, $GroupID, $OCLC) = $Request; //Convenience variables $IsFilled = !empty($TorrentID); @@ -46,35 +46,11 @@ $ArtistName = Artists::display_artists($ArtistForm, false, true); $ArtistLink = Artists::display_artists($ArtistForm, true, true); - if ($IsFilled) { - $DisplayLink = $ArtistLink."".$Title." [$Year]"; - } else { - $DisplayLink = $ArtistLink.$Title." [$Year]"; - } - $FullName = $ArtistName.$Title." [$Year]"; - - if ($BitrateList != '') { - $BitrateString = implode(', ', explode('|', $BitrateList)); - $FormatString = implode(', ', explode('|', $FormatList)); - $MediaString = implode(', ', explode('|', $MediaList)); - } else { - $BitrateString = 'Unknown, please read the description.'; - $FormatString = 'Unknown, please read the description.'; - $MediaString = 'Unknown, please read the description.'; - } - if (empty($ReleaseType)) { $ReleaseName = 'Unknown'; } else { $ReleaseName = $ReleaseTypes[$ReleaseType]; } - -} elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') { - $FullName = $Title." [$Year]"; - $DisplayLink = $Title." [$Year]"; -} else { - $FullName = $Title; - $DisplayLink = $Title; } //Votes time @@ -87,18 +63,18 @@ if ($CategoryName == "Music") { $JsonMusicInfo = array( /*'composers' => $ArtistForm[4] != null ? $ArtistForm[4] : array(), - 'dj' => $ArtistForm[6] != null ? $ArtistForm[6] : array(), - 'artists' => $ArtistForm[1] != null ? $ArtistForm[1] : array(), - 'with' => $ArtistForm[2] != null ? $ArtistForm[2] : array(), + 'dj' => $ArtistForm[6] != null ? $ArtistForm[6] : array(), + 'artists' => $ArtistForm[1] != null ? $ArtistForm[1] : array(), + 'with' => $ArtistForm[2] != null ? $ArtistForm[2] : array(), 'conductor' => $ArtistForm[5] != null ? $ArtistForm[5] : array(), 'remixedBy' => $ArtistForm[3] != null ? $ArtistForm[3] : array()*/ 'composers' => $ArtistForm[4] == null ? array() : pullmediainfo($ArtistForm[4]), - 'dj' => $ArtistForm[6] == null ? array() : pullmediainfo($ArtistForm[6]), - 'artists' => $ArtistForm[1] == null ? array() : pullmediainfo($ArtistForm[1]), - 'with' => $ArtistForm[2] == null ? array() : pullmediainfo($ArtistForm[2]), + 'dj' => $ArtistForm[6] == null ? array() : pullmediainfo($ArtistForm[6]), + 'artists' => $ArtistForm[1] == null ? array() : pullmediainfo($ArtistForm[1]), + 'with' => $ArtistForm[2] == null ? array() : pullmediainfo($ArtistForm[2]), 'conductor' => $ArtistForm[5] == null ? array() : pullmediainfo($ArtistForm[5]), 'remixedBy' => $ArtistForm[3] == null ? array() : pullmediainfo($ArtistForm[3]), - 'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7]) + 'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7]) ); } else { $JsonMusicInfo = new stdClass; //json_encodes into an empty object: {} @@ -118,19 +94,19 @@ $Results = $Cache->get_value('request_comments_'.$RequestID); if ($Results === false) { - $DB->query("SELECT - COUNT(c.ID) - FROM requests_comments as c - WHERE c.RequestID = '$RequestID'"); + $DB->query(" + SELECT COUNT(c.ID) + FROM requests_comments as c + WHERE c.RequestID = '$RequestID'"); list($Results) = $DB->next_record(); $Cache->cache_value('request_comments_'.$RequestID, $Results, 0); } -list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$Results); +list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE, $Results); -//Get the cache catalogue +// Get the cache catalogue $CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE); -$CatalogueLimit=$CatalogueID*THREAD_CATALOGUE . ', ' . THREAD_CATALOGUE; +$CatalogueLimit = $CatalogueID * THREAD_CATALOGUE . ', ' . THREAD_CATALOGUE; //---------- Get some data to start processing @@ -156,7 +132,7 @@ } //This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue -$Thread = array_slice($Catalogue,((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) % THREAD_CATALOGUE),TORRENT_COMMENTS_PER_PAGE,true); +$Thread = array_slice($Catalogue, ((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) % THREAD_CATALOGUE), TORRENT_COMMENTS_PER_PAGE, true); $JsonRequestComments = array(); foreach ($Thread as $Key => $Post) { @@ -209,10 +185,10 @@ 'catalogueNumber' => $CatalogueNumber, 'releaseType' => (int) $ReleaseType, 'releaseName' => $ReleaseName, - 'bitrateList' => $BitrateList, - 'formatList' => $FormatList, - 'mediaList' => $MediaList, - 'logCue' => $LogCue, + 'bitrateList' => preg_split('/\|/', $BitrateList, NULL, PREG_SPLIT_NO_EMPTY), + 'formatList' => preg_split('/\|/', $FormatList, NULL, PREG_SPLIT_NO_EMPTY), + 'mediaList' => preg_split('/\|/', $MediaList, NULL, PREG_SPLIT_NO_EMPTY), + 'logCue' => html_entity_decode($LogCue), 'isFilled' => $IsFilled, 'fillerId' => (int) $FillerID, 'fillerName' => $FillerName, @@ -221,7 +197,9 @@ 'tags' => $JsonTags, 'comments' => $JsonRequestComments, 'commentPage' => (int) $Page, - 'commentPages' => (int) ceil($Results / TORRENT_COMMENTS_PER_PAGE) + 'commentPages' => (int) ceil($Results / TORRENT_COMMENTS_PER_PAGE), + 'recordLabel' => $RecordLabel, + 'oclc' => $OCLC )); ?> diff --git a/sections/artist/artist.php b/sections/artist/artist.php index a449c074..6f1ed04a 100644 --- a/sections/artist/artist.php +++ b/sections/artist/artist.php @@ -402,7 +402,7 @@ function compare($X, $Y) { echo " Bookmark"; } ?> -
    format()?>
    +
    format('torrents.php?taglist=', $Name)?>
    -
    # +
    # - Quote diff --git a/sections/artist/concerts.php b/sections/artist/concerts.php index 057b6154..db9c798e 100644 --- a/sections/artist/concerts.php +++ b/sections/artist/concerts.php @@ -40,13 +40,13 @@ function make_concert_link($Event) { return; } $Date = get_date_title($Event['startDate']); - $ConcertTitle = $Date . " - " . $Event['venue']['name'] . " at " . + $ConcertTitle = $Date . ' - ' . $Event['venue']['name'] . ' at ' . $Event['venue']['location']['city'] . ', ' . $Event['venue']['location']['country']; - $Concert = "" . $ConcertTitle . ""; + $Concert = "$ConcertTitle"; ?> diff --git a/sections/collages/browse.php b/sections/collages/browse.php index 87ae268a..61be33c8 100644 --- a/sections/collages/browse.php +++ b/sections/collages/browse.php @@ -318,6 +318,4 @@
    - + diff --git a/sections/forums/newthread.php b/sections/forums/newthread.php index db4efb51..9b9ab01c 100644 --- a/sections/forums/newthread.php +++ b/sections/forums/newthread.php @@ -22,7 +22,7 @@ if (!check_forumperm($ForumID, 'Write') || !check_forumperm($ForumID, 'Create')) { error(403); } -View::show_header('Forums > '.$Forum['Name'].' > New Topic','comments,bbcode'); +View::show_header('Forums > '.$Forum['Name'].' > New Topic','comments,bbcode,jquery,jquery.validate,form_validate'); ?>

    Forums > > New Topic

    @@ -77,18 +77,18 @@
    -
    + - + - + @@ -111,6 +111,7 @@ function AddAnswerField() { var AnswerField = document.createElement("input"); AnswerField.type = "text"; AnswerField.id = "answer_"+AnswerCount; + AnswerField.className = "required"; AnswerField.name = "answers[]"; AnswerField.style.width = "90%"; @@ -140,12 +141,12 @@ function RemoveAnswerField() { - + @@ -159,7 +160,7 @@ function RemoveAnswerField() {
    - +
    diff --git a/sections/forums/search.php b/sections/forums/search.php index 03d26fb5..9b462cfc 100644 --- a/sections/forums/search.php +++ b/sections/forums/search.php @@ -6,7 +6,7 @@ include(SERVER_ROOT.'/classes/class_text.php'); $Text = new TEXT; -list($Page,$Limit) = Format::page_limit(POSTS_PER_PAGE); +list($Page, $Limit) = Format::page_limit(POSTS_PER_PAGE); if ($LoggedUser['CustomForums']) { unset($LoggedUser['CustomForums']['']); @@ -70,11 +70,11 @@ if (!empty($RestrictedForums)) { $SQL .= " AND f.ID NOT IN ('$RestrictedForums')"; } - $SQL .= ")"; + $SQL .= ')'; if (!empty($PermittedForums)) { $SQL .= " OR f.ID IN ('$PermittedForums')"; } - $SQL .= ")"; + $SQL .= ')'; $DB->query($SQL); if (list($Title) = $DB->next_record()) { $Title = " > $Title"; @@ -86,10 +86,12 @@ } // Let's hope we got some results - start printing out the content. -View::show_header('Forums > Search', 'bbcode'); +View::show_header('Forums > Search', 'bbcode,jquery,forum_search'); ?>
    -

    Forums > Search

    +
    +

    Forums > Search

    +
    Title:
    Body:
    @@ -116,11 +118,11 @@
    - - + @@ -152,7 +158,7 @@ - + record_count() == 0) { ?> diff --git a/sections/forums/thread.php b/sections/forums/thread.php index 97151174..cd6dee46 100644 --- a/sections/forums/thread.php +++ b/sections/forums/thread.php @@ -183,6 +183,8 @@

    Search this thread:

    + +
    + + Check all +
    - /> + />
    Forum Time
    @@ -194,8 +196,6 @@ diff --git a/sections/inbox/compose.php b/sections/inbox/compose.php index 36ab8b25..a1e1529f 100644 --- a/sections/inbox/compose.php +++ b/sections/inbox/compose.php @@ -21,7 +21,7 @@ if (!$Username) { error(404); } -View::show_header('Compose', 'inbox,bbcode'); +View::show_header('Compose', 'inbox,bbcode,jquery,jquery.validate,form_validate'); ?>
    @@ -34,9 +34,9 @@

    Subject

    -
    +

    Body

    - +
    diff --git a/sections/inbox/conversation.php b/sections/inbox/conversation.php index ce36af97..f6d88e86 100644 --- a/sections/inbox/conversation.php +++ b/sections/inbox/conversation.php @@ -61,7 +61,7 @@ $Cache->decrement('inbox_new_'.$UserID); } -View::show_header('View conversation '.$Subject, 'comments,inbox,bbcode'); +View::show_header('View conversation '.$Subject, 'comments,inbox,bbcode,jquery,jquery.validate,form_validate'); // Get messages $DB->query("SELECT SentDate, SenderID, Body, ID FROM pm_messages AS m WHERE ConvID='$ConvID' ORDER BY ID"); @@ -102,7 +102,7 @@ -
    +
    diff --git a/sections/reports/report.php b/sections/reports/report.php index b3d4e581..c1333671 100644 --- a/sections/reports/report.php +++ b/sections/reports/report.php @@ -101,7 +101,7 @@ break; } -View::show_header('Report a '.$Type['title'],'bbcode'); +View::show_header('Report a '.$Type['title'],'bbcode,jquery,jquery.validate,form_validate'); ?>
    @@ -150,7 +150,7 @@

    It will greatly increase the turnover rate of the updates if you can fill in as much of the following details as possible.

    - + @@ -159,7 +159,7 @@
    @@ -179,7 +179,7 @@
    Search for:
    - -
    Year (required) - +
    Comment - +
    @@ -275,12 +275,12 @@ ?>

    Reason

    - + -

    +

    diff --git a/sections/reports/reports.php b/sections/reports/reports.php index 292f2ee9..c8ed4e17 100644 --- a/sections/reports/reports.php +++ b/sections/reports/reports.php @@ -45,7 +45,8 @@ } -$Reports = $DB->query("SELECT SQL_CALC_FOUND_ROWS +$Reports = $DB->query(" + SELECT SQL_CALC_FOUND_ROWS r.ID, r.UserID, um.Username, @@ -58,10 +59,10 @@ r.Notes, r.ResolverID FROM reports AS r - JOIN users_main AS um ON r.UserID=um.ID - WHERE " . $Where . " - ORDER BY ReportedTime - DESC LIMIT " . $Limit); + JOIN users_main AS um ON r.UserID=um.ID + WHERE $Where + ORDER BY ReportedTime DESC + LIMIT $Limit"); // Number of results (for pagination) $DB->query('SELECT FOUND_ROWS()'); @@ -75,7 +76,6 @@

    Active Reports

    - - +
    - +
    diff --git a/sections/reportsv2/ajax_new_report.php b/sections/reportsv2/ajax_new_report.php index 6d3b2f77..75f65fbe 100644 --- a/sections/reportsv2/ajax_new_report.php +++ b/sections/reportsv2/ajax_new_report.php @@ -105,10 +105,11 @@ query("UPDATE reportsv2 - SET Status='InProgress', - ResolverID=".$LoggedUser['ID']." - WHERE ID=".$ReportID); + $DB->query(" + UPDATE reportsv2 + SET Status='InProgress', + ResolverID=".$LoggedUser['ID']." + WHERE ID=".$ReportID); if (array_key_exists($Type, $Types[$CategoryID])) { $ReportType = $Types[$CategoryID][$Type]; @@ -119,23 +120,25 @@ $Type = 'other'; $ReportType = $Types['master']['other']; } + $RemasterDisplayString = Reports::format_reports_remaster_info($Remastered, $RemasterTitle, $RemasterYear); + if ($ArtistID == 0 && empty($ArtistName)) { - $RawName = $GroupName.($Year ? " ($Year)" : "").($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : "").($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; - $LinkName = "$GroupName".($Year ? " ($Year)" : "")." ".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : "").($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")." ".($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; - $BBName = "[url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."[/url] ".($HasCue ? " (Cue)" : '').($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; + $RawName = $GroupName.($Year ? " ($Year)" : '').($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '') . $RemasterDisplayString . ($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $LinkName = "$GroupName".($Year ? " ($Year)" : '')." ".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '') . $RemasterDisplayString . ' '.($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $BBName = "[url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]{$RemasterDisplayString}[/url] ".($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; } elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') { - $RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; - $LinkName = "Various Artists - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")." ".($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; - $BBName = "Various Artists - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."[/url] ".($HasCue ? " (Cue)" : '').($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; + $RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]$RemasterDisplayString" . ($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $LinkName = "Various Artists - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]$RemasterDisplayString ".($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $BBName = "Various Artists - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]{$RemasterDisplayString}[/url] ".($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; } else { - $RawName = "$ArtistName - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; - $LinkName = "$ArtistName - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")." ".($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; - $BBName = "[url=artist.php?id=$ArtistID]".$ArtistName."[/url] - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."[/url] ".($HasCue ? " (Cue)" : '').($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; + $RawName = "$ArtistName - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]$RemasterDisplayString" . ($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $LinkName = "$ArtistName - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]$RemasterDisplayString ".($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $BBName = "[url=artist.php?id=$ArtistID]".$ArtistName."[/url] - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]{$RemasterDisplayString}[/url] ".($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; } ?>
    - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : '').' '.($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; + $ExtraLinkName = "$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]$ExtraRemasterDisplayString " . ($ExtraHasLog == '1' ? " (Log: {$ExtraLogScore}%)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; } elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') { - $ExtraLinkName = "Various Artists - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : '')." ".($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; + $ExtraLinkName = "Various Artists - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]$ExtraRemasterDisplayString " . ($ExtraHasLog == '1' ? " (Log: {$ExtraLogScore}%)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; } else { - $ExtraLinkName = "$ExtraArtistName - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : '').' '.($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; + $ExtraLinkName = "$ExtraArtistName - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]$ExtraRemasterDisplayString " . ($ExtraHasLog == '1' ? " (Log: {$ExtraLogScore}%)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; } ?> ')?> diff --git a/sections/reportsv2/static.php b/sections/reportsv2/static.php index 89b78bc9..0bdfadd9 100644 --- a/sections/reportsv2/static.php +++ b/sections/reportsv2/static.php @@ -14,6 +14,7 @@ } include(SERVER_ROOT.'/classes/class_text.php'); +include(SERVER_ROOT.'/classes/class_reports.php'); $Text = NEW TEXT; define('REPORTS_PER_PAGE', '10'); @@ -264,29 +265,31 @@ $ReportType = $Types['master']['other']; } } + $RemasterDisplayString = Reports::format_reports_remaster_info($Remastered, $RemasterTitle, $RemasterYear); + if ($ArtistID == 0 && empty($ArtistName)) { - $RawName = $GroupName.($Year ? " ($Year)" : '').($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '').($Remastered ? " <$RemasterTitle - $RemasterYear>" : '').($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: $LogScore %)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $RawName = $GroupName.($Year ? " ($Year)" : '').($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '') . $RemasterDisplayString . ($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; - $LinkName = "$GroupName".($Year ? " ($Year)" : '')." ".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '').($Remastered ? " <$RemasterTitle - $RemasterYear>" : '').' '.($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: $LogScore %)" : '')." (".number_format($Size/(1024*1024), 2)." MB)"; + $LinkName = "$GroupName".($Year ? " ($Year)" : '')." ".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '') . $RemasterDisplayString . ' '.($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2)." MB)"; - $BBName = "[url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : '').'[/url] '.($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID](Log: $LogScore %)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $BBName = "[url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]{$RemasterDisplayString}[/url] ".($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; } elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') { - $RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : '').($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: $LogScore %)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]{$RemasterDisplayString}" . ($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; - $LinkName = "Various Artists - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : '').' '.($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: $LogScore %)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $LinkName = "Various Artists - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]$RemasterDisplayString ".($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; - $BBName = "Various Artists - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : '').'[/url] '.($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID](Log: $LogScore %)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $BBName = "Various Artists - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]{$RemasterDisplayString}[/url] ".($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; } else { - $RawName = "$ArtistName - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : '').($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: $LogScore %)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $RawName = "$ArtistName - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]{$RemasterDisplayString}" . ($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; - $LinkName = "$ArtistName - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : '').' '.($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: $LogScore %)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $LinkName = "$ArtistName - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]{$RemasterDisplayString} ".($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; - $BBName = "[url=artist.php?id=$ArtistID]".$ArtistName."[/url] - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : '').'[/url] '.($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID](Log: $LogScore %)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $BBName = "[url=artist.php?id=$ArtistID]".$ArtistName."[/url] - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]{$RemasterDisplayString}[/url] ".($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; } ?>
    - next_record()); if ($ExtraGroupName) { + $ExtraRemasterDisplayString = Reports::format_reports_remaster_info($ExtraRemastered, $ExtraRemasterTitle, $ExtraRemasterYear); + if ($ArtistID == 0 && empty($ArtistName)) { - $ExtraLinkName = "$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : '').' '.($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; + $ExtraLinkName = "$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]$ExtraRemasterDisplayString " . ($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; } elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') { - $ExtraLinkName = "Various Artists - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : '').' '.($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; + $ExtraLinkName = "Various Artists - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]$ExtraRemasterDisplayString " . ($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; } else { - $ExtraLinkName = "$ExtraArtistName - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : '').' '.($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; + $ExtraLinkName = "$ExtraArtistName - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]$ExtraRemasterDisplayString " . ($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; } ?> ')?> @@ -588,51 +593,48 @@ - + | - + | - + | Multi-resolve | - + - Resolver + Resolver: - Resolve time + Resolve time: - + - Report comments + Report comments: - + - Log message + Log message: - + - + - +
    @@ -647,9 +649,8 @@ } ?>
    - - + diff --git a/sections/reportsv2/views.php b/sections/reportsv2/views.php index b4e2a05f..3b5fbe06 100644 --- a/sections/reportsv2/views.php +++ b/sections/reportsv2/views.php @@ -115,6 +115,7 @@ query(" SELECT + um.ID, um.Username, COUNT(r.ID) AS Reports FROM reportsv2 AS r @@ -130,10 +131,10 @@ Reports - + diff --git a/sections/requests/request.php b/sections/requests/request.php index 6b079fb5..9201a4ed 100644 --- a/sections/requests/request.php +++ b/sections/requests/request.php @@ -22,6 +22,7 @@ error(404); } +// If you change this line, make sure to do the same change to the corresponding line in sections/ajax/request.php list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $RecordLabel, $ReleaseType, $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled, $GroupID, $OCLC) = $Request; @@ -42,7 +43,7 @@ $ArtistLink = Artists::display_artists($ArtistForm, true, true); if ($IsFilled) { - $DisplayLink = $ArtistLink."$Title [$Year]"; + $DisplayLink = $ArtistLink."$Title [$Year]"; } else { $DisplayLink = $ArtistLink.$Title." [$Year]"; } @@ -99,23 +100,22 @@ Report request - " class="brackets">Upload request + " class="brackets">Upload request Request update Find in library Find in stores @@ -131,7 +131,7 @@ ?>

    <?=$FullName?>

    -

    <?=$CategoryName?>

    +

    <?=$CategoryName?>

    $TagName) { ?>
  • -
    +
  • @@ -244,10 +244,10 @@ ?> - ':''?>':''?> + ' : '')?>' : '')?> - ':''?>':''?> + ' : '')?>' : '')?> by - Record label @@ -328,10 +328,10 @@ '.$OCLCs[$i].''; @@ -558,11 +558,13 @@ - - + + 'requestid', 'InputID' => $RequestID)); diff --git a/sections/requests/requests.php b/sections/requests/requests.php index 27199d91..ff028930 100644 --- a/sections/requests/requests.php +++ b/sections/requests/requests.php @@ -678,6 +678,4 @@
    - + diff --git a/sections/requests/requests.php.presphinx b/sections/requests/requests.php.presphinx index 57cdf8b9..f6ac8e6d 100644 --- a/sections/requests/requests.php.presphinx +++ b/sections/requests/requests.php.presphinx @@ -374,15 +374,13 @@ foreach ($Categories as $CatKey => $CatName) {
    - - @@ -401,7 +399,7 @@ foreach ($Categories as $CatKey => $CatName) { Created @@ -422,14 +420,14 @@ foreach ($Categories as $CatKey => $CatName) { if ($CategoryName == "Music") { $ArtistForm = Requests::get_artists($RequestID); $ArtistLink = display_artists($ArtistForm, true, true); - $FullName = $ArtistLink."".$Title." [".$Year."]"; + $FullName = $ArtistLink."$Title [$Year]"; } elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') { - $FullName = "".$Title." [".$Year."]"; + $FullName = "$Title [$Year]"; } else { - $FullName ="".$Title.""; + $FullName ="$Title"; } - $Row = ($Row == 'a') ? 'b' : 'a'; + $Row = (($Row == 'a') ? 'b' : 'a'); $Tags = Requests::get_tags($RequestID); ?> @@ -440,7 +438,7 @@ foreach ($Categories as $CatKey => $CatName) { $TagName) { - $TagList[] = "".display_str($TagName).""; + $TagList[] = "" . display_str($TagName) . ''; } $TagList = implode(', ', $TagList); ?> diff --git a/sections/tools/data/invite_pool.php b/sections/tools/data/invite_pool.php index 8fadeb5d..ce028a9e 100644 --- a/sections/tools/data/invite_pool.php +++ b/sections/tools/data/invite_pool.php @@ -99,7 +99,7 @@
    - Request Name + Request name Vote (20MB) - Last Vote + Last vote
    - - + + + diff --git a/sections/tools/misc/tags.php b/sections/tools/misc/tags.php index 93d861f3..60bf9f0a 100644 --- a/sections/tools/misc/tags.php +++ b/sections/tools/misc/tags.php @@ -1,18 +1,18 @@ SetFields('tag',true,'string','Enter a single tag to search for.',array('maxlength'=>'200','minlength'=>'2')); -$Val->SetFields('replace',true,'string','Enter a single replacement tag.',array('maxlength'=>'200','minlength'=>'2')); +$Val->SetFields('tag', true, 'string', 'Enter a single tag to search for.', array('maxlength'=>'200', 'minlength'=>'2')); +$Val->SetFields('replace', true, 'string', 'Enter a single replacement tag.', array('maxlength'=>'200', 'minlength'=>'2')); echo $Val->GenerateJS('tagform'); // some constants to make programmers' lives easier -define('MODE_RENAME',0); -define('MODE_MERGE',1); +define('MODE_RENAME', 0); +define('MODE_MERGE', 1); ?>
    @@ -69,10 +69,11 @@ } // 1) make sure tag exists - $DB->query("SELECT ID - FROM tags - WHERE Name = '".$Tag."' - LIMIT 1;"); + $DB->query(" + SELECT ID + FROM tags + WHERE Name = '$Tag' + LIMIT 1;"); if ($DB->record_count() == 0) { echo "
    Error: No such tag found: $Tag @@ -84,10 +85,11 @@ list($TagID) = $DB->next_record(); // 2) check if replacement exists - $DB->query("SELECT ID - FROM tags - WHERE Name = '".$Replacement."' - LIMIT 1;"); + $DB->query(" + SELECT ID + FROM tags + WHERE Name = '$Replacement' + LIMIT 1;"); if ($DB->record_count() == 0 ) { $Mode = MODE_RENAME; } else { @@ -98,35 +100,37 @@ if ($_GET['list']) { $AffectedTorrents = array(); // 3) get a list of affected torrents - $DB->query("SELECT + $DB->query(" + SELECT tg.ID, ag.ArtistID, ag.Name, tg.Name - FROM torrents_group AS tg - LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID - JOIN torrents_tags AS t ON t.GroupID=tg.ID - WHERE t.TagID=$TagID;"); - while (list($TorrentID,$ArtistID,$ArtistName,$TorrentName) = $DB->next_record()) { + FROM torrents_group AS tg + LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID + JOIN torrents_tags AS t ON t.GroupID=tg.ID + WHERE t.TagID=$TagID;"); + while (list($TorrentID, $ArtistID, $ArtistName, $TorrentName) = $DB->next_record()) { $Row = ($ArtistName ? "$ArtistName - " : ''); - $Row.= "".display_str($TorrentName).""; + $Row.= "".display_str($TorrentName).''; $AffectedTorrents[] = $Row; } // 4) get a list of affected requests - $DB->query("SELECT + $DB->query(" + SELECT ra.RequestID, ag.ArtistID, ag.Name, r.Title - FROM requests AS r - LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID - LEFT JOIN artists_group AS ag ON ag.ArtistID=ra.ArtistID - JOIN requests_tags AS t ON t.RequestID=r.ID - WHERE t.TagID=$TagID;"); - while (list($RequestID,$ArtistID,$ArtistName,$RequestName) = $DB->next_record()) { + FROM requests AS r + LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID + LEFT JOIN artists_group AS ag ON ag.ArtistID=ra.ArtistID + JOIN requests_tags AS t ON t.RequestID=r.ID + WHERE t.TagID=$TagID;"); + while (list($RequestID, $ArtistID, $ArtistName, $RequestName) = $DB->next_record()) { $Row = ($ArtistName ? "$ArtistName - " : ''); - $Row.= "".display_str($RequestName).""; + $Row.= "".display_str($RequestName).''; $AffectedRequests[] = $Row; } } @@ -135,10 +139,11 @@ if ($Mode == MODE_RENAME) { // EASY! just rename the tag // 5) rename the tag - $DB->query("UPDATE tags - SET Name = '".$Replacement."' - WHERE ID = $TagID - LIMIT 1;"); + $DB->query(" + UPDATE tags + SET Name = '$Replacement' + WHERE ID = $TagID + LIMIT 1;"); $TotalAffected = $DB->affected_rows(); } else { // HARD! merge two tags together and update usage @@ -146,78 +151,82 @@ // (torrents that have both "old tag" and "replacement tag" set) $DB->query("SELECT GroupID FROM torrents_tags WHERE TagID=$ReplacementID;"); if ($DB->record_count() > 0 ) { - $Query = "DELETE - FROM torrents_tags - WHERE TagID=$TagID + $Query = " + DELETE FROM torrents_tags + WHERE TagID=$TagID AND GroupID IN ("; while (list($GroupID) = $DB->next_record()) { $Query.= $GroupID.','; } - $Query = substr($Query,0,-1).");"; + $Query = substr($Query, 0, -1) . ');'; $DB->query($Query); $TotalAffected = $DB->affected_rows(); } // 6) replace old tag in torrents - $DB->query("UPDATE torrents_tags - SET TagID=$ReplacementID - WHERE TagID=$TagID;"); + $DB->query(" + UPDATE torrents_tags + SET TagID=$ReplacementID + WHERE TagID=$TagID;"); $UsageChange = $DB->affected_rows(); // 7) remove dupe tags from artists $DB->query("SELECT ArtistID FROM artists_tags WHERE TagID=$ReplacementID;"); if ($DB->record_count() > 0 ) { - $Query = "DELETE - FROM artists_tags - WHERE TagID=$TagID + $Query = " + DELETE FROM artists_tags + WHERE TagID=$TagID AND ArtistID IN ("; while (list($ArtistID) = $DB->next_record()) { $Query.= $ArtistID.','; } - $Query = substr($Query,0,-1).");"; + $Query = substr($Query, 0, -1) . ');'; $DB->query($Query); $TotalAffected += $DB->affected_rows(); } // 8) replace old tag in artists - $DB->query("UPDATE artists_tags - SET TagID=$ReplacementID - WHERE TagID=$TagID;"); + $DB->query(" + UPDATE artists_tags + SET TagID=$ReplacementID + WHERE TagID=$TagID;"); $UsageChange += $DB->affected_rows(); // 9) remove dupe tags from requests $DB->query("SELECT RequestID FROM requests_tags WHERE TagID=$ReplacementID;"); if ($DB->record_count() > 0) { - $Query = "DELETE - FROM requests_tags - WHERE TagID=$TagID + $Query = " + DELETE FROM requests_tags + WHERE TagID=$TagID AND RequestID IN ("; while (list($RequestID) = $DB->next_record()) { $Query.= $RequestID.','; } - $Query = substr($Query,0,-1).");"; + $Query = substr($Query, 0, -1) . ');'; $DB->query($Query); $TotalAffected += $DB->affected_rows(); } // 10) replace old tag in requests - $DB->query("UPDATE requests_tags - SET TagID=$ReplacementID - WHERE TagID=$TagID;"); + $DB->query(" + UPDATE requests_tags + SET TagID=$ReplacementID + WHERE TagID=$TagID;"); $UsageChange += $DB->affected_rows(); $TotalAffected += $UsageChange; // 11) finally, remove old tag completely - $DB->query("DELETE - FROM tags - WHERE ID=$TagID - LIMIT 1"); + $DB->query(" + DELETE FROM tags + WHERE ID=$TagID + LIMIT 1"); // 12) update usage count for replacement tag - $DB->query("UPDATE tags - SET Uses=Uses+$UsageChange - WHERE ID=$ReplacementID - LIMIT 1"); + $DB->query(" + UPDATE tags + SET Uses=Uses+$UsageChange + WHERE ID=$ReplacementID + LIMIT 1"); } // if ($Mode == MODE_MERGE) diff --git a/sections/tools/tools.php b/sections/tools/tools.php index 8361ebbe..609bed1a 100644 --- a/sections/tools/tools.php +++ b/sections/tools/tools.php @@ -1,7 +1,5 @@ Client whitelist IP address bans - Login watch @@ -27,31 +24,25 @@ "Do Not Upload" list Vanity House additions - Email blacklist Manage freeleech tokens Official tags manager Tag aliases - -
    - - + - @@ -62,7 +53,6 @@ -
    Data
    Donation log
    Bitcoin donation balance
    Registration log
    Invite pool
    Upscale pool
    User flow
    Service stats
    Special users
    @@ -71,8 +61,7 @@ Misc Batch tag editor - + Manipulate tree @@ -83,7 +72,6 @@ Clear/view a cache key Duplicate IP addresses - Sandbox (1) Sandbox (2) @@ -93,7 +81,6 @@ Sandbox (6) Sandbox (7) Sandbox (8) - Schedule Rerender stylesheet gallery images diff --git a/sections/top10/history.php b/sections/top10/history.php index a4d1ba67..7972988f 100644 --- a/sections/top10/history.php +++ b/sections/top10/history.php @@ -120,7 +120,7 @@ $DisplayName = Artists::display_artists($Artists, true, true); } - $DisplayName .= "$GroupName"; + $DisplayName .= "$GroupName"; if ($GroupCategoryID == 1 && $GroupYear > 0) { $DisplayName.= " [$GroupYear]"; @@ -130,36 +130,36 @@ $ExtraInfo = ''; $AddExtra = ''; if ($Format) { - $ExtraInfo.=$Format; + $ExtraInfo.= $Format; $AddExtra = ' / '; } if ($Encoding) { - $ExtraInfo.=$AddExtra.$Encoding; + $ExtraInfo.= $AddExtra.$Encoding; $AddExtra = ' / '; } //"FLAC / Lossless / Log (100%) / Cue / CD"; if ($HasLog) { - $ExtraInfo.=$AddExtra."Log (".$LogScore."%)"; + $ExtraInfo.= "$AddExtra Log ($LogScore".'%)'; $AddExtra = ' / '; } if ($HasCue) { - $ExtraInfo.=$AddExtra."Cue"; + $ExtraInfo.= $AddExtra.'Cue'; $AddExtra = ' / '; } if ($Media) { - $ExtraInfo.=$AddExtra.$Media; + $ExtraInfo.= $AddExtra.$Media; $AddExtra = ' / '; } if ($Scene) { - $ExtraInfo.=$AddExtra.'Scene'; + $ExtraInfo.= $AddExtra.'Scene'; $AddExtra = ' / '; } if ($Year > 0) { - $ExtraInfo.=$AddExtra.$Year; + $ExtraInfo.= $AddExtra.$Year; $AddExtra = ' '; } if ($RemasterTitle) { - $ExtraInfo.=$AddExtra.$RemasterTitle; + $ExtraInfo.= $AddExtra.$RemasterTitle; } if ($ExtraInfo != '') { $ExtraInfo = "- [$ExtraInfo]"; diff --git a/sections/torrents/add_tag.php b/sections/torrents/add_tag.php index 0d09e16e..101ef7a9 100644 --- a/sections/torrents/add_tag.php +++ b/sections/torrents/add_tag.php @@ -11,6 +11,11 @@ error(0); } +//Delete cached tag used for undos +if(isset($_POST['undo'])) { + $Cache->delete_value('deleted_tags_'.$GroupID.'_'.$LoggedUser['ID']); +} + $Tags = explode(',', $_POST['tagname']); foreach ($Tags as $TagName) { $TagName = Misc::sanitize_tag($TagName); @@ -45,6 +50,7 @@ } } + Torrents::update_hash($GroupID); // Delete torrent group cache header('Location: '.$_SERVER['HTTP_REFERER']); ?> diff --git a/sections/torrents/browse2.php b/sections/torrents/browse2.php index d70c13c3..76bc3cf3 100644 --- a/sections/torrents/browse2.php +++ b/sections/torrents/browse2.php @@ -781,7 +781,7 @@ function header_link($SortKey,$DefaultWay="desc") { - /> + /> @@ -801,8 +801,8 @@ function header_link($SortKey,$DefaultWay="desc") { $x++; ?> - checked="checked" /> - + checked="checked" /> + - +
    - +
    Results - +    diff --git a/sections/torrents/delete.php b/sections/torrents/delete.php index 7ec1e6da..0213c78f 100644 --- a/sections/torrents/delete.php +++ b/sections/torrents/delete.php @@ -6,7 +6,15 @@ -$DB->query("SELECT t.UserID, t.Time, COUNT(x.uid) FROM torrents AS t LEFT JOIN xbt_snatched AS x ON x.fid=t.ID WHERE t.ID=".$TorrentID." GROUP BY t.UserID"); +$DB->query(" + SELECT + t.UserID, + t.Time, + COUNT(x.uid) + FROM torrents AS t + LEFT JOIN xbt_snatched AS x ON x.fid=t.ID + WHERE t.ID=$TorrentID + GROUP BY t.UserID"); if ($DB->record_count() < 1) { error('Torrent already deleted.'); @@ -22,15 +30,15 @@ } if (isset($_SESSION['logged_user']['multi_delete']) && $_SESSION['logged_user']['multi_delete'] >= 3 && !check_perms('torrents_delete_fast')) { - error('You have recently deleted 3 torrents, please contact a staff member if you need to delete more.'); + error('You have recently deleted 3 torrents. Please contact a staff member if you need to delete more.'); } if (time_ago($Time) > 3600 * 24 * 7 && !check_perms('torrents_delete')) { // Should this be torrents_delete or torrents_delete_fast? - error('You can no longer delete this torrent as it has been uploaded for over a week with no problems. If you now think there is a problem, please report it instead.'); + error('You can no longer delete this torrent as it has been uploaded for over a week. If you now think there is a problem, please report the torrent instead.'); } if ($Snatches > 4 && !check_perms('torrents_delete')) { // Should this be torrents_delete or torrents_delete_fast? - error('You can no longer delete this torrent as it has been snatched by 5 or more users. If you believe there is a problem with the torrent please report it instead.'); + error('You can no longer delete this torrent as it has been snatched by 5 or more users. If you believe there is a problem with this torrent, please report it instead.'); } @@ -67,6 +75,8 @@ ?>
    $GroupName".($Year ? " ($Year)" : "")." ".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : "").($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."".($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; - $BBName = "[url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."[/url] ".($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; + $RawName = $GroupName.($Year ? " ($Year)" : '').($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '') . $RemasterDisplayString . ($HasLog ? " ({$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $LinkName = "$GroupName".($Year ? " ($Year)" : '')." ".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '') . "$RemasterDisplayString" . ($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $BBName = "[url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]{$RemasterDisplayString}[/url] " . ($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; } elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') { - $RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasLog ? " ($LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; - $LinkName = "Various Artists - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")." ".($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; - $BBName = "Various Artists - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."[/url] ".($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; + $RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]$RemasterDisplayString" . ($HasLog ? " ({$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $LinkName = "Various Artists - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]$RemasterDisplayString ".($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $BBName = "Various Artists - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]{$RemasterDisplayString}[/url] ".($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; } else { - $RawName = "$ArtistName - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasLog ? " ($LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; - $LinkName = "$ArtistName - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")." ".($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; - $BBName = "[url=artist.php?id=$ArtistID]".$ArtistName."[/url] - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."[/url] ".($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)"; + $RawName = "$ArtistName - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]$RemasterDisplayString" . ($HasLog ? " ({$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $LinkName = "$ArtistName - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]$RemasterDisplayString ".($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; + $BBName = "[url=artist.php?id=$ArtistID]".$ArtistName."[/url] - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]{$RemasterDisplayString}[/url] " . ($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; } ?>
    -
    @@ -169,11 +181,12 @@ DL uploaded by
    -query("SELECT r.ID - FROM reportsv2 AS r - LEFT JOIN torrents AS t ON t.ID=r.TorrentID - WHERE r.Status != 'Resolved' - AND t.GroupID=$GroupID"); +query(" + SELECT r.ID + FROM reportsv2 AS r + LEFT JOIN torrents AS t ON t.ID=r.TorrentID + WHERE r.Status != 'Resolved' + AND t.GroupID=$GroupID"); $GroupOthers = ($DB->record_count()); if ($GroupOthers > 0) { ?> @@ -182,11 +195,12 @@
    query("SELECT t.UserID - FROM reportsv2 AS r - JOIN torrents AS t ON t.ID=r.TorrentID - WHERE r.Status != 'Resolved' - AND t.UserID=$UploaderID"); + $DB->query(" + SELECT t.UserID + FROM reportsv2 AS r + JOIN torrents AS t ON t.ID=r.TorrentID + WHERE r.Status != 'Resolved' + AND t.UserID=$UploaderID"); $UploaderOthers = ($DB->record_count()); if ($UploaderOthers > 0) { ?> @@ -195,20 +209,21 @@
    query("SELECT DISTINCT req.ID, - req.FillerID, - um.Username, - req.TimeFilled - FROM requests AS req - JOIN users_main AS um ON um.ID=req.FillerID - AND req.TorrentID=$TorrentID"); + $DB->query(" + SELECT DISTINCT req.ID, + req.FillerID, + um.Username, + req.TimeFilled + FROM requests AS req + JOIN users_main AS um ON um.ID=req.FillerID + AND req.TorrentID=$TorrentID"); $Requests = ($DB->record_count()); if ($Requests > 0) { while (list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) { ?> -
    +
    used this torrent to fill this request -
    +
    $Data) { ?> - + @@ -246,7 +261,7 @@ Warning @@ -255,7 +270,7 @@ /> - + PM Uploader diff --git a/sections/torrents/delete_tag.php b/sections/torrents/delete_tag.php index dc20dd82..276d5d48 100644 --- a/sections/torrents/delete_tag.php +++ b/sections/torrents/delete_tag.php @@ -29,6 +29,7 @@ $DB->query("DELETE FROM tags WHERE ID=".$TagID); } - +// Cache the deleted tag for 5 minutes +$Cache->cache_value('deleted_tags_'.$GroupID.'_'.$LoggedUser['ID'], $TagName, 300); header('Location: '.$_SERVER['HTTP_REFERER']); ?> diff --git a/sections/torrents/details.php b/sections/torrents/details.php index d2e0a823..503567b6 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -311,7 +311,22 @@ function compare($X, $Y) { include(SERVER_ROOT.'/sections/torrents/vote.php'); ?>
    -
    Tags
    +
    + Tags + get_value('deleted_tags_'.$GroupID.'_'.$LoggedUser['ID']); + if(!empty($DeletedTag)) { ?> + + + + + + + + Undo Delete + + +
    0) { ?> @@ -443,7 +458,7 @@ function filelist($Str) { //There was a type but it wasn't an option! $ReportType = $Types['master']['other']; } - $ReportInfo .= "".(check_perms('admin_reports') ? "$ReporterName reported it " : "Someone reported it ").time_diff($ReportedTime,2,true,true)." for the reason '".$ReportType['title']."':"; + $ReportInfo .= "".(check_perms('admin_reports') ? "$ReporterName reported it " : 'Someone reported it ') . time_diff($ReportedTime, 2, true, true) . ' for the reason "' . $ReportType['title'] . '":'; $ReportInfo .= "
    ".$Text->full_format($ReportReason)."
    "; } $ReportInfo .= ""; @@ -468,7 +483,7 @@ function filelist($Str) { if ($Spaces = strspn($Name, ' ')) { $Name = str_replace(' ', ' ', substr($Name, 0, $Spaces)) . substr($Name, $Spaces); } - $FileSize = substr($File, $NameEnd+3, -3); + $FileSize = substr($File, $NameEnd + 3, -3); $FileTable .= sprintf("\n%s%s", $Name, Format::get_size($FileSize)); } @@ -483,8 +498,8 @@ function filelist($Str) { $FileTable .= ' '; - $ExtraInfo=''; // String that contains information on the torrent (e.g. format and encoding) - $AddExtra=''; // Separator between torrent properties + $ExtraInfo = ''; // String that contains information on the torrent (e.g. format and encoding) + $AddExtra = ''; // Separator between torrent properties $TorrentUploader = $Username; // Save this for "Uploaded by:" below @@ -533,9 +548,9 @@ function filelist($Str) { $LastMedia = $Media; ?> - + - [ + [ | FL diff --git a/sections/torrents/edit.php b/sections/torrents/edit.php index 0938d8a8..f0aa1fda 100644 --- a/sections/torrents/edit.php +++ b/sections/torrents/edit.php @@ -16,47 +16,48 @@ $TorrentID = $_GET['id']; -$DB->query("SELECT - t.Media, - t.Format, - t.Encoding AS Bitrate, - t.RemasterYear, - t.Remastered, - t.RemasterTitle, - t.RemasterCatalogueNumber, - t.RemasterRecordLabel, - t.Scene, - t.FreeTorrent, - t.FreeLeechType, - t.Dupable, - t.DupeReason, - t.Description AS TorrentDescription, - tg.CategoryID, - tg.Name AS Title, - tg.Year, - tg.ArtistID, - tg.VanityHouse, - ag.Name AS ArtistName, - t.GroupID, - t.UserID, - t.HasLog, - t.HasCue, - t.LogScore, - bt.TorrentID AS BadTags, - bf.TorrentID AS BadFolders, - bfi.TorrentID AS BadFiles, - ca.TorrentID AS CassetteApproved, - lma.TorrentID AS LossymasterApproved, - lwa.TorrentID AS LossywebApproved +$DB->query(" + SELECT + t.Media, + t.Format, + t.Encoding AS Bitrate, + t.RemasterYear, + t.Remastered, + t.RemasterTitle, + t.RemasterCatalogueNumber, + t.RemasterRecordLabel, + t.Scene, + t.FreeTorrent, + t.FreeLeechType, + t.Dupable, + t.DupeReason, + t.Description AS TorrentDescription, + tg.CategoryID, + tg.Name AS Title, + tg.Year, + tg.ArtistID, + tg.VanityHouse, + ag.Name AS ArtistName, + t.GroupID, + t.UserID, + t.HasLog, + t.HasCue, + t.LogScore, + bt.TorrentID AS BadTags, + bf.TorrentID AS BadFolders, + bfi.TorrentID AS BadFiles, + ca.TorrentID AS CassetteApproved, + lma.TorrentID AS LossymasterApproved, + lwa.TorrentID AS LossywebApproved FROM torrents AS t - LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID - LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID - LEFT JOIN torrents_bad_tags AS bt ON bt.TorrentID=t.ID - LEFT JOIN torrents_bad_folders AS bf ON bf.TorrentID=t.ID - LEFT JOIN torrents_bad_files AS bfi ON bfi.TorrentID=t.ID - LEFT JOIN torrents_cassette_approved AS ca ON ca.TorrentID=t.ID - LEFT JOIN torrents_lossymaster_approved AS lma ON lma.TorrentID=t.ID - LEFT JOIN torrents_lossyweb_approved AS lwa ON lwa.TorrentID=t.id + LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID + LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID + LEFT JOIN torrents_bad_tags AS bt ON bt.TorrentID=t.ID + LEFT JOIN torrents_bad_folders AS bf ON bf.TorrentID=t.ID + LEFT JOIN torrents_bad_files AS bfi ON bfi.TorrentID=t.ID + LEFT JOIN torrents_cassette_approved AS ca ON ca.TorrentID=t.ID + LEFT JOIN torrents_lossymaster_approved AS lma ON lma.TorrentID=t.ID + LEFT JOIN torrents_lossyweb_approved AS lwa ON lwa.TorrentID=t.id WHERE t.ID='$TorrentID'"); list($Properties) = $DB->to_array(false,MYSQLI_BOTH); @@ -64,7 +65,7 @@ error(404); } -$UploadForm = $Categories[$Properties['CategoryID']-1]; +$UploadForm = $Categories[$Properties['CategoryID'] - 1]; if (($LoggedUser['ID'] != $Properties['UserID'] && !check_perms('torrents_edit')) || $LoggedUser['DisableWiki']) { error(403); @@ -94,6 +95,7 @@ case 'E-Learning Videos': $TorrentForm->simple_form($Properties['CategoryID']); break; + default: $TorrentForm->music_form(''); } @@ -105,7 +107,9 @@ -

    Change group

    +
    +

    Change group

    +
    @@ -175,7 +179,7 @@ @@ -184,7 +188,7 @@ diff --git a/sections/torrents/notify.php b/sections/torrents/notify.php index b9853a67..08ebc9c3 100644 --- a/sections/torrents/notify.php +++ b/sections/torrents/notify.php @@ -223,12 +223,10 @@ function header_link($SortKey, $DefaultWay = "desc") { } } } - $MatchingArtistsText = !empty($MatchingArtists) - ? 'Caught by filter for '.implode(', ', $MatchingArtists) - : ''; + $MatchingArtistsText = (!empty($MatchingArtists) ? 'Caught by filter for '.implode(', ', $MatchingArtists) : ''); $DisplayName = Artists::display_artists($GroupInfo['ExtendedArtists'], true, true); } - $DisplayName .= "".$GroupInfo['Name'].""; + $DisplayName .= "" . $GroupInfo['Name'] . ''; $GroupCategoryID = $GroupInfo['CategoryID']; if ($GroupCategoryID == 1) { @@ -236,7 +234,7 @@ function header_link($SortKey, $DefaultWay = "desc") { $DisplayName .= " [$GroupInfo[Year]]"; } if ($GroupInfo['ReleaseType'] > 0) { - $DisplayName.= " [".$ReleaseTypes[$GroupInfo['ReleaseType']]."]"; + $DisplayName.= ' ['.$ReleaseTypes[$GroupInfo['ReleaseType']].']'; } } @@ -246,12 +244,12 @@ function header_link($SortKey, $DefaultWay = "desc") { $TorrentTags = new Tags($GroupInfo['TagList']); if ($GroupInfo['TagList'] == '') - $TorrentTags->set_primary($Categories[$GroupCategoryID-1]); + $TorrentTags->set_primary($Categories[$GroupCategoryID - 1]); // print row ?> - > - + > +
    @@ -293,9 +291,8 @@ function header_link($SortKey, $DefaultWay = "desc") { } } -?> - + if ($Pages) { ?> + +
    diff --git a/sections/user/search.php b/sections/user/search.php index d3b3ea7d..45e00a95 100644 --- a/sections/user/search.php +++ b/sections/user/search.php @@ -52,12 +52,10 @@

    Search results

    - + + + diff --git a/sections/user/user.php b/sections/user/user.php index be223d33..0342a925 100644 --- a/sections/user/user.php +++ b/sections/user/user.php @@ -757,18 +757,18 @@ function check_paranoia_here($Setting) { } list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $ReleaseType, - $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled) = $Request; + $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled) = $Request; $CategoryName = $Categories[$CategoryID - 1]; if ($CategoryName == 'Music') { $ArtistForm = Requests::get_artists($RequestID); $ArtistLink = Artists::display_artists($ArtistForm, true, true); - $FullName = $ArtistLink."$Title [$Year]"; + $FullName = $ArtistLink."$Title [$Year]"; } elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') { - $FullName = "$Title [$Year]"; + $FullName = "$Title [$Year]"; } else { - $FullName ="$Title"; + $FullName ="$Title"; } $Row = (empty($Row) || $Row == 'a') ? 'b' : 'a'; @@ -781,11 +781,11 @@ function check_paranoia_here($Setting) { $Tags = $Request['Tags']; $TagList = array(); foreach ($Tags as $TagID => $TagName) { - $TagList[] = "".display_str($TagName).""; + $TagList[] = "".display_str($TagName).''; } $TagList = implode(', ', $TagList); ?> - +
    diff --git a/sections/userhistory/ip_history.php b/sections/userhistory/ip_history.php index 6fbc84be..ec3d6c4a 100644 --- a/sections/userhistory/ip_history.php +++ b/sections/userhistory/ip_history.php @@ -140,15 +140,16 @@ function UnBan(ip, id, elemID) {

    IP address history for

    -
    - diff --git a/sections/userhistory/post_history.php b/sections/userhistory/post_history.php index cd876ea3..ed390be2 100644 --- a/sections/userhistory/post_history.php +++ b/sections/userhistory/post_history.php @@ -317,8 +317,4 @@ - + diff --git a/sections/wiki/aliases.php b/sections/wiki/aliases.php index 417cd144..db8afbb2 100644 --- a/sections/wiki/aliases.php +++ b/sections/wiki/aliases.php @@ -15,9 +15,9 @@

    Aliases

    - +

    diff --git a/sections/wiki/search.php b/sections/wiki/search.php index 714d9ebc..86cf42eb 100644 --- a/sections/wiki/search.php +++ b/sections/wiki/search.php @@ -111,12 +111,10 @@

    - + + +
    diff --git a/static/functions/class_ajax.js b/static/functions/class_ajax.js index 86d5c978..c6cdbe96 100644 --- a/static/functions/class_ajax.js +++ b/static/functions/class_ajax.js @@ -117,9 +117,9 @@ var ajax = { //Bookmarks function Bookmark(type, id, newName) { if (window.location.pathname.indexOf('top10.php') != -1) { - var oldName = $('.bookmarklink_' + type + '_' + id).raw().innerHTML; + var oldName = $('#bookmarklink_' + type + '_' + id).raw().innerHTML; ajax.get("bookmarks.php?action=add&type=" + type + "&auth=" + authkey + "&id=" + id, function() { - var bookmarklinks = $('.bookmarklink_' + type + '_' + id).objects; + var bookmarklinks = $('#bookmarklink_' + type + '_' + id).objects; for (var i = 0; i < bookmarklinks.length; i++) { $(bookmarklinks[i].parentNode.parentNode.parentNode).add_class('bookmarked'); bookmarklinks[i].onclick = function() { Unbookmark(type, id, oldName); return false; }; @@ -146,9 +146,9 @@ function Unbookmark(type, id, newName) { $('.bookmark_' + id).remove(); }); } else if (window.location.pathname.indexOf('top10.php') != -1) { - var oldName = $('.bookmarklink_' + type + '_' + id).raw().innerHTML; + var oldName = $('#bookmarklink_' + type + '_' + id).raw().innerHTML; ajax.get("bookmarks.php?action=remove&type=" + type + "&auth=" + authkey + "&id=" + id, function() { - var bookmarklinks = $('.bookmarklink_' + type + '_' + id).objects; + var bookmarklinks = $('#bookmarklink_' + type + '_' + id).objects; for (var i = 0; i < bookmarklinks.length; i++) { $(bookmarklinks[i].parentNode.parentNode.parentNode).remove_class('bookmarked'); bookmarklinks[i].onclick = function() { Bookmark(type, id, oldName); return false; }; diff --git a/static/functions/form_validate.js b/static/functions/form_validate.js new file mode 100644 index 00000000..ba419275 --- /dev/null +++ b/static/functions/form_validate.js @@ -0,0 +1,32 @@ +(function ($) { + $(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) { + case "forums": + if(query['action'] == "new") { + $("#newthreadform").validate(); + } + break; + case "reports": + if(query['action'] == "report") { + $("#report_form").validate(); + } + break; + case "inbox": + if(query['action'] == "viewconv" || query['action'] == "compose") { + $("#messageform").validate(); + } + break; + default: + break; + } + }); +} (jQuery)); diff --git a/static/functions/forum_search.js b/static/functions/forum_search.js new file mode 100644 index 00000000..d115fa0b --- /dev/null +++ b/static/functions/forum_search.js @@ -0,0 +1,11 @@ +(function ($) { + $(document).ready(function() { + $(".forum_category").click(function(e) { + var id = this.id; + var isChecked = $(this).text() != "Check all"; + isChecked ? $(this).text("Check all") : $(this).text("Uncheck all"); + $("input[data-category='" + id + "']").attr("checked", !isChecked); + e.preventDefault(); + }); + }); +}(jQuery)); diff --git a/static/functions/jquery.validate.js b/static/functions/jquery.validate.js new file mode 100644 index 00000000..95a279f6 --- /dev/null +++ b/static/functions/jquery.validate.js @@ -0,0 +1,1230 @@ +/*! + * jQuery Validation Plugin 1.12.0pre + * + * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ + * http://docs.jquery.com/Plugins/Validation + * + * Copyright 2013 Jörn Zaefferer + * Released under the MIT license: + * http://www.opensource.org/licenses/mit-license.php + */ + +(function($) { + +$.extend($.fn, { + // http://docs.jquery.com/Plugins/Validation/validate + validate: function( options ) { + // if nothing is selected, return nothing; can't chain anyway + if ( !this.length ) { + if ( options && options.debug && window.console ) { + console.warn( "Nothing selected, can't validate, returning nothing." ); + } + return; + } + + // check if a validator for this form was already created + var validator = $.data( this[0], "validator" ); + if ( validator ) { + return validator; + } + + // Add novalidate tag if HTML5. + this.attr( "novalidate", "novalidate" ); + + validator = new $.validator( options, this[0] ); + $.data( this[0], "validator", validator ); + + if ( validator.settings.onsubmit ) { + + this.validateDelegate( ":submit", "click", function( event ) { + if ( validator.settings.submitHandler ) { + validator.submitButton = event.target; + } + // allow suppressing validation by adding a cancel class to the submit button + if ( $(event.target).hasClass("cancel") ) { + validator.cancelSubmit = true; + } + + // allow suppressing validation by adding the html5 formnovalidate attribute to the submit button + if ( $(event.target).attr("formnovalidate") !== undefined ) { + validator.cancelSubmit = true; + } + }); + + // validate the form on submit + this.submit( function( event ) { + if ( validator.settings.debug ) { + // prevent form submit to be able to see console output + event.preventDefault(); + } + function handle() { + var hidden; + if ( validator.settings.submitHandler ) { + if ( validator.submitButton ) { + // insert a hidden input as a replacement for the missing submit button + hidden = $("").attr("name", validator.submitButton.name).val( $(validator.submitButton).val() ).appendTo(validator.currentForm); + } + validator.settings.submitHandler.call( validator, validator.currentForm, event ); + if ( validator.submitButton ) { + // and clean up afterwards; thanks to no-block-scope, hidden can be referenced + hidden.remove(); + } + return false; + } + return true; + } + + // prevent submit for invalid forms or custom submit handlers + if ( validator.cancelSubmit ) { + validator.cancelSubmit = false; + return handle(); + } + if ( validator.form() ) { + if ( validator.pendingRequest ) { + validator.formSubmitted = true; + return false; + } + return handle(); + } else { + validator.focusInvalid(); + return false; + } + }); + } + + return validator; + }, + // http://docs.jquery.com/Plugins/Validation/valid + valid: function() { + if ( $(this[0]).is("form")) { + return this.validate().form(); + } else { + var valid = true; + var validator = $(this[0].form).validate(); + this.each(function() { + valid = valid && validator.element(this); + }); + return valid; + } + }, + // attributes: space separated list of attributes to retrieve and remove + removeAttrs: function( attributes ) { + var result = {}, + $element = this; + $.each(attributes.split(/\s/), function( index, value ) { + result[value] = $element.attr(value); + $element.removeAttr(value); + }); + return result; + }, + // http://docs.jquery.com/Plugins/Validation/rules + rules: function( command, argument ) { + var element = this[0]; + + if ( command ) { + var settings = $.data(element.form, "validator").settings; + var staticRules = settings.rules; + var existingRules = $.validator.staticRules(element); + switch(command) { + case "add": + $.extend(existingRules, $.validator.normalizeRule(argument)); + // remove messages from rules, but allow them to be set separetely + delete existingRules.messages; + staticRules[element.name] = existingRules; + if ( argument.messages ) { + settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages ); + } + break; + case "remove": + if ( !argument ) { + delete staticRules[element.name]; + return existingRules; + } + var filtered = {}; + $.each(argument.split(/\s/), function( index, method ) { + filtered[method] = existingRules[method]; + delete existingRules[method]; + }); + return filtered; + } + } + + var data = $.validator.normalizeRules( + $.extend( + {}, + $.validator.classRules(element), + $.validator.attributeRules(element), + $.validator.dataRules(element), + $.validator.staticRules(element) + ), element); + + // make sure required is at front + if ( data.required ) { + var param = data.required; + delete data.required; + data = $.extend({required: param}, data); + } + + return data; + } +}); + +// Custom selectors +$.extend($.expr[":"], { + // http://docs.jquery.com/Plugins/Validation/blank + blank: function( a ) { return !$.trim("" + $(a).val()); }, + // http://docs.jquery.com/Plugins/Validation/filled + filled: function( a ) { return !!$.trim("" + $(a).val()); }, + // http://docs.jquery.com/Plugins/Validation/unchecked + unchecked: function( a ) { return !$(a).prop("checked"); } +}); + +// constructor for validator +$.validator = function( options, form ) { + this.settings = $.extend( true, {}, $.validator.defaults, options ); + this.currentForm = form; + this.init(); +}; + +$.validator.format = function( source, params ) { + if ( arguments.length === 1 ) { + return function() { + var args = $.makeArray(arguments); + args.unshift(source); + return $.validator.format.apply( this, args ); + }; + } + if ( arguments.length > 2 && params.constructor !== Array ) { + params = $.makeArray(arguments).slice(1); + } + if ( params.constructor !== Array ) { + params = [ params ]; + } + $.each(params, function( i, n ) { + source = source.replace( new RegExp("\\{" + i + "\\}", "g"), function() { + return n; + }); + }); + return source; +}; + +$.extend($.validator, { + + defaults: { + messages: {}, + groups: {}, + rules: {}, + errorClass: "error", + validClass: "valid", + errorElement: "label", + focusInvalid: true, + errorContainer: $([]), + errorLabelContainer: $([]), + onsubmit: true, + ignore: ":hidden", + ignoreTitle: false, + onfocusin: function( element, event ) { + this.lastActive = element; + + // hide error label and remove error class on focus if enabled + if ( this.settings.focusCleanup && !this.blockFocusCleanup ) { + if ( this.settings.unhighlight ) { + this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass ); + } + this.addWrapper(this.errorsFor(element)).hide(); + } + }, + onfocusout: function( element, event ) { + if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) { + this.element(element); + } + }, + onkeyup: function( element, event ) { + if ( event.which === 9 && this.elementValue(element) === "" ) { + return; + } else if ( element.name in this.submitted || element === this.lastElement ) { + this.element(element); + } + }, + onclick: function( element, event ) { + // click on selects, radiobuttons and checkboxes + if ( element.name in this.submitted ) { + this.element(element); + } + // or option elements, check parent select in that case + else if ( element.parentNode.name in this.submitted ) { + this.element(element.parentNode); + } + }, + highlight: function( element, errorClass, validClass ) { + if ( element.type === "radio" ) { + this.findByName(element.name).addClass(errorClass).removeClass(validClass); + } else { + $(element).addClass(errorClass).removeClass(validClass); + } + }, + unhighlight: function( element, errorClass, validClass ) { + if ( element.type === "radio" ) { + this.findByName(element.name).removeClass(errorClass).addClass(validClass); + } else { + $(element).removeClass(errorClass).addClass(validClass); + } + } + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults + setDefaults: function( settings ) { + $.extend( $.validator.defaults, settings ); + }, + + messages: { + required: "This field is required.", + remote: "Please fix this field.", + email: "Please enter a valid email address.", + url: "Please enter a valid URL.", + date: "Please enter a valid date.", + dateISO: "Please enter a valid date (ISO).", + number: "Please enter a valid number.", + digits: "Please enter only digits.", + creditcard: "Please enter a valid credit card number.", + equalTo: "Please enter the same value again.", + maxlength: $.validator.format("Please enter no more than {0} characters."), + minlength: $.validator.format("Please enter at least {0} characters."), + rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), + range: $.validator.format("Please enter a value between {0} and {1}."), + max: $.validator.format("Please enter a value less than or equal to {0}."), + min: $.validator.format("Please enter a value greater than or equal to {0}.") + }, + + autoCreateRanges: false, + + prototype: { + + init: function() { + this.labelContainer = $(this.settings.errorLabelContainer); + this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm); + this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer ); + this.submitted = {}; + this.valueCache = {}; + this.pendingRequest = 0; + this.pending = {}; + this.invalid = {}; + this.reset(); + + var groups = (this.groups = {}); + $.each(this.settings.groups, function( key, value ) { + if ( typeof value === "string" ) { + value = value.split(/\s/); + } + $.each(value, function( index, name ) { + groups[name] = key; + }); + }); + var rules = this.settings.rules; + $.each(rules, function( key, value ) { + rules[key] = $.validator.normalizeRule(value); + }); + + function delegate(event) { + var validator = $.data(this[0].form, "validator"), + eventType = "on" + event.type.replace(/^validate/, ""); + if ( validator.settings[eventType] ) { + validator.settings[eventType].call(validator, this[0], event); + } + } + $(this.currentForm) + .validateDelegate(":text, [type='password'], [type='file'], select, textarea, " + + "[type='number'], [type='search'] ,[type='tel'], [type='url'], " + + "[type='email'], [type='datetime'], [type='date'], [type='month'], " + + "[type='week'], [type='time'], [type='datetime-local'], " + + "[type='range'], [type='color'] ", + "focusin focusout keyup", delegate) + .validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate); + + if ( this.settings.invalidHandler ) { + $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); + } + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/form + form: function() { + this.checkForm(); + $.extend(this.submitted, this.errorMap); + this.invalid = $.extend({}, this.errorMap); + if ( !this.valid() ) { + $(this.currentForm).triggerHandler("invalid-form", [this]); + } + this.showErrors(); + return this.valid(); + }, + + checkForm: function() { + this.prepareForm(); + for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) { + this.check( elements[i] ); + } + return this.valid(); + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/element + element: function( element ) { + element = this.validationTargetFor( this.clean( element ) ); + this.lastElement = element; + this.prepareElement( element ); + this.currentElements = $(element); + var result = this.check( element ) !== false; + if ( result ) { + delete this.invalid[element.name]; + } else { + this.invalid[element.name] = true; + } + if ( !this.numberOfInvalids() ) { + // Hide error containers on last error + this.toHide = this.toHide.add( this.containers ); + } + this.showErrors(); + return result; + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/showErrors + showErrors: function( errors ) { + if ( errors ) { + // add items to error list and map + $.extend( this.errorMap, errors ); + this.errorList = []; + for ( var name in errors ) { + this.errorList.push({ + message: errors[name], + element: this.findByName(name)[0] + }); + } + // remove items from success list + this.successList = $.grep( this.successList, function( element ) { + return !(element.name in errors); + }); + } + if ( this.settings.showErrors ) { + this.settings.showErrors.call( this, this.errorMap, this.errorList ); + } else { + this.defaultShowErrors(); + } + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/resetForm + resetForm: function() { + if ( $.fn.resetForm ) { + $(this.currentForm).resetForm(); + } + this.submitted = {}; + this.lastElement = null; + this.prepareForm(); + this.hideErrors(); + this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" ); + }, + + numberOfInvalids: function() { + return this.objectLength(this.invalid); + }, + + objectLength: function( obj ) { + var count = 0; + for ( var i in obj ) { + count++; + } + return count; + }, + + hideErrors: function() { + this.addWrapper( this.toHide ).hide(); + }, + + valid: function() { + return this.size() === 0; + }, + + size: function() { + return this.errorList.length; + }, + + focusInvalid: function() { + if ( this.settings.focusInvalid ) { + try { + $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []) + .filter(":visible") + .focus() + // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find + .trigger("focusin"); + } catch(e) { + // ignore IE throwing errors when focusing hidden elements + } + } + }, + + findLastActive: function() { + var lastActive = this.lastActive; + return lastActive && $.grep(this.errorList, function( n ) { + return n.element.name === lastActive.name; + }).length === 1 && lastActive; + }, + + elements: function() { + var validator = this, + rulesCache = {}; + + // select all valid inputs inside the form (no submit or reset buttons) + return $(this.currentForm) + .find("input, select, textarea") + .not(":submit, :reset, :image, [disabled]") + .not( this.settings.ignore ) + .filter(function() { + if ( !this.name && validator.settings.debug && window.console ) { + console.error( "%o has no name assigned", this); + } + + // select only the first element for each name, and only those with rules specified + if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) { + return false; + } + + rulesCache[this.name] = true; + return true; + }); + }, + + clean: function( selector ) { + return $(selector)[0]; + }, + + errors: function() { + var errorClass = this.settings.errorClass.replace(" ", "."); + return $(this.settings.errorElement + "." + errorClass, this.errorContext); + }, + + reset: function() { + this.successList = []; + this.errorList = []; + this.errorMap = {}; + this.toShow = $([]); + this.toHide = $([]); + this.currentElements = $([]); + }, + + prepareForm: function() { + this.reset(); + this.toHide = this.errors().add( this.containers ); + }, + + prepareElement: function( element ) { + this.reset(); + this.toHide = this.errorsFor(element); + }, + + elementValue: function( element ) { + var type = $(element).attr("type"), + val = $(element).val(); + + if ( type === "radio" || type === "checkbox" ) { + return $("input[name='" + $(element).attr("name") + "']:checked").val(); + } + + if ( typeof val === "string" ) { + return val.replace(/\r/g, ""); + } + return val; + }, + + check: function( element ) { + element = this.validationTargetFor( this.clean( element ) ); + + var rules = $(element).rules(); + var dependencyMismatch = false; + var val = this.elementValue(element); + var result; + + for (var method in rules ) { + var rule = { method: method, parameters: rules[method] }; + try { + + result = $.validator.methods[method].call( this, val, element, rule.parameters ); + + // if a method indicates that the field is optional and therefore valid, + // don't mark it as valid when there are no other rules + if ( result === "dependency-mismatch" ) { + dependencyMismatch = true; + continue; + } + dependencyMismatch = false; + + if ( result === "pending" ) { + this.toHide = this.toHide.not( this.errorsFor(element) ); + return; + } + + if ( !result ) { + this.formatAndAdd( element, rule ); + return false; + } + } catch(e) { + if ( this.settings.debug && window.console ) { + console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e ); + } + throw e; + } + } + if ( dependencyMismatch ) { + return; + } + if ( this.objectLength(rules) ) { + this.successList.push(element); + } + return true; + }, + + // return the custom message for the given element and validation method + // specified in the element's HTML5 data attribute + customDataMessage: function( element, method ) { + return $(element).data("msg-" + method.toLowerCase()) || (element.attributes && $(element).attr("data-msg-" + method.toLowerCase())); + }, + + // return the custom message for the given element name and validation method + customMessage: function( name, method ) { + var m = this.settings.messages[name]; + return m && (m.constructor === String ? m : m[method]); + }, + + // return the first defined argument, allowing empty strings + findDefined: function() { + for(var i = 0; i < arguments.length; i++) { + if ( arguments[i] !== undefined ) { + return arguments[i]; + } + } + return undefined; + }, + + defaultMessage: function( element, method ) { + return this.findDefined( + this.customMessage( element.name, method ), + this.customDataMessage( element, method ), + // title is never undefined, so handle empty string as undefined + !this.settings.ignoreTitle && element.title || undefined, + $.validator.messages[method], + "Warning: No message defined for " + element.name + "" + ); + }, + + formatAndAdd: function( element, rule ) { + var message = this.defaultMessage( element, rule.method ), + theregex = /\$?\{(\d+)\}/g; + if ( typeof message === "function" ) { + message = message.call(this, rule.parameters, element); + } else if (theregex.test(message)) { + message = $.validator.format(message.replace(theregex, "{$1}"), rule.parameters); + } + this.errorList.push({ + message: message, + element: element + }); + + this.errorMap[element.name] = message; + this.submitted[element.name] = message; + }, + + addWrapper: function( toToggle ) { + if ( this.settings.wrapper ) { + toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); + } + return toToggle; + }, + + defaultShowErrors: function() { + var i, elements; + for ( i = 0; this.errorList[i]; i++ ) { + var error = this.errorList[i]; + if ( this.settings.highlight ) { + this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass ); + } + this.showLabel( error.element, error.message ); + } + if ( this.errorList.length ) { + this.toShow = this.toShow.add( this.containers ); + } + if ( this.settings.success ) { + for ( i = 0; this.successList[i]; i++ ) { + this.showLabel( this.successList[i] ); + } + } + if ( this.settings.unhighlight ) { + for ( i = 0, elements = this.validElements(); elements[i]; i++ ) { + this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass ); + } + } + this.toHide = this.toHide.not( this.toShow ); + this.hideErrors(); + this.addWrapper( this.toShow ).show(); + }, + + validElements: function() { + return this.currentElements.not(this.invalidElements()); + }, + + invalidElements: function() { + return $(this.errorList).map(function() { + return this.element; + }); + }, + + showLabel: function( element, message ) { + var label = this.errorsFor( element ); + if ( label.length ) { + // refresh error/success class + label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass ); + // replace message on existing label + label.html(message); + } else { + // create label + label = $("<" + this.settings.errorElement + ">") + .attr("for", this.idOrName(element)) + .addClass(this.settings.errorClass) + .html(message || ""); + if ( this.settings.wrapper ) { + // make sure the element is visible, even in IE + // actually showing the wrapped element is handled elsewhere + label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); + } + if ( !this.labelContainer.append(label).length ) { + if ( this.settings.errorPlacement ) { + this.settings.errorPlacement(label, $(element) ); + } else { + label.insertAfter(element); + } + } + } + if ( !message && this.settings.success ) { + label.text(""); + if ( typeof this.settings.success === "string" ) { + label.addClass( this.settings.success ); + } else { + this.settings.success( label, element ); + } + } + this.toShow = this.toShow.add(label); + }, + + errorsFor: function( element ) { + var name = this.idOrName(element); + return this.errors().filter(function() { + return $(this).attr("for") === name; + }); + }, + + idOrName: function( element ) { + return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name); + }, + + validationTargetFor: function( element ) { + // if radio/checkbox, validate first element in group instead + if ( this.checkable(element) ) { + element = this.findByName( element.name ).not(this.settings.ignore)[0]; + } + return element; + }, + + checkable: function( element ) { + return (/radio|checkbox/i).test(element.type); + }, + + findByName: function( name ) { + return $(this.currentForm).find("[name='" + name + "']"); + }, + + getLength: function( value, element ) { + switch( element.nodeName.toLowerCase() ) { + case "select": + return $("option:selected", element).length; + case "input": + if ( this.checkable( element) ) { + return this.findByName(element.name).filter(":checked").length; + } + } + return value.length; + }, + + depend: function( param, element ) { + return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true; + }, + + dependTypes: { + "boolean": function( param, element ) { + return param; + }, + "string": function( param, element ) { + return !!$(param, element.form).length; + }, + "function": function( param, element ) { + return param(element); + } + }, + + optional: function( element ) { + var val = this.elementValue(element); + return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch"; + }, + + startRequest: function( element ) { + if ( !this.pending[element.name] ) { + this.pendingRequest++; + this.pending[element.name] = true; + } + }, + + stopRequest: function( element, valid ) { + this.pendingRequest--; + // sometimes synchronization fails, make sure pendingRequest is never < 0 + if ( this.pendingRequest < 0 ) { + this.pendingRequest = 0; + } + delete this.pending[element.name]; + if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) { + $(this.currentForm).submit(); + this.formSubmitted = false; + } else if (!valid && this.pendingRequest === 0 && this.formSubmitted) { + $(this.currentForm).triggerHandler("invalid-form", [this]); + this.formSubmitted = false; + } + }, + + previousValue: function( element ) { + return $.data(element, "previousValue") || $.data(element, "previousValue", { + old: null, + valid: true, + message: this.defaultMessage( element, "remote" ) + }); + } + + }, + + classRuleSettings: { + required: {required: true}, + email: {email: true}, + url: {url: true}, + date: {date: true}, + dateISO: {dateISO: true}, + number: {number: true}, + digits: {digits: true}, + creditcard: {creditcard: true} + }, + + addClassRules: function( className, rules ) { + if ( className.constructor === String ) { + this.classRuleSettings[className] = rules; + } else { + $.extend(this.classRuleSettings, className); + } + }, + + classRules: function( element ) { + var rules = {}; + var classes = $(element).attr("class"); + if ( classes ) { + $.each(classes.split(" "), function() { + if ( this in $.validator.classRuleSettings ) { + $.extend(rules, $.validator.classRuleSettings[this]); + } + }); + } + return rules; + }, + + attributeRules: function( element ) { + var rules = {}; + var $element = $(element); + var type = $element[0].getAttribute("type"); + + for (var method in $.validator.methods) { + var value; + + // support for in both html5 and older browsers + if ( method === "required" ) { + value = $element.get(0).getAttribute(method); + // Some browsers return an empty string for the required attribute + // and non-HTML5 browsers might have required="" markup + if ( value === "" ) { + value = true; + } + // force non-HTML5 browsers to return bool + value = !!value; + } else { + value = $element.attr(method); + } + + // convert the value to a number for number inputs, and for text for backwards compability + // allows type="date" and others to be compared as strings + if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) { + value = Number(value); + } + + if ( value ) { + rules[method] = value; + } else if ( type === method && type !== 'range' ) { + // exception: the jquery validate 'range' method + // does not test for the html5 'range' type + rules[method] = true; + } + } + + // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs + if ( rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength) ) { + delete rules.maxlength; + } + + return rules; + }, + + dataRules: function( element ) { + var method, value, + rules = {}, $element = $(element); + for (method in $.validator.methods) { + value = $element.data("rule-" + method.toLowerCase()); + if ( value !== undefined ) { + rules[method] = value; + } + } + return rules; + }, + + staticRules: function( element ) { + var rules = {}; + var validator = $.data(element.form, "validator"); + if ( validator.settings.rules ) { + rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {}; + } + return rules; + }, + + normalizeRules: function( rules, element ) { + // handle dependency check + $.each(rules, function( prop, val ) { + // ignore rule when param is explicitly false, eg. required:false + if ( val === false ) { + delete rules[prop]; + return; + } + if ( val.param || val.depends ) { + var keepRule = true; + switch (typeof val.depends) { + case "string": + keepRule = !!$(val.depends, element.form).length; + break; + case "function": + keepRule = val.depends.call(element, element); + break; + } + if ( keepRule ) { + rules[prop] = val.param !== undefined ? val.param : true; + } else { + delete rules[prop]; + } + } + }); + + // evaluate parameters + $.each(rules, function( rule, parameter ) { + rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter; + }); + + // clean number parameters + $.each(['minlength', 'maxlength'], function() { + if ( rules[this] ) { + rules[this] = Number(rules[this]); + } + }); + $.each(['rangelength', 'range'], function() { + var parts; + if ( rules[this] ) { + if ( $.isArray(rules[this]) ) { + rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; + } else if ( typeof rules[this] === "string" ) { + parts = rules[this].split(/[\s,]+/); + rules[this] = [Number(parts[0]), Number(parts[1])]; + } + } + }); + + if ( $.validator.autoCreateRanges ) { + // auto-create ranges + if ( rules.min && rules.max ) { + rules.range = [rules.min, rules.max]; + delete rules.min; + delete rules.max; + } + if ( rules.minlength && rules.maxlength ) { + rules.rangelength = [rules.minlength, rules.maxlength]; + delete rules.minlength; + delete rules.maxlength; + } + } + + return rules; + }, + + // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} + normalizeRule: function( data ) { + if ( typeof data === "string" ) { + var transformed = {}; + $.each(data.split(/\s/), function() { + transformed[this] = true; + }); + data = transformed; + } + return data; + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/addMethod + addMethod: function( name, method, message ) { + $.validator.methods[name] = method; + $.validator.messages[name] = message !== undefined ? message : $.validator.messages[name]; + if ( method.length < 3 ) { + $.validator.addClassRules(name, $.validator.normalizeRule(name)); + } + }, + + methods: { + + // http://docs.jquery.com/Plugins/Validation/Methods/required + required: function( value, element, param ) { + // check if dependency is met + if ( !this.depend(param, element) ) { + return "dependency-mismatch"; + } + if ( element.nodeName.toLowerCase() === "select" ) { + // could be an array for select-multiple or a string, both are fine this way + var val = $(element).val(); + return val && val.length > 0; + } + if ( this.checkable(element) ) { + return this.getLength(value, element) > 0; + } + return $.trim(value).length > 0; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/email + email: function( value, element ) { + // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ + return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/url + url: function( value, element ) { + // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/ + return this.optional(element) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/date + date: function( value, element ) { + return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString()); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/dateISO + dateISO: function( value, element ) { + return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/number + number: function( value, element ) { + return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/digits + digits: function( value, element ) { + return this.optional(element) || /^\d+$/.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/creditcard + // based on http://en.wikipedia.org/wiki/Luhn + creditcard: function( value, element ) { + if ( this.optional(element) ) { + return "dependency-mismatch"; + } + // accept only spaces, digits and dashes + if ( /[^0-9 \-]+/.test(value) ) { + return false; + } + var nCheck = 0, + nDigit = 0, + bEven = false; + + value = value.replace(/\D/g, ""); + + for (var n = value.length - 1; n >= 0; n--) { + var cDigit = value.charAt(n); + nDigit = parseInt(cDigit, 10); + if ( bEven ) { + if ( (nDigit *= 2) > 9 ) { + nDigit -= 9; + } + } + nCheck += nDigit; + bEven = !bEven; + } + + return (nCheck % 10) === 0; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/minlength + minlength: function( value, element, param ) { + var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); + return this.optional(element) || length >= param; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/maxlength + maxlength: function( value, element, param ) { + var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); + return this.optional(element) || length <= param; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/rangelength + rangelength: function( value, element, param ) { + var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); + return this.optional(element) || ( length >= param[0] && length <= param[1] ); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/min + min: function( value, element, param ) { + return this.optional(element) || value >= param; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/max + max: function( value, element, param ) { + return this.optional(element) || value <= param; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/range + range: function( value, element, param ) { + return this.optional(element) || ( value >= param[0] && value <= param[1] ); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/equalTo + equalTo: function( value, element, param ) { + // bind to the blur event of the target in order to revalidate whenever the target field is updated + // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead + var target = $(param); + if ( this.settings.onfocusout ) { + target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function() { + $(element).valid(); + }); + } + return value === target.val(); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/remote + remote: function( value, element, param ) { + if ( this.optional(element) ) { + return "dependency-mismatch"; + } + + var previous = this.previousValue(element); + if (!this.settings.messages[element.name] ) { + this.settings.messages[element.name] = {}; + } + previous.originalMessage = this.settings.messages[element.name].remote; + this.settings.messages[element.name].remote = previous.message; + + param = typeof param === "string" && {url:param} || param; + + if ( previous.old === value ) { + return previous.valid; + } + + previous.old = value; + var validator = this; + this.startRequest(element); + var data = {}; + data[element.name] = value; + $.ajax($.extend(true, { + url: param, + mode: "abort", + port: "validate" + element.name, + dataType: "json", + data: data, + success: function( response ) { + validator.settings.messages[element.name].remote = previous.originalMessage; + var valid = response === true || response === "true"; + if ( valid ) { + var submitted = validator.formSubmitted; + validator.prepareElement(element); + validator.formSubmitted = submitted; + validator.successList.push(element); + delete validator.invalid[element.name]; + validator.showErrors(); + } else { + var errors = {}; + var message = response || validator.defaultMessage( element, "remote" ); + errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message; + validator.invalid[element.name] = true; + validator.showErrors(errors); + } + previous.valid = valid; + validator.stopRequest(element, valid); + } + }, param)); + return "pending"; + } + + } + +}); + +// deprecated, use $.validator.format instead +$.format = $.validator.format; + +}(jQuery)); + +// ajax mode: abort +// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); +// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() +(function($) { + var pendingRequests = {}; + // Use a prefilter if available (1.5+) + if ( $.ajaxPrefilter ) { + $.ajaxPrefilter(function( settings, _, xhr ) { + var port = settings.port; + if ( settings.mode === "abort" ) { + if ( pendingRequests[port] ) { + pendingRequests[port].abort(); + } + pendingRequests[port] = xhr; + } + }); + } else { + // Proxy ajax + var ajax = $.ajax; + $.ajax = function( settings ) { + var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, + port = ( "port" in settings ? settings : $.ajaxSettings ).port; + if ( mode === "abort" ) { + if ( pendingRequests[port] ) { + pendingRequests[port].abort(); + } + pendingRequests[port] = ajax.apply(this, arguments); + return pendingRequests[port]; + } + return ajax.apply(this, arguments); + }; + } +}(jQuery)); + +// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation +// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target +(function($) { + $.extend($.fn, { + validateDelegate: function( delegate, type, handler ) { + return this.bind(type, function( event ) { + var target = $(event.target); + if ( target.is(delegate) ) { + return handler.apply(target, arguments); + } + }); + } + }); +}(jQuery));
    Article