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
4f584dd2
Commit
4f584dd2
authored
May 29, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(mvc) check for uuid before using it.
parent
94d946c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
32 deletions
+34
-32
UIModelGrid.php
src/opnsense/mvc/app/library/OPNsense/Base/UIModelGrid.php
+34
-32
No files found.
src/opnsense/mvc/app/library/OPNsense/Base/UIModelGrid.php
View file @
4f584dd2
...
@@ -70,46 +70,48 @@ class UIModelGrid
...
@@ -70,46 +70,48 @@ class UIModelGrid
$recordIndex
=
0
;
$recordIndex
=
0
;
foreach
(
$this
->
DataField
->
sortedBy
(
$sortBy
,
$sortDescending
)
as
$record
)
{
foreach
(
$this
->
DataField
->
sortedBy
(
$sortBy
,
$sortDescending
)
as
$record
)
{
// parse rows, because we may need to convert some (list) items we need to know the actual content
if
(
array_key_exists
(
"uuid"
,
$record
->
getAttributes
()))
{
// before searching.
// parse rows, because we may need to convert some (list) items we need to know the actual content
$row
=
array
();
// before searching.
$row
[
'uuid'
]
=
$record
->
getAttributes
()[
'uuid'
];
$row
=
array
();
foreach
(
$fields
as
$fieldname
)
{
$row
[
'uuid'
]
=
$record
->
getAttributes
()[
'uuid'
];
$row
[
$fieldname
]
=
$record
->
$fieldname
->
getNodeData
();
foreach
(
$fields
as
$fieldname
)
{
if
(
is_array
(
$row
[
$fieldname
]))
{
$row
[
$fieldname
]
=
$record
->
$fieldname
->
getNodeData
();
foreach
(
$row
[
$fieldname
]
as
$fieldKey
=>
$fieldValue
)
{
if
(
$fieldValue
[
'selected'
]
==
1
)
{
$row
[
$fieldname
]
=
$fieldValue
[
'value'
];
}
}
if
(
is_array
(
$row
[
$fieldname
]))
{
if
(
is_array
(
$row
[
$fieldname
]))
{
$row
[
$fieldname
]
=
"##Unlinked"
;
foreach
(
$row
[
$fieldname
]
as
$fieldKey
=>
$fieldValue
)
{
if
(
$fieldValue
[
'selected'
]
==
1
)
{
$row
[
$fieldname
]
=
$fieldValue
[
'value'
];
}
}
if
(
is_array
(
$row
[
$fieldname
]))
{
$row
[
$fieldname
]
=
"##Unlinked"
;
}
}
}
}
}
}
// if a search phrase is provided, use it to search in all requested fields
// if a search phrase is provided, use it to search in all requested fields
if
(
$searchPhrase
!=
''
)
{
if
(
$searchPhrase
!=
''
)
{
$searchFound
=
false
;
$searchFound
=
false
;
foreach
(
$fields
as
$fieldname
)
{
foreach
(
$fields
as
$fieldname
)
{
if
(
strpos
(
strtolower
(
$row
[
$fieldname
]),
strtolower
(
$searchPhrase
))
!==
false
)
{
if
(
strpos
(
strtolower
(
$row
[
$fieldname
]),
strtolower
(
$searchPhrase
))
!==
false
)
{
$searchFound
=
true
;
$searchFound
=
true
;
break
;
break
;
}
}
}
}
else
{
$searchFound
=
true
;
}
}
}
else
{
$searchFound
=
true
;
}
// if result is relevant, count total and add (max number of) items to result.
// if result is relevant, count total and add (max number of) items to result.
// $itemsPerPage = -1 is used as wildcard for "all results"
// $itemsPerPage = -1 is used as wildcard for "all results"
if
(
$searchFound
)
{
if
(
$searchFound
)
{
if
((
count
(
$result
[
'rows'
])
<
$itemsPerPage
&&
if
((
count
(
$result
[
'rows'
])
<
$itemsPerPage
&&
$recordIndex
>=
(
$itemsPerPage
*
(
$currentPage
-
1
))
||
$itemsPerPage
==
-
1
)
$recordIndex
>=
(
$itemsPerPage
*
(
$currentPage
-
1
))
||
$itemsPerPage
==
-
1
)
)
{
)
{
$result
[
'rows'
][]
=
$row
;
$result
[
'rows'
][]
=
$row
;
}
$recordIndex
++
;
}
}
$recordIndex
++
;
}
}
}
}
...
...
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