• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP generate_data_source_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_data_source_path

function get_data_source_path($local_data_id, $expand_paths) {
	global $config;

	    if (empty($local_data_id)) { return ""; }

	    $data_source = db_fetch_row("select name,data_source_path from data_template_data where local_data_id=$local_data_id");

	if (sizeof($data_source) > 0) {
		if (empty($data_source["data_source_path"])) {
			/* no custom path was specified */
			$data_source_path = generate_data_source_path($local_data_id);
		}else{
			if (!strstr($data_source["data_source_path"], "/")) {
				$data_source_path = "<path_rra>/" . $data_source["data_source_path"];
			}else{
				$data_source_path = $data_source["data_source_path"];
			}
		}

		/* whether to show the "actual" path or the <path_rra> variable name (for edit boxes) */
		if ($expand_paths == true) {
			$data_source_path = str_replace("<path_rra>", $config["base_path"] . "/rra", $data_source_path);
		}

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


示例2: form_save


//.........这里部分代码省略.........
        $save1["host_id"] = $_POST["host_id"];
        $save2["id"] = $_POST["data_template_data_id"];
        $save2["local_data_template_data_id"] = $_POST["local_data_template_data_id"];
        $save2["data_template_id"] = $_POST["data_template_id"];
        $save2["data_input_id"] = form_input_validate($_POST["data_input_id"], "data_input_id", "", true, 3);
        $save2["name"] = form_input_validate($_POST["name"], "name", "", false, 3);
        $save2["data_source_path"] = form_input_validate($_POST["data_source_path"], "data_source_path", "", true, 3);
        $save2["active"] = form_input_validate(isset($_POST["active"]) ? $_POST["active"] : "", "active", "", true, 3);
        $save2["rrd_step"] = form_input_validate($_POST["rrd_step"], "rrd_step", "^[0-9]+\$", false, 3);
        if (!is_error_message()) {
            $local_data_id = sql_save($save1, "data_local");
            $save2["local_data_id"] = $local_data_id;
            $data_template_data_id = sql_save($save2, "data_template_data");
            if ($data_template_data_id) {
                raise_message(1);
            } else {
                raise_message(2);
            }
        }
        if (!is_error_message()) {
            /* if this is a new data source and a template has been selected, skip item creation this time
            			otherwise it throws off the templatate creation because of the NULL data */
            if (!empty($_POST["local_data_id"]) || empty($_POST["data_template_id"])) {
                /* if no template was set before the save, there will be only one data source item to save;
                			otherwise there might be >1 */
                if (empty($_POST["_data_template_id"])) {
                    $rrds[0]["id"] = $_POST["current_rrd"];
                } else {
                    $rrds = db_fetch_assoc("select id from data_template_rrd where local_data_id=" . $_POST["local_data_id"]);
                }
                if (sizeof($rrds) > 0) {
                    foreach ($rrds as $rrd) {
                        if (empty($_POST["_data_template_id"])) {
                            $name_modifier = "";
                        } else {
                            $name_modifier = "_" . $rrd["id"];
                        }
                        $save3["id"] = $rrd["id"];
                        $save3["local_data_id"] = $local_data_id;
                        $save3["local_data_template_rrd_id"] = db_fetch_cell("select local_data_template_rrd_id from data_template_rrd where id=" . $rrd["id"]);
                        $save3["data_template_id"] = $_POST["data_template_id"];
                        $save3["rrd_maximum"] = form_input_validate($_POST["rrd_maximum{$name_modifier}"], "rrd_maximum{$name_modifier}", "^-?[0-9]+\$", false, 3);
                        $save3["rrd_minimum"] = form_input_validate($_POST["rrd_minimum{$name_modifier}"], "rrd_minimum{$name_modifier}", "^-?[0-9]+\$", false, 3);
                        $save3["rrd_heartbeat"] = form_input_validate($_POST["rrd_heartbeat{$name_modifier}"], "rrd_heartbeat{$name_modifier}", "^[0-9]+\$", false, 3);
                        $save3["data_source_type_id"] = $_POST["data_source_type_id{$name_modifier}"];
                        $save3["data_source_name"] = form_input_validate($_POST["data_source_name{$name_modifier}"], "data_source_name{$name_modifier}", "^[a-zA-Z0-9_-]{1,19}\$", false, 3);
                        $save3["data_input_field_id"] = form_input_validate(isset($_POST["data_input_field_id{$name_modifier}"]) ? $_POST["data_input_field_id{$name_modifier}"] : "0", "data_input_field_id{$name_modifier}", "", true, 3);
                        $data_template_rrd_id = sql_save($save3, "data_template_rrd");
                        if ($data_template_rrd_id) {
                            raise_message(1);
                        } else {
                            raise_message(2);
                        }
                    }
                }
            }
        }
        if (!is_error_message()) {
            if (!empty($_POST["rra_id"])) {
                /* save entries in 'selected rras' field */
                db_execute("delete from data_template_data_rra where data_template_data_id={$data_template_data_id}");
                for ($i = 0; $i < count($_POST["rra_id"]); $i++) {
                    /* ================= input validation ================= */
                    input_validate_input_number($_POST["rra_id"][$i]);
                    /* ==================================================== */
                    db_execute("insert into data_template_data_rra (rra_id,data_template_data_id)\n\t\t\t\t\t\tvalues (" . $_POST["rra_id"][$i] . ",{$data_template_data_id})");
                }
            }
            if ($_POST["data_template_id"] != $_POST["_data_template_id"]) {
                /* update all necessary template information */
                change_data_template($local_data_id, $_POST["data_template_id"]);
            } elseif (!empty($_POST["data_template_id"])) {
                update_data_source_data_query_cache($local_data_id);
            }
            if ($_POST["host_id"] != $_POST["_host_id"]) {
                /* push out all necessary host information */
                push_out_host($_POST["host_id"], $local_data_id);
                /* reset current host for display purposes */
                $_SESSION["sess_data_source_current_host_id"] = $_POST["host_id"];
            }
            /* if no data source path has been entered, generate one */
            if (empty($_POST["data_source_path"])) {
                generate_data_source_path($local_data_id);
            }
            /* update the title cache */
            update_data_source_title_cache($local_data_id);
        }
    }
    /* update the poller cache last to make sure everything is fresh */
    if (!is_error_message() && !empty($local_data_id)) {
        update_poller_cache($local_data_id, false);
    }
    if (isset($_POST["save_component_data_source_new"]) && empty($_POST["data_template_id"])) {
        header("Location: data_sources.php?action=ds_edit&host_id=" . $_POST["host_id"] . "&new=1");
    } elseif (is_error_message() || $_POST["data_template_id"] != $_POST["_data_template_id"] || $_POST["data_input_id"] != $_POST["_data_input_id"] || $_POST["host_id"] != $_POST["_host_id"]) {
        header("Location: data_sources.php?action=ds_edit&id=" . (empty($local_data_id) ? $_POST["local_data_id"] : $local_data_id) . "&host_id=" . $_POST["host_id"] . "&view_rrd=" . (isset($_POST["current_rrd"]) ? $_POST["current_rrd"] : "0"));
    } else {
        header("Location: data_sources.php");
    }
}
开发者ID:BackupTheBerlios,项目名称:odp-svn,代码行数:101,代码来源:data_sources.php


