Ejemplo n.º 1
0
 public function __construct($url, $api, $options = false)
 {
     $this->fullUrl = $url . "/" . $api . "Version";
     $this->options = $options;
     Hessian::remoteMethod($this->fullUrl, 'getSupportedVersions');
     Hessian::remoteMethod($this->fullUrl, 'getVersionInfo');
 }
Ejemplo n.º 2
0
function registerAdminToolMethods($url)
{
    $methods = array('sendRequestGetResponse', 'getShards', 'getApplications', 'startShard', 'stopShard', 'startApplication', 'stopApplication');
    foreach ($methods as $method) {
        Hessian::remoteMethod($url, $method);
    }
}
Ejemplo n.º 3
0
function registerGametoolResourceMethods($fullPath)
{
    $methods = array('getResource');
    foreach ($methods as $method) {
        Hessian::remoteMethod($fullPath, $method);
    }
}
function registerEditionMethods($fullPath)
{
    Hessian::remoteMethod($fullPath, 'getCollectionEditions');
    Hessian::remoteMethod($fullPath, 'addEdition');
    Hessian::remoteMethod($fullPath, 'removeEdition');
    Hessian::remoteMethod($fullPath, 'getEditionsOfAccount');
    Hessian::remoteMethod($fullPath, 'addEditionToAccount');
    Hessian::remoteMethod($fullPath, 'removeEditionFromAccount');
}
Ejemplo n.º 5
0
 public function HessianAPI($endpoint, $username, $password)
 {
     try {
         Hessian::errorReporting(HESSIAN_EXCEPTION);
         $this->proxy =& new HessianClient($endpoint, array('username' => $username, 'password' => $password));
         if (Hessian::error()) {
             throw new JbillingAPIException(Hessian::error());
         }
     } catch (Exception $e) {
         throw new JbillingAPIException($e->getMessage());
     }
 }
Ejemplo n.º 6
0
function registerBillingMethods($fullPath)
{
    \Hessian::remoteMethod($fullPath, 'getAccount');
    \Hessian::remoteMethod($fullPath, 'addMoney');
    \Hessian::remoteMethod($fullPath, 'subMoney');
    \Hessian::remoteMethod($fullPath, 'subMoneyWithCurrency');
    \Hessian::remoteMethod($fullPath, 'setStatus');
    \Hessian::remoteMethod($fullPath, 'addMoneyWithTranType');
    \Hessian::remoteMethod($fullPath, 'addMoneyWithCurrency');
    \Hessian::remoteMethod($fullPath, 'addMoneyToAll');
    \Hessian::remoteMethod($fullPath, 'getAccountBonuses');
    \Hessian::remoteMethod($fullPath, 'createAccountBonus');
    \Hessian::remoteMethod($fullPath, 'removeAccountBonus');
}
Ejemplo n.º 7
0
 /**
  * Publishes the service, check incoming calls and routes them to the wrapped object.<BR>
  * This method uses streams to retrieve raw POST bytes and a 
  * {@link HessianPHP.HessianParser HessianParser} and {@link HessianPHP.HessianWriter HessianWriter}
  * to execute the call and send results back to the client.
  *
  * As defined in Hessian 1.0 spec, the service requires POST to execute. It is advised not to call<BR>
  * any other php code that writes to the default screen output (echo, print, etc.) as it can corrupt
  * the reply.
  *  
  * @access public 
  **/
 function service()
 {
     if (!is_object($this->serviceInfo->service)) {
         header("HTTP/1.0 500 Hessian not configured");
         die('Serviced object not registered!');
     }
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         if ($this->displayInfo) {
             $this->serviceInfo->displayInfo();
             exit;
         } else {
             header("HTTP/1.0 500 Hessian Requires POST");
             die('<h1>Hessian Requires POST</h1>');
         }
     }
     ob_start();
     // apparently it wins a few milliseconds
     // handle errorReporting
     if ($this->errorReporting) {
         $this->_restoreError = error_reporting($this->errorReporting);
     }
     // uso de streams para obtener información cruda del post
     $ph = fopen("php://input", "rb");
     $postData = '';
     while (!feof($ph)) {
         $postData .= fread($ph, 4096);
     }
     fclose($ph);
     $this->parser->setStream($postData);
     $method =& $this->parser->parseCall();
     $result = null;
     if (Hessian::isError($method)) {
         $this->writer->setFault($method->code, $method->message, $method->getError());
     } else {
         $params = array();
         $error = false;
         while (!$this->parser->endStream()) {
             $param =& $this->parser->parseObject();
             if (Hessian::isError($param)) {
                 $this->writer->setFault($param->code, $param->message, $param->getError());
                 $error = true;
                 break;
             } else {
                 $params[] =& $param;
             }
         }
         // little hack to get rid of the finishing code 'z' in the parameter list
         if (!$error) {
             $last = count($params) - 1;
             unset($params[$last]);
             // end hack
             $result = $this->serviceInfo->callMethod($method, $params, $this->writer);
         }
     }
     $reply = trim($this->writer->writeReply($result));
     header('Content-type: application/binary');
     header('Content-length: ' . strlen($reply));
     header('Connection: close');
     $nfp = fopen("php://output", "wb+");
     fwrite($nfp, trim($reply));
     fclose($nfp);
     //echo $reply;
     ob_end_flush();
     // restore error reporting level
     if ($this->errorReporting) {
         error_reporting($this->_restoreError);
     }
 }
