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
9002010c
Commit
9002010c
authored
Mar 24, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inc: remove more globals that are barely used or unused
parent
8f2449cb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
49 deletions
+36
-49
Makefile
Makefile
+3
-3
captiveportal.inc
src/etc/inc/captiveportal.inc
+7
-6
globals.inc
src/etc/inc/globals.inc
+0
-8
pfsense-utils.inc
src/etc/inc/pfsense-utils.inc
+1
-15
crash_reporter.php
src/www/crash_reporter.php
+15
-10
fbegin.inc
src/www/fbegin.inc
+1
-1
services_captiveportal_filemanager.php
src/www/services_captiveportal_filemanager.php
+8
-5
setup_wizard.xml
src/www/wizards/setup_wizard.xml
+1
-1
No files found.
Makefile
View file @
9002010c
...
...
@@ -11,7 +11,7 @@ install:
@
cp
${
.CURDIR
}
/pkg/+PRE_DEINSTALL
${
DESTDIR
}
@
cp
${
.CURDIR
}
/pkg/+POST_INSTALL
${
DESTDIR
}
@
cp
${
.CURDIR
}
/pkg/+MANIFEST
${
DESTDIR
}
# move all sources to their destination
and...
# move all sources to their destination
@
mkdir
-p
${
DESTDIR
}
/usr/local
@
cp
-r
${
.CURDIR
}
/src/
*
${
DESTDIR
}
/usr/local
# bootstrap pkg
(
8
)
files that are not
in
sources
...
...
@@ -20,7 +20,7 @@ install:
@
echo
/usr/local/etc/pkg/repos/OPNsense.conf
@
cp
${
.CURDIR
}
/pkg/pkg.conf
${
DESTDIR
}
/usr/local/etc
@
echo
/usr/local/etc/pkg.conf
#
...
pretty-print a list of files present
#
and finally
pretty-print a list of files present
@
(
cd
${
.CURDIR
}
/src
;
find
*
-type
f
)
|
\
xargs
-n1
printf
"/usr/local/%s
\n
"
...
...
@@ -58,4 +58,4 @@ health:
clean
:
git reset
--hard
HEAD
&&
git clean
-xdqf
.
.PHONY
:
mount umount install lint sweep style setup clean
.PHONY
:
mount umount install lint sweep style setup
health
clean
src/etc/inc/captiveportal.inc
View file @
9002010c
...
...
@@ -1075,22 +1075,23 @@ function radius($username,$password,$clientip,$clientmac,$type, $radiusctx = nul
}
function
captiveportal_write_elements
()
{
function
captiveportal_write_elements
()
{
global
$g
,
$config
,
$cpzone
;
$cpcfg
=
$config
[
'captiveportal'
][
$cpzone
];
if
(
!
is_dir
(
$g
[
'captiveportal_element_path'
]))
@
mkdir
(
$g
[
'captiveportal_element_path'
]);
@
mkdir
(
'/var/db/cpelements'
);
if
(
is_array
(
$cpcfg
[
'element'
]))
{
foreach
(
$cpcfg
[
'element'
]
as
$data
)
{
if
(
!@
file_put_contents
(
"
{
$g
[
'captiveportal_element_path'
]
}
/
{
$data
[
'name'
]
}
"
,
base64_decode
(
$data
[
'content'
])))
{
if
(
!@
file_put_contents
(
"
/var/db/cpelements
/
{
$data
[
'name'
]
}
"
,
base64_decode
(
$data
[
'content'
])))
{
printf
(
gettext
(
"Error: cannot open '%s' in captiveportal_write_elements()%s"
),
$data
[
'name'
],
"
\n
"
);
return
1
;
}
if
(
!
file_exists
(
"
{
$g
[
'captiveportal_path'
]
}
/
{
$data
[
'name'
]
}
"
))
@
symlink
(
"
{
$g
[
'captiveportal_element_path'
]
}
/
{
$data
[
'name'
]
}
"
,
"
{
$g
[
'captiveportal_path'
]
}
/
{
$data
[
'name'
]
}
"
);
if
(
!
file_exists
(
"/usr/local/captiveportal/
{
$data
[
'name'
]
}
"
))
{
@
symlink
(
"/var/db/cpelements/
{
$data
[
'name'
]
}
"
,
"/usr/local/captiveportal/
{
$data
[
'name'
]
}
"
);
}
}
}
...
...
src/etc/inc/globals.inc
View file @
9002010c
...
...
@@ -48,18 +48,10 @@ $g = array(
"product_copyright_owner"
=>
"Deciso B.V."
,
"product_copyright_years"
=>
"2014 - 2015"
,
"product_copyright_url"
=>
"https://www.deciso.com/"
,
"crashreporterurl"
=>
"https://crash.opnsense.org/"
,
"latest_config"
=>
"11.1"
,
"minimum_ram_warning"
=>
"101"
,
"minimum_ram_warning_text"
=>
"128 MB"
,
"wan_interface_name"
=>
"wan"
,
"xmlrpcbaseurl"
=>
"https://not.supported.opnsense.org"
,
"captiveportal_path"
=>
"/usr/local/captiveportal"
,
"captiveportal_element_path"
=>
"/var/db/cpelements"
,
"captiveportal_element_sizelimit"
=>
1048576
,
"xmlrpcpath"
=>
"/xmlrpc.php"
,
"wireless_regex"
=>
"/^(ndis|wi|ath|an|ral|ural|iwi|wlan|rum|run|bwn|zyd|mwl|bwi|ipw|iwn|malo|uath|upgt|urtw|wpi)/"
,
"help_base_url"
=>
"/help.php"
);
/* IP TOS flags */
...
...
src/etc/inc/pfsense-utils.inc
View file @
9002010c
...
...
@@ -598,8 +598,7 @@ function rmdir_recursive($path,$follow_links=false) {
function
check_firmware_version
(
$tocheck
=
"all"
,
$return_php
=
true
)
{
global
$g
,
$config
;
$xmlrpc_base_url
=
get_active_xml_rpc_base_url
();
$xmlrpcfqdn
=
preg_replace
(
"(https?://)"
,
""
,
$xmlrpc_base_url
);
$xmlrpcfqdn
=
preg_replace
(
'(https?://)'
,
''
,
'/xmlrpc.php'
);
$ip
=
gethostbyname
(
$xmlrpcfqdn
);
if
(
$ip
==
$xmlrpcfqdn
)
return
false
;
...
...
@@ -2675,16 +2674,3 @@ function get_pppoes_child_interfaces($ifpattern) {
return
$if_arr
;
}
/* Function to find and return the active XML RPC base URL to avoid code duplication */
function get_active_xml_rpc_base_url() {
global
$config
,
$g
;
/* If the user has activated the option to enable an alternate xmlrpcbaseurl, and it's not empty, then use it */
if (isset(
$config['system']['altpkgrepo']['enable']
) && !empty(
$config['system']['altpkgrepo']['xmlrpcbaseurl']
)) {
return
$config['system']['altpkgrepo']['xmlrpcbaseurl']
;
} else {
return
$g['xmlrpcbaseurl']
;
}
}
?>
src/www/crash_reporter.php
View file @
9002010c
...
...
@@ -33,23 +33,28 @@ require_once("captiveportal.inc");
define
(
"FILE_SIZE"
,
450000
);
function
upload_crash_report
(
$files
)
{
function
upload_crash_report
(
$files
)
{
global
$g
;
$post
=
array
();
$counter
=
0
;
foreach
(
$files
as
$file
)
{
$post
[
"file
{
$counter
}
"
]
=
"@
{
$file
}
"
;
$counter
++
;
}
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_HEADER
,
0
);
curl_setopt
(
$ch
,
CURLOPT_VERBOSE
,
0
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
true
);
curl_setopt
(
$ch
,
CURLOPT_USERAGENT
,
"Mozilla/4.0 (compatible;)"
);
curl_setopt
(
$ch
,
CURLOPT_URL
,
$g
[
'crashreporterurl'
]);
curl_setopt
(
$ch
,
CURLOPT_POST
,
true
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$post
);
$response
=
curl_exec
(
$ch
);
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_HEADER
,
0
);
curl_setopt
(
$ch
,
CURLOPT_VERBOSE
,
0
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
true
);
curl_setopt
(
$ch
,
CURLOPT_USERAGENT
,
'Mozilla/4.0 (compatible;)'
);
curl_setopt
(
$ch
,
CURLOPT_URL
,
'https://crash.opnsense.org/'
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
true
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$post
);
$response
=
curl_exec
(
$ch
);
return
$response
;
}
...
...
src/www/fbegin.inc
View file @
9002010c
...
...
@@ -62,7 +62,7 @@ if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "
}
/* Build the full help URL. */
$helpurl
.=
"
{
$g
[
'help_base_url'
]
}
?page=
{
$pagename
}
"
;
$helpurl
.=
"
/help.php
?page=
{
$pagename
}
"
;
function
return_ext_menu
(
$section
)
{
global
$config
;
...
...
src/www/services_captiveportal_filemanager.php
View file @
9002010c
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2005-2006 Jonathan De Graeve (jonathan.de.graeve@imelda.be)
...
...
@@ -27,6 +28,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
$captiveportal_element_sizelimit
=
1048576
;
function
cpelementscmp
(
$a
,
$b
)
{
return
strcasecmp
(
$a
[
'name'
],
$b
[
'name'
]);
}
...
...
@@ -89,9 +92,9 @@ if ($_POST) {
}
// check total file size
if
((
$total_size
+
$size
)
>
$
g
[
'captiveportal_element_sizelimit'
]
)
{
if
((
$total_size
+
$size
)
>
$
captiveportal_element_sizelimit
)
{
$input_errors
[]
=
gettext
(
"The total size of all files uploaded may not exceed "
)
.
format_bytes
(
$
g
[
'captiveportal_element_sizelimit'
]
)
.
"."
;
format_bytes
(
$
captiveportal_element_sizelimit
)
.
"."
;
}
if
(
!
$input_errors
)
{
...
...
@@ -110,8 +113,8 @@ if ($_POST) {
}
}
}
else
if
((
$_GET
[
'act'
]
==
"del"
)
&&
!
empty
(
$cpzone
)
&&
$a_element
[
$_GET
[
'id'
]])
{
@
unlink
(
"
{
$g
[
'captiveportal_element_path'
]
}
/"
.
$a_element
[
$_GET
[
'id'
]][
'name'
]);
@
unlink
(
"
{
$g
[
'captiveportal_path'
]
}
/"
.
$a_element
[
$_GET
[
'id'
]][
'name'
]);
@
unlink
(
"
/var/db/cpelements
/"
.
$a_element
[
$_GET
[
'id'
]][
'name'
]);
@
unlink
(
"
/usr/local/captiveportal
/"
.
$a_element
[
$_GET
[
'id'
]][
'name'
]);
unset
(
$a_element
[
$_GET
[
'id'
]]);
write_config
();
header
(
"Location: services_captiveportal_filemanager.php?zone=
{
$cpzone
}
"
);
...
...
@@ -228,7 +231,7 @@ $main_buttons = array(
<br
/><br
/>
<tt>
<
a href="/captiveportal-aup.php?zone=$PORTAL_ZONE$
&
redirurl=$PORTAL_REDIRURL$"
>
<?=
gettext
(
"Acceptable usage policy"
);
?>
<
/a
>
</tt>
<br
/><br
/>
<?php
printf
(
gettext
(
"The total size limit for all files is %s."
),
format_bytes
(
$
g
[
'captiveportal_element_sizelimit'
]
));
?>
</span>
<?php
printf
(
gettext
(
"The total size limit for all files is %s."
),
format_bytes
(
$
captiveportal_element_sizelimit
));
?>
</span>
</form>
</div>
...
...
src/www/wizards/setup_wizard.xml
View file @
9002010c
...
...
@@ -605,7 +605,7 @@
}
unset($config['wizardtemp']);
write_config();
]]>
]]>
</stepafterformdisplay>
</step>
<step>
...
...
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