本文整理汇总了PHP中update_if_changed函数的典型用法代码示例。如果您正苦于以下问题:PHP update_if_changed函数的具体用法?PHP update_if_changed怎么用?PHP update_if_changed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_if_changed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if (!$input_errors) {
$poolent = array();
if (isset($id) && $a_pool[$id]) {
$poolent = $a_pool[$id];
}
if ($poolent['name'] != "") {
$changedesc .= sprintf(gettext(" modified '%s' pool:"), $poolent['name']);
}
update_if_changed("name", $poolent['name'], $_POST['name']);
update_if_changed("mode", $poolent['mode'], $_POST['mode']);
update_if_changed("description", $poolent['descr'], $_POST['descr']);
update_if_changed("port", $poolent['port'], $_POST['port']);
update_if_changed("retry", $poolent['retry'], $_POST['retry']);
update_if_changed("servers", $poolent['servers'], $_POST['servers']);
update_if_changed("serversdisabled", $poolent['serversdisabled'], $_POST['serversdisabled']);
update_if_changed("monitor", $poolent['monitor'], $_POST['monitor']);
if (isset($id) && $a_pool[$id]) {
/* modify all virtual servers with this name */
for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) {
if ($config['load_balancer']['virtual_server'][$i]['lbpool'] == $a_pool[$id]['name']) {
$config['load_balancer']['virtual_server'][$i]['lbpool'] = $poolent['name'];
}
}
$a_pool[$id] = $poolent;
} else {
$a_pool[] = $poolent;
}
if ($changecount > 0) {
/* Mark pool dirty */
mark_subsystem_dirty('loadbalancer');
write_config($changedesc);
示例2: gettext
$input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
}
}
if (!$input_errors) {
update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']);
update_if_changed("domain", $config['system']['domain'], $_POST['domain']);
update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']);
update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
update_if_changed("NTP update interval", $config['system']['time-update-interval'], $_POST['timeupdateinterval']);
if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
$config['system']['language'] = $_POST['language'];
set_language($config['system']['language']);
}
/* pfSense themes */
if (!$g['disablethemeselection']) {
update_if_changed("System Theme", $config['theme'], $_POST['theme']);
}
/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
$olddnsservers = $config['system']['dnsserver'];
unset($config['system']['dnsserver']);
if ($_POST['dns1']) {
$config['system']['dnsserver'][] = $_POST['dns1'];
}
if ($_POST['dns2']) {
$config['system']['dnsserver'][] = $_POST['dns2'];
}
if ($_POST['dns3']) {
$config['system']['dnsserver'][] = $_POST['dns3'];
}
if ($_POST['dns4']) {
$config['system']['dnsserver'][] = $_POST['dns4'];
示例3: explode
if ($pconfig['mode'] != "p2p_shared_key") {
$reqdfields = explode(" ", "caref");
$reqdfieldsn = array(gettext("Certificate Authority"));
} elseif (!$pconfig['autokey_enable']) {
/* We only need the shared key filled in if we are in shared key mode and autokey is not selected. */
$reqdfields = array('shared_key');
$reqdfieldsn = array(gettext('Shared key'));
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
if ($pconfig['mode'] != "p2p_shared_key" && empty($pconfig['certref']) && empty($pconfig['auth_user']) && empty($pconfig['auth_pass'])) {
$input_errors[] = gettext("If no Client Certificate is selected, a username and/or password must be entered.");
}
if (!$input_errors) {
$client = array();
foreach ($simplefields as $stat) {
update_if_changed($stat, $client[$stat], $_POST[$stat]);
}
if ($vpnid) {
$client['vpnid'] = $vpnid;
} else {
$client['vpnid'] = openvpn_vpnid_next();
}
if ($_POST['disable'] == "yes") {
$client['disable'] = true;
}
$client['protocol'] = $pconfig['protocol'];
$client['dev_mode'] = $pconfig['dev_mode'];
list($client['interface'], $client['ipaddr']) = explode("|", $pconfig['interface']);
$client['local_port'] = $pconfig['local_port'];
$client['server_addr'] = $pconfig['server_addr'];
$client['server_port'] = $pconfig['server_port'];
示例4: sprintf
if (isset($id) && $a_vs[$id]) {
$vsent = $a_vs[$id];
}
if ($vsent['name'] != "") {
$changedesc .= " " . sprintf(gettext("modified '%s' vs:"), $vsent['name']);
} else {
$changedesc .= " " . sprintf(gettext("created '%s' vs:"), $_POST['name']);
}
update_if_changed("name", $vsent['name'], $_POST['name']);
update_if_changed("descr", $vsent['descr'], $_POST['descr']);
update_if_changed("poolname", $vsent['poolname'], $_POST['poolname']);
update_if_changed("port", $vsent['port'], $_POST['port']);
update_if_changed("sitedown", $vsent['sitedown'], $_POST['sitedown']);
update_if_changed("ipaddr", $vsent['ipaddr'], $_POST['ipaddr']);
update_if_changed("mode", $vsent['mode'], $_POST['mode']);
update_if_changed("relay protocol", $vsent['relay_protocol'], $_POST['relay_protocol']);
if ($_POST['sitedown'] == "") {
unset($vsent['sitedown']);
}
if (isset($id) && $a_vs[$id]) {
if ($a_vs[$id]['name'] != $_POST['name']) {
/* Because the VS name changed, mark the old name for cleanup. */
cleanup_lb_mark_anchor($a_vs[$id]['name']);
}
$a_vs[$id] = $vsent;
} else {
$a_vs[] = $vsent;
}
if ($changecount > 0) {
/* Mark virtual server dirty */
mark_subsystem_dirty('loadbalancer');
示例5: gettext
$input_errors[] = gettext("The time update interval must be either 0 (disabled) or between 6 and 1440.");
}
# it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
$_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']);
$_POST['timeservers'] = trim($_POST['timeservers']);
foreach (explode(' ', $_POST['timeservers']) as $ts) {
if (!is_domain($ts)) {
$input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
}
}
if (!$input_errors) {
update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']);
update_if_changed("domain", $config['system']['domain'], $_POST['domain']);
update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']);
update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
update_if_changed("NTP update interval", $config['system']['time-update-interval'], $_POST['timeupdateinterval']);
if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
$config['system']['language'] = $_POST['language'];
set_language($config['system']['language']);
}
/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
$olddnsservers = $config['system']['dnsserver'];
unset($config['system']['dnsserver']);
if ($_POST['dns1']) {
$config['system']['dnsserver'][] = $_POST['dns1'];
}
if ($_POST['dns2']) {
$config['system']['dnsserver'][] = $_POST['dns2'];
}
if ($_POST['dns3']) {
$config['system']['dnsserver'][] = $_POST['dns3'];
示例6: update_if_changed
}
}
}
}
}
if ($pool['name'] != "") {
$changedesc .= " modified pool: '{$pool['name']}'";
}
$pool['ha_servers']['item'] = $a_servers;
$pool['a_acl']['item'] = $pconfig['a_acl'];
$pool['a_actionitems']['item'] = $pconfig['a_actionitems'];
update_if_changed("advanced", $pool['advanced'], base64_encode($_POST['advanced']));
update_if_changed("advanced_backend", $pool['advanced_backend'], base64_encode($_POST['advanced_backend']));
global $simplefields;
foreach ($simplefields as $stat) {
update_if_changed($stat, $pool[$stat], $_POST[$stat]);
}
if (isset($id) && $a_pools[$id]) {
$a_pools[$id] = $pool;
} else {
$a_pools[] = $pool;
}
if (!isset($input_errors)) {
if ($changecount > 0) {
touch($d_haproxyconfdirty_path);
write_config($changedesc);
}
header("Location: haproxy_pools.php");
exit;
}
}
示例7: update_if_changed
update_if_changed("type", $monent['type'], $pconfig['type']);
update_if_changed("description", $monent['descr'], $pconfig['descr']);
if ($pconfig['type'] == "http" || $pconfig['type'] == "https") {
/* log updates, then clear array and reassign - dumb, but easiest way to have a clear array */
update_if_changed("path", $monent['options']['path'], $pconfig['options']['path']);
update_if_changed("host", $monent['options']['host'], $pconfig['options']['host']);
update_if_changed("code", $monent['options']['code'], $pconfig['options']['code']);
$monent['options'] = array();
$monent['options']['path'] = $pconfig['options']['path'];
$monent['options']['host'] = $pconfig['options']['host'];
$monent['options']['code'] = $pconfig['options']['code'];
}
if ($pconfig['type'] == "send") {
/* log updates, then clear array and reassign - dumb, but easiest way to have a clear array */
update_if_changed("send", $monent['options']['send'], $pconfig['options']['send']);
update_if_changed("expect", $monent['options']['expect'], $pconfig['options']['expect']);
$monent['options'] = array();
$monent['options']['send'] = $pconfig['options']['send'];
$monent['options']['expect'] = $pconfig['options']['expect'];
}
if ($pconfig['type'] == "tcp" || $pconfig['type'] == "icmp") {
$monent['options'] = array();
}
if (isset($id) && $a_monitor[$id]) {
/* modify all pools with this name */
for ($i = 0; isset($config['load_balancer']['lbpool'][$i]); $i++) {
if ($config['load_balancer']['lbpool'][$i]['monitor'] == $a_monitor[$id]['name']) {
$config['load_balancer']['lbpool'][$i]['monitor'] = $monent['name'];
}
}
$a_monitor[$id] = $monent;
示例8: system_start_ftp_helpers
/* per interface pftpx helper */
if ($_POST['disableftpproxy'] == "yes") {
$lancfg['disableftpproxy'] = true;
system_start_ftp_helpers();
} else {
system_start_ftp_helpers();
}
$bridge = discover_bridge($lancfg['if'], filter_translate_type_to_real_interface($lancfg['bridge']));
if ($bridge != "-1") {
destroy_bridge($bridge);
setup_bridge();
}
$lancfg['bridge'] = $_POST['bridge'];
if ($lancfg['ipaddr'] != $_POST['ipaddr'] || $lancfg['subnet'] != $_POST['subnet']) {
update_if_changed("IP Address", &$lancfg['ipaddr'], $_POST['ipaddr']);
update_if_changed("subnet", &$lancfg['subnet'], $_POST['subnet']);
}
write_config($changedesc);
touch($d_landirty_path);
/* restart snmp so that it binds to correct address */
services_snmpd_configure();
if ($_POST['apply'] != "") {
unlink($d_landirty_path);
$savemsg = "Değişiklikler uygulandı. İnternet gezgininizde yeni IP adresini yazmanız gerekebilir.";
}
}
}
$pgtitle = "Ağ aygıtları: LAN";
include "head.inc";
?>
示例9: update_if_changed
$a_backend =& $config['installedpackages']['haproxy']['ha_backends']['item'];
for ($i = 0; $i < count($a_backend); $i++) {
if ($a_backend[$i]['pool'] == $pool['name']) {
$a_backend[$i]['pool'] = $_POST['name'];
}
}
}
if ($pool['name'] != "") {
$changedesc .= " modified '{$pool['name']}' pool:";
}
$pool['ha_servers']['item'] = $a_servers;
update_if_changed("name", $pool['name'], $_POST['name']);
update_if_changed("cookie", $pool['cookie'], $_POST['cookie']);
update_if_changed("advanced", $pool['advanced'], base64_encode($_POST['advanced']));
update_if_changed("checkinter", $pool['checkinter'], $_POST['checkinter']);
update_if_changed("monitor_uri", $pool['monitor_uri'], $_POST['monitor_uri']);
if (isset($id) && $a_pools[$id]) {
$a_pools[$id] = $pool;
} else {
$a_pools[] = $pool;
}
if ($changecount > 0) {
touch($d_haproxyconfdirty_path);
write_config($changedesc);
/*
echo "<PRE>";
print_r($config);
echo "</PRE>";
*/
}
header("Location: haproxy_pools.php");
示例10: gettext
}
if ($_POST['sshport']) {
if (!is_port($_POST['sshport'])) {
$input_errors[] = gettext("You must specify a valid port number");
}
}
ob_flush();
flush();
if (!$input_errors) {
if (update_if_changed("webgui protocol", $config['system']['webgui']['protocol'], $_POST['webguiproto'])) {
$restart_webgui = true;
}
if (update_if_changed("webgui port", $config['system']['webgui']['port'], $_POST['webguiport'])) {
$restart_webgui = true;
}
if (update_if_changed("webgui certificate", $config['system']['webgui']['ssl-certref'], $_POST['ssl-certref'])) {
$restart_webgui = true;
}
if ($_POST['disablehttpredirect'] == "yes") {
$config['system']['webgui']['disablehttpredirect'] = true;
$restart_webgui = true;
} else {
unset($config['system']['webgui']['disablehttpredirect']);
$restart_webgui = true;
}
if ($_POST['quietlogin'] == "yes") {
$config['system']['webgui']['quietlogin'] = true;
} else {
unset($config['system']['webgui']['quietlogin']);
}
if ($_POST['disableconsolemenu'] == "yes") {
示例11: array
$server = array();
if (isset($id) && $a_server[$id]) {
$server = $a_server[$id];
}
if ($server['name'] != "") {
$changedesc .= " modified '{$server['name']}' pool:";
}
update_if_changed("name", $server['name'], $_POST['name']);
update_if_changed("port", $server['port'], $_POST['port']);
update_if_changed("backend", $server['backend'], $backend);
update_if_changed("cookie", $server['cookie'], $_POST['cookie']);
update_if_changed("weight", $server['weight'], $_POST['weight']);
update_if_changed("status", $server['status'], $_POST['status']);
update_if_changed("address", $server['address'], $_POST['address']);
update_if_changed("advanced", $server['advanced'], base64_encode($_POST['advanced']));
update_if_changed("checkinter", $server['checkinter'], $_POST['checkinter']);
if (isset($id) && $a_server[$id]) {
$a_server[$id] = $server;
} else {
$a_server[] = $server;
}
if ($changecount > 0) {
touch($d_haproxyconfdirty_path);
write_config($changedesc);
/*
echo "<PRE>";
print_r($config);
echo "</PRE>";
*/
}
header("Location: haproxy_servers.php");
示例12: update_if_changed
update_if_changed("protocol", $actent['protocol'], $pconfig['protocol']);
update_if_changed("type", $actent['type'], $pconfig['type']);
update_if_changed("direction", $actent['direction'], $pconfig['direction']);
update_if_changed("description", $actent['descr'], $pconfig['descr']);
update_if_changed("action", $actent['action'], $pconfig['action']);
switch ($pconfig['action']) {
case "append":
case "change":
case "expect":
case "filter":
update_if_changed("value", $actent['options']['value'], $pconfig['option_action_value']);
update_if_changed("key", $actent['options']['akey'], $pconfig['option_action_key']);
break;
case "hash":
case "log":
update_if_changed("key", $actent['options']['akey'], $pconfig['option_action_key']);
break;
}
if (isset($id) && $a_action[$id]) {
// XXX - TODO
/* modify all virtual servers with this name */
// for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) {
// if ($config['load_balancer']['virtual_server'][$i]['protocol'] == $a_protocol[$id]['name'])
// $config['load_balancer']['virtual_server'][$i]['protocol'] = $protent['name'];
// }
$a_action[$id] = $actent;
} else {
$a_action[] = $actent;
}
if ($changecount > 0) {
/* Mark config dirty */
示例13: preg_replace
}
}
}
# it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
$_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']);
$_POST['timeservers'] = trim($_POST['timeservers']);
foreach (explode(' ', $_POST['timeservers']) as $ts) {
if (!is_domain($ts)) {
$input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
}
}
if (!$input_errors) {
update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']);
update_if_changed("domain", $config['system']['domain'], $_POST['domain']);
update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']);
update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
$config['system']['language'] = $_POST['language'];
set_language();
}
unset($config['system']['webgui']['webguileftcolumnhyper']);
$config['system']['webgui']['webguileftcolumnhyper'] = $_POST['webguileftcolumnhyper'] ? true : false;
unset($config['system']['webgui']['dashboardavailablewidgetspanel']);
$config['system']['webgui']['dashboardavailablewidgetspanel'] = $_POST['dashboardavailablewidgetspanel'] ? true : false;
unset($config['system']['webgui']['systemlogsfilterpanel']);
$config['system']['webgui']['systemlogsfilterpanel'] = $_POST['systemlogsfilterpanel'] ? true : false;
unset($config['system']['webgui']['systemlogsmanagelogpanel']);
$config['system']['webgui']['systemlogsmanagelogpanel'] = $_POST['systemlogsmanagelogpanel'] ? true : false;
unset($config['system']['webgui']['statusmonitoringsettingspanel']);
$config['system']['webgui']['statusmonitoringsettingspanel'] = $_POST['statusmonitoringsettingspanel'] ? true : false;
/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
示例14: array
if (!$input_errors) {
$vsent = array();
if (isset($id) && $a_vs[$id]) {
$vsent = $a_vs[$id];
}
if ($vsent['name'] != "") {
$changedesc .= " modified '{$vsent['name']}' vs:";
} else {
$changedesc .= " created '{$_POST['name']}' vs:";
}
update_if_changed("name", $vsent['name'], $_POST['name']);
update_if_changed("desc", $vsent['desc'], $_POST['desc']);
update_if_changed("pool", $vsent['pool'], $_POST['pool']);
update_if_changed("port", $vsent['port'], $_POST['port']);
update_if_changed("sitedown", $vsent['sitedown'], $_POST['sitedown']);
update_if_changed("ipaddr", $vsent['ipaddr'], $_POST['ipaddr']);
if (isset($id) && $a_vs[$id]) {
$a_vs[$id] = $vsent;
} else {
$a_vs[] = $vsent;
}
if ($changecount > 0) {
/* Mark virtual server dirty */
touch($d_vsconfdirty_path);
write_config($changedesc);
}
header("Location: load_balancer_virtual_server.php");
exit;
}
}
$pgtitle = "Yük Dağılımı: Sanal Sunucu: Düzenle";
示例15: unset
unset($config['system']['ssh']['sshdkeyonly']);
}
}
ob_flush();
flush();
if (!$input_errors) {
if (update_if_changed("webgui protocol", $config['system']['webgui']['protocol'], $_POST['webguiproto'])) {
$restart_webgui = true;
}
if (update_if_changed("webgui port", $config['system']['webgui']['port'], $_POST['webguiport'])) {
$restart_webgui = true;
}
if (update_if_changed("webgui certificate", $config['system']['webgui']['ssl-certref'], $_POST['ssl-certref'])) {
$restart_webgui = true;
}
if (update_if_changed("webgui max processes", $config['system']['webgui']['max_procs'], $_POST['max_procs'])) {
$restart_webgui = true;
}
// Restart the webgui only if this actually changed
if ($_POST['webgui-redirect'] == "yes") {
if ($config['system']['webgui']['disablehttpredirect'] != true) {
$restart_webgui = true;
}
$config['system']['webgui']['disablehttpredirect'] = true;
} else {
if ($config['system']['webgui']['disablehttpredirect'] == true) {
$restart_webgui = true;
}
unset($config['system']['webgui']['disablehttpredirect']);
}
if ($_POST['webgui-login-messages'] == "yes") {