Exemple #1
0
 /**
  * Executes API requests.
  *
  * @return string JSON encoded value
  */
 public function execute()
 {
     if ($this->json->hasError()) {
         $this->jsonError(null, '-32700', null, null, true);
         return $this->json->encode($this->_response[0]);
     }
     if ($this->_jsonDecoded === null || $this->_jsonDecoded == []) {
         $this->jsonError(null, '-32600', null, null, true);
         return $this->json->encode($this->_response[0]);
     }
     foreach (zbx_toArray($this->_jsonDecoded) as $call) {
         $call = is_array($call) ? $call : [$call];
         // notification
         if (!array_key_exists('id', $call)) {
             $call['id'] = null;
         }
         if (!$this->validate($call)) {
             continue;
         }
         list($api, $method) = array_merge(explode('.', $call['method']), [null, null]);
         $result = $this->apiClient->callMethod($api, $method, $call['params'], $call['auth']);
         $this->processResult($call, $result);
     }
     if (is_array($this->_jsonDecoded) && array_keys($this->_jsonDecoded) === range(0, count($this->_jsonDecoded) - 1)) {
         // Return response as encoded batch if $this->_jsonDecoded is associative array.
         return $this->json->encode($this->_response);
     }
     return $this->json->encode($this->_response[0]);
 }
Exemple #2
0
 public function execute($encoded = true)
 {
     $call = $this->_jsonDecoded;
     // notification
     if (!isset($call['id'])) {
         $call['id'] = null;
     }
     if ($this->validate($call)) {
         $params = isset($call['params']) ? $call['params'] : null;
         $auth = isset($call['auth']) ? $call['auth'] : null;
         list($api, $method) = explode('.', $call['method']);
         $result = $this->apiClient->callMethod($api, $method, $params, $auth);
         $this->processResult($call, $result);
     }
     if (!$encoded) {
         return $this->_response;
     } else {
         return $this->json->encode($this->_response);
     }
 }
 /**
  * Call the client method and return the result.
  *
  * @param string 	$method		API method name
  * @param mixed 	$params		API method parameters
  *
  * @return CApiClientResponse
  */
 protected function callClientMethod($method, $params)
 {
     return $this->client->callMethod($this->api, $method, $params, $this->auth);
 }
Exemple #4
0
<?php

$api =& CApiClient::getInstance();
$usm =& CUserManage::getInstance();
$us =& CUser::getInstance();
$fb =& CFotobox::getInstance();
$fbm =& CFotoboxManage::getInstance();
$fl =& CFlix::getInstance();
$userData = $us->find($_USER_ID);
$result = 0;
$codes = array();
$foto_ids = explode(',', $_REQUEST['foto_ids']);
$fastflix = $_REQUEST['fastflix'];
$blogIds = array();
if (isset($_GET['quickpost'])) {
    if (isset($_REQUEST['foto_ids'])) {
        $ids = explode(',', $foto_ids);
        $fotos = $fb->fotosByIds($foto_ids, $_USER_ID);
        $cnt_fotos = count($fotos);
        $ff_code_embed = '';
        foreach ($fotos as $v) {
            $ff_code_embed .= '<div style="padding-top:5px;"><a href="http://' . FF_SERVER_NAME . '/users/' . $user_data['U_USERNAME'] . '/foto/' . $v['P_ID'] . '/" target="_blank"><img src="http://' . FF_SERVER_NAME . '/foto?key=' . $v['P_KEY'] . '&size=400x300" border="0" /></a></div>' . "\n";
        }
    } else {
        if (isset($_REQUEST['fastflix'])) {
            $xml_orig = '/xml/' . substr($fastflix, 0, 2) . '/' . $fastflix . '.xml';
            $xml_path = '/xml/' . substr($fastflix, 0, 2) . '/' . $fastflix . '_' . NOW . '.xml';
            $flix_data = $fl->fastflix($_REQUEST['fastflix'], $_USER_ID);
            $sizeArr = explode('x', $flix_data['A_SIZE']);
            $containerWidth = $sizeArr[0];
            $containerHeight = $sizeArr[1];