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


PHP sql_save函数代码示例

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


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

示例1: form_save

function form_save()
{
    if (isset($_POST["save_component_rra"])) {
        $save["id"] = $_POST["id"];
        $save["hash"] = get_hash_round_robin_archive($_POST["id"]);
        $save["name"] = form_input_validate($_POST["name"], "name", "", false, 3);
        $save["x_files_factor"] = form_input_validate($_POST["x_files_factor"], "x_files_factor", "^[0-9]+(\\.[0-9])?\$", false, 3);
        $save["steps"] = form_input_validate($_POST["steps"], "steps", "^[0-9]*\$", false, 3);
        $save["rows"] = form_input_validate($_POST["rows"], "rows", "^[0-9]*\$", false, 3);
        $save["timespan"] = form_input_validate($_POST["timespan"], "timespan", "^[0-9]*\$", false, 3);
        if (!is_error_message()) {
            $rra_id = sql_save($save, "rra");
            if ($rra_id) {
                raise_message(1);
                db_execute("delete from rra_cf where rra_id={$rra_id}");
                if (isset($_POST["consolidation_function_id"])) {
                    for ($i = 0; $i < count($_POST["consolidation_function_id"]); $i++) {
                        /* ================= input validation ================= */
                        input_validate_input_number($_POST["consolidation_function_id"][$i]);
                        /* ==================================================== */
                        db_execute("insert into rra_cf (rra_id,consolidation_function_id)\n\t\t\t\t\t\t\tvalues ({$rra_id}," . $_POST["consolidation_function_id"][$i] . ")");
                    }
                }
            } else {
                raise_message(2);
            }
        }
        if (is_error_message()) {
            header("Location: rra.php?action=edit&id=" . (empty($rra_id) ? $_POST["id"] : $rra_id));
        } else {
            header("Location: rra.php");
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:odp-svn,代码行数:34,代码来源:rra.php

示例2: form_save

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

		if (!is_error_message()) {
			$gprint_preset_id = sql_save($save, "graph_templates_gprint");

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

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

示例3: form_save

function form_save()
{
    /* modify for multi user start */
    /* ================= input validation ================= */
    input_validate_input_number(get_request_var_post("id"));
    /* ==================================================== */
    if (!check_notification($_REQUEST['id'])) {
        access_denied();
    }
    /* modify for multi user end */
    if (isset($_POST["save_component"])) {
        $save["id"] = $_POST["id"];
        $save["name"] = form_input_validate($_POST["name"], "name", "", false, 3);
        $save["description"] = form_input_validate($_POST["description"], "description", "", false, 3);
        $save["emails"] = form_input_validate($_POST["emails"], "emails", "", false, 3);
        if (!is_error_message()) {
            $id = sql_save($save, "plugin_notification_lists");
            if ($id) {
                raise_message(1);
            } else {
                raise_message(2);
            }
        }
    }
    header("Location: notify_lists.php?action=edit&id=" . (empty($id) ? $_POST["id"] : $id));
}
开发者ID:resmon,项目名称:resmon-cacti,代码行数:26,代码来源:notify_lists.php

示例4: form_save

function form_save() {
	if (isset($_POST["save_component_template"])) {
		$redirect_back = false;

		$save["id"] = $_POST["id"];
		$save["hash"] = get_hash_host_template($_POST["id"]);
		$save["name"] = form_input_validate($_POST["name"], "name", "", false, 3);

		if (!is_error_message()) {
			$host_template_id = sql_save($save, "host_template");

			if ($host_template_id) {
				raise_message(1);

				if (isset($_POST["add_gt_x"])) {
					db_execute("replace into host_template_graph (host_template_id,graph_template_id) values($host_template_id," . $_POST["graph_template_id"] . ")");
					$redirect_back = true;
				}elseif (isset($_POST["add_dq_x"])) {
					db_execute("replace into host_template_snmp_query (host_template_id,snmp_query_id) values($host_template_id," . $_POST["snmp_query_id"] . ")");
					$redirect_back = true;
				}
			}else{
				raise_message(2);
			}
		}

		if ((is_error_message()) || (empty($_POST["id"])) || ($redirect_back == true)) {
			header("Location: host_templates.php?action=edit&id=" . (empty($host_template_id) ? $_POST["id"] : $host_template_id));
		}else{
			header("Location: host_templates.php");
		}
	}
}
开发者ID:songchin,项目名称:Cacti,代码行数:33,代码来源:host_templates.php

示例5: event_save

/**
 * Insert an event including all parameters
 *
 * This function if used by plugins to insert events to be processed
 *
 * @param string $handler Handler Name
 * @param array $params array of parameters, field => value elements
 * @param string $message Event Message
 * @param int $plugin_id ID of plugin that is inserting the event
 * @return int row number of insert (false if unsuccessful)
 */
function event_save ($handler, $params, $message = '', $plugin_id = 0) {
	$save['id'] = '';
	$save["handler"] = $handler;
	$save['created'] = time();
	$save["plugin_id"] = $plugin_id;
	$save["message"] = $message;

	$control_id = sql_save($save, "event_queue_control");

	if ($control_id) {
		$save = array();
		$save['id'] = '';
		$save["control_id"] = $control_id;
		$save["plugin_id"] = $plugin_id;
		if (is_array($params)) {
			foreach($params as $par => $text) {
				$save = array();
				$save['id'] = '';
				$save["control_id"] = $control_id;
				$save["plugin_id"] = $plugin_id;
				$save['name'] = $par;
				$save['value'] = $text;
				$param_id = sql_save($save, "event_queue_param");
			}
		}
	}
	return $control_id;
}
开发者ID:songchin,项目名称:Cacti,代码行数:39,代码来源:event_update.php

示例6: user_copy

function user_copy($template_user, $new_user, $new_realm = 0)
{
    $user_auth = db_fetch_row("select * from user_auth where username = '{$template_user}'");
    $user_auth['username'] = $new_user;
    $user_auth['realm'] = $new_realm;
    $old_id = $user_auth['id'];
    $user_auth['id'] = 0;
    $new_id = sql_save($user_auth, 'user_auth');
    $user_auth_perms = db_fetch_assoc("select * from user_auth_perms where user_id = '{$old_id}'");
    foreach ($user_auth_perms as $row) {
        $row['user_id'] = $new_id;
        sql_save($row, 'user_auth_perms', array('user_id', 'item_id', 'type'), false);
    }
    $user_auth_realm = db_fetch_assoc("select * from user_auth_realm where user_id = '{$old_id}'");
    foreach ($user_auth_realm as $row) {
        $row['user_id'] = $new_id;
        sql_save($row, 'user_auth_realm', array('realm_id', 'user_id'), false);
    }
    $settings_graphs = db_fetch_assoc("select * from settings_graphs where user_id = '{$old_id}'");
    foreach ($settings_graphs as $row) {
        $row['user_id'] = $new_id;
        sql_save($row, 'settings_graphs', array('user_id', 'name'), false);
    }
    $settings_tree = db_fetch_assoc("select * from settings_tree where user_id = '{$old_id}'");
    foreach ($settings_tree as $row) {
        $row['user_id'] = $new_id;
        sql_save($row, 'settings_tree', array('user_id', 'graph_tree_item_id'), false);
    }
}
开发者ID:songchin,项目名称:Cacti,代码行数:29,代码来源:auth.php

示例7: form_save

function form_save()
{
    if (isset($_POST["save_component_tree"])) {
        $save["id"] = $_POST["id"];
        $save["name"] = form_input_validate($_POST["name"], "name", "", false, 3);
        $save["sort_type"] = form_input_validate($_POST["sort_type"], "sort_type", "", true, 3);
        if (!is_error_message()) {
            $tree_id = sql_save($save, "graph_tree");
            if ($tree_id) {
                raise_message(1);
                /* sort the tree using the algorithm chosen by the user */
                sort_tree(SORT_TYPE_TREE, $tree_id, $_POST["sort_type"]);
            } else {
                raise_message(2);
            }
        }
        if (is_error_message() || empty($_POST["id"])) {
            header("Location: tree.php?action=edit&id=" . (empty($tree_id) ? $_POST["id"] : $tree_id));
        } else {
            header("Location: tree.php");
        }
    } elseif (isset($_POST["save_component_tree_item"])) {
        $tree_item_id = api_tree_item_save($_POST["id"], $_POST["graph_tree_id"], $_POST["type"], $_POST["parent_item_id"], isset($_POST["title"]) ? $_POST["title"] : "", isset($_POST["local_graph_id"]) ? $_POST["local_graph_id"] : "0", isset($_POST["rra_id"]) ? $_POST["rra_id"] : "0", isset($_POST["host_id"]) ? $_POST["host_id"] : "0", isset($_POST["host_grouping_type"]) ? $_POST["host_grouping_type"] : "1", isset($_POST["sort_children_type"]) ? $_POST["sort_children_type"] : "1", isset($_POST["propagate_changes"]) ? true : false);
        if (is_error_message()) {
            header("Location: tree.php?action=item_edit&tree_item_id=" . (empty($tree_item_id) ? $_POST["id"] : $tree_item_id) . "&tree_id=" . $_POST["graph_tree_id"] . "&parent_id=" . $_POST["parent_item_id"]);
        } else {
            header("Location: tree.php?action=edit&id=" . $_POST["graph_tree_id"]);
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:odp-svn,代码行数:30,代码来源:tree.php

示例8: form_save

function form_save() {
	/* save the poller */
	if (isset($_POST["save_component_poller"])) {
		$save["id"]          = $_POST["id"];

		$save["disabled"]    = form_input_validate((isset($_POST["disabled"]) ? get_request_var_post("disabled"):""), "disabled", "", true, 3);
		$save["description"] = form_input_validate(get_request_var_post("description"), "description", "", false, 3);
		$save["hostname"]    = form_input_validate(get_request_var_post("hostname"), "hostname", "", true, 3);
		$save["ip_address"]  = form_input_validate(get_request_var_post("ip_address"), "ip_address", "", true, 3);

		if (!is_error_message()) {
			$poller_id = sql_save($save, "poller");

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

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

示例9: form_save

function form_save()
{
    /* ================= input validation ================= */
    input_validate_input_number(get_request_var_post('host_template_id'));
    input_validate_input_number(get_request_var_post('snmp_query_id'));
    input_validate_input_number(get_request_var_post('graph_template_id'));
    /* ==================================================== */
    if (isset($_POST['save_component_template'])) {
        $redirect_back = false;
        $save['id'] = $_POST['id'];
        $save['hash'] = get_hash_host_template($_POST['id']);
        $save['name'] = form_input_validate($_POST['name'], 'name', '', false, 3);
        if (!is_error_message()) {
            $host_template_id = sql_save($save, 'host_template');
            if ($host_template_id) {
                raise_message(1);
                if (isset($_POST['add_gt_x'])) {
                    db_execute_prepared('REPLACE INTO host_template_graph (host_template_id, graph_template_id) VALUES (?, ?)', array($host_template_id, $_POST['graph_template_id']));
                    $redirect_back = true;
                } elseif (isset($_POST['add_dq_x'])) {
                    db_execute_prepared('REPLACE INTO host_template_snmp_query (host_template_id, snmp_query_id) VALUES (?, ?)', array($host_template_id, $_POST['snmp_query_id']));
                    $redirect_back = true;
                }
            } else {
                raise_message(2);
            }
        }
        header('Location: host_templates.php?action=edit&id=' . (empty($host_template_id) ? $_POST['id'] : $host_template_id));
    }
}
开发者ID:MrWnn,项目名称:cacti,代码行数:30,代码来源:host_templates.php

示例10: xaxis_form_save

function xaxis_form_save() {

	if (isset($_POST["save_component_xaxis"])) {
		$save["id"]   = $_POST["id"];
		$save["hash"] = get_hash_xaxis($_POST["id"]);
		$save["name"] = form_input_validate($_POST["name"], "name", "", false, 3);

		if (!is_error_message()) {
			$xaxis_id = sql_save($save, "graph_templates_xaxis");

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

		if ((is_error_message()) || (empty($_POST["id"]))) {
			header("Location: xaxis_presets.php?action=edit&id=" . (empty($xaxis_id) ? $_POST["id"] : $xaxis_id));
		}else{
			header("Location: xaxis_presets.php");
		}
		exit;
	}

	if ((isset($_POST["save_component_item"]))) {
		$save["id"]   = $_POST["id"];
		$save["hash"] = get_hash_xaxis($_POST["id"], "xaxis_item");
		$save["item_name"] = form_input_validate($_POST["item_name"], "item_name", "", true, 3);
		$save["xaxis_id"] = form_input_validate($_POST["xaxis_id"], "xaxis_id", "^[0-9]+$", false, 3);
		$save["timespan"] = form_input_validate($_POST["timespan"], "timespan", "^[0-9]+$", false, 3);
		$save["gtm"] = form_input_validate($_POST["gtm"], "gtm", "", false, 3);
		$save["gst"] = form_input_validate($_POST["gst"], "gst", "^[0-9]+$", false, 3);
		$save["mtm"] = form_input_validate($_POST["mtm"], "mtm", "", false, 3);
		$save["mst"] = form_input_validate($_POST["mst"], "mst", "^[0-9]+$", false, 3);
		$save["ltm"] = form_input_validate($_POST["ltm"], "ltm", "", false, 3);
		$save["lst"] = form_input_validate($_POST["lst"], "lst", "^[0-9]+$", false, 3);
		$save["lpr"] = form_input_validate($_POST["lpr"], "lpr", "^[0-9]+$", false, 3);
		$save["lfm"] = form_input_validate($_POST["lfm"], "lfm", "", true, 3);

		if (!is_error_message()) {
			$xaxis_item_id = sql_save($save, "graph_templates_xaxis_items");

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

		if ((is_error_message()) || (empty($_POST["id"]))) {
			header("Location: xaxis_presets.php?action=item_edit&xaxis_id=" . $_POST["xaxis_id"] . "&id=" . (empty($xaxis_item_id) ? $_POST["id"] : $xaxis_item_id));
		}else{
			header("Location: xaxis_presets.php?action=edit&id=" . (!empty($_POST["xaxis_id"]) ? $_POST["xaxis_id"] : 0));
		}
		exit;
	}
}
开发者ID:songchin,项目名称:Cacti,代码行数:58,代码来源:xaxis_form.php

示例11: form_save

function form_save()
{
    if (isset($_POST["save_component_input"]) && !is_error_message()) {
        $graph_input_values = array();
        $selected_graph_items = array();
        $save["id"] = $_POST["graph_template_input_id"];
        $save["hash"] = get_hash_graph_template($_POST["graph_template_input_id"], "graph_template_input");
        $save["graph_template_id"] = $_POST["graph_template_id"];
        $save["name"] = form_input_validate($_POST["name"], "name", "", false, 3);
        $save["description"] = form_input_validate($_POST["description"], "description", "", true, 3);
        $save["column_name"] = form_input_validate($_POST["column_name"], "column_name", "", true, 3);
        if (!is_error_message()) {
            $graph_template_input_id = sql_save($save, "graph_template_input");
            if ($graph_template_input_id) {
                raise_message(1);
                /* list all graph items from the db so we can compare them with the current form */
                $db_selected_graph_item = array_rekey(db_fetch_assoc("select graph_template_item_id from graph_template_input_defs where graph_template_input_id={$graph_template_input_id}"), "graph_template_item_id", "graph_template_item_id");
                /* list all select graph items for use down below */
                while (list($var, $val) = each($_POST)) {
                    if (preg_match("/^i_(\\d+)\$/", $var, $matches)) {
                        /* ================= input validation ================= */
                        input_validate_input_number($matches[1]);
                        /* ==================================================== */
                        $selected_graph_items[$matches[1]] = $matches[1];
                        if (isset($db_selected_graph_item[$matches[1]])) {
                            /* is selected and exists in the db; old item */
                            $old_members[$matches[1]] = $matches[1];
                        } else {
                            /* is selected and does not exist the db; new item */
                            $new_members[$matches[1]] = $matches[1];
                        }
                    }
                }
                if (isset($new_members) && sizeof($new_members) > 0) {
                    while (list($item_id, $item_id) = each($new_members)) {
                        push_out_graph_input($graph_template_input_id, $item_id, isset($new_members) ? $new_members : array());
                    }
                }
                db_execute("delete from graph_template_input_defs where graph_template_input_id={$graph_template_input_id}");
                if (sizeof($selected_graph_items) > 0) {
                    foreach ($selected_graph_items as $graph_template_item_id) {
                        db_execute("insert into graph_template_input_defs (graph_template_input_id,graph_template_item_id)\n\t\t\t\t\t\tvalues ({$graph_template_input_id},{$graph_template_item_id})");
                    }
                }
            } else {
                raise_message(2);
            }
        }
        if (is_error_message()) {
            header("Location: graph_templates_inputs.php?action=input_edit&graph_template_input_id=" . (empty($graph_template_input_id) ? $_POST["graph_template_input_id"] : $graph_template_input_id) . "&graph_template_id=" . $_POST["graph_template_id"]);
            exit;
        } else {
            header("Location: graph_templates.php?action=template_edit&id=" . $_POST["graph_template_id"]);
            exit;
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:odp-svn,代码行数:57,代码来源:graph_templates_inputs.php

示例12: api_device_save

function api_device_save($id, $host_template_id, $description, $hostname, $snmp_community, $snmp_version, $snmp_username, $snmp_password, $snmp_port, $snmp_timeout, $disabled)
{
    /* fetch some cache variables */
    if (empty($id)) {
        $_host_template_id = 0;
    } else {
        $_host_template_id = db_fetch_cell("select host_template_id from host where id={$id}");
    }
    $save["id"] = $id;
    $save["host_template_id"] = form_input_validate($host_template_id, "host_template_id", "^[0-9]+\$", false, 3);
    $save["description"] = form_input_validate($description, "description", "", false, 3);
    $save["hostname"] = form_input_validate($hostname, "hostname", "", false, 3);
    $save["snmp_community"] = form_input_validate($snmp_community, "snmp_community", "", true, 3);
    $save["snmp_version"] = form_input_validate($snmp_version, "snmp_version", "", true, 3);
    $save["snmp_username"] = form_input_validate($snmp_username, "snmp_username", "", true, 3);
    $save["snmp_password"] = form_input_validate($snmp_password, "snmp_password", "", true, 3);
    $save["snmp_port"] = form_input_validate($snmp_port, "snmp_port", "^[0-9]+\$", false, 3);
    $save["snmp_timeout"] = form_input_validate($snmp_timeout, "snmp_timeout", "^[0-9]+\$", false, 3);
    $save["disabled"] = form_input_validate($disabled, "disabled", "", true, 3);
    $host_id = 0;
    if (!is_error_message()) {
        $host_id = sql_save($save, "host");
        if ($host_id) {
            raise_message(1);
            /* push out relavant fields to data sources using this host */
            push_out_host($host_id, 0);
            /* the host substitution cache is now stale; purge it */
            kill_session_var("sess_host_cache_array");
            /* update title cache for graph and data source */
            update_data_source_title_cache_from_host($host_id);
            update_graph_title_cache_from_host($host_id);
        } else {
            raise_message(2);
        }
        /* if the user changes the host template, add each snmp query associated with it */
        if ($host_template_id != $_host_template_id && !empty($host_template_id)) {
            $snmp_queries = db_fetch_assoc("select snmp_query_id from host_template_snmp_query where host_template_id={$host_template_id}");
            if (sizeof($snmp_queries) > 0) {
                foreach ($snmp_queries as $snmp_query) {
                    db_execute("replace into host_snmp_query (host_id,snmp_query_id,reindex_method) values ({$host_id}," . $snmp_query["snmp_query_id"] . "," . DATA_QUERY_AUTOINDEX_BACKWARDS_UPTIME . ")");
                    /* recache snmp data */
                    run_data_query($host_id, $snmp_query["snmp_query_id"]);
                }
            }
            $graph_templates = db_fetch_assoc("select graph_template_id from host_template_graph where host_template_id={$host_template_id}");
            if (sizeof($graph_templates) > 0) {
                foreach ($graph_templates as $graph_template) {
                    db_execute("replace into host_graph (host_id,graph_template_id) values ({$host_id}," . $graph_template["graph_template_id"] . ")");
                }
            }
        }
    }
    return $host_id;
}
开发者ID:songchin,项目名称:Cacti,代码行数:54,代码来源:api_device.php

示例13: api_mactrack_device_save

function api_mactrack_device_save($device_id, $host_id, $site_id, $hostname,
	$device_name, $scan_type, $snmp_options, $snmp_readstring,
	$snmp_version, $snmp_username, $snmp_password, $snmp_auth_protocol,
	$snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context,
	$snmp_port, $snmp_timeout, $snmp_retries, $max_oids,
	$ignorePorts, $notes, $user_name, $user_password, $term_type,
	$private_key_path, $disabled) {
	global $config;
	include_once($config["base_path"] . "/plugins/mactrack/lib/mactrack_functions.php");

	$save["device_id"] = $device_id;
	$save["host_id"] = $host_id;
	$save["site_id"] = $site_id;
	$save["hostname"] = form_input_validate($hostname, "hostname", "", false, 3);
	$save["device_name"] = form_input_validate($device_name, "device_name", "", false, 3);
	$save["notes"] = form_input_validate($notes, "notes", "", true, 3);
	$save["scan_type"] = form_input_validate($scan_type, "scan_type", "", false, 3);
	$save["snmp_options"] = form_input_validate($snmp_options, "snmp_options", "^[0-9]+$", true, 3);
	$save["snmp_readstring"] = form_input_validate($snmp_readstring, "snmp_readstring", "", true, 3); # for SNMP V3, this is optional
	$save["snmp_version"] = form_input_validate($snmp_version, "snmp_version", "", false, 3);
	$save["snmp_username"]        = form_input_validate($snmp_username, "snmp_username", "", true, 3);
	$save["snmp_password"]        = form_input_validate($snmp_password, "snmp_password", "", true, 3);
	$save["snmp_auth_protocol"]   = form_input_validate($snmp_auth_protocol, "snmp_auth_protocol", "", true, 3);
	$save["snmp_priv_passphrase"] = form_input_validate($snmp_priv_passphrase, "snmp_priv_passphrase", "", true, 3);
	$save["snmp_priv_protocol"]   = form_input_validate($snmp_priv_protocol, "snmp_priv_protocol", "", true, 3);
	$save["snmp_context"]         = form_input_validate($snmp_context, "snmp_context", "", true, 3);
	$save["snmp_port"] = form_input_validate($snmp_port, "snmp_port", "^[0-9]+$", false, 3);
	$save["snmp_timeout"] = form_input_validate($snmp_timeout, "snmp_timeout", "^[0-9]+$", false, 3);
	$save["snmp_retries"] = form_input_validate($snmp_retries, "snmp_retries", "^[0-9]+$", false, 3);
	$save["max_oids"] = form_input_validate($max_oids, "max_oids", "^[0-9]+$", false, 3);
	$save["user_name"] = form_input_validate($user_name, "user_name", "", true, 3);
	$save["user_password"] = form_input_validate($user_password, "user_password", "", true, 3);
	$save["ignorePorts"] = form_input_validate($ignorePorts, "ignorePorts", "", true, 3);
	$save["term_type"] = form_input_validate($term_type, "term_type", "", true, 3);
	$save["private_key_path"] = form_input_validate($private_key_path, "private_key_path", "", true, 3);
	$save["disabled"] = form_input_validate($disabled, "disabled", "", true, 3);

	$device_id = 0;
	if (!is_error_message()) {
		$device_id = sql_save($save, "mac_track_devices", "device_id");

		if ($device_id) {
			raise_message(1);
			sync_mactrack_to_cacti($save);
		}else{
			raise_message(2);
			mactrack_debug("ERROR: Cacti Device: ($device_id/$host_id): $hostname, error on save: " . serialize($save));
		}
	} else {
		mactrack_debug("ERROR: Cacti Device: ($device_id/$host_id): $hostname, error on verify: " . serialize($save));
	}

	return $device_id;
}
开发者ID:avillaverdec,项目名称:cacti,代码行数:54,代码来源:mactrack_actions.php

示例14: form_save

function form_save()
{
    if (isset($_POST["save_component_item"])) {
        global $graph_item_types;
        $items[0] = array();
        if ($graph_item_types[$_POST["graph_type_id"]] == "LEGEND") {
            /* this can be a major time saver when creating lots of graphs with the typical
            			GPRINT LAST/AVERAGE/MAX legends */
            $items = array(0 => array("color_id" => "0", "graph_type_id" => "9", "consolidation_function_id" => "4", "text_format" => "Current:", "hard_return" => ""), 1 => array("color_id" => "0", "graph_type_id" => "9", "consolidation_function_id" => "1", "text_format" => "Average:", "hard_return" => ""), 2 => array("color_id" => "0", "graph_type_id" => "9", "consolidation_function_id" => "3", "text_format" => "Maximum:", "hard_return" => "on"));
        }
        foreach ($items as $item) {
            /* generate a new sequence if needed */
            if (empty($_POST["sequence"])) {
                $_POST["sequence"] = get_sequence($_POST["sequence"], "sequence", "graph_templates_item", "local_graph_id=" . $_POST["local_graph_id"]);
            }
            $save["id"] = $_POST["graph_template_item_id"];
            $save["graph_template_id"] = $_POST["graph_template_id"];
            $save["local_graph_template_item_id"] = $_POST["local_graph_template_item_id"];
            $save["local_graph_id"] = $_POST["local_graph_id"];
            $save["task_item_id"] = form_input_validate($_POST["task_item_id"], "task_item_id", "", true, 3);
            $save["color_id"] = form_input_validate(isset($item["color_id"]) ? $item["color_id"] : $_POST["color_id"], "color_id", "", true, 3);
            $save["graph_type_id"] = form_input_validate(isset($item["graph_type_id"]) ? $item["graph_type_id"] : $_POST["graph_type_id"], "graph_type_id", "", true, 3);
            $save["cdef_id"] = form_input_validate($_POST["cdef_id"], "cdef_id", "", true, 3);
            $save["consolidation_function_id"] = form_input_validate(isset($item["consolidation_function_id"]) ? $item["consolidation_function_id"] : $_POST["consolidation_function_id"], "consolidation_function_id", "", true, 3);
            $save["text_format"] = form_input_validate(isset($item["text_format"]) ? $item["text_format"] : $_POST["text_format"], "text_format", "", true, 3);
            $save["value"] = form_input_validate($_POST["value"], "value", "", true, 3);
            $save["hard_return"] = form_input_validate(isset($item["hard_return"]) ? $item["hard_return"] : (isset($_POST["hard_return"]) ? $_POST["hard_return"] : ""), "hard_return", "", true, 3);
            $save["gprint_id"] = form_input_validate($_POST["gprint_id"], "gprint_id", "", true, 3);
            $save["sequence"] = $_POST["sequence"];
            if (!is_error_message()) {
                $graph_template_item_id = sql_save($save, "graph_templates_item");
                if ($graph_template_item_id) {
                    raise_message(1);
                } else {
                    raise_message(2);
                }
            }
            $_POST["sequence"] = 0;
        }
        if (is_error_message()) {
            header("Location: graphs.php?action=item_edit&graph_template_item_id=" . (empty($graph_template_item_id) ? $_POST["graph_template_item_id"] : $graph_template_item_id) . "&id=" . $_POST["local_graph_id"]);
            exit;
        } else {
            header("Location: graphs.php?action=graph_edit&id=" . $_POST["local_graph_id"]);
            exit;
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:odp-svn,代码行数:48,代码来源:graphs_items.php

示例15: form_save

function form_save()
{
    if (isset_request_var('save_component')) {
        $save['id'] = get_filter_request_var('id');
        $save['name'] = form_input_validate(get_nfilter_request_var('name'), 'name', '', false, 3);
        $save['description'] = form_input_validate(get_nfilter_request_var('description'), 'description', '', false, 3);
        $save['emails'] = form_input_validate(get_nfilter_request_var('emails'), 'emails', '', false, 3);
        if (!is_error_message()) {
            $id = sql_save($save, 'plugin_notification_lists');
            if ($id) {
                raise_message(1);
            } else {
                raise_message(2);
            }
        }
    }
    header('Location: notify_lists.php?header=false&action=edit&id=' . (empty($id) ? get_request_var('id') : $id));
}
开发者ID:Cacti,项目名称:plugin_thold,代码行数:18,代码来源:notify_lists.php


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