cvs diff: Diffing . cvs diff: Diffing database cvs diff: Diffing includes Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.41 diff -u -r1.41 bootstrap.inc --- includes/bootstrap.inc 19 Mar 2005 01:24:18 -0000 1.41 +++ includes/bootstrap.inc 27 Mar 2005 13:52:01 -0000 @@ -393,7 +393,7 @@ if (!isset($title)) { // during a bootstrap, menu.inc is not included and thus we cannot provide a title if (function_exists('menu_get_active_title')) { - $title = menu_get_active_title(); + $title = check_plain(menu_get_active_title()); } } @@ -509,7 +509,7 @@ */ function referer_uri() { if (isset($_SERVER['HTTP_REFERER'])) { - return check_url($_SERVER['HTTP_REFERER']); + return $_SERVER['HTTP_REFERER']; } } @@ -537,14 +537,14 @@ } /** - * Prepare user input for use in a URI. + * Prepare a URL for use in an HTML attribute. * - * We replace ( and ) with their entity equivalents to prevent XSS attacks. + * We replace ( and ) with their url-encoded equivalents to prevent XSS attacks. */ function check_url($uri) { $uri = htmlspecialchars($uri, ENT_QUOTES); - $uri = strtr($uri, array('(' => '&040;', ')' => '&041;')); + $uri = strtr($uri, array('(' => '%28', ')' => '%29')); return $uri; } @@ -567,7 +567,7 @@ } } - return check_url($uri); + return $uri; } /** Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.431 diff -u -r1.431 common.inc --- includes/common.inc 21 Mar 2005 19:26:47 -0000 1.431 +++ includes/common.inc 29 Mar 2005 18:59:18 -0000 @@ -173,8 +173,7 @@ extract(parse_url($_REQUEST['edit']['destination'])); } - // Translate & to simply & in the absolute URL. - $url = str_replace('&', '&', url($path, $query, $fragment, TRUE)); + $url = url($path, $query, $fragment, TRUE); if (ini_get('session.use_trans_sid') && session_id() && !strstr($url, session_id())) { $sid = session_name() . '=' . session_id(); @@ -203,7 +202,7 @@ */ function drupal_not_found() { header('HTTP/1.0 404 Not Found'); - watchdog('page not found', t('%page not found.', array('%page' => ''. db_escape_string($_GET['q']) .'')), WATCHDOG_WARNING); + watchdog('page not found', t('%page not found.', array('%page' => ''. check_plain($_GET['q']) .'')), WATCHDOG_WARNING); $path = drupal_get_normal_path(variable_get('site_404', '')); $status = MENU_NOT_FOUND; @@ -223,7 +222,7 @@ */ function drupal_access_denied() { header('HTTP/1.0 403 Forbidden'); - watchdog('access denied', t('%page denied access.', array('%page' => ''. db_escape_string($_GET['q']) .'')), WATCHDOG_WARNING, l(t('view'), $_GET['q'])); + watchdog('access denied', t('%page denied access.', array('%page' => ''. check_plain($_GET['q']) .'')), WATCHDOG_WARNING, l(t('view'), $_GET['q'])); $path = drupal_get_normal_path(variable_get('site_403', '')); $status = MENU_NOT_FOUND; @@ -549,15 +548,10 @@ } /** - * Encode special characters in a string for display as HTML. - * - * Note that we'd like to use htmlspecialchars($input, $quotes, 'utf-8') - * as outlined in the PHP manual, but we can't because there's a bug in - * PHP < 4.3 that makes it mess up multibyte charsets if we specify the - * charset. This will be changed later once we make PHP 4.3 a requirement. + * Encode special characters in a plain-text string for display as HTML. */ -function drupal_specialchars($input, $quotes = ENT_NOQUOTES) { - return htmlspecialchars($input, $quotes); +function check_plain($text) { + return htmlspecialchars($text, ENT_QUOTES); } /** @@ -642,7 +636,7 @@ $match += preg_match("/<\s*(applet|script|object|style|embed|form|blink|meta|html|frame|iframe|layer|ilayer|head|frameset|xml)/i", $data); if ($match) { - watchdog('security', t('Terminated request because of suspicious input data: %data.', array('%data' => ''. drupal_specialchars($data) .''))); + watchdog('security', t('Terminated request because of suspicious input data: %data.', array('%data' => ''. check_plain($data) .''))); return FALSE; } } @@ -680,10 +674,6 @@ return ($number < $threshold ? TRUE : FALSE); } -function check_form($text) { - return drupal_specialchars($text, ENT_QUOTES); -} - function check_file($filename) { return is_uploaded_file($filename); } @@ -703,12 +693,12 @@ // arbitrary elements may be added using the $args associative array $output = "\n"; - $output .= ' '. drupal_specialchars(strip_tags($title)) ."\n"; - $output .= ' '. drupal_specialchars(strip_tags($link)) ."\n"; - $output .= ' '. drupal_specialchars(strip_tags($description)) ."\n"; - $output .= ' '. drupal_specialchars(strip_tags($language)) ."\n"; + $output .= ' '. check_plain($title) ."\n"; + $output .= ' '. check_url($link) ."\n"; + $output .= ' '. check_plain($description) ."\n"; + $output .= ' '. check_plain($language) ."\n"; foreach ($args as $key => $value) { - $output .= ' <'. $key .'>'. drupal_specialchars(strip_tags($value)) ."\n"; + $output .= ' <'. $key .'>'. check_plain($value) ."\n"; } $output .= $items; $output .= "\n"; @@ -723,9 +713,9 @@ */ function format_rss_item($title, $link, $description, $args = array()) { $output = "\n"; - $output .= ' '. drupal_specialchars(strip_tags($title)) ."\n"; - $output .= ' '. drupal_specialchars(strip_tags($link)) ."\n"; - $output .= ' '. drupal_specialchars($description) ."\n"; + $output .= ' '. check_plain($title) ."\n"; + $output .= ' '. check_url($link) ."\n"; + $output .= ' '. check_plain($description) ."\n"; foreach ($args as $key => $value) { if (is_array($value)) { if ($value['key']) { @@ -743,7 +733,7 @@ } } else { - $output .= ' <'. $key .'>'. drupal_specialchars(strip_tags($value)) ."\n"; + $output .= ' <'. $key .'>'. check_plain($value) ."\n"; } } $output .= "\n"; @@ -1212,7 +1202,7 @@ */ function form_textfield($title, $name, $value, $size, $maxlength, $description = NULL, $attributes = NULL, $required = FALSE) { $size = $size ? ' size="'. $size .'"' : ''; - return theme('form_element', $title, '', $description, 'edit-'. $name, $required, _form_get_error($name)); + return theme('form_element', $title, '', $description, 'edit-'. $name, $required, _form_get_error($name)); } /** @@ -1239,7 +1229,7 @@ */ function form_password($title, $name, $value, $size, $maxlength, $description = NULL, $attributes = NULL, $required = FALSE) { $size = $size ? ' size="'. $size .'"' : ''; - return theme('form_element', $title, '', $description, 'edit-'. $name, $required, _form_get_error($name)); + return theme('form_element', $title, '', $description, 'edit-'. $name, $required, _form_get_error($name)); } /** @@ -1275,7 +1265,7 @@ } } - $output .= theme('form_element', $title, '', $description, 'edit-'. $name, $required, _form_get_error($name)); + $output .= theme('form_element', $title, '', $description, 'edit-'. $name, $required, _form_get_error($name)); // e.g. optionally plug in a WYSIWYG editor foreach (module_list() as $module_name) { @@ -1321,12 +1311,12 @@ if (is_array($choice)) { $select .= ''; foreach ($choice as $key => $choice) { - $select .= ''; + $select .= ''; } $select .= ''; } else { - $select .= ''; + $select .= ''; } } return theme('form_element', $title, '', $description, 'edit-'. $name, $required, _form_get_error($name)); @@ -1370,7 +1360,7 @@ * an attacker to change the value before it is submitted. */ function form_hidden($name, $value) { - return '\n"; + return '\n"; } /** @@ -1389,7 +1379,7 @@ * A themed HTML string representing the button. */ function form_button($value, $name = 'op', $type = 'submit', $attributes = NULL) { - return '\n"; + return '\n"; } /** @@ -1476,12 +1466,12 @@ $fragment = '#'. $fragment; } - $base = ($absolute ? $base_url . '/' : ''); + $base = ($absolute ? $base_url .'/' : ''); if (variable_get('clean_url', '0') == '0') { if (isset($path)) { if (isset($query)) { - return $base . $script .'?q='. $path .'&'. $query . $fragment; + return $base . $script .'?q='. $path .'&'. $query . $fragment; } else { return $base . $script .'?q='. $path . $fragment; @@ -1528,7 +1518,7 @@ if ($attributes) { $t = array(); foreach ($attributes as $key => $value) { - $t[] = $key .'="'. $value .'"'; + $t[] = $key .'="'. check_plain($value) .'"'; } return ' '. implode($t, ' '); @@ -1555,10 +1545,12 @@ * @param $absolute * Whether to force the output to be an absolute link (beginning with http:). * Useful for links that will be displayed outside the site, such as in an RSS feed. + * @param $html + * Whether the title is HTML, or just plain-text. * @return * an HTML string containing a link to the given path. */ -function l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE) { +function l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE) { if (drupal_get_normal_path($path) == $_GET['q']) { if (isset($attributes['class'])) { $attributes['class'] .= ' active'; @@ -1567,7 +1559,7 @@ $attributes['class'] = 'active'; } } - return ''. $text .''; + return ''. ($html ? $text : check_plain($text)) .''; } /** @@ -1679,7 +1671,7 @@ $out = @mb_convert_encoding($data, 'utf-8', $encoding); } else if (function_exists('recode_string')) { - $out = @recode_string($encoding . '..utf-8', $data); + $out = @recode_string($encoding .'..utf-8', $data); } else { watchdog('php', t("Unsupported encoding '%s'. Please install iconv, GNU recode or mbstring for PHP.", $encoding), WATCHDOG_ERROR); Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.37 diff -u -r1.37 file.inc --- includes/file.inc 8 Mar 2005 22:10:26 -0000 1.37 +++ includes/file.inc 29 Mar 2005 18:59:54 -0000 @@ -76,11 +76,11 @@ // Check if directory exists. if (!is_dir($directory)) { if (($mode & FILE_CREATE_DIRECTORY) && @mkdir($directory, 0760)) { - drupal_set_message(t('Created directory %directory.', array('%directory' => "$directory"))); + drupal_set_message(t('Created directory %directory.', array('%directory' => ''. check_plain($directory) .''))); } else { if ($form_item) { - form_set_error($form_item, t('The directory %directory does not exist.', array('%directory' => "$directory"))); + form_set_error($form_item, t('The directory %directory does not exist.', array('%directory' => ''. check_plain($directory) .''))); } return false; } @@ -89,10 +89,10 @@ // Check to see if the directory is writable. if (!is_writable($directory)) { if (($mode & FILE_MODIFY_PERMISSIONS) && @chmod($directory, 0760)) { - drupal_set_message(t('Modified permissions on directory %directory.', array('%directory' => "$directory"))); + drupal_set_message(t('Modified permissions on directory %directory.', array('%directory' => ''. check_plain($directory) .''))); } else { - form_set_error($form_item, t('The directory %directory is not writable.', array('%directory' => "$directory"))); + form_set_error($form_item, t('The directory %directory is not writable.', array('%directory' => ''. check_plain($directory) .''))); return false; } } Index: includes/locale.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/locale.inc,v retrieving revision 1.39 diff -u -r1.39 locale.inc --- includes/locale.inc 9 Jan 2005 09:22:39 -0000 1.39 +++ includes/locale.inc 13 Mar 2005 02:17:42 -0000 @@ -23,14 +23,14 @@ // the language addition, we need to inform the user on how to start // a translation if ($onlylanguage) { - $message = t('%locale language added. You can now import a translation. See the help screen for more information.', array('%locale' => ''. t($name) .'', '%locale-help' => url('admin/help/locale'))); + $message = t('%locale language added. You can now import a translation. See the help screen for more information.', array('%locale' => ''. check_plain(t($name)) .'', '%locale-help' => url('admin/help/locale'))); } else { - $message = t('%locale language added.', array('%locale' => ''. t($name) .'')); + $message = t('%locale language added.', array('%locale' => ''. check_plain(t($name)) .'')); } drupal_set_message($message); - watchdog('locale', t('%language language (%locale) added.', array('%language' => "$name", '%locale' => "$code"))); + watchdog('locale', t('%language language (%locale) added.', array('%language' => ''. check_plain($name) .'', '%locale' => ''. check_plain($code) .''))); } /** @@ -47,7 +47,7 @@ $status = db_fetch_object(db_query("SELECT isdefault, enabled FROM {locales_meta} WHERE locale = '%s'", $key)); if ($key == 'en') { - $rows[] = array('en', $lang, form_checkbox('', 'enabled][en', 1, $status->enabled), form_radio('', 'sitedefault', $key, $status->isdefault), message_na(), ''); + $rows[] = array('en', check_plain($lang), form_checkbox('', 'enabled][en', 1, $status->enabled), form_radio('', 'sitedefault', $key, $status->isdefault), message_na(), ''); } else { $original = db_fetch_object(db_query("SELECT COUNT(*) AS strings FROM {locales_source}")); @@ -55,7 +55,7 @@ $ratio = ($original->strings > 0 && $translation->translation > 0) ? round(($translation->translation/$original->strings)*100., 2) : 0; - $rows[] = array($key, ($key != 'en' ? form_textfield('', 'name]['. $key, $lang, 15, 64) : $lang), form_checkbox('', 'enabled]['. $key, 1, $status->enabled), form_radio('', 'sitedefault', $key, $status->isdefault), "$translation->translation/$original->strings ($ratio%)", ($key != 'en' ? l(t('delete'), 'admin/locale/language/delete/'. urlencode($key)) : '')); + $rows[] = array(check_plain($key), ($key != 'en' ? form_textfield('', 'name]['. $key, $lang, 15, 64) : $lang), form_checkbox('', 'enabled]['. $key, 1, $status->enabled), form_radio('', 'sitedefault', $key, $status->isdefault), "$translation->translation/$original->strings ($ratio%)", ($key != 'en' ? l(t('delete'), 'admin/locale/language/delete/'. urlencode($key)) : '')); } } @@ -132,7 +132,7 @@ // Check if we can get the strings from the file if (!($strings = _locale_import_read_po($file))) { - drupal_set_message(t('Translation file %filename broken: Could not be read.', array('%filename' => "$file->filename")), 'error'); + drupal_set_message(t('Translation file %filename broken: Could not be read.', array('%filename' => ''. check_plain($file->filename) .'')), 'error'); return FALSE; } @@ -154,7 +154,7 @@ } } else { - drupal_set_message(t('Translation file %filename broken: No header.', array('%filename' => "$file->filename")), 'error'); + drupal_set_message(t('Translation file %filename broken: No header.', array('%filename' => ''. check_plain($file->filename) .'')), 'error'); return FALSE; } @@ -257,7 +257,7 @@ menu_rebuild(); drupal_set_message(t('Translation successfully imported. %number translated strings added to language, %update strings updated.', array('%number' => $additions, '%update' => $updates))); - watchdog('locale', t('Imported %file into %locale: %number new strings added and %update updated.', array('%file' => "$file->filename", '%locale' => "$lang", '%number' => $additions, '%update' => $updates))); + watchdog('locale', t('Imported %file into %locale: %number new strings added and %update updated.', array('%file' => ''. check_plain($file->filename) .'', '%locale' => ''. check_plain($lang) .'', '%number' => $additions, '%update' => $updates))); return TRUE; } @@ -269,9 +269,10 @@ */ function _locale_import_read_po($file) { + $message = ''. check_plain($file->filename) .''; $fd = fopen($file->filepath, "rb"); if (!$fd) { - drupal_set_message(t('Translation import failed: file %filename cannot be read.', array('%filename' => "$file->filename")), 'error'); + drupal_set_message(t('Translation import failed: file %filename cannot be read.', array('%filename' => $message)), 'error'); return FALSE; } $info = fstat($fd); @@ -303,19 +304,19 @@ $context = "COMMENT"; } else { // Parse error - drupal_set_message(t("Translation file %filename broken: expected 'msgstr' in line %line.", array('%filename' => "$file->filename", '%line' => $lineno)), 'error'); + drupal_set_message(t("Translation file %filename broken: expected 'msgstr' in line %line.", array('%filename' => $message, '%line' => $lineno)), 'error'); return FALSE; } } elseif (!strncmp("msgid_plural", $line, 12)) { if ($context != "MSGID") { // Must be plural form for current entry - drupal_set_message(t("Translation file %filename broken: unexpected 'msgid_plural' in line %line.", array('%filename' => "$file->filename", '%line' => $lineno)), 'error'); + drupal_set_message(t("Translation file %filename broken: unexpected 'msgid_plural' in line %line.", array('%filename' => $message, '%line' => $lineno)), 'error'); return FALSE; } $line = trim(substr($line, 12)); $quoted = _locale_import_parse_quoted($line); if ($quoted === false) { - drupal_set_message(t('Translation file %filename broken: syntax error in line %line.', array('%filename' => "$file->filename", '%line' => $lineno)), 'error'); + drupal_set_message(t('Translation file %filename broken: syntax error in line %line.', array('%filename' => $message, '%line' => $lineno)), 'error'); return FALSE; } $current["msgid"] = $current["msgid"] ."\0". $quoted; @@ -327,13 +328,13 @@ $current = array(); } elseif ($context == "MSGID") { // Already in this context? Parse error - drupal_set_message(t("Translation file %filename broken: unexpected 'msgid' in line %line.", array('%filename' => "$file->filename", '%line' => $lineno)), 'error'); + drupal_set_message(t("Translation file %filename broken: unexpected 'msgid' in line %line.", array('%filename' => $message, '%line' => $lineno)), 'error'); return FALSE; } $line = trim(substr($line, 5)); $quoted = _locale_import_parse_quoted($line); if ($quoted === false) { - drupal_set_message(t('Translation file %filename broken: syntax error in line %line.', array('%filename' => "$file->filename", '%line' => $lineno)), 'error'); + drupal_set_message(t('Translation file %filename broken: syntax error in line %line.', array('%filename' => $message, '%line' => $lineno)), 'error'); return FALSE; } $current["msgid"] = $quoted; @@ -341,11 +342,11 @@ } elseif (!strncmp("msgstr[", $line, 7)) { if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { // Must come after msgid, msgid_plural, or msgstr[] - drupal_set_message(t("Translation file %filename broken: unexpected 'msgstr[]' in line %line.", array('%filename' => "$file->filename", '%line' => $lineno)), 'error'); + drupal_set_message(t("Translation file %filename broken: unexpected 'msgstr[]' in line %line.", array('%filename' => $message, '%line' => $lineno)), 'error'); return FALSE; } if (strpos($line, "]") === false) { - drupal_set_message(t('Translation file %filename broken: syntax error in line %line.', array('%filename' => "$file->filename", '%line' => $lineno)), 'error'); + drupal_set_message(t('Translation file %filename broken: syntax error in line %line.', array('%filename' => $message, '%line' => $lineno)), 'error'); return FALSE; } $frombracket = strstr($line, "["); @@ -353,7 +354,7 @@ $line = trim(strstr($line, " ")); $quoted = _locale_import_parse_quoted($line); if ($quoted === false) { - drupal_set_message(t('Translation file %filename broken: syntax error in line %line.', array('%filename' => "$file->filename", '%line' => $lineno)), 'error'); + drupal_set_message(t('Translation file %filename broken: syntax error in line %line.', array('%filename' => $message, '%line' => $lineno)), 'error'); return FALSE; } $current["msgstr"][$plural] = $quoted; @@ -361,13 +362,13 @@ } elseif (!strncmp("msgstr", $line, 6)) { if ($context != "MSGID") { // Should come just after a msgid block - drupal_set_message(t("Translation file %filename broken: unexpected 'msgstr' in line %line.", array('%filename' => "$file->filename", '%line' => $lineno)), 'error'); + drupal_set_message(t("Translation file %filename broken: unexpected 'msgstr' in line %line.", array('%filename' => $message, '%line' => $lineno)), 'error'); return FALSE; } $line = trim(substr($line, 6)); $quoted = _locale_import_parse_quoted($line); if ($quoted === false) { - drupal_set_message(t('Translation file %filename broken: syntax error in line %line.', array('%filename' => "$file->filename", '%line' => $lineno)), 'error'); + drupal_set_message(t('Translation file %filename broken: syntax error in line %line.', array('%filename' => $message, '%line' => $lineno)), 'error'); return FALSE; } $current["msgstr"] = $quoted; @@ -376,7 +377,7 @@ elseif ($line != "") { $quoted = _locale_import_parse_quoted($line); if ($quoted === false) { - drupal_set_message(t('Translation file %filename broken: syntax error in line %line.', array('%filename' => "$file->filename", '%line' => $lineno)), 'error'); + drupal_set_message(t('Translation file %filename broken: syntax error in line %line.', array('%filename' => $message, '%line' => $lineno)), 'error'); return FALSE; } if (($context == "MSGID") || ($context == "MSGID_PLURAL")) { @@ -389,7 +390,7 @@ $current["msgstr"][$plural] .= $quoted; } else { - drupal_set_message(t('Translation file %filename broken: unexpected string in line %line.', array('%filename' => "$file->filename", '%line' => $lineno)), 'error'); + drupal_set_message(t('Translation file %filename broken: unexpected string in line %line.', array('%filename' => $message, '%line' => $lineno)), 'error'); return FALSE; } } @@ -400,7 +401,7 @@ $strings[$current["msgid"]] = $current; } elseif ($context != "COMMENT") { - drupal_set_message(t('Translation file %filename broken: unexpected end file at line %line.', array('%filename' => "$file->filename", '%line' => $lineno)), 'error'); + drupal_set_message(t('Translation file %filename broken: unexpected end of file at line %line.', array('%filename' => $message, '%line' => $lineno)), 'error'); return FALSE; } @@ -465,7 +466,7 @@ return array($nplurals, $plural); } else { - drupal_set_message(t("Translation file %filename broken: plural formula couldn't get parsed.", array('%filename' => "$filename")), 'error'); + drupal_set_message(t("Translation file %filename broken: plural formula couldn't get parsed.", array('%filename' => ''. check_plain($filename) .'')), 'error'); return FALSE; } } @@ -768,7 +769,7 @@ $header .= "\"Plural-Forms: nplurals=". $meta->plurals ."; plural=". strtr($meta->formula, '$', '') .";\\n\"\n"; } $header .= "\n"; - watchdog('locale', t('Exported %locale translation file: %filename.', array('%locale' => "$meta->name", '%filename' => "$filename"))); + watchdog('locale', t('Exported %locale translation file: %filename.', array('%locale' => ''. check_plain($meta->name) .'', '%filename' => ''. check_plain($filename) .''))); } // Generating Portable Object Template @@ -789,7 +790,7 @@ $header .= "\"Content-Transfer-Encoding: 8bit\\n\"\n"; $header .= "\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n\"\n"; $header .= "\n"; - watchdog('locale', t('Exported translation file: %filename.', array('%filename' => "$filename"))); + watchdog('locale', t('Exported translation file: %filename.', array('%filename' => ''. check_plain($filename) .''))); } // Start download process @@ -1080,6 +1081,7 @@ // Get *all* languages set up $languages = locale_supported_languages(FALSE, TRUE); asort($languages['name']); unset($languages['name']['en']); + $languages['name'] = array_map('check_plain', $languages['name']); // Present edit form preserving previous user settings $query = _locale_string_seek_query(); Index: includes/pager.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/pager.inc,v retrieving revision 1.41 diff -u -r1.41 pager.inc --- includes/pager.inc 28 Jan 2005 18:44:17 -0000 1.41 +++ includes/pager.inc 7 Mar 2005 23:02:10 -0000 @@ -384,19 +384,19 @@ $q = $_GET['q']; $from = array_key_exists('from', $_GET) ? $_GET['from'] : ''; - foreach($attributes as $key => $value) { + foreach ($attributes as $key => $value) { $query[] = $key .'='. $value; } $from_new = pager_load_array($from_new[$element], $element, explode(',', $from)); if (count($attributes)) { - $url = url($q, 'from='. implode($from_new, ',') .'&'. implode('&', $query)); + $url = url($q, 'from='. implode($from_new, ',') .'&'. implode('&', $query)); } else { $url = url($q, 'from='. implode($from_new, ',')); } - return $url; + return check_url($url); } function pager_load_array($value, $element, $old_array) { Index: includes/tablesort.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/tablesort.inc,v retrieving revision 1.31 diff -u -r1.31 tablesort.inc --- includes/tablesort.inc 31 Jan 2005 21:36:37 -0000 1.31 +++ includes/tablesort.inc 12 Mar 2005 20:09:20 -0000 @@ -87,7 +87,7 @@ $ts['sort'] = 'asc'; $image = ''; } - $cell['data'] = l($cell['data'] . $image, $_GET['q'], array('title' => $title), 'sort='. $ts['sort'] .'&order='. urlencode($cell['data']). $ts['query_string']); + $cell['data'] = l($cell['data'] . $image, $_GET['q'], array('title' => $title), 'sort='. $ts['sort'] .'&order='. urlencode($cell['data']). $ts['query_string'], NULL, FALSE, TRUE); unset($cell['field'], $cell['sort']); } @@ -139,7 +139,7 @@ $query_string = ''; foreach ($cgi as $key => $val) { if ($key != 'order' && $key != 'sort' && $key != 'q') { - $query_string .= '&'. $key .'='. $val; + $query_string .= '&'. $key .'='. $val; } } return $query_string; Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.225 diff -u -r1.225 theme.inc --- includes/theme.inc 16 Mar 2005 19:41:12 -0000 1.225 +++ includes/theme.inc 28 Mar 2005 20:17:53 -0000 @@ -221,8 +221,8 @@ */ function theme_get_settings($key = NULL) { $defaults = array( - 'primary_links' => l('edit primary links', 'admin/themes/settings'), - 'secondary_links' => l('edit secondary links', 'admin/themes/settings'), + 'primary_links' => l(t('edit primary links'), 'admin/themes/settings'), + 'secondary_links' => l(t('edit secondary links'), 'admin/themes/settings'), 'mission' => '', 'default_logo' => 1, 'logo_path' => '', @@ -357,7 +357,7 @@ $output = "\n"; $output .= ''; $output .= ''; - $output .= ' '. (drupal_get_title() ? drupal_get_title() : variable_get('site_name', 'drupal')) .''; + $output .= ' '. (drupal_get_title() ? strip_tags(drupal_get_title()) : variable_get('site_name', 'drupal')) .''; $output .= drupal_get_html_head(); $output .= theme_get_styles(); @@ -496,7 +496,7 @@ } if ($page == 0) { - $output = '

'. $node->title .'

by '. format_name($node); + $output = '

'. check_plain($node->title) .'

by '. format_name($node); } else { $output = 'by '. format_name($node); cvs diff: Diffing misc cvs diff: Diffing modules Index: modules/aggregator.module =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator.module,v retrieving revision 1.230 diff -u -r1.230 aggregator.module --- modules/aggregator.module 3 Mar 2005 20:05:46 -0000 1.230 +++ modules/aggregator.module 29 Mar 2005 19:08:13 -0000 @@ -198,11 +198,11 @@ if ($op == 'list') { $result = db_query('SELECT cid, title FROM {aggregator_category} ORDER BY title'); while ($category = db_fetch_object($result)) { - $block['category:'. $category->cid]['info'] = t('%title category latest items', array('%title' => $category->title)); + $block['category:'. $category->cid]['info'] = t('%title category latest items', array('%title' => ''. check_plain($category->title) .'')); } $result = db_query('SELECT fid, title FROM {aggregator_feed} ORDER BY fid'); while ($feed = db_fetch_object($result)) { - $block['feed:'. $feed->fid]['info'] = t('%title feed latest items', array('%title' => $feed->title)); + $block['feed:'. $feed->fid]['info'] = t('%title feed latest items', array('%title' => ''. check_plain($feed->title) .'')); } } else if ($op == 'configure') { @@ -231,7 +231,7 @@ switch ($type) { case 'feed': if ($feed = db_fetch_object(db_query('SELECT fid, title, block FROM {aggregator_feed} WHERE fid = %d', $id))) { - $block['subject'] = $feed->title; + $block['subject'] = check_plain($feed->title); $result = db_query_range('SELECT * FROM {aggregator_item} WHERE fid = %d ORDER BY timestamp DESC, iid DESC', $feed->fid, 0, $feed->block); $block['content'] = ''; } @@ -239,7 +239,7 @@ case 'category': if ($category = db_fetch_object(db_query('SELECT cid, title, block FROM {aggregator_category} WHERE cid = %d', $id))) { - $block['subject'] = $category->title; + $block['subject'] = check_plain($category->title); $result = db_query_range('SELECT i.* FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON ci.iid = i.iid WHERE ci.cid = %d ORDER BY i.timestamp DESC, i.iid DESC', $category->cid, 0, $category->block); $block['content'] = ''; } @@ -265,7 +265,7 @@ } db_query('DELETE FROM {aggregator_item} WHERE fid = %d', $feed['fid']); db_query("UPDATE {aggregator_feed} SET checked = 0, etag = '', modified = 0 WHERE fid = %d", $feed['fid']); - drupal_set_message(t('Removed news items from %site.', array('%site' => ''. $feed['title'] .''))); + drupal_set_message(t('Removed news items from %site.', array('%site' => ''. check_plain($feed['title']) .''))); } /** @@ -345,11 +345,11 @@ switch ($result->code) { case 304: db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', time(), $feed['fid']); - drupal_set_message(t('No new syndicated content from %site.', array('%site' => ''. $feed['title'] .''))); + drupal_set_message(t('No new syndicated content from %site.', array('%site' => ''. check_plain($feed['title']) .''))); break; case 301: $feed['url'] = $result->redirect_url; - watchdog('aggregator', t('Updated URL for feed %title to %url.', array('%title' => ''. $feed['title'] .'', '%url' => ''. $feed['url'] .''))); + watchdog('aggregator', t('Updated URL for feed %title to %url.', array('%title' => ''. check_plain($feed['title']) .'', '%url' => ''. check_url($feed['url']) .''))); break; case 200: @@ -397,13 +397,13 @@ cache_clear_all(); - $message = t('Syndicated content from %site.', array('%site' => ''. $feed[title] .'')); + $message = t('Syndicated content from %site.', array('%site' => ''. check_plain($feed[title]) .'')); watchdog('aggregator', $message); drupal_set_message($message); } break; default: - $message = t('Failed to parse RSS feed %site: %error.', array('%site' => ''. $feed['title'] .'', '%error' => "$result->code $result->error")); + $message = t('Failed to parse RSS feed %site: %error.', array('%site' => ''. check_plain($feed['title']) .'', '%error' => ''. check_plain($result->code .' '. $result->error) .'')); watchdog('aggregator', $message, WATCHDOG_WARNING); drupal_set_message($message); } @@ -461,7 +461,7 @@ xml_set_character_data_handler($xml_parser, 'aggregator_element_data'); if (!xml_parse($xml_parser, $data, 1)) { - $message = t('Failed to parse RSS feed %site: %error at line %line.', array('%site' => ''. $feed['title'] .'', '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))); + $message = t('Failed to parse RSS feed %site: %error at line %line.', array('%site' => ''. check_plain($feed['title']) .'', '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))); watchdog('aggregator', $message, WATCHDOG_WARNING); drupal_set_message($message, 'error'); return 0; @@ -554,7 +554,7 @@ } if (!valid_input_data($item['DESCRIPTION'])) { - drupal_set_message(t('Failed to parse entry from %site feed: suspicious input data.', array('%site' => ''. $feed['title'] .'')), 'error'); + drupal_set_message(t('Failed to parse entry from %site feed: suspicious input data.', array('%site' => ''. check_plain($feed['title']) .'')), 'error'); } else { aggregator_save_item(array('iid' => $entry->iid, 'fid' => $feed['fid'], 'timestamp' => $timestamp, 'title' => $title, 'link' => $link, 'author' => $item['AUTHOR'], 'description' => $item['DESCRIPTION'])); @@ -643,7 +643,7 @@ $categories = db_query('SELECT c.cid, c.title, f.fid FROM {aggregator_category} c LEFT JOIN {aggregator_category_feed} f ON c.cid = f.cid AND f.fid = %d ORDER BY title', $edit['fid']); while ($category = db_fetch_object($categories)) { $options[$category->cid] = $category->title; - if ($category->fid) $values[] = $category->cid; + if ($category->fid) $values[] = check_plain($category->cid); } if ($options) { $form .= form_checkboxes(t('Categorize news items'), 'category', $values, $options, t('New items in this feed will be automatically filed in the the checked categories as they are received.')); @@ -920,7 +920,7 @@ $selected = array(); while ($category = db_fetch_object($categories_result)) { if (!$done) { - $categories[$category->cid] = check_form($category->title); + $categories[$category->cid] = check_plain($category->title); } if ($category->iid) { $selected[] = $category->cid; @@ -932,7 +932,7 @@ else { $form = ''; while ($category = db_fetch_object($categories_result)) { - $form .= form_checkbox(check_form($category->title), 'categories]['. $item->iid .'][', $category->cid, !is_null($category->iid)); + $form .= form_checkbox(check_plain($category->title), 'categories]['. $item->iid .'][', $category->cid, !is_null($category->iid)); } } $rows[] = array(theme('aggregator_page_item', $item), array('data' => $form, 'class' => 'categorize-item')); @@ -960,7 +960,7 @@ $result = db_query('SELECT f.fid, f.title, f.description, f.image, MAX(i.timestamp) AS last FROM {aggregator_feed} f LEFT JOIN {aggregator_item} i ON f.fid = i.fid GROUP BY f.fid'); $output = "
\n"; while ($feed = db_fetch_object($result)) { - $output .= "

$feed->title

\n"; + $output .= '

'. check_plain($feed->title) ."

\n"; // Most recent items: $list = array(); @@ -987,13 +987,13 @@ $output = "\n"; $output .= "\n"; $output .= "\n"; - $output .= ''. drupal_specialchars(variable_get('site_name', 'Drupal')) ."\n"; + $output .= ''. check_plain(variable_get('site_name', 'Drupal')) ."\n"; $output .= ''. gmdate('r') ."\n"; $output .= "\n"; $output .= "\n"; while ($feed = db_fetch_object($result)) { - $output .= '\n"; + $output .= '\n"; } $output .= "\n"; @@ -1011,7 +1011,7 @@ $output = "
\n"; while ($category = db_fetch_object($result)) { - $output .= "

$category->title

\n"; + $output .= '

'. check_plain($category->title) ."

\n"; if (variable_get('aggregator_summary_items', 3)) { $list = array(); $items = db_query_range('SELECT i.title, i.timestamp, i.link, f.title as feed_title, f.link as feed_link FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON i.iid = ci.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE ci.cid = %d ORDER BY i.timestamp DESC', $category->cid, 0, variable_get('aggregator_summary_items', 3)); @@ -1066,12 +1066,12 @@ if ($user->uid && module_exist('blog') && user_access('edit own blog')) { if ($image = theme('image', 'misc/blog.png', t('blog it'), t('blog it'))) { - $output .= '
'. l($image, 'node/add/blog', array('title' => t('Comment on this news item in your personal blog.'), 'class' => 'blog-it'), "iid=$item->iid") .'
'; + $output .= '
'. l($image, 'node/add/blog', array('title' => t('Comment on this news item in your personal blog.'), 'class' => 'blog-it'), "iid=$item->iid", NULL, FALSE, TRUE) .'
'; } } // Display the external link to the item. - $output .= "link\">$item->title\n"; + $output .= ''. check_plain($item->title) ."\n"; return $output; } @@ -1086,7 +1086,7 @@ * @ingroup themeable */ function theme_aggregator_summary_item($item) { - $output = ''. $item->title .' '. t('%age old', array('%age' => format_interval(time() - $item->timestamp))) .''; + $output = ''. check_plain($item->title) .' '. t('%age old', array('%age' => format_interval(time() - $item->timestamp))) .''; if ($item->feed_link) { $output .= ', '. $item->feed_title .''; } @@ -1110,9 +1110,9 @@ $output .= "
\n"; $output .= '
'. date('H:i', $item->timestamp) ."
\n"; $output .= "
\n"; - $output .= " \n"; + $output .= ' \n"; if ($item->description) { - $output .= "
$item->description
\n"; + $output .= '
'. check_plain($item->description) ."
\n"; } if ($item->ftitle && $item->fid) { $output .= '
'. t('Source') .': '. l($item->ftitle, "aggregator/sources/$item->fid") ."
\n"; Index: modules/archive.module =================================================================== RCS file: /cvs/drupal/drupal/modules/archive.module,v retrieving revision 1.77 diff -u -r1.77 archive.module --- modules/archive.module 29 Jan 2005 22:02:36 -0000 1.77 +++ modules/archive.module 12 Mar 2005 20:13:52 -0000 @@ -91,7 +91,7 @@ $output .= "\n\n"; $output .= '
'; $output .= '\n"; - $output .= ' \n"; + $output .= ' \n"; // First day of week (0 => Sunday, 1 => Monday, ...) $weekstart = variable_get('date_first_day', 0); Index: modules/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block.module,v retrieving revision 1.160 diff -u -r1.160 block.module --- modules/block.module 18 Mar 2005 07:07:04 -0000 1.160 +++ modules/block.module 29 Mar 2005 19:10:28 -0000 @@ -86,7 +86,7 @@ case 'list': $result = db_query('SELECT bid, title, info FROM {boxes} ORDER BY title'); while ($block = db_fetch_object($result)) { - $blocks[$block->bid]['info'] = $block->info ? $block->info : $block->title; + $blocks[$block->bid]['info'] = $block->info ? check_plain($block->info) : check_plain($block->title); } return $blocks; @@ -103,7 +103,7 @@ case 'view': $block = db_fetch_object(db_query('SELECT * FROM {boxes} WHERE bid = %d', $delta)); - $data['subject'] = $block->title; + $data['subject'] = check_plain($block->title); $data['content'] = check_output($block->body, $block->format); return $data; } @@ -335,13 +335,13 @@ if ($_POST['edit']['confirm']) { db_query('DELETE FROM {boxes} WHERE bid = %d', $bid); - drupal_set_message(t('The block %name has been deleted.', array('%name' => ''. $info .''))); + drupal_set_message(t('The block %name has been deleted.', array('%name' => ''. check_plain($info) .''))); cache_clear_all(); drupal_goto('admin/block'); } else { $output = theme('confirm', - t('Are you sure you want to delete the block %name?', array('%name' => ''. $info .'')), + t('Are you sure you want to delete the block %name?', array('%name' => ''. check_plain($info) .'')), 'admin/block', NULL, t('Delete')); Index: modules/blogapi.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi.module,v retrieving revision 1.37 diff -u -r1.37 blogapi.module --- modules/blogapi.module 31 Jan 2005 19:36:20 -0000 1.37 +++ modules/blogapi.module 8 Mar 2005 23:09:28 -0000 @@ -153,7 +153,7 @@ $nid = node_save($node); if ($nid) { - watchdog('content', t('%type: added %title using blog API.', array('%type' => ''. t($node->type) .'', '%title' => "$node->title")), WATCHDOG_NOTICE, l(t('view'), "node/$nid")); + watchdog('content', t('%type: added %title using blog API.', array('%type' => ''. t($node->type) .'', '%title' => ''. check_plain($node->title) .'')), WATCHDOG_NOTICE, l(t('view'), "node/$nid")); return new xmlrpcresp(new xmlrpcval($nid, 'string')); } @@ -215,7 +215,7 @@ } $nid = node_save($node); if ($nid) { - watchdog('content', t('%type: updated %title using blog API.', array('%type' => ''. t($node->type) .'', '%title' => "$node->title")), WATCHDOG_NOTICE, l(t('view'), "node/$nid")); + watchdog('content', t('%type: updated %title using blog API.', array('%type' => ''. t($node->type) .'', '%title' => ''. check_plain($node->title) .'')), WATCHDOG_NOTICE, l(t('view'), "node/$nid")); return new xmlrpcresp(new xmlrpcval(true, 'boolean')); } Index: modules/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book.module,v retrieving revision 1.286 diff -u -r1.286 book.module --- modules/book.module 22 Mar 2005 18:34:20 -0000 1.286 +++ modules/book.module 27 Mar 2005 13:52:01 -0000 @@ -148,7 +148,7 @@ $expand[] = $node->nid; } - $block['subject'] = $path[0]->title; + $block['subject'] = check_plain($path[0]->title); $block['content'] = book_tree($expand[0], 5, $expand); } } @@ -287,7 +287,7 @@ $output .= form_submit(t('Add to book outline')); } - drupal_set_title($node->title); + drupal_set_title(check_plain($node->title)); print theme('page', form($output)); } } @@ -477,7 +477,7 @@ $links .= ''; - $titles .= ''; + $titles .= ''; } else { $links .= ''; // Make an empty div to fill the space. @@ -486,7 +486,7 @@ $links .= ''; - $titles .= ''; + $titles .= ''; } else { $links .= ''; // Make an empty div to fill the space. @@ -633,7 +633,7 @@ // Allow modules to change $node->body before viewing. node_invoke_nodeapi($node, 'view', $node->body, false); - $output .= '

'. $node->title .'

'; + $output .= '

'. check_plain($node->title) .'

'; if ($node->body) { $output .= $node->body; @@ -643,7 +643,7 @@ $output .= book_print_recurse($nid, $depth); - $html = ''. $node->title .''; + $html = ''. check_plain($node->title) .''; $html .= ''; $html .= ""; $html .= ''. $output .''; @@ -671,7 +671,7 @@ // Allow modules to change $node->body before viewing. node_invoke_nodeapi($node, 'view', $node->body, false); - $output .= '

'. $node->title .'

'; + $output .= '

'. check_plain($node->title) .'

'; if ($node->body) { $output .= '
    '. $node->body .'
'; @@ -707,7 +707,7 @@ if ($nid) { $node = node_load(array('nid' => $nid)); - $output .= '

'. $node->title .'

'; + $output .= '

'. check_plain($node->title) .'

'; $header = array(t('Title'), t('Weight'), array('data' => t('Operations'), 'colspan' => '3')); $rows[] = book_admin_view_line($node); @@ -738,7 +738,7 @@ } } - $message = t('Updated book %title.', array('%title' => "$book->title")); + $message = t('Updated book %title.', array('%title' => ''. check_plain($book->title) .'')); watchdog('content', $message); return $message; Index: modules/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment.module,v retrieving revision 1.343 diff -u -r1.343 comment.module --- modules/comment.module 20 Mar 2005 19:42:14 -0000 1.343 +++ modules/comment.module 29 Mar 2005 19:54:34 -0000 @@ -274,7 +274,7 @@ $text = ''; $comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = %d AND status = 0', $node->nid); while ($comment = db_fetch_object($comments)) { - $text .= '

'. $comment->subject .'

'. check_output($comment->comment, $comment->format); + $text .= '

'. check_plain($comment->subject) .'

'. check_output($comment->comment, $comment->format); } return $text; @@ -431,9 +431,12 @@ // Validate the comment's subject. If not specified, extract // one from the comment's body. - $edit['subject'] = strip_tags($edit['subject']); - if ($edit['subject'] == '') { - $edit['subject'] = truncate_utf8(strip_tags($edit['comment']), 29, TRUE); + if (trim($edit['subject']) == '') { + // If there are HTML tags in the comment, strip them out. + // This is not 100% correct as the body may not be HTML at all, + // but it is more desirable than not doing any stripping at all. + $stripped = preg_match('/<[a-zA-Z]/', $edit['comment']) ? strip_tags($edit['comment']) : $edit['comment']; + $edit['subject'] = truncate_utf8($stripped, 29, TRUE); } // Validate the comment's body. @@ -450,7 +453,7 @@ if (!$user->uid) { if (variable_get('comment_anonymous', 0) > 0) { if ($edit['name']) { - $taken = db_result(db_query("SELECT COUNT(uid) FROM {users} WHERE LOWER(name) = '%s'", strip_tags($edit['name'])), 0); + $taken = db_result(db_query("SELECT COUNT(uid) FROM {users} WHERE LOWER(name) = '%s'", $edit['name']), 0); if ($taken != 0) { form_set_error('name', t('The name you used belongs to a registered user.')); @@ -494,7 +497,7 @@ // Attach the user and time information. $comment->uid = $user->uid; $comment->timestamp = time(); - $comment->name = $user->name ? $user->name : $comment->name; + $comment->name = check_plain($user->name ? $user->name : $comment->name); // Preview the comment. $output .= theme('comment_view', $comment, theme('links', module_invoke_all('link', 'comment', $comment, 1))); @@ -523,7 +526,7 @@ // validated/filtered data to perform such check. $duplicate = db_result(db_query("SELECT COUNT(cid) FROM {comments} WHERE pid = %d AND nid = %d AND subject = '%s' AND comment = '%s'", $edit['pid'], $edit['nid'], $edit['subject'], $edit['comment']), 0); if ($duplicate != 0) { - watchdog('content', t('Comment: duplicate %subject.', array('%subject' => ''. $edit['subject'] .'')), WATCHDOG_WARNING); + watchdog('content', t('Comment: duplicate %subject.', array('%subject' => ''. check_plain($edit['subject']) .'')), WATCHDOG_WARNING); } if ($edit['cid']) { @@ -538,7 +541,7 @@ module_invoke_all('comment', 'update', $edit); // Add an entry to the watchdog log. - watchdog('content', t('Comment: updated %subject.', array('%subject' => ''. $edit['subject'] .'')), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid'])); + watchdog('content', t('Comment: updated %subject.', array('%subject' => ''. check_plain($edit['subject']) .'')), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid'])); } else { // Add the comment to database. @@ -641,7 +644,7 @@ module_invoke_all('comment', 'insert', $edit); // Add an entry to the watchdog log. - watchdog('content', t('Comment: added %subject.', array('%subject' => ''. $edit['subject'] .'')), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid'])); + watchdog('content', t('Comment: added %subject.', array('%subject' => ''. check_plain($edit['subject']) .'')), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid'])); } // Clear the cache so an anonymous user can see his comment being added. @@ -662,7 +665,7 @@ } } else { - watchdog('content', t('Comment: unauthorized comment submitted or comment submitted to a closed node %subject.', array('%subject' => ''. $edit['subject'] .'')), WATCHDOG_WARNING); + watchdog('content', t('Comment: unauthorized comment submitted or comment submitted to a closed node (%subject).', array('%subject' => ''. check_plain($edit['subject']) .'')), WATCHDOG_WARNING); } } @@ -974,7 +977,7 @@ } else if ($comment->cid) { $output = theme('confirm', - t('Are you sure you want to delete the comment %title?', array('%title' => ''. $comment->subject .'')), + t('Are you sure you want to delete the comment %title?', array('%title' => ''. check_plain($comment->subject) .'')), 'node/'. $comment->nid, t('Any replies to this comment will be lost. This action cannot be undone.'), t('Delete')); @@ -992,7 +995,7 @@ function comment_save($id, $edit) { db_query("UPDATE {comments} SET subject = '%s', comment = '%s', status = %d, format = '%s', name = '%s', mail = '%s', homepage = '%s' WHERE cid = %d", $edit['subject'], $edit['comment'], $edit['status'], $edit['format'], $edit['name'], $edit['mail'], $edit['homepage'], $id); - watchdog('content', t('Comment: modified %subject.', array('%subject' => ''. $edit['subject'] .''))); + watchdog('content', t('Comment: modified %subject.', array('%subject' => ''. check_plain($edit['subject']) .''))); drupal_set_message(t('The comment has been saved.')); _comment_update_node_statistics($edit['nid']); @@ -1023,7 +1026,7 @@ while ($comment = db_fetch_object($result)) { $comment->name = $comment->uid ? $comment->registered_name : $comment->name; $rows[] = array( - l($comment->subject, "node/$comment->nid", array('title' => htmlspecialchars(truncate_utf8($comment->comment, 128))), NULL, "comment-$comment->cid") ." ". theme('mark', node_mark($comment->nid, $comment->timestamp)), + l($comment->subject, "node/$comment->nid", array('title' => truncate_utf8($comment->comment, 128)), NULL, "comment-$comment->cid") ." ". theme('mark', node_mark($comment->nid, $comment->timestamp)), format_name($comment), ($comment->status == 0 ? t('Published') : t('Not published')), format_date($comment->timestamp, 'small'), @@ -1624,7 +1627,7 @@ function _comment_delete_thread($comment) { // Delete the comment: db_query('DELETE FROM {comments} WHERE cid = %d', $comment->cid); - watchdog('content', t('Comment: deleted %subject.', array('%subject' => "$comment->subject"))); + watchdog('content', t('Comment: deleted %subject.', array('%subject' => ''. check_plain($comment->subject) .''))); module_invoke_all('comment', 'delete', $comment); Index: modules/contact.module =================================================================== RCS file: /cvs/drupal/drupal/modules/contact.module,v retrieving revision 1.5 diff -u -r1.5 contact.module --- modules/contact.module 22 Feb 2005 06:16:40 -0000 1.5 +++ modules/contact.module 9 Mar 2005 02:20:54 -0000 @@ -88,7 +88,7 @@ // Tidy up the body: foreach ($message as $key => $value) { - $message[$key] = wordwrap(strip_tags($value)); + $message[$key] = wordwrap(check_plain($value)); } // Prepare all fields: Index: modules/drupal.module =================================================================== RCS file: /cvs/drupal/drupal/modules/drupal.module,v retrieving revision 1.99 diff -u -r1.99 drupal.module --- modules/drupal.module 18 Mar 2005 07:07:04 -0000 1.99 +++ modules/drupal.module 29 Mar 2005 19:16:14 -0000 @@ -95,7 +95,7 @@ db_query("DELETE FROM {directory} WHERE link = '%s' OR mail = '%s'", $link, $mail); db_query("INSERT INTO {directory} (link, name, mail, slogan, mission, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $link, $name, $mail, $slogan, $mission, time()); - watchdog('directory ping', t('Ping from %name (%link).', array('%name' => "$name", '%link' => "$link")), WATCHDOG_NOTICE, "view"); + watchdog('directory ping', t('Ping from %name (%link).', array('%name' => ''. check_plain($name) .'', '%link' => ''. check_url($link) .'')), WATCHDOG_NOTICE, "view"); return new xmlrpcresp(new xmlrpcval(1, 'int')); } @@ -143,7 +143,7 @@ $result = $client->send($message, 5); if (!$result || $result->faultCode()) { - watchdog('directory ping', t('Failed to notify %url at %path: %error.', array('%url' => ''. $url["host"] .'', '%path' => ''. $url["path"] .'', '%error' => ''. $result->faultString() .'')), WATCHDOG_WARNING); + watchdog('directory ping', t('Failed to notify %url at %path: %error.', array('%url' => ''. check_plain($url['host']) .'', '%path' => ''. check_plain($url['path']) .'', '%error' => ''. check_plain($result->faultString()) .'')), WATCHDOG_WARNING); } } Index: modules/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter.module,v retrieving revision 1.55 diff -u -r1.55 filter.module --- modules/filter.module 18 Mar 2005 20:28:22 -0000 1.55 +++ modules/filter.module 27 Mar 2005 13:52:02 -0000 @@ -60,9 +60,9 @@ if ($allowed_html = variable_get("allowed_html_$format", '
'. l('«', 'archive/'. date('Y/m/d', $prev), array('title' => t('Previous month'))) .' '. format_date($requested, 'custom', 'F') . date(' Y', $requested) .' '. ($nextmonth <= time() ? l('»', 'archive/'. date('Y/m/d', $next), array('title' => t('Next month'))) : ' ') ."'. l('«', 'archive/'. date('Y/m/d', $prev), array('title' => t('Previous month'))) .' '. format_date($requested, 'custom', 'F') . date(' Y', $requested) .' '. ($nextmonth <= time() ? l('»', 'archive/'. date('Y/m/d', $next), array('title' => t('Next month'))) : ' ') ."