本文整理汇总了PHP中write_config函数的典型用法代码示例。如果您正苦于以下问题:PHP write_config函数的具体用法?PHP write_config怎么用?PHP write_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write_config函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: save_settings
public function save_settings()
{
//update the configuration file
$this->load->helper('configfile');
$configfile = "google";
foreach ($this->config_items as $item_name) {
switch ($item_name) {
case 'google_contact_sync':
if ($this->input->post($item_name)) {
$this->config->set_item($item_name, "true");
} else {
$this->config->set_item($item_name, "false");
}
break;
case 'google_admin_password':
//do both the pass fields match in content?
if ($this->input->post($item_name) != $this->input->post('google_admin_confirm_password')) {
return false;
}
//is the password changed?
if ($this->input->post($item_name) != $this->config->item($item_name)) {
$submitted_pwd = $this->input->post($item_name);
$pwd = system('/usr/local/bin/gads_pwd.sh ' . escapeshellarg($submitted_pwd), $retval);
$this->config->set_item($item_name, $pwd);
}
break;
default:
$this->config->set_item($item_name, $this->input->post($item_name));
break;
}
}
return write_config($configfile, $this->config_items, true) ? true : false;
}
开发者ID:roxio,项目名称:MyClientBase-SB,代码行数:33,代码来源:google.php
示例2: index
public function index()
{
$this->load->library('form_validation');
if ($this->input->post('submit')) {
$this->form_validation->set_rules('sender_email', 'System Email', 'required|trim|valid_email|max_length[120]|xss_clean');
$this->form_validation->set_rules('mailpath', 'Sendmail Path', 'trim|xss_clean');
$this->form_validation->set_rules('smtp_host', 'SMTP Server Address', 'trim|strip_tags|xss_clean');
$this->form_validation->set_rules('smtp_user', 'SMTP Username', 'trim|strip_tags|xss_clean');
$this->form_validation->set_rules('smtp_pass', 'SMTP Password', 'trim|strip_tags|xss_clean');
$this->form_validation->set_rules('smtp_port', 'SMTP Port', 'trim|strip_tags|numeric|xss_clean');
$this->form_validation->set_rules('smtp_timeout', 'SMTP timeout', 'trim|strip_tags|numeric|xss_clean');
if ($this->form_validation->run() !== FALSE) {
$data = array('sender_email' => $this->input->post('sender_email'), 'mailtype' => $this->input->post('mailtype'), 'protocol' => strtolower($_POST['protocol']), 'mailpath' => $_POST['mailpath'], 'smtp_host' => isset($_POST['smtp_host']) ? $_POST['smtp_host'] : '', 'smtp_user' => isset($_POST['smtp_user']) ? $_POST['smtp_user'] : '', 'smtp_pass' => isset($_POST['smtp_pass']) ? $_POST['smtp_pass'] : '', 'smtp_port' => isset($_POST['smtp_port']) ? $_POST['smtp_port'] : '', 'smtp_timeout' => isset($_POST['smtp_timeout']) ? $_POST['smtp_timeout'] : '5');
if (write_config('email', $data)) {
// Success, so reload the page, so they can see their settings
Template::set_message('Email settings successfully saved.', 'success');
redirect(SITE_AREA . '/settings/emailer');
} else {
Template::set_message('There was an error saving the file: config/email.', 'error');
}
}
}
// Load our current settings
Template::set(read_config('email'));
Template::set('toolbar_title', 'Email Settings');
Template::render();
}
开发者ID:hnmurugan,项目名称:Bonfire,代码行数:27,代码来源:settings.php
示例3: show_vars
function show_vars()
{
global $name;
if (is_file("modules/{$name}/configure.php")) {
$file = file("modules/{$name}/configure.php");
$strfile = join("", $file);
#eval("\n>\n$file\n<?php\n ");
echo "<table>" . "<tr>" . "<td><textarea name=config_file cols=80 rows=25>{$strfile}</textarea></td>" . "</tr>" . "</table>";
foreach ($file as $line) {
if (strstr($line, "\$hlpdsk_theme")) {
$theme_selected = substr(strstr($line, '"'), 1, -3);
echo "theme selected<br>{$theme_selected}<br>";
}
}
$themes = get_themes();
foreach ($themes as $value) {
if ($value == $theme_selected) {
$options .= "<option value=\"{$value}\" selected>{$value}</option>\n";
} else {
$options .= "<option value=\"{$value}\">{$value}</option>\n";
}
}
echo "<select>{$options}</select>";
} else {
write_config();
}
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:27,代码来源:setup.php
示例4: zfszpool_process_updatenotification
function zfszpool_process_updatenotification($mode, $data)
{
global $config;
$retval = 0;
switch ($mode) {
case UPDATENOTIFY_MODE_NEW:
$retval = zfs_zpool_configure($data);
break;
case UPDATENOTIFY_MODE_MODIFIED:
$retval = zfs_zpool_properties($data);
break;
case UPDATENOTIFY_MODE_DIRTY:
$cnid = array_search_ex($data, $config['zfs']['pools']['pool'], "uuid");
if (FALSE !== $cnid) {
zfs_zpool_destroy($data);
unset($config['zfs']['pools']['pool'][$cnid]);
write_config();
// remove existing pool cache
conf_mount_rw();
unlink_if_exists("{$g['cf_path']}/boot/zfs/zpool.cache");
conf_mount_ro();
}
break;
}
return $retval;
}
开发者ID:BillTheBest,项目名称:OpenNAS,代码行数:26,代码来源:disks_zfs_zpool.php
示例5: save_settings
private function save_settings()
{
$this->form_validation->set_rules('title', 'Site Name', 'required|trim|strip_tags|xss_clean');
$this->form_validation->set_rules('system_email', 'Site Email', 'required|trim|strip_tags|valid_email|xss_clean');
$this->form_validation->set_rules('list_limit', 'List Limit', 'required|trim|strip_tags|numeric|xss_clean');
if ($this->form_validation->run() === false)
{
return false;
}
$data = array(
'site.title' => $this->input->post('title'),
'site.system_email' => $this->input->post('system_email'),
'site.status' => $this->input->post('status'),
'site.list_limit' => $this->input->post('list_limit'),
'auth.allow_register' => isset($_POST['allow_register']) ? 1 : 0,
'auth.login_type' => $this->input->post('login_type'),
'auth.use_usernames' => isset($_POST['use_usernames']) ? 1 : 0,
'auth.allow_remember' => isset($_POST['allow_remember']) ? 1 : 0,
'auth.remember_length' => (int)$this->input->post('remember_length'),
'updates.bleeding_edge' => isset($_POST['update_check']) ? 1 : 0,
);
return write_config('application', $data);
}
开发者ID:ndcisiv,项目名称:Bonfire,代码行数:28,代码来源:settings.php
示例6: create_config
function create_config($path, $file)
{
if (!is_writable($path)) {
return array('error' => true, 'message' => LANG_CONFIG_NOT_WRITABLE);
}
$file = $path . '/' . $file;
$config = array('root' => $_SESSION['install']['paths']['root'], 'host' => $_SESSION['install']['hosts']['root'], 'upload_root' => $_SESSION['install']['paths']['upload'], 'upload_host' => $_SESSION['install']['hosts']['upload'], 'cache_root' => $_SESSION['install']['paths']['cache'], 'is_site_on' => 1, 'off_reason' => LANG_CFG_OFF_REASON, 'sitename' => $_SESSION['install']['site']['sitename'], 'hometitle' => $_SESSION['install']['site']['hometitle'], 'date_format' => LANG_CFG_DATE_FORMAT, 'date_format_js' => LANG_CFG_DATE_FORMAT_JS, 'time_zone' => LANG_CFG_TIME_ZONE, 'template' => 'default', 'db_host' => $_SESSION['install']['db']['host'], 'db_base' => $_SESSION['install']['db']['base'], 'db_user' => $_SESSION['install']['db']['user'], 'db_pass' => $_SESSION['install']['db']['pass'], 'db_prefix' => $_SESSION['install']['db']['prefix'], 'db_users_table' => "{$_SESSION['install']['db']['users_table']}", 'language' => LANG, 'metakeys' => $_SESSION['install']['site']['metakeys'], 'metadesc' => $_SESSION['install']['site']['metadesc'], 'ct_autoload' => 'frontpage', 'ct_default' => 'content', 'frontpage' => 'none', 'debug' => 0, 'emulate_lag' => '', 'cache_enabled' => 0, 'cache_method' => 'files', 'cache_ttl' => 300, 'cache_host' => 'localhost', 'cache_port' => 11211, 'min_html' => 0, 'merge_css' => 0, 'merge_js' => 0, 'mail_transport' => 'mail', 'mail_from' => '[email protected]', 'mail_from_name' => '', 'mail_smtp_server' => 'smtp.example.com', 'mail_smtp_port' => 25, 'mail_smtp_auth' => 1, 'mail_smtp_user' => '[email protected]', 'mail_smtp_pass' => '', 'is_check_updates' => 1);
write_config($file, $config);
return array('error' => false);
}
开发者ID:asphix,项目名称:icms2,代码行数:10,代码来源:config.php
示例7: get_cmd
function get_cmd()
{
global $config, $g;
// print $_REQUEST['type'];
if ($_REQUEST['cmd'] == 'sarg') {
$update_config = 0;
// Check report xml info
if (!is_array($config['installedpackages']['sargrealtime'])) {
$config['installedpackages']['sargrealtime']['config'][0]['realtime_types'] = "";
$config['installedpackages']['sargrealtime']['config'][0]['realtime_users'] = "";
}
// Check report http actions to show
if ($config['installedpackages']['sargrealtime']['config'][0]['realtime_types'] != $_REQUEST['qshape']) {
$config['installedpackages']['sargrealtime']['config'][0]['realtime_types'] = $_REQUEST['qshape'];
$update_config++;
}
// Check report users show
if ($config['installedpackages']['sargrealtime']['config'][0]['realtime_users'] != $_REQUEST['type']) {
$config['installedpackages']['sargrealtime']['config'][0]['realtime_users'] = $_REQUEST['type'];
$update_config++;
}
if ($update_config > 0) {
write_config();
// write changes to sarg_file
$sarg_config = file_get_contents(SARG_DIR . '/etc/sarg/sarg.conf');
$pattern[0] = '/realtime_types\\s+[A-Z,,]+/';
$replace[0] = "realtime_types " . $_REQUEST['qshape'];
$pattern[1] = '/realtime_unauthenticated_records\\s+\\w+/';
$replace[1] = "realtime_unauthenticated_records " . $_REQUEST['type'];
file_put_contents(SARG_DIR . '/etc/sarg/sarg.conf', preg_replace($pattern, $replace, $sarg_config), LOCK_EX);
}
exec(SARG_DIR . "/bin/sarg -r", $sarg);
$pattern[0] = "/<?(html|head|style)>/";
$replace[0] = "";
$pattern[1] = "/header_\\w/";
$replace[1] = "listtopic";
$pattern[2] = "/class=.data./";
$replace[2] = 'class="listlr"';
$pattern[3] = "/cellpadding=.\\d./";
$replace[3] = 'cellpadding="0"';
$pattern[4] = "/cellspacing=.\\d./";
$replace[4] = 'cellspacing="0"';
$pattern[5] = "/sarg/";
$replace[5] = 'cellspacing="0"';
foreach ($sarg as $line) {
if (preg_match("/<.head>/", $line)) {
$print = "ok";
}
if ($print == "ok" && !preg_match("/(sarg realtime|Auto Refresh)/i", $line)) {
print preg_replace($pattern, $replace, $line);
}
}
}
}
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:54,代码来源:sarg_realtime.php
示例8: enable
public function enable()
{
$this->auth->restrict('Bonfire.Logs.Manage');
if ($this->input->post('submit')) {
$this->load->helper('config_file');
if (write_config('config', array('log_threshold' => $_POST['log_threshold']))) {
Template::set_message('Log settings successfully saved.', 'success');
} else {
Template::set_message('Unable to save log settings. Check the write permissions on <b>application/config.php</b> and try again.', 'error');
}
}
redirect(SITE_AREA . '/developer/logs');
}
开发者ID:hnmurugan,项目名称:Bonfire,代码行数:13,代码来源:developer.php
示例9: save_settings
private function save_settings()
{
$this->form_validation->set_rules('title', lang('bf_site_name'), 'required|trim|strip_tags|xss_clean');
$this->form_validation->set_rules('system_email', lang('bf_site_email'), 'required|trim|strip_tags|valid_email|xss_clean');
$this->form_validation->set_rules('list_limit', 'Items <em>p.p.</em>', 'required|trim|strip_tags|numeric|xss_clean');
if ($this->form_validation->run() === false) {
return false;
}
$data = array('site.title' => $this->input->post('title'), 'site.system_email' => $this->input->post('system_email'), 'site.status' => $this->input->post('status'), 'site.list_limit' => $this->input->post('list_limit'), 'auth.allow_register' => isset($_POST['allow_register']) ? 1 : 0, 'auth.login_type' => $this->input->post('login_type'), 'auth.use_usernames' => isset($_POST['use_usernames']) ? $this->input->post('use_usernames') : 0, 'auth.allow_remember' => isset($_POST['allow_remember']) ? 1 : 0, 'auth.remember_length' => (int) $this->input->post('remember_length'), 'auth.use_extended_profile' => isset($_POST['use_ext_profile']) ? 1 : 0, 'updates.do_check' => isset($_POST['do_check']) ? 1 : 0, 'updates.bleeding_edge' => isset($_POST['bleeding_edge']) ? 1 : 0, 'site.show_profiler' => isset($_POST['show_profiler']) ? 1 : 0);
//destroy the saved update message in case they changed update preferences.
if ($this->cache->get('update_message')) {
$this->cache->delete('update_message');
}
return write_config('application', $data);
}
开发者ID:hnmurugan,项目名称:Bonfire,代码行数:15,代码来源:settings.php
示例10: update_config
/**
* This function sets the new configuration values for the objects Person, Organization and Location using the common Code Igniter method
* $this->config->set_item. Afterwards, writes the values in the config file using the function write_config
*
* @access private
* @param
* @var
* @return boolean
* @example
* @see
*
* @author Damiano Venturin
* @copyright 2V S.r.l.
* @license GPL
* @link http://www.squadrainformatica.com/en/development#mcbsb MCB-SB official page
* @since Feb 6, 2012
*
*/
private function update_config(&$obj, $configfile)
{
if (!is_object($obj)) {
return false;
}
//update the configuration file
$this->load->helper('configfile');
$this->config->set_item($obj->objName . '_show_fields', $obj->show_fields);
$this->config->set_item($obj->objName . '_attributes_aliases', $obj->aliases);
if (write_config($configfile, array($obj->objName . '_show_fields', $obj->objName . '_attributes_aliases', $obj->objName . '_hidden_fields'), true)) {
$obj->prepareShow();
//refreshes the object with the new values
return true;
}
return false;
}
开发者ID:roxio,项目名称:MyClientBase-SB,代码行数:34,代码来源:contact.php
示例11: interfaces_carp_set_maintenancemode
function interfaces_carp_set_maintenancemode($carp_maintenancemode)
{
global $config;
if (isset($config["virtualip_carp_maintenancemode"]) && $carp_maintenancemode == false) {
unset($config["virtualip_carp_maintenancemode"]);
write_config("Leave CARP maintenance mode");
} elseif (!isset($config["virtualip_carp_maintenancemode"]) && $carp_maintenancemode == true) {
$config["virtualip_carp_maintenancemode"] = true;
write_config("Enter CARP maintenance mode");
}
$viparr =& $config['virtualip']['vip'];
foreach ($viparr as $vip) {
if ($vip['mode'] == "carp") {
interface_carp_configure($vip);
}
}
}
开发者ID:8191,项目名称:opnsense-core,代码行数:17,代码来源:carp_status.php
示例12: userdbgroup_process_updatenotification
function userdbgroup_process_updatenotification($mode, $data)
{
global $config;
$retval = 0;
switch ($mode) {
case UPDATENOTIFY_MODE_NEW:
case UPDATENOTIFY_MODE_MODIFIED:
break;
case UPDATENOTIFY_MODE_DIRTY:
$index = array_search_ex($data, $config['access']['group'], "uuid");
if (false !== $index) {
unset($config['access']['group'][$index]);
write_config();
}
break;
}
return $retval;
}
开发者ID:ZenaVault,项目名称:FreeNAS-Source,代码行数:18,代码来源:access_users_groups.php
示例13: afpshare_process_updatenotification
function afpshare_process_updatenotification($mode, $data)
{
global $config;
$retval = 0;
switch ($mode) {
case UPDATENOTIFY_MODE_NEW:
case UPDATENOTIFY_MODE_MODIFIED:
break;
case UPDATENOTIFY_MODE_DIRTY:
$cnid = array_search_ex($data, $config['afp']['share'], "uuid");
if (FALSE !== $cnid) {
unset($config['afp']['share'][$cnid]);
write_config();
}
break;
}
return $retval;
}
开发者ID:rterbush,项目名称:nas4free,代码行数:18,代码来源:services_afp_share.php
示例14: set_default_gps
function set_default_gps()
{
global $config;
if (!isset($config['ntpd']) || !is_array($config['ntpd'])) {
$config['ntpd'] = array();
}
$config['ntpd']['gps'] = array();
$config['ntpd']['gps']['type'] = 'Generic';
/* copy an existing configured GPS port if it exists, the unset may be uncommented post production */
if (!empty($config['ntpd']['gpsport']) && empty($config['ntpd']['gps']['port'])) {
$config['ntpd']['gps']['port'] = $config['ntpd']['gpsport'];
unset($config['ntpd']['gpsport']);
/* this removes the original port config from config.xml */
$config['ntpd']['gps']['speed'] = 0;
$config['ntpd']['gps']['nmea'] = 0;
}
write_config("Setting default NTPd settings");
}
开发者ID:Toudix,项目名称:core,代码行数:18,代码来源:services_ntpd_gps.php
示例15: geli_process_updatenotification
function geli_process_updatenotification($mode, $data)
{
global $config;
$retval = 0;
switch ($mode) {
case UPDATENOTIFY_MODE_DIRTY:
$cnid = array_search_ex($data, $config['geli']['vdisk'], "uuid");
if (FALSE !== $cnid) {
// Kill encrypted volume.
disks_geli_kill($config['geli']['vdisk'][$cnid]['devicespecialfile']);
// Reset disk file system type attribute ('fstype') in configuration.
set_conf_disk_fstype($config['geli']['vdisk'][$cnid]['device'][0], "");
unset($config['geli']['vdisk'][$cnid]);
write_config();
}
break;
}
return $retval;
}
开发者ID:ZenaVault,项目名称:FreeNAS-Source,代码行数:19,代码来源:disks_crypt.php
示例16: rsynclocal_process_updatenotification
function rsynclocal_process_updatenotification($mode, $data)
{
global $config;
$retval = 0;
switch ($mode) {
case UPDATENOTIFY_MODE_NEW:
case UPDATENOTIFY_MODE_MODIFIED:
break;
case UPDATENOTIFY_MODE_DIRTY:
$cnid = array_search_ex($data, $config['rsync']['rsynclocal'], "uuid");
if (FALSE !== $cnid) {
unset($config['rsync']['rsynclocal'][$cnid]);
write_config();
}
@unlink("/var/run/rsync_local_{$data}.sh");
break;
}
return $retval;
}
开发者ID:sdoney,项目名称:nas4free,代码行数:19,代码来源:services_rsyncd_local.php
示例17: routes_process_updatenotification
function routes_process_updatenotification($mode, $data)
{
global $config;
$retval = 0;
switch ($mode) {
case UPDATENOTIFY_MODE_NEW:
case UPDATENOTIFY_MODE_MODIFIED:
break;
case UPDATENOTIFY_MODE_DIRTY:
$cnid = array_search_ex($data, $config['staticroutes']['route'], "uuid");
if (FALSE !== $index) {
rc_exec_service("routing delete conf_" . strtr($config['staticroutes']['route'][$cnid]['uuid'], "-", "_"));
unset($config['staticroutes']['route'][$cnid]);
write_config();
}
break;
}
return $retval;
}
开发者ID:ZenaVault,项目名称:FreeNAS-Source,代码行数:19,代码来源:system_routes.php
示例18: ftpd_mod_ban_process_updatenotification
function ftpd_mod_ban_process_updatenotification($mode, $data)
{
global $config;
$retval = 0;
switch ($mode) {
case UPDATENOTIFY_MODE_NEW:
case UPDATENOTIFY_MODE_MODIFIED:
break;
case UPDATENOTIFY_MODE_DIRTY:
if (is_array($config['ftpd']['mod_ban']['rule'])) {
$index = array_search_ex($data, $config['ftpd']['mod_ban']['rule'], "uuid");
if (false !== $index) {
unset($config['ftpd']['mod_ban']['rule'][$index]);
write_config();
}
}
break;
}
return $retval;
}
开发者ID:sdoney,项目名称:nas4free,代码行数:20,代码来源:services_ftp_mod.php
示例19: rcconf_process_updatenotification
function rcconf_process_updatenotification($mode, $data)
{
global $config;
$retval = 0;
switch ($mode) {
case UPDATENOTIFY_MODE_NEW:
case UPDATENOTIFY_MODE_MODIFIED:
break;
case UPDATENOTIFY_MODE_DIRTY:
if (is_array($config['system']['rcconf']['param'])) {
$index = array_search_ex($data, $config['system']['rcconf']['param'], "uuid");
if (false !== $index) {
mwexec2("/usr/local/sbin/rconf attribute remove {$config['system']['rcconf']['param'][$index]['name']}");
unset($config['system']['rcconf']['param'][$index]);
write_config();
}
}
break;
}
return $retval;
}
开发者ID:rterbush,项目名称:nas4free,代码行数:21,代码来源:system_rcconf.php
示例20: zfszpool_process_updatenotification
function zfszpool_process_updatenotification($mode, $data)
{
global $config;
$retval = 0;
switch ($mode) {
case UPDATENOTIFY_MODE_NEW:
$retval = zfs_zpool_configure($data);
break;
case UPDATENOTIFY_MODE_MODIFIED:
break;
case UPDATENOTIFY_MODE_DIRTY:
$cnid = array_search_ex($data, $config['zfs']['pools']['pool'], "uuid");
if (FALSE !== $cnid) {
zfs_zpool_destroy($data);
unset($config['zfs']['pools']['pool'][$cnid]);
write_config();
}
break;
}
return $retval;
}
开发者ID:ZenaVault,项目名称:FreeNAS-Source,代码行数:21,代码来源:disks_zfs_zpool.php
注:本文中的write_config函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论