Ejemplo n.º 1
0
				$TorrentInfo.=$Encoding;
			}
			
			if ($TorrentInfo!='') { $TorrentName.=' ('.$TorrentInfo.')'; }
			
			if(!empty($_GET['mode']) && $_GET['mode'] == 'bbb'){
				$TorrentName = $Artists.' -- '.$Name;
			}
			
			if (!$TorrentName) { $TorrentName="No Name"; }
			
			if($DownloadAlt) {
				header('Content-Type: text/plain');
				header('Content-Disposition: attachment; filename="'.file_string($TorrentName).'.txt"');
				//header('Content-Length: '.strlen($Tor->enc()));
				echo $Tor->enc();
				
			} elseif(!$DownloadAlt || $Failed) {
				header('Content-Type: application/x-bittorrent');
				header('Content-Disposition: inline; filename="'.file_string($TorrentName).'.torrent"');
				//header('Content-Length: '.strlen($Tor->enc()));
				echo $Tor->enc();
			}
			
			break;
		case 'reply':
			enforce_login();
			if (!isset($_POST['groupid']) || !is_number($_POST['groupid']) || empty($_POST['body'])) { 
				error(0);
			}
			if($LoggedUser['DisablePosting']) {
Ejemplo n.º 2
0
$DB->query("SELECT 
	DATE_FORMAT(t.Time,'%b \'%y') AS Month,
	t.GroupID,
	t.Media,
	t.Format,
	t.Encoding,
	IF(t.RemasterYear=0,tg.Year,t.RemasterYear),
	tg.Name,
	t.Size,
	f.File
	FROM torrents as t 
	JOIN torrents_group AS tg ON t.GroupID=tg.ID 
	LEFT JOIN torrents_files AS f ON t.ID=f.TorrentID
	".$SQL);
$Downloads = $DB->to_array(false,MYSQLI_NUM,false);
$Artists = get_artists($DB->collect('GroupID'));

list($UserID, $Username) = array_values(user_info($UserID));
$Zip = new ZIP($Username.'\'s '.ucfirst($_GET['type']));
foreach($Downloads as $Download) {
	list($Month, $GroupID, $Media, $Format, $Encoding, $Year, $Album, $Size, $Contents) = $Download;
	$Artist = display_artists($Artists[$GroupID],false);
	$Contents = unserialize(base64_decode($Contents));
	$Tor = new TORRENT($Contents, true);
	$Tor->set_announce_url(ANNOUNCE_URL.'/'.$LoggedUser['torrent_pass'].'/announce');
	unset($Tor->Val['announce-list']);
	$Zip->add_file($Tor->enc(), file_string($Month).'/'.file_string($Artist.$Album).' - '.file_string($Year).' ('.file_string($Media).' - '.file_string($Format).' - '.file_string($Encoding).').torrent');
}
$Zip->close_stream();
Ejemplo n.º 3
0
 /**
  * Convert a stored torrent into a binary file that can be loaded in a torrent client
  *
  * @param mixed $TorrentData bencoded torrent without announce URL (new format) or TORRENT object (old format)
  * @return bencoded string
  */
 public static function get_file(&$TorrentData, $AnnounceURL)
 {
     if (Misc::is_new_torrent($TorrentData)) {
         return BencodeTorrent::add_announce_url($TorrentData, $AnnounceURL);
     }
     $Tor = new TORRENT(unserialize(base64_decode($TorrentData)), true);
     $Tor->set_announce_url($AnnounceURL);
     unset($Tor->Val['announce-list']);
     unset($Tor->Val['url-list']);
     unset($Tor->Val['libtorrent_resume']);
     return $Tor->enc();
 }
Ejemplo n.º 4
0
 public function download($id = -1)
 {
     $this->utility->enforce_perm('site_torrents_download');
     $this->load->model('usermodel');
     require APPPATH . '/libraries/torrent.php';
     if (!($data = $this->torrentmodel->getData($id))) {
         show_404();
     }
     $tor = new TORRENT($data['data']->bin);
     //$tor->set_announce_url($this->config->item('announce_url').'/'.$this->session->userdata('torrent_pass').'/announce');
     if (!$this->utility->user_setting('download_as_txt')) {
         header('Content-Disposition: attachment; filename="' . $this->utility->torrent_name($id, false) . '.torrent"');
         header('Content-Type: application/x-bittorrent');
     } else {
         header('Content-Disposition: attachment; filename="' . $this->utility->torrent_name($id, false) . '.txt"');
         header('Content-Type: text/plain');
     }
     echo $tor->enc();
     $this->utility->log($this->utility->current_user('username') . ' (' . $this->utility->current_user('_id') . ') downloaded torrent ' . $id);
     exit;
 }