public function multicast_post() { try { // Error Checking if (!trim($_REQUEST['name'])) { throw new Exception(_('Please input a session name')); } if (!$_REQUEST['image']) { throw new Exception(_('Please choose an image')); } if ($this->getClass('MulticastSessionsManager')->exists(trim($_REQUEST['name']))) { throw new Exception(_('Session with that name already exists')); } if ($this->getClass('HostManager')->exists(trim($_REQUEST['name']))) { throw new Exception(_('Session name cannot be the same as an existing hostname')); } if (is_numeric($_REQUEST['timeout']) && $_REQUEST['timeout'] > 0) { $this->FOGCore->setSetting('FOG_UDPCAST_MAXWAIT', $_REQUEST['timeout']); } $countmc = $this->getClass('MulticastSessionsManager')->count(array('stateID' => array(0, 1, 2, 3))); $countmctot = $this->FOGCore->getSetting('FOG_MULTICAST_MAX_SESSIONS'); $Image = new Image($_REQUEST['image']); $StorageGroup = new StorageGroup($Image->getStorageGroup()); $StorageNode = $StorageGroup->getMasterStorageNode(); if ($countmc >= $countmctot) { throw new Exception(_('Please wait until a slot is open<br/>There are currently ' . $countmc . ' tasks in queue<br/>Your server only allows ' . $countmctot)); } $MulticastSession = new MulticastSessions(array('name' => trim($_REQUEST['name']), 'port' => $this->FOGCore->getSetting('FOG_UDPCAST_STARTINGPORT'), 'image' => $Image->get('id'), 'stateID' => 0, 'sessclients' => $_REQUEST['count'], 'isDD' => $Image->get('imageTypeID'), 'starttime' => $this->formatTime('now', 'Y-m-d H:i:s'), 'interface' => $StorageNode->get('interface'), 'logpath' => $Image->get('path'))); if (!$MulticastSession->save()) { $this->FOGCore->setMessage(_('Failed to create Session')); } // Sets a new port number so you can create multiple Multicast Tasks. $randomnumber = mt_rand(24576, 32766) * 2; while ($randomnumber == $MulticastSession->get('port')) { $randomnumber = mt_rand(24576, 32766) * 2; } $this->FOGCore->setSetting('FOG_UDPCAST_STARTINGPORT', $randomnumber); $this->FOGCore->setMessage(_('Multicast session created') . '<br />' . $MulticastSession->get('name') . ' has been started on port ' . $MulticastSession->get('port')); } catch (Exception $e) { $this->FOGCore->setMessage($e->getMessage()); } $this->FOGCore->redirect('?node=' . $this->node . '&sub=multicast'); }
try { // Send the dmi information. if ($_REQUEST['action'] == 'dmi') { print $FOGCore->getSetting('FOG_PLUGIN_CAPONE_DMI'); } else { if ($_REQUEST['action'] == 'imagelookup' && $_REQUEST['key'] != null) { $key = trim(base64_decode(trim($_REQUEST['key']))); // Find the key association $Capones = $FOGCore->getClass('CaponeManager')->find(); if ($FOGCore->getClass('CaponeManager')->count() > 0) { foreach ($Capones as $Capone) { if (stristr($key, $Capone->get('key'))) { $Image = new Image($Capone->get('imageID')); $OS = new OS($Capone->get('osID')); $StorageGroup = new StorageGroup($Image->get('storageGroupID')); $StorageNode = $StorageGroup->getMasterStorageNode(); switch ($Image->get('imageTypeID')) { case 1: $imgType = 'n'; break; case 2: $imgType = 'mps'; break; case 3: $imgType = 'mpa'; break; case 4: $imgType = 'dd'; break; } $imgPartitionType = $Image->getImagePartitionType()->get('type');