本文整理汇总了PHP中read_config_option函数的典型用法代码示例。如果您正苦于以下问题:PHP read_config_option函数的具体用法?PHP read_config_option怎么用?PHP read_config_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了read_config_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: iconskml
function iconskml()
{
//get all icons in the icon folder and create an icon list
global $config;
$kmlDomain = read_config_option("gpsmap_kmldomain");
$iconlist = "";
$icons = opendir($config['base_path'] . '/plugins/gpsmap/images/icons');
while (false !== ($icon = readdir($icons))) {
if ($icon != "." && $icon != "..") {
list($icon, $tail) = explode('.', $icon);
switch ($tail) {
case "png":
case "jpg":
case "jpeg":
case "gif":
$iconlist .= "<Style id=\"" . $icon . "\">";
$iconlist .= "<IconStyle id=\"my" . $icon . "\">";
$iconlist .= "<Icon>";
$iconlist .= "<href>http://" . $kmlDomain . $config['url_path'] . "plugins/gpsmap/images/icons/" . $icon . "." . $tail . "</href>";
$iconlist .= "<scale>1.0</scale>";
$iconlist .= "</Icon>";
$iconlist .= "</IconStyle>";
$iconlist .= "</Style>\n";
break;
default:
//Not an icon we want to load
break;
}
}
}
return $iconlist;
}
示例2: api_user_changepassword
function api_user_changepassword($user_id, $password_new, $password_old="") {
/* validate we can change the password */
if (read_config_option("auth_method") != "1") {
return 1;
}
/* validate old password */
if (!empty($password_old)) {
if (!sizeof(db_fetch_row("select id from user_auth where id =" . sql_sanitize($user_id) . " and password = '" . md5($password_old) . "' and realm = 0"))) {
/* Password validation error */
return 2;
}
}
/* validate user exists */
if (sizeof(db_fetch_row("select id from user_auth where id =" . sql_sanitize($user_id) . " and realm = 0"))) {
if (db_execute("update user_auth set password = '" . md5($password_new) . "',must_change_password = '', password_change_last = NOW() where id = " . sql_sanitize($user_id)) == 1) {
/* password changed */
return 0;
}else{
/* error */
return 1;
}
}else{
/* user not found */
return 3;
}
/* all else fails return error */
return 1;
}
示例3: getConfigOption
public static function getConfigOption($settingName, $defaultValue = "")
{
$result = read_config_option($settingName);
if ($result == "" && $defaultValue != "") {
self::log("No result for %s, using default\n", $defaultValue);
$result = $defaultValue;
}
return $result;
}
示例4: settings_check_upgrade
function settings_check_upgrade()
{
$current = plugin_settings_version();
$current = $current['version'];
$old = read_config_option('plugin_settings_version');
if ($current != $old) {
// settings_setup_table ();
}
db_execute("REPLACE INTO settings (name, value) VALUES ('plugin_settings_version', '{$current}')");
}
示例5: input_remove
function input_remove()
{
if (read_config_option("remove_verification") == "on" && !isset($_GET["confirm"])) {
require_once CACTI_BASE_PATH . "/include/top_header.php";
form_confirm(_("Are You Sure?"), _("Are you sure you want to delete the input item") . " <strong>'" . db_fetch_cell("select name from graph_template_item_input where id=" . $_GET["id"]) . "'</strong>? NOTE: Deleting this input will <strong>not</strong> affect graphs that use this template.", "graph_templates.php?action=edit&id=" . $_GET["graph_template_id"], "graph_templates_inputs.php?action=remove&id=" . $_GET["id"] . "&graph_template_id=" . $_GET["graph_template_id"]);
require_once CACTI_BASE_PATH . "/include/bottom_footer.php";
exit;
}
if (read_config_option("remove_verification") == "" || isset($_GET["confirm"])) {
api_graph_template_item_input_remove($_GET["id"]);
}
}
示例6: ss_host_disk
function ss_host_disk($hostname, $host_id, $snmp_auth, $cmd, $arg1 = "", $arg2 = "")
{
$snmp = explode(":", $snmp_auth);
$snmp_version = $snmp[0];
$snmp_port = $snmp[1];
$snmp_timeout = $snmp[2];
$snmp_auth_username = "";
$snmp_auth_password = "";
$snmp_auth_protocol = "";
$snmp_priv_passphrase = "";
$snmp_priv_protocol = "";
$snmp_context = "";
$snmp_community = "";
if ($snmp_version == 3) {
$snmp_auth_username = $snmp[4];
$snmp_auth_password = $snmp[5];
$snmp_auth_protocol = $snmp[6];
$snmp_priv_passphrase = $snmp[7];
$snmp_priv_protocol = $snmp[8];
$snmp_context = $snmp[9];
} else {
$snmp_community = $snmp[3];
}
$oids = array("total" => ".1.3.6.1.2.1.25.2.3.1.5", "totalin" => ".1.3.6.1.2.1.25.2.3.1.5", "used" => ".1.3.6.1.2.1.25.2.3.1.6", "failures" => ".1.3.6.1.2.1.25.2.3.1.7", "index" => ".1.3.6.1.2.1.25.2.3.1.1", "description" => ".1.3.6.1.2.1.25.2.3.1.3", "sau" => ".1.3.6.1.2.1.25.2.3.1.4");
if ($cmd == "index") {
$return_arr = ss_host_disk_reindex(cacti_snmp_walk($hostname, $snmp_community, $oids["index"], $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, read_config_option("snmp_retries"), SNMP_POLLER));
for ($i = 0; $i < sizeof($return_arr); $i++) {
print $return_arr[$i] . "\n";
}
} elseif ($cmd == "query") {
$arg = $arg1;
$arr_index = ss_host_disk_reindex(cacti_snmp_walk($hostname, $snmp_community, $oids["index"], $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, read_config_option("snmp_retries"), SNMP_POLLER));
$arr = ss_host_disk_reindex(cacti_snmp_walk($hostname, $snmp_community, $oids[$arg], $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, read_config_option("snmp_retries"), SNMP_POLLER));
for ($i = 0; $i < sizeof($arr_index); $i++) {
print $arr_index[$i] . "!" . $arr[$i] . "\n";
}
} elseif ($cmd == "get") {
$arg = $arg1;
$index = $arg2;
$value = api_plugin_hook_function('hmib_get_disk', array("host_id" => $host_id, "arg" => $arg, "index" => $index));
if (is_array($value)) {
if ($arg == "total" || $arg == "used") {
$sau = eregi_replace("[^0-9]", "", db_fetch_cell("select field_value from host_snmp_cache where host_id={$host_id} and field_name='hrStorageAllocationUnits' and snmp_index='{$index}'"));
return cacti_snmp_get($hostname, $snmp_community, $oids[$arg] . ".{$index}", $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, read_config_option("snmp_retries"), SNMP_POLLER) * $sau;
} else {
return cacti_snmp_get($hostname, $snmp_community, $oids[$arg] . ".{$index}", $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, read_config_option("snmp_retries"), SNMP_POLLER);
}
} else {
return $value;
}
}
}
示例7: settings
function settings() {
global $colors, $themes;
$themes["default"] = _("System Default (Global Setting)");
/* you cannot have per-user settings if cacti's user management is not turned on */
if (read_config_option("auth_method") == "0") {
raise_message(6);
display_output_messages();
return;
}
/* get user settings */
$user = api_user_info( array( "id" => $_SESSION["sess_user_id"] ) );
print "<form method='post'>\n";
html_start_box("<strong>" . _("User Settings") . "</strong>", "98%", $colors["header_background"], "3", "center", "");
?>
<tr bgcolor='<?php print $colors["header_panel_background"];?>'>
<td colspan='2' class='textSubHeaderDark' style='padding: 3px;'>General</td>
</tr>
<?php
$form_array = array(
"current_theme" => array(
"friendly_name" => _("Visual Theme"),
"description" => _("The Cacti theme to use. Changes the look of Cacti."),
"method" => "drop_array",
"array" => $themes,
"value" => api_user_theme($_SESSION["sess_user_id"]),
"default" => "default"
)
);
draw_edit_form(
array(
"config" => array(
"no_form_tag" => true
),
"fields" => $form_array
)
);
html_end_box();
form_hidden_box("save_component_user","1","");
form_save_button((isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "index.php"), "save");
}
示例8: ss_host_cpu_get_indexes
function ss_host_cpu_get_indexes($hostname, $snmp_community, $snmp_version, $snmpv3_auth_username, $snmpv3_auth_password, $snmpv3_auth_protocol, $snmpv3_priv_passphrase, $snmpv3_priv_protocol, $snmp_port, $snmp_timeout)
{
$arr = ss_host_cpu_reindex(cacti_snmp_walk($hostname, $snmp_community, ".1.3.6.1.2.1.25.3.3.1", $snmp_version, $snmpv3_auth_username, $snmpv3_auth_password, $snmp_port, $snmp_timeout, read_config_option("snmp_retries"), SNMP_POLLER));
$return_arr = array();
$j = 0;
for ($i = 0; $i < sizeof($arr); $i++) {
if (is_numeric($arr[$i])) {
$return_arr[$j] = $j;
$j++;
}
}
return $return_arr;
}
示例9: api_reapply_suggested_graph_title
function api_reapply_suggested_graph_title($local_graph_id) {
global $config;
/* get graphs template id */
$graph_template_id = db_fetch_cell("select graph_template_id from graph_templates_graph where local_graph_id=" . $local_graph_id);
/* if a non-template graph, simply return */
if ($graph_template_id == 0) {
return;
}
/* get the host associated with this graph */
$graph_local = db_fetch_row("select host_id, graph_template_id, snmp_query_id, snmp_index from graph_local where id=" . $local_graph_id);
$snmp_query_graph_id = db_fetch_cell("select id from snmp_query_graph where graph_template_id=" . $graph_local["graph_template_id"] .
" and snmp_query_id=" . $graph_local["snmp_query_id"]);
/* get the suggested values from the suggested values cache */
$suggested_values = db_fetch_assoc("select text,field_name from snmp_query_graph_sv where snmp_query_graph_id=" . $snmp_query_graph_id . " order by sequence");
if (sizeof($suggested_values) > 0) {
foreach ($suggested_values as $suggested_value) {
/* once we find a match; don't try to find more */
if (!isset($suggested_values_graph[$graph_template_id]{$suggested_value["field_name"]})) {
$subs_string = substitute_snmp_query_data($suggested_value["text"], $graph_local["host_id"], $graph_local["snmp_query_id"], $graph_local["snmp_index"], read_config_option("max_data_query_field_length"));
/* if there are no '|' characters, all of the substitutions were successful */
if (!strstr($subs_string, "|query")) {
db_execute("update graph_templates_graph set " . $suggested_value["field_name"] . "='" . $suggested_value["text"] . "' where local_graph_id=" . $local_graph_id);
/* once we find a working value, stop */
$suggested_values_graph[$graph_template_id]{$suggested_value["field_name"]} = true;
}
}
}
}
/* suggested values: graph */
if (isset($suggested_values_array[$graph_template_id]["graph_template"])) {
while (list($field_name, $field_value) = each($suggested_values_array[$graph_template_id]["graph_template"])) {
db_execute("update graph_templates_graph set $field_name='$field_value' where local_graph_id=" . $local_graph_id);
}
}
/* suggested values: graph item */
if (isset($suggested_values_array[$graph_template_id]["graph_template_item"])) {
while (list($graph_template_item_id, $field_array) = each($suggested_values_array[$graph_template_id]["graph_template_item"])) {
while (list($field_name, $field_value) = each($field_array)) {
$graph_item_id = db_fetch_cell("select id from graph_templates_item where local_graph_template_item_id=$graph_template_item_id and local_graph_id=" . $local_graph_id);
db_execute("update graph_templates_item set $field_name='$field_value' where id=$graph_item_id");
}
}
}
}
示例10: mactrack_vmacs
function mactrack_vmacs()
{
global $site_actions, $config, $item_rows;
mactrack_vmacs_validate_request_vars();
if (get_request_var('rows') == -1) {
$row_limit = read_config_option('num_rows_table');
} elseif (get_request_var('rows') == -2) {
$row_limit = 999999;
} else {
$row_limit = get_request_var('rows');
}
html_start_box(__('MacTrack Vendor Mac Filter'), '100%', '', '3', 'center', '');
mactrack_vmac_filter();
html_end_box();
$sql_where = '';
$vmacs = mactrack_vmacs_get_vmac_records($sql_where, $row_limit);
$total_rows = db_fetch_cell("SELECT\n\t\tCOUNT(*)\n\t\tFROM mac_track_oui_database\n\t\t{$sql_where}");
$nav = html_nav_bar('mactrack_vendormacs.php', MAX_DISPLAY_PAGES, get_request_var('page'), $row_limit, $total_rows, 9, __('Vendor Macs'));
print $nav;
html_start_box('', '100%', '', '3', 'center', '');
$display_text = array('vendor_mac' => array(__('Vendor MAC'), 'ASC'), 'vendor_name' => array(__('Corporation'), 'ASC'), 'vendor_address' => array(__('Address'), 'ASC'));
html_header_sort($display_text, get_request_var('sort_column'), get_request_var('sort_direction'));
if (sizeof($vmacs)) {
foreach ($vmacs as $vmac) {
form_alternate_row();
?>
<td class='linkEditMain'><?php
print $vmac['vendor_mac'];
?>
</td>
<td><?php
print get_request_var('filter') != '' ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", $vmac['vendor_name']) : $vmac['vendor_name'];
?>
</td>
<td><?php
print get_request_var('filter') != '' ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", $vmac['vendor_address']) : $vmac['vendor_address'];
?>
</td>
</tr>
<?php
}
} else {
print '<tr><td><em>' . __('No MacTrack Vendor MACS') . '</em></td></tr>';
}
html_end_box(false);
if (sizeof($vmacs)) {
print $nav;
}
}
示例11: ss_mikrotik_snmpget
function ss_mikrotik_snmpget($hostid = '', $oid = '')
{
global $config;
include_once $config['base_path'] . '/lib/snmp.php';
if ($hostid > 0) {
$host = db_fetch_row("SELECT hostname, snmp_community, snmp_version, snmp_username, snmp_password, \n\t\t\tsnmp_auth_protocol, snmp_priv_passphrase, snmp_priv_protocol, snmp_context, \n\t\t\tsnmp_port, snmp_timeout, max_oids \n\t\t\tFROM host \n\t\t\tWHERE id={$hostid}");
if (sizeof($host)) {
$get = cacti_snmp_get($host['hostname'], $host['snmp_community'], $oid, $host['snmp_version'], $host['snmp_username'], $host['snmp_password'], $host['snmp_auth_protocol'], $host['snmp_priv_passphrase'], $host['snmp_priv_protocol'], $host['snmp_context'], $host['snmp_port'], $host['snmp_timeout'], read_config_option('snmp_retries'), SNMP_WEBUI);
if (!empty($get)) {
return $get;
}
}
}
return '0';
}
示例12: gpsmap_upgrade_database
function gpsmap_upgrade_database()
{
global $config, $database_default, $old;
include_once $config['library_path'] . '/database.php';
gpsmap_setup_database();
if ($old < "1.6") {
mysql_query("ALTER TABLE `host` CHANGE COLUMN latitude latitude DECIMAL(13,10) NOT NULL;");
mysql_query("ALTER TABLE `host` ALTER COLUMN latitude SET DEFAULT `0.0000000000`;");
mysql_query("ALTER TABLE `host` CHANGE COLUMN longitude longitude DECIMAL(13,10) NOT NULL;");
mysql_query("ALTER TABLE `host` ALTER COLUMN longitude SET DEFAULT `0.0000000000`;");
}
include_once $config['base_path'] . '/plugins/gpsmap/setup.php';
$v = plugin_gpsmap_version();
$oldv = read_config_option('plugin_gpsmap_version');
}
示例13: gpsmap_check_upgrade
function gpsmap_check_upgrade()
{
global $config;
$files = array('gpsmap.php', 'gpstemplates.php', 'poller.php');
if (isset($_SERVER['PHP_SELF']) && !in_array(basename($_SERVER['PHP_SELF']), $files)) {
return;
}
$current = plugin_gpsmap_version();
$current = $current['version'];
$old = read_config_option('plugin_gpsmap_version', TRUE);
if ($current != $old) {
include_once $config['base_path'] . '/plugins/gpsmap/includes/database.php';
gpsmap_upgrade_database();
}
}
示例14: substitute_path_variables
function substitute_path_variables($path) {
require_once(CACTI_BASE_PATH . "/lib/sys/string.php");
/* script query */
$path = clean_up_path(str_replace("|path_cacti|", CACTI_BASE_PATH, $path));
$path = clean_up_path(str_replace("|path_php_binary|", read_config_option("path_php_binary"), $path));
/* data source */
$path = clean_up_path(str_replace("<path_rra>", CACTI_BASE_PATH . "/rra", $path));
/* script */
$path = clean_up_path(str_replace("<path_cacti>", CACTI_BASE_PATH, $path));
$path = clean_up_path(str_replace("<path_snmpget>", read_config_option("path_snmpget"), $path));
$path = clean_up_path(str_replace("<path_php_binary>", read_config_option("path_php_binary"), $path));
return $path;
}
示例15: read_graph_config_option
function read_graph_config_option($config_name) {
/* users must have cacti user auth turned on to use this */
if ((read_config_option("auth_method") == "0") || (!isset($_SESSION["sess_user_id"]))) {
return read_default_graph_config_option($config_name);
}
if (!isset($_SESSION["sess_graph_config_array"][$config_name])) {
$db_setting = db_fetch_row("select value from settings_graphs where name='$config_name' and user_id=" . $_SESSION["sess_user_id"]);
if (isset($db_setting["value"])) {
$_SESSION["sess_graph_config_array"][$config_name] = $db_setting["value"];
}else{
$_SESSION["sess_graph_config_array"][$config_name] = read_default_graph_config_option($config_name);
}
}
return $_SESSION["sess_graph_config_array"][$config_name];
}