コード例 #1
0
ファイル: edit-result.php プロジェクト: martinsv/phpipam
    print "\t<a class='btn btn-sm btn-danger editSectionSubmitDelete' id='editSectionSubmitDelete'>" . _("Confirm") . "</a>";
    print "</div>";
    print "</div>";
    print "</div>";
} else {
    # set variables for update
    $values = array("id" => @$_POST['id'], "name" => @$_POST['name'], "description" => @$_POST['description'], "strictMode" => @$_POST['strictMode'], "subnetOrdering" => @$_POST['subnetOrdering'], "showVLAN" => @$_POST['showVLAN'], "showVRF" => @$_POST['showVRF'], "masterSection" => @$_POST['masterSection']);
    # set permissions
    foreach ($_POST as $key => $val) {
        if (substr($key, 0, 5) == "group") {
            if ($val != "0") {
                $perm[substr($key, 5)] = $val;
            }
        }
    }
    $values['permissions'] = isset($perm) ? json_encode($perm) : "";
    # delegate to all subnets?
    if (isset($_POST['delegate'])) {
        if ($_POST['delegate'] == 1) {
            $values['delegate'] = 1;
        } else {
            $values['delegate'] = 0;
        }
    }
    # execute update
    if (!$Sections->modify_section($_POST['action'], $values, @$_POST['id'])) {
        $Result->show("danger", _("Section {$_POST['action']} failed"), true);
    } else {
        $Result->show("success", _("Section {$_POST['action']} successful"), true);
    }
}
コード例 #2
0
<?php

/**
 * Function to add / edit / delete section
 *************************************************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database);
$Sections = new Sections($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# create array of ordering
$otmp = explode(";", $_POST['position']);
foreach ($otmp as $ot) {
    $ptmp = explode(":", $ot);
    $order[$ptmp[0]] = $ptmp[1];
}
#update
if (!$Sections->modify_section("reorder", $order)) {
    $Result->show("danger", _("Section reordering failed"), true);
} else {
    $Result->show("success", _("Section reordering successful"), true);
}