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) {
...
@@ -42,7 +42,7 @@ $di->set('view', function () use ($config) {
'compiledSeparator'
=>
'_'
'compiledSeparator'
=>
'_'
));
));
// register additional volt template functions
// 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
.
")"
;
$chk_path
=
"str_replace('/ui/','/usr/local/opnsense/www/',"
.
$local_url
.
")"
;
$js_tag
=
"'<script type=
\"
text/javascript
\"
src=
\"
'.
$local_url
.'
\"
></script>'"
;
$js_tag
=
"'<script type=
\"
text/javascript
\"
src=
\"
'.
$local_url
.'
\"
></script>'"
;
return
"file_exists("
.
$chk_path
.
") ? "
.
$js_tag
.
" :''"
;
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
...
@@ -76,7 +76,7 @@ class FilterRule
* @param int $maxsize maximum size, cut when longer
* @param int $maxsize maximum size, cut when longer
* @return string
* @return string
*/
*/
private
function
parsePlain
(
$value
,
$prefix
=
""
,
$suffix
=
""
,
$maxsize
=
null
)
private
function
parsePlain
(
$value
,
$prefix
=
""
,
$suffix
=
""
,
$maxsize
=
null
)
{
{
if
(
!
empty
(
$maxsize
)
&&
strlen
(
$value
)
>
$maxsize
)
{
if
(
!
empty
(
$maxsize
)
&&
strlen
(
$value
)
>
$maxsize
)
{
$value
=
substr
(
$value
,
0
,
$maxsize
);
$value
=
substr
(
$value
,
0
,
$maxsize
);
...
@@ -90,7 +90,7 @@ class FilterRule
...
@@ -90,7 +90,7 @@ class FilterRule
* @param string $map
* @param string $map
* @return string
* @return string
*/
*/
private
function
parseReplaceSimple
(
$value
,
$map
,
$prefix
=
""
,
$suffix
=
""
)
private
function
parseReplaceSimple
(
$value
,
$map
,
$prefix
=
""
,
$suffix
=
""
)
{
{
$retval
=
$value
;
$retval
=
$value
;
foreach
(
explode
(
'|'
,
$map
)
as
$item
)
{
foreach
(
explode
(
'|'
,
$map
)
as
$item
)
{
...
@@ -145,7 +145,7 @@ class FilterRule
...
@@ -145,7 +145,7 @@ class FilterRule
* @param string $value field value
* @param string $value field value
* @return string
* @return string
*/
*/
private
function
parseBool
(
$value
,
$valueTrue
,
$valueFalse
=
""
)
private
function
parseBool
(
$value
,
$valueTrue
,
$valueFalse
=
""
)
{
{
if
(
!
empty
(
$value
))
{
if
(
!
empty
(
$value
))
{
return
!
empty
(
$valueTrue
)
?
$valueTrue
.
" "
:
""
;
return
!
empty
(
$valueTrue
)
?
$valueTrue
.
" "
:
""
;
...
@@ -201,21 +201,21 @@ class FilterRule
...
@@ -201,21 +201,21 @@ class FilterRule
}
}
if
(
!
isset
(
$tmp
[
'quick'
]))
{
if
(
!
isset
(
$tmp
[
'quick'
]))
{
// all rules are quick by default except floating
// 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
// restructure state settings for easier output parsing
if
(
!
empty
(
$tmp
[
'statetype'
]))
{
if
(
!
empty
(
$tmp
[
'statetype'
]))
{
$tmp
[
'state'
]
=
array
(
'type'
=>
'keep'
,
'options'
=>
array
());
$tmp
[
'state'
]
=
array
(
'type'
=>
'keep'
,
'options'
=>
array
());
switch
(
$tmp
[
'statetype'
])
{
switch
(
$tmp
[
'statetype'
])
{
case
'none'
:
case
'none'
:
$tmp
[
'state'
][
'type'
]
=
'no'
;
$tmp
[
'state'
][
'type'
]
=
'no'
;
break
;
break
;
case
'sloppy state'
:
case
'sloppy state'
:
$tmp
[
'state'
][
'type'
]
=
'keep'
;
$tmp
[
'state'
][
'type'
]
=
'keep'
;
$tmp
[
'state'
][
'options'
][]
=
"sloppy "
;
$tmp
[
'state'
][
'options'
][]
=
"sloppy "
;
break
;
break
;
default
:
default
:
$tmp
[
'state'
][
'type'
]
=
explode
(
' '
,
$tmp
[
'statetype'
])[
0
];
$tmp
[
'state'
][
'type'
]
=
explode
(
' '
,
$tmp
[
'statetype'
])[
0
];
}
}
if
(
!
empty
(
$tmp
[
'nopfsync'
]))
{
if
(
!
empty
(
$tmp
[
'nopfsync'
]))
{
$tmp
[
'state'
][
'options'
][]
=
"no-sync "
;
$tmp
[
'state'
][
'options'
][]
=
"no-sync "
;
...
@@ -254,7 +254,7 @@ class FilterRule
...
@@ -254,7 +254,7 @@ class FilterRule
* output rule as string
* output rule as string
* @return string ruleset
* @return string ruleset
*/
*/
public
function
__toString
()
public
function
__toString
()
{
{
$ruleTxt
=
''
;
$ruleTxt
=
''
;
foreach
(
$this
->
fetchActualRules
()
as
$rule
)
{
foreach
(
$this
->
fetchActualRules
()
as
$rule
)
{
...
...
src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php
View file @
4b61811b
...
@@ -74,7 +74,7 @@ class Plugin
...
@@ -74,7 +74,7 @@ class Plugin
* @param string $placement placement head,tail
* @param string $placement placement head,tail
* @return null
* @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
));
$anchorKey
=
sprintf
(
"%s.%s.%08d.%08d"
,
$type
,
$placement
,
$priority
,
count
(
$this
->
anchors
));
$this
->
anchors
[
$anchorKey
]
=
$name
;
$this
->
anchors
[
$anchorKey
]
=
$name
;
...
@@ -87,7 +87,7 @@ class Plugin
...
@@ -87,7 +87,7 @@ class Plugin
* @param string $placement placement head,tail
* @param string $placement placement head,tail
* @return string
* @return string
*/
*/
public
function
anchorToText
(
$types
=
"fw"
,
$placement
=
"tail"
)
public
function
anchorToText
(
$types
=
"fw"
,
$placement
=
"tail"
)
{
{
$result
=
""
;
$result
=
""
;
foreach
(
explode
(
','
,
$types
)
as
$type
)
{
foreach
(
explode
(
','
,
$types
)
as
$type
)
{
...
@@ -107,7 +107,7 @@ class Plugin
...
@@ -107,7 +107,7 @@ class Plugin
* @param array $conf configuration
* @param array $conf configuration
* @param array $defaults merge these defaults when provided
* @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
)
{
if
(
$defaults
!=
null
)
{
$conf
=
array_merge
(
$defaults
,
$conf
);
$conf
=
array_merge
(
$defaults
,
$conf
);
...
...
src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php
View file @
4b61811b
...
@@ -469,7 +469,7 @@ abstract class BaseModel
...
@@ -469,7 +469,7 @@ abstract class BaseModel
if
(
$messages
->
count
()
>
0
)
{
if
(
$messages
->
count
()
>
0
)
{
$exception_msg
=
""
;
$exception_msg
=
""
;
foreach
(
$messages
as
$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_part
.=
$msg
->
getMessage
();
$exception_msg
.=
"
$exception_msg_part
\n
"
;
$exception_msg
.=
"
$exception_msg_part
\n
"
;
// always log validation errors
// 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