Compare commits

..

11 Commits

Author SHA1 Message Date
Dominique FOURNIER b723f47a44 dblayeroo : DEPRECATED Array and string offset access syntax with curly braces is deprecated [dblayeroo.php:1770] 2022-11-17 08:07:49 +01:00
Dominique FOURNIER 6c9d624d81 Certificationauthority.php : phpstan valid in level 6 2022-10-14 21:01:23 +02:00
Dominique FOURNIER 3ba6c5435a Certificationauthority : Add phpstan @return values when parameter is null 2022-09-09 08:34:19 +02:00
Dominique FOURNIER d7f0c2f6dd Better @return description 2022-09-06 16:41:46 +02:00
Dominique FOURNIER ed8449d321 Add the @return types 2022-07-27 10:26:43 +02:00
Dominique FOURNIER 89e26be943 Outputtxt : phpstan 2022-07-27 08:43:38 +02:00
Dominique FOURNIER e5d407960e Route : phpstan 2022-07-27 08:40:10 +02:00
Dominique FOURNIER bbcb816ff6 Smtp : phpstan 2022-07-27 08:37:17 +02:00
Dominique FOURNIER f083abb3fc TcpServer : phpstan 2022-07-27 08:36:33 +02:00
Dominique FOURNIER f810fbf8e5 Verify : phpstan 2022-07-27 08:35:53 +02:00
Dominique FOURNIER 8d2baff781 File : @return correctely typed 2022-07-27 08:33:20 +02:00
19 changed files with 98 additions and 115 deletions
+2 -2
View File
@@ -82,7 +82,7 @@ class Authentication
/** Setter/Getter for debug /** Setter/Getter for debug
* @param integer|null $debug The debug value to get/set * @param integer|null $debug The debug value to get/set
* @return the actual value or this * @return integer|self the actual value or this
*/ */
public function debug ($debug = null) public function debug ($debug = null)
// {{{ // {{{
@@ -380,7 +380,7 @@ class Authentication
* properties of the class. * properties of the class.
* @param string $email The email to check * @param string $email The email to check
* @param string $password The password to check * @param string $password The password to check
* @return an array containing the user data if the authentication is * @return array containing the user data if the authentication is
* correct, * correct,
* an exception if noting is found * an exception if noting is found
*/ */
+1 -1
View File
@@ -106,7 +106,7 @@ class Authjwt extends Auth
/** Save the auth data in cache directory and return the JWT token /** Save the auth data in cache directory and return the JWT token
* Do not allow to store data if the $auth is anonymous * Do not allow to store data if the $auth is anonymous
* @param array $auth The authentication to save * @param array $auth The authentication to save
* @return JWT token string * @return string JWT token
*/ */
public function createJwtToken ($auth) public function createJwtToken ($auth)
// {{{ // {{{
+11 -11
View File
@@ -59,7 +59,7 @@ class Authorizationdb extends Authorization
/** Return if the user right is NONE, READ, WRITE, EXECUTE /** Return if the user right is NONE, READ, WRITE, EXECUTE
if the object doesn't exists, or is not readable, throw an exception if the object doesn't exists, or is not readable, throw an exception
@param string $object The object path to examine @param string $object The object path to examine
@return an array with READ, WRITE, EXECUTE */ @return array with READ, WRITE, EXECUTE */
public function validate ($object) public function validate ($object)
{ {
if ($this->db === null) if ($this->db === null)
@@ -136,7 +136,7 @@ class Authorizationdb extends Authorization
@param integer $ownerid Owner ID of the object @param integer $ownerid Owner ID of the object
@param integer $groupid Group ID of the object @param integer $groupid Group ID of the object
@param integer $modbits Bits of authorization @param integer $modbits Bits of authorization
@return TRUE or an exception with the error message */ @return boolean TRUE or an exception with the error message */
public function add ($object, $ownerid, $groupid, $modbits) public function add ($object, $ownerid, $groupid, $modbits)
{ {
if ($this->db === null) if ($this->db === null)
@@ -205,7 +205,7 @@ class Authorizationdb extends Authorization
/** Remove the information about an object and all its sub-objects /** Remove the information about an object and all its sub-objects
@param string $object Object path to drop @param string $object Object path to drop
@return TRUE or an exception with the error message */ @return boolean TRUE or an exception with the error message */
public function drop ($object) public function drop ($object)
{ {
if ($this->db === null) if ($this->db === null)
@@ -279,7 +279,7 @@ class Authorizationdb extends Authorization
Need to be the root administrator Need to be the root administrator
@param string $object Object path to add @param string $object Object path to add
@param integer $ownerid Owner ID of the object @param integer $ownerid Owner ID of the object
@return TRUE or an exception with the error message */ @return boolean TRUE or an exception with the error message */
public function chown ($object, $ownerid) public function chown ($object, $ownerid)
{ {
if ($this->db === null) if ($this->db === null)
@@ -322,7 +322,7 @@ class Authorizationdb extends Authorization
Need to be the ownerid of the object or the root administrator Need to be the ownerid of the object or the root administrator
@param string $object Object path to add @param string $object Object path to add
@param integer $groupid Group ID of the object @param integer $groupid Group ID of the object
@return TRUE or an exception with the error message */ @return boolean TRUE or an exception with the error message */
public function chgrp ($object, $groupid) public function chgrp ($object, $groupid)
{ {
if ($this->db === null) if ($this->db === null)
@@ -368,7 +368,7 @@ class Authorizationdb extends Authorization
Need to be the owner of the object or the root administrator Need to be the owner of the object or the root administrator
@param string $object Object path to change @param string $object Object path to change
@param integer $mod Bits of authorization @param integer $mod Bits of authorization
@return TRUE or an exception with the error message */ @return boolean TRUE or an exception with the error message */
public function chmod ($object, $mod) public function chmod ($object, $mod)
{ {
if ($this->db === null) if ($this->db === null)
@@ -411,7 +411,7 @@ class Authorizationdb extends Authorization
/** Return the mode bits for an object if all his parents are readable for /** Return the mode bits for an object if all his parents are readable for
the user the user
@param string $object Object path to examine @param string $object Object path to examine
@return the modbits or an exception with the error message */ @return int|float the modbits or an exception with the error message */
public function lsmod ($object) public function lsmod ($object)
{ {
if ($this->db === null) if ($this->db === null)
@@ -449,7 +449,7 @@ class Authorizationdb extends Authorization
/** Return the ownerid for an object if all his parents are readable for /** Return the ownerid for an object if all his parents are readable for
the user the user
@param string $object Object path to examine @param string $object Object path to examine
@return the ownerid or an exception with the error message */ @return integer the ownerid or an exception with the error message */
public function lsown ($object) public function lsown ($object)
{ {
if ($this->db === null) if ($this->db === null)
@@ -487,7 +487,7 @@ class Authorizationdb extends Authorization
/** Return the groupid for an object if all his parents are readable for /** Return the groupid for an object if all his parents are readable for
the user the user
@param string $object Object path to examine @param string $object Object path to examine
@return the groupid or an exception with the error message */ @return integer the groupid or an exception with the error message */
public function lsgrp ($object) public function lsgrp ($object)
{ {
if ($this->db === null) if ($this->db === null)
@@ -527,7 +527,7 @@ class Authorizationdb extends Authorization
//////////////////// ////////////////////
/** Check if all the parent objects are executable /** Check if all the parent objects are executable
@param string $object The object to test @param string $object The object to test
@return TRUE or an exception in case of error */ @return boolean TRUE or an exception in case of error */
private function treecheckExecute ($object) private function treecheckExecute ($object)
{ {
if ($this->db === null) if ($this->db === null)
@@ -602,7 +602,7 @@ class Authorizationdb extends Authorization
/** Check if the parent of object is writeable /** Check if the parent of object is writeable
@param string $object The object to found @param string $object The object to found
@return TRUE or an exception */ @return boolean TRUE or an exception */
private function treecheckWrite ($object) private function treecheckWrite ($object)
{ {
$parent = dirname ($object); $parent = dirname ($object);
+6 -26
View File
@@ -12,7 +12,6 @@ namespace Domframework;
class Certificationauthority class Certificationauthority
{ {
// PROPERTIES // PROPERTIES
// {{{
/** The opensslCnfPath file /** The opensslCnfPath file
*/ */
private $opensslCnfPath; private $opensslCnfPath;
@@ -53,12 +52,10 @@ basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment keyUsage = nonRepudiation, digitalSignature, keyEncipherment
extendedKeyUsage = serverAuth, clientAuth extendedKeyUsage = serverAuth, clientAuth
'; ';
// }}}
/** Check if openssl support is available in PHP /** Check if openssl support is available in PHP
*/ */
public function __construct () public function __construct ()
// {{{
{ {
if (! function_exists ("openssl_csr_new")) if (! function_exists ("openssl_csr_new"))
throw new \Exception (dgettext ("domframework", throw new \Exception (dgettext ("domframework",
@@ -71,17 +68,14 @@ extendedKeyUsage = serverAuth, clientAuth
"private_key_bits" => 4096, "private_key_bits" => 4096,
); );
} }
// }}}
/** Remove the temporary files when destroying the object /** Remove the temporary files when destroying the object
*/ */
public function __destruct () public function __destruct ()
// {{{
{ {
if (file_exists ($this->opensslCnfPath)) if (file_exists ($this->opensslCnfPath))
unlink ($this->opensslCnfPath); unlink ($this->opensslCnfPath);
} }
// }}}
/** Create the pair key/cert for authority /** Create the pair key/cert for authority
* @param string $countryName Country name (like FR) * @param string $countryName Country name (like FR)
@@ -93,7 +87,6 @@ extendedKeyUsage = serverAuth, clientAuth
*/ */
public function createCA ($countryName, $organizationName, $commonName, public function createCA ($countryName, $organizationName, $commonName,
$days = 3650) $days = 3650)
// {{{
{ {
$req_key = openssl_pkey_new (array ( $req_key = openssl_pkey_new (array (
"config" => $this->opensslCnfPath, "config" => $this->opensslCnfPath,
@@ -117,14 +110,12 @@ extendedKeyUsage = serverAuth, clientAuth
openssl_pkey_export ($req_key, $this->caKey); openssl_pkey_export ($req_key, $this->caKey);
return $this; return $this;
} }
// }}}
/** Get/Set the ca cert /** Get/Set the ca cert
* @param string|null $caCert The CA cert to get/set * @param string|null $caCert The CA cert to get/set
* @return the CA if get in PEM, $this if set * @return ($caCert is null ? string : $this) the CA if get in PEM, $this if set
*/ */
public function caCert ($caCert = null) public function caCert ($caCert = null)
// {{{
{ {
if ($caCert === null) if ($caCert === null)
return $this->caCert; return $this->caCert;
@@ -133,14 +124,12 @@ extendedKeyUsage = serverAuth, clientAuth
$this->caCert = $caCert; $this->caCert = $caCert;
return $this; return $this;
} }
// }}}
/** Get/Set the ca key /** Get/Set the ca key
* @param string|null $caKey The CA key to get/set * @param string|null $caKey The CA key to get/set
* @return the CA if get, $this if set * @return ($caKey is null ? string : $this) the CA if get, $this if set
*/ */
public function caKey ($caKey = null) public function caKey ($caKey = null)
// {{{
{ {
if ($caKey === null) if ($caKey === null)
return $this->caKey; return $this->caKey;
@@ -149,13 +138,11 @@ extendedKeyUsage = serverAuth, clientAuth
$this->caKey = $caKey; $this->caKey = $caKey;
return $this; return $this;
} }
// }}}
/** Create a private key /** Create a private key
* @return $this; * @return $this;
*/ */
public function createPrivateKey () public function createPrivateKey ()
// {{{
{ {
$this->privateKey = openssl_pkey_new (array ( $this->privateKey = openssl_pkey_new (array (
"config" => $this->opensslCnfPath, "config" => $this->opensslCnfPath,
@@ -164,14 +151,12 @@ extendedKeyUsage = serverAuth, clientAuth
)); ));
return $this; return $this;
} }
// }}}
/** Get in PEM/Set the private key /** Get in PEM/Set the private key
* @param string|null $privateKey The private key to use * @param string|null $privateKey The private key to use
* @return the privatekey if get in PEM, $this if set * @return ($privateKey is null ? string : $this) the privatekey if get in PEM, $this if set
*/ */
public function privateKey ($privateKey = null) public function privateKey ($privateKey = null)
// {{{
{ {
if ($privateKey === null) if ($privateKey === null)
{ {
@@ -184,17 +169,15 @@ extendedKeyUsage = serverAuth, clientAuth
$this->privateKey = openssl_pkey_get_private ($privateKey); $this->privateKey = openssl_pkey_get_private ($privateKey);
return $this; return $this;
} }
// }}}
/** Create a CSR. /** Create a CSR.
* Will create a private key if none is already exists * Will create a private key if none is already exists
* @param string $countryName Country name (like FR) * @param string $countryName Country name (like FR)
* @param string $organizationName Name of organization * @param string $organizationName Name of organization
* @param string $commonName Common name of authority * @param string $commonName Common name of authority
* @return the CSR created in PEM * @return string the CSR created in PEM
*/ */
public function createCSR ($countryName, $organizationName, $commonName) public function createCSR ($countryName, $organizationName, $commonName)
// {{{
{ {
if ($this->privateKey === null) if ($this->privateKey === null)
$this->createPrivateKey (); $this->createPrivateKey ();
@@ -211,7 +194,6 @@ extendedKeyUsage = serverAuth, clientAuth
openssl_csr_export ($req_csr, $out); openssl_csr_export ($req_csr, $out);
return $out; return $out;
} }
// }}}
/** Sign a CSR with an CA cert/key pair and return the signed certificate in /** Sign a CSR with an CA cert/key pair and return the signed certificate in
* PEM mode * PEM mode
@@ -221,11 +203,10 @@ extendedKeyUsage = serverAuth, clientAuth
* @param string $caKey The CA private key * @param string $caKey The CA private key
* @param integer|null $days The number of days of validity (365 by default) * @param integer|null $days The number of days of validity (365 by default)
* @param array|null $altNames The alternative names allowed in cert * @param array|null $altNames The alternative names allowed in cert
* @return the signed certificate in PEM * @return string the signed certificate in PEM
*/ */
public function signCSR ($csr, $caCert, $caKey, $days = 365, public function signCSR ($csr, $caCert, $caKey, $days = 365,
$altNames = array ()) $altNames = array ())
// {{{
{ {
$conf = $this->opensslConf; $conf = $this->opensslConf;
if (! empty($altNames)) if (! empty($altNames))
@@ -248,7 +229,7 @@ extendedKeyUsage = serverAuth, clientAuth
} }
$this->configargs["x509_extensions"] = "v3_req"; $this->configargs["x509_extensions"] = "v3_req";
$usercert = openssl_csr_sign ($csr, $caCert, $caKey, $days, $usercert = openssl_csr_sign ($csr, $caCert, $caKey, $days,
$this->configargs, date ("YmdHis")); $this->configargs, intval(date ("YmdHis")));
if ($usercert === false) if ($usercert === false)
throw new \Exception ("Can not create certificate : " . throw new \Exception ("Can not create certificate : " .
openssl_error_string (), 500); openssl_error_string (), 500);
@@ -256,5 +237,4 @@ extendedKeyUsage = serverAuth, clientAuth
file_put_contents ($this->opensslCnfPath, $this->opensslConf); file_put_contents ($this->opensslCnfPath, $this->opensslConf);
return $certout; return $certout;
} }
// }}}
} }
+1 -1
View File
@@ -270,7 +270,7 @@ class Console
* @param string $propo Preset the text for the user * @param string $propo Preset the text for the user
* @param boolean|string $stopperChar The chars to stop the analysis and * @param boolean|string $stopperChar The chars to stop the analysis and
* return the result * return the result
* @return The typed string * @return string The typed string
*/ */
public function readline ($propo = "", $stopperChar = false) public function readline ($propo = "", $stopperChar = false)
// {{{ // {{{
+1 -1
View File
@@ -1769,7 +1769,7 @@ class Dblayeroo
$tmp = ""; $tmp = "";
for ($i = 0 ; $i < strlen ($columnNames) ; $i++) for ($i = 0 ; $i < strlen ($columnNames) ; $i++)
{ {
$char = $columnNames{$i}; $char = $columnNames[$i];
if ($parenthesis === true) if ($parenthesis === true)
{ {
$tmp .= $char; $tmp .= $char;
+13 -13
View File
@@ -131,7 +131,7 @@ class File
/** Chroot in the provided directory /** Chroot in the provided directory
* @param string $directory The directory to chroot * @param string $directory The directory to chroot
* @return true if the chroot is done, false if there is a failure * @return boolean true if the chroot is done, false if there is a failure
* @throws If directory not exists, or the directory is not executable * @throws If directory not exists, or the directory is not executable
*/ */
public function chroot ($directory) public function chroot ($directory)
@@ -230,9 +230,9 @@ class File
/** Write a string to a file /** Write a string to a file
* @param string $filename Path to the file where to write the data * @param string $filename Path to the file where to write the data
* @param string $data The data to write * @param string|integer $data The data to write
* @param integer|null $flags The optional flags * @param integer|null $flags The optional flags
* @return the length of the data stored * @return integer the length of the data stored
* @throws If parent directory not exists, is not writeable, or the file * @throws If parent directory not exists, is not writeable, or the file
* exists and is not writeable * exists and is not writeable
*/ */
@@ -260,9 +260,9 @@ class File
/** Get the file modification time of a file /** Get the file modification time of a file
* @param string $filename Path to the file * @param string $filename Path to the file
* @return the time the file was last modified, or FALSE on failure. The * @return integer|boolean the time the file was last modified, or FALSE
* time is returned as a Unix timestamp, which is suitable for the date() * on failure. The time is returned as a Unix timestamp, which is suitable
* function. * for the date() function.
* @throws If parent directory not exists, is not writeable * @throws If parent directory not exists, is not writeable
*/ */
public function filemtime ($filename) public function filemtime ($filename)
@@ -277,7 +277,7 @@ class File
/** Get the file size /** Get the file size
* @param string $filename Path to the file * @param string $filename Path to the file
* @return the size of the file or FALSE on failure. * @return integer|boolean the size of the file or FALSE on failure.
* @throws If parent directory not exists, is not writeable * @throws If parent directory not exists, is not writeable
*/ */
public function filesize ($filename) public function filesize ($filename)
@@ -292,7 +292,7 @@ class File
/** Get the file info of the provided filename /** Get the file info of the provided filename
* @param string $filename Path to the file * @param string $filename Path to the file
* @return the mimetype of the file * @return string the mimetype of the file
* @throws If parent directory not exists, is not writeable * @throws If parent directory not exists, is not writeable
*/ */
public function fileinfoMimeType ($filename) public function fileinfoMimeType ($filename)
@@ -515,7 +515,7 @@ class File
/** Calculate the md5 sum of a file /** Calculate the md5 sum of a file
* @param string $filename The file to hash * @param string $filename The file to hash
* @return the calulated hash * @return string the calulated hash
* @throws If the file doesn't exists * @throws If the file doesn't exists
*/ */
public function md5_file ($filename) public function md5_file ($filename)
@@ -781,7 +781,7 @@ class File
/** Calculate the sha1 sum of a file /** Calculate the sha1 sum of a file
* @param string $filename The file to hash * @param string $filename The file to hash
* @return the calulated hash * @return string the calulated hash
* @throws If the file doesn't exists * @throws If the file doesn't exists
*/ */
public function sha1_file ($filename) public function sha1_file ($filename)
@@ -849,8 +849,8 @@ class File
* Must use the filesystem path (complete) and not the version in chroot. * Must use the filesystem path (complete) and not the version in chroot.
* The last directoy must be executable and readable (no test for writeable) * The last directoy must be executable and readable (no test for writeable)
* @param string $path The directory path to check * @param string $path The directory path to check
* @return true if the path is executable for all the parents and for the * @return boolean true if the path is executable for all the parents and
* last directory * for the last directory
* @throws if there is a missing part, or a parent is not executable * @throws if there is a missing part, or a parent is not executable
*/ */
private function checkPathRO ($path) private function checkPathRO ($path)
@@ -967,7 +967,7 @@ class File
* @param integer $prio The message priority. Should be higher than * @param integer $prio The message priority. Should be higher than
* $this->debug to save the message * $this->debug to save the message
* @param string $message The message to save * @param string $message The message to save
* @return null; * @return null
*/ */
private function debug ($prio, $message) private function debug ($prio, $message)
// {{{ // {{{
+1 -1
View File
@@ -61,7 +61,7 @@ class Macaddresses
/** Remove all the separators from the provided MAC address /** Remove all the separators from the provided MAC address
* @param string $mac the mac address to update * @param string $mac the mac address to update
* @param array|null $separators The separators to remove * @param array|null $separators The separators to remove
* @return the updated mac address without separators * @return string the updated mac address without separators
*/ */
public static function removeSeparator ($mac, public static function removeSeparator ($mac,
$separators = array (":", "-", ".")) $separators = array (":", "-", "."))
+1 -1
View File
@@ -921,7 +921,7 @@ class Mail
/** Get an attachment of the mail /** Get an attachment of the mail
* @param integer $number the number of attach to get starting to 0 * @param integer $number the number of attach to get starting to 0
* @param boolean|null $inline Return only the attachments Inline if true * @param boolean|null $inline Return only the attachments Inline if true
* @return the content of the attachment. Can be binary * @return string the content of the attachment. Can be binary
*/ */
public function getAttachment ($number, $inline = false) public function getAttachment ($number, $inline = false)
// {{{ // {{{
+1 -1
View File
@@ -131,7 +131,7 @@ class Outputtxt extends Output
elseif ($data === NULL) elseif ($data === NULL)
echo "NULL\n"; echo "NULL\n";
else else
echo "TODO : ".gettype ($rc)." on ".__FILE__.":".__LINE__."\n"; echo "TODO : ".gettype ($data)." on ".__FILE__.":".__LINE__."\n";
if (!defined ("PHPUNIT")) if (!defined ("PHPUNIT"))
exit; exit;
} }
+4 -4
View File
@@ -69,7 +69,7 @@ class Password
// }}} // }}}
/** Create a salt, based on openssl_random_pseudo_bytes function /** Create a salt, based on openssl_random_pseudo_bytes function
* @return a string salt * @return string a string salt
*/ */
public function salt () public function salt ()
// {{{ // {{{
@@ -165,7 +165,7 @@ class Password
* chars). * chars).
* A maximum of 20% for special chars in the size * A maximum of 20% for special chars in the size
* @param integer|null $nbChars The number of chars (12 by default) * @param integer|null $nbChars The number of chars (12 by default)
* @return The random password * @return string The random password
*/ */
static public function generateASCII ($nbChars = 12) static public function generateASCII ($nbChars = 12)
// {{{ // {{{
@@ -194,7 +194,7 @@ class Password
/** Create a random password with $nbChars chars, Alphanumericals chars /** Create a random password with $nbChars chars, Alphanumericals chars
* (without special chars) * (without special chars)
* @param integer|null $nbChars The number of chars (12 by default) * @param integer|null $nbChars The number of chars (12 by default)
* @return The random password * @return string The random password
*/ */
static public function generateAlphanum ($nbChars = 12) static public function generateAlphanum ($nbChars = 12)
// {{{ // {{{
@@ -219,7 +219,7 @@ class Password
/** Create a random password with $nbChars chars, Alphabeticals chars /** Create a random password with $nbChars chars, Alphabeticals chars
* (without special chars, neither numbers) * (without special chars, neither numbers)
* @param integer|null $nbChars The number of chars (12 by default) * @param integer|null $nbChars The number of chars (12 by default)
* @return The random password * @return string The random password
*/ */
static public function generateAlphabetical ($nbChars = 12) static public function generateAlphabetical ($nbChars = 12)
// {{{ // {{{
+4 -3
View File
@@ -337,8 +337,9 @@ class Route
return $_POST["_METHOD"]; return $_POST["_METHOD"];
} }
if (!isset ($_SERVER["REQUEST_METHOD"])) if (!isset ($_SERVER["REQUEST_METHOD"])) {
$this->error (new \Exception ("No REQUEST_METHOD", 415)); $this->error (new \Exception ("No REQUEST_METHOD", 415));
}
if ($_SERVER["REQUEST_METHOD"] === "GET" || if ($_SERVER["REQUEST_METHOD"] === "GET" ||
$_SERVER["REQUEST_METHOD"] === "POST" || $_SERVER["REQUEST_METHOD"] === "POST" ||
$_SERVER["REQUEST_METHOD"] === "PUT" || $_SERVER["REQUEST_METHOD"] === "PUT" ||
@@ -350,6 +351,7 @@ class Route
} }
$this->error (new \Exception ("Invalid REQUEST_METHOD", 406)); $this->error (new \Exception ("Invalid REQUEST_METHOD", 406));
return "";
} }
/** Return the mached route search /** Return the mached route search
@@ -554,7 +556,6 @@ class Route
$regex = str_replace ("}", ">.+)", $regex); $regex = str_replace ("}", ">.+)", $regex);
else else
$regex = str_replace ("}", ">[^/]+)", $regex); $regex = str_replace ("}", ">[^/]+)", $regex);
unset ($matches);
$rcRegex = @preg_match ($regex, $url, $matches); $rcRegex = @preg_match ($regex, $url, $matches);
if ($rcRegex === false) if ($rcRegex === false)
{ {
@@ -708,7 +709,7 @@ class Route
} }
/** Return the last valid get page to return /** Return the last valid get page to return
* @return The last valid page URL * @return string The last valid page URL or "" if not set
*/ */
public function lastValidGetPage () public function lastValidGetPage ()
{ {
+2 -1
View File
@@ -79,6 +79,7 @@ class Smtp
$errno, $errstr, $errno, $errstr,
$this->timeout, STREAM_CLIENT_CONNECT, $this->timeout, STREAM_CLIENT_CONNECT,
$mainContext); $mainContext);
$php_errormsg = "";
ini_set('track_errors', 0); ini_set('track_errors', 0);
if ($this->smtpStream === false) if ($this->smtpStream === false)
{ {
@@ -167,7 +168,7 @@ class Smtp
* @param string|array $to the recipient of the email. Not displayed in the * @param string|array $to the recipient of the email. Not displayed in the
* email content * email content
* @param string $completeMail The content of the email * @param string $completeMail The content of the email
* @return the message from the server (where is stored the message queue * @return string the message from the server (where is stored the message queue
* identifier * identifier
*/ */
public function send ($from, $to, $completeMail) public function send ($from, $to, $completeMail)
+1 -2
View File
@@ -205,8 +205,7 @@ class Spfcheck
/** Get the DNS values set for the provided $domain/$part(/$entity) /** Get the DNS values set for the provided $domain/$part(/$entity)
* @param string $search The search entity * @param string $search The search entity
* @return array The array of result from DNS * @return array|boolean The array of result from DNS or false if not exists
* @return false if not exists
*/ */
public function getDNSEntries ($search) public function getDNSEntries ($search)
{ {
+1 -1
View File
@@ -309,7 +309,7 @@ class Sse
/** Initialize the backend for one specific file. /** Initialize the backend for one specific file.
* @param string $event The event to start * @param string $event The event to start
* @param string $filePath The file path where the event data are stored * @param string $filePath The file path where the event data are stored
* @return false if the file doesn't exists * @return boolean false if the file doesn't exists
*/ */
private function backendInitEvent ($event, $filePath) private function backendInitEvent ($event, $filePath)
// {{{ // {{{
+3 -3
View File
@@ -198,8 +198,8 @@ class Tcpclient
* @param boolean $val True to activate, false to disable SSL * @param boolean $val True to activate, false to disable SSL
* @param integer|null $cryptoMethod The cryptoMethod allowed * @param integer|null $cryptoMethod The cryptoMethod allowed
* @param array|null $options Can overload the SSL options if needed * @param array|null $options Can overload the SSL options if needed
* @return false if the client can not found a encryption method with the * @return boolean false if the client can not found a encryption method
* server * with the server
*/ */
public function cryptoEnable ($val, $cryptoMethod = null, $options = array ()) public function cryptoEnable ($val, $cryptoMethod = null, $options = array ())
// {{{ // {{{
@@ -258,7 +258,7 @@ class Tcpclient
* In text mode, the read return when found the first \r\n, and doesn't * In text mode, the read return when found the first \r\n, and doesn't
* returns the \r\n. * returns the \r\n.
* @param integer $maxLength Limit the length of the data from the server * @param integer $maxLength Limit the length of the data from the server
* @return The content * @return string The content
*/ */
public function read ($maxLength = 1024) public function read ($maxLength = 1024)
// {{{ // {{{
+4 -2
View File
@@ -64,6 +64,8 @@ class Tcpserver
/** Server name displayed in process list /** Server name displayed in process list
*/ */
private $processName = "tcpserver"; private $processName = "tcpserver";
private $ipOrName;
// }}} // }}}
//////////////////////// ////////////////////////
@@ -348,7 +350,7 @@ class Tcpserver
// }}} // }}}
/** Start the main loop in background and do not wait its end /** Start the main loop in background and do not wait its end
* @return the PID of the child * @return integer the PID of the child
*/ */
final public function loopInBackgroundStart () final public function loopInBackgroundStart ()
// {{{ // {{{
@@ -505,7 +507,7 @@ class Tcpserver
* Use the readMode in text or binary (text by default) * Use the readMode in text or binary (text by default)
* In text mode, the read return when found the first \r or the first \n. * In text mode, the read return when found the first \r or the first \n.
* @param integer $maxLength Limit the length of the data from the server * @param integer $maxLength Limit the length of the data from the server
* @return The content * @return string The content
*/ */
final public function read ($maxLength = 1024) final public function read ($maxLength = 1024)
// {{{ // {{{
+40 -40
View File
@@ -20,7 +20,7 @@ class Verify
*/ */
public function isIp ($val) public function isIp ($val)
{ {
return verify::staticIsIp ($val); return Verify::staticIsIp ($val);
} }
/** Check if $val is a valid IPv4 in static mode /** Check if $val is a valid IPv4 in static mode
@@ -41,7 +41,7 @@ class Verify
*/ */
public function is_ip ($val) public function is_ip ($val)
{ {
return verify::staticIsIp ($val); return Verify::staticIsIp ($val);
} }
/** Check if $val is a valid IPv4 in static mode /** Check if $val is a valid IPv4 in static mode
@@ -51,7 +51,7 @@ class Verify
*/ */
public static function staticIs_ip ($val) public static function staticIs_ip ($val)
{ {
return verify::staticIsIp ($val); return Verify::staticIsIp ($val);
} }
/** Check if $val is a valid IPv4 /** Check if $val is a valid IPv4
@@ -60,7 +60,7 @@ class Verify
*/ */
public function isIpv4 ($val) public function isIpv4 ($val)
{ {
return verify::staticIsIpv4 ($val); return Verify::staticIsIpv4 ($val);
} }
/** Check if $val is a valid IPv4 in static mode /** Check if $val is a valid IPv4 in static mode
@@ -81,7 +81,7 @@ class Verify
*/ */
public function is_ipv4 ($val) public function is_ipv4 ($val)
{ {
return verify::staticIsIpv4 ($val); return Verify::staticIsIpv4 ($val);
} }
/** Check if $val is a valid IPv4 in static mode /** Check if $val is a valid IPv4 in static mode
@@ -91,7 +91,7 @@ class Verify
*/ */
public static function staticIs_ipv4 ($val) public static function staticIs_ipv4 ($val)
{ {
return verify::staticIsIpv4 ($val); return Verify::staticIsIpv4 ($val);
} }
/** Check if $val is a valid IPv6 /** Check if $val is a valid IPv6
@@ -100,7 +100,7 @@ class Verify
*/ */
public function isIpv6 ($val) public function isIpv6 ($val)
{ {
return verify::staticIsIpv6 ($val); return Verify::staticIsIpv6 ($val);
} }
/** Check if $val is a valid IPv6 in static mode /** Check if $val is a valid IPv6 in static mode
@@ -121,7 +121,7 @@ class Verify
*/ */
public function is_ipv6 ($val) public function is_ipv6 ($val)
{ {
return verify::staticIsipv6 ($val); return Verify::staticIsipv6 ($val);
} }
/** Check if $val is a valid IPv6 in static mode /** Check if $val is a valid IPv6 in static mode
@@ -131,7 +131,7 @@ class Verify
*/ */
public static function staticIs_ipv6 ($val) public static function staticIs_ipv6 ($val)
{ {
return verify::staticIsipv6 ($val); return Verify::staticIsipv6 ($val);
} }
/** Check if $val is a valid hostname (without domain) /** Check if $val is a valid hostname (without domain)
@@ -140,7 +140,7 @@ class Verify
*/ */
public function isHostname ($val) public function isHostname ($val)
{ {
return verify::staticIsHostname ($val); return Verify::staticIsHostname ($val);
} }
/** Check if $val is a valid hostname (without domain) /** Check if $val is a valid hostname (without domain)
@@ -168,7 +168,7 @@ class Verify
*/ */
public function is_hostname ($val) public function is_hostname ($val)
{ {
return verify::staticIs_hostname ($val); return Verify::staticIs_hostname ($val);
} }
/** Check if $val is a valid hostname (without domain) /** Check if $val is a valid hostname (without domain)
@@ -178,7 +178,7 @@ class Verify
*/ */
public static function staticIs_hostname ($val) public static function staticIs_hostname ($val)
{ {
return verify::staticIsHostname ($val); return Verify::staticIsHostname ($val);
} }
/** Check if $val is a valid domain (without hostname) /** Check if $val is a valid domain (without hostname)
@@ -187,7 +187,7 @@ class Verify
*/ */
public function isDomain ($val) public function isDomain ($val)
{ {
return verify::staticIsDomain ($val); return Verify::staticIsDomain ($val);
} }
/** Check if $val is a valid domain (without hostname) in static mode /** Check if $val is a valid domain (without hostname) in static mode
@@ -216,7 +216,7 @@ class Verify
*/ */
public function is_domain ($val) public function is_domain ($val)
{ {
return verify::staticIsDomain ($val); return Verify::staticIsDomain ($val);
} }
/** Check if $val is a valid domain (without hostname) in static mode /** Check if $val is a valid domain (without hostname) in static mode
@@ -226,7 +226,7 @@ class Verify
*/ */
public static function staticIs_domain ($val) public static function staticIs_domain ($val)
{ {
return verify::staticIsDomain ($val); return Verify::staticIsDomain ($val);
} }
/** Check if $val is a valid FQDN /** Check if $val is a valid FQDN
@@ -235,7 +235,7 @@ class Verify
*/ */
public function isFQDN ($val) public function isFQDN ($val)
{ {
return verify::staticIsFQDN ($val); return Verify::staticIsFQDN ($val);
} }
/** Check if $val is a valid FQDN in static mode /** Check if $val is a valid FQDN in static mode
@@ -246,7 +246,7 @@ class Verify
{ {
if (strlen ($val) < 2 || strlen ($val) > 255) if (strlen ($val) < 2 || strlen ($val) > 255)
return false; return false;
if (verify::is_ip ($val)) if (Verify::staticIsIp ($val))
return false; return false;
if (strspn ($val, "abcdefghijklmnopqrstuvwxyz". if (strspn ($val, "abcdefghijklmnopqrstuvwxyz".
"ABCDEFGHIJKLMNOPQRSTUVWXYZ". "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
@@ -266,7 +266,7 @@ class Verify
*/ */
public function is_FQDN ($val) public function is_FQDN ($val)
{ {
return verify::staticIsFQDN ($val); return Verify::staticIsFQDN ($val);
} }
/** Check if $val is a valid FQDN in static mode /** Check if $val is a valid FQDN in static mode
@@ -276,7 +276,7 @@ class Verify
*/ */
public static function staticIs_FQDN ($val) public static function staticIs_FQDN ($val)
{ {
return verify::staticIsFQDN ($val); return Verify::staticIsFQDN ($val);
} }
/////////////// ///////////////
@@ -289,7 +289,7 @@ class Verify
*/ */
public function isDatetimeSQL ($val) public function isDatetimeSQL ($val)
{ {
return verify::staticIsDatetimeSQL ($val); return Verify::staticIsDatetimeSQL ($val);
} }
/** Check if $val is a valid date and time in SQL in static mode /** Check if $val is a valid date and time in SQL in static mode
@@ -323,7 +323,7 @@ class Verify
*/ */
public function is_datetimeSQL ($val) public function is_datetimeSQL ($val)
{ {
return verify::staticIsDatetimeSQL ($val); return Verify::staticIsDatetimeSQL ($val);
} }
/** Check if $val is a valid date and time in SQL in static mode /** Check if $val is a valid date and time in SQL in static mode
@@ -334,7 +334,7 @@ class Verify
*/ */
public static function staticIs_datetimeSQL ($val) public static function staticIs_datetimeSQL ($val)
{ {
return verify::staticIsDatetimeSQL ($val); return Verify::staticIsDatetimeSQL ($val);
} }
/** Check if $val is a valid date in SQL /** Check if $val is a valid date in SQL
@@ -344,7 +344,7 @@ class Verify
*/ */
public function isDateSQL ($val) public function isDateSQL ($val)
{ {
return verify::staticIsDateSQL ($val); return Verify::staticIsDateSQL ($val);
} }
/** Check if $val is a valid date in SQL in static mode /** Check if $val is a valid date in SQL in static mode
@@ -378,7 +378,7 @@ class Verify
*/ */
public function is_dateSQL ($val) public function is_dateSQL ($val)
{ {
return verify::staticIsDateSQL ($val); return Verify::staticIsDateSQL ($val);
} }
/** Check if $val is a valid date in SQL in static mode /** Check if $val is a valid date in SQL in static mode
@@ -389,7 +389,7 @@ class Verify
*/ */
public static function staticIs_dateSQL ($val) public static function staticIs_dateSQL ($val)
{ {
return verify::staticIsDateSQL ($val); return Verify::staticIsDateSQL ($val);
} }
@@ -403,7 +403,7 @@ class Verify
*/ */
public function isAllowedChars ($val, $allowedChars) public function isAllowedChars ($val, $allowedChars)
{ {
return verify::staticIsAllowedChars ($val, $allowedChars); return Verify::staticIsAllowedChars ($val, $allowedChars);
} }
/** Check if the provided value is only contains the provided chars. /** Check if the provided value is only contains the provided chars.
@@ -430,7 +430,7 @@ class Verify
*/ */
public function isInteger ($val) public function isInteger ($val)
{ {
return verify::staticIsInteger ($val); return Verify::staticIsInteger ($val);
} }
/** Return true if the provided value is an integer in decimal (not octal) /** Return true if the provided value is an integer in decimal (not octal)
@@ -454,7 +454,7 @@ class Verify
*/ */
public function is_integer ($val) public function is_integer ($val)
{ {
return verify::staticIsInteger ($val); return Verify::staticIsInteger ($val);
} }
/** Return true if the provided value is an integer in decimal (not octal) /** Return true if the provided value is an integer in decimal (not octal)
@@ -464,7 +464,7 @@ class Verify
*/ */
public static function staticIs_integer ($val) public static function staticIs_integer ($val)
{ {
return verify::staticIsInteger ($val); return Verify::staticIsInteger ($val);
} }
//////////////// ////////////////
@@ -476,7 +476,7 @@ class Verify
*/ */
public function isEmail ($val) public function isEmail ($val)
{ {
return verify::staticIsEmail ($val); return Verify::staticIsEmail ($val);
} }
/** Return true if the provided value is a valid email address in static mode /** Return true if the provided value is a valid email address in static mode
@@ -495,7 +495,7 @@ class Verify
*/ */
public function is_email ($val) public function is_email ($val)
{ {
return verify::staticIsEmail ($val); return Verify::staticIsEmail ($val);
} }
/** Return true if the provided value is a valid email address in static mode /** Return true if the provided value is a valid email address in static mode
@@ -505,7 +505,7 @@ class Verify
*/ */
public static function staticIs_email ($val) public static function staticIs_email ($val)
{ {
return verify::staticIsEmail ($val); return Verify::staticIsEmail ($val);
} }
///////////// /////////////
@@ -517,7 +517,7 @@ class Verify
*/ */
public function isURL ($val) public function isURL ($val)
{ {
return verify::staticIsURL ($val); return Verify::staticIsURL ($val);
} }
/** Return true if the provided value is a valid URL in static mode /** Return true if the provided value is a valid URL in static mode
@@ -536,7 +536,7 @@ class Verify
*/ */
public function is_URL ($val) public function is_URL ($val)
{ {
return verify::staticIsURL ($val); return Verify::staticIsURL ($val);
} }
/** Return true if the provided value is a valid URL in static mode /** Return true if the provided value is a valid URL in static mode
@@ -546,7 +546,7 @@ class Verify
*/ */
public static function staticIs_URL ($val) public static function staticIs_URL ($val)
{ {
return verify::staticIsURL ($val); return Verify::staticIsURL ($val);
} }
////////////////// //////////////////
@@ -559,7 +559,7 @@ class Verify
*/ */
public function isUUID ($val) public function isUUID ($val)
{ {
return verify::staticIsUUID ($val); return Verify::staticIsUUID ($val);
} }
/** Return true if the provided value is a valid UUID in static mode /** Return true if the provided value is a valid UUID in static mode
@@ -589,7 +589,7 @@ class Verify
*/ */
public function is_UUID ($val) public function is_UUID ($val)
{ {
return verify::staticIsUUID ($val); return Verify::staticIsUUID ($val);
} }
/** Return true if the provided value is a valid UUID in static mode /** Return true if the provided value is a valid UUID in static mode
@@ -600,7 +600,7 @@ class Verify
*/ */
public static function staticIs_UUID ($val) public static function staticIs_UUID ($val)
{ {
return verify::staticIsUUID ($val); return Verify::staticIsUUID ($val);
} }
/** Return true if the provided string is a valid hash /** Return true if the provided string is a valid hash
@@ -609,7 +609,7 @@ class Verify
*/ */
public function isHash ($algo, $val) public function isHash ($algo, $val)
{ {
return verify::IsHash ($algo, $val); return Verify::IsHash ($algo, $val);
} }
/** Return true if the provided string is a valid hash in static /** Return true if the provided string is a valid hash in static
@@ -625,7 +625,7 @@ class Verify
$len = strlen (hash ($algo, "")); $len = strlen (hash ($algo, ""));
if (strlen ($val) !== $len) if (strlen ($val) !== $len)
return false; return false;
if (verify::staticIsAllowedChars ($val, "0123456789abcdef") === false) if (Verify::staticIsAllowedChars ($val, "0123456789abcdef") === false)
return false; return false;
return true; return true;
} }
+1 -1
View File
@@ -208,7 +208,7 @@ class Xmppclient
// PRIVATE METHODS // // PRIVATE METHODS //
/** Read fron socket /** Read fron socket
* @return the read value * @return string the read value
*/ */
private function read () private function read ()
// {{{ // {{{