? molstats ? patches ? temp-status-export.txt Index: mollom.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/mollom/mollom.module,v retrieving revision 1.2.2.95 diff -u -p -r1.2.2.95 mollom.module --- mollom.module 15 Sep 2009 08:01:20 -0000 1.2.2.95 +++ mollom.module 13 Oct 2009 19:56:40 -0000 @@ -68,28 +68,28 @@ function mollom_link($type, $object, $te * Implementation of hook_menu(). */ function mollom_menu() { - $items['mollom/comment'] = array( + $items['mollom/comment/%'] = array( 'title' => 'Report and delete', 'page callback' => 'drupal_get_form', - 'page arguments' => array('mollom_report_comment'), + 'page arguments' => array('mollom_report_comment', 2), 'access callback' => '_mollom_access', 'access arguments' => array('administer comments'), 'file' => 'mollom.pages.inc', 'type' => MENU_CALLBACK, ); - $items['mollom/node'] = array( + $items['mollom/node/%node'] = array( 'title' => 'Report and delete', 'page callback' => 'drupal_get_form', - 'page arguments' => array('mollom_report_node'), + 'page arguments' => array('mollom_report_node', 2), 'access callback' => '_mollom_access', 'access arguments' => array('administer nodes'), 'file' => 'mollom.pages.inc', 'type' => MENU_CALLBACK, ); - $items['mollom/contact'] = array( + $items['mollom/contact/%'] = array( 'title' => 'Report', 'page callback' => 'drupal_get_form', - 'page arguments' => array('mollom_report_contact'), + 'page arguments' => array('mollom_report_contact', 2), 'access callback' => '_mollom_access', 'file' => 'mollom.pages.inc', 'type' => MENU_CALLBACK, Index: mollom.pages.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/mollom/Attic/mollom.pages.inc,v retrieving revision 1.1.2.1 diff -u -p -r1.1.2.1 mollom.pages.inc --- mollom.pages.inc 30 Jul 2009 20:28:49 -0000 1.1.2.1 +++ mollom.pages.inc 13 Oct 2009 19:56:40 -0000 @@ -56,16 +56,21 @@ function _mollom_feedback_options() { * This function reports a comment as feedback and deletes it. */ function mollom_report_comment($form_state, $cid) { - if ($comment = _comment_load($cid)) { - $form['cid'] = array('#type' => 'value', '#value' => $cid); - $form['feedback'] = _mollom_feedback_options(); - - return confirm_form($form, - t('Are you sure you want to delete the comment and report it?'), - isset($_GET['destination']) ? $_GET['destination'] : 'node/'. $comment->nid, - t('This action cannot be undone.'), - t('Delete'), t('Cancel')); + $comment = _comment_load($cid); + if (!$comment) { + return drupal_access_denied(); } + + $form['cid'] = array('#type' => 'value', '#value' => $cid); + $form['feedback'] = _mollom_feedback_options(); + + return confirm_form($form, + t('Are you sure you want to delete the comment and report it?'), + isset($_GET['destination']) ? $_GET['destination'] : 'node/'. $comment->nid, + t('This action cannot be undone.'), + t('Delete'), + t('Cancel') + ); } /** @@ -97,17 +102,16 @@ function mollom_report_comment_submit($f /** * This function deletes a node and optionally sends feedback to Mollom. */ -function mollom_report_node($form_state, $nid) { - if ($node = node_load($nid)) { - $form['nid'] = array('#type' => 'value', '#value' => $node->nid); - $form['feedback'] = _mollom_feedback_options(); - - return confirm_form($form, - t('Are you sure you want to delete %title and report it?', array('%title' => $node->title)), - isset($_GET['destination']) ? $_GET['destination'] : 'node/'. $node->nid, - t('This action cannot be undone.'), - t('Delete'), t('Cancel')); - } +function mollom_report_node($form_state, $node) { + $form['nid'] = array('#type' => 'value', '#value' => $node->nid); + $form['feedback'] = _mollom_feedback_options(); + + return confirm_form($form, + t('Are you sure you want to delete %title and report it?', array('%title' => $node->title)), + isset($_GET['destination']) ? $_GET['destination'] : 'node/'. $node->nid, + t('This action cannot be undone.'), + t('Delete'), t('Cancel') + ); } /** @@ -132,3 +136,31 @@ function mollom_report_node_submit($form $form_state['redirect'] = ''; } + +/** + * This function reports a contact form message as inappropriate. + */ +function mollom_report_contact($form_state, $session) { + $form['session'] = array('#type' => 'value', '#value' => $session); + $form['feedback'] = _mollom_feedback_options(); + + return confirm_form($form, + t('Are you sure you want to report the e-mail message as inappropriate?'), + isset($_GET['destination']) ? $_GET['destination'] : '', + t('This action cannot be undone.'), + t('Report as inappropriate'), + t('Cancel') + ); +} + +/** + * This function reports a contact form message as inappropriate. + */ +function mollom_report_contact_submit($form, &$form_state) { + if ($form_state['values']['feedback']) { + mollom('mollom.sendFeedback', array('session_id' => $form_state['values']['session'], 'feedback' => $form_state['values']['feedback'])); + drupal_set_message(t('The e-mail has been reported as inappropriate.')); + } + + $form_state['redirect'] = ''; +}