Adding a recommended artist will automatically NL the entire group

Finished adding [code] tag

Merging groups no longer wipes comments

Group comments are no longer lost on merge

Fixing incorrect equality

Added the freeleech_torrents() and freeleech_groups() functions, testing on vanity house addition

Implementing new freeleech functions for torrent and group editing

Implementing better.php filter for seeding

Separating staff and forum staff within staff functions
This commit is contained in:
What.CD 2011-07-10 08:00:06 +00:00
parent 5aa0471e66
commit 89aa3f46e3
18 changed files with 239 additions and 51 deletions

View File

@ -1,7 +1,7 @@
<?
class TEXT {
// tag=>max number of attributes
private $ValidTags = array('b'=>0, 'u'=>0, 'i'=>0, 's'=>0, '*'=>0, 'artist'=>0, 'user'=>0, 'n'=>0, 'inlineurl'=>0, 'inlinesize'=>1, 'align'=>1, 'color'=>1, 'colour'=>1, 'size'=>1, 'url'=>1, 'img'=>1, 'quote'=>1, 'pre'=>1, 'tex'=>0, 'hide'=>1, 'plain'=>0
private $ValidTags = array('b'=>0, 'u'=>0, 'i'=>0, 's'=>0, '*'=>0, 'artist'=>0, 'user'=>0, 'n'=>0, 'inlineurl'=>0, 'inlinesize'=>1, 'align'=>1, 'color'=>1, 'colour'=>1, 'size'=>1, 'url'=>1, 'img'=>1, 'quote'=>1, 'pre'=>1, 'code'=>1, 'tex'=>0, 'hide'=>1, 'plain'=>0
);
private $Smileys = array(
':angry:' => 'angry.gif',
@ -11,8 +11,7 @@ class TEXT {
':-|' => 'blank.gif',
':blush:' => 'blush.gif',
':cool:' => 'cool.gif',
':\'(' => 'crying.gif',
':*(' => 'crying.gif',
':&#39;(' => 'crying.gif',
':crying:' => 'crying.gif',
'&gt;.&gt;' => 'eyesright.gif',
':frown:' => 'frown.gif',
@ -43,6 +42,7 @@ class TEXT {
':-P' => 'tongue.gif',
':-p' => 'tongue.gif',
':wave:' => 'wave.gif',
';-)' => 'wink.gif',
':wink:' => 'wink.gif',
':creepy:' => 'creepy.gif',
':worried:' => 'worried.gif',
@ -64,9 +64,13 @@ function full_format($Str) {
$Str = display_str($Str);
//Inline links
$Str = preg_replace('/(?<!(\[url\]|\[url\=|\[img\=|\[img\]))http(s)?:\/\//i', '$1[inlineurl]http$2://', $Str);
// For anonym.to links. We can't have this in the regex because php freaks out at the ?, even if it's escaped
$Str = strtr($Str, array('?[inlineurl]http'=>'?http', '=[inlineurl]http'=>'=http'));
$URLPrefix = '(\[url\]|\[url\=|\[img\=|\[img\])';
$Str = preg_replace('/'.$URLPrefix.'\s+/i', '$1', $Str);
$Str = preg_replace('/(?<!'.$URLPrefix.')http(s)?:\/\//i', '$1[inlineurl]http$2://', $Str);
// For anonym.to and archive.org links, remove any [inlineurl] in the middle of the link
$callback = create_function('$matches', 'return str_replace("[inlineurl]","",$matches[0]);');
$Str = preg_replace_callback('/(?<=\[inlineurl\]|'.$URLPrefix.')(\S*\[inlineurl\]\S*)/m', $callback, $Str);
$Str = preg_replace('/\=\=\=\=([^=].*)\=\=\=\=/i', '[inlinesize=3]$1[/inlinesize]', $Str);
$Str = preg_replace('/\=\=\=([^=].*)\=\=\=/i', '[inlinesize=5]$1[/inlinesize]', $Str);
$Str = preg_replace('/\=\=([^=].*)\=\=/i', '[inlinesize=7]$1[/inlinesize]', $Str);
@ -104,16 +108,16 @@ function valid_url($Str, $Extension = '', $Inline = false) {
$Regex .= ')';
$Regex .= '(:[0-9]{1,5})?'; // port
$Regex .= '\/?'; // slash?
$Regex .= '(\/?[0-9a-z\-_.,&=@~%\/:;()+!#]+)*'; // /file
$Regex .= '(\/?[0-9a-z\-_.,&=@~%\/:;()+|!#]+)*'; // /file
if(!empty($Extension)) {
$Regex.=$Extension;
}
// query string
if ($Inline) {
$Regex .= '(\?([0-9a-z\-_.,%\/\@~&=:;()+*\^$!#]|\[\d*\])*)?';
$Regex .= '(\?([0-9a-z\-_.,%\/\@~&=:;()+*\^$!#|]|\[\d*\])*)?';
} else {
$Regex .= '(\?[0-9a-z\-_.,%\/\@[\]~&=:;()+*\^$!#]*)?';
$Regex .= '(\?[0-9a-z\-_.,%\/\@[\]~&=:;()+*\^$!#|]*)?';
}
$Regex .= '(#[a-z0-9\-_.,%\/\@[\]~&=:;()+*\^$!]*)?'; // #anchor
@ -370,13 +374,14 @@ function parse($Str) {
$Array[$ArrayPos] = array('Type'=>'tex', 'Val'=>$Block);
break;
case 'pre':
case 'code':
case 'plain':
$Block = strtr($Block, array('[inlineurl]'=>''));
$Block = preg_replace('/\[inlinesize\=3\](.*?)\[\/inlinesize\]/i', '====$1====', $Block);
$Block = preg_replace('/\[inlinesize\=5\](.*?)\[\/inlinesize\]/i', '===$1===', $Block);
$Block = preg_replace('/\[inlinesize\=7\](.*?)\[\/inlinesize\]/i', '==$1==', $Block);
$Array[$ArrayPos] = array('Type'=>$TagName, 'Val'=>htmlspecialchars($Block)); // double escape
$Array[$ArrayPos] = array('Type'=>$TagName, 'Val'=>$Block);
break;
case 'hide':
$Array[$ArrayPos] = array('Type'=>'hide', 'Attr'=>$Attrib, 'Val'=>$this->parse($Block));
@ -437,7 +442,7 @@ function to_html($Array) {
$Str.='<a href="user.php?action=search&amp;search='.urlencode($Block['Val']).'">'.$Block['Val'].'</a>';
break;
case 'artist':
$Str.='<a href="artist.php?artistname='.urlencode(mb_convert_encoding($Block['Val'],"UTF-8","HTML-ENTITIES")).'">'.$Block['Val'].'</a>';
$Str.='<a href="artist.php?artistname='.urlencode(undisplay_str($Block['Val'])).'">'.$Block['Val'].'</a>';
break;
case 'wiki':
$Str.='<a href="wiki.php?action=article&amp;name='.urlencode($Block['Val']).'">'.$Block['Val'].'</a>';
@ -451,6 +456,9 @@ function to_html($Array) {
case 'pre':
$Str.='<pre>'.$Block['Val'].'</pre>';
break;
case 'code':
$Str.='<code>'.$Block['Val'].'</code>';
break;
case 'list':
$Str .= '<ul>';
foreach($Block['Val'] as $Line) {
@ -599,6 +607,7 @@ function raw_text($Array) {
case 'user':
case 'wiki':
case 'pre':
case 'code':
case 'aud':
case 'img':
$Str.=$Block['Val'];

View File

@ -121,6 +121,13 @@ function foot() {
<? $FL = array("Normal", "Free", "Neutral");
foreach($FL as $Key => $Name) { ?>
<option value="<?=$Key?>" <?=($Key == $Torrent['FreeTorrent'] ? ' selected="selected"' : '')?>><?=$Name?></option>
<? } ?>
</select>
because
<select name="freeleechtype">
<? $FL = array("N/A", "Staff Pick", "Perma-FL", "Vanity House");
foreach($FL as $Key => $Name) { ?>
<option value="<?=$Key?>" <?=($Key == $Torrent['FreeLeechType'] ? ' selected="selected"' : '')?>><?=$Name?></option>
<? } ?>
</select>
</td>

View File

@ -331,6 +331,7 @@ function user_heavy_info($UserID) {
m.torrent_pass,
m.IP,
m.CustomPermissions,
m.can_leech AS CanLeech,
i.AuthKey,
i.RatioWatchEnds,
i.RatioWatchDownload,
@ -854,6 +855,11 @@ function display_str($Str) {
return $Str;
}
// Use sparingly
function undisplay_str($Str) {
return mb_convert_encoding($Str, 'UTF-8', 'HTML-ENTITIES');
}
function make_utf8($Str) {
if ($Str!="") {
if (is_utf8($Str)) { $Encoding="UTF-8"; }
@ -1164,7 +1170,7 @@ function warn_user($UserID, $Duration, $Reason) {
send_pm($UserID, 0, db_string("You have received multiple warnings."), db_string("When you received your latest warning (Set to expire on ".date("Y-m-d", (time() + $Duration))."), you already had a different warning (Set to expire on ".date("Y-m-d", strtotime($OldDate)).").\n\n Due to this collision, your warning status will now expire at ".$NewExpDate."."));
$AdminComment = date("Y-m-d").' - Warning (Clash) extended to expire at '.$NewExpDate.' by '.$LoggedUser['Username']."\nReason: $Reason\n";
$AdminComment = date("Y-m-d").' - Warning (Clash) extended to expire at '.$NewExpDate.' by '.$LoggedUser['Username']."\nReason: $Reason\n\n";
$DB->query('UPDATE users_info SET
Warned=\''.db_string($NewExpDate).'\',
@ -1179,7 +1185,7 @@ function warn_user($UserID, $Duration, $Reason) {
$Cache->update_row(false, array('Warned' => $WarnTime));
$Cache->commit_transaction(0);
$AdminComment = "\n".date("Y-m-d").' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $Reason\n";
$AdminComment = "\n".date("Y-m-d").' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $Reason\n\n";
$DB->query('UPDATE users_info SET
Warned=\''.db_string($WarnTime).'\',
@ -1249,6 +1255,14 @@ function update_hash($GroupID) {
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('torrent_group_'.$GroupID);
$ArtistInfo = get_artist($GroupID);
foreach($ArtistInfo as $Importances => $Importance) {
foreach($Importance as $Artist) {
$Cache->delete_value('artist_'.$Artist['id']); //Needed for at least freeleech change, if not others.
}
}
$Cache->delete_value('groups_artists_'.$GroupID);
}
@ -1929,6 +1943,49 @@ function in_array_partial($Needle, $Haystack) {
return false;
}
/**
* Will freeleech / neutralleech / normalise a set of torrents
* @param array $TorrentIDs An array of torrents IDs to iterate over
* @param int $FreeNeutral 0 = normal, 1 = fl, 2 = nl
* @param int $FreeLeechType 0 = Unknown, 1 = Staff picks, 2 = Perma-FL (Toolbox, etc.), 3 = Vanity House
*/
function freeleech_torrents($TorrentIDs, $FreeNeutral = 1, $FreeLeechType = 0) {
global $DB;
if(!is_array($TorrentIDs)) {
$TorrentIDs = array($TorrentIDs);
}
$DB->query("UPDATE torrents SET FreeTorrent = '".$FreeNeutral."', FreeLeechType = '".$FreeLeechType."' WHERE ID IN (".implode(", ", $TorrentIDs).")");
$DB->query("SELECT ID, GroupID, info_hash FROM torrents WHERE ID IN (".implode(", ", $TorrentIDs).") ORDER BY GroupID ASC");
$Torrents = $DB->to_array(false, MYSQLI_NUM, false);
$GroupIDs = $DB->collect('GroupID');
foreach($Torrents as $Torrent) {
list($TorrentID, $GroupID, $InfoHash) = $Torrent;
update_tracker('update_torrent', array('info_hash' => rawurlencode($InfoHash), 'freetorrent' => $FreeNeutral));
}
foreach($GroupIDs as $GroupID) {
update_hash($GroupID);
}
}
/**
* Convenience function to allow for passing groups to freeleech_torrents()
*/
function freeleech_groups($GroupIDs, $FreeNeutral = 1, $FreeLeechType = 0) {
global $DB;
if(!is_array($GroupIDs)) {
$GroupIDs = array($GroupIDs);
}
$DB->query("SELECT ID from torrents WHERE GroupID IN (".implode(", ", $GroupIDs).")");
$TorrentIDs = $DB->collect('ID');
freeleech_torrents($TorrentIDs, $FreeNeutral, $FreeLeechType);
}
$Debug->set_flag('ending function definitions');

View File

@ -200,8 +200,10 @@
$Alerts[] = '<a href="inbox.php">'.'You have '.$NewMessages.(($NewMessages > 1) ? ' new messages' : ' new message').'</a>';
}
if($LoggedUser['RatioWatch']){
if($LoggedUser['RatioWatch']) {
$Alerts[] = '<a href="rules.php?p=ratio">'.'Ratio Watch'.'</a>: '.'You have '.time_diff($LoggedUser['RatioWatchEnds'], 3).' to get your ratio over your required ratio.';
} else if($LoggedUser['CanLeech'] != 1) {
$Alerts[] = '<a href="rules.php?p=ratio">'.'Ratio Watch'.'</a>: '.'Your downloading privileges are disabled until you meet your required ratio.';
}
if (check_perms('site_torrents_notify')) {

View File

@ -10,20 +10,25 @@
$UserID = $LoggedUser['ID'];
}
if(!empty($_GET['filter']) && $_GET['filter'] == 'seeding') {
$SeedingOnly = true;
} else {
$SeedingOnly = false;
}
// Get list of FLAC snatches
$DB->query("SELECT t.GroupID, xs.fid
FROM xbt_snatched AS xs
JOIN torrents AS t ON t.ID=xs.fid
WHERE
t.Format='FLAC'
AND ((t.LogScore = '100' AND t.Media = 'CD')
OR t.Media = 'Vinyl')
AND xs.uid='$UserID'");
$DB->query("SELECT t.GroupID, x.fid
FROM ".($SeedingOnly ? 'xbt_files_users' : 'xbt_snatched')." AS x
JOIN torrents AS t ON t.ID=x.fid
WHERE t.Format='FLAC'
AND ((t.LogScore = '100' AND t.Media = 'CD')
OR t.Media = 'Vinyl')
AND x.uid='$UserID'");
$SnatchedGroupIDs = $DB->collect('GroupID');
$Snatches = $DB->to_array('GroupID');
if(count($SnatchedGroupIDs) == 0) { error('You haven\'t snatched any 100% flacs!'); }
if(count($SnatchedGroupIDs) == 0) { error(($SeedingOnly ? "You aren't seeding any 100% FLACs!" : "You haven't snatched any 100% FLACs!")); }
// Create hash table
$DB->query("CREATE TEMPORARY TABLE t
@ -48,6 +53,13 @@
show_header('Transcode Snatches');
?>
<div class="linkbox">
<? if($SeedingOnly) { ?>
<a href="better.php?method=snatch">Show all</a>
<? } else { ?>
<a href="better.php?method=snatch&amp;filter=seeding">Just those currently seeding</a>
<? } ?>
</div>
<div class="thin">
<table width="100%">
<tr class="colhead">

View File

@ -5,12 +5,17 @@
if($_POST['collage_id'] && is_number($_POST['collage_id'])) {
authorize();
$CollageID = $_POST['collage_id'];
$DB->query("UPDATE collages SET Deleted = '0' WHERE ID=$CollageID");
$Cache->delete_value('collage_'.$CollageID);
write_log("Collage ".$CollageID." was recovered by ".$LoggedUser['Username']);
header("Location: collages.php?id=$CollageID");
$DB->query("SELECT Name FROM collages WHERE ID = ".$CollageID);
if($DB->record_count() == 0) {
error('Collage is completely deleted');
} else {
$DB->query("UPDATE collages SET Deleted = '0' WHERE ID=$CollageID");
$Cache->delete_value('collage_'.$CollageID);
write_log("Collage ".$CollageID." was recovered by ".$LoggedUser['Username']);
header("Location: collages.php?id=$CollageID");
}
}
show_header("Collage recovery!");
?>

View File

@ -394,7 +394,7 @@ function next_hour() {
foreach($OffRatioWatch as $UserID) {
$Cache->begin_transaction('user_info_heavy_'.$UserID);
$Cache->update_row(false, array('RatioWatchEnds'=>'0000-00-00 00:00:00','RatioWatchDownload'=>'0'));
$Cache->update_row(false, array('RatioWatchEnds'=>'0000-00-00 00:00:00','RatioWatchDownload'=>'0','CanLeech'=>1));
$Cache->commit_transaction(0);
send_pm($UserID, 0, db_string("You have been taken off Ratio Watch"), db_string("Congratulations! Feel free to begin downloading again.\n To ensure that you do not get put on ratio watch again, please read the rules located [url=http://".NONSSL_SITE_URL."/rules.php?p=ratio]here[/url].\n"), '');
echo "Ratio watch off: $UserID\n";
@ -422,7 +422,7 @@ function next_hour() {
foreach($OffRatioWatch as $UserID) {
$Cache->begin_transaction('user_info_heavy_'.$UserID);
$Cache->update_row(false, array('RatioWatchEnds'=>'0000-00-00 00:00:00','RatioWatchDownload'=>'0'));
$Cache->update_row(false, array('RatioWatchEnds'=>'0000-00-00 00:00:00','RatioWatchDownload'=>'0','CanLeech'=>1));
$Cache->commit_transaction(0);
send_pm($UserID, 0, db_string("You have been taken off Ratio Watch"), db_string("Congratulations! Feel free to begin downloading again.\n To ensure that you do not get put on ratio watch again, please read the rules located [url=http://".NONSSL_SITE_URL."/rules.php?p=ratio]here[/url].\n"), '');
echo "Ratio watch off: $UserID\n";
@ -496,7 +496,7 @@ function next_hour() {
foreach($UserIDs as $UserID) {
$Cache->begin_transaction('user_info_heavy_'.$UserID);
$Cache->update_row(false, array('RatioWatchDownload'=>0));
$Cache->update_row(false, array('RatioWatchDownload'=>0, 'CanLeech'=>0));
$Cache->commit_transaction(0);
send_pm($UserID, 0, db_string("Your downloading rights have been disabled"), db_string("As you did not raise your ratio in time, your downloading rights have been revoked. You will not be able to download any torrents until your ratio is above your new required ratio."), '');
echo "Ratio watch disabled: $UserID\n";

View File

@ -23,6 +23,32 @@ function get_fls() {
return $FLS;
}
function get_forum_staff() {
global $Cache, $DB;
static $ForumStaff;
if(is_array($ForumStaff)) {
return $ForumStaff;
}
if(($ForumStaff = $Cache->get_value('forum_staff')) === false) {
$DB->query("SELECT
m.ID,
p.Level,
m.Username,
m.Paranoia,
m.LastAccess,
i.SupportFor
FROM users_main AS m
JOIN users_info AS i ON m.ID=i.UserID
JOIN permissions AS p ON p.ID=m.PermissionID
WHERE p.DisplayStaff='1'
AND p.Level < 700
ORDER BY p.Level, m.LastAccess ASC");
$ForumStaff = $DB->to_array(false, MYSQLI_BOTH, array(4));
$Cache->cache_value('forum_staff', $ForumStaff, 180);
}
return $ForumStaff;
}
function get_staff() {
global $Cache, $DB;
static $Staff;
@ -42,6 +68,7 @@ function get_staff() {
JOIN users_info AS i ON m.ID=i.UserID
JOIN permissions AS p ON p.ID=m.PermissionID
WHERE p.DisplayStaff='1'
AND p.Level >= 700
ORDER BY p.Level, m.LastAccess ASC");
$Staff = $DB->to_array(false, MYSQLI_BOTH, array(4));
$Cache->cache_value('staff', $Staff, 180);
@ -51,9 +78,11 @@ function get_staff() {
function get_support() {
return array(
0 => get_fls(),
1 => get_staff(),
get_fls(),
get_forum_staff(),
get_staff(),
'fls' => get_fls(),
'forum_staff' => get_forum_staff(),
'staff' => get_staff()
);
}

View File

@ -2,10 +2,10 @@
enforce_login();
show_header('Staff');
include('functions.php');
$Support = get_support();
include(SERVER_ROOT.'/sections/staff/functions.php');
$SupportStaff = get_support();
list($FrontLineSupport,$Staff) = $Support;
list($FrontLineSupport, $ForumStaff, $Staff) = $SupportStaff;
?>
<div class="thin">
@ -64,6 +64,36 @@
<?=$SupportFor?>
</td>
</tr>
<? } ?>
</table>
</div>
<br />
<div class="box pad" style="padding:0px 10px 10px 10px;">
<h3>Forum moderators</h3>
<p>Forum Mods are users who have been promoted to help moderate the forums. They can only help with forum oriented questions</p>
<table class="staff" width="100%">
<tr class="colhead">
<td style="width:130px;">Username</td>
<td style="width:130px;">Last seen</td>
<td><strong>Remark</strong></td>
</tr>
<?
$Row = 'a';
foreach($ForumStaff as $Support) {
list($ID, $Class, $Username, $Paranoia, $LastAccess, $SupportFor) = $Support;
$Row = ($Row == 'a') ? 'b' : 'a';
?>
<tr class="row<?=$Row?>">
<td class="nobr">
<?=format_username($ID, $Username)?>
</td>
<td class="nobr">
<? if (check_paranoia('lastseen', $Paranoia, $Class)) { echo time_diff($LastAccess); } else { echo 'Hidden by user'; }?>
</td>
<td class="nobr">
<?=$SupportFor?>
</td>
</tr>
<? } ?>
</table>
</div>
@ -72,7 +102,7 @@
<?
$CurClass = 0;
$CloseTable = false;
foreach ($Staff as $StaffMember) {
foreach ($Staff as $StaffMember) {
list($ID, $Class, $ClassName, $Username, $Paranoia, $LastAccess, $Remark) = $StaffMember;
if($Class!=$CurClass) { // Start new class of staff members
$Row = 'a';
@ -84,9 +114,6 @@
$CloseTable = true;
echo '<br /><h3>'.$ClassName.'s</h3>';
?>
<? if($CurClass == 650) { ?>
<p>Forum Mods are users who have been promoted to help moderate the forums. They can only help with forum oriented questions</p>
<? } ?>
<table class="staff" width="100%">
<tr class="colhead">
<td style="width:130px;">Username</td>

View File

@ -130,6 +130,18 @@
<img src="<?=$BrowserDistribution?>" />
</div>
<br />
<h3>Geographical Distribution Map</h3>
<div class="box center">
<img src="http://chart.apis.google.com/chart?cht=t&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('',$Countries)?>&chtm=world&chf=bg,s,CCD6FF" />
<img src="http://chart.apis.google.com/chart?cht=t&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('',$Countries)?>&chtm=europe&chf=bg,s,CCD6FF" />
<br />
<img src="http://chart.apis.google.com/chart?cht=t&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('',$Countries)?>&chtm=south_america&chf=bg,s,CCD6FF" />
<img src="http://chart.apis.google.com/chart?cht=t&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('',$Countries)?>&chtm=asia&chf=bg,s,CCD6FF" />
<br />
<img src="http://chart.apis.google.com/chart?cht=t&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('',$Countries)?>&chtm=africa&chf=bg,s,CCD6FF" />
<img src="http://chart.apis.google.com/chart?cht=t&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('',$Countries)?>&chtm=middle_east&chf=bg,s,CCD6FF" />
<br />
<img src="http://chart.apis.google.com/chart?chxt=y,x&chg=0,-1,1,1&chxs=0,h&cht=bvs&chco=76A4FB&chs=880x300&chd=t:<?=implode(',',array_slice($CountryUsers,0,31))?>&chxl=1:|<?=implode('|',array_slice($Countries,0,31))?>|0:|<?=implode('|',$LogIncrements)?>&amp;chf=bg,s,FFFFFF00" />
</div>
<?
show_footer();

View File

@ -25,9 +25,14 @@
$URLRegex = '/torrents\.php\?id=([0-9]+)$/i';
preg_match($URLRegex, $URL, $Matches);
$GroupID=$Matches[1];
if(!$GroupID){ error(404); }
if(empty($GroupID) || !is_number($GroupID)) {
error(404);
}
$DB->query("INSERT INTO torrents_recommended (GroupID, UserID, Time) VALUES ('".db_string($GroupID)."', $LoggedUser[ID], '".sqltime()."')");
freeleech_groups($GroupID, 2, 3);
$Cache->delete_value('recommend');
header('Location: '.$_SERVER['HTTP_REFERER']);
?>

View File

@ -25,6 +25,7 @@
t.RemasterRecordLabel,
t.Scene,
t.FreeTorrent,
t.FreeLeechType,
t.Dupable,
t.DupeReason,
t.Description AS TorrentDescription,

View File

@ -108,6 +108,13 @@
<input type="checkbox" name="unfreeleech" /> Reset
<input type="checkbox" name="freeleech" /> Freeleech
<input type="checkbox" name="neutralleech" /> Neutralleech
because
<select name="freeleechtype">
<? $FL = array("N/A", "Staff Pick", "Perma-FL", "Vanity House");
foreach($FL as $Key => $Name) { ?>
<option value="<?=$Key?>" <?=($Key == $Torrent['FreeLeechType'] ? ' selected="selected"' : '')?>><?=$Name?></option>
<? } ?>
</select>
</td>
</tr>
<? } ?>

View File

@ -70,6 +70,7 @@
$DB->query("SELECT COUNT(ID) FROM torrents WHERE GroupID='$OldGroupID'");
list($TorrentsInGroup) = $DB->next_record();
if($TorrentsInGroup == 0) {
$DB->query("UPDATE torrents_comments SET GroupID='$GroupID' WHERE GroupID='$OldGroupID'");
delete_group($OldGroupID);
} else {
update_hash($OldGroupID);

View File

@ -25,12 +25,14 @@
} else {
$Free = 0;
}
$DB->query("SELECT info_hash FROM torrents WHERE GroupID = ".$GroupID);
$InfoHashes = $DB->collect('info_hash', false);
foreach($InfoHashes as $InfoHash) {
update_tracker('update_torrent', array('info_hash' => rawurlencode($InfoHash), 'freetorrent' => $Free));
if(isset($_POST['freeleechtype']) && in_array($_POST['freeleechtype'], array(0,1,2,3))) {
$FreeType = $_POST['freeleechtype'];
} else {
error(404);
}
$DB->query("UPDATE torrents SET FreeTorrent = '".$Free."' WHERE GroupID = ".$GroupID);
freeleech_groups($GroupID, $Free, $FreeType);
}
//Escape fields

View File

@ -108,7 +108,7 @@
$DisplayName = display_artists($Artists, true, true);
}
$DisplayName.= "<a href='torrents.php?id=$GroupID&amp;torrentid=$TorrentID' title='View Torrent'>".$GroupName."</a>";
$DisplayName.= "<a href='torrents.php?id=$GroupID&amp;torrentid=$TorrentID#torrentID$TorrentID' title='View Torrent'>".$GroupName."</a>";
if($GroupCategoryID==1 && $GroupYear>0) {
$DisplayName.= " [$GroupYear]";

View File

@ -60,13 +60,23 @@
error(404);
}
$Properties['FreeLeech'] = $Free;
if($Free == 0) {
$FreeType = 0;
} else {
$FreeType = (int)$_POST['freeleechtype'];
if(!in_array($Free, array(0,1,2,3))) {
error(404);
}
}
$Properties['FreeLeechType'] = $FreeType;
}
//******************************************************************************//
//--------------- Validate data in edit form -----------------------------------//
$DB->query('SELECT UserID, Remastered, RemasterYear, FreeTorrent, info_hash FROM torrents WHERE ID='.$TorrentID);
list($UserID, $Remastered, $RemasterYear, $CurFreeLeech, $InfoHash) = $DB->next_record(MYSQLI_BOTH, false);
$DB->query('SELECT UserID, Remastered, RemasterYear, FreeTorrent FROM torrents WHERE ID='.$TorrentID);
list($UserID, $Remastered, $RemasterYear, $CurFreeLeech) = $DB->next_record(MYSQLI_BOTH, false);
if($LoggedUser['ID']!=$UserID && !check_perms('torrents_edit')) {
error(403);
@ -263,6 +273,7 @@
if(check_perms('torrents_freeleech')) {
$SQL .= "FreeTorrent=$T[FreeLeech],";
$SQL .= "FreeLeechType=$T[FreeLeechType],";
}
if(check_perms('users_mod')) {
@ -316,7 +327,7 @@
$DB->query($SQL);
if(check_perms('torrents_freeleech') && $Properties['FreeLeech'] != $CurFreeLeech) {
update_tracker('update_torrent', array('info_hash' => rawurlencode($InfoHash), 'freetorrent' => $Properties['FreeLeech']));
freeleech_torrents($TorrentID, $Properties['FreeLeech'], $Properties['FreeLeechType']);
}
$DB->query("SELECT GroupID, Time FROM torrents WHERE ID='$TorrentID'");

View File

@ -357,6 +357,7 @@
$UpdateSet[]="can_leech='$DisableLeech'";
$EditSummary[]="leeching status changed";
$HeavyUpdates['DisableLeech']=$DisableLeech;
$HeavyUpdates['CanLeech']=$DisableLeech;
if (!empty($UserReason)) {
send_pm($UserID, 0, db_string('Your leeching privileges have been disabled'),db_string("Your leeching privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=http://".NONSSL_SITE_URL."/wiki.php?action=article&name=IRC+-+How+to+join]here[/url]."));
}