Commit 1b03f583 authored by Franco Fichtner's avatar Franco Fichtner

www: transform $input_error strings to gettext()

Spotted by: @fabianfrz
parent 1f5b8fa0
......@@ -81,11 +81,11 @@ function openvpn_client_export_validate_config($srvid, $usrid, $crtid) {
// lookup server settings
$settings = $config['openvpn']['openvpn-server'][$srvid];
if (empty($settings)) {
$input_errors[] = "Could not locate server configuration.";
$input_errors[] = gettext("Could not locate server configuration.");
return false;
}
if (!empty($settings['disable'])) {
$input_errors[] = "You cannot export for disabled servers.";
$input_errors[] = gettext("You cannot export for disabled servers.");
return false;
}
......@@ -93,11 +93,11 @@ function openvpn_client_export_validate_config($srvid, $usrid, $crtid) {
$server_cert = lookup_cert($settings['certref']);
if (!$server_cert)
{
$input_errors[] = "Could not locate server certificate.";
$input_errors[] = gettext("Could not locate server certificate.");
} else {
$server_ca = isset($server_cert['caref']) ? lookup_ca($server_cert['caref']) : null;
if (!$server_ca) {
$input_errors[] = "Could not locate the CA reference for the server certificate.";
$input_errors[] = gettext("Could not locate the CA reference for the server certificate.");
}
if (function_exists("cert_get_cn")) {
$servercn = cert_get_cn($server_cert['crt']);
......@@ -108,7 +108,7 @@ function openvpn_client_export_validate_config($srvid, $usrid, $crtid) {
if (is_numeric($usrid)) {
$user = $config['system']['user'][$usrid];
if (!$user) {
$input_errors[] = "Could not find user settings.";
$input_errors[] = gettext("Could not find user settings.");
}
}
......@@ -119,9 +119,8 @@ function openvpn_client_export_validate_config($srvid, $usrid, $crtid) {
} else {
$cert = $config['cert'][$crtid];
}
if (!$cert)
{
$input_errors[] = "Could not find client certificate.";
if (!$cert) {
$input_errors[] = gettext("Could not find client certificate.");
} else {
// If $cert is not an array, it's a certref not a cert.
if (!is_array($cert))
......@@ -130,7 +129,7 @@ function openvpn_client_export_validate_config($srvid, $usrid, $crtid) {
} elseif (($settings['mode'] == "server_tls") || (($settings['mode'] == "server_tls_user") && ($settings['authmode'] != "Local Database"))) {
$cert = $config['cert'][$crtid];
if (!$cert)
$input_errors[] = "Could not find client certificate.";
$input_errors[] = gettext("Could not find client certificate.");
} else
$nokeys = true;
......@@ -207,7 +206,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys
if ($proxy['proxy_type'] == "http") {
if (strtoupper(substr($settings['protocol'], 0, 3)) == "UDP") {
$input_errors[] = "This server uses UDP protocol and cannot communicate with HTTP proxy.";
$input_errors[] = gettext("This server uses UDP protocol and cannot communicate with HTTP proxy.");
return;
}
$conf .= "http-proxy {$proxy['ip']} {$proxy['port']} ";
......@@ -500,7 +499,7 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $veri
}
$conf = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifyservercn, $randomlocalport, $usetoken, $nokeys, $proxy, "", "baseconf", false, true, $openvpnmanager, $advancedoptions);
if (!$conf) {
$input_errors[] = "Could not create a config to export.";
$input_errors[] = gettext("Could not create a config to export.");
return false;
}
......@@ -684,11 +683,11 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco
// lookup server settings
$settings = $config['openvpn']['openvpn-server'][$srvid];
if (empty($settings)) {
$input_errors[] = "Could not locate server configuration.";
$input_errors[] = gettext("Could not locate server configuration.");
return false;
}
if ($settings['disable']) {
$input_errors[] = "You cannot export for disabled servers.";
$input_errors[] = gettext("You cannot export for disabled servers.");
return false;
}
......@@ -752,7 +751,7 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco
if (!empty($proxy)) {
if ($proxy['proxy_type'] == "http") {
if ($proto == "udp") {
$input_errors[] = "This server uses UDP protocol and cannot communicate with HTTP proxy.";
$input_errors[] = gettext("This server uses UDP protocol and cannot communicate with HTTP proxy.");
return;
}
$conf .= "http-proxy {$proxy['ip']} {$proxy['port']} ";
......
......@@ -213,7 +213,7 @@ function step7_submitphpaction() {
} elseif (has_special_chars($_POST['country']) || has_special_chars($_POST['state']) ||
has_special_chars($_POST['city']) || has_special_chars($_POST['organization'])) {
$stepid--;
$input_errors[] = "Please do not use special characters in Certificate field names.";
$input_errors[] = gettext("Please do not use special characters in Certificate field names.");
} elseif (in_array($_POST['descr'], $canames) || in_array($_POST['descr'], $cacns)) {
$stepid--;
$savemsg = "Please enter a different name for the Certicicate Authority. A Certificate Authority with that name already exists.";
......@@ -312,7 +312,7 @@ function step9_submitphpaction() {
} elseif (has_special_chars($_POST['country']) || has_special_chars($_POST['state']) ||
has_special_chars($_POST['city']) || has_special_chars($_POST['organization'])) {
$stepid--;
$input_errors[] = "Please do not use special characters in Certificate field names.";
$input_errors[] = gettext("Please do not use special characters in Certificate field names.");
} elseif (in_array($_POST['descr'], $certnames) || in_array($_POST['descr'], $certcns)) {
$stepid--;
$savemsg = "Please enter a different name for the Certicicate. A Certificate with that name/common name already exists.";
......@@ -398,37 +398,37 @@ function step10_submitphpaction() {
$portused = openvpn_port_used($_POST['protocol'], $_POST['interface'], $_POST['localport']);
if ($portused != 0)
$input_errors[] = "The specified 'Local port' is in use. Please select another value";
$input_errors[] = gettext("The specified 'Local port' is in use. Please select another value.");
if (!isset($_POST['generatetlskey']) && isset($_POST['tlsauthentication']))
if (!strstr($_POST['tlssharedkey'], "-----BEGIN OpenVPN Static key V1-----") ||
!strstr($_POST['tlssharedkey'], "-----END OpenVPN Static key V1-----"))
$input_errors[] = "The field 'TLS Authentication Key' does not appear to be valid";
$input_errors[] = gettext("The field 'TLS Authentication Key' does not appear to be valid.");
if (!empty($_POST['dnsserver1']) && !is_ipaddr(trim($_POST['dnsserver1'])))
$input_errors[] = "The field 'DNS Server #1' must contain a valid IP address";
$input_errors[] = gettext("The field 'DNS Server #1' must contain a valid IP address");
if (!empty($_POST['dnsserver2']) && !is_ipaddr(trim($_POST['dnsserver2'])))
$input_errors[] = "The field 'DNS Server #2' must contain a valid IP address";
$input_errors[] = gettext("The field 'DNS Server #2' must contain a valid IP address");
if (!empty($_POST['dnsserver3']) && !is_ipaddr(trim($_POST['dnsserver3'])))
$input_errors[] = "The field 'DNS Server #3' must contain a valid IP address";
$input_errors[] = gettext("The field 'DNS Server #3' must contain a valid IP address");
if (!empty($_POST['dnsserver4']) && !is_ipaddr(trim($_POST['dnsserver4'])))
$input_errors[] = "The field 'DNS Server #4' must contain a valid IP address";
$input_errors[] = gettext("The field 'DNS Server #4' must contain a valid IP address");
if (!empty($_POST['ntpserver1']) && !is_ipaddr(trim($_POST['ntpserver1'])))
$input_errors[] = "The field 'NTP Server #1' must contain a valid IP address";
$input_errors[] = gettext("The field 'NTP Server #1' must contain a valid IP address");
if (!empty($_POST['ntpserver2']) && !is_ipaddr(trim($_POST['ntpserver2'])))
$input_errors[] = "The field 'NTP Server #2' must contain a valid IP address";
$input_errors[] = gettext("The field 'NTP Server #2' must contain a valid IP address");
if (!empty($_POST['winsserver1']) && !is_ipaddr(trim($_POST['winsserver1'])))
$input_errors[] = "The field 'WINS Server #1' must contain a valid IP address";
$input_errors[] = gettext("The field 'WINS Server #1' must contain a valid IP address");
if (!empty($_POST['winsserver2']) && !is_ipaddr(trim($_POST['winsserver2'])))
$input_errors[] = "The field 'WINS Server #2' must contain a valid IP address";
$input_errors[] = gettext("The field 'WINS Server #2' must contain a valid IP address");
if ($_POST['concurrentcon'] && !is_numeric($_POST['concurrentcon']))
$input_errors[] = "The field 'Concurrent connections' must be numeric.";
$input_errors[] = gettext("The field 'Concurrent connections' must be numeric.");
if (empty($_POST['tunnelnet']))
$input_errors[] = "You must specify a 'Tunnel network'.";
$input_errors[] = gettext("You must specify a 'Tunnel network'.");
if (count($input_errors) > 0) {
$savemsg = $input_errors[0];
......
......@@ -296,7 +296,7 @@ if (isset($_POST['add_x']) && isset($_POST['if_add'])) {
if (isset($config['vlans']['vlan'])) {
foreach ($config['vlans']['vlan'] as $vlan) {
if (does_interface_exist($vlan['if']) == false)
$input_errors[] = "Vlan parent interface {$vlan['if']} does not exist anymore so vlan id {$vlan['tag']} cannot be created please fix the issue before continuing.";
$input_errors[] = sprintf(gettext("VLAN parent interface %s does not exist."), $vlan['if']);
}
}
......
......@@ -54,9 +54,9 @@ function bridge_inuse($num) {
if ($_GET['act'] == "del") {
if (!isset($_GET['id']))
$input_errors[] = getext("Wrong parameters supplied");
$input_errors[] = gettext("Wrong parameters supplied");
else if (empty($a_bridges[$_GET['id']]))
$input_errors[] = getext("Wrong index supplied");
$input_errors[] = gettext("Wrong index supplied");
/* check if still in use */
else if (bridge_inuse($_GET['id'])) {
$input_errors[] = gettext("This bridge cannot be deleted because it is assigned as an interface.");
......
......@@ -139,13 +139,15 @@ if ($_POST) {
if ($_POST['holdcnt'] && !is_numeric($_POST['holdcnt']))
$input_errors[] = gettext("Transmit Hold Count for STP needs to be an integer between 1 and 10.");
foreach ($ifacelist as $ifn => $ifdescr) {
if ($_POST[$ifn] <> "" && !is_numeric($_POST[$ifn]))
$input_errors[] = "{$ifdescr} " . gettext("interface priority for STP needs to be an integer between 0 and 240.");
if ($_POST[$ifn] <> "" && !is_numeric($_POST[$ifn])) {
$input_errors[] = sprintf(gettext("%s interface priority for STP needs to be an integer between 0 and 240."), $ifdescr);
}
}
$i = 0;
foreach ($ifacelist as $ifn => $ifdescr) {
if ($_POST["{$ifn}{$i}"] <> "" && !is_numeric($_POST["{$ifn}{$i}"]))
$input_errors[] = "{$ifdescr} " . gettext("interface path cost for STP needs to be an integer between 1 and 200000000.");
if ($_POST["{$ifn}{$i}"] <> "" && !is_numeric($_POST["{$ifn}{$i}"])) {
$input_errors[] = sprintf(gettext("%s interface path cost for STP needs to be an integer between 1 and 200000000."), $ifdescr);
}
$i++;
}
......
......@@ -50,9 +50,9 @@ function gif_inuse($num) {
if ($_GET['act'] == "del") {
if (!isset($_GET['id']))
$input_errors[] = getext("Wrong parameters supplied");
$input_errors[] = gettext("Wrong parameters supplied");
else if (empty($a_gifs[$_GET['id']]))
$input_errors[] = getext("Wrong index supplied");
$input_errors[] = gettext("Wrong index supplied");
/* check if still in use */
else if (gif_inuse($_GET['id'])) {
$input_errors[] = gettext("This gif TUNNEL cannot be deleted because it is still being used as an interface.");
......
......@@ -50,9 +50,9 @@ function gre_inuse($num) {
if ($_GET['act'] == "del") {
if (!isset($_GET['id']))
$input_errors[] = getext("Wrong parameters supplied");
$input_errors[] = gettext("Wrong parameters supplied");
else if (empty($a_gres[$_GET['id']]))
$input_errors[] = getext("Wrong index supplied");
$input_errors[] = gettext("Wrong index supplied");
/* check if still in use */
else if (gre_inuse($_GET['id'])) {
$input_errors[] = gettext("This GRE tunnel cannot be deleted because it is still being used as an interface.");
......
......@@ -68,7 +68,7 @@ if ($_POST) {
foreach ($iflist as $gif => $gdescr) {
if ($gdescr == $_POST['ifname'] || $gif == $_POST['ifname'])
$input_errors[] = "The specified group name is already used by an interface. Please choose another name.";
$input_errors[] = gettext("The specified group name is already used by an interface. Please choose another name.");
}
$members = "";
$isfirst = 0;
......
......@@ -55,9 +55,9 @@ function lagg_inuse($num) {
if ($_GET['act'] == "del") {
if (!isset($_GET['id']))
$input_errors[] = getext("Wrong parameters supplied");
$input_errors[] = gettext("Wrong parameters supplied");
else if (empty($a_laggs[$_GET['id']]))
$input_errors[] = getext("Wrong index supplied");
$input_errors[] = gettext("Wrong index supplied");
/* check if still in use */
else if (lagg_inuse($_GET['id'])) {
$input_errors[] = gettext("This LAGG interface cannot be deleted because it is still being used.");
......
......@@ -260,7 +260,7 @@ if ($_POST) {
continue;
if ($ppp['serialport'] == $_POST['serialport']) {
$input_errors[] = "Serial port is in use";
$input_errors[] = gettext("Serial port is in use");
break;
}
}
......
......@@ -54,9 +54,9 @@ function vlan_inuse($num) {
if ($_GET['act'] == "del") {
if (!isset($_GET['id']))
$input_errors[] = getext("Wrong parameters supplied");
$input_errors[] = gettext("Wrong parameters supplied");
else if (empty($a_vlans[$_GET['id']]))
$input_errors[] = getext("Wrong index supplied");
$input_errors[] = gettext("Wrong index supplied");
/* check if still in use */
else if (vlan_inuse($_GET['id'])) {
$input_errors[] = gettext("This VLAN cannot be deleted because it is still being used as an interface.");
......
......@@ -293,7 +293,7 @@ if (isset($_POST['submit'])) {
if (empty($map['ipaddr']))
$noip = true;
if ($_POST['staticarp'] && $noip)
$input_errors[] = "Cannot enable static ARP when you have static map entries without IP addresses. Ensure all static maps have IP addresses and try again.";
$input_errors[] = gettext("Cannot enable static ARP when you have static map entries without IP addresses. Ensure all static maps have IP addresses and try again.");
if(is_array($pconfig['numberoptions']['item'])) {
foreach ($pconfig['numberoptions']['item'] as $numberoption) {
......
......@@ -86,13 +86,13 @@ if ($_POST) {
$pconfig = $_POST;
if (isset($_POST['enable']) && isset($config['dnsmasq']['enable']))
$input_errors[] = "The system dns-forwarder is still active. Disable it before enabling the DNS Resolver.";
$input_errors[] = gettext("The DNS Forwarder is still active. Disable it before enabling the DNS Resolver.");
if (empty($_POST['active_interface']))
$input_errors[] = "A single network interface needs to be selected for the DNS Resolver to bind to.";
$input_errors[] = gettext("A single network interface needs to be selected for the DNS Resolver to bind to.");
if (empty($_POST['outgoing_interface']))
$input_errors[] = "A single outgoing network interface needs to be selected for the DNS Resolver to use for outgoing DNS requests.";
$input_errors[] = gettext("A single outgoing network interface needs to be selected for the DNS Resolver to use for outgoing DNS requests.");
if ($_POST['port'])
if (is_port($_POST['port']))
......
......@@ -67,22 +67,22 @@ function upnp_validate_port($port) {
function validate_form_miniupnpd($post, &$input_errors) {
if(!empty($post['enable']) && (empty($post['enable_upnp']) && empty($post['enable_natpmp'])))
$input_errors[] = 'At least one of \'UPnP\' or \'NAT-PMP\' must be allowed';
$input_errors[] = gettext('At least one of \'UPnP\' or \'NAT-PMP\' must be allowed');
if($post['iface_array'])
foreach($post['iface_array'] as $iface) {
if($iface == 'wan')
$input_errors[] = 'It is a security risk to specify WAN in the \'Interface\' field';
$input_errors[] = gettext('It is a security risk to specify WAN in the \'Interface\' field');
elseif ($iface == $post['ext_iface'])
$input_errors[] = 'You cannot select the external interface as an internal interface.';
$input_errors[] = gettext('You cannot select the external interface as an internal interface.');
}
if(!empty($post['overridewanip']) && !upnp_validate_ip($post['overridewanip'],false))
$input_errors[] = 'You must specify a valid ip address in the \'Override WAN address\' field';
$input_errors[] = gettext('You must specify a valid ip address in the \'Override WAN address\' field');
if((!empty($post['download']) && empty($post['upload'])) || (!empty($post['upload']) && empty($post['download'])))
$input_errors[] = 'You must fill in both \'Maximum Download Speed\' and \'Maximum Upload Speed\' fields';
$input_errors[] = gettext('You must fill in both \'Maximum Download Speed\' and \'Maximum Upload Speed\' fields');
if(!empty($post['download']) && $post['download'] <= 0)
$input_errors[] = 'You must specify a value greater than 0 in the \'Maximum Download Speed\' field';
$input_errors[] = gettext('You must specify a value greater than 0 in the \'Maximum Download Speed\' field');
if(!empty($post['upload']) && $post['upload'] <= 0)
$input_errors[] = 'You must specify a value greater than 0 in the \'Maximum Upload Speed\' field';
$input_errors[] = gettext('You must specify a value greater than 0 in the \'Maximum Upload Speed\' field');
/* user permissions validation */
for($i=1; $i<=4; $i++) {
......@@ -90,18 +90,17 @@ function validate_form_miniupnpd($post, &$input_errors) {
$perm = explode(' ',$post["permuser{$i}"]);
/* should explode to 4 args */
if(count($perm) != 4) {
$input_errors[] = "You must follow the specified format in the 'User specified permissions {$i}' field";
$input_errors[] = sprintf(gettext("You must follow the specified format in the 'User specified permissions %s' field"), $i);
} else {
/* must with allow or deny */
if(!($perm[0] == 'allow' || $perm[0] == 'deny'))
$input_errors[] = "You must begin with allow or deny in the 'User specified permissions {$i}' field";
$input_errors[] = sprintf(gettext("You must begin with allow or deny in the 'User specified permissions %s' field"), $i);
/* verify port or port range */
if(!upnp_validate_port($perm[1]) || !upnp_validate_port($perm[3]))
$input_errors[] = "You must specify a port or port range between 0 and 65535 in the 'User specified
permissions {$i}' field";
$input_errors[] = sprintf(gettext("You must specify a port or port range between 0 and 65535 in the 'User specified permissions %s' field"), $i);
/* verify ip address */
if(!upnp_validate_ip($perm[2],true))
$input_errors[] = "You must specify a valid ip address in the 'User specified permissions {$i}' field";
$input_errors[] = sprintf(gettext("You must specify a valid ip address in the 'User specified permissions %s' field"), $i);
}
}
}
......
......@@ -312,21 +312,21 @@ if ($_POST) {
for ($i = 0; $i < count($reqdfields); $i++) {
if ($reqdfields[$i] == 'dn_email') {
if (preg_match("/[\!\#\$\%\^\(\)\~\?\>\<\&\/\\\,\"\']/", $_POST["dn_email"])) {
array_push($input_errors, "The field 'Distinguished name Email Address' contains invalid characters.");
$input_errors[] = gettext("The field 'Distinguished name Email Address' contains invalid characters.");
}
} elseif ($reqdfields[$i] == 'dn_commonname') {
if (preg_match("/[\!\@\#\$\%\^\(\)\~\?\>\<\&\/\\\,\"\']/", $_POST["dn_commonname"])) {
array_push($input_errors, "The field 'Distinguished name Common Name' contains invalid characters.");
$input_errors[] = gettext("The field 'Distinguished name Common Name' contains invalid characters.");
}
} elseif (($reqdfields[$i] != "descr") && preg_match("/[\!\@\#\$\%\^\(\)\~\?\>\<\&\/\\\,\.\"\']/", $_POST["$reqdfields[$i]"])) {
array_push($input_errors, "The field '" . $reqdfieldsn[$i] . "' contains invalid characters.");
$input_errors[] = sprintf(gettext("The field '%s' contains invalid characters."), $reqdfieldsn[$i]);
}
}
if (!in_array($_POST["keylen"], $ca_keylens)) {
array_push($input_errors, gettext("Please select a valid Key Length."));
$input_errors[] = gettext("Please select a valid Key Length.");
}
if (!in_array($_POST["digest_alg"], $openssl_digest_algs)) {
array_push($input_errors, gettext("Please select a valid Digest Algorithm."));
$input_errors[] = gettext("Please select a valid Digest Algorithm.");
}
}
......@@ -378,7 +378,7 @@ if ($_POST) {
if (!ca_create($ca, $pconfig['keylen'], $pconfig['lifetime'], $dn, $pconfig['digest_alg'])) {
$input_errors = array();
while ($ssl_err = openssl_error_string()) {
array_push($input_errors, "openssl library returns: " . $ssl_err);
$input_errors[] = gettext("openssl library returns:") . " " . $ssl_err;
}
}
} elseif ($pconfig['method'] == "intermediate") {
......@@ -392,7 +392,7 @@ if ($_POST) {
if (!ca_inter_create($ca, $pconfig['keylen'], $pconfig['lifetime'], $dn, $pconfig['caref'], $pconfig['digest_alg'])) {
$input_errors = array();
while ($ssl_err = openssl_error_string()) {
array_push($input_errors, "openssl library returns: " . $ssl_err);
$input_errors[] = gettext("openssl library returns:") . " " . $ssl_err;
}
}
}
......
......@@ -326,30 +326,30 @@ if ($_POST) {
switch ($altname['type']) {
case "DNS":
if (!is_hostname($altname['value'])) {
array_push($input_errors, "DNS subjectAltName values must be valid hostnames or FQDNs");
$input_errors[] = gettext("DNS subjectAltName values must be valid hostnames or FQDNs");
}
break;
case "IP":
if (!is_ipaddr($altname['value'])) {
array_push($input_errors, "IP subjectAltName values must be valid IP Addresses");
$input_errors[] = gettext("IP subjectAltName values must be valid IP Addresses");
}
break;
case "email":
if (empty($altname['value'])) {
array_push($input_errors, "You must provide an e-mail address for this type of subjectAltName");
$input_errors[] = gettext("You must provide an e-mail address for this type of subjectAltName");
}
if (preg_match("/[\!\#\$\%\^\(\)\~\?\>\<\&\/\\\,\"\']/", $altname['value'])) {
array_push($input_errors, "The e-mail provided in a subjectAltName contains invalid characters.");
$input_errors[] = gettext("The e-mail provided in a subjectAltName contains invalid characters.");
}
break;
case "URI":
/* Close enough? */
if (!is_URL($altname['value'])) {
$input_errors[] = "URI subjectAltName types must be a valid URI";
$input_errors[] = gettext("URI subjectAltName types must be a valid URI");
}
break;
default:
$input_errors[] = "Unrecognized subjectAltName type.";
$input_errors[] = gettext("Unrecognized subjectAltName type.");
}
}
......@@ -358,30 +358,30 @@ if ($_POST) {
if (preg_match('/email/', $reqdfields[$i])) {
/* dn_email or csr_dn_name */
if (preg_match("/[\!\#\$\%\^\(\)\~\?\>\<\&\/\\\,\"\']/", $_POST[$reqdfields[$i]])) {
array_push($input_errors, "The field 'Distinguished name Email Address' contains invalid characters.");
$input_errors[] = gettext("The field 'Distinguished name Email Address' contains invalid characters.");
}
} elseif (preg_match('/commonname/', $reqdfields[$i])) {
/* dn_commonname or csr_dn_commonname */
if (preg_match("/[\!\@\#\$\%\^\(\)\~\?\>\<\&\/\\\,\"\']/", $_POST[$reqdfields[$i]])) {
array_push($input_errors, "The field 'Distinguished name Common Name' contains invalid characters.");
$input_errors[] = gettext("The field 'Distinguished name Common Name' contains invalid characters.");
}
} elseif (($reqdfields[$i] != "descr") && preg_match("/[\!\@\#\$\%\^\(\)\~\?\>\<\&\/\\\,\.\"\']/", $_POST[$reqdfields[$i]])) {
array_push($input_errors, "The field '" . $reqdfieldsn[$i] . "' contains invalid characters.");
$input_errors[] = sprintf(gettext("The field '%s' contains invalid characters."), $reqdfieldsn[$i]);
}
}
if (($pconfig['method'] != "external") && isset($_POST["keylen"]) && !in_array($_POST["keylen"], $cert_keylens)) {
array_push($input_errors, gettext("Please select a valid Key Length."));
$input_errors[] = gettext("Please select a valid Key Length.");
}
if (($pconfig['method'] != "external") && !in_array($_POST["digest_alg"], $openssl_digest_algs)) {
array_push($input_errors, gettext("Please select a valid Digest Algorithm."));
$input_errors[] = gettext("Please select a valid Digest Algorithm.");
}
if (($pconfig['method'] == "external") && isset($_POST["csr_keylen"]) && !in_array($_POST["csr_keylen"], $cert_keylens)) {
array_push($input_errors, gettext("Please select a valid Key Length."));
$input_errors[] = gettext("Please select a valid Key Length.");
}
if (($pconfig['method'] == "external") && !in_array($_POST["csr_digest_alg"], $openssl_digest_algs)) {
array_push($input_errors, gettext("Please select a valid Digest Algorithm."));
$input_errors[] = gettext("Please select a valid Digest Algorithm.");
}
}
......@@ -438,7 +438,7 @@ if ($_POST) {
)) {
$input_errors = array();
while ($ssl_err = openssl_error_string()) {
array_push($input_errors, "openssl library returns: " . $ssl_err);
$input_errors[] = gettext("openssl library returns:") . " " . $ssl_err;
}
}
}
......@@ -461,7 +461,7 @@ if ($_POST) {
if (!csr_generate($cert, $pconfig['csr_keylen'], $dn, $pconfig['csr_digest_alg'])) {
$input_errors = array();
while ($ssl_err = openssl_error_string()) {
array_push($input_errors, "openssl library returns: " . $ssl_err);
$input_errors[] = gettext("openssl library returns:") . " " . $ssl_err;
}
}
}
......@@ -516,7 +516,7 @@ if ($_POST) {
if (strcmp($mod_csr, $mod_cert)) {
// simply: if the moduli don't match, then the private key and public key won't match
$input_errors[] = sprintf(gettext("The certificate modulus does not match the signing request modulus."), $subj_cert);
$input_errors[] = gettext("The certificate modulus does not match the signing request modulus.");
$subject_mismatch = true;
}
......
......@@ -115,7 +115,7 @@ if ($_POST) {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
if (! isset($_POST['name'])) {
$input_errors[] = "A valid gateway name must be specified.";
$input_errors[] = gettext("A valid gateway name must be specified.");
}
if (! is_validaliasname($_POST['name'])) {
$input_errors[] = gettext("The gateway name must not contain invalid characters.");
......
......@@ -175,7 +175,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
if (!empty($pconfig['local_port'])) {
if (empty($pconfig['local_port']) || !is_numeric($pconfig['local_port']) || $pconfig['local_port'] < 0 || ($pconfig['local_port'] > 65535)) {
$input_errors[] = "The field Local port must contain a valid port, ranging from 0 to 65535.";
$input_errors[] = gettext("The field Local port must contain a valid port, ranging from 0 to 65535.");
}
$portused = openvpn_port_used($pconfig['protocol'], $pconfig['interface'], $pconfig['local_port'], $vpnid);
if (($portused != $vpnid) && ($portused != 0)) {
......@@ -187,7 +187,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
if (empty($pconfig['server_port']) || !is_numeric($pconfig['server_port']) || $pconfig['server_port'] < 0 || ($pconfig['server_port'] > 65535)) {
$input_errors[] = "The field Server port must contain a valid port, ranging from 0 to 65535.";
$input_errors[] = gettext("The field Server port must contain a valid port, ranging from 0 to 65535.");
}
if (!empty($pconfig['proxy_addr'])) {
......@@ -195,7 +195,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$input_errors[] = gettext("The field Proxy host or address must contain a valid IP address or domain name.") ;
}
if (empty($pconfig['proxy_port']) || !is_numeric($pconfig['proxy_port']) || $pconfig['proxy_port'] < 0 || ($pconfig['proxy_port'] > 65535)) {
$input_errors[] = "The field Proxy port must contain a valid port, ranging from 0 to 65535.";
$input_errors[] = gettext("The field Proxy port must contain a valid port, ranging from 0 to 65535.");
}
if (isset($pconfig['proxy_authtype']) && $pconfig['proxy_authtype'] != "none") {
if (empty($pconfig['proxy_user']) || empty($pconfig['proxy_passwd'])) {
......
......@@ -136,7 +136,7 @@ if (isset($config['openvpn']['openvpn-server'])) {
if (!(is_ipaddr($useaddr) || is_hostname($useaddr) ||
in_array($useaddr, array("serveraddr", "servermagic", "servermagichost", "serverhostname")))) {
$input_errors[] = "You need to specify an IP or hostname.";
$input_errors[] = gettext("You need to specify an IP or hostname.");
}
$advancedoptions = isset($_GET['advancedoptions']) ? $_GET['advancedoptions'] : null;
......@@ -146,10 +146,10 @@ if (isset($config['openvpn']['openvpn-server'])) {
$randomlocalport = isset($_GET['randomlocalport']) ? $_GET['randomlocalport'] : null;
$usetoken = $_GET['usetoken'];
if ($usetoken && (substr($act, 0, 10) == "confinline")) {
$input_errors[] = "You cannot use Microsoft Certificate Storage with an Inline configuration.";
$input_errors[] = gettext("You cannot use Microsoft Certificate Storage with an Inline configuration.");
}
if ($usetoken && (($act == "conf_yealink_t28") || ($act == "conf_yealink_t38g") || ($act == "conf_yealink_t38g2") || ($act == "conf_snom"))) {
$input_errors[] = "You cannot use Microsoft Certificate Storage with a Yealink or SNOM configuration.";
$input_errors[] = gettext("You cannot use Microsoft Certificate Storage with a Yealink or SNOM configuration.");
}
$password = "";
if (!empty($_GET['password'])) {
......@@ -160,12 +160,12 @@ if (isset($config['openvpn']['openvpn-server'])) {
if (!empty($_GET['proxy_addr']) || !empty($_GET['proxy_port'])) {
$proxy = array();
if (empty($_GET['proxy_addr'])) {
$input_errors[] = "You need to specify an address for the proxy port.";
$input_errors[] = gettext("You need to specify an address for the proxy port.");
} else {
$proxy['ip'] = $_GET['proxy_addr'];
}
if (empty($_GET['proxy_port'])) {
$input_errors[] = "You need to specify a port for the proxy ip.";
$input_errors[] = gettext("You need to specify a port for the proxy ip.");
} else {
$proxy['port'] = $_GET['proxy_port'];
}
......@@ -176,12 +176,12 @@ if (isset($config['openvpn']['openvpn-server'])) {
$proxy['proxy_authtype'] = $_GET['proxy_authtype'];
if ($_GET['proxy_authtype'] != "none") {
if (empty($_GET['proxy_user'])) {
$input_errors[] = "You need to specify a username with the proxy config.";
$input_errors[] = gettext("You need to specify a username with the proxy config.");
} else {
$proxy['user'] = $_GET['proxy_user'];
}
if (!empty($_GET['proxy_user']) && empty($_GET['proxy_password'])) {
$input_errors[] = "You need to specify a password with the proxy user.";
$input_errors[] = gettext("You need to specify a password with the proxy user.");
} else {
$proxy['password'] = $_GET['proxy_password'];
}
......@@ -243,7 +243,7 @@ if (isset($config['openvpn']['openvpn-server'])) {
}
if (!$exp_path) {
$input_errors[] = "Failed to export config files!";
$input_errors[] = gettext("Failed to export config files!");
}
if (count($input_errors) == 0) {
......
......@@ -76,7 +76,7 @@ if (isset($_GET['act'])) {
}
if (empty($_GET['useaddr'])) {
$input_errors[] = "You need to specify an IP or hostname.";
$input_errors[] = gettext("You need to specify an IP or hostname.");
} else {
$useaddr = $_GET['useaddr'];
}
......@@ -85,12 +85,12 @@ if (isset($_GET['act'])) {
if (!empty($_GET['proxy_addr']) || !empty($_GET['proxy_port'])) {
$proxy = array();
if (empty($_GET['proxy_addr'])) {
$input_errors[] = "You need to specify an address for the proxy port.";
$input_errors[] = gettext("You need to specify an address for the proxy port.");
} else {
$proxy['ip'] = $_GET['proxy_addr'];
}
if (empty($_GET['proxy_port'])) {
$input_errors[] = "You need to specify a port for the proxy ip.";
$input_errors[] = gettext("You need to specify a port for the proxy ip.");
} else {
$proxy['port'] = $_GET['proxy_port'];
}
......@@ -98,12 +98,12 @@ if (isset($_GET['act'])) {
$proxy['proxy_authtype'] = $_GET['proxy_authtype'];
if ($_GET['proxy_authtype'] != "none") {
if (empty($_GET['proxy_user'])) {
$input_errors[] = "You need to specify a username with the proxy config.";
$input_errors[] = gettext("You need to specify a username with the proxy config.");
} else {
$proxy['user'] = $_GET['proxy_user'];
}
if (!empty($_GET['proxy_user']) && empty($_GET['proxy_password'])) {
$input_errors[] = "You need to specify a password with the proxy user.";
$input_errors[] = gettext("You need to specify a password with the proxy user.");
} else {
$proxy['password'] = $_GET['proxy_password'];
}
......@@ -116,7 +116,7 @@ if (isset($_GET['act'])) {
}
$exp_data = openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipconf);
if (!$exp_data) {
$input_errors[] = "Failed to export config files!";
$input_errors[] = gettext("Failed to export config files!");
}
if (count($input_errors) == 0) {
if ($zipconf) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment