diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-01-31 15:49:26 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-01-31 15:49:26 +0000 |
commit | 05a708fb06137758cf7a15a623b4813af2fc005f (patch) | |
tree | 6ae6f50edbcb601329805cbbd7c22d11340327e3 /modules/comment/comment.module | |
parent | 4c9fc80fc48608982a731b03655b02e5ccdb6b17 (diff) | |
download | brdo-05a708fb06137758cf7a15a623b4813af2fc005f.tar.gz brdo-05a708fb06137758cf7a15a623b4813af2fc005f.tar.bz2 |
- Patch #112715 by chx, webchick, asimmonds, et al: fixing E_ALL notices. Thanks.
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r-- | modules/comment/comment.module | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 8e7a2e937..f92467c4a 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -791,6 +791,7 @@ function comment_save($edit) { $edit['name'] = $user->name; } + $edit += array('mail' => '', 'homepage' => ''); db_query("INSERT INTO {comments} (cid, nid, pid, uid, subject, comment, format, hostname, timestamp, status, score, users, thread, name, mail, homepage) VALUES (%d, %d, %d, %d, '%s', '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s')", $edit['cid'], $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], $_SERVER['REMOTE_ADDR'], $edit['timestamp'], $status, $score, $users, $thread, $edit['name'], $edit['mail'], $edit['homepage']); _comment_update_node_statistics($edit['nid']); @@ -1150,7 +1151,7 @@ function comment_operations($action = NULL) { function comment_admin($type = 'new') { $edit = $_POST; - if ($edit['operation'] == 'delete' && $edit['comments']) { + if (isset($edit['operation']) && ($edit['operation'] == 'delete') && $edit['comments']) { return drupal_get_form('comment_multiple_delete_confirm'); } else { @@ -1192,7 +1193,7 @@ function comment_admin_overview($type = 'new', $arg) { $form['timestamp'][$comment->cid] = array('#value' => format_date($comment->timestamp, 'small')); $form['operations'][$comment->cid] = array('#value' => l(t('edit'), 'comment/edit/'. $comment->cid, array(), $destination)); } - $form['comments'] = array('#type' => 'checkboxes', '#options' => $comments); + $form['comments'] = array('#type' => 'checkboxes', '#options' => isset($comments) ? $comments: array()); $form['pager'] = array('#value' => theme('pager', NULL, 50, 0)); return $form; } @@ -1431,7 +1432,7 @@ function comment_form($edit, $title = NULL) { $op = isset($_POST['op']) ? $_POST['op'] : ''; if ($user->uid) { - if ($edit['cid'] && user_access('administer comments')) { + if (!empty($edit['cid']) && user_access('administer comments')) { if ($edit['author']) { $author = $edit['author']; } @@ -1537,19 +1538,19 @@ function comment_form($edit, $title = NULL) { } if (variable_get('comment_subject_field', 1) == 1) { - $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#maxlength' => 64, '#default_value' => $edit['subject']); + $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#maxlength' => 64, '#default_value' => !empty($edit['subject']) ? $edit['subject'] : ''); } - $form['comment_filter']['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#rows' => 15, '#default_value' => $edit['comment'] ? $edit['comment'] : $user->signature, '#required' => TRUE); + $form['comment_filter']['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#rows' => 15, '#default_value' => !empty($edit['comment']) ? $edit['comment'] : $user->signature, '#required' => TRUE); if (!isset($edit['format'])) { $edit['format'] = FILTER_FORMAT_DEFAULT; } $form['comment_filter']['format'] = filter_form($edit['format']); - $form['cid'] = array('#type' => 'value', '#value' => $edit['cid']); + $form['cid'] = array('#type' => 'value', '#value' => !empty($edit['cid']) ? $edit['cid'] : NULL); $form['pid'] = array('#type' => 'value', '#value' => $edit['pid']); $form['nid'] = array('#type' => 'value', '#value' => $edit['nid']); - $form['uid'] = array('#type' => 'value', '#value' => $edit['uid']); + $form['uid'] = array('#type' => 'value', '#value' => !empty($edit['uid']) ? $edit['uid'] : NULL); $form['preview'] = array('#type' => 'button', '#value' => t('Preview comment'), '#weight' => 19); $form['#token'] = 'comment'. $edit['nid'] . $edit['pid']; @@ -1565,7 +1566,7 @@ function comment_form($edit, $title = NULL) { $form['#after_build'] = array('comment_form_add_preview'); } - if ($_REQUEST['destination']) { + if (!empty($_REQUEST['destination'])) { $form['#attributes']['destination'] = $_REQUEST['destination']; } @@ -1603,7 +1604,7 @@ function comment_form_add_preview($form, $edit) { $comment->uid = $account->uid; $comment->name = check_plain($account->name); } - $comment->timestamp = $edit['timestamp'] ? $edit['timestamp'] : time(); + $comment->timestamp = !empty($edit['timestamp']) ? $edit['timestamp'] : time(); // Preview the comment with security check. if (!form_get_errors()) { |