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; }
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(); }
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(); } }
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; }
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); }
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' => '*****@*****.**', 'mail_from_name' => '', 'mail_smtp_server' => 'smtp.example.com', 'mail_smtp_port' => 25, 'mail_smtp_auth' => 1, 'mail_smtp_user' => '*****@*****.**', 'mail_smtp_pass' => '', 'is_check_updates' => 1); write_config($file, $config); return array('error' => false); }
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); } } } }
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'); }
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); }
/** * 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; }
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); } } }
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; }
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; }
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"); }
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; }
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; }
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; }
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; }
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; }
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; }
function add_user() { // Adds a user to the captive portal user configuration. global $config; $users =& $config['captiveportal']['user']; $tmp['name'] = rand(100000, 900000); // Create a temporary username // TODO: Double check if username exists, if it does, try until we get a good one. $randpass = rand(100000, 900000); $tmp['password'] = md5($randpass); $tmp['fullname'] = 'Automatically added by ticket manager'; /** * Expiration date is the day of the month, 48 hours from now. * This is to avoid cancelling the Internet at 12am if a client * logged in at 11pm which a 24 hour expiration would do. * This could be more complex, but should be fine for now. * in the end, $tmp['expirationdate'] is in the format 'mm/dd/yyyy' **/ $tmp['expirationdate'] = date("m/d/Y", time() + 60 * 60 * 48); $users[] = $tmp; write_config(); return array('name' => $tmp['name'], 'pass' => $randpass, 'expire' => $tmp['expirationdate']); }
function loaderconf_process_updatenotification($mode, $data) { global $config; $retval = 0; switch ($mode) { case UPDATENOTIFY_MODE_NEW: case UPDATENOTIFY_MODE_MODIFIED: write_loader_config(); write_config(); break; case UPDATENOTIFY_MODE_DIRTY: if (is_array($config['system']['loaderconf']['param'])) { $index = array_search_ex($data, $config['system']['loaderconf']['param'], "uuid"); if (false !== $index) { unset($config['system']['loaderconf']['param'][$index]); write_loader_config(); write_config(); } } break; } return $retval; }
} $filterent['updated'] = make_config_revision_entry(); // Allow extending of the firewall edit page and include custom input validation pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_write_config"); if (isset($id) && $a_filter[$id]) { $a_filter[$id] = $filterent; } else { $filterent['created'] = make_config_revision_entry(); if (is_numeric($after)) { array_splice($a_filter, $after + 1, 0, array($filterent)); } else { $a_filter[] = $filterent; } } filter_rules_sort(); if (write_config()) { mark_subsystem_dirty('filter'); } if (isset($_POST['floating'])) { header("Location: firewall_rules.php?if=FloatingRules"); } else { header("Location: firewall_rules.php?if=" . htmlspecialchars($_POST['interface'])); } exit; } } $pgtitle = array(gettext("Firewall"), gettext("Rules"), gettext("Edit")); $shortcut_section = "firewall"; $closehead = false; $page_filename = "firewall_rules_edit.php"; include "head.inc";
unset($resource['auxparam']); foreach (explode("\n", $_POST['auxparam']) as $auxparam) { $auxparam = trim($auxparam, "\t\n\r"); if (!empty($auxparam)) { $resource['auxparam'][] = $auxparam; } } if (isset($uuid) && FALSE !== $cnid) { $a_resource[$cnid] = $resource; $mode = UPDATENOTIFY_MODE_MODIFIED; } else { $a_resource[] = $resource; $mode = UPDATENOTIFY_MODE_NEW; } updatenotify_set("hastresource", $mode, $resource['uuid']); write_config(); header("Location: services_hast_resource.php"); exit; } } include "fbegin.inc"; ?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="tabnavtbl"> <ul id="tabnav"> <li class="tabinact"><a href="services_hast.php"><span><?php echo gettext("Settings"); ?> </span></a></li> <li class="tabact"><a href="services_hast_resource.php" title="<?php
if ($v['bind_to'] == "all") { $i = $f; break; } } /* Only relocate the entry if we */ /* found it, and it's not already */ /* at the end. */ if ($i > -1 && $i < count($a_nat) - 1) { $tmp = $a_nat[$i]; unset($a_nat[$i]); $a_nat[] = $tmp; } } /* Now write the new engine array to conf */ write_config("Snort pkg: modified ftp_telnet_client engine settings."); header("Location: /snort/snort_preprocessors.php?id={$id}#ftp_telnet_row_ftp_proto_opts"); exit; } } $if_friendly = convert_friendly_interface_to_friendly_descr($config['installedpackages']['snortglobal']['rule'][$id]['interface']); $pgtitle = gettext("Snort: Interface {$if_friendly} - FTP Preprocessor Client Engine"); include_once "head.inc"; ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC" > <?php include "fbegin.inc"; if ($input_errors) { print_input_errors($input_errors);
} write_config(); redirectHeader("system_authservers.php"); } else { $act = "edit"; } } elseif (isset($pconfig['act']) && $pconfig['act'] == 'del' && isset($id)) { /* Remove server from main list. */ $serverdeleted = $a_server[$id]['name']; foreach ($config['system']['authserver'] as $k => $as) { if ($config['system']['authserver'][$k]['name'] == $serverdeleted) { unset($config['system']['authserver'][$k]); } } $savemsg = gettext("Authentication Server") . " {$serverdeleted} " . gettext("deleted") . "<br />"; write_config($savemsg); redirectHeader("system_authservers.php"); } } $pgtitle = array(gettext('System'), gettext('Users'), gettext('Servers')); $shortcut_section = "authentication"; // list of all possible fields for auth item (used for form init) $all_authfields = array('type', 'name', 'ldap_caref', 'ldap_host', 'ldap_port', 'ldap_urltype', 'ldap_protver', 'ldap_scope', 'ldap_basedn', 'ldap_authcn', 'ldap_extended_query', 'ldap_binddn', 'ldap_bindpw', 'ldap_attr_user', 'radius_host', 'radius_auth_port', 'radius_acct_port', 'radius_secret', 'radius_timeout', 'radius_srvcs'); foreach ($all_authfields as $fieldname) { if (!isset($pconfig[$fieldname])) { $pconfig[$fieldname] = null; } } legacy_html_escape_form_data($pconfig); legacy_html_escape_form_data($a_server); include "head.inc";
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * ==================================================================== * */ $nocsrf = true; require_once "guiconfig.inc"; require_once "pfsense-utils.inc"; require_once "functions.inc"; if ($_POST['rssfeed']) { $config['widgets']['rssfeed'] = str_replace("\n", ",", htmlspecialchars($_POST['rssfeed'], ENT_QUOTES | ENT_HTML401)); $config['widgets']['rssmaxitems'] = str_replace("\n", ",", htmlspecialchars($_POST['rssmaxitems'], ENT_QUOTES | ENT_HTML401)); $config['widgets']['rsswidgetheight'] = htmlspecialchars($_POST['rsswidgetheight'], ENT_QUOTES | ENT_HTML401); $config['widgets']['rsswidgettextlength'] = htmlspecialchars($_POST['rsswidgettextlength'], ENT_QUOTES | ENT_HTML401); write_config(gettext("Saved RSS Widget feed via Dashboard")); header("Location: /"); } // Use saved feed and max items if ($config['widgets']['rssfeed']) { $rss_feed_s = explode(",", $config['widgets']['rssfeed']); } if ($config['widgets']['rssmaxitems']) { $max_items = $config['widgets']['rssmaxitems']; } if (is_numeric($config['widgets']['rsswidgetheight'])) { $rsswidgetheight = $config['widgets']['rsswidgetheight']; } if (is_numeric($config['widgets']['rsswidgettextlength'])) { $rsswidgettextlength = $config['widgets']['rsswidgettextlength']; }
public function step3() { if (session('step') != 3) { $this->redirect('step2'); } $this->display(); //连接数据库 $dbconfig = session('db_config'); $db = Db::getInstance($dbconfig); //创建数据表 create_tables($db, $dbconfig['DB_PREFIX']); //注册创始人帐号 $auth = build_auth_key(); $admin = session('admin_info'); register_administrator($db, $dbconfig['DB_PREFIX'], $admin, $auth); //创建初始编辑号 register_editor($db, $dbconfig['DB_PREFIX'], $auth); //创建配置文件 $conf = write_config($dbconfig, $auth); session('config_file', $conf); if (session('error')) { //show_msg(); } else { session('step', 3); $this->redirect('Index/complete'); } }
} } if ($olddnsgwname != "" && $olddnsgwname != "none" && ($olddnsgwname != $thisdnsgwname || $olddnsservers[$dnscounter - 1] != $_POST[$dnsname])) { // A previous DNS GW name was specified. It has now gone or changed, or the DNS server address has changed. // Remove the route. Later calls will add the correct new route if needed. if (is_ipaddrv4($olddnsservers[$dnscounter - 1])) { mwexec("/sbin/route delete " . escapeshellarg($olddnsservers[$dnscounter - 1])); } else { if (is_ipaddrv6($olddnsservers[$dnscounter - 1])) { mwexec("/sbin/route delete -inet6 " . escapeshellarg($olddnsservers[$dnscounter - 1])); } } } } if ($changecount > 0) { write_config($changedesc); } $retval = 0; $retval = system_hostname_configure(); $retval |= system_hosts_generate(); $retval |= system_resolvconf_generate(); if (isset($config['dnsmasq']['enable'])) { $retval |= services_dnsmasq_configure(); } elseif (isset($config['unbound']['enable'])) { $retval |= services_unbound_configure(); } $retval |= system_timezone_configure(); $retval |= system_ntp_configure(); if ($olddnsallowoverride != $config['system']['dnsallowoverride']) { $retval |= send_event("service reload dns"); }
conf_mount_rw(); } } if ($_POST['setrw']) { if (!DEBUG) { conf_mount_rw(); if (isset($_POST['nanobsd_force_rw'])) { $savemsg = gettext("Permanent read/write has been set successfully."); $class = 'alert-success'; $config['system']['nanobsd_force_rw'] = true; } else { $savemsg = gettext('Permanent read/write has been cleared successfully.'); $class = 'alert-success'; unset($config['system']['nanobsd_force_rw']); } write_config(gettext("Changed Permanent Read/Write Setting")); conf_mount_ro(); } else { $savemsg = gettext('Saved r/w permanently'); $class = 'alert-success'; } } print_info_box(gettext("The options on this page are intended for use by advanced users only.")); if ($savemsg) { print_info_box($savemsg, $class); } $form = new Form(false); $section = new Form_Section('NanoBSD Options'); $section->addInput(new Form_StaticText('Image Size', $NANOBSD_SIZE)); $slicebtn = new Form_Button('bootslice', 'Switch Slice'); $slicebtn->removeClass('btn-primary')->addClass('btn-default btn-sm');