/** * Set information of the node. * * @return void * @access private */ function set_info() { $this->status = -1; if (!$this->url) { return; } $turl = $this->url . '/inform'; $reqheads = array(); if ($this->auth) { $reqheads['Authorization'] = 'Basic ' . base64_encode($this->auth); } $res =& new EstraierPure_Response(); $rv = EstraierPure_Utility::shuttle_url($turl, $this->pxhost, $this->pxport, $this->timeout, $reqheads, null, $res); if (PEAR::isError($rv)) { return; } $this->status = $rv; if ($rv != 200) { return; } $lines = explode("\n", rtrim($res->body(), "\n")); if (count($lines) == 0) { return; } $elems = explode("\t", $lines[0]); if (count($elems) != 5) { return; } $this->name = $elems[0]; $this->label = $elems[1]; $this->dnum = intval($elems[2]); $this->wnum = intval($elems[3]); $this->size = floatval($elems[4]); }
/** * Set information of the node. * * @return void * @access private */ function set_info() { $this->status = -1; if (!$this->url) { return; } $turl = $this->url . '/inform'; $reqheads = array(); if ($this->auth) { $reqheads['authorization'] = 'Basic ' . base64_encode($this->auth); } $res =& EstraierPure_Utility::shuttle_url($turl, $this->pxhost, $this->pxport, $this->timeout, $reqheads); if (!$res) { return; } $this->status = $res->status(); if ($res->is_error()) { return; } $lines = explode("\n", $res->body()); if (count($lines) == 0) { return; } $elems = explode("\t", $lines[0]); if (count($elems) != 5) { return; } $this->name = $elems[0]; $this->label = $elems[1]; $this->dnum = intval($elems[2]); $this->wnum = intval($elems[3]); $this->size = floatval($elems[4]); $llen = count($lines); if ($llen < 2) { return; } $lnum = 1; if ($lnum < $llen && strlen($lines[$lnum]) < 1) { $lnum++; } $this->admins = array(); while ($lnum < $llen) { $line = $lines[$lnum]; if (strlen($line) < 1) { break; } $this->admins[] = $line; $lnum++; } if ($lnum < $llen && strlen($lines[$lnum]) < 1) { $lnum++; } $this->users = array(); while ($lnum < $llen) { $line = $lines[$lnum]; if (strlen($line) < 1) { break; } $this->users[] = $line; $lnum++; } if ($lnum < $llen && strlen($lines[$lnum]) < 1) { $lnum++; } $this->links = array(); while ($lnum < $llen) { $line = $lines[$lnum]; if (strlen($line) < 1) { break; } $links = explode($line); if (count($links) == 3) { $this->links[] = $links; } $lnum++; } }