function updatePortRsvAJAX() { global $sic; assertUIntArg('id'); assertStringArg('text', TRUE); $port_info = getPortInfo($sic['id']); fixContext(spotEntity('object', $port_info['object_id'])); assertPermission('object', 'ports', 'editPort'); if ($port_info['linked']) { throw new RackTablesError('Cant update port comment: port is already linked'); } if (!isset($port_info['reservation_comment'])) { $port_info['reservation_comment'] = ''; } if ($port_info['reservation_comment'] !== $sic['text']) { commitUpdatePortComment($sic['id'], $sic['text']); } echo 'OK'; }
function linkmgmt_opupdate() { if (!isset($_POST['id'])) { exit; } $ids = explode('_', $_POST['id'], 3); $retval = strip_tags($_POST['value']); if (isset($ids[1])) { if (permitted(NULL, NULL, 'set_link')) { if (isset($ids[2]) && $ids[2] == 'back') { linkmgmt_commitUpdatePortLink($ids[0], $ids[1], $retval, TRUE); } else { linkmgmt_commitUpdatePortLink($ids[0], $ids[1], $retval); } } else { $retval = "Permission denied!"; } } else { if (permitted(NULL, NULL, 'set_reserve_comment')) { commitUpdatePortComment($ids[0], $retval); } else { $retval = "Permission denied!"; } } /* return what jeditable should display after edit */ echo $retval; exit; }