本文整理汇总了PHP中mergecnf函数的典型用法代码示例。如果您正苦于以下问题:PHP mergecnf函数的具体用法?PHP mergecnf怎么用?PHP mergecnf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mergecnf函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mergecnf
/**
* Merge config function
* @author f0o <f0o@devilcode.org>
* @copyright 2015 f0o, LibreNMS
* @license GPL
* @package LibreNMS
* @subpackage Config
*/
function mergecnf($obj)
{
$pointer = array();
$val = $obj['config_value'];
$obj = $obj['config_name'];
$obj = explode('.', $obj, 2);
if (!isset($obj[1])) {
if (filter_var($val, FILTER_VALIDATE_INT)) {
$val = (int) $val;
} else {
if (filter_var($val, FILTER_VALIDATE_FLOAT)) {
$val = (double) $val;
} else {
if (filter_var($val, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) !== null) {
$val = filter_var($val, FILTER_VALIDATE_BOOLEAN);
}
}
}
if (!empty($obj[0])) {
return array($obj[0] => $val);
} else {
return array($val);
}
} else {
$pointer[$obj[0]] = mergecnf(array('config_name' => $obj[1], 'config_value' => $val));
}
return $pointer;
}
示例2: mysql_pconnect
<?php
// Observium Includes
require_once $config['install_dir'] . '/includes/dbFacile.php';
require_once $config['install_dir'] . '/includes/mergecnf.inc.php';
// Connect to database
$database_link = mysql_pconnect($config['db_host'], $config['db_user'], $config['db_pass']);
if (!$database_link) {
echo '<h2>MySQL Error</h2>';
echo mysql_error();
die;
}
$database_db = mysql_select_db($config['db_name'], $database_link);
$clone = $config;
foreach (dbFetchRows('select config_name,config_value from config') as $obj) {
$clone = array_replace_recursive($clone, mergecnf($obj));
}
$config = array_replace_recursive($clone, $config);
//
// NO CHANGES TO THIS FILE, IT IS NOT USER-EDITABLE #
//
// YES, THAT MEANS YOU #
//
umask(02);
$config['os']['default']['over'][0]['graph'] = 'device_processor';
$config['os']['default']['over'][0]['text'] = 'Processor Usage';
$config['os']['default']['over'][1]['graph'] = 'device_mempool';
$config['os']['default']['over'][1]['text'] = 'Memory Usage';
$os_group = 'unix';
$config['os_group'][$os_group]['type'] = 'server';
$config['os_group'][$os_group]['processor_stacked'] = 1;