示例3: get_data_source_path

function get_data_source_path($local_data_id, $expand_paths)
{
    global $config;
    if (empty($local_data_id)) {
        return '';
    }
    $data_source = db_fetch_row_prepared('SELECT name, data_source_path FROM data_template_data WHERE local_data_id = ?', array($local_data_id));
    if (sizeof($data_source) > 0) {
        if (empty($data_source['data_source_path'])) {
            /* no custom path was specified */
            $data_source_path = generate_data_source_path($local_data_id);
        } else {
            if (!strstr($data_source['data_source_path'], '/')) {
                $data_source_path = '<path_rra>/' . $data_source['data_source_path'];
            } else {
                $data_source_path = $data_source['data_source_path'];
            }
        }
        /* whether to show the "actual" path or the <path_rra> variable name (for edit boxes) */
        if ($expand_paths == true) {
            $data_source_path = str_replace('<path_rra>', $config['rra_path'], $data_source_path);
        }
        return $data_source_path;
    }
}
开发者ID:MrWnn,项目名称:cacti,代码行数:25,代码来源:functions.php


示例4: data_source_form_save


//.........这里部分代码省略.........
			}
		}

#		if (!is_error_message()) {
#			/* if this is a new data source and a template has been selected, skip item creation this time
#			otherwise it throws off the templatate creation because of the NULL data */
#			if ((!empty($_POST["local_data_id"])) || (empty($_POST["data_template_id"]))) {
#				/* if no template was set before the save, there will be only one data source item to save;
#				otherwise there might be >1 */
#				if (empty($_POST["hidden_data_template_id"])) {
#					$rrds[0]["id"] = $_POST["current_rrd"];
#				}else{
#					$rrds = db_fetch_assoc("select id from data_template_rrd where local_data_id=" . $_POST["local_data_id"]);
#				}
#
#				if (sizeof($rrds) > 0) {
#				foreach ($rrds as $rrd) {
#					if (empty($_POST["hidden_data_template_id"])) {
#						$name_modifier = "";
#					}else{
#						$name_modifier = "_" . $rrd["id"];
#					}
#
#					$save3["id"] = $rrd["id"];
#					$save3["local_data_id"] = $local_data_id;
#					$save3["local_data_template_rrd_id"] = db_fetch_cell("select local_data_template_rrd_id from data_template_rrd where id=" . $rrd["id"]);
#					$save3["data_template_id"] = $_POST["data_template_id"];
#					$save3["rrd_maximum"] = form_input_validate($_POST["rrd_maximum$name_modifier"], "rrd_maximum$name_modifier", "^(-?([0-9]+(\.[0-9]*)?|[0-9]*\.[0-9]+)([eE][+\-]?[0-9]+)?)|U$", false, 3);
#					$save3["rrd_minimum"] = form_input_validate($_POST["rrd_minimum$name_modifier"], "rrd_minimum$name_modifier", "^(-?([0-9]+(\.[0-9]*)?|[0-9]*\.[0-9]+)([eE][+\-]?[0-9]+)?)|U$", false, 3);
#					$save3["rrd_heartbeat"] = form_input_validate($_POST["rrd_heartbeat$name_modifier"], "rrd_heartbeat$name_modifier", "^[0-9]+$", false, 3);
#					$save3["data_source_type_id"] = $_POST["data_source_type_id$name_modifier"];
#					$save3["data_source_name"] = form_input_validate($_POST["data_source_name$name_modifier"], "data_source_name$name_modifier", "^[a-zA-Z0-9_-]{1,19}$", false, 3);
#					$save3["data_input_field_id"] = form_input_validate((isset($_POST["data_input_field_id$name_modifier"]) ? $_POST["data_input_field_id$name_modifier"] : "0"), "data_input_field_id$name_modifier", "", true, 3);
#
#					$data_template_rrd_id = sql_save($save3, "data_template_rrd");
#
#					if ($data_template_rrd_id) {
#						raise_message(1);
#					}else{
#						raise_message(2);
#					}
#				}
#				}
#			}
#		}

		if (!is_error_message()) {
			if (!empty($_POST["rra_id"])) {
				/* save entries in 'selected rras' field */
				db_execute("delete from data_template_data_rra where data_template_data_id=$data_template_data_id");

				for ($i=0; ($i < count($_POST["rra_id"])); $i++) {
					/* ================= input validation ================= */
					input_validate_input_number($_POST["rra_id"][$i]);
					/* ==================================================== */

					db_execute("insert into data_template_data_rra (rra_id,data_template_data_id)
						values (" . $_POST["rra_id"][$i] . ",$data_template_data_id)");
				}
			}

			if ($_POST["data_template_id"] != $_POST["hidden_data_template_id"]) {
				/* update all necessary template information */
				change_data_template($local_data_id, get_request_var_post("data_template_id"));
			}elseif (!empty($_POST["data_template_id"])) {
				update_data_source_data_query_cache($local_data_id);
			}

			if ($_POST["device_id"] != $_POST["hidden_device_id"]) {
				/* push out all necessary device information */
				push_out_device(get_request_var_post("device_id"), $local_data_id);

				/* reset current device for display purposes */
				$_SESSION["sess_data_source_currenthidden_device_id"] = $_POST["device_id"];
			}

			/* if no data source path has been entered, generate one */
			if (empty($_POST["data_source_path"])) {
				generate_data_source_path($local_data_id);
			}

			/* update the title cache */
			update_data_source_title_cache($local_data_id);
		}
	}

	/* update the poller cache last to make sure everything is fresh */
	if ((!is_error_message()) && (!empty($local_data_id))) {
		update_poller_cache($local_data_id, true);
	}

	if ((isset($_POST["save_component_data_source_new"])) && (empty($_POST["data_template_id"]))) {
		header("Location: data_sources.php?action=data_source_edit&device_id=" . $_POST["device_id"] . "&new=1");
	}elseif ((is_error_message()) || ($_POST["data_template_id"] != $_POST["hidden_data_template_id"]) || ($_POST["data_input_id"] != $_POST["hidden_data_input_id"]) || ($_POST["device_id"] != $_POST["hidden_device_id"])) {
		header("Location: data_sources.php?action=data_source_edit&id=" . (empty($local_data_id) ? $_POST["local_data_id"] : $local_data_id) . "&device_id=" . $_POST["device_id"] . "&view_rrd=" . (isset($_POST["current_rrd"]) ? $_POST["current_rrd"] : "0"));
	}else{
		header("Location: data_sources.php");
	}
	exit;
}
开发者ID:songchin,项目名称:Cacti,代码行数:101,代码来源:data_source_form.php


