PHPDoc support : correct the erroneous entries

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1463 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-06-16 13:46:39 +00:00
parent 679fa2c24a
commit 027cbccdcf
3 changed files with 34 additions and 16 deletions

View File

@@ -43,8 +43,12 @@ class dblayer extends PDO
protected $foreign = array (); protected $foreign = array ();
/** The db connection */ /** The db connection */
protected $db = null; protected $db = null;
/** The verify stack */ /** The verify unitary stack
@param string $field The name of the field to test
@param string $val The value of the field to test */
protected function verifyOne ($field, $val) {} protected function verifyOne ($field, $val) {}
/** The verify global stack
@param array $datas The associative array of contents */
protected function verifyAll ($datas) {} protected function verifyAll ($datas) {}
/** Debug of the SQL */ /** Debug of the SQL */
public $debug = FALSE; public $debug = FALSE;

View File

@@ -21,6 +21,7 @@ class form
It can be disabled if needed. An Exception is raised if the form is send It can be disabled if needed. An Exception is raised if the form is send
back without the token */ back without the token */
public $csrf=TRUE; public $csrf=TRUE;
/** Name of the CSRF hidden field in HTML page */
public $csrfField = "CSRF_TOKEN"; public $csrfField = "CSRF_TOKEN";
/** The method used to send the values */ /** The method used to send the values */
@@ -161,7 +162,9 @@ die ("FORM/VERIFY : UNUSED and dirty\n");
$method is the method written in method field of <form> $method is the method written in method field of <form>
@param string|null $method The method to use to transmit the form (POST, @param string|null $method The method to use to transmit the form (POST,
GET) GET)
@param array|null $values The default values of the fields */ @param array|null $values The default values of the fields
@param array|null $errors The fields to put in error with the associated
message */
public function printHTML ($method = 'post', $values = NULL, public function printHTML ($method = 'post', $values = NULL,
$errors = array()) $errors = array())
{ {
@@ -492,7 +495,8 @@ die ("FORM/VERIFY : UNUSED and dirty\n");
return $res; return $res;
} }
/** Check the token from the user */ /** Check the token from the user
@param string $tokenFromUser The value form the user's token */
public function checkToken ($tokenFromUser) public function checkToken ($tokenFromUser)
{ {
$csrf = new csrf (); $csrf = new csrf ();
@@ -535,12 +539,13 @@ class formfield
} }
} }
class csrf /** CSRF protection
{
/** CSRF protection
By default, the CSRF protection is active if a SESSION is active too. By default, the CSRF protection is active if a SESSION is active too.
It can be disabled if needed. An Exception is raised if the form is send It can be disabled if needed. An Exception is raised if the form is send
back without the token */ back without the token */
class csrf
{
/** Allow to disable the csrf protection */
public $csrf=TRUE; public $csrf=TRUE;
/** This hidden field name in HTML */ /** This hidden field name in HTML */
public $field = "CSRF_TOKEN"; public $field = "CSRF_TOKEN";
@@ -564,7 +569,8 @@ class csrf
} }
/** Check if the provided token is the right token, defined last displayed /** Check if the provided token is the right token, defined last displayed
page */ page
@param string $tokenFromUser The value form the user's token */
public function checkToken ($tokenFromUser) public function checkToken ($tokenFromUser)
{ {
if ($this->csrf === FALSE ) if ($this->csrf === FALSE )

View File

@@ -10,7 +10,8 @@ class verify
// NETWORK // // NETWORK //
///////////////// /////////////////
/** Check if $val is a valid IPv4 /** Check if $val is a valid IPv4
Return TRUE or FALSE */ Return TRUE or FALSE
@param string $val The IP to test */
public function is_ip ($val) public function is_ip ($val)
{ {
if (filter_var ($val, FILTER_VALIDATE_IP)) if (filter_var ($val, FILTER_VALIDATE_IP))
@@ -19,7 +20,8 @@ class verify
} }
/** Check if $val is a valid IPv4 /** Check if $val is a valid IPv4
Return TRUE or FALSE */ Return TRUE or FALSE
@param string $val The IPv4 to test */
public function is_ipv4 ($val) public function is_ipv4 ($val)
{ {
if (filter_var ($val, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) if (filter_var ($val, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
@@ -28,7 +30,8 @@ class verify
} }
/** Check if $val is a valid IPv6 /** Check if $val is a valid IPv6
Return TRUE or FALSE */ Return TRUE or FALSE
@param string $val The IPv to test */
public function is_ipv6 ($val) public function is_ipv6 ($val)
{ {
if (filter_var ($val, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) if (filter_var ($val, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
@@ -37,7 +40,8 @@ class verify
} }
/** Check if $val is a valid hostname (without domain) /** Check if $val is a valid hostname (without domain)
Return TRUE or FALSE */ Return TRUE or FALSE
@param string $val The hostname to check */
public function is_hostname ($val) public function is_hostname ($val)
{ {
if (strlen ($val) < 2 || strlen ($val) > 128) if (strlen ($val) < 2 || strlen ($val) > 128)
@@ -54,7 +58,8 @@ class verify
} }
/** Check if $val is a valid domain (without hostname) /** Check if $val is a valid domain (without hostname)
Return TRUE or FALSE */ Return TRUE or FALSE
@param string $val The domain to check */
public function is_domain ($val) public function is_domain ($val)
{ {
if (strlen ($val) < 2 || strlen ($val) > 128) if (strlen ($val) < 2 || strlen ($val) > 128)
@@ -71,7 +76,8 @@ class verify
} }
/** Check if $val is a valid FQDN /** Check if $val is a valid FQDN
Return TRUE or FALSE */ Return TRUE or FALSE
@param string $val The FQDN to check */
public function is_FQDN ($val) public function is_FQDN ($val)
{ {
if (strlen ($val) < 2 || strlen ($val) > 255) if (strlen ($val) < 2 || strlen ($val) > 255)
@@ -94,7 +100,8 @@ class verify
/////////////// ///////////////
/** Check if $val is a valid date /** Check if $val is a valid date
A valid date is 2014-03-20 12:27:34 A valid date is 2014-03-20 12:27:34
Return TRUE or FALSE */ Return TRUE or FALSE
@param string $val The date to check */
public function is_datetimeSQL ($val) public function is_datetimeSQL ($val)
{ {
if (strlen ($val) !== 19) if (strlen ($val) !== 19)
@@ -114,7 +121,8 @@ class verify
///////////////// /////////////////
// NUMBERS // // NUMBERS //
///////////////// /////////////////
/** 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)
@param string $val The Integer val to check */
public function is_integer ($val) public function is_integer ($val)
{ {
if (strspn ($val, "0123456789") !== strlen ($val)) if (strspn ($val, "0123456789") !== strlen ($val))