1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
<?php
class Fbgui_IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$params = $this->_request->getParam('postdata');
if(isset($_SESSION['postdata'])){
$_POST = ($_SESSION['postdata']);
}
if(isset($_POST['bootisoID']) || isset($_POST['serialnumber'])){
// Create a session
$n = new Pbs_Session();
$bootisomapper = new Application_Model_BootIsoMapper();
$bootiso = new Application_Model_BootIso();
if(isset($_POST['bootisoID'])){
$bootisomapper->find($_POST['bootisoID'],$bootiso);
$groupID = $bootiso->getGroupID();
}
elseif(isset($_POST['serialnumber'])){
$results = $bootisomapper->findBy('serialnumber',$_POST['serialnumber']);
if(count($results) == 0){
echo 'Your serialnumber is not known by the system';
}
$bootiso->setOptions($results[0]);
$bootiso->setID($results[0]['bootisoID']);
$groupID = $bootiso->getGroupID();
}
$client = new Application_Model_Client();
$client->setMacadress($_POST['mac']);
$client->setHardwarehash($_POST['hardwarehash']);
$client->setGroupID($groupID);
$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);
$_SESSION['alphasessionID'] = $session->getAlphasessionID();
// Request Bootmenu
$pbsFilter = new Pbs_Filter();
$bootmenuID = $pbsFilter->evaluate();
if($bootmenuID != null){
print_a('Debug Output',
'Session is now set',
'Your sessionID is '.$session->getID(),
'Your alphasessionID is '.$session->getAlphasessionID(),
'Your client is '.$session->getClientID(),
'goto bootmenu '.$bootmenuID);
$bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
$res = $bootmenuentriesMapper->findBy('bootmenuID',$bootmenuID);
$this->view->entries = $res;
}
else{
print_a('Debug Output',
'Session is now set',
'Your sessionID is '.$session->getID(),
'Your alphasessionID is '.$session->getAlphasessionID(),
'Your client is '.$session->getClientID(),
'there is no bootmenu for you');
echo "<a href='/fbgui/auth/login/'>Goto Login to get a Bootmenu</a>";
}
}
else{
echo "<h1>Not Welcome</h1>";
}
}
public function startAction(){
$bootmenuntryID = $this->_request->getParam('bme');
$bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
$bootmenuentry = new Application_Model_BootMenuEntries();
$bootmenuentriesMapper->find($bootmenuntryID,$bootmenuentry);
$sessionMapper = new Application_Model_SessionMapper();
$session_k = $sessionMapper->findBy('alphasessionID',$_SESSION['alphasessionID']);
$session = new Application_Model_Session();
$session->setOptions($session_k[0]);
$session->setID($session_k[0]['sessionID']);
#print_a($bootmenuentry);
$session->setBootmenuentryID($bootmenuntryID);
$session->setBootosID($bootmenuentry->getBootosID());
$sessionMapper->save($session);
echo "<h1>Downloading</h1>";
echo "<script>\n";
echo "fbgui.setCallbackOnFinished('foo();');\n";
echo "fbgui.startDownload('http://132.230.4.27/dev/resource/getkernel/alpha/".$_SESSION['alphasessionID']."/file/kernel');\n";
echo "fbgui.startDownload('http://132.230.4.27/dev/resource/getinitramfs/alpha/".$_SESSION['alphasessionID']."/file/initramfs');\n";
echo "fbgui.startDownload('http://132.230.4.27/dev/resource/getkcl/alpha/".$_SESSION['alphasessionID']."/file/kcl');\n";
echo "fbgui.getSession('".$_SESSION['alphasessionID']."');\n";
echo "function foo(){
fbgui.quit();
}";
echo "</script>";
}
}
|