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
Show 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
...
@@ -210,30 +210,13 @@ class ServiceController extends ApiControllerBase
*/
*/
public
function
searchTemplatesAction
()
public
function
searchTemplatesAction
()
{
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
$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
();
$mdlCP
=
new
CaptivePortal
();
$grid
=
new
UIModelGrid
(
$mdlCP
->
templates
->
template
);
$grid
=
new
UIModelGrid
(
$mdlCP
->
templates
->
template
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
return
$grid
->
fetchBindRequest
(
}
else
{
$this
->
request
,
return
array
();
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
...
@@ -195,30 +195,13 @@ class SettingsController extends ApiControllerBase
*/
*/
public
function
searchZonesAction
()
public
function
searchZonesAction
()
{
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
$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
();
$mdlCP
=
new
CaptivePortal
();
$grid
=
new
UIModelGrid
(
$mdlCP
->
zones
->
zone
);
$grid
=
new
UIModelGrid
(
$mdlCP
->
zones
->
zone
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
return
$grid
->
fetchBindRequest
(
}
else
{
$this
->
request
,
return
array
();
array
(
"enabled"
,
"description"
,
"zoneid"
),
}
"description"
);
}
}
}
}
src/opnsense/mvc/app/controllers/OPNsense/Cron/Api/SettingsController.php
View file @
d61fb7f9
...
@@ -202,24 +202,7 @@ class SettingsController extends ApiControllerBase
...
@@ -202,24 +202,7 @@ class SettingsController extends ApiControllerBase
*/
*/
public
function
searchJobsAction
()
public
function
searchJobsAction
()
{
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
$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
(
$fields
=
array
(
"enabled"
,
"enabled"
,
"minutes"
,
"minutes"
,
...
@@ -234,10 +217,10 @@ class SettingsController extends ApiControllerBase
...
@@ -234,10 +217,10 @@ class SettingsController extends ApiControllerBase
);
);
$mdlCron
=
new
Cron
();
$mdlCron
=
new
Cron
();
$grid
=
new
UIModelGrid
(
$mdlCron
->
jobs
->
job
);
$grid
=
new
UIModelGrid
(
$mdlCron
->
jobs
->
job
);
return
$grid
->
fetchBindRequest
(
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
$this
->
request
,
}
else
{
$fields
,
return
array
();
"description"
}
);
}
}
}
}
src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php
View file @
d61fb7f9
...
@@ -495,31 +495,14 @@ class SettingsController extends ApiControllerBase
...
@@ -495,31 +495,14 @@ class SettingsController extends ApiControllerBase
*/
*/
public
function
searchFingerprintAction
()
public
function
searchFingerprintAction
()
{
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
$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
();
$mdlIDS
=
$this
->
getModel
();
$grid
=
new
UIModelGrid
(
$mdlIDS
->
rules
->
fingerprint
);
$grid
=
new
UIModelGrid
(
$mdlIDS
->
rules
->
fingerprint
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
return
$grid
->
fetchBindRequest
(
}
else
{
$this
->
request
,
return
array
();
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
...
@@ -100,32 +100,13 @@ class SettingsController extends ApiControllerBase
public
function
searchRemoteBlacklistsAction
()
public
function
searchRemoteBlacklistsAction
()
{
{
$this
->
sessionClose
();
$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
();
$mdlProxy
=
new
Proxy
();
$grid
=
new
UIModelGrid
(
$mdlProxy
->
forward
->
acl
->
remoteACLs
->
blacklists
->
blacklist
);
$grid
=
new
UIModelGrid
(
$mdlProxy
->
forward
->
acl
->
remoteACLs
->
blacklists
->
blacklist
);
return
$grid
->
fetchBindRequest
(
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
$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
...
@@ -196,32 +196,14 @@ class SettingsController extends ApiControllerBase
*/
*/
public
function
searchPipesAction
()
public
function
searchPipesAction
()
{
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
$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
();
$mdlShaper
=
new
TrafficShaper
();
$grid
=
new
UIModelGrid
(
$mdlShaper
->
pipes
->
pipe
);
$grid
=
new
UIModelGrid
(
$mdlShaper
->
pipes
->
pipe
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
return
$grid
->
fetchBindRequest
(
}
else
{
$this
->
request
,
return
array
();
array
(
"enabled"
,
"number"
,
"bandwidth"
,
"bandwidthMetric"
,
"burst"
,
"description"
,
"mask"
,
"origin"
),
}
"number"
);
}
}
/**
/**
...
@@ -230,32 +212,14 @@ class SettingsController extends ApiControllerBase
...
@@ -230,32 +212,14 @@ class SettingsController extends ApiControllerBase
*/
*/
public
function
searchQueuesAction
()
public
function
searchQueuesAction
()
{
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
$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
();
$mdlShaper
=
new
TrafficShaper
();
$grid
=
new
UIModelGrid
(
$mdlShaper
->
queues
->
queue
);
$grid
=
new
UIModelGrid
(
$mdlShaper
->
queues
->
queue
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
return
$grid
->
fetchBindRequest
(
}
else
{
$this
->
request
,
return
array
();
array
(
"enabled"
,
"number"
,
"pipe"
,
"weight"
,
"description"
,
"mask"
,
"origin"
),
}
"number"
);
}
}
/**
/**
...
@@ -379,31 +343,14 @@ class SettingsController extends ApiControllerBase
...
@@ -379,31 +343,14 @@ class SettingsController extends ApiControllerBase
*/
*/
public
function
searchRulesAction
()
public
function
searchRulesAction
()
{
{
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
$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
();
$mdlShaper
=
new
TrafficShaper
();
$grid
=
new
UIModelGrid
(
$mdlShaper
->
rules
->
rule
);
$grid
=
new
UIModelGrid
(
$mdlShaper
->
rules
->
rule
);
return
$grid
->
fetch
(
$fields
,
$itemsPerPage
,
$currentPage
,
$sortBy
,
$sortDescending
,
$searchPhrase
);
return
$grid
->
fetchBindRequest
(
}
else
{
$this
->
request
,
return
array
();
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