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
35ec2adc
Commit
35ec2adc
authored
Aug 22, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: add portable url_safe() like we have exec_safe(); closes #1068
parent
ed4a3335
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
11 deletions
+26
-11
util.inc
src/etc/inc/util.inc
+15
-0
system_usermanager.php
src/www/system_usermanager.php
+7
-7
system_usermanager_addprivs.php
src/www/system_usermanager_addprivs.php
+4
-4
No files found.
src/etc/inc/util.inc
View file @
35ec2adc
...
...
@@ -988,6 +988,21 @@ function log_error($error)
syslog
(
LOG_ERR
,
"
$page
:
$error
"
);
}
function
url_safe
(
$format
,
$args
=
array
())
{
if
(
!
is_array
(
$args
))
{
/* just in case there's only one argument */
$args
=
array
(
$args
);
}
foreach
(
$args
as
$id
=>
$arg
)
{
$args
[
$id
]
=
urlencode
(
$arg
);
}
return
vsprintf
(
$format
,
$args
);
}
/****f* util/exec_command
* NAME
* exec_command - Execute a command and return a string of the result.
...
...
src/www/system_usermanager.php
View file @
35ec2adc
...
...
@@ -173,7 +173,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset
(
$a_user
[
$id
]);
write_config
();
$savemsg
=
sprintf
(
gettext
(
'The user "%s" was successfully removed.'
),
$userdeleted
);
header
(
"Location: system_usermanager.php?savemsg="
.
$savemsg
);
header
(
url_safe
(
'Location: system_usermanager.php?savemsg=%s'
,
$savemsg
)
);
exit
;
}
}
elseif
(
$act
==
"delcert"
&&
isset
(
$id
))
{
...
...
@@ -183,7 +183,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset
(
$a_user
[
$id
][
'cert'
][
$pconfig
[
'certid'
]]);
write_config
();
$savemsg
=
sprintf
(
gettext
(
'The certificate association "%s" was successfully removed.'
),
$certdeleted
);
header
(
"Location: system_usermanager.php?savemsg="
.
$savemsg
.
"&act=edit&userid="
.
$id
);
header
(
url_safe
(
'Location: system_usermanager.php?savemsg=%s&act=edit&userid=%s'
,
array
(
$savemsg
,
$id
))
);
exit
;
}
elseif
(
$act
==
"newApiKey"
&&
isset
(
$id
))
{
// every action is using the sequence of the user, to keep it understandable, we will use
...
...
@@ -209,7 +209,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$savemsg
=
gettext
(
'No API key found'
);
}
// redirect
header
(
"Location: system_usermanager.php?savemsg="
.
$savemsg
.
"&act=edit&userid="
.
$id
);
header
(
url_safe
(
'Location: system_usermanager.php?savemsg=%s&act=edit&userid=%s'
,
array
(
$savemsg
,
$id
))
);
exit
;
}
elseif
(
isset
(
$pconfig
[
'save'
]))
{
// save user
...
...
@@ -347,17 +347,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if
(
!
empty
(
$pconfig
[
'chkNewCert'
]))
{
// redirect to cert manager when a new cert is requested for this user
header
(
"Location: system_certmanager.php?act=new&userid="
.
(
count
(
$a_user
)
-
1
));
header
(
url_safe
(
'Location: system_certmanager.php?act=new&userid=%s'
,
count
(
$a_user
)
-
1
));
}
else
{
header
(
"Location: system_usermanager.php"
);
header
(
url_safe
(
'Location: system_usermanager.php'
)
);
exit
;
}
}
}
elseif
(
isset
(
$id
))
{
header
(
"Location: system_usermanager.php?userid="
.
$id
);
header
(
url_safe
(
'Location: system_usermanager.php?userid=%s'
,
$id
)
);
exit
;
}
else
{
header
(
"Location: system_usermanager.php"
);
header
(
url_safe
(
'Location: system_usermanager.php'
)
);
exit
;
}
}
...
...
src/www/system_usermanager_addprivs.php
View file @
35ec2adc
...
...
@@ -52,7 +52,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$input_type
=
"group"
;
$id
=
$_GET
[
'groupid'
];
}
else
{
header
(
"Location: system_usermanager.php"
);
header
(
url_safe
(
'Location: system_usermanager.php'
)
);
exit
;
}
if
(
$input_type
==
"group"
)
{
...
...
@@ -80,7 +80,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$retval
=
write_config
();
$savemsg
=
get_std_save_message
();
header
(
"Location: system_usermanager.php?act=edit&userid="
.
$userid
.
"&savemsg="
.
$savemsg
);
header
(
url_safe
(
'Location: system_usermanager.php?act=edit&userid=%s&savemsg=%s'
,
array
(
$userid
,
$savemsg
))
);
exit
;
}
elseif
(
$_POST
[
'input_type'
]
==
'group'
&&
isset
(
$config
[
'system'
][
'group'
][
$pconfig
[
'id'
]][
'name'
]))
{
$groupid
=
$_POST
[
'id'
];
...
...
@@ -101,11 +101,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
write_config
();
header
(
"Location: system_groupmanager.php?act=edit&groupid=
{
$groupid
}
"
);
header
(
url_safe
(
'Location: system_groupmanager.php?act=edit&groupid=%s'
,
$groupid
)
);
exit
;
}
}
header
(
"Location: system_usermanager.php"
);
header
(
url_safe
(
'Location: system_usermanager.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