? commentmail-6.x-188698-2.patch ? commentmail-6.x-188698-4.patch Index: README.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/commentmail/README.txt,v retrieving revision 1.3 diff -u -p -r1.3 README.txt --- README.txt 10 Feb 2007 17:27:31 -0000 1.3 +++ README.txt 18 Feb 2008 00:08:45 -0000 @@ -10,4 +10,4 @@ administrator(s) when new comments are p email allows quick approval, editing, deletion, and/or banning of the poster's IP address (good for spam). -Module currently works with Drupal 5. \ No newline at end of file +Module currently works with Drupal 6. \ No newline at end of file Index: commentmail.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/commentmail/commentmail.info,v retrieving revision 1.1 diff -u -p -r1.1 commentmail.info --- commentmail.info 10 Feb 2007 17:27:31 -0000 1.1 +++ commentmail.info 18 Feb 2008 00:08:45 -0000 @@ -1,3 +1,4 @@ ; $Id: commentmail.info,v 1.1 2007/02/10 17:27:31 timcn Exp $ name = Comment Mail description = Sends an email message when comments are posted to the site. +core = 6.x \ No newline at end of file Index: commentmail.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/commentmail/commentmail.module,v retrieving revision 1.12 diff -u -p -r1.12 commentmail.module --- commentmail.module 18 Mar 2007 12:45:53 -0000 1.12 +++ commentmail.module 18 Feb 2008 00:08:45 -0000 @@ -43,39 +43,28 @@ Comment administration: @admin_url"); /** * Implementation of hook_menu() */ -function commentmail_menu($may_cache) { - $items = array(); - - if ($may_cache) { - $access = user_access('administer comments'); - - $items[] = array( - 'title' => t('Comment mail'), - 'path' => 'admin/settings/commentmail', - 'description' => t('Settings for the comment mail module.'), - 'access' => $access, - 'callback' => 'drupal_get_form', - 'callback arguments' => array('commentmail_admin_settings'), - ); - - $items[] = array( - 'title' => t('Approve comment'), - 'path' => 'comment/approve', - 'access' => $access, - 'callback' => 'drupal_get_form', - 'callback arguments' => array('commentmail_approve'), - 'type' => MENU_CALLBACK, - ); - - $items[] = array( - 'title' => t('Delete comment and ban user'), - 'path' => 'comment/deleteban', - 'access' => $access, - 'callback' => 'drupal_get_form', - 'callback arguments' => array('commentmail_deleteban'), - 'type' => MENU_CALLBACK, - ); - } +function commentmail_menu() { + $items['admin/settings/commentmail'] = array( + 'title' => t('Comment mail'), + 'description' => t('Settings for the comment mail module.'), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('commentmail_admin_settings'), + 'access arguments' => array('administer comments'), + ); + $items['comment/approve'] = array( + 'title' => t('Approve comment'), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('commentmail_approve'), + 'access arguments' => array('administer comments'), + 'type' => MENU_CALLBACK, + ); + $items['comment/deleteban'] = array( + 'title' => t('Delete comment and ban user'), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('commentmail_deleteban'), + 'access arguments' => array('administer comments'), + 'type' => MENU_CALLBACK, + ); return $items; } @@ -213,13 +202,13 @@ function commentmail_comment($comment, $ $body = strtr($text, array( '@site' => variable_get('site_name', 'Drupal'), '@node' => $node->title, - '@approval_url' => url('comment/approve/'. $comment_obj->cid, NULL, NULL, TRUE), - '@delete_url' => url('comment/delete/'. $comment_obj->cid, NULL, NULL, TRUE), - '@ban_url' => url('comment/deleteban/'. $comment_obj->cid, NULL, NULL, TRUE), - '@edit_url' => url('comment/edit/'. $comment_obj->cid, NULL, NULL, TRUE), - '@queue_url' => url('admin/comment/list/approval', NULL, NULL, TRUE), - '@view_url' => url('node/'. $node->nid, NULL, 'comment-'. $comment_obj->cid, TRUE), - '@admin_url' => url('admin/content/comment', NULL, NULL, TRUE), + '@approval_url' => url('comment/approve/'. $comment_obj->cid, array('absolute' => TRUE)), + '@delete_url' => url('comment/delete/'. $comment_obj->cid, array('absolute' => TRUE)), + '@ban_url' => url('comment/deleteban/'. $comment_obj->cid, array('absolute' => TRUE)), + '@edit_url' => url('comment/edit/'. $comment_obj->cid, array('absolute' => TRUE)), + '@queue_url' => url('admin/comment/list/approval', array('absolute' => TRUE)), + '@view_url' => url('node/'. $node->nid, array('fragment' => 'comment-'. $comment_obj->cid, 'absolute' => TRUE)), + '@admin_url' => url('admin/content/comment', array('absolute' => TRUE)), '@host' => $comment_obj->hostname, '@user' => $comment_obj->name, '@mail' => $comment_obj->mail, @@ -236,7 +225,7 @@ function commentmail_comment($comment, $ ); } else { - watchdog('commentmail', t('Site mail address is not configured.'), WATCHDOG_ERROR); + watchdog('commentmail', 'Site mail address is not configured.', array(), WATCHDOG_ERROR); } } } @@ -266,8 +255,8 @@ function commentmail_approve($cid) { } } -function commentmail_approve_submit($form_id, $form_values) { - $comment = _comment_load($form_values['cid']); +function commentmail_approve_submit($form, &$form_state) { + $comment = _comment_load($form_state['values']['cid']); $comment->status = 0; if (comment_save((array)$comment)) { @@ -299,8 +288,8 @@ function commentmail_deleteban($cid) { } -function commentmail_deleteban_submit($form_id, $form_values) { - $comment = _comment_load($form_values['cid']); +function commentmail_deleteban_submit($form, &$form_state) { + $comment = _comment_load($form_state['values']['cid']); // Delete comment and its replies. _comment_delete_thread($comment); @@ -312,7 +301,7 @@ function commentmail_deleteban_submit($f cache_clear_all(); // Now, ban the user - $aid = db_next_id('{access}_aid'); + $aid = db_last_insert_id('access_aid', 'aid'); db_query("INSERT INTO {access} (aid, mask, type, status) VALUES ('%s', '%s', 'host', 0)", $aid, $comment->hostname); drupal_set_message(t('The host %host has been banned.', array('%host' => $comment->hostname)));