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
03885497
Commit
03885497
authored
May 15, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
system: more style sweeping
parent
27a06305
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
673 additions
and
585 deletions
+673
-585
system_firmware_check.php
src/www/system_firmware_check.php
+95
-93
system_firmware_settings.php
src/www/system_firmware_settings.php
+19
-12
system_groupmanager.php
src/www/system_groupmanager.php
+354
-334
system_groupmanager_addprivs.php
src/www/system_groupmanager_addprivs.php
+105
-89
system_hasync.php
src/www/system_hasync.php
+100
-57
No files found.
src/www/system_firmware_check.php
View file @
03885497
This diff is collapsed.
Click to expand it.
src/www/system_firmware_settings.php
View file @
03885497
...
...
@@ -31,14 +31,15 @@
require_once
(
'guiconfig.inc'
);
if
(
$_POST
)
{
if
(
!
$input_errors
)
{
if
(
$_POST
[
'disablecheck'
]
==
"yes"
)
$config
[
'system'
][
'firmware'
][
'disablecheck'
]
=
true
;
else
unset
(
$config
[
'system'
][
'firmware'
][
'disablecheck'
]);
write_config
();
}
if
(
!
$input_errors
)
{
if
(
$_POST
[
'disablecheck'
]
==
"yes"
)
{
$config
[
'system'
][
'firmware'
][
'disablecheck'
]
=
true
;
}
else
{
unset
(
$config
[
'system'
][
'firmware'
][
'disablecheck'
]);
}
write_config
();
}
}
$curcfg
=
$config
[
'system'
][
'firmware'
];
...
...
@@ -59,8 +60,12 @@ include("head.inc");
<div
class=
"row"
>
<?php
if
(
$input_errors
)
print_input_errors
(
$input_errors
);
if
(
$savemsg
)
print_info_box
(
$savemsg
);
if
(
$input_errors
)
{
print_input_errors
(
$input_errors
);
}
if
(
$savemsg
)
{
print_info_box
(
$savemsg
);
}
?>
<section
class=
"col-xs-12"
>
...
...
@@ -81,7 +86,9 @@ include("head.inc");
<tr>
<td
width=
"22%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Dashboard check"
);
?>
</td>
<td
width=
"78%"
class=
"vtable"
>
<input
name=
"disablecheck"
type=
"checkbox"
id=
"disablecheck"
value=
"yes"
<?php
if
(
isset
(
$curcfg
[
'disablecheck'
]))
echo
"checked=
\"
checked
\"
"
;
?>
/>
<input
name=
"disablecheck"
type=
"checkbox"
id=
"disablecheck"
value=
"yes"
<?php
if
(
isset
(
$curcfg
[
'disablecheck'
]))
{
echo
"checked=
\"
checked
\"
"
;
}
?>
/>
<br
/>
<?=
gettext
(
"Disable the automatic dashboard auto-update check."
);
?>
</td>
...
...
@@ -107,4 +114,4 @@ include("head.inc");
</section>
<?php
include
(
"foot.inc"
);
?>
<?php
include
(
"foot.inc"
);
src/www/system_groupmanager.php
View file @
03885497
This diff is collapsed.
Click to expand it.
src/www/system_groupmanager_addprivs.php
View file @
03885497
...
...
@@ -26,15 +26,18 @@
POSSIBILITY OF SUCH DAMAGE.
*/
function
cpusercmp
(
$a
,
$b
)
{
return
strcasecmp
(
$a
[
'name'
],
$b
[
'name'
]);
function
cpusercmp
(
$a
,
$b
)
{
return
strcasecmp
(
$a
[
'name'
],
$b
[
'name'
]);
}
function
admin_groups_sort
()
{
function
admin_groups_sort
()
{
global
$config
;
if
(
!
is_array
(
$config
[
'system'
][
'group'
]))
return
;
if
(
!
is_array
(
$config
[
'system'
][
'group'
]))
{
return
;
}
usort
(
$config
[
'system'
][
'group'
],
"cpusercmp"
);
}
...
...
@@ -43,69 +46,74 @@ require_once("guiconfig.inc");
$pgtitle
=
array
(
gettext
(
"System"
),
gettext
(
"Group manager"
),
gettext
(
"Add privileges"
));
if
(
is_numericint
(
$_GET
[
'groupid'
]))
$groupid
=
$_GET
[
'groupid'
];
if
(
isset
(
$_POST
[
'groupid'
])
&&
is_numericint
(
$_POST
[
'groupid'
]))
$groupid
=
$_POST
[
'groupid'
];
if
(
is_numericint
(
$_GET
[
'groupid'
]))
{
$groupid
=
$_GET
[
'groupid'
];
}
if
(
isset
(
$_POST
[
'groupid'
])
&&
is_numericint
(
$_POST
[
'groupid'
]))
{
$groupid
=
$_POST
[
'groupid'
];
}
$a_group
=
&
$config
[
'system'
][
'group'
][
$groupid
];
if
(
!
is_array
(
$a_group
))
{
redirectHeader
(
"system_groupmanager.php?id=
{
$groupid
}
"
);
exit
;
redirectHeader
(
"system_groupmanager.php?id=
{
$groupid
}
"
);
exit
;
}
if
(
!
is_array
(
$a_group
[
'priv'
]))
$a_group
[
'priv'
]
=
array
();
if
(
!
is_array
(
$a_group
[
'priv'
]))
{
$a_group
[
'priv'
]
=
array
();
}
if
(
$_POST
)
{
unset
(
$input_errors
);
$pconfig
=
$_POST
;
/* input validation */
$reqdfields
=
explode
(
" "
,
"sysprivs"
);
$reqdfieldsn
=
array
(
gettext
(
"Selected priveleges"
));
do_input_validation
(
$_POST
,
$reqdfields
,
$reqdfieldsn
,
$input_errors
);
/* if this is an AJAX caller then handle via JSON */
if
(
isAjax
()
&&
is_array
(
$input_errors
))
{
input_errors2Ajax
(
$input_errors
);
exit
;
}
if
(
!
$input_errors
)
{
if
(
!
is_array
(
$pconfig
[
'sysprivs'
]))
$pconfig
[
'sysprivs'
]
=
array
();
if
(
!
count
(
$a_group
[
'priv'
]))
$a_group
[
'priv'
]
=
$pconfig
[
'sysprivs'
];
else
$a_group
[
'priv'
]
=
array_merge
(
$a_group
[
'priv'
],
$pconfig
[
'sysprivs'
]);
if
(
is_array
(
$a_group
[
'member'
]))
{
foreach
(
$a_group
[
'member'
]
as
$uid
)
{
$user
=
getUserEntryByUID
(
$uid
);
if
(
$user
)
local_user_set
(
$user
);
}
}
admin_groups_sort
();
$retval
=
write_config
();
$savemsg
=
get_std_save_message
(
$retval
);
redirectHeader
(
"system_groupmanager.php?act=edit&id=
{
$groupid
}
"
);
exit
;
}
unset
(
$input_errors
);
$pconfig
=
$_POST
;
/* input validation */
$reqdfields
=
explode
(
" "
,
"sysprivs"
);
$reqdfieldsn
=
array
(
gettext
(
"Selected priveleges"
));
do_input_validation
(
$_POST
,
$reqdfields
,
$reqdfieldsn
,
$input_errors
);
/* if this is an AJAX caller then handle via JSON */
if
(
isAjax
()
&&
is_array
(
$input_errors
))
{
input_errors2Ajax
(
$input_errors
);
exit
;
}
if
(
!
$input_errors
)
{
if
(
!
is_array
(
$pconfig
[
'sysprivs'
]))
{
$pconfig
[
'sysprivs'
]
=
array
();
}
if
(
!
count
(
$a_group
[
'priv'
]))
{
$a_group
[
'priv'
]
=
$pconfig
[
'sysprivs'
];
}
else
{
$a_group
[
'priv'
]
=
array_merge
(
$a_group
[
'priv'
],
$pconfig
[
'sysprivs'
]);
}
if
(
is_array
(
$a_group
[
'member'
]))
{
foreach
(
$a_group
[
'member'
]
as
$uid
)
{
$user
=
getUserEntryByUID
(
$uid
);
if
(
$user
)
{
local_user_set
(
$user
);
}
}
}
admin_groups_sort
();
$retval
=
write_config
();
$savemsg
=
get_std_save_message
(
$retval
);
redirectHeader
(
"system_groupmanager.php?act=edit&id=
{
$groupid
}
"
);
exit
;
}
}
/* if ajax is calling, give them an update message */
if
(
isAjax
())
print_info_box_np
(
$savemsg
);
if
(
isAjax
())
{
print_info_box_np
(
$savemsg
);
}
include
(
"head.inc"
);
?>
...
...
@@ -118,18 +126,19 @@ include("head.inc");
<?php
if
(
is_array
(
$priv_list
))
{
$id
=
0
;
$jdescs
=
"var descs = new Array();
\n
"
;
foreach
(
$priv_list
as
$pname
=>
$pdata
)
{
if
(
in_array
(
$pname
,
$a_group
[
'priv'
]))
continue
;
$desc
=
addslashes
(
$pdata
[
'descr'
]);
$jdescs
.=
"descs[
{
$id
}
] = '
{
$desc
}
';
\n
"
;
$id
++
;
}
echo
$jdescs
;
$id
=
0
;
$jdescs
=
"var descs = new Array();
\n
"
;
foreach
(
$priv_list
as
$pname
=>
$pdata
)
{
if
(
in_array
(
$pname
,
$a_group
[
'priv'
]))
{
continue
;
}
$desc
=
addslashes
(
$pdata
[
'descr'
]);
$jdescs
.=
"descs[
{
$id
}
] = '
{
$desc
}
';
\n
"
;
$id
++
;
}
echo
$jdescs
;
}
?>
...
...
@@ -146,21 +155,23 @@ function update_description() {
<div
class=
"container-fluid"
>
<div
class=
"row"
>
<?php
if
(
$input_errors
)
print_input_errors
(
$input_errors
);
if
(
$savemsg
)
print_info_box
(
$savemsg
);
?>
if
(
$input_errors
)
{
print_input_errors
(
$input_errors
);
}
if
(
$savemsg
)
{
print_info_box
(
$savemsg
);
}
?>
<section
class=
"col-xs-12"
>
<?php
$tab_array
=
array
();
$tab_array
[]
=
array
(
gettext
(
"Users"
),
false
,
"system_usermanager.php"
);
$tab_array
[]
=
array
(
gettext
(
"Groups"
),
true
,
"system_groupmanager.php"
);
$tab_array
[]
=
array
(
gettext
(
"Settings"
),
false
,
"system_usermanager_settings.php"
);
$tab_array
[]
=
array
(
gettext
(
"Servers"
),
false
,
"system_authservers.php"
);
display_top_tabs
(
$tab_array
);
?>
$tab_array
=
array
();
$tab_array
[]
=
array
(
gettext
(
"Users"
),
false
,
"system_usermanager.php"
);
$tab_array
[]
=
array
(
gettext
(
"Groups"
),
true
,
"system_groupmanager.php"
);
$tab_array
[]
=
array
(
gettext
(
"Settings"
),
false
,
"system_usermanager_settings.php"
);
$tab_array
[]
=
array
(
gettext
(
"Servers"
),
false
,
"system_authservers.php"
);
display_top_tabs
(
$tab_array
);
?>
<div
class=
"tab-content content-box col-xs-12"
>
<form
action=
"system_groupmanager_addprivs.php"
method=
"post"
name=
"iform"
id=
"iform"
>
...
...
@@ -170,12 +181,15 @@ function update_description() {
<td
width=
"78%"
class=
"vtable"
>
<select
name=
"sysprivs[]"
id=
"sysprivs"
class=
"formselect"
onchange=
"update_description();"
multiple=
"multiple"
size=
"35"
>
<?php
foreach
(
$priv_list
as
$pname
=>
$pdata
)
:
if
(
in_array
(
$pname
,
$a_group
[
'priv'
]))
continue
;
?>
<option
value=
"
<?=
$pname
;
?>
"
>
<?=
$pdata
[
'name'
];
?>
</option>
<?php
endforeach
;
?>
foreach
(
$priv_list
as
$pname
=>
$pdata
)
:
if
(
in_array
(
$pname
,
$a_group
[
'priv'
]))
{
continue
;
}
?>
<option
value=
"
<?=
$pname
;
?>
"
>
<?=
$pdata
[
'name'
];
?>
</option>
<?php
endforeach
;
?>
</select>
<br
/>
<?=
gettext
(
"Hold down CTRL (pc)/COMMAND (mac) key to select multiple items"
);
?>
...
...
@@ -205,9 +219,11 @@ function update_description() {
<td
width=
"78%"
>
<input
id=
"submitt"
name=
"Submit"
type=
"submit"
class=
"formbtn btn btn-primary"
value=
"
<?=
gettext
(
"Save"
);
?>
"
/>
<input
id=
"cancelbutton"
class=
"formbtn btn btn-default"
type=
"button"
value=
"
<?=
gettext
(
"Cancel"
);
?>
"
onclick=
"history.back()"
/>
<?php
if
(
isset
(
$groupid
))
:
?>
<?php
if
(
isset
(
$groupid
))
:
?>
<input
name=
"groupid"
type=
"hidden"
value=
"
<?=
htmlspecialchars
(
$groupid
);
?>
"
/>
<?php
endif
;
?>
<?php
endif
;
?>
</td>
</tr>
</table>
...
...
src/www/system_hasync.php
View file @
03885497
This diff is collapsed.
Click to expand it.
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