"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "front/lock.form.php" between
glpi-9.3.3.tgz and glpi-9.4.0.tgz

About: GLPI is an IT and asset management software (Information Resource Manager).

lock.form.php  (glpi-9.3.3.tgz):lock.form.php  (glpi-9.4.0.tgz)
skipping to change at line 43 skipping to change at line 43
/** /**
* @since 0.84 * @since 0.84
*/ */
include ('../inc/includes.php'); include ('../inc/includes.php');
if (isset($_POST['itemtype'])) { if (isset($_POST['itemtype'])) {
$itemtype = $_POST['itemtype']; $itemtype = $_POST['itemtype'];
$source_item = new $itemtype(); $source_item = new $itemtype();
if ($source_item->canCreate()) { if ($source_item->can($_POST['id'], UPDATE)) {
$devices = Item_Devices::getDeviceTypes(); $devices = Item_Devices::getDeviceTypes();
$actions = array_merge($CFG_GLPI['inventory_lockable_objects'], array_valu es($devices)); $actions = array_merge($CFG_GLPI['inventory_lockable_objects'], array_valu es($devices));
if (isset($_POST["unlock"])) { if (isset($_POST["unlock"])) {
$source_item->check($_POST['id'], UPDATE);
foreach ($actions as $type) { foreach ($actions as $type) {
if (isset($_POST[$type]) && count($_POST[$type])) { if (isset($_POST[$type]) && count($_POST[$type])) {
$item = new $type(); $item = new $type();
foreach (array_keys($_POST[$type]) as $key) { foreach (array_keys($_POST[$type]) as $key) {
if (!$item->can($key, UPDATE)) {
Session::addMessageAfterRedirect(
sprintf(
__('You do not have rights to restore %s item.'),
$type
),
true,
ERROR
);
continue;
}
//Force unlock //Force unlock
$item->restore(['id' => $key]); $item->restore(['id' => $key]);
} }
} }
} }
//Execute hook to unlock fields managed by a plugin, if needed //Execute hook to unlock fields managed by a plugin, if needed
Plugin::doHookFunction('unlock_fields', $_POST); Plugin::doHookFunction('unlock_fields', $_POST);
} else if (isset($_POST["purge"])) { } else if (isset($_POST["purge"])) {
$source_item->check($_POST['id'], PURGE);
foreach ($actions as $type) { foreach ($actions as $type) {
if (isset($_POST[$type]) && count($_POST[$type])) { if (isset($_POST[$type]) && count($_POST[$type])) {
$item = new $type(); $item = new $type();
foreach (array_keys($_POST[$type]) as $key) { foreach (array_keys($_POST[$type]) as $key) {
if (!$item->can($key, PURGE)) {
Session::addMessageAfterRedirect(
sprintf(
__('You do not have rights to delete %s item.'),
$type
),
true,
ERROR
);
continue;
}
//Force unlock //Force unlock
$item->delete(['id' => $key], 1); $item->delete(['id' => $key], 1);
} }
} }
} }
} }
} }
} }
Html::back(); Html::back();
 End of changes. 6 change blocks. 
5 lines changed or deleted 26 lines changed or added

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