summaryrefslogtreecommitdiff
path: root/includes/sys_form.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-12-18 13:22:10 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2018-12-18 13:22:10 +0100
commit204ff4c0e79fab0d1f73daa29a026582efffee69 (patch)
treeb0570be6cfcf43c12e06b049e7fec2721184d699 /includes/sys_form.php
parentc676e73cf6c326bc067627d9d623494dd0b243cf (diff)
rooms admin: Set a maximum character length
closes #525 (Room names with more than 35 characters dispatch a team of untrained monkeys)
Diffstat (limited to 'includes/sys_form.php')
-rw-r--r--includes/sys_form.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/includes/sys_form.php b/includes/sys_form.php
index 38e9da4e..af8d094a 100644
--- a/includes/sys_form.php
+++ b/includes/sys_form.php
@@ -229,15 +229,18 @@ function form_submit($name, $label, $class = '', $wrapForm = true, $buttonType =
* @param string $label
* @param string $value
* @param bool $disabled
+ * @param int $maxlength
* @return string
*/
-function form_text($name, $label, $value, $disabled = false)
+function form_text($name, $label, $value, $disabled = false, $maxlength = null)
{
$disabled = $disabled ? ' disabled="disabled"' : '';
+ $maxlength = $maxlength ? ' maxlength=' . (int)$maxlength : '';
+
return form_element(
$label,
'<input class="form-control" id="form_' . $name . '" type="text" name="' . $name
- . '" value="' . htmlspecialchars($value) . '" ' . $disabled . '/>',
+ . '" value="' . htmlspecialchars($value) . '"' . $maxlength . $disabled . '/>',
'form_' . $name
);
}