From 594101be3840d8e76db8c4bfbd359741cc1c6eb4 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 24 Nov 2006 09:08:04 +0000 Subject: - Patch #99180 by webchick and chx: validate type the content type names. --- modules/node/content_types.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc index c298ed2fe..251a49066 100644 --- a/modules/node/content_types.inc +++ b/modules/node/content_types.inc @@ -86,7 +86,7 @@ function node_type_form($type = NULL) { '#default_value' => $type->type, '#maxlength' => 32, '#required' => TRUE, - '#description' => t('The machine-readable name of this content type. This text will be used for constructing the URL of the create content page for this content type. It is recommended that this name consists only of lowercase letters, numbers, and underscores. Dashes are not allowed. Underscores will be converted into dashes when constructing the URL of the create content page. The name must be unique to this content type.'), + '#description' => t('The machine-readable name of this content type. This text will be used for constructing the URL of the create content page for this content type. This name may consist of only of lowercase letters, numbers, and underscores. Dashes are not allowed. Underscores will be converted into dashes when constructing the URL of the create content page. The name must be unique to this content type.'), ); } else { @@ -231,8 +231,8 @@ function node_type_form_validate($form_id, $form_values) { if (isset($types[$type->type]) && $type->type != $old_type) { form_set_error('type', t('The machine-readable name %type is already taken.', array('%type' => $type->type))); } - if (strpos($type->type, '-') !== FALSE) { - form_set_error('type', t('The machine-readable name cannot contain dashes.', array('%type' => $type->type))); + if (!preg_match('!a-z0-9_!', $type->type)) { + form_set_error('type', t('The machine-readable name can only consist of lowercase letters, underscores, and numbers.')); } } -- cgit v1.2.3