Esempio n. 1
0
 /**
  * Extract data or throw errors.
  *
  * @return mixed
  */
 protected function getData()
 {
     // Check if client says "Everything aokay"
     if ($this->response->isSuccess()) {
         if ($this->response->isSplitcontent() == true) {
             try {
                 $this->response->setResponse($this->rebuildSplitcontent($this->response->getSplitname(), $this->response->getSplitcount()));
             } catch (\RuntimeException $exc) {
                 throw $exc;
             }
         }
         return $this->response->getResponse();
     } else {
         if ($this->getDebug() == true) {
             $string = vsprintf($GLOBALS['TL_LANG']['ERR']['client_error'] . ":<br />%s<br /><br />RPC Call: %s | Class: %s | Function: %s", array(nl2br($this->response->getError()->getMessage()), $this->response->getError()->getRPC(), strlen($this->response->getError()->getClass()) != 0 ? $this->response->getError()->getClass() : " - ", strlen($this->response->getError()->getFunction()) != 0 ? $this->response->getError()->getFunction() : " - "));
         } else {
             if ($this->response->getError()->getRPC() == "") {
                 $string = "There was an unknown error on client site.";
             } else {
                 $string = vsprintf($GLOBALS['TL_LANG']['ERR']['client_error'] . ":<br />%s<br /><br />RPC Call: %s", array(nl2br($this->response->getError()->getMessage()), $this->response->getError()->getRPC()));
             }
         }
         throw new \RuntimeException($string);
     }
 }
Esempio n. 2
0
 /**
  * String Response as String
  *
  * @param IO   $objContainer
  * @param Base $objCodifyEngine
  *
  * @return array|string
  */
 public function OutputResponse(IO $objContainer, $objCodifyEngine)
 {
     if ($objContainer->getError() != null) {
         $mixError = array();
         $mixError["language"] = $objContainer->getError()->getLanguage();
         $mixError["id"] = $objContainer->getError()->getID();
         $mixError["object"] = $objContainer->getError()->getObject();
         $mixError["msg"] = $objContainer->getError()->getMessage();
         $mixError["rpc"] = $objContainer->getError()->getRPC();
         $mixError["class"] = $objContainer->getError()->getClass();
         $mixError["function"] = $objContainer->getError()->getFunction();
         $mixError["exception"] = $objContainer->getError()->getException();
     } else {
         $mixError = "";
     }
     $mixOutput = array("success" => $objContainer->isSuccess(), "error" => $mixError, "response" => $objContainer->getResponse(), "splitcontent" => $objContainer->isSplitcontent(), "splitcount" => $objContainer->getSplitcount(), "splitname" => $objContainer->getSplitname());
     $mixOutput = serialize($mixOutput);
     $mixOutput = $objCodifyEngine->Encrypt($mixOutput);
     $mixOutput = gzcompress($mixOutput);
     $mixOutput = base64_encode($mixOutput);
     $mixOutput = "<|@|" . $mixOutput . "|@|>";
     return $mixOutput;
 }