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
3c7069f7
Commit
3c7069f7
authored
Apr 21, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mvc: style sweep
parent
2bc8e64b
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
16 additions
and
32 deletions
+16
-32
services.php
src/opnsense/mvc/app/config/services.php
+0
-1
services_api.php
src/opnsense/mvc/app/config/services_api.php
+0
-1
NetworkinsightController.php
...ers/OPNsense/Diagnostics/Api/NetworkinsightController.php
+16
-10
SystemhealthController.php
...llers/OPNsense/Diagnostics/Api/SystemhealthController.php
+0
-7
ServiceController.php
...vc/app/controllers/OPNsense/IDS/Api/ServiceController.php
+0
-1
SettingsController.php
...app/controllers/OPNsense/Proxy/Api/SettingsController.php
+0
-1
Radius.php
src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php
+0
-4
Backend.php
src/opnsense/mvc/app/library/OPNsense/Core/Backend.php
+0
-1
BaseModel.php
src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php
+0
-3
BaseField.php
...nse/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php
+0
-2
ACL.php
src/opnsense/mvc/app/models/OPNsense/Core/ACL.php
+0
-1
No files found.
src/opnsense/mvc/app/config/services.php
View file @
3c7069f7
...
@@ -155,7 +155,6 @@ $di->set('router', function () {
...
@@ -155,7 +155,6 @@ $di->set('router', function () {
"action"
=>
2
,
"action"
=>
2
,
"params"
=>
3
"params"
=>
3
));
));
}
}
$router
->
handle
();
$router
->
handle
();
...
...
src/opnsense/mvc/app/config/services_api.php
View file @
3c7069f7
...
@@ -144,7 +144,6 @@ $di->set('router', function () {
...
@@ -144,7 +144,6 @@ $di->set('router', function () {
"action"
=>
2
,
"action"
=>
2
,
"params"
=>
3
"params"
=>
3
));
));
}
}
$router
->
handle
();
$router
->
handle
();
...
...
src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetworkinsightController.php
View file @
3c7069f7
<?php
<?php
/**
/**
* Copyright (C) 2016 Deciso B.V.
* Copyright (C) 2016 Deciso B.V.
*
*
...
@@ -52,7 +53,7 @@ class NetworkinsightController extends ApiControllerBase
...
@@ -52,7 +53,7 @@ class NetworkinsightController extends ApiControllerBase
* @param string $field field name to aggregate
* @param string $field field name to aggregate
* @return array timeseries
* @return array timeseries
*/
*/
public
function
timeserieAction
(
public
function
timeserieAction
(
$provider
=
null
,
$provider
=
null
,
$measure
=
null
,
$measure
=
null
,
$from_date
=
null
,
$from_date
=
null
,
...
@@ -74,9 +75,14 @@ class NetworkinsightController extends ApiControllerBase
...
@@ -74,9 +75,14 @@ class NetworkinsightController extends ApiControllerBase
if
(
$this
->
request
->
isGet
())
{
if
(
$this
->
request
->
isGet
())
{
$backend
=
new
Backend
();
$backend
=
new
Backend
();
// request current data
// request current data
$response
=
$backend
->
configdRun
(
"netflow aggregate fetch
{
$provider
}
{
$from_date
}
{
$to_date
}
{
$resolution
}
{
$field
}
"
);
//
$response
=
$backend
->
configdRun
(
"netflow aggregate fetch
{
$provider
}
{
$from_date
}
{
$to_date
}
{
$resolution
}
{
$field
}
"
);
// for test, request random data
// for test, request random data
//$response = $backend->configdRun("netflow aggregate fetch {$provider} {$from_date} {$to_date} {$resolution} {$field} em0,in~em0,out~em1,in~em1,out~em2,in~em2,out~em3,in~em3,out"); //
//$response = $backend->configdRun(
// "netflow aggregate fetch {$provider} {$from_date} {$to_date} {$resolution} {$field} " .
// "em0,in~em0,out~em1,in~em1,out~em2,in~em2,out~em3,in~em3,out"
//);
$graph_data
=
json_decode
(
$response
,
true
);
$graph_data
=
json_decode
(
$response
,
true
);
if
(
$graph_data
!=
null
)
{
if
(
$graph_data
!=
null
)
{
ksort
(
$graph_data
);
ksort
(
$graph_data
);
...
@@ -121,7 +127,7 @@ class NetworkinsightController extends ApiControllerBase
...
@@ -121,7 +127,7 @@ class NetworkinsightController extends ApiControllerBase
* @param string $max_hits maximum number of results
* @param string $max_hits maximum number of results
* @return array timeseries
* @return array timeseries
*/
*/
public
function
topAction
(
public
function
topAction
(
$provider
=
null
,
$provider
=
null
,
$from_date
=
null
,
$from_date
=
null
,
$to_date
=
null
,
$to_date
=
null
,
...
@@ -208,7 +214,7 @@ class NetworkinsightController extends ApiControllerBase
...
@@ -208,7 +214,7 @@ class NetworkinsightController extends ApiControllerBase
public
function
getProtocolsAction
()
public
function
getProtocolsAction
()
{
{
$result
=
array
();
$result
=
array
();
foreach
(
explode
(
"
\n
"
,
file_get_contents
(
'/etc/protocols'
))
as
$line
)
{
foreach
(
explode
(
"
\n
"
,
file_get_contents
(
'/etc/protocols'
))
as
$line
)
{
if
(
strlen
(
$line
)
>
1
&&
$line
[
0
]
!=
'#'
)
{
if
(
strlen
(
$line
)
>
1
&&
$line
[
0
]
!=
'#'
)
{
$parts
=
preg_split
(
'/\s+/'
,
$line
);
$parts
=
preg_split
(
'/\s+/'
,
$line
);
if
(
count
(
$parts
)
>=
4
)
{
if
(
count
(
$parts
)
>=
4
)
{
...
@@ -225,7 +231,7 @@ class NetworkinsightController extends ApiControllerBase
...
@@ -225,7 +231,7 @@ class NetworkinsightController extends ApiControllerBase
public
function
getServicesAction
()
public
function
getServicesAction
()
{
{
$result
=
array
();
$result
=
array
();
foreach
(
explode
(
"
\n
"
,
file_get_contents
(
'/etc/services'
))
as
$line
)
{
foreach
(
explode
(
"
\n
"
,
file_get_contents
(
'/etc/services'
))
as
$line
)
{
if
(
strlen
(
$line
)
>
1
&&
$line
[
0
]
!=
'#'
)
{
if
(
strlen
(
$line
)
>
1
&&
$line
[
0
]
!=
'#'
)
{
// there a few ports which have different names for different protocols, but to not overcomplicate
// there a few ports which have different names for different protocols, but to not overcomplicate
// things here, we ignore those exceptions.
// things here, we ignore those exceptions.
...
@@ -247,7 +253,7 @@ class NetworkinsightController extends ApiControllerBase
...
@@ -247,7 +253,7 @@ class NetworkinsightController extends ApiControllerBase
* @param string $resolution resolution in seconds
* @param string $resolution resolution in seconds
* @return string csv output
* @return string csv output
*/
*/
public
function
exportAction
(
public
function
exportAction
(
$provider
=
null
,
$provider
=
null
,
$from_date
=
null
,
$from_date
=
null
,
$to_date
=
null
,
$to_date
=
null
,
...
@@ -255,9 +261,9 @@ class NetworkinsightController extends ApiControllerBase
...
@@ -255,9 +261,9 @@ class NetworkinsightController extends ApiControllerBase
)
{
)
{
$this
->
response
->
setContentType
(
'application/CSV'
,
'UTF-8'
);
$this
->
response
->
setContentType
(
'application/CSV'
,
'UTF-8'
);
$this
->
response
->
setHeader
(
$this
->
response
->
setHeader
(
'Content-Disposition:'
,
'Content-Disposition:'
,
"Attachment; filename=
\"
"
.
$provider
.
".csv
\"
"
"Attachment; filename=
\"
"
.
$provider
.
".csv
\"
"
);
);
if
(
$this
->
request
->
isGet
())
{
if
(
$this
->
request
->
isGet
())
{
$backend
=
new
Backend
();
$backend
=
new
Backend
();
$configd_cmd
=
"netflow aggregate export
{
$provider
}
{
$from_date
}
{
$to_date
}
{
$resolution
}
"
;
$configd_cmd
=
"netflow aggregate export
{
$provider
}
{
$from_date
}
{
$to_date
}
{
$resolution
}
"
;
...
...
src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php
View file @
3c7069f7
...
@@ -71,7 +71,6 @@ class SystemhealthController extends ApiControllerBase
...
@@ -71,7 +71,6 @@ class SystemhealthController extends ApiControllerBase
"recorded_time"
=>
(
$step
*
(
int
)
$value
->
pdp_per_row
)
*
"recorded_time"
=>
(
$step
*
(
int
)
$value
->
pdp_per_row
)
*
(
$this
->
countRows
(
$value
)
-
$firstValue_rowNumber
)
(
$this
->
countRows
(
$value
)
-
$firstValue_rowNumber
)
]);
]);
}
}
}
}
return
(
$info
);
return
(
$info
);
...
@@ -224,7 +223,6 @@ class SystemhealthController extends ApiControllerBase
...
@@ -224,7 +223,6 @@ class SystemhealthController extends ApiControllerBase
$last
=
$rra_info
[
0
][
"firstValue_timestamp"
];
$last
=
$rra_info
[
0
][
"firstValue_timestamp"
];
$first
=
$rra_info
[
$last_rra_key
][
"firstValue_timestamp"
]
+
$rra_info
[
$last_rra_key
][
"recorded_time"
]
-
$first
=
$rra_info
[
$last_rra_key
][
"firstValue_timestamp"
]
+
$rra_info
[
$last_rra_key
][
"recorded_time"
]
-
$rra_info
[
$last_rra_key
][
"full_step"
];
$rra_info
[
$last_rra_key
][
"full_step"
];
}
else
{
}
else
{
$first
=
0
;
$first
=
0
;
$last
=
0
;
$last
=
0
;
...
@@ -370,7 +368,6 @@ class SystemhealthController extends ApiControllerBase
...
@@ -370,7 +368,6 @@ class SystemhealthController extends ApiControllerBase
$skip_nan
=
true
;
$skip_nan
=
true
;
$condensed_row_values
[
$count_values
][
$column_counter
]
=
"NaN"
;
$condensed_row_values
[
$count_values
][
$column_counter
]
=
"NaN"
;
}
elseif
(
$skip_nan
==
false
)
{
}
elseif
(
$skip_nan
==
false
)
{
if
(
$archValue
[
"type"
]
==
"overview"
)
{
if
(
$archValue
[
"type"
]
==
"overview"
)
{
// overwrite this values and skip averaging, looks better for overview
// overwrite this values and skip averaging, looks better for overview
...
@@ -424,12 +421,9 @@ class SystemhealthController extends ApiControllerBase
...
@@ -424,12 +421,9 @@ class SystemhealthController extends ApiControllerBase
}
}
}
}
$rowCount
++
;
$rowCount
++
;
}
}
}
}
}
}
}
}
$key_counter
++
;
$key_counter
++
;
...
@@ -555,7 +549,6 @@ class SystemhealthController extends ApiControllerBase
...
@@ -555,7 +549,6 @@ class SystemhealthController extends ApiControllerBase
if
(
trim
((
string
)
$xml
->
rra
[
$count
]
->
cf
)
!=
"AVERAGE"
)
{
if
(
trim
((
string
)
$xml
->
rra
[
$count
]
->
cf
)
!=
"AVERAGE"
)
{
unset
(
$xml
->
rra
[
$count
]);
unset
(
$xml
->
rra
[
$count
]);
}
}
}
}
$data_sets_full
=
$this
->
getDataSetInfo
(
$xml
);
// get dataSet information to include in answer
$data_sets_full
=
$this
->
getDataSetInfo
(
$xml
);
// get dataSet information to include in answer
...
...
src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/ServiceController.php
View file @
3c7069f7
...
@@ -166,7 +166,6 @@ class ServiceController extends ApiControllerBase
...
@@ -166,7 +166,6 @@ class ServiceController extends ApiControllerBase
}
else
{
}
else
{
$status
=
"error generating ids template ("
.
$bckresult
.
")"
;
$status
=
"error generating ids template ("
.
$bckresult
.
")"
;
}
}
}
}
return
array
(
"status"
=>
$status
);
return
array
(
"status"
=>
$status
);
}
}
...
...
src/opnsense/mvc/app/controllers/OPNsense/Proxy/Api/SettingsController.php
View file @
3c7069f7
...
@@ -85,7 +85,6 @@ class SettingsController extends ApiControllerBase
...
@@ -85,7 +85,6 @@ class SettingsController extends ApiControllerBase
$cnf
->
save
();
$cnf
->
save
();
$result
[
"result"
]
=
"saved"
;
$result
[
"result"
]
=
"saved"
;
}
}
}
}
return
$result
;
return
$result
;
...
...
src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php
View file @
3c7069f7
...
@@ -171,7 +171,6 @@ class Radius implements IAuthConnector
...
@@ -171,7 +171,6 @@ class Radius implements IAuthConnector
break
;
break
;
default
:
default
:
syslog
(
LOG_ERR
,
"Unexpected return value:
$radius
\n
"
);
syslog
(
LOG_ERR
,
"Unexpected return value:
$radius
\n
"
);
}
}
radius_close
(
$radius
);
radius_close
(
$radius
);
}
}
...
@@ -240,7 +239,6 @@ class Radius implements IAuthConnector
...
@@ -240,7 +239,6 @@ class Radius implements IAuthConnector
break
;
break
;
default
:
default
:
syslog
(
LOG_ERR
,
"Unexpected return value:
$radius
\n
"
);
syslog
(
LOG_ERR
,
"Unexpected return value:
$radius
\n
"
);
}
}
radius_close
(
$radius
);
radius_close
(
$radius
);
}
}
...
@@ -310,7 +308,6 @@ class Radius implements IAuthConnector
...
@@ -310,7 +308,6 @@ class Radius implements IAuthConnector
break
;
break
;
default
:
default
:
syslog
(
LOG_ERR
,
"Unexpected return value:
$radius
\n
"
);
syslog
(
LOG_ERR
,
"Unexpected return value:
$radius
\n
"
);
}
}
radius_close
(
$radius
);
radius_close
(
$radius
);
}
}
...
@@ -388,7 +385,6 @@ class Radius implements IAuthConnector
...
@@ -388,7 +385,6 @@ class Radius implements IAuthConnector
default
:
default
:
break
;
break
;
}
}
}
}
return
true
;
return
true
;
break
;
break
;
...
...
src/opnsense/mvc/app/library/OPNsense/Core/Backend.php
View file @
3c7069f7
...
@@ -119,7 +119,6 @@ class Backend
...
@@ -119,7 +119,6 @@ class Backend
$this
->
getLogger
()
->
error
(
"Timeout ("
.
$timeout
.
") executing : "
.
$event
);
$this
->
getLogger
()
->
error
(
"Timeout ("
.
$timeout
.
") executing : "
.
$event
);
return
null
;
return
null
;
}
}
}
}
return
str_replace
(
$endOfStream
,
""
,
$resp
);
return
str_replace
(
$endOfStream
,
""
,
$resp
);
...
...
src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php
View file @
3c7069f7
...
@@ -189,7 +189,6 @@ abstract class BaseModel
...
@@ -189,7 +189,6 @@ abstract class BaseModel
// add object as child to this node
// add object as child to this node
$internal_data
->
addChildNode
(
$xmlNode
->
getName
(),
$fieldObject
);
$internal_data
->
addChildNode
(
$xmlNode
->
getName
(),
$fieldObject
);
}
}
}
}
}
}
...
@@ -401,7 +400,6 @@ abstract class BaseModel
...
@@ -401,7 +400,6 @@ abstract class BaseModel
}
else
{
}
else
{
$target_node
=
$target_node
->
xpath
(
$str_parts
[
$i
])[
0
];
$target_node
=
$target_node
->
xpath
(
$str_parts
[
$i
])[
0
];
}
}
}
}
}
}
...
@@ -466,7 +464,6 @@ abstract class BaseModel
...
@@ -466,7 +464,6 @@ abstract class BaseModel
}
else
{
}
else
{
return
null
;
return
null
;
}
}
}
}
return
$node
;
return
$node
;
}
}
...
...
src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php
View file @
3c7069f7
...
@@ -499,8 +499,6 @@ abstract class BaseField
...
@@ -499,8 +499,6 @@ abstract class BaseField
foreach
(
$this
->
getAttributes
()
as
$AttrKey
=>
$AttrValue
)
{
foreach
(
$this
->
getAttributes
()
as
$AttrKey
=>
$AttrValue
)
{
$subnode
->
addAttribute
(
$AttrKey
,
$AttrValue
);
$subnode
->
addAttribute
(
$AttrKey
,
$AttrValue
);
}
}
}
}
foreach
(
$this
->
__items
as
$key
=>
$FieldNode
)
{
foreach
(
$this
->
__items
as
$key
=>
$FieldNode
)
{
...
...
src/opnsense/mvc/app/models/OPNsense/Core/ACL.php
View file @
3c7069f7
...
@@ -127,7 +127,6 @@ class ACL
...
@@ -127,7 +127,6 @@ class ACL
$this
->
ACLtags
[
$aclID
]
=
$aclPayload
;
$this
->
ACLtags
[
$aclID
]
=
$aclPayload
;
}
}
}
}
}
}
}
}
...
...
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