Location: PHPKode > projects > Simple Way to Usenet > libs/swun/themes/tfeat_nzbdload.class.php
<?php
/**
 *  
 * @author  Benjamin Gillissen <hide@address.com>
 * 
 *	**************************************************************

	Copyright (C) 2009  Benjamin Gillissen
	
	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details at:
	http://www.gnu.org/copyleft/gpl.html

 *	**************************************************************
 */
/* used to catch a nfo request on any page.
 * 
 */ 
class tfeat_nzbdload {
	
	const PROFILE = FALSE;
	
	public function __construct(){ }
	
	public static function implent(){
		thm_mediaq::append_js_file('unfid_dload');
		if ( ! isset($_GET['nzbdload']) ){ return TRUE; }
		if ( empty($_GET['nzbdload']) ){ exit; }
		if ( !hellarpcs::gotfree_slot() ){ exit; }
		if ( !hellarpcs::lock_slot('dload', '') ){ exit; }
		$ids = split(';', $_GET['nzbdload']);
		foreach($ids as $k => $id){ if ( empty($id) ){ unset($ids[$k]); } }
		$nzb = nb_fetch::get_nzb(NULL, $ids);
		header('Content-type: text/xml; charset="ISO-8859-1"');
		header('Content-Disposition: attachment; filename="'.urlencode("swungenat_".time().".nzb").'"');
		echo file_get_contents($nzb);
		unlink($nzb);
		exit;
	}
	
	public static function genpart($part, $of=FALSE){
		$o='<iframe style="height:0px;width:0px;overflow:hidden;visibility:hidden" id="unfid_dloadest" src="?nzbdload="></iframe>';
		if ( !$of ){ return $o; } 
		call_user_func($of, $o);
		return TRUE;
	}
}
return TRUE;
Return current item: Simple Way to Usenet