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
47157048
Commit
47157048
authored
Sep 16, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notices: properly address empty notices
parent
184b842a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
9 deletions
+19
-9
notices.inc
src/etc/inc/notices.inc
+19
-9
No files found.
src/etc/inc/notices.inc
View file @
47157048
...
...
@@ -90,19 +90,22 @@ function get_notices($category = 'all')
{
if
(
file_exists
(
'/tmp/notices'
))
{
$queue
=
unserialize
(
file_get_contents
(
'/tmp/notices'
));
if
(
!
$queue
)
return
false
;
if
(
$category
!=
'all'
)
{
if
(
!
$queue
)
{
return
false
;
}
if
(
$category
!=
'all'
)
{
foreach
(
$queue
as
$time
=>
$notice
)
{
if
(
strtolower
(
$notice
[
'category'
])
==
strtolower
(
$category
))
if
(
strtolower
(
$notice
[
'category'
])
==
strtolower
(
$category
))
{
$toreturn
[
$time
]
=
$notice
;
}
}
return
$toreturn
;
}
else
{
return
$queue
;
}
}
else
{
return
fals
e
;
return
$queu
e
;
}
return
false
;
}
/****f* notices/close_notice
...
...
@@ -159,8 +162,14 @@ function close_notice($id)
* RESULT
* prints notices to the GUI
******/
function
print_notices
(
$notices
,
$category
=
"all"
)
{
foreach
(
$notices
as
$notice
)
{
function
print_notices
(
$notices
,
$category
=
"all"
)
{
if
(
!
is_array
(
$notices
)
||
count
(
$notices
)
==
0
)
{
/* nothing to do */
return
;
}
foreach
(
$notices
as
$notice
)
{
if
(
$category
!=
"all"
)
{
if
(
in_array
(
$notice
[
'category'
],
$category
))
$categories
[]
=
$notice
[
'category'
];
}
else
{
...
...
@@ -184,6 +193,7 @@ function print_notices($notices, $category = "all") {
}
$toreturn
.=
"</ul></li></ul>"
;
}
return
$toreturn
;
}
...
...
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