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
4b61811b
Commit
4b61811b
authored
Nov 05, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: style sweep
parent
c2cd032c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
19 deletions
+19
-19
services.php
src/opnsense/mvc/app/config/services.php
+1
-1
FilterRule.php
...opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php
+14
-14
Plugin.php
src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php
+3
-3
BaseModel.php
src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php
+1
-1
No files found.
src/opnsense/mvc/app/config/services.php
View file @
4b61811b
...
...
@@ -42,7 +42,7 @@ $di->set('view', function () use ($config) {
'compiledSeparator'
=>
'_'
));
// register additional volt template functions
$volt
->
getCompiler
()
->
addFunction
(
'javascript_include_when_exists'
,
function
(
$local_url
)
{
$volt
->
getCompiler
()
->
addFunction
(
'javascript_include_when_exists'
,
function
(
$local_url
)
{
$chk_path
=
"str_replace('/ui/','/usr/local/opnsense/www/',"
.
$local_url
.
")"
;
$js_tag
=
"'<script type=
\"
text/javascript
\"
src=
\"
'.
$local_url
.'
\"
></script>'"
;
return
"file_exists("
.
$chk_path
.
") ? "
.
$js_tag
.
" :''"
;
...
...
src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php
View file @
4b61811b
...
...
@@ -76,7 +76,7 @@ class FilterRule
* @param int $maxsize maximum size, cut when longer
* @return string
*/
private
function
parsePlain
(
$value
,
$prefix
=
""
,
$suffix
=
""
,
$maxsize
=
null
)
private
function
parsePlain
(
$value
,
$prefix
=
""
,
$suffix
=
""
,
$maxsize
=
null
)
{
if
(
!
empty
(
$maxsize
)
&&
strlen
(
$value
)
>
$maxsize
)
{
$value
=
substr
(
$value
,
0
,
$maxsize
);
...
...
@@ -90,7 +90,7 @@ class FilterRule
* @param string $map
* @return string
*/
private
function
parseReplaceSimple
(
$value
,
$map
,
$prefix
=
""
,
$suffix
=
""
)
private
function
parseReplaceSimple
(
$value
,
$map
,
$prefix
=
""
,
$suffix
=
""
)
{
$retval
=
$value
;
foreach
(
explode
(
'|'
,
$map
)
as
$item
)
{
...
...
@@ -145,7 +145,7 @@ class FilterRule
* @param string $value field value
* @return string
*/
private
function
parseBool
(
$value
,
$valueTrue
,
$valueFalse
=
""
)
private
function
parseBool
(
$value
,
$valueTrue
,
$valueFalse
=
""
)
{
if
(
!
empty
(
$value
))
{
return
!
empty
(
$valueTrue
)
?
$valueTrue
.
" "
:
""
;
...
...
@@ -201,21 +201,21 @@ class FilterRule
}
if
(
!
isset
(
$tmp
[
'quick'
]))
{
// all rules are quick by default except floating
$tmp
[
'quick'
]
=
!
isset
(
$rule
[
'floating'
])
?
true
:
false
;
$tmp
[
'quick'
]
=
!
isset
(
$rule
[
'floating'
])
?
true
:
false
;
}
// restructure state settings for easier output parsing
if
(
!
empty
(
$tmp
[
'statetype'
]))
{
$tmp
[
'state'
]
=
array
(
'type'
=>
'keep'
,
'options'
=>
array
());
switch
(
$tmp
[
'statetype'
])
{
case
'none'
:
$tmp
[
'state'
][
'type'
]
=
'no'
;
break
;
case
'sloppy state'
:
$tmp
[
'state'
][
'type'
]
=
'keep'
;
$tmp
[
'state'
][
'options'
][]
=
"sloppy "
;
break
;
default
:
$tmp
[
'state'
][
'type'
]
=
explode
(
' '
,
$tmp
[
'statetype'
])[
0
];
case
'none'
:
$tmp
[
'state'
][
'type'
]
=
'no'
;
break
;
case
'sloppy state'
:
$tmp
[
'state'
][
'type'
]
=
'keep'
;
$tmp
[
'state'
][
'options'
][]
=
"sloppy "
;
break
;
default
:
$tmp
[
'state'
][
'type'
]
=
explode
(
' '
,
$tmp
[
'statetype'
])[
0
];
}
if
(
!
empty
(
$tmp
[
'nopfsync'
]))
{
$tmp
[
'state'
][
'options'
][]
=
"no-sync "
;
...
...
@@ -254,7 +254,7 @@ class FilterRule
* output rule as string
* @return string ruleset
*/
public
function
__toString
()
public
function
__toString
()
{
$ruleTxt
=
''
;
foreach
(
$this
->
fetchActualRules
()
as
$rule
)
{
...
...
src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php
View file @
4b61811b
...
...
@@ -74,7 +74,7 @@ class Plugin
* @param string $placement placement head,tail
* @return null
*/
public
function
registerAnchor
(
$name
,
$type
=
"fw"
,
$priority
=
0
,
$placement
=
"tail"
)
public
function
registerAnchor
(
$name
,
$type
=
"fw"
,
$priority
=
0
,
$placement
=
"tail"
)
{
$anchorKey
=
sprintf
(
"%s.%s.%08d.%08d"
,
$type
,
$placement
,
$priority
,
count
(
$this
->
anchors
));
$this
->
anchors
[
$anchorKey
]
=
$name
;
...
...
@@ -87,7 +87,7 @@ class Plugin
* @param string $placement placement head,tail
* @return string
*/
public
function
anchorToText
(
$types
=
"fw"
,
$placement
=
"tail"
)
public
function
anchorToText
(
$types
=
"fw"
,
$placement
=
"tail"
)
{
$result
=
""
;
foreach
(
explode
(
','
,
$types
)
as
$type
)
{
...
...
@@ -107,7 +107,7 @@ class Plugin
* @param array $conf configuration
* @param array $defaults merge these defaults when provided
*/
public
function
registerFilterRule
(
$prio
,
$conf
,
$defaults
=
null
)
public
function
registerFilterRule
(
$prio
,
$conf
,
$defaults
=
null
)
{
if
(
$defaults
!=
null
)
{
$conf
=
array_merge
(
$defaults
,
$conf
);
...
...
src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php
View file @
4b61811b
...
...
@@ -469,7 +469,7 @@ abstract class BaseModel
if
(
$messages
->
count
()
>
0
)
{
$exception_msg
=
""
;
foreach
(
$messages
as
$msg
)
{
$exception_msg_part
=
"["
.
str_replace
(
"
\\
"
,
"."
,
get_class
(
$this
))
.
"."
.
$msg
->
getField
()
.
"] "
;
$exception_msg_part
=
"["
.
str_replace
(
"
\\
"
,
"."
,
get_class
(
$this
))
.
"."
.
$msg
->
getField
()
.
"] "
;
$exception_msg_part
.=
$msg
->
getMessage
();
$exception_msg
.=
"
$exception_msg_part
\n
"
;
// always log validation errors
...
...
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