<No commit messages entered>

This commit is contained in:
What.CD 2011-07-04 08:00:07 +00:00
parent e02ee62aa9
commit e61aa7c115
14 changed files with 21 additions and 23 deletions

View File

@ -125,13 +125,6 @@ function foot() {
</select> </select>
</td> </td>
</tr> </tr>
<tr id="grace">
<td class="label">Extended Grace</td>
<td>
<input type="checkbox" name="extendedgrace"<?=$Torrent['ExtendedGrace']? ' checked="checked"' : ''?> /> Checking this box extendes the grace period for this torrent.
</td>
</tr>
<? <?
} }
} }

View File

@ -1439,6 +1439,11 @@ function check_perms($PermissionName,$MinClass = 0) {
return (isset($LoggedUser['Permissions'][$PermissionName]) && $LoggedUser['Permissions'][$PermissionName] && $LoggedUser['Class']>=$MinClass)?true:false; return (isset($LoggedUser['Permissions'][$PermissionName]) && $LoggedUser['Permissions'][$PermissionName] && $LoggedUser['Class']>=$MinClass)?true:false;
} }
// TODO: make stricter, e.g. on all whitespace characters or Unicode normalisation
function normalise_artist_name($ArtistName) {
return trim(preg_replace('/ +/', ' ', $ArtistName));
}
function get_artists($GroupIDs, $Escape = array()) { function get_artists($GroupIDs, $Escape = array()) {
global $Cache, $DB; global $Cache, $DB;
$Results = array(); $Results = array();

View File

@ -78,6 +78,10 @@ CREATE TABLE `artists_tags` (
KEY `UserID` (`UserID`) KEY `UserID` (`UserID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `bad_passwords` (
`Password` char(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `blog` ( CREATE TABLE `blog` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT, `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`UserID` int(10) unsigned NOT NULL, `UserID` int(10) unsigned NOT NULL,

View File

@ -4,7 +4,7 @@
if(!check_perms('torrents_edit')) { error(403); } if(!check_perms('torrents_edit')) { error(403); }
$ArtistID = $_POST['artistid']; $ArtistID = $_POST['artistid'];
$Redirect = $_POST['redirect']; $Redirect = $_POST['redirect'];
$AliasName = db_string($_POST['name']); $AliasName = db_string(normalise_artist_name($_POST['name']));
if(!$Redirect) { $Redirect = 0; } if(!$Redirect) { $Redirect = 0; }
if(!is_number($ArtistID) || !($Redirect === 0 || is_number($Redirect)) || !$ArtistID) { if(!is_number($ArtistID) || !($Redirect === 0 || is_number($Redirect)) || !$ArtistID) {

View File

@ -23,7 +23,7 @@
authorize(); authorize();
$ArtistID = $_POST['artistid']; $ArtistID = $_POST['artistid'];
$NewName = $_POST['name']; $NewName = normalise_artist_name($_POST['name']);
if(!$ArtistID || !is_number($ArtistID)) { error(404); } if(!$ArtistID || !is_number($ArtistID)) { error(404); }

View File

@ -103,11 +103,12 @@ function compare($X, $Y){
// Start an output buffer, so we can store this output in $TorrentTable // Start an output buffer, so we can store this output in $TorrentTable
ob_start(); ob_start();
if(count($Torrents)>1 || $GroupCategoryID==1) { if(count($Torrents)>1 || $GroupCategoryID==1) {
// Grouped torrents // Grouped torrents
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
?> ?>
<tr class="group discog" id="group_<?=$GroupID?>"> <tr class="group discog" id="group_<?=$GroupID?>">
<td class="center"> <td class="center">
<div title="View" id="showimg_<?=$GroupID?>" class="hide_torrents"> <div title="View" id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
<a href="#" class="show_torrents_link" onclick="ToggleGroup(<?=$GroupID?>); return false;"></a> <a href="#" class="show_torrents_link" onclick="ToggleGroup(<?=$GroupID?>); return false;"></a>
</div> </div>
</td> </td>

View File

@ -33,7 +33,7 @@
if($FeaturedAlbum === false) { if($FeaturedAlbum === false) {
$DB->query("SELECT fa.GroupID, tg.Name, tg.WikiImage, fa.ThreadID, fa.Title FROM featured_albums AS fa JOIN torrents_group AS tg ON tg.ID=fa.GroupID WHERE Ended = 0"); $DB->query("SELECT fa.GroupID, tg.Name, tg.WikiImage, fa.ThreadID, fa.Title FROM featured_albums AS fa JOIN torrents_group AS tg ON tg.ID=fa.GroupID WHERE Ended = 0");
$FeaturedAlbum = $DB->next_record(); $FeaturedAlbum = $DB->next_record();
$FeaturedAlbum['WikiImage'] = 'http://i.imgur.com/4xaAx.png';
$Cache->cache_value('featured_album', $FeaturedAlbum, 0); $Cache->cache_value('featured_album', $FeaturedAlbum, 0);
} }
if(is_number($FeaturedAlbum['GroupID'])) { if(is_number($FeaturedAlbum['GroupID'])) {

View File

@ -13,7 +13,7 @@
$Changed = false; $Changed = false;
for($i = 0; $i < count($AliasNames); $i++) { for($i = 0; $i < count($AliasNames); $i++) {
$AliasName = trim($AliasNames[$i]); $AliasName = normalise_artist_name($AliasNames[$i]);
$Importance = $Importances[$i]; $Importance = $Importances[$i];
if($Importance!='1' && $Importance!='2' && $Importance!='3') { if($Importance!='1' && $Importance!='2' && $Importance!='3') {

View File

@ -695,7 +695,7 @@ function header_link($SortKey,$DefaultWay="desc") {
<tr class="group"> <tr class="group">
<td class="center"> <td class="center">
<? <?
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1) $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
?> ?>
<div title="View" id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents"> <div title="View" id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
<a href="#" class="show_torrents_link" onclick="ToggleGroup(<?=$GroupID?>); return false;"></a> <a href="#" class="show_torrents_link" onclick="ToggleGroup(<?=$GroupID?>); return false;"></a>

View File

@ -293,7 +293,7 @@ function filelist($Str) {
list($TorrentID, $Media, $Format, $Encoding, $Remastered, $RemasterYear, $RemasterTitle, $RemasterRecordLabel, $RemasterCatalogueNumber, list($TorrentID, $Media, $Format, $Encoding, $Remastered, $RemasterYear, $RemasterTitle, $RemasterRecordLabel, $RemasterCatalogueNumber,
$Scene, $HasLog, $HasCue, $LogScore, $FileCount, $Size, $Seeders, $Leechers, $Snatched, $FreeTorrent, $TorrentTime, $Description, $Scene, $HasLog, $HasCue, $LogScore, $FileCount, $Size, $Seeders, $Leechers, $Snatched, $FreeTorrent, $TorrentTime, $Description,
$FileList, $FilePath, $UserID, $Username, $LastActive, $BadTags, $BadFolders, $BadFiles, $LastReseedRequest, $LogInDB, $HasFile, $ExtendedGrace) = $Torrent; $FileList, $FilePath, $UserID, $Username, $LastActive, $BadTags, $BadFolders, $BadFiles, $LastReseedRequest, $LogInDB, $HasFile) = $Torrent;
if($Remastered && !$RemasterYear) { if($Remastered && !$RemasterYear) {
if(!isset($FirstUnknown)) { if(!isset($FirstUnknown)) {
@ -372,7 +372,6 @@ function filelist($Str) {
if(!empty($BadTags)) { $ExtraInfo.=$AddExtra.'<strong>Bad Tags</strong>'; $AddExtra=' / '; } if(!empty($BadTags)) { $ExtraInfo.=$AddExtra.'<strong>Bad Tags</strong>'; $AddExtra=' / '; }
if(!empty($BadFolders)) { $ExtraInfo.=$AddExtra.'<strong>Bad Folders</strong>'; $AddExtra=' / '; } if(!empty($BadFolders)) { $ExtraInfo.=$AddExtra.'<strong>Bad Folders</strong>'; $AddExtra=' / '; }
if(!empty($BadFiles)) { $ExtraInfo.=$AddExtra.'<strong>Bad File Names</strong>'; $AddExtra=' / '; } if(!empty($BadFiles)) { $ExtraInfo.=$AddExtra.'<strong>Bad File Names</strong>'; $AddExtra=' / '; }
if (!empty($ExtendedGrace)) { $ExtraInfo.=$AddExtra.'<strong>Extended Grace Period</strong>'; $AddExtra=' / '; }
if($GroupCategoryID == 1 if($GroupCategoryID == 1
&& ($RemasterTitle != $LastRemasterTitle && ($RemasterTitle != $LastRemasterTitle

View File

@ -38,7 +38,6 @@
t.HasLog, t.HasLog,
t.HasCue, t.HasCue,
t.LogScore, t.LogScore,
t.ExtendedGrace,
bt.TorrentID AS BadTags, bt.TorrentID AS BadTags,
bf.TorrentID AS BadFolders, bf.TorrentID AS BadFolders,
bfi.TorrentID AS BadFiles bfi.TorrentID AS BadFiles

View File

@ -87,8 +87,7 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
tfi.TorrentID, tfi.TorrentID,
t.LastReseedRequest, t.LastReseedRequest,
tln.TorrentID AS LogInDB, tln.TorrentID AS LogInDB,
t.ID AS HasFile, t.ID AS HasFile
t.ExtendedGrace
FROM torrents AS t FROM torrents AS t
LEFT JOIN users_main AS um ON um.ID=t.UserID LEFT JOIN users_main AS um ON um.ID=t.UserID
LEFT JOIN torrents_bad_tags AS tbt ON tbt.TorrentID=t.ID LEFT JOIN torrents_bad_tags AS tbt ON tbt.TorrentID=t.ID

View File

@ -61,7 +61,6 @@
} }
$Properties['FreeLeech'] = $Free; $Properties['FreeLeech'] = $Free;
} }
$Properties['ExtendedGrace'] = (isset($_POST['extendedgrace']))? 1 : 0;
//******************************************************************************// //******************************************************************************//
//--------------- Validate data in edit form -----------------------------------// //--------------- Validate data in edit form -----------------------------------//
@ -260,8 +259,7 @@
RemasterRecordLabel=$T[RemasterRecordLabel], RemasterRecordLabel=$T[RemasterRecordLabel],
RemasterCatalogueNumber=$T[RemasterCatalogueNumber], RemasterCatalogueNumber=$T[RemasterCatalogueNumber],
Scene=$T[Scene], Scene=$T[Scene],
Description=$T[TorrentDescription], Description=$T[TorrentDescription],";
ExtendedGrace=$T[ExtendedGrace],";
if(check_perms('torrents_freeleech')) { if(check_perms('torrents_freeleech')) {
$SQL .= "FreeTorrent=$T[FreeLeech],"; $SQL .= "FreeTorrent=$T[FreeLeech],";

View File

@ -270,7 +270,7 @@
for($i = 0, $il = count($Artists); $i < $il; $i++) { for($i = 0, $il = count($Artists); $i < $il; $i++) {
if(trim($Artists[$i]) != "") { if(trim($Artists[$i]) != "") {
if(!in_array($Artists[$i], trim($ArtistNames))) { if(!in_array($Artists[$i], trim($ArtistNames))) {
$ArtistForm[$Importance[$i]][] = array('name' => trim($Artists[$i])); $ArtistForm[$Importance[$i]][] = array('name' => normalise_artist_name($Artists[$i]));
if($Importance[$i] == 1) { if($Importance[$i] == 1) {
$MainArtistCount++; $MainArtistCount++;
} }