コード例 #1
0
 public function run_deployment()
 {
     if (!ALLOW_DEPLOYMENT) {
         echo NConf_HTML::limit_space(NConf_HTML::show_error('ERROR', 'Deployment functionality is currently disabled.'));
     } elseif (ALLOW_DEPLOYMENT && (!ALLOW_DIRECT_DEPLOYMENT && empty($_POST["status"]))) {
         echo NConf_HTML::limit_space(NConf_HTML::show_error('ERROR', 'Please first run the "Generate Nagios config".'));
     } elseif (ALLOW_DEPLOYMENT && ALLOW_DIRECT_DEPLOYMENT || ALLOW_DEPLOYMENT && (!ALLOW_DIRECT_DEPLOYMENT && (!empty($_POST["status"]) && $_POST["status"] == "OK"))) {
         echo NConf_HTML::table_begin('class="table_checks"', array(170, 50, ''));
         // DEPLOY
         // First do the local module
         $local_module = $this->modules["local"];
         if ($local_module->configured()) {
             NConf_DEBUG::set('', 'DEBUG', 'Deploying ' . $local_module->name);
             echo NConf_HTML::table_row_text(NConf_HTML::title($local_module->name, '', 'class="content_header"'));
             NConf_DEBUG::set($local_module->destinations, 'DEBUG', $local_module->name);
             $local_module->deploy();
             echo NConf_HTML::table_row_text(NConf_HTML::line(), '', 'colspan=3');
         }
         // Then do all other modules if they are configured
         foreach ($this->modules as $module) {
             // Dont do the "local" module
             // Check also if module is configured
             if ($module->name == "local" or !$module->configured()) {
                 continue;
             }
             NConf_DEBUG::set('', 'DEBUG', 'Deploying ' . $module->name);
             echo NConf_HTML::table_row_text(NConf_HTML::title($module->name, '', 'class="content_header"'));
             NConf_DEBUG::set($module->destinations, 'DEBUG', $module->name);
             // run the deploy
             $module->deploy();
             echo NConf_HTML::table_row_text(NConf_HTML::line(), '', 'colspan=3');
         }
         echo NConf_HTML::table_end();
     } else {
         echo NConf_HTML::text('Deployment is enabled, but your configuration seems to have errors.', TRUE, 'div', 'class="attention"');
     }
 }