Ejemplo n.º 8
0
                //trigger_error($error->message);
                break;
            case HESSIAN_TRIGGER_NOTICE:
                trigger_error($error->message);
                break;
            case HESSIAN_TRIGGER_ERROR:
                trigger_error($error->message, E_USER_ERROR);
                break;
            default:
                break;
                // silent
        }
    }
    function clear()
    {
        $this->errorStack = array();
    }
    function getLastError()
    {
        if (!empty($this->errorStack)) {
            $last = count($this->errorStack) - 1;
            return $this->errorStack[$last];
        }
        return false;
    }
}
// static initialization
HessianConfig::globalConfig();
// uncomment this line if you want to control error_reporting() yourself
Hessian::addFilter(new PHPErrorReportingFilter());
Ejemplo n.º 9
0
 function check_balance()
 {
     $mobtel = $this->session->userdata('mobile_number');
     try {
         Hessian::getAccountTypeAndClassification($mobtel);
     } catch (Exception $e) {
         die('here');
     }
     $this->template->render();
     //var_dump($_COOKIE['mob_tel']);
 }
Ejemplo n.º 10
0
<?php

/**
 * Provides result of giving item to avatar.
 * Contains status, and id of item action if succeeded.
 * Value object.
 *
 * @author andrey.kuprishov
 */
class GiveItemResult
{
    public $status;
    // GiveItemStatus
    /**
     * When succeeded item action id contains id of newly created action.
     */
    public $itemActionId;
    // long
    public function getStatus()
    {
        return $this->status;
    }
    public function getItemActionId()
    {
        return $this->itemActionId;
    }
}
Hessian::mapRemoteType('query.hessian.accounts.GiveItemResult', 'GiveItemResult');
Ejemplo n.º 11
0
    public function getAvatarId()
    {
        return $this->avatarId;
    }
    public function getItemResourceId()
    {
        return $this->itemResourceId;
    }
    public function getRuneResourceId()
    {
        return $this->runeResourceId;
    }
    public function getStackCount()
    {
        return $this->stackCount;
    }
    public function getCounter()
    {
        return $this->counter;
    }
    public function getStatus()
    {
        return $this->status;
    }
    public function getDebugInfo()
    {
        return $this->debugInfo;
    }
}
Hessian::mapRemoteType('query.hessian.accounts.ItemActionInfo', 'ItemActionInfo');
Ejemplo n.º 12
0
 /**
  * Constructor, requires the url of the remote Hessian service
  *  
  * @param string url Url of the remote service
  **/
 function HessianClient($url, $options = false)
 {
     $this->__hessian__proxy__ =& Hessian::getHessianProxy($url, $options);
 }
Ejemplo n.º 13
0
 * Status of giving item to avatar. Used in result.
 *
 * @see query.hessian.accounts.GiveItemResult
 * @author andrey.kuprishov
 */
class GiveItemStatus
{
    public $name;
    public function __construct($value = '')
    {
        $this->name = $value;
    }
    public function equals($obj)
    {
        return $this->name == $obj->name;
    }
    public static function Succeeded()
    {
        return new GiveItemStatus('Succeeded');
    }
    public static function ShardNotFound()
    {
        return new GiveItemStatus('ShardNotFound');
    }
    public static function AvatarNotFound()
    {
        return new GiveItemStatus('AvatarNotFound');
    }
}
Hessian::mapRemoteType('query.hessian.accounts.GiveItemStatus', 'GiveItemStatus');
Ejemplo n.º 14
0
<?php

class CCUSample
{
    /**
     * Time when ccu was logged.
     */
    public $timeSeconds;
    // int
    /**
     * Number of concurrent users logged.
     */
    public $ccu;
    // int
    public function getTimeSeconds()
    {
        return $this->timeSeconds;
    }
    public function getCcu()
    {
        return $this->ccu;
    }
}
Hessian::mapRemoteType('gametool.helpers.CCUSample', 'CCUSample');
Ejemplo n.º 15
0
<?php

/**
 * Simple value-class for recent ccu (when and how much).
 * Leaves in .helpers package to avoid accidental rewriting by database entity class generator.
 *
 * @author andrey.kuprishov
 */
