From de3b0796d24c05856340d94504c109195b51d71c Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 5 Jun 2003 18:09:39 +0000 Subject: - Bugfix: better charset support for non-ISO-8859-1 languages. Patch 0029.charset.fixes.patch by Al. Could East Asia test this please. - Bugfix: made the "moderate" field behave. Patch 0030.queue.module.help.and.settings.form.patch by Al. - Documentation: revised a large part of the help texts / documentation! Al's 0024.* patches. - Documentation: added a glossary to the help module. Patch 0025.help.module.glossary.patch by Al and Michael. - Usability: first step towards unifying the terminology used in the cloud module. Patch by 0028.site.cloud.rationalize.name.patch Al. - Usability + CSS improvements: revamped the node form and removed all tables. Patch 0027.node.form.rewrite.patch by Al. - CSS improvements: patch 0026.admin.css.small.improvement.patch by Al. - Updated the MAINTAINERS file. --- includes/common.inc | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) (limited to 'includes') diff --git a/includes/common.inc b/includes/common.inc index 708ee9a39..30ba8d7b9 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -207,6 +207,10 @@ function variable_del($name) { unset($conf[$name]); } +function drupal_specialchars($input) { + return htmlspecialchars($input, ENT_NOQUOTES, variable_get("site_charset", "iso-8859-1")); +} + function table_cell($cell, $header = 0) { if (is_array($cell)) { $data = $cell["data"]; @@ -472,7 +476,7 @@ function referer_load() { } function check_form($text) { - return htmlspecialchars($text); + return drupal_specialchars($text); } function check_query($text) { @@ -603,12 +607,12 @@ function format_rss_channel($title, $link, $description, $items, $language = "en // arbitrary elements may be added using the $args associative array $output .= "\n"; - $output .= " ". htmlspecialchars(strip_tags($title)) ."\n"; - $output .= " ". htmlspecialchars(strip_tags($link)) ."\n"; - $output .= " ". htmlspecialchars($description) ."\n"; - $output .= " ". htmlspecialchars(strip_tags($language)) ."\n"; + $output .= " ". drupal_specialchars(strip_tags($title)) ."\n"; + $output .= " ". drupal_specialchars(strip_tags($link)) ."\n"; + $output .= " ". drupal_specialchars($description) ."\n"; + $output .= " ". drupal_specialchars(strip_tags($language)) ."\n"; foreach ($args as $key => $value) { - $output .= "<$key>". htmlspecialchars(strip_tags($value)) .""; + $output .= "<$key>". drupal_specialchars(strip_tags($value)) .""; } $output .= $items; $output .= "\n"; @@ -620,11 +624,11 @@ function format_rss_item($title, $link, $description, $args = array()) { // arbitrary elements may be added using the $args associative array $output .= "\n"; - $output .= " ". htmlspecialchars(strip_tags($title)) ."\n"; - $output .= " ". htmlspecialchars(strip_tags($link)) ."\n"; - $output .= " ". htmlspecialchars(check_output($description)) ."\n"; + $output .= " ". drupal_specialchars(strip_tags($title)) ."\n"; + $output .= " ". drupal_specialchars(strip_tags($link)) ."\n"; + $output .= " ". drupal_specialchars(check_output($description)) ."\n"; foreach ($args as $key => $value) { - $output .= "<$key>". htmlspecialchars(strip_tags($value)) .""; + $output .= "<$key>". drupal_specialchars(strip_tags($value)) .""; } $output .= "\n"; @@ -805,16 +809,19 @@ function form_checkbox($title, $name, $value = 1, $checked = 0, $description = 0 } function form_textfield($title, $name, $value, $size, $maxlength, $description = 0) { - return form_item($title, "", $description); + $size = $size ? " size=\"$size\"" : ""; + return form_item($title, "", $description); } function form_password($title, $name, $value, $size, $maxlength, $description = 0) { - return form_item($title, "", $description); + $size = $size ? " size=\"$size\"" : ""; + return form_item($title, "", $description); } function form_textarea($title, $name, $value, $cols, $rows, $description = 0) { + $cols = $cols ? " cols=\"$cols\"" : ""; module_invoke_all("textarea", $name); // eg. optionally plug in a WYSIWYG editor - return form_item($title, "", $description); + return form_item($title, "", $description); } function form_select($title, $name, $value, $options, $description = 0, $extra = 0, $multiple = 0) { @@ -826,6 +833,15 @@ function form_select($title, $name, $value, $options, $description = 0, $extra = } } +function form_radios($title, $name, $value, $options, $description = 0) { + if (count($options) > 0) { + foreach ($options as $key=>$choice) { + $output .= form_radio($choice, $name, $key, ($key == $value)); + } + return form_item($title, $output, $description); + } +} + function form_file($title, $name, $size, $description = 0) { return form_item($title, "\n", $description); } @@ -1000,7 +1016,7 @@ $conf = variable_init(isset($conf) ? $conf : array()); set_error_handler("error_handler"); // spit out the correct charset http header -header("Content-Type: text/html; charset=". variable_get("charset", "iso-8859-1")); +header("Content-Type: text/html; charset=". variable_get("site_charset", "iso-8859-1")); // initialize installed modules: module_init(); -- cgit v1.2.3