mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-15 03:46:25 +00:00
89aa3f46e3
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
39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?
|
|
//******************************************************************************//
|
|
//--------------- Add a recommendation -----------------------------------------//
|
|
authorize();
|
|
|
|
if(!check_perms('site_recommend_own') && !check_perms('site_manage_recommendations')){
|
|
error(403);
|
|
}
|
|
|
|
$URL = trim($_POST['url']);
|
|
|
|
// Make sure the URL they entered is on our site, and is a link to a torrent
|
|
$URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.NONSSL_SITE_URL.'\/torrents\.php\?id=([0-9]+)$/i';
|
|
$Val->SetFields('url',
|
|
'1','regex','The URL must be a link to a torrent on the site.',array('regex'=>$URLRegex));
|
|
$Err = $Val->ValidateForm($_POST); // Validate the form
|
|
|
|
if($Err){ // if something didn't validate
|
|
error($Err);
|
|
header('Location: '.$_SERVER['HTTP_REFERER']);
|
|
exit;
|
|
}
|
|
|
|
// Get torrent ID
|
|
$URLRegex = '/torrents\.php\?id=([0-9]+)$/i';
|
|
preg_match($URLRegex, $URL, $Matches);
|
|
$GroupID=$Matches[1];
|
|
|
|
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']);
|
|
?>
|