Zeile 130 | Zeile 130 |
---|
*/ function generate_numeric_field($name, $value=0, $options=array()) {
|
*/ function generate_numeric_field($name, $value=0, $options=array()) {
|
$input = "<input type=\"number\" name=\"".$name."\" value=\"".(int)$value."\""; if(isset($options['min']))
| if(is_numeric($value)) { $value = (float)$value; } else { $value = ''; }
$input = "<input type=\"number\" name=\"{$name}\" value=\"{$value}\""; if(isset($options['min']))
|
{ $input .= " min=\"".$options['min']."\""; }
| { $input .= " min=\"".$options['min']."\""; }
|
Zeile 142 | Zeile 151 |
---|
if(isset($options['step'])) { $input .= " step=\"".$options['step']."\"";
|
if(isset($options['step'])) { $input .= " step=\"".$options['step']."\"";
|
} if(isset($options['class'])) { $input .= " class=\"text_input ".$options['class']."\""; } else { $input .= " class=\"text_input\"";
| } if(isset($options['class'])) { $input .= " class=\"text_input ".$options['class']."\""; } else { $input .= " class=\"text_input\"";
|
} if(isset($options['style'])) { $input .= " style=\"".$options['style']."\"";
|
} if(isset($options['style'])) { $input .= " style=\"".$options['style']."\"";
|
} if(isset($options['id']))
| } if(isset($options['id']))
|
{ $input .= " id=\"".$options['id']."\""; }
| { $input .= " id=\"".$options['id']."\""; }
|
Zeile 174 | Zeile 183 |
---|
function generate_password_box($name, $value="", $options=array()) { $input = "<input type=\"password\" name=\"".$name."\" value=\"".htmlspecialchars_uni($value)."\"";
|
function generate_password_box($name, $value="", $options=array()) { $input = "<input type=\"password\" name=\"".$name."\" value=\"".htmlspecialchars_uni($value)."\"";
|
if(isset($options['class'])) { $input .= " class=\"text_input ".$options['class']."\""; } else { $input .= " class=\"text_input\""; } if(isset($options['id'])) { $input .= " id=\"".$options['id']."\""; } if(isset($options['autocomplete'])) { $input .= " autocomplete=\"".$options['autocomplete']."\""; } $input .= " />";
| if(isset($options['class'])) { $input .= " class=\"text_input ".$options['class']."\""; } else { $input .= " class=\"text_input\""; } if(isset($options['id'])) { $input .= " id=\"".$options['id']."\""; } if(isset($options['autocomplete'])) { $input .= " autocomplete=\"".$options['autocomplete']."\""; } $input .= " />";
|
return $input; }
| return $input; }
|
Zeile 204 | Zeile 213 |
---|
function generate_file_upload_box($name, $options=array()) { $input = "<input type=\"file\" name=\"".$name."\"";
|
function generate_file_upload_box($name, $options=array()) { $input = "<input type=\"file\" name=\"".$name."\"";
|
if(isset($options['class'])) {
| if(isset($options['class'])) {
|
$input .= " class=\"text_input ".$options['class']."\"";
|
$input .= " class=\"text_input ".$options['class']."\"";
|
} else { $input .= " class=\"text_input\""; } if(isset($options['style'])) {
| } else { $input .= " class=\"text_input\""; } if(isset($options['style'])) {
|
$input .= " style=\"".$options['style']."\""; } if(isset($options['id']))
| $input .= " style=\"".$options['style']."\""; } if(isset($options['id']))
|
Zeile 249 | Zeile 258 |
---|
$textarea .= " id=\"{$options['id']}\""; } if(isset($options['style']))
|
$textarea .= " id=\"{$options['id']}\""; } if(isset($options['style']))
|
{
| {
|
$textarea .= " style=\"{$options['style']}\"";
|
$textarea .= " style=\"{$options['style']}\"";
|
}
| }
|
if(isset($options['disabled']) && $options['disabled'] !== false) { $textarea .= " disabled=\"disabled\"";
|
if(isset($options['disabled']) && $options['disabled'] !== false) { $textarea .= " disabled=\"disabled\"";
|
}
| }
|
if(isset($options['readonly']) && $options['readonly'] !== false) { $textarea .= " readonly=\"readonly\"";
| if(isset($options['readonly']) && $options['readonly'] !== false) { $textarea .= " readonly=\"readonly\"";
|
Zeile 293 | Zeile 302 |
---|
if(isset($options['id'])) { $input .= " for=\"{$options['id']}\"";
|
if(isset($options['id'])) { $input .= " for=\"{$options['id']}\"";
|
} if(isset($options['class'])) {
| } if(isset($options['class'])) {
|
$input .= " class=\"label_{$options['class']}\"";
|
$input .= " class=\"label_{$options['class']}\"";
|
}
| }
|
$input .= "><input type=\"radio\" name=\"{$name}\" value=\"".htmlspecialchars_uni($value)."\""; if(isset($options['class']))
|
$input .= "><input type=\"radio\" name=\"{$name}\" value=\"".htmlspecialchars_uni($value)."\""; if(isset($options['class']))
|
{
| {
|
$input .= " class=\"radio_input ".$options['class']."\"";
|
$input .= " class=\"radio_input ".$options['class']."\"";
|
} else { $input .= " class=\"radio_input\""; } if(isset($options['id'])) {
| } else { $input .= " class=\"radio_input\""; } if(isset($options['id'])) {
|
$input .= " id=\"".$options['id']."\"";
|
$input .= " id=\"".$options['id']."\"";
|
}
| }
|
if(isset($options['checked']) && $options['checked'] != 0) { $input .= " checked=\"checked\""; } $input .= " />";
|
if(isset($options['checked']) && $options['checked'] != 0) { $input .= " checked=\"checked\""; } $input .= " />";
|
if($label != "")
| if($label != "")
|
{ $input .= $label; }
| { $input .= $label; }
|
Zeile 360 | Zeile 369 |
---|
if(isset($options['checked']) && ($options['checked'] === true || $options['checked'] == 1)) { $input .= " checked=\"checked\"";
|
if(isset($options['checked']) && ($options['checked'] === true || $options['checked'] == 1)) { $input .= " checked=\"checked\"";
|
}
| }
|
if(isset($options['onclick'])) { $input .= " onclick=\"{$options['onclick']}\""; } $input .= " /> "; if($label != "")
|
if(isset($options['onclick'])) { $input .= " onclick=\"{$options['onclick']}\""; } $input .= " /> "; if($label != "")
|
{
| {
|
$input .= $label; } $input .= "</label>";
| $input .= $label; } $input .= "</label>";
|
Zeile 383 | Zeile 392 |
---|
* @param array $options Array of options for the select box (multiple, class, id, size) * @return string The select box. */
|
* @param array $options Array of options for the select box (multiple, class, id, size) * @return string The select box. */
|
function generate_select_box($name, $option_list, $selected=array(), $options=array())
| function generate_select_box($name, $option_list=array(), $selected=array(), $options=array())
|
{ if(!isset($options['multiple'])) {
| { if(!isset($options['multiple'])) {
|
Zeile 413 | Zeile 422 |
---|
foreach($option_list as $value => $option) { $select_add = '';
|
foreach($option_list as $value => $option) { $select_add = '';
|
if(!empty($selected) && ((string)$value == (string)$selected || (is_array($selected) && in_array((string)$value, $selected))))
| if((!is_array($selected) || !empty($selected)) && ((string)$value == (string)$selected || (is_array($selected) && in_array((string)$value, $selected))))
|
{ $select_add = " selected=\"selected\""; }
| { $select_add = " selected=\"selected\""; }
|
Zeile 545 | Zeile 554 |
---|
$select .= ">\n".$selectoptions."</select>\n"; $selectoptions = ''; return $select;
|
$select .= ">\n".$selectoptions."</select>\n"; $selectoptions = ''; return $select;
|
} }
| } }
/** * Generate a group selection box. * * @param string $name The name of the selection box. * @param array|string $selected Array/string of the selected items. * @param array $options Array of options (class, id, multiple, size) * @return string The built select box. */ function generate_group_select($name, $selected=array(), $options=array()) { global $cache;
$select = "<select name=\"{$name}\"";
if(isset($options['multiple'])) { $select .= " multiple=\"multiple\""; }
if(isset($options['class'])) { $select .= " class=\"{$options['class']}\""; }
if(isset($options['id'])) { $select .= " id=\"{$options['id']}\""; }
if(isset($options['size'])) { $select .= " size=\"{$options['size']}\""; }
$select .= ">\n";
$groups_cache = $cache->read('usergroups'); if(!is_array($selected)) { $selected = array($selected); } foreach($groups_cache as $group) { $selected_add = ""; if(in_array($group['gid'], $selected)) { $selected_add = " selected=\"selected\""; }
$select .= "<option value=\"{$group['gid']}\"{$selected_add}>".htmlspecialchars_uni($group['title'])."</option>"; }
$select .= "</select>";
|
|
|
| return $select; }
|
/**
|
/**
|
* Generate a group selection box.
| * Generate a prefix selection box.
|
* * @param string $name The name of the selection box. * @param array|string $selected Array/string of the selected items. * @param array $options Array of options (class, id, multiple, size) * @return string The built select box. */
|
* * @param string $name The name of the selection box. * @param array|string $selected Array/string of the selected items. * @param array $options Array of options (class, id, multiple, size) * @return string The built select box. */
|
function generate_group_select($name, $selected=array(), $options=array())
| function generate_prefix_select($name, $selected=array(), $options=array())
|
{ global $cache;
|
{ global $cache;
|
| |
$select = "<select name=\"{$name}\"";
|
$select = "<select name=\"{$name}\"";
|
| |
if(isset($options['multiple'])) { $select .= " multiple=\"multiple\""; }
|
if(isset($options['multiple'])) { $select .= " multiple=\"multiple\""; }
|
| |
if(isset($options['class'])) { $select .= " class=\"{$options['class']}\""; }
|
if(isset($options['class'])) { $select .= " class=\"{$options['class']}\""; }
|
| |
if(isset($options['id'])) { $select .= " id=\"{$options['id']}\"";
|
if(isset($options['id'])) { $select .= " id=\"{$options['id']}\"";
|
}
| }
|
if(isset($options['size'])) { $select .= " size=\"{$options['size']}\""; }
|
if(isset($options['size'])) { $select .= " size=\"{$options['size']}\""; }
|
| |
$select .= ">\n";
|
$select .= ">\n";
|
$groups_cache = $cache->read('usergroups');
| $prefix_cache = $cache->read('threadprefixes');
|
if(!is_array($selected)) { $selected = array($selected);
|
if(!is_array($selected)) { $selected = array($selected);
|
} foreach($groups_cache as $group)
| } foreach($prefix_cache as $prefix)
|
{ $selected_add = "";
|
{ $selected_add = "";
|
if(in_array($group['gid'], $selected))
| if(in_array($prefix['pid'], $selected))
|
{ $selected_add = " selected=\"selected\""; }
|
{ $selected_add = " selected=\"selected\""; }
|
$select .= "<option value=\"{$group['gid']}\"{$selected_add}>".htmlspecialchars_uni($group['title'])."</option>";
| $select .= "<option value=\"{$prefix['pid']}\"{$selected_add}>".htmlspecialchars_uni($prefix['prefix'])."</option>";
|
}
|
}
|
| |
$select .= "</select>";
|
$select .= "</select>";
|
| |
return $select; }
| return $select; }
|