mirror of
https://github.com/lucaspalomodevelop/opnsense-core.git
synced 2026-03-13 00:07:27 +00:00
inc: remove more globals that are barely used or unused
This commit is contained in:
parent
8f2449cb2c
commit
9002010cb0
6
Makefile
6
Makefile
@ -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
|
||||
|
||||
@ -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']}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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'];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?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>
|
||||
|
||||
@ -605,7 +605,7 @@
|
||||
}
|
||||
unset($config['wizardtemp']);
|
||||
write_config();
|
||||
]]>
|
||||
]]>
|
||||
</stepafterformdisplay>
|
||||
</step>
|
||||
<step>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user