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
d61fb7f9
Commit
d61fb7f9
authored
Feb 02, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(mvc applications) refactor model search
parent
8a309525
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
213 deletions
+73
-213
ServiceController.php
...trollers/OPNsense/CaptivePortal/Api/ServiceController.php
+8
-25
SettingsController.php
...rollers/OPNsense/CaptivePortal/Api/SettingsController.php
+8
-25
SettingsController.php
.../app/controllers/OPNsense/Cron/Api/SettingsController.php
+20
-37
SettingsController.php
...c/app/controllers/OPNsense/IDS/Api/SettingsController.php
+8
-25
SettingsController.php
...app/controllers/OPNsense/Proxy/Api/SettingsController.php
+5
-24
SettingsController.php
...rollers/OPNsense/TrafficShaper/Api/SettingsController.php
+24
-77
No files found.
src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/ServiceController.php
View file @
d61fb7f9
...
...
@@ -210,30 +210,13 @@ class ServiceController extends ApiControllerBase
*/
public
function
searchTemplatesAction
()
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
// fetch query parameters
$itemsPerPage
=
$this
->
request
->
getPost
(
'rowCount'
,
'int'
,
9999
);
$currentPage
=
$this
->
request
->
getPost
(
'current'
,
'int'
,
1
);
$sortBy
=
array
(
"name"
);
$sortDescending
=
false
;
if
(
$this
->
request
->
hasPost
(
'sort'
)
&&
is_array
(
$this
->
request
->
getPost
(
"sort"
)))
{
$sortBy
=
array_keys
(
$this
->
request
->
getPost
(
"sort"
));
if
(
$this
->
request
->
getPost
(
"sort"
)[
$sortBy
[
0
]]
==
"desc"
)
{
$sortDescending
=
true
;
}
}
$searchPhrase
=
$this
->
request
->
getPost
(
'searchPhrase'
,
'string'
,
''
);
// create model and fetch query resuls
$fields
=
array
(
"name"
,
"fileid"
);
$mdlCP
=
new
CaptivePortal
();
$grid
=
new
UIModelGrid
(
$mdlCP
->
templates
->
template
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
}
else
{
return
array
();
}
$this
->
sessionClose
();
$mdlCP
=
new
CaptivePortal
();
$grid
=
new
UIModelGrid
(
$mdlCP
->
templates
->
template
);
return
$grid
->
fetchBindRequest
(
$this
->
request
,
array
(
"name"
,
"fileid"
),
"name"
);
}
}
src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/SettingsController.php
View file @
d61fb7f9
...
...
@@ -195,30 +195,13 @@ class SettingsController extends ApiControllerBase
*/
public
function
searchZonesAction
()
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
// fetch query parameters
$itemsPerPage
=
$this
->
request
->
getPost
(
'rowCount'
,
'int'
,
9999
);
$currentPage
=
$this
->
request
->
getPost
(
'current'
,
'int'
,
1
);
$sortBy
=
array
(
"number"
);
$sortDescending
=
false
;
if
(
$this
->
request
->
hasPost
(
'sort'
)
&&
is_array
(
$this
->
request
->
getPost
(
"sort"
)))
{
$sortBy
=
array_keys
(
$this
->
request
->
getPost
(
"sort"
));
if
(
$this
->
request
->
getPost
(
"sort"
)[
$sortBy
[
0
]]
==
"desc"
)
{
$sortDescending
=
true
;
}
}
$searchPhrase
=
$this
->
request
->
getPost
(
'searchPhrase'
,
'string'
,
''
);
// create model and fetch query resuls
$fields
=
array
(
"enabled"
,
"description"
,
"zoneid"
);
$mdlCP
=
new
CaptivePortal
();
$grid
=
new
UIModelGrid
(
$mdlCP
->
zones
->
zone
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
}
else
{
return
array
();
}
$this
->
sessionClose
();
$mdlCP
=
new
CaptivePortal
();
$grid
=
new
UIModelGrid
(
$mdlCP
->
zones
->
zone
);
return
$grid
->
fetchBindRequest
(
$this
->
request
,
array
(
"enabled"
,
"description"
,
"zoneid"
),
"description"
);
}
}
src/opnsense/mvc/app/controllers/OPNsense/Cron/Api/SettingsController.php
View file @
d61fb7f9
...
...
@@ -202,42 +202,25 @@ class SettingsController extends ApiControllerBase
*/
public
function
searchJobsAction
()
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
// fetch query parameters
$itemsPerPage
=
$this
->
request
->
getPost
(
'rowCount'
,
'int'
,
9999
);
$currentPage
=
$this
->
request
->
getPost
(
'current'
,
'int'
,
1
);
$sortBy
=
array
(
"description"
);
$sortDescending
=
false
;
if
(
$this
->
request
->
hasPost
(
'sort'
)
&&
is_array
(
$this
->
request
->
getPost
(
"sort"
)))
{
$sortBy
=
array_keys
(
$this
->
request
->
getPost
(
"sort"
));
if
(
$this
->
request
->
getPost
(
"sort"
)[
$sortBy
[
0
]]
==
"desc"
)
{
$sortDescending
=
true
;
}
}
$searchPhrase
=
$this
->
request
->
getPost
(
'searchPhrase'
,
'string'
,
''
);
// create model and fetch query resuls
$fields
=
array
(
"enabled"
,
"minutes"
,
"hours"
,
"days"
,
"months"
,
"weekdays"
,
"description"
,
"command"
,
"origin"
,
"cronPermissions"
);
$mdlCron
=
new
Cron
();
$grid
=
new
UIModelGrid
(
$mdlCron
->
jobs
->
job
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
}
else
{
return
array
();
}
$this
->
sessionClose
();
$fields
=
array
(
"enabled"
,
"minutes"
,
"hours"
,
"days"
,
"months"
,
"weekdays"
,
"description"
,
"command"
,
"origin"
,
"cronPermissions"
);
$mdlCron
=
new
Cron
();
$grid
=
new
UIModelGrid
(
$mdlCron
->
jobs
->
job
);
return
$grid
->
fetchBindRequest
(
$this
->
request
,
$fields
,
"description"
);
}
}
src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php
View file @
d61fb7f9
...
...
@@ -495,31 +495,14 @@ class SettingsController extends ApiControllerBase
*/
public
function
searchFingerprintAction
()
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
// fetch query parameters
$itemsPerPage
=
$this
->
request
->
getPost
(
'rowCount'
,
'int'
,
9999
);
$currentPage
=
$this
->
request
->
getPost
(
'current'
,
'int'
,
1
);
$sortBy
=
array
(
"number"
);
$sortDescending
=
false
;
if
(
$this
->
request
->
hasPost
(
'sort'
)
&&
is_array
(
$this
->
request
->
getPost
(
"sort"
)))
{
$sortBy
=
array_keys
(
$this
->
request
->
getPost
(
"sort"
));
if
(
$this
->
request
->
getPost
(
"sort"
)[
$sortBy
[
0
]]
==
"desc"
)
{
$sortDescending
=
true
;
}
}
$searchPhrase
=
$this
->
request
->
getPost
(
'searchPhrase'
,
'string'
,
''
);
// create model and fetch query resuls
$fields
=
array
(
"enabled"
,
"action"
,
"description"
,
"fingerprint"
);
$mdlIDS
=
$this
->
getModel
();
$grid
=
new
UIModelGrid
(
$mdlIDS
->
rules
->
fingerprint
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
}
else
{
return
array
();
}
$this
->
sessionClose
();
$mdlIDS
=
$this
->
getModel
();
$grid
=
new
UIModelGrid
(
$mdlIDS
->
rules
->
fingerprint
);
return
$grid
->
fetchBindRequest
(
$this
->
request
,
array
(
"enabled"
,
"action"
,
"description"
,
"fingerprint"
),
"description"
);
}
/**
...
...
src/opnsense/mvc/app/controllers/OPNsense/Proxy/Api/SettingsController.php
View file @
d61fb7f9
...
...
@@ -100,32 +100,13 @@ class SettingsController extends ApiControllerBase
public
function
searchRemoteBlacklistsAction
()
{
$this
->
sessionClose
();
// fetch query parameters
$itemsPerPage
=
$this
->
request
->
getPost
(
'rowCount'
,
'int'
,
9999
);
$currentPage
=
$this
->
request
->
getPost
(
'current'
,
'int'
,
1
);
$sortBy
=
array
(
"filename"
);
$sortDescending
=
false
;
if
(
$this
->
request
->
hasPost
(
'sort'
)
&&
is_array
(
$this
->
request
->
getPost
(
"sort"
)))
{
$sortBy
=
array_keys
(
$this
->
request
->
getPost
(
"sort"
));
if
(
$this
->
request
->
getPost
(
"sort"
)[
$sortBy
[
0
]]
==
"desc"
)
{
$sortDescending
=
true
;
}
}
$searchPhrase
=
$this
->
request
->
getPost
(
'searchPhrase'
,
'string'
,
''
);
// create model and fetch query resuls
$fields
=
array
(
"enabled"
,
"filename"
,
"url"
,
"description"
);
$mdlProxy
=
new
Proxy
();
$grid
=
new
UIModelGrid
(
$mdlProxy
->
forward
->
acl
->
remoteACLs
->
blacklists
->
blacklist
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
return
$grid
->
fetchBindRequest
(
$this
->
request
,
array
(
"enabled"
,
"filename"
,
"url"
,
"description"
),
"description"
);
}
/**
...
...
src/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/Api/SettingsController.php
View file @
d61fb7f9
...
...
@@ -196,32 +196,14 @@ class SettingsController extends ApiControllerBase
*/
public
function
searchPipesAction
()
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
// fetch query parameters
$itemsPerPage
=
$this
->
request
->
getPost
(
'rowCount'
,
'int'
,
9999
);
$currentPage
=
$this
->
request
->
getPost
(
'current'
,
'int'
,
1
);
$sortBy
=
array
(
"number"
);
$sortDescending
=
false
;
if
(
$this
->
request
->
hasPost
(
'sort'
)
&&
is_array
(
$this
->
request
->
getPost
(
"sort"
)))
{
$sortBy
=
array_keys
(
$this
->
request
->
getPost
(
"sort"
));
if
(
$this
->
request
->
getPost
(
"sort"
)[
$sortBy
[
0
]]
==
"desc"
)
{
$sortDescending
=
true
;
}
}
$searchPhrase
=
$this
->
request
->
getPost
(
'searchPhrase'
,
'string'
,
''
);
// create model and fetch query resuls
$fields
=
array
(
"enabled"
,
"number"
,
"bandwidth"
,
"bandwidthMetric"
,
"burst"
,
"description"
,
"mask"
,
"origin"
);
$mdlShaper
=
new
TrafficShaper
();
$grid
=
new
UIModelGrid
(
$mdlShaper
->
pipes
->
pipe
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
}
else
{
return
array
();
}
$this
->
sessionClose
();
$mdlShaper
=
new
TrafficShaper
();
$grid
=
new
UIModelGrid
(
$mdlShaper
->
pipes
->
pipe
);
return
$grid
->
fetchBindRequest
(
$this
->
request
,
array
(
"enabled"
,
"number"
,
"bandwidth"
,
"bandwidthMetric"
,
"burst"
,
"description"
,
"mask"
,
"origin"
),
"number"
);
}
/**
...
...
@@ -230,32 +212,14 @@ class SettingsController extends ApiControllerBase
*/
public
function
searchQueuesAction
()
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
// fetch query parameters
$itemsPerPage
=
$this
->
request
->
getPost
(
'rowCount'
,
'int'
,
9999
);
$currentPage
=
$this
->
request
->
getPost
(
'current'
,
'int'
,
1
);
$sortBy
=
array
(
"number"
);
$sortDescending
=
false
;
if
(
$this
->
request
->
hasPost
(
'sort'
)
&&
is_array
(
$this
->
request
->
getPost
(
"sort"
)))
{
$sortBy
=
array_keys
(
$this
->
request
->
getPost
(
"sort"
));
if
(
$this
->
request
->
getPost
(
"sort"
)[
$sortBy
[
0
]]
==
"desc"
)
{
$sortDescending
=
true
;
}
}
$searchPhrase
=
$this
->
request
->
getPost
(
'searchPhrase'
,
'string'
,
''
);
// create model and fetch query resuls
$fields
=
array
(
"enabled"
,
"number"
,
"pipe"
,
"weight"
,
"description"
,
"mask"
,
"origin"
);
$mdlShaper
=
new
TrafficShaper
();
$grid
=
new
UIModelGrid
(
$mdlShaper
->
queues
->
queue
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
}
else
{
return
array
();
}
$this
->
sessionClose
();
$mdlShaper
=
new
TrafficShaper
();
$grid
=
new
UIModelGrid
(
$mdlShaper
->
queues
->
queue
);
return
$grid
->
fetchBindRequest
(
$this
->
request
,
array
(
"enabled"
,
"number"
,
"pipe"
,
"weight"
,
"description"
,
"mask"
,
"origin"
),
"number"
);
}
/**
...
...
@@ -379,31 +343,14 @@ class SettingsController extends ApiControllerBase
*/
public
function
searchRulesAction
()
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
// fetch query parameters
$itemsPerPage
=
$this
->
request
->
getPost
(
'rowCount'
,
'int'
,
9999
);
$currentPage
=
$this
->
request
->
getPost
(
'current'
,
'int'
,
1
);
$sortBy
=
array
(
"sequence"
);
$sortDescending
=
false
;
if
(
$this
->
request
->
hasPost
(
'sort'
)
&&
is_array
(
$this
->
request
->
getPost
(
"sort"
)))
{
$sortBy
=
array_keys
(
$this
->
request
->
getPost
(
"sort"
));
if
(
$this
->
request
->
getPost
(
"sort"
)[
$sortBy
[
0
]]
==
"desc"
)
{
$sortDescending
=
true
;
}
}
$searchPhrase
=
$this
->
request
->
getPost
(
'searchPhrase'
,
'string'
,
''
);
// create model and fetch query resuls
$fields
=
array
(
"interface"
,
"proto"
,
"source"
,
"destination"
,
"description"
,
"origin"
,
"sequence"
,
"target"
);
$mdlShaper
=
new
TrafficShaper
();
$grid
=
new
UIModelGrid
(
$mdlShaper
->
rules
->
rule
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
}
else
{
return
array
();
}
$this
->
sessionClose
();
$mdlShaper
=
new
TrafficShaper
();
$grid
=
new
UIModelGrid
(
$mdlShaper
->
rules
->
rule
);
return
$grid
->
fetchBindRequest
(
$this
->
request
,
array
(
"interface"
,
"proto"
,
"source"
,
"destination"
,
"description"
,
"origin"
,
"sequence"
,
"target"
),
"sequence"
);
}
/**
...
...
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