class RecentCCU
{
    /**
     * Time when ccu was logged.
     */
    public $time;
    // long
    /**
     * Number of concurrent users logged.
     */
    public $ccu;
    // int
    public function getTime()
    {
        return $this->time;
    }
    public function getCcu()
    {
        return $this->ccu;
    }
}
Hessian::mapRemoteType('gametool.helpers.RecentCCU', 'RecentCCU');
    public $type;
    // String
    /**
     * Path to resource in resource system.
     */
    public $path;
    // String
    /**
     * Pairs of name->value data of resource.
     */
    public $namedValues;
    // Map<String, String>
    public function getId()
    {
        return $this->id;
    }
    public function getType()
    {
        return $this->type;
    }
    public function getPath()
    {
        return $this->path;
    }
    public function getNamedValues()
    {
        return $this->namedValues;
    }
}
Hessian::mapRemoteType('query.hessian.resources.GametoolResource', 'GametoolResource');
Ejemplo n.º 17
0
     * Whether avatar online or not.
     */
    public $online;
    // boolean
    public function getAvatarId()
    {
        return $this->avatarId;
    }
    public function getAvatar()
    {
        return $this->avatar;
    }
    public function getShard()
    {
        return $this->shard;
    }
    public function getAvatarLevel()
    {
        return $this->avatarLevel;
    }
    public function isDeleted()
    {
        return $this->deleted;
    }
    public function isOnline()
    {
        return $this->online;
    }
}
Hessian::mapRemoteType('query.hessian.accounts.AvatarOnShard', 'AvatarOnShard');
Ejemplo n.º 18
0
 function get_bal($mobtel)
 {
     $hessian = new Hessian();
     var_dump("<pre>", $hessian->get_balance('09179229535'));
 }
Ejemplo n.º 19
0
 */
class SendItemStatus
{
    public $name;
    public function __construct($value = '')
    {
        $this->name = $value;
    }
    public function equals($obj)
    {
        return $this->name == $obj->name;
    }
    public static function ShardNotFound()
    {
        return new SendItemStatus('ShardNotFound');
    }
    public static function AvatarNotFound()
    {
        return new SendItemStatus('AvatarNotFound');
    }
    public static function NotSortedByShard()
    {
        return new SendItemStatus('NotSortedByShard');
    }
    public static function SomeSucceeded()
    {
        return new SendItemStatus('SomeSucceeded');
    }
}
Hessian::mapRemoteType('query.hessian.accounts.SendItemStatus', 'SendItemStatus');
Ejemplo n.º 20
0
    public $name;
    // String
    /**
     * If true then we calculate hash(salt + password), if false - hash(password + salt).
     */
    public $saltThenPwd;
    // boolean
    /**
     * Charset name used to provide raw bytes to hash method. E.g. 'UTF-8'.
     */
    public $charsetName;
    // String
    public function getId()
    {
        return $this->id;
    }
    public function getName()
    {
        return $this->name;
    }
    public function isSaltThenPwd()
    {
        return $this->saltThenPwd;
    }
    public function getCharsetName()
    {
        return $this->charsetName;
    }
}
Hessian::mapRemoteType('api.account.HashAlgoInfo', 'HashAlgoInfo');
/**
 * Result of cancelling pending item.
 *
 * @author andrey.kuprishov
 */
class CancelItemResult
{
    public $name;
    public function __construct($value = '')
    {
        $this->name = $value;
    }
    public function equals($obj)
    {
        return $this->name == $obj->name;
    }
    public static function Cancelled()
    {
        return new CancelItemResult('Cancelled');
    }
    public static function ItemActionNotFound()
    {
        return new CancelItemResult('ItemActionNotFound');
    }
    public static function ItemActionIsNotPending()
    {
        return new CancelItemResult('ItemActionIsNotPending');
    }
}
Hessian::mapRemoteType('query.hessian.accounts.CancelItemResult', 'CancelItemResult');
Ejemplo n.º 22
0
    public function getItemResourceId()
    {
        return $this->itemResourceId;
    }
    public function getRuneResourceId()
    {
        return $this->runeResourceId;
    }
    public function getStackCount()
    {
        return $this->stackCount;
    }
    public function getCounter()
    {
        return $this->counter;
    }
    public function getSenderName()
    {
        return $this->senderName;
    }
    public function getSubject()
    {
        return $this->subject;
    }
    public function getBody()
    {
        return $this->body;
    }
}
Hessian::mapRemoteType('query.hessian.accounts.ItemToSend', 'ItemToSend');
Ejemplo n.º 23
0
<?php

/**
 * Result of sending item. If succeeded contains ids of created actions.
 *
 * @author andrey.kuprishov
 */
class SendItemResult
{
    public $status;
    // SendItemStatus
    public $error;
    // String
    public $actionIds;
    // long[]
    public function getStatus()
    {
        return $this->status;
    }
    public function getError()
    {
        return $this->error;
    }
    public function getActionIds()
    {
        return $this->actionIds;
    }
}
Hessian::mapRemoteType('query.hessian.accounts.SendItemResult', 'SendItemResult');