diff --git a/csrf.php b/csrf.php index b58a306..61c6903 100644 --- a/csrf.php +++ b/csrf.php @@ -1,12 +1,14 @@ */ + * @package domframework + * @author Dominique Fournier + */ /** CSRF protection * 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 - * back without the token */ + * back without the token + */ class csrf { /** Allow to disable the csrf protection */ @@ -19,7 +21,8 @@ class csrf * enter information in form and submit) */ private $csrfTimeout = 3600; - /** Manage the singleton */ + /** Manage the singleton + */ public function __construct () // {{{ { @@ -36,7 +39,8 @@ class csrf } // }}} - /** This function return the token */ + /** This function return the token + */ public function createToken () // {{{ { @@ -54,7 +58,8 @@ class csrf /** Check if the provided token is the right token, defined last displayed * page - * @param string $tokenFromUser The value csrf the user's token */ + * @param string $tokenFromUser The value csrf the user's token + */ public function checkToken ($tokenFromUser) // {{{ { @@ -80,7 +85,8 @@ class csrf } // }}} - /** Return the CSRF token in a hidden field */ + /** Return the CSRF token in a hidden field + */ public function displayFormCSRF () // {{{ { @@ -92,7 +98,8 @@ class csrf } // }}} - /** Return the token if exists or create a new one if needed */ + /** Return the token if exists or create a new one if needed + */ public function getToken () // {{{ { @@ -110,6 +117,7 @@ class csrf { $this->checkToken ($tokenFromUser); $_SESSION["domframework"]["csrf"]["csrfStart"] = microtime (TRUE); + return true; } // }}} }