当前位置: 首页>>代码示例>>PHP>>正文


PHP get_hash_cdef函数代码示例

本文整理汇总了PHP中get_hash_cdef函数的典型用法代码示例。如果您正苦于以下问题:PHP get_hash_cdef函数的具体用法?PHP get_hash_cdef怎么用?PHP get_hash_cdef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_hash_cdef函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upgrade_to_0_8_4


//.........这里部分代码省略.........
	db_execute("update snmp_query_graph set hash='c1c2cfd33eaf5064300e92e26e20bc56' where id=11;");
	db_execute("update snmp_query_graph_rrd_sv set hash='8132fa9c446e199732f0102733cb1714' where id=30;");
	db_execute("update snmp_query_graph_sv set hash='48f4792dd49fefd7d640ec46b1d7bdb3' where id=12;");
	db_execute("update snmp_query set hash='8ffa36c1864124b38bcda2ae9bd61f46' where id=6;");
	db_execute("update snmp_query_graph set hash='a0b3e7b63c2e66f9e1ea24a16ff245fc' where id=15;");
	db_execute("update snmp_query_graph_rrd_sv set hash='cb09784ba05e401a3f1450126ed1e395' where id=69;");
	db_execute("update snmp_query_graph_sv set hash='f21b23df740bc4a2d691d2d7b1b18dba' where id=30;");
	db_execute("update snmp_query set hash='30ec734bc0ae81a3d995be82c73f46c1' where id=7;");
	db_execute("update snmp_query_graph set hash='f6db4151aa07efa401a0af6c9b871844' where id=17;");
	db_execute("update snmp_query_graph_rrd_sv set hash='42277993a025f1bfd85374d6b4deeb60' where id=92;");
	db_execute("update snmp_query_graph_sv set hash='d99f8db04fd07bcd2260d246916e03da' where id=40;");
	db_execute("update snmp_query set hash='9343eab1f4d88b0e61ffc9d020f35414' where id=8;");
	db_execute("update snmp_query_graph set hash='46c4ee688932cf6370459527eceb8ef3' where id=18;");
	db_execute("update snmp_query_graph_rrd_sv set hash='a3f280327b1592a1a948e256380b544f' where id=93;");
	db_execute("update snmp_query_graph_sv set hash='9852782792ede7c0805990e506ac9618' where id=38;");
	db_execute("update snmp_query set hash='0d1ab53fe37487a5d0b9e1d3ee8c1d0d' where id=9;");
	db_execute("update snmp_query_graph set hash='4a515b61441ea5f27ab7dee6c3cb7818' where id=19;");
	db_execute("update snmp_query_graph_rrd_sv set hash='b5a724edc36c10891fa2a5c370d55b6f' where id=94;");
	db_execute("update snmp_query_graph_sv set hash='fa2f07ab54fce72eea684ba893dd9c95' where id=39;");
	db_execute("update host_template set hash='4855b0e3e553085ed57219690285f91f' where id=1;");
	db_execute("update host_template set hash='07d3fe6a52915f99e642d22e27d967a4' where id=3;");
	db_execute("update host_template set hash='4e5dc8dd115264c2e9f3adb725c29413' where id=4;");
	db_execute("update host_template set hash='cae6a879f86edacb2471055783bec6d0' where id=5;");
	db_execute("update host_template set hash='9ef418b4251751e09c3c416704b01b01' where id=6;");
	db_execute("update host_template set hash='5b8300be607dce4f030b026a381b91cd' where id=7;");
	db_execute("update host_template set hash='2d3e47f416738c2d22c87c40218cc55e' where id=8;");
	db_execute("update rra set hash='c21df5178e5c955013591239eb0afd46' where id=1;");
	db_execute("update rra set hash='0d9c0af8b8acdc7807943937b3208e29' where id=2;");
	db_execute("update rra set hash='6fc2d038fb42950138b0ce3e9874cc60' where id=3;");
	db_execute("update rra set hash='e36f3adb9f152adfa5dc50fd2b23337e' where id=4;");

	$item = db_fetch_assoc("select id from cdef");
	for ($i=0; $i<count($item); $i++) {
		db_execute("update cdef set hash='" . get_hash_cdef($item[$i]["id"]) . "' where id=" . $item[$i]["id"] . ";");
		$item2 = db_fetch_assoc("select id from cdef_items where cdef_id=" . $item[$i]["id"]);
		for ($j=0; $j<count($item2); $j++) {
			db_execute("update cdef_items set hash='" . get_hash_cdef($item2[$j]["id"], "cdef_item") . "' where id=" . $item2[$j]["id"] . ";");
		}
	}

	$item = db_fetch_assoc("select id from graph_templates_gprint");
	for ($i=0; $i<count($item); $i++) {
		db_execute("update graph_templates_gprint set hash='" . get_hash_gprint($item[$i]["id"]) . "' where id=" . $item[$i]["id"] . ";");
	}

	$item = db_fetch_assoc("select id from data_input");
	for ($i=0; $i<count($item); $i++) {
		db_execute("update data_input set hash='" . get_hash_data_input($item[$i]["id"]) . "' where id=" . $item[$i]["id"] . ";");
		$item2 = db_fetch_assoc("select id from data_input_fields where data_input_id=" . $item[$i]["id"]);
		for ($j=0; $j<count($item2); $j++) {
			db_execute("update data_input_fields set hash='" . get_hash_data_input($item2[$j]["id"], "data_input_field") . "' where id=" . $item2[$j]["id"] . ";");
		}
	}

	$item = db_fetch_assoc("select id from data_template");
	for ($i=0; $i<count($item); $i++) {
		db_execute("update data_template set hash='" . get_hash_data_template($item[$i]["id"]) . "' where id=" . $item[$i]["id"] . ";");
		$item2 = db_fetch_assoc("select id from data_template_rrd where data_template_id=" . $item[$i]["id"] . " and local_data_id=0");
		for ($j=0; $j<count($item2); $j++) {
			db_execute("update data_template_rrd set hash='" . get_hash_data_template($item2[$j]["id"], "data_template_item") . "' where id=" . $item2[$j]["id"] . ";");
		}
	}

	$item = db_fetch_assoc("select id from graph_templates");
	for ($i=0; $i<count($item); $i++) {
		db_execute("update graph_templates set hash='" . get_hash_graph_template($item[$i]["id"]) . "' where id=" . $item[$i]["id"] . ";");
开发者ID:songchin,项目名称:Cacti,代码行数:67,代码来源:0_8_3_to_0_8_4.php

示例2: array

function &cdef_to_xml($cdef_id) {
	global $fields_cdef_edit;

	$fields_cdef_item_edit = array(
		"sequence" => "sequence",
		"type" => "type",
		"value" => "value"
		);

	$hash["cdef"] = get_hash_version("cdef") . get_hash_cdef($cdef_id);
	$xml_text = "";

	$cdef = db_fetch_row("select * from cdef where id=$cdef_id");
	$cdef_items = db_fetch_assoc("select * from cdef_items where cdef_id=$cdef_id order by sequence");

	if (empty($cdef["id"])) {
		return "Invalid CDEF.";
	}

	$xml_text .= "<hash_" . $hash["cdef"] . ">\n";

	/* XML Branch: <> */
	reset($fields_cdef_edit);
	while (list($field_name, $field_array) = each($fields_cdef_edit)) {
		if (($field_array["method"] != "hidden_zero") && ($field_array["method"] != "hidden")) {
			$xml_text .= "\t<$field_name>" . xml_character_encode($cdef{$field_name}) . "</$field_name>\n";
		}
	}

	/* XML Branch: <items> */

	$xml_text .= "\t<items>\n";

	$i = 0;
	if (sizeof($cdef_items) > 0) {
	foreach ($cdef_items as $item) {
		$hash["cdef_item"] = get_hash_version("cdef_item") . get_hash_cdef($item["id"], "cdef_item");

		$xml_text .= "\t\t<hash_" . $hash["cdef_item"] . ">\n";

		reset($fields_cdef_item_edit);
		while (list($field_name, $field_array) = each($fields_cdef_item_edit)) {
			if (($field_array["method"] != "hidden_zero") && ($field_array["method"] != "hidden")) {
				$xml_text .= "\t\t\t<$field_name>" . xml_character_encode($item{$field_name}) . "</$field_name>\n";
			}
		}

		$xml_text .= "\t\t</hash_" . $hash["cdef_item"] . ">\n";

		$i++;
	}
	}

	$xml_text .= "\t</items>\n";
	$xml_text .= "</hash_" . $hash["cdef"] . ">";

	return $xml_text;
}
开发者ID:songchin,项目名称:Cacti,代码行数:58,代码来源:export.php

示例3: form_save

function form_save() {
	if (isset($_POST["save_component_cdef"])) {
		$save["id"] = $_POST["id"];
		$save["hash"] = get_hash_cdef($_POST["id"]);
		$save["name"] = form_input_validate($_POST["name"], "name", "", false, 3);

		if (!is_error_message()) {
			$cdef_id = sql_save($save, "cdef");

			if ($cdef_id) {
				raise_message(1);
			}else{
				raise_message(2);
			}
		}

		if ((is_error_message()) || (empty($_POST["id"]))) {
			header("Location: cdef.php?action=edit&id=" . (empty($cdef_id) ? $_POST["id"] : $cdef_id));
		}else{
			header("Location: cdef.php");
		}
	}elseif (isset($_POST["save_component_item"])) {
		$sequence = get_sequence($_POST["id"], "sequence", "cdef_items", "cdef_id=" . $_POST["cdef_id"]);

		$save["id"] = $_POST["id"];
		$save["hash"] = get_hash_cdef($_POST["id"], "cdef_item");
		$save["cdef_id"] = $_POST["cdef_id"];
		$save["sequence"] = $sequence;
		$save["type"] = $_POST["type"];
		$save["value"] = $_POST["value"];

		if (!is_error_message()) {
			$cdef_item_id = sql_save($save, "cdef_items");

			if ($cdef_item_id) {
				raise_message(1);
			}else{
				raise_message(2);
			}
		}

		if (is_error_message()) {
			header("Location: cdef.php?action=item_edit&cdef_id=" . $_POST["cdef_id"] . "&id=" . (empty($cdef_item_id) ? $_POST["id"] : $cdef_item_id));
		}else{
			header("Location: cdef.php?action=edit&id=" . $_POST["cdef_id"]);
		}
	}
}
开发者ID:songchin,项目名称:Cacti,代码行数:48,代码来源:cdef.php

示例4: duplicate_cdef

function duplicate_cdef($_cdef_id, $cdef_title) {
	require_once(CACTI_BASE_PATH . "/lib/presets/preset_cdef_info.php");

	$cdef = db_fetch_row("select * from cdef where id=$_cdef_id");
	$cdef_items = db_fetch_assoc("select * from cdef_items where cdef_id=$_cdef_id");

	/* substitute the title variable */
	$cdef["name"] = str_replace(__("<cdef_title>"), $cdef["name"], $cdef_title);

	/* create new entry: device_template */
	$save["id"] = 0;
	$save["hash"] = get_hash_cdef(0);

	$fields_cdef_edit = preset_cdef_form_list();
	reset($fields_cdef_edit);
	while (list($field, $array) = each($fields_cdef_edit)) {
		if (!preg_match("/^hidden/", $array["method"])) {
			$save[$field] = $cdef[$field];
		}
	}

	$cdef_id = sql_save($save, "cdef");

	/* create new entry(s): cdef_items */
	if (sizeof($cdef_items) > 0) {
		foreach ($cdef_items as $cdef_item) {
			unset($save);

			$save["id"] = 0;
			$save["hash"] = get_hash_cdef(0, "cdef_item");
			$save["cdef_id"] = $cdef_id;
			$save["sequence"] = $cdef_item["sequence"];
			$save["type"] = $cdef_item["type"];
			$save["value"] = $cdef_item["value"];

			sql_save($save, "cdef_items");
		}
	}
}
开发者ID:songchin,项目名称:Cacti,代码行数:39,代码来源:utility.php

示例5: cdef_to_xml

/** encode a cdef along with all cdef_items as XML text
 * @param int $cdef_id	- the id of the cdef that has to be encoded
 * @return string		- the resulting XML text
 */
function cdef_to_xml($cdef_id)
{
    global $fields_cdef_edit, $export_errors;
    $fields_cdef_item_edit = array("sequence" => "sequence", "type" => "type", "value" => "value");
    $hash["cdef"] = get_hash_version("cdef") . get_hash_cdef($cdef_id);
    $xml_text = "";
    $cdef = db_fetch_row("select * from cdef where id={$cdef_id}");
    $cdef_items = db_fetch_assoc("select * from cdef_items where cdef_id={$cdef_id} order by sequence");
    if (empty($cdef["id"])) {
        $export_errors++;
        raise_message(25);
        cacti_log("ERROR: Invalid CDEF found in Graph Template.  Please run database repair script to identify and/or correct.", false, "WEBUI");
        return;
    }
    $xml_text .= "<hash_" . $hash["cdef"] . ">\n";
    /* XML Branch: <> */
    reset($fields_cdef_edit);
    while (list($field_name, $field_array) = each($fields_cdef_edit)) {
        if ($field_array["method"] != "hidden_zero" && $field_array["method"] != "hidden") {
            $xml_text .= "\t<{$field_name}>" . xml_character_encode($cdef[$field_name]) . "</{$field_name}>\n";
        }
    }
    /* XML Branch: <items> */
    $xml_text .= "\t<items>\n";
    $i = 0;
    if (sizeof($cdef_items) > 0) {
        foreach ($cdef_items as $item) {
            $hash["cdef_item"] = get_hash_version("cdef_item") . get_hash_cdef($item["id"], "cdef_item");
            $xml_text .= "\t\t<hash_" . $hash["cdef_item"] . ">\n";
            /* now do the encoding */
            reset($fields_cdef_item_edit);
            while (list($field_name, $field_array) = each($fields_cdef_item_edit)) {
                /* check, if an inherited cdef as to be encoded */
                if ($field_name == "value" && $item["type"] == '5') {
                    $xml_text .= "\t\t\t<{$field_name}>hash_" . get_hash_version("cdef") . get_hash_cdef($item[$field_name]) . "</{$field_name}>\n";
                } else {
                    $xml_text .= "\t\t\t<{$field_name}>" . xml_character_encode($item[$field_name]) . "</{$field_name}>\n";
                }
            }
            $xml_text .= "\t\t</hash_" . $hash["cdef_item"] . ">\n";
            $i++;
        }
    }
    $xml_text .= "\t</items>\n";
    $xml_text .= "</hash_" . $hash["cdef"] . ">";
    return $xml_text;
}
开发者ID:teddywen,项目名称:cacti,代码行数:51,代码来源:export.php

示例6: duplicate_cdef

function duplicate_cdef($_cdef_id, $cdef_title)
{
    global $fields_cdef_edit;
    $cdef = db_fetch_row("select * from cdef where id={$_cdef_id}");
    $cdef_items = db_fetch_assoc("select * from cdef_items where cdef_id={$_cdef_id}");
    /* substitute the title variable */
    $cdef["name"] = str_replace("<cdef_title>", $cdef["name"], $cdef_title);
    /* create new entry: host_template */
    $save["id"] = 0;
    $save["hash"] = get_hash_cdef(0);
    reset($fields_cdef_edit);
    while (list($field, $array) = each($fields_cdef_edit)) {
        if (!ereg("^hidden", $array["method"])) {
            $save[$field] = $cdef[$field];
        }
    }
    $cdef_id = sql_save($save, "cdef");
    /* create new entry(s): cdef_items */
    if (sizeof($cdef_items) > 0) {
        foreach ($cdef_items as $cdef_item) {
            unset($save);
            $save["id"] = 0;
            $save["hash"] = get_hash_cdef(0, "cdef_item");
            $save["cdef_id"] = $cdef_id;
            $save["sequence"] = $cdef_item["sequence"];
            $save["type"] = $cdef_item["type"];
            $save["value"] = $cdef_item["value"];
            sql_save($save, "cdef_items");
        }
    }
}
开发者ID:songchin,项目名称:Cacti,代码行数:31,代码来源:utility.php

示例7: form_save

function form_save()
{
    // make sure ids are numeric
    if (isset($_POST["id"]) && !is_numeric($_POST["id"])) {
        $_POST["id"] = 0;
    }
    if (isset($_POST["cdef_id"]) && !is_numeric($_POST["cdef_id"])) {
        $_POST["cdef_id"] = 0;
    }
    if (isset($_POST["save_component_cdef"])) {
        /* ================= input validation ================= */
        input_validate_input_number(get_request_var_post('id'));
        /* ==================================================== */
        $save["id"] = $_POST["id"];
        $save["hash"] = get_hash_cdef($_POST["id"]);
        $save["name"] = form_input_validate($_POST["name"], "name", "", false, 3);
        if (!is_error_message()) {
            $cdef_id = sql_save($save, "cdef");
            if ($cdef_id) {
                raise_message(1);
            } else {
                raise_message(2);
            }
        }
        header("Location: cdef.php?action=edit&id=" . (empty($cdef_id) ? $_POST["id"] : $cdef_id));
    } elseif (isset($_POST["save_component_item"])) {
        /* ================= input validation ================= */
        input_validate_input_number(get_request_var_post('id'));
        input_validate_input_number(get_request_var_post('cdef_id'));
        input_validate_input_number(get_request_var_post('type'));
        /* ==================================================== */
        $sequence = get_sequence($_POST["id"], "sequence", "cdef_items", "cdef_id=" . $_POST["cdef_id"]);
        $save["id"] = $_POST["id"];
        $save["hash"] = get_hash_cdef($_POST["id"], "cdef_item");
        $save["cdef_id"] = $_POST["cdef_id"];
        $save["sequence"] = $sequence;
        $save["type"] = $_POST["type"];
        $save["value"] = $_POST["value"];
        if (!is_error_message()) {
            $cdef_item_id = sql_save($save, "cdef_items");
            if ($cdef_item_id) {
                raise_message(1);
            } else {
                raise_message(2);
            }
        }
        if (is_error_message()) {
            header("Location: cdef.php?action=item_edit&cdef_id=" . $_POST["cdef_id"] . "&id=" . (empty($cdef_item_id) ? $_POST["id"] : $cdef_item_id));
        } else {
            header("Location: cdef.php?action=edit&id=" . $_POST["cdef_id"]);
        }
    }
}
开发者ID:teddywen,项目名称:cacti,代码行数:53,代码来源:cdef.php

示例8: cdef_to_xml

function cdef_to_xml($cdef_id) {
	require_once(CACTI_BASE_PATH . "/lib/presets/preset_cdef_info.php");

	$hash["cdef"] = get_hash_version("cdef") . get_hash_cdef($cdef_id);
	$xml_text = "";

	$cdef = db_fetch_row("select * from cdef where id=$cdef_id");
	$cdef_items = db_fetch_assoc("select * from cdef_items where cdef_id=$cdef_id order by sequence");

	if (empty($cdef["id"])) {
		$err_msg = "Invalid CDEF.";
		return $err_msg;
	}

	$xml_text .= "<hash_" . $hash["cdef"] . ">\n";

	/* XML Branch: <> */
	$fields_cdef_edit = preset_cdef_form_list();
	reset($fields_cdef_edit);
	while (list($field_name, $field_array) = each($fields_cdef_edit)) {
		if (($field_array["method"] != "hidden_zero") && ($field_array["method"] != "hidden") && ($field_array["method"] != "spacer")) {
			$xml_text .= "\t<$field_name>" . xml_character_encode($cdef{$field_name}) . "</$field_name>\n";
		}
	}

	/* XML Branch: <items> */

	$xml_text .= "\t<items>\n";

	$i = 0;
	if (sizeof($cdef_items) > 0) {
	foreach ($cdef_items as $item) {
		$hash["cdef_item"] = get_hash_version("cdef_item") . get_hash_cdef($item["id"], "cdef_item");

		$xml_text .= "\t\t<hash_" . $hash["cdef_item"] . ">\n";

		reset($fields_cdef_item_edit);
		while (list($field_name, $field_array) = each($fields_cdef_item_edit)) {
			if (($field_array["method"] != "hidden_zero") && ($field_array["method"] != "hidden") && ($field_array["method"] != "spacer")) {
				$xml_text .= "\t\t\t<$field_name>" . xml_character_encode($item{$field_name}) . "</$field_name>\n";
			}
		}

		$xml_text .= "\t\t</hash_" . $hash["cdef_item"] . ">\n";

		$i++;
	}
	}

	$xml_text .= "\t</items>\n";
	$xml_text .= "</hash_" . $hash["cdef"] . ">";

	return $xml_text;
}
开发者ID:songchin,项目名称:Cacti,代码行数:54,代码来源:export.php

示例9: form_save

function form_save()
{
    if (isset($_POST['save_component_cdef'])) {
        $save['id'] = form_input_validate($_POST['id'], 'id', '^[0-9]+$', false, 3);
        $save['hash'] = get_hash_cdef($_POST['id']);
        $save['name'] = form_input_validate($_POST['name'], 'name', '', false, 3);
        if (!is_error_message()) {
            $cdef_id = sql_save($save, 'cdef');
            if ($cdef_id) {
                raise_message(1);
            } else {
                raise_message(2);
            }
        }
        header('Location: cdef.php?action=edit&id=' . (empty($cdef_id) ? $_POST['id'] : $cdef_id));
    } elseif (isset($_POST['save_component_item'])) {
        $sequence = get_sequence($_POST['id'], 'sequence', 'cdef_items', 'cdef_id=' . $_POST['cdef_id']);
        $save['id'] = form_input_validate($_POST['id'], 'id', '^[0-9]+$', false, 3);
        $save['hash'] = get_hash_cdef($_POST['id'], 'cdef_item');
        $save['cdef_id'] = form_input_validate($_POST['cdef_id'], 'cdef_id', '^[0-9]+$', false, 3);
        $save['sequence'] = $sequence;
        $save['type'] = form_input_validate($_POST['type'], 'type', '^[0-9]+$', false, 3);
        $save['value'] = form_input_validate($_POST['value'], 'value', '', false, 3);
        if (!is_error_message()) {
            $cdef_item_id = sql_save($save, 'cdef_items');
            if ($cdef_item_id) {
                raise_message(1);
            } else {
                raise_message(2);
            }
        }
        if (is_error_message()) {
            header('Location: cdef.php?action=item_edit&cdef_id=' . $_POST['cdef_id'] . '&id=' . (empty($cdef_item_id) ? $_POST['id'] : $cdef_item_id));
        } else {
            header('Location: cdef.php?action=edit&id=' . $_POST['cdef_id']);
        }
    }
}
开发者ID:MrWnn,项目名称:cacti,代码行数:38,代码来源:cdef.php


注:本文中的get_hash_cdef函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。