Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue #3825. #3827

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions web/lib/MRBS/Form/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private function setMethod(int $method) : Element
if ($max_file_size !== false)
{
$max_file_size = self::convertToBytes($max_file_size);
$this->addHiddenInput('MAX_FILE_SIZE', $max_file_size);
$this->addHiddenInput('MAX_FILE_SIZE', $max_file_size, 'MAX_FILE_SIZE');
}
// Add a CSRF token
$this->addCSRFToken();
Expand Down Expand Up @@ -126,11 +126,12 @@ public function setAttribute(string $name, $value=true): Element
}


// Adds a hidden input to the form
public function addHiddenInput(string $name, $value) : Form
// Adds a hidden input to the form. Optionally give the element a key
// so that it can be removed later using the same key.
public function addHiddenInput(string $name, $value, ?string $key=null) : Form
{
$element = new ElementInputHidden($name, $value);
$this->addElement($element, $name);
$this->addElement($element, $key);
return $this;
}

Expand All @@ -147,9 +148,9 @@ public function addHiddenInputs(array $hidden_inputs) : Form


// Removes a hidden input from the form.
private function removeHiddenInput(string $name) : Form
private function removeHiddenInput(string $key) : Form
{
$this->removeElement($name);
$this->removeElement($key);
return $this;
}

Expand Down Expand Up @@ -231,7 +232,7 @@ public static function getTimeUnitOptions($max_unit=null) : array

private function addCSRFToken() : Form
{
$this->addHiddenInput(self::TOKEN_NAME, self::getToken());
$this->addHiddenInput(self::TOKEN_NAME, self::getToken(), self::TOKEN_NAME);
return $this;
}

Expand Down