_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); } public function errorAction() { $result = $this->_request->getParam('serialresult'); if($result != ""){ $pbsNotifier = new Pbs_Notifier(); echo $pbsNotifier->notify('serial',$result); } } public function serialAction() { $serialnumber = $this->_request->getParam('serialnumber'); $mac = $this->_request->getParam('mac'); $login = $this->_request->getParam('login'); if(isset($serialnumber)){ // Create a session $n = new Pbs_Session(); $bootisomapper = new Application_Model_BootIsoMapper(); $bootiso = new Application_Model_BootIso(); $results = $bootisomapper->findBy(array('serialnumber' => $serialnumber),true); if(count($results) == 0){ $this->_redirect('/ipxe/auth/error/serialresult/noserial'); } $bootiso->setOptions($results[0]); $bootiso->setID($results[0]['bootisoID']); $groupID = $bootiso->getGroupID(); $client = new Application_Model_Client(); $client->setGroupID($groupID); $client->setMacadress($mac); $client->setCreated(time()); $client = $n->createClient($client); $clientID = $client->getID(); $session = new Application_Model_Session(); $session->setBootisoID($bootiso->getID()); $session->setClientID($clientID); $session->setTime(time()); $session->setIp($_SERVER['REMOTE_ADDR']); $session = $n->createSession($session); header('Content-Type: text/plain'); $result = "#!ipxe\n"; $result .= "imgfree\n"; if(isset($login)){ $result .= "login\n"; $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenu/alpha/".$session->getAlphasessionID()." http://\${username:uristring}:\${password:uristring}@".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$session->getAlphasessionID()."/login/true"; }else{ $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenu/alpha/".$session->getAlphasessionID()." http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$session->getAlphasessionID()."/login/false"; } header("Content-Length: ".(strlen($result))); echo $result; } else{ $this->_redirect('/ipxe/auth/error/serialresult/noserial'); } } }