Esempio n. 1
0
 public function __construct(Pakiti &$pakiti)
 {
     parent::__construct($pakiti);
     $this->_host = new Host();
     $this->_report = new Report();
     # Get the version of the client
     if (($this->_version = Utils::getHttpVar(Constants::$REPORT_VERSION)) == null) {
         //TODO Change version
         //Throw exception if null
         $this->_version = "cern_1";
     }
     # Map variables in the report to the internal variables
     $this->doReportMapping($this->_version);
     # Get the hostname and ip
     $this->_host->setHostname($this->_report_hostname);
     $this->_host->setIp($this->_report_ip);
     # Get the hostname and ip of the reporting machine (could be a NAT machine)
     $this->_host->setReporterIp(isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : "0.0.0.0");
     $this->_host->setReporterHostname(gethostbyaddr($this->_host->getReporterIp()));
     Utils::log(LOG_DEBUG, "Report from [reporterHost=" . $this->_host->getReporterHostname() . ",reporterIp=" . $this->_host->getReporterIp() . "]", __FILE__, __LINE__);
     # Is the host proxy?
     if ($this->_report_proxy == Constants::$HOST_IS_PROXY) {
         $this->_report->setTroughtProxy(Constants::$HOST_IS_PROXY);
         # Check if the proxy is authorized to send the reports
         if (!$this->checkProxyAuthz($this->_host->getReporterHostname(), $this->_host->getReporterIp())) {
             throw new Exception("Proxy " . $this->_host->getReporterHostname() . " is not authorized to send the reports");
         }
         Utils::log(LOG_INFO, "Proxy logging [proxy=" . $this->_host->getReporterHostname() . "] for [host=" . $this->_host->getHostname() . "]");
         # If we are in proxy mode, the reporterHostname and reporterIp will be replaced with the real hostname and ip of the client machine.
         $this->_host->setReporterHostname($this->_host->getHostname());
         $this->_host->setReporterIp($this->_host->getIp());
     } else {
         $this->_report->setTroughtProxy(Constants::$HOST_IS_NOT_PROXY);
     }
 }
Esempio n. 2
0
 public function __construct(Pakiti &$pakiti)
 {
     parent::__construct($pakiti);
     $this->_pakiti = $pakiti;
     $this->_sources = array();
     # Load all VDS sources
     $this->loadSources();
 }
Esempio n. 3
0
 public function __construct(&$pakiti)
 {
     parent::__construct($pakiti);
     $this->_time = microtime(true);
     $this->_htmlAttributes = array();
     $this->_httpGetVars = array();
     $this->_acl = new Acl();
     $this->_errors = array();
     $this->_messages = array();
 }