Exemplo n.º 1
0
 function retrieveP2pImageAction()
 {
     $cust = $this->view->cust = $this->resolveCustomerByShortnameParam();
     // includes security checks
     $this->setIXP($cust);
     $category = $this->setCategory('category', false);
     $period = $this->setPeriod();
     $proto = $this->setProtocol();
     // Find the possible VLAN interfaces that this customer has for the given IXP
     // and ensure we have a valid svli
     $srcVlis = $this->getD2R('\\Entities\\VlanInterface')->getForCustomer($cust, $this->ixp);
     if (!($svli = $this->getParam('svli', false)) || !isset($svli, $srcVlis)) {
         $this->getLogger()->alert("P2P file request with illegal svli={$svli} for {$cust->getShortname()}/{$this->getUser()->getUsername()}");
         die;
     }
     // Find the possible interfaces that this customer peers with and ensure we have a valid dvli
     $dstVlis = $this->getD2R('\\Entities\\VlanInterface')->getObjectsForVlan($srcVlis[$svli]->getVlan());
     unset($dstVlis[$svli]);
     if (!($dvli = $this->getParam('dvli', false)) || !isset($dvli, $dstVlis)) {
         $this->getLogger()->alert("P2P file request with illegal dvli={$dvli} for {$cust->getShortname()}/{$this->getUser()->getUsername()}");
         die;
     }
     $filename = IXP_Mrtg::getMrtgP2pFilePath($this->ixp->getMrtgP2pPath(), $svli, $dvli, $category, $period, $proto);
     $this->getLogger()->debug("Serving P2P {$filename} to {$this->getUser()->getUsername()}");
     if (@readfile($filename) === false) {
         $this->getLogger()->notice('Could not load ' . $filename . ' for mrtg/retrieveImageAction');
         @readfile(APPLICATION_PATH . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . '300x1.png');
     }
 }