Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
168bb7b5
Commit
168bb7b5
authored
Aug 29, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: strip gettext() from write_config(); closes #1158
(cherry picked from commit
5585e109
)
parent
f82c6fa7
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
64 additions
and
96 deletions
+64
-96
config.lib.inc
src/etc/inc/config.lib.inc
+3
-3
services.inc
src/etc/inc/services.inc
+0
-25
system.inc
src/etc/inc/system.inc
+1
-1
legacy.inc
src/etc/inc/xmlrpc/legacy.inc
+1
-1
rc.initial.password
src/etc/rc.initial.password
+1
-1
rc.initial.setlanip
src/etc/rc.initial.setlanip
+1
-1
setup.xml
src/wizard/setup.xml
+1
-1
diag_backup.php
src/www/diag_backup.php
+1
-1
diag_confbak.php
src/www/diag_confbak.php
+1
-1
firewall_nat_1to1.php
src/www/firewall_nat_1to1.php
+8
-12
firewall_nat_npt.php
src/www/firewall_nat_npt.php
+36
-40
index.php
src/www/index.php
+1
-1
services_rfc2136_edit.php
src/www/services_rfc2136_edit.php
+2
-1
services_upnp.php
src/www/services_upnp.php
+1
-1
system_crlmanager.php
src/www/system_crlmanager.php
+5
-5
vpn_ipsec_keys.php
src/www/vpn_ipsec_keys.php
+1
-1
No files found.
src/etc/inc/config.lib.inc
View file @
168bb7b5
...
...
@@ -138,7 +138,7 @@ function convert_config()
}
if
(
$prev_version
!=
$config
[
'version'
])
{
write_config
(
sprintf
(
gettext
(
'Upgraded config version level from %s to %s'
)
,
$prev_version
,
$config
[
'version'
]));
write_config
(
sprintf
(
'Upgraded config version level from %s to %s'
,
$prev_version
,
$config
[
'version'
]));
}
}
...
...
@@ -216,7 +216,7 @@ function config_restore($conffile)
$config
=
parse_config
();
write_config
(
gettext
(
"Reverted to"
)
.
" "
.
array_pop
(
explode
(
"/"
,
$conffile
))
.
"."
,
false
);
write_config
(
sprintf
(
'Reverted to %s'
,
array_pop
(
explode
(
'/'
,
$conffile
)))
,
false
);
return
0
;
}
...
...
@@ -306,7 +306,7 @@ function make_config_revision_entry($desc = '')
}
if
(
empty
(
$desc
))
{
$desc
=
sprintf
(
gettext
(
'%s made changes'
)
,
$_SERVER
[
'SCRIPT_NAME'
]);
$desc
=
sprintf
(
'%s made changes'
,
$_SERVER
[
'SCRIPT_NAME'
]);
}
$revision
=
array
();
...
...
src/etc/inc/services.inc
View file @
168bb7b5
...
...
@@ -2355,31 +2355,6 @@ function configure_cron()
{
global
$config
;
/*
* Strip the cron jobs that we no longer save explicitly.
* This can be safely removed on our final road to 17.1.
*/
if
(
isset
(
$config
[
'cron'
][
'item'
]))
{
$flush
=
false
;
$index
=
0
;
/* PHP retains the index, can iterate all and unset */
foreach
(
$config
[
'cron'
][
'item'
]
as
$item
)
{
unset
(
$config
[
'cron'
][
'item'
][
$index
]);
$flush
=
true
;
$index
++
;
}
if
(
!
count
(
$config
[
'cron'
][
'item'
]))
{
unset
(
$config
[
'cron'
]);
$flush
=
true
;
}
if
(
$flush
)
{
write_config
(
gettext
(
'Removed obsolete cron jobs'
));
}
}
$autocron
=
array
();
/* hourly */
...
...
src/etc/inc/system.inc
View file @
168bb7b5
...
...
@@ -981,7 +981,7 @@ function system_webgui_configure()
cert_import
(
$cert
,
$crt
,
$key
);
$a_cert
[]
=
$cert
;
$config
[
'system'
][
'webgui'
][
'ssl-certref'
]
=
$cert
[
'refid'
];
write_config
(
gettext
(
"Importing HTTPS certificate"
)
);
write_config
(
'Importing HTTPS certificate'
);
}
else
{
$crt
=
base64_decode
(
$cert
[
'crt'
]);
$key
=
base64_decode
(
$cert
[
'prv'
]);
...
...
src/etc/inc/xmlrpc/legacy.inc
View file @
168bb7b5
...
...
@@ -200,7 +200,7 @@ function restore_config_section_xmlrpc($new_config)
/* Log what happened */
$mergedkeys
=
implode
(
","
,
array_merge
(
array_keys
(
$new_config
),
$sync_full_done
));
write_config
(
sprintf
(
gettext
(
"Merged in config (%s sections) from XMLRPC client."
)
,
$mergedkeys
));
write_config
(
sprintf
(
'Merged %s config sections from XMLRPC client.'
,
$mergedkeys
));
/*
* Handle virtual ips
...
...
src/etc/rc.initial.password
View file @
168bb7b5
...
...
@@ -72,7 +72,7 @@ if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
local_user_set_password
(
$admin_user
,
$g
[
'factory_shipped_password'
]);
local_user_set
(
$admin_user
);
write_config
(
gettext
(
"password changed from console menu"
)
);
write_config
(
'Password reset from console menu'
);
printf
(
"
\n\n
"
);
printf
(
gettext
(
"The password has been reset."
));
...
...
src/etc/rc.initial.setlanip
View file @
168bb7b5
...
...
@@ -492,7 +492,7 @@ if (!$config['interfaces']['lan']) {
$upperifname
=
strtoupper
(
$interface
);
if
(
!
$dry_run
)
{
echo
"
\n
Please wait while the changes are saved to
{
$upperifname
}
..."
;
write_config
(
sprintf
(
gettext
(
"%s IP configuration from console menu"
)
,
$interface
));
write_config
(
sprintf
(
'%s IP configuration from console menu'
,
$interface
));
interface_reconfigure
(
strtolower
(
$upperifname
));
echo
"
\n
Reloading filter..."
;
filter_configure_sync
();
...
...
src/wizard/setup.xml
View file @
168bb7b5
...
...
@@ -43,7 +43,7 @@
<stepbeforeformdisplay>
if (isset($config['trigger_initial_wizard'])) {
unset($config['trigger_initial_wizard']);
write_config(
gettext("Triggered initial wizard")
);
write_config(
'Triggered initial wizard'
);
}
</stepbeforeformdisplay>
</step>
...
...
src/www/diag_backup.php
View file @
168bb7b5
...
...
@@ -57,7 +57,7 @@ function restore_config_section($section_name, $new_contents)
$config
[
$section_name
]
=
$xml
[
$section_name
];
write_config
(
sprintf
(
gettext
(
"Restored %s of config file"
)
,
$section_name
));
write_config
(
sprintf
(
'Restored section %s of config file'
,
$section_name
));
convert_config
();
disable_security_checks
();
...
...
src/www/diag_confbak.php
View file @
168bb7b5
...
...
@@ -94,7 +94,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
if
(
count
(
$input_errors
)
==
0
)
{
$config
[
'system'
][
'backupcount'
]
=
$pconfig
[
'backupcount'
];
write_config
(
gettext
(
'Changed backup revision count.'
)
);
write_config
(
'Changed backup revision count'
);
$savemsg
=
get_std_save_message
();
}
}
...
...
src/www/firewall_nat_1to1.php
View file @
168bb7b5
...
...
@@ -51,9 +51,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
}
elseif
(
isset
(
$pconfig
[
'action'
])
&&
$pconfig
[
'action'
]
==
'del'
&&
isset
(
$id
))
{
// delete single entry
unset
(
$a_1to1
[
$id
]);
if
(
write_config
())
{
mark_subsystem_dirty
(
'natconf'
);
}
write_config
();
mark_subsystem_dirty
(
'natconf'
);
header
(
"Location: firewall_nat_1to1.php"
);
exit
;
}
elseif
(
isset
(
$pconfig
[
'action'
])
&&
$pconfig
[
'action'
]
==
'del_x'
&&
isset
(
$pconfig
[
'rule'
])
&&
count
(
$pconfig
[
'rule'
])
>
0
)
{
...
...
@@ -61,9 +60,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
foreach
(
$pconfig
[
'rule'
]
as
$rulei
)
{
unset
(
$a_1to1
[
$rulei
]);
}
if
(
write_config
())
{
mark_subsystem_dirty
(
'natconf'
);
}
write_config
();
mark_subsystem_dirty
(
'natconf'
);
header
(
"Location: firewall_nat_1to1.php"
);
exit
;
}
elseif
(
isset
(
$pconfig
[
'action'
])
&&
$pconfig
[
'action'
]
==
'move'
)
{
...
...
@@ -75,9 +73,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
}
$a_1to1
=
legacy_move_config_list_items
(
$a_1to1
,
$id
,
$pconfig
[
'rule'
]);
if
(
write_config
())
{
mark_subsystem_dirty
(
'natconf'
);
}
write_config
();
mark_subsystem_dirty
(
'natconf'
);
header
(
"Location: firewall_nat_1to1.php"
);
exit
;
}
...
...
@@ -88,9 +85,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
}
else
{
$a_1to1
[
$id
][
'disabled'
]
=
true
;
}
if
(
write_config
(
gettext
(
'Toggled NAT rule'
)))
{
mark_subsystem_dirty
(
'natconf'
);
}
write_config
(
'Toggled NAT 1:1 rule'
);
mark_subsystem_dirty
(
'natconf'
);
header
(
"Location: firewall_nat_1to1.php"
);
exit
;
}
...
...
src/www/firewall_nat_npt.php
View file @
168bb7b5
...
...
@@ -47,52 +47,48 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$savemsg
=
get_std_save_message
();
clear_subsystem_dirty
(
'natconf'
);
clear_subsystem_dirty
(
'filter'
);
}
elseif
(
isset
(
$pconfig
[
'act'
])
&&
$pconfig
[
'act'
]
==
'del'
&&
isset
(
$id
))
{
}
elseif
(
isset
(
$pconfig
[
'act'
])
&&
$pconfig
[
'act'
]
==
'del'
&&
isset
(
$id
))
{
// delete single record
unset
(
$a_npt
[
$id
]);
if
(
write_config
())
{
mark_subsystem_dirty
(
'natconf'
);
}
write_config
();
mark_subsystem_dirty
(
'natconf'
);
header
(
"Location: firewall_nat_npt.php"
);
exit
;
}
elseif
(
isset
(
$pconfig
[
'act'
])
&&
$pconfig
[
'act'
]
==
'del_x'
&&
isset
(
$pconfig
[
'rule'
])
&&
count
(
$pconfig
[
'rule'
])
>
0
)
{
/* delete selected rules */
foreach
(
$pconfig
[
'rule'
]
as
$rulei
)
{
if
(
isset
(
$a_npt
[
$rulei
]))
{
unset
(
$a_npt
[
$rulei
]);
}
}
if
(
write_config
())
{
mark_subsystem_dirty
(
'natconf'
);
}
header
(
"Location: firewall_nat_npt.php"
);
exit
;
}
elseif
(
isset
(
$pconfig
[
'act'
])
&&
$pconfig
[
'act'
]
==
'move'
)
{
// move records
if
(
isset
(
$pconfig
[
'rule'
])
&&
count
(
$pconfig
[
'rule'
])
>
0
)
{
// if rule not set/found, move to end
if
(
!
isset
(
$id
))
{
$id
=
count
(
$a_npt
);
}
$a_npt
=
legacy_move_config_list_items
(
$a_npt
,
$id
,
$pconfig
[
'rule'
]);
}
if
(
write_config
())
{
mark_subsystem_dirty
(
'natconf'
);
}
header
(
"Location: firewall_nat_npt.php"
);
exit
;
}
elseif
(
isset
(
$pconfig
[
'act'
])
&&
$pconfig
[
'act'
]
==
'toggle'
&&
isset
(
$id
))
{
// toggle item
if
(
isset
(
$a_npt
[
$id
][
'disabled'
]))
{
unset
(
$a_npt
[
$id
][
'disabled'
]);
}
else
{
$a_npt
[
$id
][
'disabled'
]
=
true
;
}
elseif
(
isset
(
$pconfig
[
'act'
])
&&
$pconfig
[
'act'
]
==
'del_x'
&&
isset
(
$pconfig
[
'rule'
])
&&
count
(
$pconfig
[
'rule'
])
>
0
)
{
/* delete selected rules */
foreach
(
$pconfig
[
'rule'
]
as
$rulei
)
{
if
(
isset
(
$a_npt
[
$rulei
]))
{
unset
(
$a_npt
[
$rulei
]);
}
if
(
write_config
(
gettext
(
"Firewall: NAT: NPT, enable/disable NAT rule"
)))
{
mark_subsystem_dirty
(
'natconf'
);
}
write_config
();
mark_subsystem_dirty
(
'natconf'
);
header
(
"Location: firewall_nat_npt.php"
);
exit
;
}
elseif
(
isset
(
$pconfig
[
'act'
])
&&
$pconfig
[
'act'
]
==
'move'
)
{
// move records
if
(
isset
(
$pconfig
[
'rule'
])
&&
count
(
$pconfig
[
'rule'
])
>
0
)
{
// if rule not set/found, move to end
if
(
!
isset
(
$id
))
{
$id
=
count
(
$a_npt
);
}
header
(
"Location: firewall_nat_npt.php"
);
exit
;
$a_npt
=
legacy_move_config_list_items
(
$a_npt
,
$id
,
$pconfig
[
'rule'
]);
}
write_config
();
mark_subsystem_dirty
(
'natconf'
);
header
(
"Location: firewall_nat_npt.php"
);
exit
;
}
elseif
(
isset
(
$pconfig
[
'act'
])
&&
$pconfig
[
'act'
]
==
'toggle'
&&
isset
(
$id
))
{
// toggle item
if
(
isset
(
$a_npt
[
$id
][
'disabled'
]))
{
unset
(
$a_npt
[
$id
][
'disabled'
]);
}
else
{
$a_npt
[
$id
][
'disabled'
]
=
true
;
}
write_config
(
'Toggled NAT NPT rule'
);
mark_subsystem_dirty
(
'natconf'
);
header
(
"Location: firewall_nat_npt.php"
);
exit
;
}
}
...
...
src/www/index.php
View file @
168bb7b5
...
...
@@ -83,7 +83,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
elseif
(
isset
(
$config
[
'widgets'
][
'column_count'
]))
{
unset
(
$config
[
'widgets'
][
'column_count'
]);
}
write_config
(
gettext
(
'Widget configuration has been changed.'
)
);
write_config
(
'Widget configuration has been changed'
);
header
(
'Location: index.php'
);
exit
;
}
...
...
src/www/services_rfc2136_edit.php
View file @
168bb7b5
...
...
@@ -101,7 +101,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
else
{
$a_rfc2136
[]
=
$rfc2136
;
}
write_config
(
gettext
(
"New/Edited RFC2136 dnsupdate entry was posted."
));
write_config
(
'New/Edited RFC2136 dnsupdate entry was posted'
);
if
(
!
empty
(
$pconfig
[
'force'
]))
{
services_dnsupdate_process
(
""
,
$rfc2136
[
'host'
],
true
);
...
...
src/www/services_upnp.php
View file @
168bb7b5
...
...
@@ -148,7 +148,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// sync to config
$config
[
'installedpackages'
][
'miniupnpd'
][
'config'
]
=
$upnp
;
write_config
(
gettext
(
'Modified Universal Plug and Play settings.'
)
);
write_config
(
'Modified Universal Plug and Play settings'
);
sync_package_miniupnpd
();
header
(
"Location: services_upnp.php"
);
exit
;
...
...
src/www/system_crlmanager.php
View file @
168bb7b5
...
...
@@ -158,7 +158,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset
(
$a_crl
[
$cid
]);
}
}
write_config
(
"Deleted CRL
{
$name
}
."
);
write_config
(
sprintf
(
'Deleted CRL %s'
,
$name
)
);
header
(
"Location: system_crlmanager.php"
);
exit
;
}
...
...
@@ -181,11 +181,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$name
=
$thiscert
[
'descr'
];
if
(
cert_unrevoke
(
$thiscert
,
$thiscrl
))
{
openvpn_refresh_crls
();
write_config
(
sprintf
(
gettext
(
"Deleted Certificate %s from CRL %s"
)
,
$name
,
$thiscrl
[
'descr'
]));
write_config
(
sprintf
(
'Deleted certificate %s from CRL %s'
,
$name
,
$thiscrl
[
'descr'
]));
header
(
"Location: system_crlmanager.php"
);
exit
;
}
else
{
$savemsg
=
sprintf
(
gettext
(
"Failed to delete
C
ertificate %s from CRL %s"
),
$name
,
$thiscrl
[
'descr'
])
.
"<br />"
;
$savemsg
=
sprintf
(
gettext
(
"Failed to delete
c
ertificate %s from CRL %s"
),
$name
,
$thiscrl
[
'descr'
])
.
"<br />"
;
}
$act
=
"edit"
;
}
elseif
(
$act
==
"addcert"
)
{
...
...
@@ -214,7 +214,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$reason
=
(
empty
(
$pconfig
[
'crlreason'
]))
?
OCSP_REVOKED_STATUS_UNSPECIFIED
:
$pconfig
[
'crlreason'
];
cert_revoke
(
$cert
,
$crl
,
$reason
);
openvpn_refresh_crls
();
write_config
(
"Revoked cert
{
$cert
[
'descr'
]
}
in CRL
{
$crl
[
'descr'
]
}
."
);
write_config
(
sprintf
(
'Revoked certificate %s in CRL %s'
,
$cert
[
'descr'
],
$crl
[
'descr'
])
);
header
(
"Location: system_crlmanager.php"
);
exit
;
}
...
...
@@ -269,7 +269,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$a_crl
[]
=
$crl
;
}
write_config
(
"Saved CRL
{
$crl
[
'descr'
]
}
"
);
write_config
(
sprintf
(
'Saved CRL %s'
,
$crl
[
'descr'
])
);
openvpn_refresh_crls
();
header
(
"Location: system_crlmanager.php"
);
exit
;
...
...
src/www/vpn_ipsec_keys.php
View file @
168bb7b5
...
...
@@ -49,7 +49,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// delete entry
if
(
isset
(
$config
[
'ipsec'
][
'mobilekey'
][
$_POST
[
'id'
]]))
{
unset
(
$config
[
'ipsec'
][
'mobilekey'
][
$_POST
[
'id'
]]);
write_config
(
gettext
(
"Deleted IPsec Pre-Shared Key"
)
);
write_config
(
'Deleted pre-shared IPsec key'
);
mark_subsystem_dirty
(
'ipsec'
);
header
(
"Location: vpn_ipsec_keys.php"
);
exit
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment