}elseif ($config["cacti_server_os"] == "win32") { $which_snmpgetnext = find_best_path("snmpgetnext.exe"); if (config_value_exists("path_snmpgetnext")) { $input["path_snmpgetnext"]["default"] = read_config_option("path_snmpgetnext"); }else if (!empty($which_snmpgetnext)) { $input["path_snmpgetnext"]["default"] = $which_snmpgetnext; }else{ $input["path_snmpgetnext"]["default"] = "c:/net-snmp/bin/snmpgetnext.exe"; } } /* log file path */ $input["path_cactilog"] = $settings["path"]["path_cactilog"]; $input["path_cactilog"]["description"] = "The path to your Cacti log file."; if (config_value_exists("path_cactilog")) { $input["path_cactilog"]["default"] = read_config_option("path_cactilog"); } else { $input["path_cactilog"]["default"] = $config["base_path"] . "/log/cacti.log"; } /* SNMP Version */ if ($config["cacti_server_os"] == "unix") { $input["snmp_version"] = $settings["general"]["snmp_version"]; $input["snmp_version"]["default"] = "net-snmp"; } /* RRDTool Version */ if ((file_exists($input["path_rrdtool"]["default"])) && (($config["cacti_server_os"] == "win32") || (is_executable($input["path_rrdtool"]["default"]))) ) { $input["rrdtool_version"] = $settings["general"]["rrdtool_version"];
$input["path_spine"] = $settings["path"]["path_spine"]; if (CACTI_SERVER_OS == "unix") { $which_spine = find_best_path("spine"); if (config_value_exists("path_spine")) { $input["path_spine"]["default"] = read_config_option("path_spine"); }else if (!empty($which_spine)) { $input["path_spine"]["default"] = $which_spine; }else{ $input["path_spine"]["default"] = "/usr/local/bin/spine"; } }elseif (CACTI_SERVER_OS == "win32") { $which_spine = find_best_path("spine.exe"); if (config_value_exists("path_spine")) { $input["path_spine"]["default"] = read_config_option("path_spine"); }else if (!empty($which_spine)) { $input["path_spine"]["default"] = $which_spine; }else{ $input["path_spine"]["default"] = "c:/spine/spine.exe"; } } /* SNMP Version */ if (CACTI_SERVER_OS == "unix") { $input["snmp_version"] = $settings["general"]["snmp_version"]; $input["snmp_version"]["default"] = "net-snmp"; } /* RRDTool Version */
if (sizeof($tabs) > 0) { foreach (array_keys($tabs) as $tab_short_name) { print "<td " . ($tab_short_name == $current_tab ? "bgcolor='silver'" : "bgcolor='#DFDFDF'") . " nowrap='nowrap' width='" . strlen($tabs[$tab_short_name]) * 9 . "' align='center' class='tab'>\n\t\t\t\t<span class='textHeader'><a href='settings.php?tab={$tab_short_name}'>{$tabs[$tab_short_name]}</a></span>\n\t\t\t\t</td>\n\n\t\t\t\t<td width='1'></td>\n"; } } print "<td></td>\n</tr></table>\n"; html_start_box("<strong>Cacti Settings (" . $tabs[$current_tab] . ")</strong>", "100%", $colors["header"], "3", "center", ""); $form_array = array(); while (list($field_name, $field_array) = each($settings[$current_tab])) { $form_array += array($field_name => $field_array); if (isset($field_array["items"]) && is_array($field_array["items"])) { while (list($sub_field_name, $sub_field_array) = each($field_array["items"])) { if (config_value_exists($sub_field_name)) { $form_array[$field_name]["items"][$sub_field_name]["form_id"] = 1; } $form_array[$field_name]["items"][$sub_field_name]["value"] = db_fetch_cell("select value from settings where name='{$sub_field_name}'"); } } else { if (config_value_exists($field_name)) { $form_array[$field_name]["form_id"] = 1; } $form_array[$field_name]["value"] = db_fetch_cell("select value from settings where name='{$field_name}'"); } } draw_edit_form(array("config" => array(), "fields" => $form_array)); html_end_box(); form_hidden_box("tab", $current_tab, ""); form_save_button("settings.php?tab={$current_tab}", "save"); include "./include/bottom_footer.php"; break; }
function camm_get_settings() { global $settings; $i = 0; $group = "default"; foreach ($settings["camm"] as $sett_name => $setting) { //$settings[$i]["name_id"] = ""; if ($setting["method"] == "spacer") { } switch ($setting["method"]) { case "spacer": $group = $setting["friendly_name"]; $i = $i - 1; break; case "textbox": $n_settings[$i]["name"] = $sett_name; $n_settings[$i]["type"] = "textbox"; $n_settings[$i]["group"] = $group; $n_settings[$i]["fname"] = $setting["friendly_name"]; $n_settings[$i]["text"] = $setting["description"]; if (config_value_exists($sett_name)) { $n_settings[$i]["value"] = db_fetch_cell("select value from settings where name='{$sett_name}'"); } else { $n_settings[$i]["value"] = $setting["default"]; } break; case "drop_array": $n_settings[$i]["name"] = $sett_name; $n_settings[$i]["group"] = $group; $n_settings[$i]["type"] = "combobox"; $n_settings[$i]["fname"] = $setting["friendly_name"]; $n_settings[$i]["text"] = $setting["description"]; if (config_value_exists($sett_name)) { $n_settings[$i]["real_value"] = db_fetch_cell("select value from settings where name='{$sett_name}'"); } else { $n_settings[$i]["real_value"] = $setting["default"]; } $tmp_arr = array(); foreach ($setting["array"] as $ar_value => $ar_name) { $tmp_arr[] = array($ar_name, $ar_value); if ($ar_value == $n_settings[$i]["real_value"]) { $n_settings[$i]["value"] = $ar_name; } } $n_settings[$i]["editor"] = $tmp_arr; break; } $i = $i + 1; } echo camm_JEncode(array('success' => true, 'settings' => $n_settings)); }