Compare commits

..

2 Commits

Author SHA1 Message Date
Dominique FOURNIER
c4f611c81e Formfield is now with the Camelcase 2022-07-21 14:20:23 +02:00
Dominique FOURNIER
cb0d01101f Form : use Csrf (instead of csrf) 2022-07-21 13:30:31 +02:00
2 changed files with 5 additions and 5 deletions

View File

@@ -185,11 +185,11 @@ or error to the user.
To use it : To use it :
require ("domframework/form.php"); require ("domframework/form.php");
$errors = array (); $errors = array ();
$f = new form (); $f = new Form ();
// Check CSRF and get the provided values if they exists // Check CSRF and get the provided values if they exists
$values = $f->values (); $values = $f->values ();
// Define here the fields (can be done multiple times) // Define here the fields (can be done multiple times)
$field = new formfield ($name, $label); $field = new Formfield ($name, $label);
// Add the parameters to the field // Add the parameters to the field
$fields[] = $field; $fields[] = $field;
unset ($field); unset ($field);

View File

@@ -382,7 +382,7 @@ class Form
if ($this->csrf === TRUE) if ($this->csrf === TRUE)
{ {
$csrf = new csrf (); $csrf = new Csrf ();
$csrf->field = $this->formName."[".$this->csrfField."]"; $csrf->field = $this->formName."[".$this->csrfField."]";
$res .= $csrf->displayFormCSRF (); $res .= $csrf->displayFormCSRF ();
$this->csrfToken = $csrf->getToken (); $this->csrfToken = $csrf->getToken ();
@@ -433,7 +433,7 @@ class Form
public function checkToken ($tokenFromUser) public function checkToken ($tokenFromUser)
// {{{ // {{{
{ {
$csrf = new csrf (); $csrf = new Csrf ();
$csrf->field = $this->csrfField; $csrf->field = $this->csrfField;
// The checkThenDeleteToken method check the token and except if there is a // The checkThenDeleteToken method check the token and except if there is a
// problem. If there is no problem, it delete the token // problem. If there is no problem, it delete the token
@@ -598,7 +598,7 @@ class Form
/** The definition of a formfield /** The definition of a formfield
*/ */
class formfield class Formfield
{ {
/** The form name /** The form name
*/ */