function VentRequestPacket($cmd, $id, $pass)
 {
     $this->mapHeader();
     // set up the references
     $this->rawdata = pack("a16", $pass);
     // the only thing in the data part.
     $this->zero = 0;
     $this->cmd = $cmd == 1 || $cmd == 2 || $cmd == 7 ? $cmd : 1;
     $this->id = $id;
     $this->totlen = strlen($this->rawdata);
     $this->len = $this->totlen;
     $this->totpck = 1;
     $this->pck = 0;
     $this->crc = Vent::getCRC($this->rawdata);
     $this->encodeData();
     // $this->data & datakey set here.
     $this->encodeHeader();
     // $this->header & headkey set here.
     $this->packet = $this->header . $this->data;
 }
示例#2
0
 function Request()
 {
     $vent = new Vent();
     $vent->setTimeout(5000000);
     // 5 seconds
     if (!$vent->makeRequest(2, $this->m_cmdhost, $this->m_cmdport)) {
         $this->m_error = "Could not connect to server.";
         return -2;
     } else {
         $rawresponse = $vent->getResponse();
         if (empty($rawresponse)) {
             $this->m_error = "The server returned no data.";
             return -3;
         }
         $nohtmltags = strip_tags($rawresponse);
         $formattedResponse = preg_split("/[\r\n]+/", $nohtmltags, 0, REG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
         foreach ($formattedResponse as $line) {
             $val = $this->Parse($line);
             if ($val < 0) {
                 return $val;
             }
         }
         return 0;
     }
 }
示例#3
0
文件: index.php 项目: Sajaki/addons
         $display = VentriloInfo1($vstat);
     } elseif ($addon['config']['guildspeak_vent_disp'] == 2) {
         $name = "";
         $display = "<center><table width=\"95%\" border=\"0\">\n";
         $display .= VentriloDisplay2($vstat, $name, 0, 0);
         $display .= "</table></center>\n";
     } elseif ($addon['config']['guildspeak_vent_disp'] == 3) {
         $name = "Lobby";
         $display = "<center><table width=\"95%\" border=\"0\">\n";
         $display .= VentriloDisplay1($vstat, $name, 0, 0);
         $display .= "</table></center>\n";
     }
     return $display;
 } elseif ($addon['config']['guildspeak_vent_mode'] == 0) {
     require_once $addon['inc_dir'] . 'vent.inc.php';
     $vent = new Vent();
     $vent->setTimeout(300000);
     // 300 ms timeout
     if ($vent->makeRequest(2, $addon['config']['guildspeak_vent_host'], $addon['config']['guildspeak_vent_port'], $addon['config']['guildspeak_vent_pass'])) {
         $res = array('NAME' => '', 'PHONETIC' => '', 'COMMENT' => '', 'AUTH' => '', 'MAXCLIENTS' => '', 'VOICECODEC' => '', 'VOICEFORMAT' => '', 'UPTIME' => '', 'PLATFORM' => '', 'VERSION' => '', 'CHANNELCOUNT' => '', 'CLIENTCOUNT' => '', 'CLIENTFIELDS' => '', 'CLIENT:' => '');
         $clientarr = array();
         $cfields = array();
         $response = $vent->getResponse();
         // Start sorting and cleaning the string into an array
         foreach ($res as $key => $value) {
             $res[$key] = strstr($response, $key);
         }
         foreach ($res as $key => $value) {
             $res[$key] = str_replace($key . ":", "", $value);
         }
         foreach ($res as $key => $value) {