here to use cacti."; exit; } /* Here, we define each name, default value, type, and path check for each value we want the user to input. The "name" field must exist in the 'settings' table for this to work. Cacti also uses different default values depending on what OS it is running on. */ /* cacti Web Root */ $input[0]["name"] = "path_webcacti"; $input[0]["default"] = dirname($HTTP_SERVER_VARS["SCRIPT_NAME"]); $input[0]["type"] = "textbox"; /* Web Server Document Root */ $input[1]["name"] = "path_webroot"; $input[1]["default"] = str_replace("\\\\", "/", $HTTP_SERVER_VARS["DOCUMENT_ROOT"]); $input[1]["check"] = ""; $input[1]["type"] = "textbox"; /* rrdtool Binary Path */ $input[2]["name"] = "path_rrdtool"; if ($cacti_server_os == "unix") { $which_rrdtool = `which rrdtool`; if ($which_rrdtool != '') { $input[2]["default"] = $which_rrdtool; } else { $input[2]["default"] = "/usr/local/rrdtool/bin/rrdtool"; } }elseif ($cacti_server_os == "win32") { $input[2]["default"] = "c:/rrdtool/rrdtool.exe"; } $input[2]["check"] = ""; $input[2]["type"] = "textbox"; if ($cacti_server_os == "unix") { /* snmpwalk Binary Path */ $input[3]["name"] = "path_snmpwalk"; $which_snmpwalk = `which snmpwalk`; if ($which_snmpwalk != '') { $input[3]["default"] = $which_snmpwalk; } else { $input[3]["default"] = "/usr/local/bin/snmpwalk"; } $input[3]["check"] = ""; $input[3]["type"] = "textbox"; /* snmpget Binary Path */ $input[4]["name"] = "path_snmpget"; $which_snmpget = `which snmpget`; if ($which_snmpget != '') { $input[4]["default"] = $which_snmpget; } else { $input[4]["default"] = "/usr/local/bin/snmpget"; } $input[4]["check"] = ""; $input[4]["type"] = "textbox"; } /* PHP Binary Path */ $input[5]["name"] = "path_php_binary"; if ($cacti_server_os == "unix") { $which_php = `which php`; if ($which_php != '') { $input[5]["default"] = $which_php; } else { $input[5]["default"] = "/usr/bin/php"; } }elseif ($cacti_server_os == "win32") { $input[5]["default"] = "c:/php/php.exe"; } $input[5]["check"] = ""; $input[5]["type"] = "textbox"; if (GetCurrentVersion() == "new_install") { /* Built-in Authentication */ $input[6]["name"] = "global_auth"; $input[6]["default"] = "on"; $input[6]["type"] = "checkbox"; } /* pre-processing that needs to be done for each step */ switch ($step) { case '4': /* last step--save all settings and continue */ /* get all items on the form and write values for them */ $i = 0; while ($i < TOTAL_VARS) { if (isset($input[$i]["name"])) { db_execute("update settings set value=\"" . ${$input[$i]["name"]} . "\" where name=\"" . $input[$i]["name"] . "\"", $cnn_id); } $i++; } /* update database */ $status = UpdateCacti(GetCurrentVersion(), $config[cacti_version]); db_execute("delete from version",$cnn_id); db_execute("insert into version (cacti) values (\"$config[cacti_version]\")"); header ("Location: index.php"); exit; break; } if (!(isset($step))) { $step = 1; } ?>