Esempio n. 1
0
        } else {
            // All is well for error checking, add the host into the db.
            $tempHost = new NagiosHost();
            $tempHost->setName($_POST['host_manage']['host_name']);
            $tempHost->setAlias($_POST['host_manage']['alias']);
            if (isset($_GET['parent_id'])) {
                // Get the host by that parent_id
                $host = NagiosHostPeer::retrieveByPk($_GET['parent_id']);
                if ($host) {
                    // valid host, add parent
                    $tempHost->addParentByName($host->getName());
                }
            }
            $tempHost->setAddress($_POST['host_manage']['address']);
            if (isset($_POST['host_manage']['display_name'])) {
                $tempHost->setDisplayName($_POST['host_manage']['display_name']);
            }
            $tempHost->save();
            header("Location: hosts.php?id=" . $tempHost->getId());
            die;
        }
    }
}
$add_template_list[] = array("host_template_id" => '', "template_name" => "None");
$lilac->get_host_template_list($template_list);
if (count($template_list)) {
    foreach ($template_list as $tempTemplate) {
        $add_template_list[] = array('host_template_id' => $tempTemplate->getId(), 'template_name' => $tempTemplate->getName());
    }
}
print_header("Add New Host");