mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
PHP: Fix lots of refs to undefined vars (#2952)
This commit is contained in:
parent
a095c72857
commit
5d49c6afcd
@ -657,7 +657,7 @@ class Net_IPv6
|
||||
*/
|
||||
function isCompressible($ip)
|
||||
{
|
||||
return (bool)($ip != Net_IPv6::compress($address));
|
||||
return (bool)($ip != Net_IPv6::compress($ip));
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
@ -801,7 +801,7 @@ function authenticate_user($username, $password, $authcfg = NULL)
|
||||
if ($authenticator != null) {
|
||||
return $authenticator->authenticate($username, $password) ;
|
||||
} else {
|
||||
log_error('Unable to retrieve authenticator for '. $authName);
|
||||
log_error('Unable to retrieve authenticator for '. $username);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,6 +317,7 @@ function cert_get_subject($str_crt, $decode = true)
|
||||
}
|
||||
|
||||
ksort($components);
|
||||
$subject = '';
|
||||
foreach ($components as $a => $v) {
|
||||
if (is_array($v)) {
|
||||
ksort($v);
|
||||
@ -365,6 +366,7 @@ function cert_get_issuer($str_crt, $decode = true)
|
||||
return "unknown";
|
||||
}
|
||||
ksort($components);
|
||||
$issuer = '';
|
||||
foreach ($components as $a => $v) {
|
||||
if (is_array($v)) {
|
||||
ksort($v);
|
||||
|
||||
@ -601,7 +601,7 @@ function filter_generate_scrubing(&$FilterIflist)
|
||||
|
||||
function filter_generate_aliases()
|
||||
{
|
||||
$aliases .= "\n# Lockout tables\n";
|
||||
$aliases = "\n# Lockout tables\n";
|
||||
$aliases .= "table <sshlockout> persist\n";
|
||||
$aliases .= "table <webConfiguratorlockout> persist\n";
|
||||
|
||||
|
||||
@ -2019,7 +2019,7 @@ function interface_wireless_configure($if, &$wl, &$wlcfg)
|
||||
switch ($wlcfg['mode']) {
|
||||
case 'bss':
|
||||
if (isset($wlcfg['wpa']['enable'])) {
|
||||
$wpa .= <<<EOD
|
||||
$wpa = <<<EOD
|
||||
ctrl_interface=/var/run/wpa_supplicant
|
||||
ctrl_interface_group=0
|
||||
ap_scan=1
|
||||
@ -2046,7 +2046,7 @@ EOD;
|
||||
$wpa_passphrase = "";
|
||||
}
|
||||
if (isset($wlcfg['wpa']['enable'])) {
|
||||
$wpa .= <<<EOD
|
||||
$wpa = <<<EOD
|
||||
interface={$if}
|
||||
driver=bsd
|
||||
logger_syslog=-1
|
||||
|
||||
@ -110,7 +110,12 @@ function dnsmasq_configure_do($verbose = false)
|
||||
flush();
|
||||
}
|
||||
|
||||
$args = ' -H /var/etc/dnsmasq-hosts ';
|
||||
$args = '';
|
||||
if (!isset($config['system']['webgui']['nodnsrebindcheck'])) {
|
||||
$args .= "--rebind-localhost-ok --stop-dns-rebind";
|
||||
}
|
||||
|
||||
$args .= ' -H /var/etc/dnsmasq-hosts ';
|
||||
|
||||
/* Setup listen port, if non-default */
|
||||
if (isset($config['dnsmasq']['port']) && is_port($config['dnsmasq']['port'])) {
|
||||
@ -169,10 +174,6 @@ function dnsmasq_configure_do($verbose = false)
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($config['system']['webgui']['nodnsrebindcheck'])) {
|
||||
$dns_rebind = "--rebind-localhost-ok --stop-dns-rebind";
|
||||
}
|
||||
|
||||
if (isset($config['dnsmasq']['strict_order'])) {
|
||||
$args .= " --strict-order ";
|
||||
}
|
||||
@ -194,7 +195,7 @@ function dnsmasq_configure_do($verbose = false)
|
||||
|
||||
_dnsmasq_add_host_entries();
|
||||
|
||||
mwexec("/usr/local/sbin/dnsmasq --all-servers {$dns_rebind} {$args}");
|
||||
mwexec("/usr/local/sbin/dnsmasq --all-servers {$args}");
|
||||
|
||||
_dnsmasq_dhcpleases_start();
|
||||
|
||||
|
||||
@ -252,6 +252,7 @@ EOF;
|
||||
}
|
||||
|
||||
// Set up forwarding if it configured
|
||||
$forward_conf = '';
|
||||
if (isset($config['unbound']['forwarding'])) {
|
||||
$dnsservers = array();
|
||||
if (isset($config['system']['dnsallowoverride'])) {
|
||||
@ -275,8 +276,6 @@ EOD;
|
||||
$forward_conf .= "\tforward-addr: $dnsserver\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$forward_conf = "";
|
||||
}
|
||||
|
||||
$unboundconf = <<<EOD
|
||||
|
||||
@ -176,6 +176,7 @@ EOD;
|
||||
|
||||
$lighty_port = $port;
|
||||
|
||||
$lighty_use_syslog = '';
|
||||
if (!isset($config['syslog']['nologlighttpd'])) {
|
||||
$lighty_use_syslog = <<<EOD
|
||||
## where to send error/access-messages to
|
||||
|
||||
@ -1746,7 +1746,7 @@ function get_dyndns_ip($int, $ipver = 4)
|
||||
$ip_address = '';
|
||||
}
|
||||
curl_close($ip_ch);
|
||||
} elseif (ipver == 6 && is_linklocal($ip_address)) {
|
||||
} elseif ($ipver == 6 && is_linklocal($ip_address)) {
|
||||
log_error('Aborted IPv6 detection: cannot bind to link-local address');
|
||||
$ip_address = '';
|
||||
}
|
||||
|
||||
@ -155,6 +155,7 @@ function system_resolvconf_generate($verbose = false)
|
||||
flush();
|
||||
}
|
||||
|
||||
$resolvconf = '';
|
||||
if (!empty($syscfg['domain'])) {
|
||||
$resolvconf = "domain {$syscfg['domain']}\n";
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ class AuthenticationFactory
|
||||
$localUserMap = $this->fetchUserDNs();
|
||||
}
|
||||
|
||||
if ($authObject != null) {
|
||||
if (isset($authObject)) {
|
||||
$props = $servers[$authserver];
|
||||
// when a local user exist and has a different (distinguished) name on the authenticator we already
|
||||
// know of, we send the mapping to the authenticator as property "local_users".
|
||||
|
||||
@ -402,7 +402,7 @@ class LDAP extends Base implements IAuthConnector
|
||||
if ($ldap_is_connected) {
|
||||
$this->lastAuthProperties['dn'] = $user_dn;
|
||||
if ($this->ldapReadProperties) {
|
||||
$sr = @ldap_read($this->ldapHandle, $userdn, '(objectclass=*)');
|
||||
$sr = @ldap_read($this->ldapHandle, $user_dn, '(objectclass=*)');
|
||||
$info = @ldap_get_entries($this->ldapHandle, $sr);
|
||||
if ($info['count'] != 0) {
|
||||
// $this->lastAuthProperties['info'] = $info[0];
|
||||
|
||||
@ -59,6 +59,7 @@ abstract class BaseExporter
|
||||
$p12 = null;
|
||||
$crt = openssl_x509_read($crt);
|
||||
$prv = openssl_get_privatekey($prv);
|
||||
$args = [];
|
||||
if ($cas !== null) {
|
||||
$args = [
|
||||
'extracerts' => $cas
|
||||
|
||||
@ -362,8 +362,8 @@ abstract class BaseField
|
||||
|
||||
/**
|
||||
* Set attribute on Field object
|
||||
* @param $key attribute key
|
||||
* @param $value attribute value
|
||||
* @param string $key attribute key
|
||||
* @param string $value attribute value
|
||||
*/
|
||||
public function setAttributeValue($key, $value)
|
||||
{
|
||||
|
||||
@ -101,7 +101,7 @@ class Alias extends BaseModel
|
||||
|
||||
/**
|
||||
* Return all places an alias seems to be used
|
||||
* @param $name alias name
|
||||
* @param string $name alias name
|
||||
* @return array hashmap with references where this alias is used
|
||||
*/
|
||||
public function whereUsed($name)
|
||||
|
||||
@ -226,7 +226,7 @@ include("fbegin.inc");
|
||||
</td>
|
||||
<td>
|
||||
<?= gettext('Be aware of how much space is consumed by backups before adjusting this value.'); ?>
|
||||
<?php if (count($confvers)) {
|
||||
<?php if (isset($confvers) && count($confvers) > 0) {
|
||||
print gettext('Current space used:') . ' ' . exec("/usr/bin/du -sh /conf/backup | /usr/bin/awk '{print $1;}'");
|
||||
} ?>
|
||||
</td>
|
||||
|
||||
@ -162,7 +162,6 @@ include("head.inc");
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$row++;
|
||||
endforeach;
|
||||
if ($states_info['total'] == 0): ?>
|
||||
<tr>
|
||||
|
||||
@ -82,7 +82,7 @@ include("head.inc");
|
||||
<div class="row">
|
||||
<section class="col-xs-12">
|
||||
<?php
|
||||
if($savemsg) {
|
||||
if(!empty($savemsg)) {
|
||||
echo "<div id=\"savemsg\">";
|
||||
print_info_box($savemsg);
|
||||
echo "</div>";
|
||||
|
||||
@ -761,8 +761,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$input_errors[] = gettext('6RD IPv4 prefix length must be a number.');
|
||||
}
|
||||
foreach ($ifdescrs as $ifent => $unused) {
|
||||
if ($if != $ifent && ($config[interfaces][$ifent]['ipaddrv6'] == $pconfig['type6'])) {
|
||||
if ($config[interfaces][$ifent]['prefix-6rd'] == $pconfig['prefix-6rd']) {
|
||||
if ($if != $ifent && ($config['interfaces'][$ifent]['ipaddrv6'] == $pconfig['type6'])) {
|
||||
if ($config['interfaces'][$ifent]['prefix-6rd'] == $pconfig['prefix-6rd']) {
|
||||
$input_errors[] = gettext("You can only have one interface configured in 6rd with same prefix.");
|
||||
break;
|
||||
}
|
||||
@ -771,7 +771,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
break;
|
||||
case "6to4":
|
||||
foreach ($ifdescrs as $ifent => $unused) {
|
||||
if ($if != $ifent && ($config[interfaces][$ifent]['ipaddrv6'] == $pconfig['type6'])) {
|
||||
if ($if != $ifent && ($config['interfaces'][$ifent]['ipaddrv6'] == $pconfig['type6'])) {
|
||||
$input_errors[] = sprintf(gettext("You can only have one interface configured as 6to4."), $pconfig['type6']);
|
||||
break;
|
||||
}
|
||||
@ -1351,9 +1351,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$send_options = array();
|
||||
$send_options = create_OR_FR_Credentials($pconfig['rfc3118_username'], $pconfig['rfc3118_password'], $pconfig['rfc3118_or_fr_lbid']);
|
||||
log_error("send options dhcp4 = {$send_options[1]}");
|
||||
$new_config[adv_dhcp_send_options] = $pconfig[adv_dhcp_send_options] = $send_options['dhcp4_send_options'];
|
||||
$new_config[adv_dhcp_request_options] = $pconfig[adv_dhcp_request_options] = $send_options['dhcp4_request_options'];
|
||||
$new_config[adv_dhcp6_interface_statement_send_options] = $pconfig[adv_dhcp6_interface_statement_send_options] = $send_options['dhcp6_send_options'];
|
||||
$new_config['adv_dhcp_send_options'] = $pconfig['adv_dhcp_send_options'] = $send_options['dhcp4_send_options'];
|
||||
$new_config['adv_dhcp_request_options'] = $pconfig['adv_dhcp_request_options'] = $send_options['dhcp4_request_options'];
|
||||
$new_config['adv_dhcp6_interface_statement_send_options'] = $pconfig['adv_dhcp6_interface_statement_send_options'] = $send_options['dhcp6_send_options'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,6 +44,7 @@ function get_mac_address()
|
||||
|
||||
function generate_new_duid($duid_type)
|
||||
{
|
||||
$new_duid = '';
|
||||
switch ($duid_type) {
|
||||
case '1': //LLT
|
||||
$mac = get_mac_address();
|
||||
@ -53,7 +54,7 @@ function generate_new_duid($duid_type)
|
||||
$timestamp_array = str_split($timestamp,2);
|
||||
$timestamp = implode(":",$timestamp_array);
|
||||
$type = "\x00\x01\x00\x01";
|
||||
while ($count < strlen($type)) {
|
||||
for ($count = 0; $count < strlen($type); ) {
|
||||
$new_duid .= bin2hex( $type[$count]);
|
||||
$count++;
|
||||
if ($count < strlen($type)) {
|
||||
@ -69,7 +70,7 @@ function generate_new_duid($duid_type)
|
||||
$timestamp_array = str_split($timestamp,2);
|
||||
$timestamp = implode(":",$timestamp_array);
|
||||
$type = "\x00\x03\x00\x01";
|
||||
while ($count < strlen($type)) {
|
||||
for ($count = 0; $count < strlen($type); ) {
|
||||
$new_duid .= bin2hex( $type[$count]);
|
||||
$count++;
|
||||
if ($count < strlen($type)) {
|
||||
@ -80,7 +81,7 @@ function generate_new_duid($duid_type)
|
||||
break;
|
||||
case '3': //UUID
|
||||
$type = "\x00\x00\x00\x04".openssl_random_pseudo_bytes(16);
|
||||
while ($count < strlen($type)) {
|
||||
for ($count = 0; $count < strlen($type); ) {
|
||||
$new_duid .= bin2hex( $type[$count]);
|
||||
$count++;
|
||||
if ($count < strlen($type)) {
|
||||
|
||||
@ -172,6 +172,7 @@ $extraBreadcrumb = $pkg['step'][$stepid]['title'];
|
||||
function update_config_field($field, $updatetext, $unset, $arraynum, $field_type) {
|
||||
global $config;
|
||||
$field_split = explode("->",$field);
|
||||
$field_conv = '';
|
||||
foreach ($field_split as $f)
|
||||
$field_conv .= "['" . $f . "']";
|
||||
if($field_conv == "")
|
||||
@ -208,6 +209,7 @@ function update_config_field($field, $updatetext, $unset, $arraynum, $field_type
|
||||
function redirect_url()
|
||||
{
|
||||
global $config, $title;
|
||||
$urlport = '';
|
||||
|
||||
switch($config['system']['webgui']['protocol']) {
|
||||
case "http":
|
||||
@ -226,8 +228,6 @@ function redirect_url()
|
||||
$urlport = ":" . $port;
|
||||
} elseif ($port != "80" and $port != "443") {
|
||||
$urlport = ":" . $port;
|
||||
} else {
|
||||
$urlport = "";
|
||||
}
|
||||
}
|
||||
$http_host = $_SERVER['SERVER_NAME'];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user