summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-11-24 09:08:04 +0000
committerDries Buytaert <dries@buytaert.net>2006-11-24 09:08:04 +0000
commit594101be3840d8e76db8c4bfbd359741cc1c6eb4 (patch)
tree8c86e6dcdf256017435dc668745ed829d99604de
parentd721a4f0d974f93d04db19c8d1c107b9d24dd3f5 (diff)
downloadbrdo-594101be3840d8e76db8c4bfbd359741cc1c6eb4.tar.gz
brdo-594101be3840d8e76db8c4bfbd359741cc1c6eb4.tar.bz2
- Patch #99180 by webchick and chx: validate type the content type names.
-rw-r--r--modules/node/content_types.inc6
1 files changed, 3 insertions, 3 deletions
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 <em>create content</em> page for this content type. It is recommended that this name consists only of lowercase letters, numbers, and <strong>underscores</strong>. Dashes are not allowed. Underscores will be converted into dashes when constructing the URL of the <em>create content</em> 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 <em>create content</em> 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 <em>create content</em> 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.'));
}
}