Beispiel #1
0
 /**
  * Parses a ServerQuery error and returns a TeamSpeak3_Adapter_ServerQuery_Exception object.
  *
  * @param  string $err
  * @throws TeamSpeak3_Adapter_ServerQuery_Exception
  * @return void
  */
 private function fetchError($err)
 {
     $cells = $err->section(TeamSpeak3::SEPERATOR_CELL, 1, 3);
     foreach ($cells->split(TeamSpeak3::SEPERATOR_CELL) as $pair) {
         list($ident, $value) = $pair->split(TeamSpeak3::SEPERATOR_PAIR);
         $this->err[$ident->toString()] = $value->is_numeric() ? $value->toInt() : $value->unescape();
     }
     if ($this->getErrorProperty("id", 0x0) != 0x0) {
         if ($permid = $this->getErrorProperty("failed_permid")) {
             $suffix = " (failed on " . $this->cmd->section(TeamSpeak3::SEPERATOR_CELL) . " " . $permid . "/0x" . strtoupper(dechex($permid)) . ")";
         } elseif ($details = $this->getErrorProperty("extra_msg")) {
             $suffix = " (" . $details . ")";
         } else {
             $suffix = "";
         }
         throw new TeamSpeak3_Adapter_ServerQuery_Exception($this->getErrorProperty("msg") . $suffix, $this->getErrorProperty("id"));
     }
 }
Beispiel #2
0
 /**
  * Parses a ServerQuery error and throws a TeamSpeak3_Adapter_ServerQuery_Exception object if
  * there's an error.
  *
  * @param  string $err
  * @throws TeamSpeak3_Adapter_ServerQuery_Exception
  * @return void
  */
 protected function fetchError($err)
 {
     $cells = $err->section(TeamSpeak3::SEPARATOR_CELL, 1, 3);
     foreach ($cells->split(TeamSpeak3::SEPARATOR_CELL) as $pair) {
         list($ident, $value) = $pair->split(TeamSpeak3::SEPARATOR_PAIR);
         $this->err[$ident->toString()] = $value->isInt() ? $value->toInt() : $value->unescape();
     }
     TeamSpeak3_Helper_Signal::getInstance()->emit("notifyError", $this);
     if ($this->getErrorProperty("id", 0x0) != 0x0 && $this->exp) {
         if ($permid = $this->getErrorProperty("failed_permid")) {
             if ($permsid = key($this->con->request("permget permid=" . $permid, FALSE)->toAssocArray("permsid"))) {
                 $suffix = " (failed on " . $permsid . ")";
             } else {
                 $suffix = " (failed on " . $this->cmd->section(TeamSpeak3::SEPARATOR_CELL) . " " . $permid . "/0x" . strtoupper(dechex($permid)) . ")";
             }
         } elseif ($details = $this->getErrorProperty("extra_msg")) {
             $suffix = " (" . trim($details) . ")";
         } else {
             $suffix = "";
         }
         throw new TeamSpeak3_Adapter_ServerQuery_Exception($this->getErrorProperty("msg") . $suffix, $this->getErrorProperty("id"));
     }
 }
Beispiel #3
0
 /**
  * Returns a client-like short-formatted version of the TeamSpeak 3 version string.
  *
  * @param  string $version
  * @return string
  */
 public static function versionShort($version)
 {
     if (!$version instanceof TeamSpeak3_Helper_String) {
         $version = new TeamSpeak3_Helper_String($version);
     }
     return $version->section(" ", 0);
 }
Beispiel #4
0
 /**
  * Returns a client-like formatted version of the TeamSpeak 3 version string.
  *
  * @param  string $version
  * @param  string $format
  * @return string
  */
 public static function version($version, $format = "Y-m-d h:i:s")
 {
     if (!$version instanceof TeamSpeak3_Helper_String) {
         $version = new TeamSpeak3_Helper_String($version);
     }
     $buildno = $version->section("[", 1)->filterDigits()->toInt();
     return $buildno <= 15001 ? $version : $version->section("[")->append("(" . date($format, $buildno) . ")");
 }