"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/web/lib/plugins/site/hooks/addsitehost.hook.php" between
fogproject-1.5.8.tar.gz and fogproject-1.5.9.tar.gz

About: FOG is a Linux-based network computer cloning solution for Windows, Mac OSX and various Linux distributions that ties together a few open-source tools with a PHP-based web interface. FOG doesn’t use any boot disks, or CDs; everything is done via TFTP and PXE.

addsitehost.hook.php  (fogproject-1.5.8):addsitehost.hook.php  (fogproject-1.5.9)
skipping to change at line 262 skipping to change at line 262
); );
if ($cnt !== 1) { if ($cnt !== 1) {
$sID = 0; $sID = 0;
} else { } else {
$Sites = self::getSubObjectIDs( $Sites = self::getSubObjectIDs(
'Site', 'Site',
array('id' => $SiteIDs) array('id' => $SiteIDs)
); );
$sID = array_shift($Sites); $sID = array_shift($Sites);
} }
$UserIsRestricted = self::getSubObjectIDs(
'SiteUserRestriction',
array('userID' => self::$FOGUser->get('id')),
'isRestricted'
)[0];
if ($UserIsRestricted == 1) {
$SitesFiltered = array_diff(
self::getSubObjectIDs(
'Site',
'',
'id'
),
self::getSubObjectIDs(
'SiteUserAssociation',
array('userID' => self::$FOGUser->get('id')),
'siteID'
)
);
}
self::arrayInsertAfter( self::arrayInsertAfter(
'<label for="productKey">' '<label for="productKey">'
. _('Host Product Key') . _('Host Product Key')
. '</label>', . '</label>',
$arguments['fields'], $arguments['fields'],
'<label for="site">' '<label for="site">'
. _('Host Site') . _('Host Site')
. '</label>', . '</label>',
self::getClass('SiteManager')->buildSelectBox( self::getClass('SiteManager')->buildSelectBox(
$sID $sID,
'',
'name',
$SitesFiltered
) )
); );
} }
/** /**
* Adds the site selector to the host. * Adds the site selector to the host.
* *
* @param mixed $arguments The arguments to modify. * @param mixed $arguments The arguments to modify.
* *
* @return void * @return void
*/ */
skipping to change at line 305 skipping to change at line 327
'edit', 'edit',
'addPost', 'addPost',
'editPost' 'editPost'
); );
if ($node != 'host') { if ($node != 'host') {
return; return;
} }
if (!in_array($sub, $subs)) { if (!in_array($sub, $subs)) {
return; return;
} }
$mac = trim(filter_input(INPUT_POST, 'mac'));
if (str_replace('_', '-', $tab) != 'host-general') { if (str_replace('_', '-', $tab) != 'host-general') {
return; self::getClass('HostManager')->getHostByMacAddresses($mac);
$hostID = self::$Host->get('id');
} else {
$hostID = $arguments['Host']->get('id');
} }
self::getClass('SiteHostAssociationManager')->destroy( self::getClass('SiteHostAssociationManager')->destroy(
array( array(
'hostID' => $arguments['Host']->get('id') 'hostID' => $hostID
) )
); );
$site = (int)filter_input(INPUT_POST, 'site'); $site = (int)filter_input(INPUT_POST, 'site');
if ($site) { if ($site) {
$insert_fields = array( $insert_fields = array(
'siteID', 'siteID',
'hostID' 'hostID'
); );
$insert_values = array(); $insert_values = array();
$insert_values[] = array( $insert_values[] = array(
$site, $site,
$arguments['Host']->get('id') $hostID
); );
if (count($insert_values)) { if (count($insert_values)) {
self::getClass('SiteHostAssociationManager') self::getClass('SiteHostAssociationManager')
->insertBatch( ->insertBatch(
$insert_fields, $insert_fields,
$insert_values $insert_values
); );
} }
} }
} }
skipping to change at line 346 skipping to change at line 374
* @param mixed $arguments The arguments to change. * @param mixed $arguments The arguments to change.
* *
* @retrun void * @retrun void
*/ */
public function hostImport($arguments) public function hostImport($arguments)
{ {
if (!in_array($this->node, (array)self::$pluginsinstalled)) { if (!in_array($this->node, (array)self::$pluginsinstalled)) {
return; return;
} }
if (!in_array('accesscontrol', (array)self::$pluginsinstalled)) { if (!in_array('accesscontrol', (array)self::$pluginsinstalled)) {
$insertIndex = 5; $insertIndex = 4;
} else { } else {
$insertIndex = 6; $insertIndex = 5;
} }
self::getClass('SiteHostAssociationManager') self::getClass('SiteHostAssociation')
->set('hostID', $argumetns['Host']->get('id')) ->set('hostID', $argumetns['Host']->get('id'))
->load('hostID') ->load('hostID')
->set('siteID', $arguments['data'][$insertIndex]) ->set('siteID', $arguments['data'][$insertIndex])
->save(); ->save();
} }
/** /**
* Adds the site to export. * Adds the site to export.
* *
* @param mixed $arguments The arguments to change. * @param mixed $arguments The arguments to change.
* *
 End of changes. 9 change blocks. 
7 lines changed or deleted 35 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)