Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
a794dd44
Commit
a794dd44
authored
Feb 27, 2005
by
Steven Wittens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-
#17877
: Auto-fill comment subject during _validate rather than _save.
parent
538a3071
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
42 deletions
+26
-42
modules/comment.module
modules/comment.module
+13
-21
modules/comment/comment.module
modules/comment/comment.module
+13
-21
No files found.
modules/comment.module
View file @
a794dd44
...
...
@@ -371,14 +371,14 @@ function comment_reply($nid, $pid = NULL) {
// are we posting or previewing a reply?
if
(
$_POST
[
'op'
]
==
t
(
'Post comment'
))
{
$edit
=
$_POST
[
'edit'
];
comment_validate_form
(
$edit
);
$edit
=
comment_validate_form
(
$edit
);
drupal_set_title
(
t
(
'Post comment'
));
print
theme
(
'page'
,
comment_post
(
$edit
));
return
;
}
else
if
(
$_POST
[
'op'
]
==
t
(
'Preview comment'
))
{
$edit
=
$_POST
[
'edit'
];
comment_validate_form
(
$edit
);
$edit
=
comment_validate_form
(
$edit
);
drupal_set_title
(
t
(
'Preview comment'
));
print
theme
(
'page'
,
comment_preview
(
$edit
));
return
;
...
...
@@ -422,25 +422,24 @@ function comment_reply($nid, $pid = NULL) {
function
comment_validate_form
(
$edit
)
{
global
$user
;
/*
** Validate the comment's body.
*/
// 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
);
}
// Validate the comment's body.
if
(
$edit
[
'comment'
]
==
''
)
{
form_set_error
(
'comment'
,
t
(
'The body of your comment is empty.'
));
}
/*
** Validate filter format
*/
// Validate filter format
if
(
array_key_exists
(
'format'
,
$edit
)
&&
!
filter_access
(
$edit
[
'format'
]))
{
form_set_error
(
'format'
,
t
(
'The supplied input format is invalid.'
));
}
/*
** Check validity of name, mail and homepage (if given)
*/
// Check validity of name, mail and homepage (if given)
if
(
!
$user
->
uid
)
{
if
(
variable_get
(
'comment_anonymous'
,
0
)
>
0
)
{
if
(
$edit
[
'name'
])
{
...
...
@@ -471,6 +470,8 @@ function comment_validate_form($edit) {
}
}
}
return
$edit
;
}
function
comment_preview
(
$edit
)
{
...
...
@@ -510,14 +511,6 @@ function comment_post($edit) {
global
$user
;
if
(
user_access
(
'post comments'
)
&&
node_comment_mode
(
$edit
[
'nid'
])
==
2
)
{
// 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
(
!
form_get_errors
())
{
// Check for duplicate comments. Note that we have to use the
// validated/filtered data to perform such check.
...
...
@@ -913,7 +906,6 @@ function comment_render($node, $cid = 0) {
* Menu callback; edit a comment from the administrative interface.
*/
function
comment_admin_edit
(
$cid
)
{
// Comment edits need to be saved.
if
(
$_POST
[
'op'
]
==
t
(
'Submit'
))
{
$edit
=
$_POST
[
'edit'
];
...
...
modules/comment/comment.module
View file @
a794dd44
...
...
@@ -371,14 +371,14 @@ function comment_reply($nid, $pid = NULL) {
// are we posting or previewing a reply?
if
(
$_POST
[
'op'
]
==
t
(
'Post comment'
))
{
$edit
=
$_POST
[
'edit'
];
comment_validate_form
(
$edit
);
$edit
=
comment_validate_form
(
$edit
);
drupal_set_title
(
t
(
'Post comment'
));
print
theme
(
'page'
,
comment_post
(
$edit
));
return
;
}
else
if
(
$_POST
[
'op'
]
==
t
(
'Preview comment'
))
{
$edit
=
$_POST
[
'edit'
];
comment_validate_form
(
$edit
);
$edit
=
comment_validate_form
(
$edit
);
drupal_set_title
(
t
(
'Preview comment'
));
print
theme
(
'page'
,
comment_preview
(
$edit
));
return
;
...
...
@@ -422,25 +422,24 @@ function comment_reply($nid, $pid = NULL) {
function
comment_validate_form
(
$edit
)
{
global
$user
;
/*
** Validate the comment's body.
*/
// 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
);
}
// Validate the comment's body.
if
(
$edit
[
'comment'
]
==
''
)
{
form_set_error
(
'comment'
,
t
(
'The body of your comment is empty.'
));
}
/*
** Validate filter format
*/
// Validate filter format
if
(
array_key_exists
(
'format'
,
$edit
)
&&
!
filter_access
(
$edit
[
'format'
]))
{
form_set_error
(
'format'
,
t
(
'The supplied input format is invalid.'
));
}
/*
** Check validity of name, mail and homepage (if given)
*/
// Check validity of name, mail and homepage (if given)
if
(
!
$user
->
uid
)
{
if
(
variable_get
(
'comment_anonymous'
,
0
)
>
0
)
{
if
(
$edit
[
'name'
])
{
...
...
@@ -471,6 +470,8 @@ function comment_validate_form($edit) {
}
}
}
return
$edit
;
}
function
comment_preview
(
$edit
)
{
...
...
@@ -510,14 +511,6 @@ function comment_post($edit) {
global
$user
;
if
(
user_access
(
'post comments'
)
&&
node_comment_mode
(
$edit
[
'nid'
])
==
2
)
{
// 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
(
!
form_get_errors
())
{
// Check for duplicate comments. Note that we have to use the
// validated/filtered data to perform such check.
...
...
@@ -913,7 +906,6 @@ function comment_render($node, $cid = 0) {
* Menu callback; edit a comment from the administrative interface.
*/
function
comment_admin_edit
(
$cid
)
{
// Comment edits need to be saved.
if
(
$_POST
[
'op'
]
==
t
(
'Submit'
))
{
$edit
=
$_POST
[
'edit'
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment