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
16022187
Commit
16022187
authored
Nov 01, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
last one, closes
https://github.com/opnsense/core/issues/303
parent
109da1b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
262 deletions
+0
-262
services_upnp.php
src/www/services_upnp.php
+0
-262
No files found.
src/www/services_upnp.php
View file @
16022187
...
...
@@ -495,39 +495,6 @@ include("head.inc");
echo
$input
;
break
;
case
"password"
:
$size
=
(
$pkga
[
'size'
]
?
" size='
{
$pkga
[
'size'
]
}
' "
:
""
);
$input
=
"<input "
.
$size
.
" id='"
.
$pkga
[
'fieldname'
]
.
"' type='password' name='"
.
$pkga
[
'fieldname'
]
.
"' class='formfld pwd' value=
\"
"
.
htmlspecialchars
(
$value
)
.
"
\"
/>
\n
"
;
$input
.=
"<br />"
.
fixup_string
(
$description
)
.
"
\n
"
;
echo
$input
;
break
;
case
"info"
:
$input
=
fixup_string
(
$description
)
.
"
\n
"
;
echo
$input
;
break
;
case
"select"
:
$fieldname
=
$pkga
[
'fieldname'
];
if
(
isset
(
$pkga
[
'multiple'
]))
{
$multiple
=
'multiple="multiple"'
;
$items
=
explode
(
','
,
$value
);
$fieldname
.=
"[]"
;
}
else
{
$multiple
=
''
;
$items
=
array
(
$value
);
}
$size
=
(
$pkga
[
'size'
]
?
" size='
{
$pkga
[
'size'
]
}
' "
:
""
);
$onchange
=
(
isset
(
$pkga
[
'onchange'
])
?
"onchange=
\"
{
$pkga
[
'onchange'
]
}
\"
"
:
''
);
$input
=
"<select id='"
.
$pkga
[
'fieldname'
]
.
"'
$multiple
$size
$onchange
name=
\"
$fieldname
\"
>
\n
"
;
foreach
(
$pkga
[
'options'
][
'option'
]
as
$opt
)
{
$selected
=
(
in_array
(
$opt
[
'value'
],
$items
)
?
'selected="selected"'
:
''
);
$input
.=
"
\t
<option value=
\"
{
$opt
[
'value'
]
}
\"
{
$selected
}
>
{
$opt
[
'name'
]
}
</option>
\n
"
;
}
$input
.=
"</select>
\n
<br />
\n
"
.
fixup_string
(
$description
)
.
"
\n
"
;
echo
$input
;
break
;
case
"select_source"
:
$fieldname
=
$pkga
[
'fieldname'
];
if
(
isset
(
$pkga
[
'multiple'
]))
{
...
...
@@ -561,17 +528,6 @@ include("head.inc");
echo
$input
;
break
;
case
"vpn_selection"
:
$input
=
"<select id='
{
$pkga
[
'fieldname'
]
}
' name='
{
$vpn
[
'name'
]
}
'>
\n
"
;
foreach
(
$config
[
'ipsec'
][
'phase1'
]
as
$vpn
)
{
$input
.=
"
\t
<option value=
\"
{
$vpn
[
'descr'
]
}
\"
>
{
$vpn
[
'descr'
]
}
</option>
\n
"
;
}
$input
.=
"</select>
\n
"
;
$input
.=
"<br />"
.
fixup_string
(
$description
)
.
"
\n
"
;
echo
$input
;
break
;
case
"checkbox"
:
$checkboxchecked
=
(
$value
==
"on"
?
" checked=
\"
checked
\"
"
:
""
);
$onchange
=
(
isset
(
$pkga
[
'onchange'
])
?
"onchange=
\"
{
$pkga
[
'onchange'
]
}
\"
"
:
''
);
...
...
@@ -582,224 +538,6 @@ include("head.inc");
echo
$input
;
break
;
case
"textarea"
:
if
(
$pkga
[
'rows'
])
$rows
=
" rows='
{
$pkga
[
'rows'
]
}
' "
;
if
(
$pkga
[
'cols'
])
$cols
=
" cols='
{
$pkga
[
'cols'
]
}
' "
;
if
((
$pkga
[
'encoding'
]
==
'base64'
)
&&
!
$get_from_post
&&
!
empty
(
$value
))
$value
=
base64_decode
(
$value
);
$wrap
=
(
$pkga
[
'wrap'
]
==
"off"
?
'wrap="off" style="white-space:nowrap;"'
:
''
);
$input
=
"<textarea
{
$rows
}
{
$cols
}
name='
{
$pkga
[
'fieldname'
]
}
'
{
$wrap
}
>
{
$value
}
</textarea>
\n
"
;
$input
.=
"<br />"
.
fixup_string
(
$description
)
.
"
\n
"
;
echo
$input
;
break
;
case
"aliases"
:
// Use xml tag <typealiases> to filter type aliases
$size
=
(
$pkga
[
'size'
]
?
"size=
\"
{
$pkga
[
'size'
]
}
\"
"
:
''
);
$fieldname
=
$pkga
[
'fieldname'
];
$a_aliases
=
&
$config
[
'aliases'
][
'alias'
];
$addrisfirst
=
0
;
$aliasesaddr
=
""
;
$value
=
"value='
{
$value
}
'"
;
if
(
isset
(
$a_aliases
))
{
if
(
!
empty
(
$pkga
[
'typealiases'
]))
{
foreach
(
$a_aliases
as
$alias
)
if
(
$alias
[
'type'
]
==
$pkga
[
'typealiases'
])
{
if
(
$addrisfirst
==
1
)
$aliasesaddr
.=
","
;
$aliasesaddr
.=
"'"
.
$alias
[
'name'
]
.
"'"
;
$addrisfirst
=
1
;
}
}
else
{
foreach
(
$a_aliases
as
$alias
)
{
if
(
$addrisfirst
==
1
)
$aliasesaddr
.=
","
;
$aliasesaddr
.=
"'"
.
$alias
[
'name'
]
.
"'"
;
$addrisfirst
=
1
;
}
}
}
$input
=
"<input name='
{
$fieldname
}
' type='text' class='formfldalias' id='
{
$fieldname
}
'
{
$size
}
{
$value
}
/>
\n
<br />"
;
$input
.=
fixup_string
(
$description
)
.
"
\n
"
;
$script
=
"<script type='text/javascript'>
\n
"
;
$script
.=
"//<![CDATA[
\n
"
;
$script
.=
"var aliasarray = new Array(
{
$aliasesaddr
}
)
\n
"
;
$script
.=
"var oTextbox1 = new AutoSuggestControl(document.getElementById('
{
$fieldname
}
'), new StateSuggestions(aliasarray))
\n
"
;
$script
.=
"//]]>
\n
"
;
$script
.=
"</script>"
;
echo
$input
;
echo
$script
;
break
;
case
"interfaces_selection"
:
$ips
=
array
();
$interface_regex
=
(
isset
(
$pkga
[
'hideinterfaceregex'
])
?
$pkga
[
'hideinterfaceregex'
]
:
"nointerfacestohide"
);
if
(
is_array
(
$config
[
'interfaces'
]))
foreach
(
$config
[
'interfaces'
]
as
$iface_key
=>
$iface_value
){
if
(
isset
(
$iface_value
[
'enable'
])
&&
!
preg_match
(
"/
$interface_regex
/"
,
$iface_key
)){
$iface_description
=
(
$iface_value
[
'descr'
]
!=
""
?
strtoupper
(
$iface_value
[
'descr'
])
:
strtoupper
(
$iface_key
));
if
(
isset
(
$pkga
[
'showips'
]))
$iface_description
.=
" address"
;
$ips
[]
=
array
(
'ip'
=>
$iface_key
,
'description'
=>
$iface_description
);
}
}
if
(
is_array
(
$config
[
'virtualip'
])
&&
isset
(
$pkga
[
'showvirtualips'
]))
foreach
(
$config
[
'virtualip'
][
'vip'
]
as
$vip
){
if
(
!
preg_match
(
"/
$interface_regex
/"
,
$vip
[
'interface'
]))
$vip_description
=
(
$vip
[
'descr'
]
!=
""
?
" (
{
$vip
[
'descr'
]
}
) "
:
" "
);
switch
(
$vip
[
'mode'
]){
case
"ipalias"
:
case
"carp"
:
$ips
[]
=
array
(
'ip'
=>
$vip
[
'subnet'
],
'description'
=>
"
{
$vip
[
'subnet'
]
}
$vip_description
"
);
break
;
case
"proxyarp"
:
if
(
$vip
[
'type'
]
==
"network"
){
$start
=
ip2long32
(
gen_subnet
(
$vip
[
'subnet'
],
$vip
[
'subnet_bits'
]));
$end
=
ip2long32
(
gen_subnet_max
(
$vip
[
'subnet'
],
$vip
[
'subnet_bits'
]));
$len
=
$end
-
$start
;
for
(
$i
=
0
;
$i
<=
$len
;
$i
++
)
$ips
[]
=
array
(
'ip'
=>
long2ip32
(
$start
+
$i
),
'description'
=>
long2ip32
(
$start
+
$i
)
.
" from
{
$vip
[
'subnet'
]
}
/
{
$vip
[
'subnet_bits'
]
}
{
$vip_description
}
"
);
}
else
{
$ips
[]
=
array
(
'ip'
=>
$vip
[
'subnet'
],
'description'
=>
"
{
$vip
[
'subnet'
]
}
$vip_description
"
);
}
break
;
}
}
sort
(
$ips
);
if
(
isset
(
$pkga
[
'showlistenall'
]))
array_unshift
(
$ips
,
array
(
'ip'
=>
'All'
,
'description'
=>
'Listen on All interfaces/ip addresses '
));
if
(
!
preg_match
(
"/
$interface_regex
/"
,
"loopback"
)){
$iface_description
=
(
isset
(
$pkga
[
'showips'
])
?
"127.0.0.1 (loopback)"
:
"loopback"
);
array_push
(
$ips
,
array
(
'ip'
=>
'lo0'
,
'description'
=>
$iface_description
));
}
#show interfaces array on gui
$size
=
(
$pkga
[
'size'
]
?
"size=
\"
{
$pkga
[
'size'
]
}
\"
"
:
''
);
$multiple
=
''
;
$fieldname
=
$pkga
[
'fieldname'
];
if
(
isset
(
$pkga
[
'multiple'
]))
{
$fieldname
.=
'[]'
;
$multiple
=
'multiple="multiple"'
;
}
$input
=
"<select id='
{
$pkga
[
'fieldname'
]
}
' name=
\"
{
$fieldname
}
\"
{
$size
}
{
$multiple
}
>
\n
"
;
if
(
is_array
(
$value
))
$values
=
$value
;
else
$values
=
explode
(
','
,
$value
);
foreach
(
$ips
as
$iface
){
$selected
=
(
in_array
(
$iface
[
'ip'
],
$values
)
?
'selected="selected"'
:
''
);
$input
.=
"<option value=
\"
{
$iface
[
'ip'
]
}
\"
{
$selected
}
>
{
$iface
[
'description'
]
}
</option>
\n
"
;
}
$input
.=
"</select>
\n
<br />"
.
fixup_string
(
$description
)
.
"
\n
"
;
echo
$input
;
break
;
case
"radio"
:
$input
=
"<input type='radio' id='
{
$pkga
[
'fieldname'
]
}
' name='
{
$pkga
[
'fieldname'
]
}
' value='
{
$value
}
' />"
;
echo
$input
;
break
;
case
"button"
:
$input
=
"<input type='submit' id='
{
$pkga
[
'fieldname'
]
}
' name='
{
$pkga
[
'fieldname'
]
}
' class='formbtn' value='
{
$pkga
[
'fieldname'
]
}
' />
\n
"
;
if
(
isset
(
$pkga
[
'placeonbottom'
]))
$pkg_buttons
.=
$input
;
else
echo
$input
.
"
\n
<br />"
.
fixup_string
(
$description
)
.
"
\n
"
;
break
;
case
"rowhelper"
:
#$rowhelpername=($fields['fieldname'] ? $fields['fieldname'] : "row");
$rowhelpername
=
"row"
;
?>
<script
type=
"text/javascript"
>
//
<!
[
CDATA
[
<?php
$rowcounter
=
0
;
$fieldcounter
=
0
;
foreach
(
$pkga
[
'rowhelper'
][
'rowhelperfield'
]
as
$rowhelper
)
{
echo
"rowname[
{
$fieldcounter
}
] =
\"
{
$rowhelper
[
'fieldname'
]
}
\"
;
\n
"
;
echo
"rowtype[
{
$fieldcounter
}
] =
\"
{
$rowhelper
[
'type'
]
}
\"
;
\n
"
;
echo
"rowsize[
{
$fieldcounter
}
] =
\"
{
$rowhelper
[
'size'
]
}
\"
;
\n
"
;
$fieldcounter
++
;
}
?>
//]]>
</script>
<table
id=
"maintable"
summary=
"main table"
>
<tr
id=
'
<?=
"tr_
{
$pkga
[
'fieldname'
]
}
"
;
?>
'
>
<?php
foreach
(
$pkga
[
'rowhelper'
][
'rowhelperfield'
]
as
$rowhelper
)
{
echo
"<td "
.
domTT_title
(
$rowhelper
[
'description'
])
.
"><b>"
.
fixup_string
(
$rowhelper
[
'fielddescr'
])
.
"</b></td>
\n
"
;
}
$rowcounter
=
0
;
$trc
=
0
;
//Use assigned $a_pkg or create an empty array to enter loop
if
(
isset
(
$a_pkg
[
$id
][
$rowhelpername
]))
$saved_rows
=
$a_pkg
[
$id
][
$rowhelpername
];
else
$saved_rows
[]
=
array
();
foreach
(
$saved_rows
as
$row
)
{
echo
"</tr>
\n
<tr class=
\"
sortable
\"
id=
\"
id_
{
$rowcounter
}
\"
>
\n
"
;
foreach
(
$pkga
[
'rowhelper'
][
'rowhelperfield'
]
as
$rowhelper
)
{
unset
(
$value
);
if
(
$rowhelper
[
'value'
]
<>
""
)
$value
=
$rowhelper
[
'value'
];
$fieldname
=
$rowhelper
[
'fieldname'
];
// if user is editing a record, load in the data.
if
(
isset
(
$id
)
&&
$a_pkg
[
$id
])
{
$value
=
$row
[
$fieldname
];
}
$options
=
""
;
$type
=
$rowhelper
[
'type'
];
$description
=
$rowhelper
[
'description'
];
$fieldname
=
$rowhelper
[
'fieldname'
];
if
(
$type
==
"option"
)
$options
=
&
$rowhelper
[
'options'
][
'option'
];
if
(
$rowhelper
[
'size'
])
$size
=
$rowhelper
[
'size'
];
else
if
(
$pkga
[
'size'
])
$size
=
$pkga
[
'size'
];
else
$size
=
"8"
;
display_row
(
$rowcounter
,
$value
,
$fieldname
,
$type
,
$rowhelper
,
$size
);
$text
=
""
;
$trc
++
;
}
$rowcounter
++
;
echo
"<td>"
;
#echo "<a onclick=\"removeRow(this); return false;\" href=\"#\"><img border=\"0\" src=\"./themes/".$g['theme']."/images/icons/icon_x.gif\" alt=\"remove\" /></a>";
echo
"<a class='delete' href=
\"
#
\"
><img border='0' src='./themes/
{
$g
[
'theme'
]
}
/images/icons/icon_x.gif' alt='delete' /></a>"
;
echo
"</td>
\n
"
;
}
?>
</tr>
<tbody></tbody>
</table>
<!-- <br /><a onclick="javascript:addRowTo('maintable'); return false;" href="#"><img border="0" src="./themes/
<?
#= $g['theme']; ?>/images/icons/icon_plus.gif" alt="add" /></a>-->
<
br
/><
a
class
="
add
" href="
#"><img border="0" src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="add" /></a>
<
br
/><?
php
if
(
$description
!=
""
)
echo
$description
;
?>
<script type="text/javascript">
//<![CDATA[
field_counter_js =
<?=
$fieldcounter
?>
;
rows =
<?=
$rowcounter
?>
;
totalrows =
<?php
echo
$rowcounter
;
?>
;
loaded =
<?php
echo
$rowcounter
;
?>
;
//typesel_change();
//]]>
</script>
<?php
break
;
}
#check typehint value
if
(
isset
(
$pkga
[
'typehint'
]))
...
...
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