form_set_error('mail',t('You have to leave an e-mail address.'));
}
if($edit['homepage']){
if(!valid_url($edit['homepage'],TRUE)){
form_set_error('homepage',t('The URL of your homepage is not valid. Remember that it must be fully qualified, i.e. of the form <code>http://example.com/directory</code>.'));
}
}
}
}
return$edit;
}
/**
* Accepts a submission of new or changed comment content.
*
...
...
@@ -632,7 +538,7 @@ function comment_save($edit) {
if($edit['cid']){
// Update the comment in the database.
db_query("UPDATE {comments} SET status = '%s', timestamp = %d, subject = '%s', comment = '%s', format = '%s', uid = %d, name = '%s' WHERE cid = %d",$edit['status'],$edit['timestamp'],$edit['subject'],$edit['comment'],$edit['format'],$edit['uid'],$edit['name'],$edit['cid']);
db_query("UPDATE {comments} SET status = '%s', timestamp = %d, subject = '%s', comment = '%s', format = '%s', uid = %d, name = '%s', mail = '%s', homepage = '%s' WHERE cid = %d",$edit['status'],$edit['timestamp'],$edit['subject'],$edit['comment'],$edit['format'],$edit['uid'],$edit['name'],$edit['mail'],$edit['homepage'],$edit['cid']);
_comment_update_node_statistics($edit['nid']);
...
...
@@ -1251,6 +1157,61 @@ function comment_num_new($nid, $timestamp = 0) {
}
functioncomment_validate($edit){
global$user;
// Invoke other validation handlers
comment_invoke_comment($edit,'validate');
$check_date=strtotime($date);
// As of PHP 5.1.0, strtotime returns FALSE upon failure instead of -1.
if($check_date===FALSE||$check_date===-1){
form_set_error('date',t('You have to specify a valid date.'));
form_set_error('mail',t('You have to leave an e-mail address.'));
}
if($edit['homepage']){
if(!valid_url($edit['homepage'],TRUE)){
form_set_error('homepage',t('The URL of your homepage is not valid. Remember that it must be fully qualified, i.e. of the form <code>http://example.com/directory</code>.'));
}
}
}
}
return$edit;
}
/*
** Generate the basic commenting form, for appending to a node or display on a separate page.
** This is rendered by theme_comment_form.
...
...
@@ -1287,9 +1248,57 @@ function comment_form($edit, $title = NULL) {
form_set_error('mail',t('You have to leave an e-mail address.'));
}
if($edit['homepage']){
if(!valid_url($edit['homepage'],TRUE)){
form_set_error('homepage',t('The URL of your homepage is not valid. Remember that it must be fully qualified, i.e. of the form <code>http://example.com/directory</code>.'));
}
}
}
}
return$edit;
}
/**
* Accepts a submission of new or changed comment content.
*
...
...
@@ -632,7 +538,7 @@ function comment_save($edit) {
if($edit['cid']){
// Update the comment in the database.
db_query("UPDATE {comments} SET status = '%s', timestamp = %d, subject = '%s', comment = '%s', format = '%s', uid = %d, name = '%s' WHERE cid = %d",$edit['status'],$edit['timestamp'],$edit['subject'],$edit['comment'],$edit['format'],$edit['uid'],$edit['name'],$edit['cid']);
db_query("UPDATE {comments} SET status = '%s', timestamp = %d, subject = '%s', comment = '%s', format = '%s', uid = %d, name = '%s', mail = '%s', homepage = '%s' WHERE cid = %d",$edit['status'],$edit['timestamp'],$edit['subject'],$edit['comment'],$edit['format'],$edit['uid'],$edit['name'],$edit['mail'],$edit['homepage'],$edit['cid']);
_comment_update_node_statistics($edit['nid']);
...
...
@@ -1251,6 +1157,61 @@ function comment_num_new($nid, $timestamp = 0) {
}
functioncomment_validate($edit){
global$user;
// Invoke other validation handlers
comment_invoke_comment($edit,'validate');
$check_date=strtotime($date);
// As of PHP 5.1.0, strtotime returns FALSE upon failure instead of -1.
if($check_date===FALSE||$check_date===-1){
form_set_error('date',t('You have to specify a valid date.'));
form_set_error('mail',t('You have to leave an e-mail address.'));
}
if($edit['homepage']){
if(!valid_url($edit['homepage'],TRUE)){
form_set_error('homepage',t('The URL of your homepage is not valid. Remember that it must be fully qualified, i.e. of the form <code>http://example.com/directory</code>.'));
}
}
}
}
return$edit;
}
/*
** Generate the basic commenting form, for appending to a node or display on a separate page.
** This is rendered by theme_comment_form.
...
...
@@ -1287,9 +1248,57 @@ function comment_form($edit, $title = NULL) {