コード例 #2
0
 public static function show_debug($LEVEL = '', $IN_CONTENT = FALSE, $BACK_BUTTON = FALSE)
 {
     if (self::status($LEVEL)) {
         $output = '';
         $after_titel = TRUE;
         $group_open = FALSE;
         $group_level = 0;
         foreach (self::$debug as $entry) {
             if (empty($LEVEL) || $LEVEL == $entry["LEVEL"]) {
                 //if ( !empty($entry["GROUP"]) ){
                 if (is_int($entry["GROUP"]) and $entry["GROUP"] > 0) {
                     # Handle groups
                     if ($entry["GROUP"] == $group_level and $group_open) {
                         $output .= '</fieldset><fieldset';
                     } elseif ($entry["GROUP"] == $group_level and !$group_open) {
                         $output .= '<fieldset';
                     } elseif ($entry["GROUP"] > $group_level) {
                         $output .= '<fieldset';
                         $group_level++;
                         $group_open = TRUE;
                     } elseif ($entry["GROUP"] < $group_level) {
                         for ($level = $group_level; $level >= $entry["GROUP"]; $level--) {
                             $output .= '</fieldset>';
                         }
                         $output .= '<fieldset';
                         $group_level = $entry["GROUP"];
                     }
                     # define the background
                     if ((1 & $entry["GROUP"]) == 1) {
                         $bgcolor = "even";
                     } else {
                         $bgcolor = "odd";
                     }
                     $output .= ' class="' . $bgcolor . '">';
                     // put title in FIELDSET - LEGEND
                     if (!empty($entry["TITLE"])) {
                         $output .= '<legend><b>' . $entry["TITLE"] . '</b></legend>';
                     }
                 } elseif ($entry["GROUP"] === FALSE) {
                     for ($level = $group_level; $level > 0; $level--) {
                         $output .= '</fieldset>';
                     }
                     $group_open = FALSE;
                 } elseif (is_int($entry["GROUP"]) and $entry["GROUP"] < 0) {
                     for ($level = (int) -$group_level; $level <= $entry["GROUP"]; $level++) {
                         $output .= '</fieldset>';
                     }
                     $group_open = FALSE;
                 } elseif (is_array($entry["MESSAGE"])) {
                     if ($after_titel) {
                         $output .= NConf_HTML::swap_content($entry["MESSAGE"], $entry["TITLE"]);
                     } else {
                         $output .= NConf_HTML::swap_content($entry["MESSAGE"], $entry["TITLE"], FALSE, FALSE);
                     }
                 } else {
                     if ($IN_CONTENT) {
                         if (!empty($entry["TITLE"])) {
                             if (!empty($entry["MESSAGE"])) {
                                 if ($after_titel) {
                                     $output .= NConf_HTML::text('<b>' . $entry["TITLE"] . '</b>: ' . $entry["MESSAGE"], FALSE);
                                 } else {
                                     $output .= NConf_HTML::text('<b>' . $entry["TITLE"] . '</b>: ' . $entry["MESSAGE"]);
                                 }
                                 // info about new line for next message
                                 $after_titel = FALSE;
                             } else {
                                 $output .= NConf_HTML::title($entry["TITLE"]);
                                 // info about new line for next message
                                 $after_titel = TRUE;
                             }
                         } else {
                             if ($after_titel) {
                                 $output .= NConf_HTML::text($entry["MESSAGE"], FALSE);
                                 $after_titel = FALSE;
                             } else {
                                 $output .= NConf_HTML::text($entry["MESSAGE"]);
                             }
                         }
                     } else {
                         if (!empty($entry["TITLE"])) {
                             $output .= NConf_HTML::text('<b>' . $entry["TITLE"] . '</b>: ' . $entry["MESSAGE"]);
                         } else {
                             // mostly for fieldset not making a first line
                             //if ($after_titel){
                             //    $output .= NConf_HTML::text($entry["MESSAGE"], FALSE);
                             //    $after_titel = FALSE;
                             //}else{
                             $output .= NConf_HTML::text($entry["MESSAGE"]);
                             //}
                         }
                     }
                 }
             }
         }
         # print back button if wanted
         if ($BACK_BUTTON) {
             $output .= '<br><br>';
             $output .= '<div id=buttons>';
             $output .= '<input type=button onClick="window.location.href=\'' . $BACK_BUTTON . '\'" value="Back">';
             $output .= '</div>';
         }
         return $output;
     } else {
         return '';
     }
 }
コード例 #3
0
ファイル: delete_class.php プロジェクト: pasichnichenko/nconf
<?php