示例5: form_save


//.........这里部分代码省略.........
        $save2['id'] = $_POST['data_template_data_id'];
        $save2['local_data_template_data_id'] = $_POST['local_data_template_data_id'];
        $save2['data_template_id'] = $_POST['data_template_id'];
        $save2['data_input_id'] = form_input_validate($_POST['data_input_id'], 'data_input_id', '', true, 3);
        $save2['name'] = form_input_validate($_POST['name'], 'name', '', false, 3);
        $save2['data_source_path'] = form_input_validate($_POST['data_source_path'], 'data_source_path', '', true, 3);
        $save2['active'] = form_input_validate(isset($_POST['active']) ? $_POST['active'] : '', 'active', '', true, 3);
        $save2['rrd_step'] = form_input_validate($_POST['rrd_step'], 'rrd_step', '^[0-9]+$', false, 3);
        if (!is_error_message()) {
            $local_data_id = sql_save($save1, 'data_local');
            $save2['local_data_id'] = $local_data_id;
            $data_template_data_id = sql_save($save2, 'data_template_data');
            if ($data_template_data_id) {
                raise_message(1);
            } else {
                raise_message(2);
            }
        }
        if (!is_error_message()) {
            /* if this is a new data source and a template has been selected, skip item creation this time
            			otherwise it throws off the templatate creation because of the NULL data */
            if (!empty($_POST['local_data_id']) || empty($_POST['data_template_id'])) {
                /* if no template was set before the save, there will be only one data source item to save;
                			otherwise there might be >1 */
                if (empty($_POST['_data_template_id'])) {
                    $rrds[0]['id'] = $_POST['current_rrd'];
                } else {
                    $rrds = db_fetch_assoc_prepared('SELECT id FROM data_template_rrd WHERE local_data_id = ?', array($_POST['local_data_id']));
                }
                if (sizeof($rrds) > 0) {
                    foreach ($rrds as $rrd) {
                        if (empty($_POST['_data_template_id'])) {
                            $name_modifier = '';
                        } else {
                            $name_modifier = '_' . $rrd['id'];
                        }
                        $save3['id'] = $rrd['id'];
                        $save3['local_data_id'] = $local_data_id;
                        $save3['local_data_template_rrd_id'] = db_fetch_cell_prepared('SELECT local_data_template_rrd_id FROM data_template_rrd WHERE id = ?', array($rrd['id']));
                        $save3['data_template_id'] = $_POST['data_template_id'];
                        $save3['rrd_maximum'] = form_input_validate($_POST["rrd_maximum{$name_modifier}"], "rrd_maximum{$name_modifier}", "^(-?([0-9]+(\\.[0-9]*)?|[0-9]*\\.[0-9]+)([eE][+\\-]?[0-9]+)?)|U\$", false, 3);
                        $save3['rrd_minimum'] = form_input_validate($_POST["rrd_minimum{$name_modifier}"], "rrd_minimum{$name_modifier}", "^(-?([0-9]+(\\.[0-9]*)?|[0-9]*\\.[0-9]+)([eE][+\\-]?[0-9]+)?)|U\$", false, 3);
                        $save3['rrd_heartbeat'] = form_input_validate($_POST["rrd_heartbeat{$name_modifier}"], "rrd_heartbeat{$name_modifier}", '^[0-9]+$', false, 3);
                        $save3['data_source_type_id'] = $_POST["data_source_type_id{$name_modifier}"];
                        $save3['data_source_name'] = form_input_validate($_POST["data_source_name{$name_modifier}"], "data_source_name{$name_modifier}", '^[a-zA-Z0-9_-]{1,19}$', false, 3);
                        $save3['data_input_field_id'] = form_input_validate(isset($_POST["data_input_field_id{$name_modifier}"]) ? $_POST["data_input_field_id{$name_modifier}"] : '0', "data_input_field_id{$name_modifier}", '', true, 3);
                        $data_template_rrd_id = sql_save($save3, 'data_template_rrd');
                        if ($data_template_rrd_id) {
                            raise_message(1);
                        } else {
                            raise_message(2);
                        }
                    }
                }
            }
        }
        if (!is_error_message()) {
            if (!empty($_POST['rra_id'])) {
                /* save entries in 'selected rras' field */
                db_execute_prepared('DELETE FROM data_template_data_rra WHERE data_template_data_id = ?', array($data_template_data_id));
                for ($i = 0; $i < count($_POST['rra_id']); $i++) {
                    /* ================= input validation ================= */
                    input_validate_input_number($_POST['rra_id'][$i]);
                    /* ==================================================== */
                    db_execute_prepared('INSERT INTO data_template_data_rra (rra_id, data_template_data_id)
						VALUES (?, ?)', array($_POST['rra_id'][$i], $data_template_data_id));
                }
            }
            if ($_POST['data_template_id'] != $_POST['_data_template_id']) {
                /* update all necessary template information */
                change_data_template($local_data_id, $_POST['data_template_id']);
            } elseif (!empty($_POST['data_template_id'])) {
                update_data_source_data_query_cache($local_data_id);
            }
            if ($_POST['host_id'] != $_POST['_host_id']) {
                /* push out all necessary host information */
                push_out_host($_POST['host_id'], $local_data_id);
                /* reset current host for display purposes */
                $_SESSION['sess_data_source_current_host_id'] = $_POST['host_id'];
            }
            /* if no data source path has been entered, generate one */
            if (empty($_POST['data_source_path'])) {
                generate_data_source_path($local_data_id);
            }
            /* update the title cache */
            update_data_source_title_cache($local_data_id);
        }
    }
    /* update the poller cache last to make sure everything is fresh */
    if (!is_error_message() && !empty($local_data_id)) {
        update_poller_cache($local_data_id, true);
    }
    if (isset($_POST['save_component_data_source_new']) && empty($_POST['data_template_id'])) {
        header('Location: data_sources.php?action=ds_edit&host_id=' . $_POST['host_id'] . '&new=1');
    } elseif (is_error_message() || $_POST['data_template_id'] != $_POST['_data_template_id'] || $_POST['data_input_id'] != $_POST['_data_input_id'] || $_POST['host_id'] != $_POST['_host_id']) {
        header('Location: data_sources.php?action=ds_edit&id=' . (empty($local_data_id) ? $_POST['local_data_id'] : $local_data_id) . '&host_id=' . $_POST['host_id'] . '&view_rrd=' . (isset($_POST['current_rrd']) ? $_POST['current_rrd'] : '0'));
    } else {
        header('Location: data_sources.php');
    }
}
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:data_sources.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP generate_device_link函数代码示例发布时间:2022-05-15
下一篇:
PHP generate_csrf_token函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap