Esempio n. 1
0
 along with GLPI. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
$alias = new NetworkAlias();
if (!isset($_GET["id"])) {
    $_GET["id"] = -1;
}
if (empty($_GET["networknames_id"])) {
    $_GET["networknames_id"] = "";
}
if (isset($_POST["add"])) {
    $alias->check(-1, 'w', $_POST);
    if ($newID = $alias->add($_POST)) {
        Ajax::refreshPopupTab();
        Event::log($newID, $alias->getType(), 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $alias->check($_POST['id'], 'd');
        $item = $alias->getItem();
        $alias->delete($_POST);
        Event::log($_POST["id"], $alias->getType(), 4, "setup", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
        if ($item) {
            Html::redirect($item->getLinkURL());
        } else {
            Html::redirect($CFG_GLPI['root_doc'] . "/front/central.php");
Esempio n. 2
0
 along with GLPI. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
$alias = new NetworkAlias();
if (!isset($_GET["id"])) {
    $_GET["id"] = -1;
}
if (empty($_GET["networknames_id"])) {
    $_GET["networknames_id"] = "";
}
if (isset($_POST["add"])) {
    $alias->check(-1, CREATE, $_POST);
    if ($newID = $alias->add($_POST)) {
        Event::log($newID, $alias->getType(), 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($alias->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
} else {
    if (isset($_POST["purge"])) {
        $alias->check($_POST['id'], PURGE);
        $item = $alias->getItem();
        $alias->delete($_POST, 1);
        Event::log($_POST["id"], "networkname", 5, "inventory", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
        if ($item) {
            Html::redirect($item->getLinkURL());