Update gettext : add spaces
DomCi : remove line too longs on all the files git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5280 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -12,7 +12,7 @@ class ipaddresses
|
||||
public function validIPAddress ($ip)
|
||||
{
|
||||
if (!is_string ($ip) || $ip === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IP address"),
|
||||
500);
|
||||
$rc = $this->validIPv4Address ($ip);
|
||||
if ($rc === TRUE)
|
||||
@@ -27,7 +27,7 @@ class ipaddresses
|
||||
public function validIPv4Address ($ip)
|
||||
{
|
||||
if (!is_string ($ip) || $ip === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv4 address"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IPv4 address"),
|
||||
500);
|
||||
$rc = filter_var ($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
|
||||
if ($rc ===FALSE)
|
||||
@@ -41,7 +41,7 @@ class ipaddresses
|
||||
public function validIPv6Address ($ip)
|
||||
{
|
||||
if (!is_string ($ip) || $ip === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv6 address"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IPv6 address"),
|
||||
500);
|
||||
$rc = filter_var ($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
|
||||
if ($rc ===FALSE)
|
||||
@@ -56,7 +56,7 @@ class ipaddresses
|
||||
public function validIPAddressWithCIDR ($ip)
|
||||
{
|
||||
if (!is_string ($ip) || $ip === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IP address"),
|
||||
500);
|
||||
$rc = $this->validIPv4AddressWithCIDR ($ip);
|
||||
if ($rc === true)
|
||||
@@ -72,7 +72,7 @@ class ipaddresses
|
||||
public function validIPv4AddressWithCIDR ($ip)
|
||||
{
|
||||
if (!is_string ($ip) || $ip === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv4 address"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IPv4 address"),
|
||||
500);
|
||||
@list ($ip, $cidr) = @explode ("/", $ip);
|
||||
if ($cidr === null)
|
||||
@@ -92,7 +92,7 @@ class ipaddresses
|
||||
public function validIPv6AddressWithCIDR ($ip)
|
||||
{
|
||||
if (!is_string ($ip) || $ip === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv6 address"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IPv6 address"),
|
||||
500);
|
||||
@list ($ip, $cidr) = @explode ("/", $ip);
|
||||
if ($cidr === null)
|
||||
@@ -112,7 +112,7 @@ class ipaddresses
|
||||
public function validCIDR ($cidr)
|
||||
{
|
||||
if (! is_integer ($cidr) && ! is_integer ($cidr))
|
||||
throw new \Exception (dgettext("domframework", "Invalid CIDR provided"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid CIDR provided"),
|
||||
500);
|
||||
if (strspn ($cidr, "0123456879") !== strlen ($cidr))
|
||||
return false;
|
||||
@@ -128,7 +128,7 @@ class ipaddresses
|
||||
public function validIPv4CIDR ($cidr)
|
||||
{
|
||||
if (! is_integer ($cidr) && ! is_string ($cidr))
|
||||
throw new \Exception (dgettext("domframework", "Invalid CIDR provided"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid CIDR provided"),
|
||||
500);
|
||||
if (strspn ($cidr, "0123456879") !== strlen ($cidr))
|
||||
return false;
|
||||
@@ -144,7 +144,7 @@ class ipaddresses
|
||||
public function validIPv6CIDR ($cidr)
|
||||
{
|
||||
if (! is_integer ($cidr) && ! is_string ($cidr))
|
||||
throw new \Exception (dgettext("domframework", "Invalid CIDR provided"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid CIDR provided"),
|
||||
500);
|
||||
if (strspn ($cidr, "0123456879") !== strlen ($cidr))
|
||||
return false;
|
||||
@@ -230,7 +230,7 @@ class ipaddresses
|
||||
{
|
||||
if (! is_string ($ip) || $ip === "" ||
|
||||
$this->validIPAddress ($ip) === false)
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IP address"),
|
||||
500);
|
||||
if (strstr ($ip,"::"))
|
||||
{
|
||||
@@ -284,10 +284,10 @@ class ipaddresses
|
||||
public function groupIPv6 ($ipv6)
|
||||
{
|
||||
if (! is_string ($ipv6) || $ipv6 === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv6 address"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IPv6 address"),
|
||||
500);
|
||||
if (substr_count ($ipv6, ".") !== 31)
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv6 address"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IPv6 address"),
|
||||
500);
|
||||
$ipv6 = str_replace (".", "", $ipv6);
|
||||
$new = "";
|
||||
@@ -314,7 +314,7 @@ class ipaddresses
|
||||
public function completeAddressWithZero ($ip)
|
||||
{
|
||||
if (! is_string ($ip) || $ip === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IP address"),
|
||||
500);
|
||||
$ip = $this->uncompressIPv6 ($ip);
|
||||
if (substr_count ($ip, ":") === 7)
|
||||
@@ -338,7 +338,7 @@ class ipaddresses
|
||||
// IPv4
|
||||
return $ip;
|
||||
}
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"), 500);
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IP address"), 500);
|
||||
}
|
||||
|
||||
/** Return the provided CIDR in binary. Length must be in bytes.
|
||||
@@ -349,9 +349,9 @@ class ipaddresses
|
||||
public function cidrToBin ($cidr, $length)
|
||||
{
|
||||
if (! is_numeric ($cidr) || $cidr < 0 || $cidr > 128)
|
||||
throw new \Exception (dgettext("domframework", "Invalid CIDR"), 500);
|
||||
throw new \Exception (dgettext ("domframework", "Invalid CIDR"), 500);
|
||||
if (! is_numeric ($length) || $length < 1 || $length > 16)
|
||||
throw new \Exception (dgettext("domframework", "Invalid length"), 500);
|
||||
throw new \Exception (dgettext ("domframework", "Invalid length"), 500);
|
||||
$val="";
|
||||
for ( $i=0 ; $i<$length*8 ; $i++ )
|
||||
{
|
||||
@@ -413,7 +413,7 @@ class ipaddresses
|
||||
function reverseIPAddress ($ipReverse)
|
||||
{
|
||||
if (!is_string ($ipReverse) || $ipReverse === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IP address"),
|
||||
500);
|
||||
$ipReverse = $this->completeAddressWithZero ($ipReverse);
|
||||
if (substr_count ($ipReverse, ":") === 7 && strlen ($ipReverse) == 39)
|
||||
@@ -439,7 +439,7 @@ class ipaddresses
|
||||
$ipnew = implode (".", $tmp2);
|
||||
return $ipnew;
|
||||
}
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"), 500);
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IP address"), 500);
|
||||
}
|
||||
|
||||
/** This function return the CIDR associated to the provided netmask
|
||||
@@ -452,7 +452,7 @@ class ipaddresses
|
||||
{
|
||||
$netmask = ip2long ($netmask);
|
||||
if ($netmask === FALSE)
|
||||
throw new \Exception (dgettext("domframework", "Invalid netmask"), 500);
|
||||
throw new \Exception (dgettext ("domframework", "Invalid netmask"), 500);
|
||||
$netmask = decbin ($netmask);
|
||||
for ($i=0 ; $i<32 ; $i++)
|
||||
{
|
||||
@@ -474,26 +474,26 @@ class ipaddresses
|
||||
public function ipInNetwork ($ip, $network, $cidr)
|
||||
{
|
||||
if ($this->validIPAddress ($ip) === false)
|
||||
throw new \Excpetion (dgettext("domframework", "Invalid IP address"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IP address"),
|
||||
500);
|
||||
if ($this->validIPAddress ($network) === false)
|
||||
throw new \Excpetion (dgettext("domframework", "Invalid Network address"),
|
||||
500);
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Invalid Network address"), 500);
|
||||
$ipv4 = $this->validIPv4Address ($ip);
|
||||
$networkv4 = $this->validIPv4Address ($network);
|
||||
if ($ipv4 !== $networkv4)
|
||||
throw new \Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Network and IP address are not compatible"), 500);
|
||||
if ($ipv4 === true)
|
||||
{
|
||||
if ($this->validIPv4CIDR ($cidr) === false)
|
||||
throw new \Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"CIDR is not IPv4 compatible"), 500);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->validIPv6CIDR ($cidr) === false)
|
||||
throw new \Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"CIDR is not IPv6 compatible"), 500);
|
||||
}
|
||||
return ($this->networkFirstIP ($ip, $cidr) ===
|
||||
@@ -536,19 +536,19 @@ class ipaddresses
|
||||
private function networkFirstLastIP ($ip, $cidr, $map)
|
||||
{
|
||||
if ($this->validIPAddress ($ip) === false)
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"),
|
||||
throw new \Exception (dgettext ("domframework", "Invalid IP address"),
|
||||
500);
|
||||
$ipv4 = $this->validIPv4Address ($ip);
|
||||
if ($ipv4 === true)
|
||||
{
|
||||
if ($this->validIPv4CIDR ($cidr) === false)
|
||||
throw new \Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"CIDR is not IPv4 compatible"), 500);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->validIPv6CIDR ($cidr) === false)
|
||||
throw new \Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"CIDR is not IPv6 compatible"), 500);
|
||||
}
|
||||
// Convert the IP and CIDR to binary string
|
||||
|
||||
Reference in New Issue
Block a user