Beispiel #1
0
 public function index()
 {
     require_once Kohana::find_file('vendor', 'phprpc/phprpc_server', TRUE);
     $server = new PHPRPC_Server();
     $server->add(array('get_data_pv_ip_by_time', 'get_data_pv_ip_by_time_range', 'get_data_domain_by_time_range', 'get_data_page_by_time_range', 'get_data_country_by_time_range', 'get_data_pv_ip_by_one_site', 'get_data_source_by_time_range'), new Rpcserver_Controller());
     $server->start();
 }
Beispiel #2
0
 /**
  * 添加接口
  */
 protected function auto_add_action()
 {
     $examples = array_diff(get_class_methods($this), get_class_methods(__CLASS__));
     foreach ($examples as $method) {
         if (strtolower(substr($method, 0, 7)) === 'action_') {
             $m = substr($method, 7);
             $this->phprpc->add($method, $this, $m);
         }
     }
 }
 /**
 +----------------------------------------------------------
 * 应用程序初始化
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @return void
 +----------------------------------------------------------
 */
 public static function run()
 {
     //导入类库
     Vendor('phpRPC.phprpc_server');
     //实例化phprpc
     $server = new PHPRPC_Server();
     $actions = explode(',', C('APP_PHPRPC_ACTIONS'));
     foreach ($actions as $action) {
         //$server -> setClass($action.'Action');
         $temp = $action . 'Action';
         $methods = get_class_methods($temp);
         $server->add($methods, new $temp());
     }
     if (APP_DEBUG) {
         $server->setDebugMode(true);
     }
     $server->setEnableGZIP(true);
     $server->start();
     //C('PHPRPC_COMMENT',$server->comment());
     echo $server->comment();
     // 保存日志记录
     if (C('LOG_RECORD')) {
         Log::save();
     }
     return;
 }
Beispiel #4
0
 /**
 +----------------------------------------------------------
 * 应用程序初始化
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @return void
 +----------------------------------------------------------
 */
 public static function run()
 {
     // 设定错误和异常处理
     set_error_handler(array('App', "appError"));
     set_exception_handler(array('App', "appException"));
     //[RUNTIME]
     // 检查项目是否编译过
     // 在部署模式下会自动在第一次执行的时候编译项目
     if (defined('RUNTIME_MODEL')) {
         // 运行模式无需载入项目编译缓存
     } elseif (is_file(RUNTIME_PATH . '~app.php') && (!is_file(CONFIG_PATH . 'config.php') || filemtime(RUNTIME_PATH . '~app.php') > filemtime(CONFIG_PATH . 'config.php'))) {
         // 直接读取编译后的项目文件
         C(include RUNTIME_PATH . '~app.php');
     } else {
         // 预编译项目
         App::build();
     }
     //[/RUNTIME]
     //导入类库
     Vendor('phpRPC.phprpc_server');
     //实例化phprpc
     $server = new PHPRPC_Server();
     $actions = explode(',', C('APP_PHPPRC_ACTIONS'));
     foreach ($actions as $action) {
         //$server -> setClass($action.'Action');
         $temp = $action . 'Action';
         $methods = get_class_methods($temp);
         $server->add($methods, new $temp());
     }
     $server->start();
     //C('PHPRPC_COMMENT',$server->comment());
     echo $server->comment();
     // 保存日志记录
     if (C('LOG_RECORD')) {
         Log::save();
     }
     return;
 }
Beispiel #5
0
 function serverAction()
 {
     //		ini_set("soap.wsdl_cache_enabled", "0");
     //		$soap = new SoapServer("wf.wsdl"); // this current file here
     //		$soap->setClass('PointService');
     //		$soap->handle();
     $server = new PHPRPC_Server();
     $server->add('decrypt', new PointService());
     $server->add('verifyAccount', new PointService());
     $server->add('exchange', new PointService());
     $server->add('getCurrentPoint', new PointService());
     $server->setCharset('UTF-8');
     $server->start();
     $this->_helper->layout->disableLayout();
 }
Beispiel #6
0
 /**
  * PHPRpc控制器架构函数
  * @access public
  */
 public function __construct()
 {
     //导入类库
     think\loader::import('vendor.phprpc.phprpc_server');
     //实例化phprpc
     $server = new \PHPRPC_Server();
     $server->add($this);
     if (APP_DEBUG) {
         $server->setDebugMode(true);
     }
     $server->setEnableGZIP(true);
     $server->start();
     //C('PHPRPC_COMMENT',$server->comment());
     echo $server->comment();
 }
Beispiel #7
0
 /**
  * 架构函数
  * @access public
  */
 public function __construct()
 {
     //控制器初始化
     if (method_exists($this, '_initialize')) {
         $this->_initialize();
     }
     //实例化phprpc
     $server = new \PHPRPC_Server();
     if ($this->allowMethodList) {
         $methods = $this->allowMethodList;
     } else {
         $methods = get_class_methods($this);
         $methods = array_diff($methods, array('__construct', '__call', '_initialize'));
     }
     $server->add($methods, $this);
     if (APP_DEBUG || $this->debug) {
         $server->setDebugMode(true);
     }
     $server->setEnableGZIP(true);
     $server->start();
     echo $server->comment();
 }
Beispiel #8
0
 /**
  * 架构函数
  * @access public
  */
 public function __construct()
 {
     //控制器初始化
     if (method_exists($this, '_initialize')) {
         $this->_initialize();
     }
     //导入类库
     Vendor('phpRPC.phprpc_server');
     //实例化phprpc
     $server = new \PHPRPC_Server();
     if ($this->allowMethodList) {
         $methods = $this->allowMethodList;
     } else {
         $methods = get_class_methods($this);
     }
     $server->add($methods, $this);
     if (APP_DEBUG) {
         $server->setDebugMode(true);
     }
     $server->setEnableGZIP(true);
     $server->start();
     echo $server->comment();
 }
Beispiel #9
0
    }
    function setEnableGZIP($enableGZIP)
    {
        $this->enableGZIP = $enableGZIP;
    }
    function start()
    {
        while (ob_get_length() !== false) {
            @ob_end_clean();
        }
        $this->initOutputBuffer();
        $this->sendHeader();
        $this->initErrorHandler();
        $this->initEncode();
        $this->initCallback();
        $this->initRef();
        $this->initClientID();
        $this->initEncrypt();
        if (isset($_REQUEST['phprpc_func'])) {
            $this->callFunction();
        } else {
            if ($this->encrypt != false) {
                $this->keyExchange();
            } else {
                $this->sendFunctions();
            }
        }
    }
}
PHPRPC_Server::initSession();
Beispiel #10
0
    {
    }
    /* db user management */
    function db_user_add()
    {
    }
    function db_user_del()
    {
    }
    function db_user_show()
    {
    }
    function db_user_edit()
    {
    }
    function db_user_list()
    {
    }
}
$rpc_sess_key = 'res';
$server = new PHPRPC_Server();
$rpc = new RPC();
/*
if(empty($_SESSION[$rpc_sess_key])) {
	$server->errno = 503;
	$server->errstr = 'Please login before calling';
	$server->sendError();
}
*/
$server->add(get_class_methods('RPC'), $rpc);
$server->start();
Beispiel #11
0
    function fetch_row($query)
    {
        $query = mysql_fetch_row($query);
        return $query;
    }
    function fetch_fields($query)
    {
        return mysql_fetch_field($query);
    }
    function version()
    {
        return mysql_get_server_info($this->link);
    }
    function close()
    {
        return mysql_close($this->link);
    }
    function halt($message = "", $sql = "")
    {
        echo "<div style=\"position:absolute;font-size:11px;font-family:verdana,arial;background:#EBEBEB;padding:0.5em;\">\r\n\t\t\t\t<b>MySQL Error</b><br>\r\n\t\t\t\tMessage: {$message}<br>\r\n\t\t\t\tSQL: {$sql}<br>\r\n\t\t\t\tError: " . $this->error() . "<br>\r\n\t\t\t\tErrno.: " . $this->errno() . "</div>";
        exit;
    }
}
require_once "rpc/phprpc_server.php";
$server = new PHPRPC_Server();
$server->add("saveDoing");
$server->add("getImByName");
$server->add("getNameByIm");
$server->add("getImList");
$server->add("getImCount");
$server->start();
Beispiel #12
0
<?php

include 'core.php';
include "libs/phprpc/phprpc_server.php";
include 'libs/rpclib.php';
if (isset($_GET["key"]) && streq($_GET["key"], Config::$intpass)) {
    $server = new PHPRPC_Server();
    $server->add('GetUsers');
    $server->add('CheckLogin');
    $server->start();
} else {
    echo "Aliens, they be coming!!!1";
}
Beispiel #13
0
 public function start()
 {
     parent::start();
 }
