Compare commits
11 Commits
e2eb34584c
...
b723f47a44
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b723f47a44 | ||
|
|
6c9d624d81 | ||
|
|
3ba6c5435a | ||
|
|
d7f0c2f6dd | ||
|
|
ed8449d321 | ||
|
|
89e26be943 | ||
|
|
e5d407960e | ||
|
|
bbcb816ff6 | ||
|
|
f083abb3fc | ||
|
|
f810fbf8e5 | ||
|
|
8d2baff781 |
@@ -82,7 +82,7 @@ class Authentication
|
||||
|
||||
/** Setter/Getter for debug
|
||||
* @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)
|
||||
// {{{
|
||||
@@ -380,7 +380,7 @@ class Authentication
|
||||
* properties of the class.
|
||||
* @param string $email The email 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,
|
||||
* an exception if noting is found
|
||||
*/
|
||||
|
||||
@@ -106,7 +106,7 @@ class Authjwt extends Auth
|
||||
/** Save the auth data in cache directory and return the JWT token
|
||||
* Do not allow to store data if the $auth is anonymous
|
||||
* @param array $auth The authentication to save
|
||||
* @return JWT token string
|
||||
* @return string JWT token
|
||||
*/
|
||||
public function createJwtToken ($auth)
|
||||
// {{{
|
||||
|
||||
@@ -59,7 +59,7 @@ class Authorizationdb extends Authorization
|
||||
/** Return if the user right is NONE, READ, WRITE, EXECUTE
|
||||
if the object doesn't exists, or is not readable, throw an exception
|
||||
@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)
|
||||
{
|
||||
if ($this->db === null)
|
||||
@@ -136,7 +136,7 @@ class Authorizationdb extends Authorization
|
||||
@param integer $ownerid Owner ID of the object
|
||||
@param integer $groupid Group ID of the object
|
||||
@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)
|
||||
{
|
||||
if ($this->db === null)
|
||||
@@ -205,7 +205,7 @@ class Authorizationdb extends Authorization
|
||||
|
||||
/** Remove the information about an object and all its sub-objects
|
||||
@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)
|
||||
{
|
||||
if ($this->db === null)
|
||||
@@ -279,7 +279,7 @@ class Authorizationdb extends Authorization
|
||||
Need to be the root administrator
|
||||
@param string $object Object path to add
|
||||
@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)
|
||||
{
|
||||
if ($this->db === null)
|
||||
@@ -322,7 +322,7 @@ class Authorizationdb extends Authorization
|
||||
Need to be the ownerid of the object or the root administrator
|
||||
@param string $object Object path to add
|
||||
@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)
|
||||
{
|
||||
if ($this->db === null)
|
||||
@@ -368,7 +368,7 @@ class Authorizationdb extends Authorization
|
||||
Need to be the owner of the object or the root administrator
|
||||
@param string $object Object path to change
|
||||
@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)
|
||||
{
|
||||
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
|
||||
the user
|
||||
@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)
|
||||
{
|
||||
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
|
||||
the user
|
||||
@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)
|
||||
{
|
||||
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
|
||||
the user
|
||||
@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)
|
||||
{
|
||||
if ($this->db === null)
|
||||
@@ -527,7 +527,7 @@ class Authorizationdb extends Authorization
|
||||
////////////////////
|
||||
/** Check if all the parent objects are executable
|
||||
@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)
|
||||
{
|
||||
if ($this->db === null)
|
||||
@@ -602,7 +602,7 @@ class Authorizationdb extends Authorization
|
||||
|
||||
/** Check if the parent of object is writeable
|
||||
@param string $object The object to found
|
||||
@return TRUE or an exception */
|
||||
@return boolean TRUE or an exception */
|
||||
private function treecheckWrite ($object)
|
||||
{
|
||||
$parent = dirname ($object);
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace Domframework;
|
||||
class Certificationauthority
|
||||
{
|
||||
// PROPERTIES
|
||||
// {{{
|
||||
/** The opensslCnfPath file
|
||||
*/
|
||||
private $opensslCnfPath;
|
||||
@@ -53,12 +52,10 @@ basicConstraints = CA:FALSE
|
||||
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
||||
extendedKeyUsage = serverAuth, clientAuth
|
||||
';
|
||||
// }}}
|
||||
|
||||
/** Check if openssl support is available in PHP
|
||||
*/
|
||||
public function __construct ()
|
||||
// {{{
|
||||
{
|
||||
if (! function_exists ("openssl_csr_new"))
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
@@ -71,17 +68,14 @@ extendedKeyUsage = serverAuth, clientAuth
|
||||
"private_key_bits" => 4096,
|
||||
);
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Remove the temporary files when destroying the object
|
||||
*/
|
||||
public function __destruct ()
|
||||
// {{{
|
||||
{
|
||||
if (file_exists ($this->opensslCnfPath))
|
||||
unlink ($this->opensslCnfPath);
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Create the pair key/cert for authority
|
||||
* @param string $countryName Country name (like FR)
|
||||
@@ -93,7 +87,6 @@ extendedKeyUsage = serverAuth, clientAuth
|
||||
*/
|
||||
public function createCA ($countryName, $organizationName, $commonName,
|
||||
$days = 3650)
|
||||
// {{{
|
||||
{
|
||||
$req_key = openssl_pkey_new (array (
|
||||
"config" => $this->opensslCnfPath,
|
||||
@@ -117,14 +110,12 @@ extendedKeyUsage = serverAuth, clientAuth
|
||||
openssl_pkey_export ($req_key, $this->caKey);
|
||||
return $this;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Get/Set the ca cert
|
||||
* @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)
|
||||
// {{{
|
||||
{
|
||||
if ($caCert === null)
|
||||
return $this->caCert;
|
||||
@@ -133,14 +124,12 @@ extendedKeyUsage = serverAuth, clientAuth
|
||||
$this->caCert = $caCert;
|
||||
return $this;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Get/Set the ca key
|
||||
* @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)
|
||||
// {{{
|
||||
{
|
||||
if ($caKey === null)
|
||||
return $this->caKey;
|
||||
@@ -149,13 +138,11 @@ extendedKeyUsage = serverAuth, clientAuth
|
||||
$this->caKey = $caKey;
|
||||
return $this;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Create a private key
|
||||
* @return $this;
|
||||
*/
|
||||
public function createPrivateKey ()
|
||||
// {{{
|
||||
{
|
||||
$this->privateKey = openssl_pkey_new (array (
|
||||
"config" => $this->opensslCnfPath,
|
||||
@@ -164,14 +151,12 @@ extendedKeyUsage = serverAuth, clientAuth
|
||||
));
|
||||
return $this;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Get in PEM/Set the private key
|
||||
* @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)
|
||||
// {{{
|
||||
{
|
||||
if ($privateKey === null)
|
||||
{
|
||||
@@ -184,17 +169,15 @@ extendedKeyUsage = serverAuth, clientAuth
|
||||
$this->privateKey = openssl_pkey_get_private ($privateKey);
|
||||
return $this;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Create a CSR.
|
||||
* Will create a private key if none is already exists
|
||||
* @param string $countryName Country name (like FR)
|
||||
* @param string $organizationName Name of organization
|
||||
* @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)
|
||||
// {{{
|
||||
{
|
||||
if ($this->privateKey === null)
|
||||
$this->createPrivateKey ();
|
||||
@@ -211,7 +194,6 @@ extendedKeyUsage = serverAuth, clientAuth
|
||||
openssl_csr_export ($req_csr, $out);
|
||||
return $out;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Sign a CSR with an CA cert/key pair and return the signed certificate in
|
||||
* PEM mode
|
||||
@@ -221,11 +203,10 @@ extendedKeyUsage = serverAuth, clientAuth
|
||||
* @param string $caKey The CA private key
|
||||
* @param integer|null $days The number of days of validity (365 by default)
|
||||
* @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,
|
||||
$altNames = array ())
|
||||
// {{{
|
||||
{
|
||||
$conf = $this->opensslConf;
|
||||
if (! empty($altNames))
|
||||
@@ -248,7 +229,7 @@ extendedKeyUsage = serverAuth, clientAuth
|
||||
}
|
||||
$this->configargs["x509_extensions"] = "v3_req";
|
||||
$usercert = openssl_csr_sign ($csr, $caCert, $caKey, $days,
|
||||
$this->configargs, date ("YmdHis"));
|
||||
$this->configargs, intval(date ("YmdHis")));
|
||||
if ($usercert === false)
|
||||
throw new \Exception ("Can not create certificate : " .
|
||||
openssl_error_string (), 500);
|
||||
@@ -256,5 +237,4 @@ extendedKeyUsage = serverAuth, clientAuth
|
||||
file_put_contents ($this->opensslCnfPath, $this->opensslConf);
|
||||
return $certout;
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ class Console
|
||||
* @param string $propo Preset the text for the user
|
||||
* @param boolean|string $stopperChar The chars to stop the analysis and
|
||||
* return the result
|
||||
* @return The typed string
|
||||
* @return string The typed string
|
||||
*/
|
||||
public function readline ($propo = "", $stopperChar = false)
|
||||
// {{{
|
||||
|
||||
@@ -1769,7 +1769,7 @@ class Dblayeroo
|
||||
$tmp = "";
|
||||
for ($i = 0 ; $i < strlen ($columnNames) ; $i++)
|
||||
{
|
||||
$char = $columnNames{$i};
|
||||
$char = $columnNames[$i];
|
||||
if ($parenthesis === true)
|
||||
{
|
||||
$tmp .= $char;
|
||||
|
||||
26
src/File.php
26
src/File.php
@@ -131,7 +131,7 @@ class File
|
||||
|
||||
/** Chroot in the provided directory
|
||||
* @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
|
||||
*/
|
||||
public function chroot ($directory)
|
||||
@@ -230,9 +230,9 @@ class File
|
||||
|
||||
/** Write a string to a file
|
||||
* @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
|
||||
* @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
|
||||
* exists and is not writeable
|
||||
*/
|
||||
@@ -260,9 +260,9 @@ class File
|
||||
|
||||
/** Get the file modification time of a file
|
||||
* @param string $filename Path to the file
|
||||
* @return the time the file was last modified, or FALSE on failure. The
|
||||
* time is returned as a Unix timestamp, which is suitable for the date()
|
||||
* function.
|
||||
* @return integer|boolean the time the file was last modified, or FALSE
|
||||
* on failure. The time is returned as a Unix timestamp, which is suitable
|
||||
* for the date() function.
|
||||
* @throws If parent directory not exists, is not writeable
|
||||
*/
|
||||
public function filemtime ($filename)
|
||||
@@ -277,7 +277,7 @@ class File
|
||||
|
||||
/** Get the file size
|
||||
* @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
|
||||
*/
|
||||
public function filesize ($filename)
|
||||
@@ -292,7 +292,7 @@ class File
|
||||
|
||||
/** Get the file info of the provided filename
|
||||
* @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
|
||||
*/
|
||||
public function fileinfoMimeType ($filename)
|
||||
@@ -515,7 +515,7 @@ class File
|
||||
|
||||
/** Calculate the md5 sum of a file
|
||||
* @param string $filename The file to hash
|
||||
* @return the calulated hash
|
||||
* @return string the calulated hash
|
||||
* @throws If the file doesn't exists
|
||||
*/
|
||||
public function md5_file ($filename)
|
||||
@@ -781,7 +781,7 @@ class File
|
||||
|
||||
/** Calculate the sha1 sum of a file
|
||||
* @param string $filename The file to hash
|
||||
* @return the calulated hash
|
||||
* @return string the calulated hash
|
||||
* @throws If the file doesn't exists
|
||||
*/
|
||||
public function sha1_file ($filename)
|
||||
@@ -849,8 +849,8 @@ class File
|
||||
* Must use the filesystem path (complete) and not the version in chroot.
|
||||
* The last directoy must be executable and readable (no test for writeable)
|
||||
* @param string $path The directory path to check
|
||||
* @return true if the path is executable for all the parents and for the
|
||||
* last directory
|
||||
* @return boolean true if the path is executable for all the parents and
|
||||
* for the last directory
|
||||
* @throws if there is a missing part, or a parent is not executable
|
||||
*/
|
||||
private function checkPathRO ($path)
|
||||
@@ -967,7 +967,7 @@ class File
|
||||
* @param integer $prio The message priority. Should be higher than
|
||||
* $this->debug to save the message
|
||||
* @param string $message The message to save
|
||||
* @return null;
|
||||
* @return null
|
||||
*/
|
||||
private function debug ($prio, $message)
|
||||
// {{{
|
||||
|
||||
@@ -61,7 +61,7 @@ class Macaddresses
|
||||
/** Remove all the separators from the provided MAC address
|
||||
* @param string $mac the mac address to update
|
||||
* @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,
|
||||
$separators = array (":", "-", "."))
|
||||
|
||||
@@ -921,7 +921,7 @@ class Mail
|
||||
/** Get an attachment of the mail
|
||||
* @param integer $number the number of attach to get starting to 0
|
||||
* @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)
|
||||
// {{{
|
||||
|
||||
@@ -131,7 +131,7 @@ class Outputtxt extends Output
|
||||
elseif ($data === NULL)
|
||||
echo "NULL\n";
|
||||
else
|
||||
echo "TODO : ".gettype ($rc)." on ".__FILE__.":".__LINE__."\n";
|
||||
echo "TODO : ".gettype ($data)." on ".__FILE__.":".__LINE__."\n";
|
||||
if (!defined ("PHPUNIT"))
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class Password
|
||||
// }}}
|
||||
|
||||
/** Create a salt, based on openssl_random_pseudo_bytes function
|
||||
* @return a string salt
|
||||
* @return string a string salt
|
||||
*/
|
||||
public function salt ()
|
||||
// {{{
|
||||
@@ -165,7 +165,7 @@ class Password
|
||||
* chars).
|
||||
* A maximum of 20% for special chars in the size
|
||||
* @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)
|
||||
// {{{
|
||||
@@ -194,7 +194,7 @@ class Password
|
||||
/** Create a random password with $nbChars chars, Alphanumericals chars
|
||||
* (without special chars)
|
||||
* @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)
|
||||
// {{{
|
||||
@@ -219,7 +219,7 @@ class Password
|
||||
/** Create a random password with $nbChars chars, Alphabeticals chars
|
||||
* (without special chars, neither numbers)
|
||||
* @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)
|
||||
// {{{
|
||||
|
||||
@@ -337,8 +337,9 @@ class Route
|
||||
return $_POST["_METHOD"];
|
||||
}
|
||||
|
||||
if (!isset ($_SERVER["REQUEST_METHOD"]))
|
||||
if (!isset ($_SERVER["REQUEST_METHOD"])) {
|
||||
$this->error (new \Exception ("No REQUEST_METHOD", 415));
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] === "GET" ||
|
||||
$_SERVER["REQUEST_METHOD"] === "POST" ||
|
||||
$_SERVER["REQUEST_METHOD"] === "PUT" ||
|
||||
@@ -350,6 +351,7 @@ class Route
|
||||
}
|
||||
|
||||
$this->error (new \Exception ("Invalid REQUEST_METHOD", 406));
|
||||
return "";
|
||||
}
|
||||
|
||||
/** Return the mached route search
|
||||
@@ -554,7 +556,6 @@ class Route
|
||||
$regex = str_replace ("}", ">.+)", $regex);
|
||||
else
|
||||
$regex = str_replace ("}", ">[^/]+)", $regex);
|
||||
unset ($matches);
|
||||
$rcRegex = @preg_match ($regex, $url, $matches);
|
||||
if ($rcRegex === false)
|
||||
{
|
||||
@@ -708,7 +709,7 @@ class Route
|
||||
}
|
||||
|
||||
/** 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 ()
|
||||
{
|
||||
|
||||
@@ -79,6 +79,7 @@ class Smtp
|
||||
$errno, $errstr,
|
||||
$this->timeout, STREAM_CLIENT_CONNECT,
|
||||
$mainContext);
|
||||
$php_errormsg = "";
|
||||
ini_set('track_errors', 0);
|
||||
if ($this->smtpStream === false)
|
||||
{
|
||||
@@ -167,7 +168,7 @@ class Smtp
|
||||
* @param string|array $to the recipient of the email. Not displayed in the
|
||||
* email content
|
||||
* @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
|
||||
*/
|
||||
public function send ($from, $to, $completeMail)
|
||||
|
||||
@@ -205,8 +205,7 @@ class Spfcheck
|
||||
|
||||
/** Get the DNS values set for the provided $domain/$part(/$entity)
|
||||
* @param string $search The search entity
|
||||
* @return array The array of result from DNS
|
||||
* @return false if not exists
|
||||
* @return array|boolean The array of result from DNS or false if not exists
|
||||
*/
|
||||
public function getDNSEntries ($search)
|
||||
{
|
||||
|
||||
@@ -309,7 +309,7 @@ class Sse
|
||||
/** Initialize the backend for one specific file.
|
||||
* @param string $event The event to start
|
||||
* @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)
|
||||
// {{{
|
||||
|
||||
@@ -198,8 +198,8 @@ class Tcpclient
|
||||
* @param boolean $val True to activate, false to disable SSL
|
||||
* @param integer|null $cryptoMethod The cryptoMethod allowed
|
||||
* @param array|null $options Can overload the SSL options if needed
|
||||
* @return false if the client can not found a encryption method with the
|
||||
* server
|
||||
* @return boolean false if the client can not found a encryption method
|
||||
* with the server
|
||||
*/
|
||||
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
|
||||
* returns the \r\n.
|
||||
* @param integer $maxLength Limit the length of the data from the server
|
||||
* @return The content
|
||||
* @return string The content
|
||||
*/
|
||||
public function read ($maxLength = 1024)
|
||||
// {{{
|
||||
|
||||
@@ -64,6 +64,8 @@ class Tcpserver
|
||||
/** Server name displayed in process list
|
||||
*/
|
||||
private $processName = "tcpserver";
|
||||
|
||||
private $ipOrName;
|
||||
// }}}
|
||||
|
||||
////////////////////////
|
||||
@@ -348,7 +350,7 @@ class Tcpserver
|
||||
// }}}
|
||||
|
||||
/** 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 ()
|
||||
// {{{
|
||||
@@ -505,7 +507,7 @@ class Tcpserver
|
||||
* 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.
|
||||
* @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)
|
||||
// {{{
|
||||
|
||||
@@ -20,7 +20,7 @@ class Verify
|
||||
*/
|
||||
public function isIp ($val)
|
||||
{
|
||||
return verify::staticIsIp ($val);
|
||||
return Verify::staticIsIp ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid IPv4 in static mode
|
||||
@@ -41,7 +41,7 @@ class Verify
|
||||
*/
|
||||
public function is_ip ($val)
|
||||
{
|
||||
return verify::staticIsIp ($val);
|
||||
return Verify::staticIsIp ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid IPv4 in static mode
|
||||
@@ -51,7 +51,7 @@ class Verify
|
||||
*/
|
||||
public static function staticIs_ip ($val)
|
||||
{
|
||||
return verify::staticIsIp ($val);
|
||||
return Verify::staticIsIp ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid IPv4
|
||||
@@ -60,7 +60,7 @@ class Verify
|
||||
*/
|
||||
public function isIpv4 ($val)
|
||||
{
|
||||
return verify::staticIsIpv4 ($val);
|
||||
return Verify::staticIsIpv4 ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid IPv4 in static mode
|
||||
@@ -81,7 +81,7 @@ class Verify
|
||||
*/
|
||||
public function is_ipv4 ($val)
|
||||
{
|
||||
return verify::staticIsIpv4 ($val);
|
||||
return Verify::staticIsIpv4 ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid IPv4 in static mode
|
||||
@@ -91,7 +91,7 @@ class Verify
|
||||
*/
|
||||
public static function staticIs_ipv4 ($val)
|
||||
{
|
||||
return verify::staticIsIpv4 ($val);
|
||||
return Verify::staticIsIpv4 ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid IPv6
|
||||
@@ -100,7 +100,7 @@ class Verify
|
||||
*/
|
||||
public function isIpv6 ($val)
|
||||
{
|
||||
return verify::staticIsIpv6 ($val);
|
||||
return Verify::staticIsIpv6 ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid IPv6 in static mode
|
||||
@@ -121,7 +121,7 @@ class Verify
|
||||
*/
|
||||
public function is_ipv6 ($val)
|
||||
{
|
||||
return verify::staticIsipv6 ($val);
|
||||
return Verify::staticIsipv6 ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid IPv6 in static mode
|
||||
@@ -131,7 +131,7 @@ class Verify
|
||||
*/
|
||||
public static function staticIs_ipv6 ($val)
|
||||
{
|
||||
return verify::staticIsipv6 ($val);
|
||||
return Verify::staticIsipv6 ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid hostname (without domain)
|
||||
@@ -140,7 +140,7 @@ class Verify
|
||||
*/
|
||||
public function isHostname ($val)
|
||||
{
|
||||
return verify::staticIsHostname ($val);
|
||||
return Verify::staticIsHostname ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid hostname (without domain)
|
||||
@@ -168,7 +168,7 @@ class Verify
|
||||
*/
|
||||
public function is_hostname ($val)
|
||||
{
|
||||
return verify::staticIs_hostname ($val);
|
||||
return Verify::staticIs_hostname ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid hostname (without domain)
|
||||
@@ -178,7 +178,7 @@ class Verify
|
||||
*/
|
||||
public static function staticIs_hostname ($val)
|
||||
{
|
||||
return verify::staticIsHostname ($val);
|
||||
return Verify::staticIsHostname ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid domain (without hostname)
|
||||
@@ -187,7 +187,7 @@ class Verify
|
||||
*/
|
||||
public function isDomain ($val)
|
||||
{
|
||||
return verify::staticIsDomain ($val);
|
||||
return Verify::staticIsDomain ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid domain (without hostname) in static mode
|
||||
@@ -216,7 +216,7 @@ class Verify
|
||||
*/
|
||||
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
|
||||
@@ -226,7 +226,7 @@ class Verify
|
||||
*/
|
||||
public static function staticIs_domain ($val)
|
||||
{
|
||||
return verify::staticIsDomain ($val);
|
||||
return Verify::staticIsDomain ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid FQDN
|
||||
@@ -235,7 +235,7 @@ class Verify
|
||||
*/
|
||||
public function isFQDN ($val)
|
||||
{
|
||||
return verify::staticIsFQDN ($val);
|
||||
return Verify::staticIsFQDN ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid FQDN in static mode
|
||||
@@ -246,7 +246,7 @@ class Verify
|
||||
{
|
||||
if (strlen ($val) < 2 || strlen ($val) > 255)
|
||||
return false;
|
||||
if (verify::is_ip ($val))
|
||||
if (Verify::staticIsIp ($val))
|
||||
return false;
|
||||
if (strspn ($val, "abcdefghijklmnopqrstuvwxyz".
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ".
|
||||
@@ -266,7 +266,7 @@ class Verify
|
||||
*/
|
||||
public function is_FQDN ($val)
|
||||
{
|
||||
return verify::staticIsFQDN ($val);
|
||||
return Verify::staticIsFQDN ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid FQDN in static mode
|
||||
@@ -276,7 +276,7 @@ class Verify
|
||||
*/
|
||||
public static function staticIs_FQDN ($val)
|
||||
{
|
||||
return verify::staticIsFQDN ($val);
|
||||
return Verify::staticIsFQDN ($val);
|
||||
}
|
||||
|
||||
///////////////
|
||||
@@ -289,7 +289,7 @@ class Verify
|
||||
*/
|
||||
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
|
||||
@@ -323,7 +323,7 @@ class Verify
|
||||
*/
|
||||
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
|
||||
@@ -334,7 +334,7 @@ class Verify
|
||||
*/
|
||||
public static function staticIs_datetimeSQL ($val)
|
||||
{
|
||||
return verify::staticIsDatetimeSQL ($val);
|
||||
return Verify::staticIsDatetimeSQL ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid date in SQL
|
||||
@@ -344,7 +344,7 @@ class Verify
|
||||
*/
|
||||
public function isDateSQL ($val)
|
||||
{
|
||||
return verify::staticIsDateSQL ($val);
|
||||
return Verify::staticIsDateSQL ($val);
|
||||
}
|
||||
|
||||
/** Check if $val is a valid date in SQL in static mode
|
||||
@@ -378,7 +378,7 @@ class Verify
|
||||
*/
|
||||
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
|
||||
@@ -389,7 +389,7 @@ class Verify
|
||||
*/
|
||||
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)
|
||||
{
|
||||
return verify::staticIsAllowedChars ($val, $allowedChars);
|
||||
return Verify::staticIsAllowedChars ($val, $allowedChars);
|
||||
}
|
||||
|
||||
/** Check if the provided value is only contains the provided chars.
|
||||
@@ -430,7 +430,7 @@ class Verify
|
||||
*/
|
||||
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)
|
||||
@@ -454,7 +454,7 @@ class Verify
|
||||
*/
|
||||
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)
|
||||
@@ -464,7 +464,7 @@ class Verify
|
||||
*/
|
||||
public static function staticIs_integer ($val)
|
||||
{
|
||||
return verify::staticIsInteger ($val);
|
||||
return Verify::staticIsInteger ($val);
|
||||
}
|
||||
|
||||
////////////////
|
||||
@@ -476,7 +476,7 @@ class Verify
|
||||
*/
|
||||
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
|
||||
@@ -495,7 +495,7 @@ class Verify
|
||||
*/
|
||||
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
|
||||
@@ -505,7 +505,7 @@ class Verify
|
||||
*/
|
||||
public static function staticIs_email ($val)
|
||||
{
|
||||
return verify::staticIsEmail ($val);
|
||||
return Verify::staticIsEmail ($val);
|
||||
}
|
||||
|
||||
/////////////
|
||||
@@ -517,7 +517,7 @@ class Verify
|
||||
*/
|
||||
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
|
||||
@@ -536,7 +536,7 @@ class Verify
|
||||
*/
|
||||
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
|
||||
@@ -546,7 +546,7 @@ class Verify
|
||||
*/
|
||||
public static function staticIs_URL ($val)
|
||||
{
|
||||
return verify::staticIsURL ($val);
|
||||
return Verify::staticIsURL ($val);
|
||||
}
|
||||
|
||||
//////////////////
|
||||
@@ -559,7 +559,7 @@ class Verify
|
||||
*/
|
||||
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
|
||||
@@ -589,7 +589,7 @@ class Verify
|
||||
*/
|
||||
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
|
||||
@@ -600,7 +600,7 @@ class Verify
|
||||
*/
|
||||
public static function staticIs_UUID ($val)
|
||||
{
|
||||
return verify::staticIsUUID ($val);
|
||||
return Verify::staticIsUUID ($val);
|
||||
}
|
||||
|
||||
/** Return true if the provided string is a valid hash
|
||||
@@ -609,7 +609,7 @@ class Verify
|
||||
*/
|
||||
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
|
||||
@@ -625,7 +625,7 @@ class Verify
|
||||
$len = strlen (hash ($algo, ""));
|
||||
if (strlen ($val) !== $len)
|
||||
return false;
|
||||
if (verify::staticIsAllowedChars ($val, "0123456789abcdef") === false)
|
||||
if (Verify::staticIsAllowedChars ($val, "0123456789abcdef") === false)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ class Xmppclient
|
||||
|
||||
// PRIVATE METHODS //
|
||||
/** Read fron socket
|
||||
* @return the read value
|
||||
* @return string the read value
|
||||
*/
|
||||
private function read ()
|
||||
// {{{
|
||||
|
||||
Reference in New Issue
Block a user