summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/pfsense-utils.inc
diff options
context:
space:
mode:
Diffstat (limited to 'src/etc/inc/pfsense-utils.inc')
-rw-r--r--src/etc/inc/pfsense-utils.inc89
1 files changed, 86 insertions, 3 deletions
diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc
index 31ffe10..301420c 100644
--- a/src/etc/inc/pfsense-utils.inc
+++ b/src/etc/inc/pfsense-utils.inc
@@ -130,6 +130,37 @@ function get_dns_servers() {
return array_unique($dns_servers);
}
+/****f* pfsense-utils/pfSenseHeader
+ * NAME
+ * pfSenseHeader
+ * INPUTS
+ * none
+ * RESULT
+ * Javascript header change or browser Location:
+ ******/
+function pfSenseHeader($text) {
+ global $_SERVER;
+ if (isAjax()) {
+ if ($_SERVER['HTTPS'] == "on") {
+ $protocol = "https";
+ } else {
+ $protocol = "http";
+ }
+
+ $port = ":{$_SERVER['SERVER_PORT']}";
+ if ($_SERVER['SERVER_PORT'] == "80" && $protocol == "http") {
+ $port = "";
+ }
+ if ($_SERVER['SERVER_PORT'] == "443" && $protocol == "https") {
+ $port = "";
+ }
+ $complete_url = "{$protocol}://{$_SERVER['HTTP_HOST']}{$port}/{$text}";
+ echo "\ndocument.location.href = '{$complete_url}';\n";
+ } else {
+ header("Location: $text");
+ }
+}
+
/****f* pfsense-utils/get_css_files
* NAME
* get_css_files - get a list of the available CSS files (themes)
@@ -255,6 +286,25 @@ function gen_dashboardcolumns_field(&$section, $value) {
));
}
+/****f* pfsense-utils/gen_interfacessort_field
+ * NAME
+ * gen_interfacessort_field
+ * INPUTS
+ * Pointer to section object
+ * Initial value for the field
+ * RESULT
+ * no return value, section object is updated
+ ******/
+function gen_interfacessort_field(&$section, $value) {
+
+ $section->addInput(new Form_Checkbox(
+ 'interfacessort',
+ 'Interfaces Sort',
+ 'Sort Alphabetically',
+ $value
+ ))->setHelp('If selected, lists of interfaces will be sorted by description, otherwise they are listed wan,lan,optn...');
+}
+
/****f* pfsense-utils/gen_associatedpanels_fields
* NAME
* gen_associatedpanels_fields
@@ -375,6 +425,7 @@ function gen_user_settings_fields(&$section, $pconfig) {
gen_webguifixedmenu_field($section, $pconfig['webguifixedmenu']);
gen_webguihostnamemenu_field($section, $pconfig['webguihostnamemenu']);
gen_dashboardcolumns_field($section, $pconfig['dashboardcolumns']);
+ gen_interfacessort_field($section, $pconfig['interfacessort']);
gen_associatedpanels_fields(
$section,
$pconfig['dashboardavailablewidgetspanel'],
@@ -585,7 +636,7 @@ function is_schedule_inuse($schedule) {
function setup_microcode() {
/* if list */
- $iflist = get_configured_interface_list(false, true);
+ $iflist = get_configured_interface_list(true);
foreach ($iflist as $if => $ifdescr) {
enable_hardware_offloading($if);
}
@@ -2058,6 +2109,37 @@ function update_progress_bar($percent, $first_time) {
}
}
+function update_alias_name($new_alias_name, $orig_alias_name) {
+ if (!$orig_alias_name) {
+ return;
+ }
+
+ // Firewall rules
+ update_alias_names_upon_change(array('filter', 'rule'), array('source', 'address'), $new_alias_name, $orig_alias_name);
+ update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'address'), $new_alias_name, $orig_alias_name);
+ update_alias_names_upon_change(array('filter', 'rule'), array('source', 'port'), $new_alias_name, $orig_alias_name);
+ update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'port'), $new_alias_name, $orig_alias_name);
+ // NAT Rules
+ update_alias_names_upon_change(array('nat', 'rule'), array('source', 'address'), $new_alias_name, $orig_alias_name);
+ update_alias_names_upon_change(array('nat', 'rule'), array('source', 'port'), $new_alias_name, $orig_alias_name);
+ update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'address'), $new_alias_name, $orig_alias_name);
+ update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'port'), $new_alias_name, $orig_alias_name);
+ update_alias_names_upon_change(array('nat', 'rule'), array('target'), $new_alias_name, $orig_alias_name);
+ update_alias_names_upon_change(array('nat', 'rule'), array('local-port'), $new_alias_name, $orig_alias_name);
+ // NAT 1:1 Rules
+ //update_alias_names_upon_change(array('nat', 'onetoone'), array('external'), $new_alias_name, $orig_alias_name);
+ //update_alias_names_upon_change(array('nat', 'onetoone'), array('source', 'address'), $new_alias_name, $orig_alias_name);
+ update_alias_names_upon_change(array('nat', 'onetoone'), array('destination', 'address'), $new_alias_name, $orig_alias_name);
+ // NAT Outbound Rules
+ update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('source', 'network'), $new_alias_name, $orig_alias_name);
+ update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('sourceport'), $new_alias_name, $orig_alias_name);
+ update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('destination', 'address'), $new_alias_name, $orig_alias_name);
+ update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('dstport'), $new_alias_name, $orig_alias_name);
+ update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('target'), $new_alias_name, $orig_alias_name);
+ // Alias in an alias
+ update_alias_names_upon_change(array('aliases', 'alias'), array('address'), $new_alias_name, $orig_alias_name);
+}
+
function update_alias_names_upon_change($section, $field, $new_alias_name, $origname) {
global $g, $config, $pconfig, $debug;
if (!$origname) {
@@ -2811,10 +2893,11 @@ function set_language() {
function get_locale_list() {
$locales = array(
+ "de_DE" => gettext("German (Germany)"),
"en_US" => gettext("English"),
"es" => gettext("Spanish"),
- "pt_BR" => gettext("Portuguese (Brazil)"),
- "tr" => gettext("Turkish"),
+ "nb" => gettext("Norwegian Bokmål"),
+ "ru" => gettext("Russian"),
"zh_Hans_CN" => gettext("Chinese (Simplified, China)"),
"zh_TW" => gettext("Chinese (Taiwan)"),
);
OpenPOWER on IntegriCloud