Location: PHPKode > projects > Simple Way to Usenet > libs/swun/ajax/ajx_rpcall.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

 *	**************************************************************
 */
class ajx_rpcall extends ajax {

	public static function rpcall($do, $rpc, $val){
		parent::$CB = __FUNCTION__;
		$REALM = new realm(pages::get_realm(browsing::get_active()));
		if ( FALSE === hellarpcs::isrpc($rpc) ){
			pagegen::add_event('Not a valid RPC : '.$rpc);
			return parent::getReply();
		}
		if ( FALSE === $REALM->checks('rpc', 'manage', $rpc) ){
			pagegen::add_event('Not allowed to manage that RPC');
			return parent::getReply();
		}
		switch($do){
			case 'setrate'	: 	$o = hellarpcs::setrate($rpc, $val);
								break;
			case 'pause'	: 	$o = hellarpcs::pause($rpc);
								break;
			case 'resume'	: 	$o = hellarpcs::resume($rpc);
								break;
			case 'cancel'   : 	IF ( empty($val) ){ $val=NULL; }
								$o = hellarpcs::cancel($rpc, $val);
								break;
			case 'mvup'		: 	$o = hellarpcs::moveup($rpc, $val);
								break;
			case 'mvdwn'	: 	$o = hellarpcs::movedown($rpc, $val);
								break;
			case 'mvtop'	: 	$o = hellarpcs::movetop($rpc, $val);
								break;
			case 'mvbot' 	: 	$o = hellarpcs::movebot($rpc, $val);
								break;
			case 'force'	: 	$o = hellarpcs::force($rpc, $val);
								break;
			case 'delrem'	:	$o = hellarpcs::cancel_delayed($rpc, $val);
								//$o = nzbrate::q_del($val);
								break;
		}
		if ( $o ){
			pagegen::add_event(langs::translate('msg_'.$do, NULL, 'hellarpcs'));
		} else {
			pagegen::add_event(langs::translate('err_'.$do, NULL, 'hellarpcs'));
		}
		return ajx_contentrefresh::contentrefresh();	
	}
	
	
	
}
Return current item: Simple Way to Usenet