require_once 'include/head.php';
//set_page();
echo NConf_HTML::title('Delete class');
if (isset($_POST["delete"]) and $_POST["delete"] == "yes" and (isset($_POST["id"]) and $_POST["id"] != "")) {
    # Delete entry
    $query = 'DELETE FROM ConfigClasses
                WHERE id_class=' . $_POST["id"];
    $result = db_handler($query, "result", "Delete Class");
    if ($result) {
        echo TXT_DELETED;
        history_add("removed", "Class", $_POST["class_name"]);
        # set url for redirect
        $url = $_SESSION["go_back_page"];
        echo '<meta http-equiv="refresh" content="' . REDIRECTING_DELAY . '; url=' . $url . '">';
        message($info, '<b>redirecting to:</b> <a href="' . $url . '"> [ this page ] (in ' . REDIRECTING_DELAY . ' seconds)</a>');
    } else {
        message($error, 'Error deleting class ' . $_POST["id"] . ':' . $query);
    }
} else {
    if (!empty($_SERVER["HTTP_REFERER"])) {
        $_SESSION["after_delete_page"] = $_SERVER["HTTP_REFERER"];
    }
    # class name
    $query = 'SELECT config_class FROM ConfigClasses where id_class=' . $_GET["id"];
    $class_name = db_handler($query, 'getOne', "get class name");
    // Fetch attr name
    $query = 'SELECT attr_name  FROM ConfigAttrs, ConfigClasses WHERE id_class=' . $_GET["id"] . ' AND fk_id_class=ConfigClasses.id_class';
    $attr = db_handler($query, "array", "Get Attrs of this Class");
    if (isset($attr[0]["attr_name"])) {
コード例 #4
0
ファイル: functions.php プロジェクト: pasichnichenko/nconf
function inheritance_HostToService($host_id, $mode = '')
{
    //NConf_DEBUG::open_group('inheritance for host_id: "'.$host_id.'"', 1);
    # Handling inheritance to services
    # check for host data
    if ($mode == 'apply_inheritance') {
        if (empty($_POST["apply_inheritance"][$host_id])) {
            // continue if service is empty
            NConf_DEBUG::set("not applying for host: " . $host_id, 'DEBUG', 'Inheritance filter');
            return;
        }
    }
    # These services will be modified
    $services = db_templates("get_services_from_host_id", $host_id);
    # array of inherited attributes
    $change_attrs = array("check_period" => "check period", "notification_period" => "notification period", "contact_groups" => "contact groups");
    $class_id = db_templates("get_id_of_class", "service");
    # array for preview functionality
    $preview_array = array();
    # make a diff with each service to detect which items must be linked and which must be removed
    foreach ($services as $service_id => $service_name) {
        NConf_DEBUG::open_group('inheritance for service: "' . $service_name . '"', 1);
        # initial value for history entry "edited"
        $edited = FALSE;
        $preview_array[$service_name] = array();
        if ($mode == 'apply_inheritance') {
            if (empty($_POST["apply_inheritance"][$host_id][$service_id])) {
                // continue if service is empty
                NConf_DEBUG::set("not applying for service: " . $service_name, 'DEBUG', 'Inheritance filter');
                continue;
            }
        }
        foreach ($change_attrs as $change_attr => $change_attr_friendly_name) {
            NConf_DEBUG::open_group("attribute: " . $change_attr_friendly_name, 2);
            if ($mode == 'apply_inheritance' and empty($_POST["apply_inheritance"][$host_id][$service_id][$change_attr])) {
                // continue if service is empty
                NConf_DEBUG::set("not applying for attribute: " . $change_attr_friendly_name, 'DEBUG', 'Inheritance filter');
                continue;
            }
            NConf_DEBUG::open_group("lookup values", 3);
            $attr_id = db_templates("get_attr_id", "service", $change_attr);
            # get current host data
            $new_items = db_templates("get_linked_item", $host_id, $change_attr, '', 'array_2fieldsTOassoc');
            # get current service data
            $current_items = db_templates("get_linked_item", $service_id, $change_attr, '', 'array_2fieldsTOassoc');
            # diff to get items to add
            $diff_array = array_diff($new_items, $current_items);
            # diff to get items to remove
            $diff_array2 = array_diff($current_items, $new_items);
            /* debugging:
               echo "<pre>";
               var_dump($diff_array);
               var_dump($diff_array2);
               echo "</pre>";
               */
            if ($mode == "preview") {
                $preview_array[$service_id]["service_name"] = $service_name;
                $preview_array[$service_id]["attrs"][$attr_id] = array("attr_name" => $change_attr, "attr_friendly_name" => $change_attr_friendly_name, "current" => $current_items, "new" => $new_items, "differs" => !empty($diff_array) or !empty($diff_array2));
                //                $preview_array[$service_id]["attrs"][$attr_id]["differs"] = (!empty($diff_array) OR !empty($diff_array2) );
            } else {
                # make changes in the DB
                // until now, there are no such special attributes:
                //$lac_OR_bidirectional = check_link_as_child_or_bidirectional($change_attr, $class_id);
                // perhaps later there must also be this logic.
                # remove items
                if (!empty($diff_array2)) {
                    NConf_DEBUG::open_group("remove items");
                    foreach ($diff_array2 as $attr_removed_name => $attr_removed_id) {
                        $query = 'DELETE FROM ItemLinks
                                    WHERE fk_id_item=' . $service_id . '
                                        AND fk_id_attr = "' . $attr_id . '"
                                        AND fk_item_linked2 = "' . $attr_removed_id . '"
                                 ';
                        db_handler($query, "delete", 'delete linked item "' . $attr_removed_name . '"');
                        history_add("unassigned", $change_attr_friendly_name, $attr_removed_name, $service_id);
                        $edited = TRUE;
                    }
                }
                # add items
                if (!empty($diff_array)) {
                    NConf_DEBUG::open_group("add items");
                    foreach ($diff_array as $attr_add_name => $attr_add_id) {
                        $query = 'INSERT INTO ItemLinks (fk_id_item,fk_item_linked2,fk_id_attr)
                                    VALUES (' . $service_id . ',' . $attr_add_id . ', ' . $attr_id . ')';
                        db_handler($query, "insert", 'insert linked item "' . $attr_add_name . '"');
                        history_add("assigned", $change_attr_friendly_name, $attr_add_name, $service_id);
                        $edited = TRUE;
                    }
                }
            }
        }
        NConf_DEBUG::close_group(2);
        //NConf_DEBUG::open_group('history "edited" entry', 1);
        # history entry "edited"
        if ($mode == "preview") {
            # clean service if nothing will change
            if (empty($preview_array[$service_name])) {
                unset($preview_array[$service_name]);
            }
        } elseif ($edited) {
            history_add("edited", "service", $service_name, $service_id);
        }
    }
    if ($mode == "preview") {
        # print preview
        # create a table with checkboxes for applying inheritance
        $preview = NConf_HTML::table_begin('class="ui-nconf-table ui-widget ui-widget-content ui-nconf-max-width"', array('', 50, 120, 100, 100));
        $preview .= '<thead class="ui-widget-header">
                      <tr>
                        <th>service</th>
                        <th name="checkbox_toggle_all" class="center pointer">update</th>
                        <th>attribute</th>
                        <th>service value</th>
                        <th>host value</th>
                      </tr>
                     </thead>';
        $bg_class = "even";
        foreach ($preview_array as $service_id => $service) {
            $i = 0;
            $service_name = $service["service_name"];
            # handle background for each service
            if ($bg_class == "odd") {
                $bg_class = "even";
            } else {
                $bg_class = "odd";
            }
            foreach ($service["attrs"] as $attribute_id => $values) {
                $i++;
                $preview .= '<tr class="' . $bg_class . '">';
                if ($i == 1) {
                    $preview .= '<td rowspan="' . count($service["attrs"]) . '" class="align_top">' . NConf_HTML::title($service_name) . '</td>';
                }
                # check box for applying
                $preview .= '<td class="center">';
                if ($values["differs"]) {
                    $preview .= '<input type="checkbox" class="pointer" name="apply_inheritance[' . $host_id . '][' . $service_id . '][' . $values["attr_name"] . ']" value="' . $attribute_id . '" checked=checked>';
                }
                $preview .= '</td>';
                $preview .= '<td>' . $values["attr_friendly_name"] . '</td>';
                # current values
                $preview .= '<td name="checkbox_toggle"';
                // color red
                if ($values["differs"]) {
                    $preview .= ' class="red"';
                }
                $preview .= '>';
                # generate value list
                $current_values = array_flip($values["current"]);
                $preview .= implode(", ", $current_values);
                $preview .= "</td>";
                # new values
                $preview .= '<td name="checkbox_toggle"';
                // color green
                if ($values["differs"]) {
                    $preview .= ' class="bold"';
                }
                $preview .= '>';
                # generate value list
                $new_values = array_flip($values["new"]);
                $preview .= implode(", ", $new_values);
                $preview .= "</td>";
                $preview .= "</tr>";
            }
        }
        $preview .= NConf_HTML::table_end();
        return $preview;
    } elseif (!NConf_DEBUG::status('ERROR') and $mode != "preview") {
        NConf_DEBUG::set('', 'INFO', 'Successfully updated all linked services.');
    }
    return;
}
コード例 #5
0
ファイル: delete_item.php プロジェクト: pasichnichenko/nconf
<?php

require_once 'include/head.php';
if (DB_NO_WRITES == 1) {
    message($info, TXT_DB_NO_WRITES);
}
if (!empty($_REQUEST["class"])) {
    $class = $_REQUEST["class"];
} elseif (!empty($_REQUEST["item"])) {
    $class = $_REQUEST["item"];
}
# delete item count
$deleted_items = 0;
echo NConf_HTML::title('Delete Items');
if (isset($_POST["delete"]) and $_POST["delete"] == "yes" and (isset($_POST["ids"]) and $_POST["ids"] != "")) {
    # make ids as array
    if (!empty($_POST["ids"])) {
        $ids = explode(",", $_POST["ids"]);
    }
    foreach ($ids as $id) {
        $item_name = db_templates("naming_attr", $id);
        $item_class = db_templates("class_name", $id);
        # Delete Services if item = host
        if ($item_class == "host") {
            # when deleting a host, go back to host overview (the session var could link to the service list)
            $_SESSION["after_delete_page"] = 'overview.php?class=host';
            # Select all linked services
            $result = db_templates("get_services_from_host_id", $id);
            if (!empty($result)) {
                if (count($result) > 0) {
                    foreach ($result as $service_ID => $service_name) {
コード例 #6
0
ファイル: show_attr.php プロジェクト: pasichnichenko/nconf
}
# Filters
if (isset($_POST["os"])) {
    $filter_os = $_POST["os"];
} else {
    $filter_os = "";
}
# Show class selection
$show_class_select = "yes";
if (isset($_GET["class"])) {
    $class = $_GET["class"];
} else {
    $class = "host";
}
// Page output begin
echo NConf_HTML::title('Show attributes: ' . $class);
$content = 'This mask allows administrators to modify the data schema of the NConf application.
            There is no need to make any changes to the schema for ordinary operation.
            Users are strictly discouraged from changing any attribute names, datatypes, from modifying classes in any way, 
            and from any other changes to the schema.
            Disregarding this may result in unexpected behavour of the application, failure to generate the Nagios configuration properly 
            and may under certain circumstances <b>result in data corruption or loss!</b>';
echo NConf_HTML::limit_space(NConf_HTML::show_error('WARNING', $content), 'style="float: right; width: 555px;"');
echo '<form name="filter" action="' . $request_url . '" method="get">
<fieldset class="inline">
<legend>Select class</legend>
      <table>';
// Class Filter
if (isset($show_class_select)) {
    echo '<tr>';
    $result = db_handler('SELECT config_class FROM ConfigClasses ORDER BY config_class', "result", "Get Config Classes");
コード例 #7
0
ファイル: delete_attr.php プロジェクト: pasichnichenko/nconf
<?php

require_once 'include/head.php';
echo NConf_HTML::title('Delete Attribute');
if (DB_NO_WRITES == 1) {
    message($info, TXT_DB_NO_WRITES);
}
if (isset($_POST["delete"]) and $_POST["delete"] == "yes" and (isset($_POST["id"]) and $_POST["id"] != "")) {
    // Delete entry
    $query = 'DELETE FROM ConfigAttrs
                WHERE id_attr=' . $_POST["id"];
    $result = db_handler($query, "result", "Delete entry");
    if ($result) {
        message($debug, '', "ok");
        history_add("removed", "Attribute", $_POST["name"]);
        echo TXT_DELETED;
        $url = $_SESSION["go_back_page"];
        echo '<meta http-equiv="refresh" content="' . REDIRECTING_DELAY . '; url=' . $url . '">';
        NConf_DEBUG::set('<a href="' . $url . '"> [ this page ] (in ' . REDIRECTING_DELAY . ' seconds)</a>', 'INFO', "<br>redirecting to");
    } else {
        message($error, 'Error deleting id_attr ' . $_POST["id"] . ':' . $query);
    }
} elseif (!empty($_GET["id"])) {
    // Fetch attr name
    $query = 'SELECT attr_name, config_class FROM ConfigAttrs, ConfigClasses WHERE id_attr=' . $_GET["id"] . ' AND fk_id_class=ConfigClasses.id_class';
    $attr = db_handler($query, "assoc", "Fetch attr name");
    // warning message
    $content = 'All &quot;<b>' . $attr["config_class"] . '</b>&quot; items will lose their &quot;<b>' . $attr["attr_name"] . '</b>&quot; attribute.
            <br>All data associated with this attribute will also be lost.
            This action cannot be undone.';
    $content .= '<br><br>
コード例 #8
0
    # this feature is not finished with attributes!
    $_SESSION["after_delete_page"] = $_SERVER["HTTP_REFERER"];
    message($debug, 'Setting after delete page to : ' . $_SERVER["HTTP_REFERER"]);
} else {
    # check mandatory input
    # It divers for ADD or MODIFY !
    if ($attr_id == "new") {
        $title = "Add attribute";
        # mandatory for ADD
        $mandatory_fields = array("attr_name" => "attribute name", 'friendly_name' => "friendly name", 'datatype' => "attribute datatype", 'mandatory' => "mandatory", 'visible' => "visible", 'conf' => "write to conf", 'fk_id_class' => "attribute class", 'naming_attr' => "is naming attribute");
    } else {
        $title = "Modify attribute";
        # mandatory for modify
        $mandatory_fields = array("attr_name" => "attribute name", 'friendly_name' => "friendly name", 'mandatory' => "mandatory", 'visible' => "visible", 'conf' => "write to conf");
    }
    echo NConf_HTML::title($title);
    # Check mandatory fields
    $write2db = check_mandatory($mandatory_fields, $_POST);
}
# special links
# they should not both be yes (already checked, not possible with javascript)
if (isset($_POST['link_as_child'])) {
    $link_as_child = $_POST['link_as_child'];
} else {
    $link_as_child = 'no';
}
if (isset($_POST['link_bidirectional'])) {
    $link_bidirectional = $_POST['link_bidirectional'];
} else {
    $link_bidirectional = 'no';
}
コード例 #9
0
                 //message ($info, TXT_UPDATE_SERVICES.'<br>'.$update_button);
                 echo NConf_HTML::limit_space(NConf_HTML::show_highlight('Attention', TXT_UPDATE_SERVICES . '<br>' . $update_button), 'width="310"');
                 echo "<br>";
                 # show inheritance table and help box
                 echo '<div style="float: left; margin-right: 5px;">';
                 echo NConf_HTML::title('Show detailed inheritance information');
                 //$title .= NConf_HTML::title('Detailed host / service diff for '.escape_string($_POST[$id_naming_attr]) );
                 echo '</div>';
                 echo '<div name="help_inheritance"></div>';
                 echo '<div style="clear: both"></div>';
                 // place for help box (only to get distance from top)
                 echo '<div id="page_content"></div>';
                 $inheritance_details = '';
                 foreach ($preview as $server_name => $service_table) {
                     $title = '<span class="ui-icon ui-icon-triangle-1-e"></span><a href="#">' . $server_name . '</a>';
                     $inheritance_details .= NConf_HTML::title($title, 3, 'class="accordion_title ui-accordion-header ui-helper-reset ui-state-default"');
                     $inheritance_details .= '<div class="accordion_content">' . $service_table . '</div>';
                 }
                 # print tables
                 echo '<div class="ui-accordion ui-widget ui-helper-reset ui-accordion-icons">';
                 echo $inheritance_details;
                 echo '</div>';
                 echo '</form>';
             }
         }
     }
 } else {
     message($info, 'Modify ' . $config_class . ' should work fine.');
 }
 # Delete session
 if (isset($_SESSION["cache"]["handle"])) {
コード例 #10
0
ファイル: foot.php プロジェクト: pasichnichenko/nconf
<div class="clearer"></div>
<div id="footer">
    <div>
        <?php 
if (NConf_DEBUG::status("INFO")) {
    echo NConf_HTML::title("Info:", 2);
    echo NConf_DEBUG::show_debug("INFO");
    echo NConf_HTML::line();
}
// Display jQuery/ajax errors
echo '<div id="jquery_error" class="ui-state-error" style="display: none">';
echo '<span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-alert">&nbsp;</span>';
echo NConf_HTML::title("Error:", 2);
echo '</div>';
if (NConf_DEBUG::status("ERROR")) {
    echo NConf_HTML::title("Error:", 2);
    echo '<font color="red">';
    echo NConf_DEBUG::show_debug("ERROR");
    echo '</font>';
    echo NConf_HTML::line();
}
if (DEBUG_MODE == 1) {
    echo '<div id="jquery_console_parent" style="padding: 0; display: none">';
    echo NConf_HTML::swap_content('<div id="jquery_console"></div>', "<b>jQuery debugging</b>", FALSE, FALSE);
    echo '</div>';
    NConf_DEBUG::display();
}
?>

        &nbsp;
    </div>
コード例 #11
0
 public static function show_error($title = "Error:", $content = '')
 {
     $output = '';
     $output .= '<div class="ui-state-error ui-corner-all fg-error">';
     $output .= '<span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-alert">&nbsp;</span>';
     $output .= NConf_HTML::title($title, 2);
     if (!empty($content)) {
         $output .= $content;
     } else {
         $output .= NConf_DEBUG::show_debug('ERROR', TRUE);
     }
     $output .= '</div>';
     return $output;
 }
コード例 #12
0
        echo '<br>';
    }
    echo '<br>';
    echo '</div>';
}
echo '</div><br>';
if ($status == "OK") {
    history_add("general", "config", "generated successfully");
    // Move generated config to "output" dir
    if (file_exists(NCONFDIR . "/output/NagiosConfig.tgz")) {
        system("mv " . NCONFDIR . "/output/NagiosConfig.tgz " . NCONFDIR . "/output/NagiosConfig.tgz." . time());
    }
    system("mv " . NCONFDIR . "/temp/NagiosConfig.tgz " . NCONFDIR . "/output/");
    system("rm -rf " . NCONFDIR . "/temp/*");
    if (ALLOW_DEPLOYMENT == 1) {
        echo NConf_HTML::title('Deploy generated config:');
        // check  if new deployment is configured
        $deployment_config = NCONFDIR . '/config/deployment.ini';
        $deployment_info = FALSE;
        if (!file_exists($deployment_config)) {
            $deployment_info = TRUE;
        } elseif (is_readable($deployment_config)) {
            $ini_array = parse_ini_file($deployment_config, TRUE);
            if (empty($ini_array)) {
                $deployment_info = TRUE;
            }
        }
        if ($deployment_info) {
            $content = 'The generated configuration has been written to the "nconf/output/" directory.<br>
                            To set up more sophisticated deployment functionality, please edit your "config/deployment.ini" file accordingly.<br>
                            For a complete list of available deployment options, refer to the online documentation on 
コード例 #13
0
ファイル: show_class.php プロジェクト: pasichnichenko/nconf
require_once 'include/head.php';
// Form action and url handling
$request_url = set_page();
?>
<script type="text/javascript">
    $(document).ready(function() {


    });
</script>
<?php 
// Page output begin
// set width of following divs
echo '<div style="width: 535px">';
echo NConf_HTML::title('Show classes');
echo "<br>";
$content = 'This mask allows administrators to modify the data schema of the NConf application.
            There is no need to make any changes to the schema for ordinary operation.
            Users are strictly discouraged from changing any attribute names, datatypes, from modifying classes in any way, 
            and from any other changes to the schema.
            Disregarding this may result in unexpected behavour of the application, failure to generate the Nagios configuration properly 
            and may under certain circumstances <b>result in data corruption or loss!</b>';
echo NConf_HTML::show_error('WARNING', $content);
// Attr manipulation
if (isset($_GET["do"])) {
    if ($_GET["do"] == "up") {
        class_order($_GET["id"], "up");
    } elseif ($_GET["do"] == "down") {
        class_order($_GET["id"], "down");
    }
コード例 #14
0
    //echo '<meta http-equiv="refresh" content="'.REDIRECTING_DELAY.'; url='.$_SESSION["go_back_page"].'">';
    echo '<meta http-equiv="refresh" content="0; url=' . $_SESSION["go_back_page"] . '">';
    NConf_DEBUG::set('<a href="' . $_SESSION["go_back_page"] . '"> handle_item (back) </a>', 'INFO', "<br>redirecting to");
} elseif (isset($_SESSION["submited"])) {
    // Write2DB (feedback: $step2)
    require_once 'include/add_item_write2db.php';
    unset($_SESSION["submited"]);
} else {
    message($error, 'Submited data is not allowed to be resent');
    if (isset($_SESSION["created_id"])) {
        $id = $_SESSION["created_id"];
        $step2 = "yes";
    }
}
# Content of Page
echo NConf_HTML::title('Add ' . $config_class, '', 'class="content_header"');
if (!empty($_POST["check_command_changed"])) {
    # do nothing, just go back
} elseif ($step2 == "yes") {
    // Host was added, go to service page
    NConf_DEBUG::set('Proceeding to add services.', 'INFO');
    // session $_SESSION["created_id"] should be checked for none F5 re-adding
    // the step2 in url is only for not working session users...
    $url = 'modify_item_service.php?id=' . $id . '&step2=true';
    echo '<meta http-equiv="refresh" content="' . REDIRECTING_DELAY . '; url=' . $url . '">';
    // add extra line (br) for more space
    echo NConf_DEBUG::show_debug('INFO', TRUE);
    // after echo because we want the redirect only in the footer
    NConf_DEBUG::set('<a href="' . $url . '"> add services </a>', 'INFO', "<br>redirecting to");
} else {
    // normal way to add items
コード例 #15
0
}
$output .= '</select><br>';
$output .= '
                <script type="text/javascript">
                    createMovableOptions("fromBox_advanced_services","toBox_advanced_services",500,145,"available items","selected items","livesearch");
                </script>
                ';
//    $output .= '<div class="loading"><img id="advanced_services_loading" src="img/working_small.gif" alt="loading" style="display:none"></div>';
echo NConf_HTML::ui_box_content($output);
unset($output);
###
# HOSTGROUP SERVICES
###
# box for direct host services
$output = '<div style="float: left; margin-right: 5px;">';
$output .= NConf_HTML::title('Advanced services (inherited over hostgroups)');
$output .= '</div>';
$output .= '<div name="help_hostgroup_services"></div>';
$output .= '<div style="clear: both"></div>';
// progress indicator / loading
$output .= '<img id="hostgroup_service_loading" src="img/working_small.gif" alt="loading" style="display:none">';
// Place for hostgroup service list
$output .= '<br><div id="hostgroup_service_list" style="display:none"></div><br>';
echo NConf_HTML::ui_box_content($output);
echo '</div>';
//echo '<div id="result"> </div>';
?>

<!-- Help text content -->
<div id="help_text" style="display: none">
    <div id="help_services" title="Services (directly linked)">