Exemple #1
0
$download4assign = $mydownload->get_downdata_for_singleview( 0, $lid, 0, 0, 1 );
$invisibleinfo = $mydownload->Invisible_Info();

// HISTORY RESTORE
if( ! empty( $_POST['restore'] ) ) {
	if ( ! $xoopsGTicket->check( true , 'd3downloads' ) ) {
		redirect_header(XOOPS_URL.'/modules/'.$mydirname.'/admin/index.php',3,$xoopsGTicket->getErrors());
	}
	require_once dirname( dirname(__FILE__) ).'/include/common_functions.php' ;
	$errors = '';
	$id = isset( $_POST['id'] ) ? intval( $_POST['id'] ) : 0 ;
	$lid = isset( $_POST['lid'] ) ? intval( $_POST['lid'] ) : 0 ;
	$cid = isset( $_POST['cid'] ) ? intval( $_POST['cid'] ) : 0 ;

	$new_id = $history->history_Insert_DB( $lid ) ;
	$result = $history->history_Restore( $id, $lid );
	if( ! $result ) $errors = $id ;
	$history->history_Delete( $lid ) ;
	d3download_delete_cache_of_categories( $mydirname ) ;
	if( empty( $errors ) && empty( $invisibleinfo ) ){
		redirect_header( XOOPS_URL.'/modules/'.$mydirname.'/index.php?page=singlefile&cid='.$cid.'&lid='.$lid , 2 , _MD_D3DOWNLOADS_RESTOREDONE ) ;
	} elseif( empty( $errors ) && ! empty( $invisibleinfo ) ){
		redirect_header( XOOPS_URL.'/modules/'.$mydirname.'/admin/index.php?page=history&id='.$new_id , 2 , _MD_D3DOWNLOADS_RESTOREDONE ) ;
	} else {
		redirect_header( XOOPS_URL.'/modules/'.$mydirname.'/admin/index.php?page=history&id='.$new_id , 2 , sprintf( _MD_D3DOWNLOADS_ERROR_MESSEAGE , $errors ) ) ;
	}
	exit();
}

// display stage
xoops_cp_header();