"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/web/lib/plugins/site/class/site.class.php" between
fogproject-1.5.5.tar.gz and fogproject-1.5.6.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.

site.class.php  (fogproject-1.5.5):site.class.php  (fogproject-1.5.6)
skipping to change at line 235 skipping to change at line 235
$hostids = self::getSubObjectIDs( $hostids = self::getSubObjectIDs(
'Host', 'Host',
array('id' => $associds) array('id' => $associds)
); );
$hostids = array_diff( $hostids = array_diff(
self::getSubObjectIDs('Host'), self::getSubObjectIDs('Host'),
$hostids $hostids
); );
$this->set('hostsnotinme', (array)$hostids); $this->set('hostsnotinme', (array)$hostids);
} }
/**
* Set's values for associative fields.
*
* @param string $assocItem the assoc item to work from/with
* @param string $alterItem the alternate item to work with
* @param bool $implicitCall call class implicitely instead of appending
* with association
*
* @return object
*/
public function assocSetter($assocItem, $alterItem = '', $implicitCall = fal
se)
{
// Lower our item
$alterItem = strtolower($alterItem ?: $assocItem);
// Getter is pluralized
$plural = "{$alterItem}s";
// Class to call, if implicit leave off association.
$classCall = ($implicitCall ? $assocItem : "{$assocItem}Association");
// Main object and string setters.
$obj = strtolower(get_class($this));
$objstr = "{$obj}ID";
$assocstr = "{$alterItem}ID";
// Don't work on item that isn't loaded yet.
if (!$this->isLoaded($plural)) {
return $this;
}
// Get the current items.
$items = $this->get($plural);
Route::ids(
$classCall,
[$objstr => $this->get('id')],
$assocstr
);
$cur = json_decode(Route::getData(), true);
// Get the items differing between the current and what we have associat
ed.
// Remove the items if there's anything to remove.
// Take in account that the array_diff function returns different values
depending the order of the factors. In this way:
// When we delete hosts or users from the webUI:
$delItems = array_diff($cur, $items);
// When we add hosts or users from the webUI:
$addItems = array_diff($items, $cur);
if (count($delItems)) {
Route::deletemass(
$classCall,
[
$objstr => $this->get('id'),
$assocstr => $delItems,
]
);
return $this;
}
if (count($addItems)) {
$items = $addItems;
// Setup our insert.
$insert_fields = [
$objstr,
$assocstr
];
$insert_values = [];
if ($assocstr == 'moduleID') {
$insert_fields[] = 'state';
}
foreach ($items as &$id) {
$insert_val = [
$this->get('id'),
$id
];
if ($assocstr == 'moduleID') {
$insert_val[] = 1;
}
$insert_values[] = $insert_val;
unset($insert_val, $id);
}
if (count($insert_values ?: []) > 0) {
self::getClass("{$classCall}manager")->insertBatch(
$insert_fields,
$insert_values
);
}
}
return $this;
}
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 88 lines changed or added

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