Beispiel #14
0
 /**
  * rpc服务
  */
 public function attachment()
 {
     $returnStruct = array('status' => 0, 'code' => 501, 'msg' => _('Not Implemented'), 'content' => array());
     try {
         //* 初始化返回数据 */
         $returnStatus = 1;
         $returnCode = 200;
         $returnMessage = '';
         $returnData = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $requestData = $this->input->get();
         //* 实现功能后屏蔽此异常抛出 */
         //throw new MyRuntimeException(_('Not Implemented'),501);
         //* 权限验证,数据验证,逻辑验证 ==根据业务逻辑定制== */
         //if(util::isAccess(array(Logon::$MGR_ROLE_LABEL_SYS_ADMIN,), array(Logon::$USER_ROLE_LABEL_DENIED,Logon::$USER_ROLE_LABEL_GUEST), $this->getUserRoleLabel())==FALSE){
         //    throw new MyRuntimeException(_('Access Denied'),403);
         //}
         if (util::isAccess('*', array(Logon::$USER_ROLE_LABEL_DENIED), $this->getUserRoleLabel()) == FALSE) {
             throw new MyRuntimeException(_('Access Denied'), 403);
         }
         //* 权限验证 ==根据业务逻辑定制== */
         //* 数据验证 ==根据业务逻辑定制== */
         //* 逻辑验证 ==根据业务逻辑定制== */
         // 调用底层服务
         !isset($servRouteInstance) && ($servRouteInstance = ServRouteInstance::getInstance(ServRouteConfig::getInstance()));
         // 执行业务逻辑
         require_once Lemon::find_file('vendor', 'phprpc/phprpc_server', TRUE);
         $server = new PHPRPC_Server();
         $server->add(array('phprpc_addAttachmentFileData', 'phprpc_getAttachmentDataById', 'phprpc_getStoreDataByStoreId', 'phprpc_getStoreDataByAttachmentId', 'phprpc_removeAttachmentDataByAttachmentId', 'phprpc_getStoreInfoByStoreId'), Attachment_Service::getInstance());
         $server->start();
         exit;
         throw new MyRuntimeException(_('Internal Error'), 500);
         //* 补充&修改返回结构体 */
         $returnStruct['status'] = $returnStatus;
         $returnStruct['code'] = $returnCode;
         $returnStruct['msg'] = $returnMessage;
         $returnStruct['content'] = $returnData;
         //* 请求类型 */
         if ($this->isAjaxRequest()) {
             // ajax 请求
             // json 输出
             $this->template->content = $returnStruct;
         } else {
             // html 输出
             //* 模板输出 */
             $this->template->returnStruct = $returnStruct;
             $content = new View('info');
             //* 变量绑定 */
             $this->template->title = Lemon::config('site.name');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->requestData = $requestData;
             //* 返回结构体绑定 */
             $this->template->content->returnStruct = $returnStruct;
             //:: 当前应用专用数据
             $this->template->content->title = Lemon::config('site.name');
         }
         // end of request type determine
     } catch (MyRuntimeException $ex) {
         $returnStruct['status'] = 0;
         $returnStruct['code'] = $ex->getCode();
         $returnStruct['msg'] = $ex->getMessage();
         //TODO 异常处理
         //throw $ex;
         if ($this->isAjaxRequest()) {
             $this->template->content = $returnStruct;
         } else {
             $this->template->returnStruct = $returnStruct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->requestData = $requestData;
             //* 返回结构体绑定 */
             $this->template->content->returnStruct = $returnStruct;
         }
     }
 }
Beispiel #15
0
 public function response()
 {
     $server = new PHPRPC_Server();
     $server->add(array('response'), $this->phalapiProxy);
     $server->start();
 }
Beispiel #16
0
	当前为一个说明,<key>关键字</key>和<b>粗体</b><b>斜体</b><u>下线</u>
	已经被支持了.官方网站<link src="http://www.freeiris.org">fri2</link>

ENDPAPER
*/
/* 
	this file :
	rpc pbx -- Freeiris2 Extra Interface

    $Id: demo1.php 160 2009-05-12 13:52:18Z anjing $
*/
require_once "./include/friextra_common_inc.php";
/*
	注册RPC函数
*/
$server = new PHPRPC_Server();
// 分机
$server->add('extension_list');
#分机列表
$server->add('extension_get');
#查看分组
$server->add('extension_add_sip');
#新增SIP分机
$server->add('extension_edit_sip');
#编辑分机
$server->add('extension_delete_sip');
#删除分机
// 分组(未开放功能暂时可以使用原形接口)
$server->add('extengroup_list');
#分组列表
$server->add('extengroup_get');
Beispiel #17
0
<?php 
include "phprpc_server.php";
function HelloWorld()
{
    return 'Hello World!';
}
$server = new PHPRPC_Server();
$server->add('HelloWorld');
$server->start();
Beispiel #18
0
**/
define('IN_ECS', true);
define('TUNNELVERSION', '1.00');
require './init.php';
require_once ROOT_PATH . 'includes/cls_json.php';
include_once ROOT_PATH . 'includes/lib_order.php';
require_once ROOT_PATH . "api/phprpc/phprpc_server.php";
$_LANG['ps'][PS_UNPAYED] = '未付款';
$_LANG['ps'][PS_PAYING] = '付款中';
$_LANG['ps'][PS_PAYED] = '已付款';
$_LANG['ss'][SS_UNSHIPPED] = '未发货';
$_LANG['ss'][SS_PREPARING] = '配货中';
$_LANG['ss'][SS_SHIPPED] = '已发货';
$_LANG['ss'][SS_RECEIVED] = '收货确认';
$funlist = array('get_version', 'server_info', 'get_goods_list', 'get_orders_list', 'get_order_info', 'pos_order_info', 'pos_order_shipping', 'shipping_list', 'get_order_print_info', 'admin_signin', 'get_table_count');
$server = new PHPRPC_Server();
$server->add($funlist);
$server->start();
/**
 * 获取程序版本信息
 *
 * @access  private
 * @param   
 * @return  array
 */
function get_version()
{
    return TUNNELVERSION;
}
/**
 * 检查帐号权限