Index: sites/all/modules/contrib/comment_notify/comment_notify.module
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+><?php\n\n/**\n * @file\n *\n * This module provides comment follow-up e-mail notification for anonymous and registered users.\n */\n\ndefine('COMMENT_NOTIFY_DISABLED', 0);\ndefine('COMMENT_NOTIFY_NODE', 1);\ndefine('COMMENT_NOTIFY_COMMENT', 2);\n\n\ndefine('AUTHOR_MAILTEXT',\n'Hi [comment:node:author],\n\nYou have received a comment on: \"[comment:node:title]\"\n\n----\n[comment:title]\n[comment:body]\n----\n\nYou can view the comment at the following url\n[comment:url]\n\nYou will receive emails like this for all replies to your posts. You can\ndisable this by logging in and changing the settings on your user account at\n[comment:node:author:edit-url].\n\n-- [site:name] team\n[site:url]');\n\ndefine('DEFAULT_MAILTEXT',\n'Hi [comment-subscribed:author],\n\n[comment:author] has commented on: \"[comment:node:title]\"\n\n----\n[comment:title]\n[comment:body]\n----\n\nYou can view the comment at the following url\n[comment:url]\n\nYou can stop receiving emails when someone replies to this post,\nby going to [comment-subscribed:unsubscribe-url]\n\nYou can set up auto-following feature for all future posts\nby creating your own user with a few clicks here [site:login-url]\n\n-- [site:name] team\n[site:url]');\n\n\n/**\n * Implements hook_init().\n */\nfunction comment_notify_init() {\n  // Add on every page - they are both very small so it's better to add\n  // everywhere than force a second file on some pages.\n  $options = array('every_page' => TRUE);\n  $path = drupal_get_path('module', 'comment_notify');\n  drupal_add_css($path . '/comment_notify.css', $options);\n\n  // We only add the JS if more than one subscription mode is enabled.\n  $available_options = _comment_notify_options();\n  if (count($available_options) > 1) {\n    drupal_add_js($path . '/comment_notify.js', $options);\n  }\n}\n\n/**\n * Provide an array of available options for notification on a comment.\n */\nfunction _comment_notify_options() {\n  $total_options = array(\n    COMMENT_NOTIFY_NODE     => t('All comments'),\n    COMMENT_NOTIFY_COMMENT  => t('Replies to my comment')\n  );\n\n  $available_options = array();\n  $options = variable_get('comment_notify_available_alerts', drupal_map_assoc(array(COMMENT_NOTIFY_NODE, COMMENT_NOTIFY_COMMENT)));\n  foreach ($options as $key => $available) {\n    if ($key == $available) {\n      $available_options[$available] = $total_options[$available];\n    }\n  }\n\n  return $available_options;\n}\n\n\nfunction comment_notify_form_comment_form_alter(&$form, &$form_state, $form_id) {\n  global $user;\n  if (!(user_access('subscribe to comments') || user_access('administer comments'))) {\n    return;\n  }\n\n  // Only add the checkbox if this is an enabled content type\n  $node = node_load($form['nid']['#value'] ? $form['nid']['#value'] : $form['nid']['#default_value']);\n  $enabled_types = variable_get('comment_notify_node_types', drupal_map_assoc(array($node->type)));\n  if (empty($enabled_types[$node->type])) {\n    return;\n  }\n\n  $available_options = _comment_notify_options();\n  // Add the checkbox for anonymous users.\n  if ($user->uid == 0) {\n    // If anonymous users can't enter their e-mail don't tempt them with the checkbox.\n    if (empty($form['author']['mail'])) {\n      return;\n    }\n    $form['#validate'][] = 'comment_notify_comment_validate';\n  }\n  module_load_include('inc', 'comment_notify', 'comment_notify');\n  $preference = comment_notify_get_user_comment_notify_preference($user->uid);\n\n  // If you want to hide this on your site see http://drupal.org/node/322482\n  $form['notify_settings'] = array(\n    '#weight' => 19,\n  );\n\n  $form['notify_settings']['notify'] = array(\n    '#type' => 'checkbox',\n    '#title' => t('Notify me when new comments are posted'),\n    '#default_value' => (bool) $preference,\n  );\n\n  $form['notify_settings']['notify_type'] = array(\n    '#type' => 'radios',\n    '#options' => $available_options,\n    '#default_value' => $preference,\n  );\n  if (count($available_options) == 1) {\n    $form['notify_settings']['notify_type']['#type'] = 'hidden';\n    $form['notify_settings']['notify_type']['#value'] = key($available_options);\n  }\n\n  // Otherwise, the submit buttons will jump below the node preview.\n  $form['actions']['#weight'] = 19;\n\n  // If this is an existing comment we set the default value based on their selection last time.\n  if ($form['cid']['#value'] != '') {\n    $notify = comment_notify_get_notification_type($form['cid']['#value']);\n    $form['notify_settings']['notify']['#default_value'] = (bool) $notify;\n    if (count($available_options) > 1) {\n      $form['notify_settings']['notify_type']['#default_value'] = $notify;\n    }\n    else {\n      $form['notify_settings']['notify_type']['#default_value'] = key($available_options);\n    }\n  }\n}\n\n/**\n * Implements hook_permission().\n */\nfunction comment_notify_permission() {\n  return array(\n    'administer comment notify' => array(\n      'title' => 'Administer Comment Notify',\n      'description' => 'Change global comment notification settings.',\n  ),\n    'subscribe to comments' => array(\n      'title' => 'Subscribe to comment notifications',\n      'description' => 'Subscribe to recieve notifications when new comments are posted.',\n  ),\n  );\n}\n\n/**\n * Implements hook_menu().\n */\nfunction comment_notify_menu() {\n\n  $items['admin/config/people/comment_notify'] = array(\n    'title' => 'Comment notify',\n    'description' => 'Configure settings for e-mails about new comments.',\n    'page callback' => 'drupal_get_form',\n    'page arguments' => array('comment_notify_settings'),\n    'access arguments' => array('administer comment notify'),\n    'type' => MENU_NORMAL_ITEM,\n  );\n  $items['admin/config/people/comment_notify/settings'] = array(\n    'title' => 'Settings',\n    'description' => 'Configure settings for e-mails about new comments.',\n    'page callback' => 'drupal_get_form',\n    'page arguments' => array('comment_notify_settings'),\n    'access arguments' => array('administer comment notify'),\n    'type' => MENU_DEFAULT_LOCAL_TASK,\n  );\n\n  $items['admin/config/people/comment_notify/unsubscribe'] = array(\n    'title' => 'Unsubscribe',\n    'description' => 'Unsubscribe an email from all notifications.',\n    'weight' => 2,\n    'page callback' => 'drupal_get_form',\n    'page arguments' => array('comment_notify_unsubscribe'),\n    'access arguments' => array('administer comment notify'),\n    'type' => MENU_LOCAL_TASK,\n  );\n  $items['comment_notify/disable/%'] = array(\n    'title' => 'Disable comment notification',\n    'page callback' => 'comment_notify_disable_page',\n    'page arguments' => array(2),\n    'access arguments' => array('access content'),\n    'type' => MENU_CALLBACK\n  );\n\n  return $items;\n}\n\n/**\n * Page callback to allow users to unsubscribe simply by visiting the page.\n */\nfunction comment_notify_disable_page($hash) {\n  module_load_include('inc', 'comment_notify', 'comment_notify');\n  if (comment_notify_unsubscribe_by_hash($hash)) {\n    drupal_set_message(t('Your comment follow-up notification for this post was disabled. Thanks.'));\n  }\n  else {\n    drupal_set_message(t('Sorry, there was a problem unsubscribing from notifications.'));\n  }\n  return ' ';\n}\n\nfunction comment_notify_comment_validate($comment) {\n  global $user;\n  // We assume that if they are non-anonymous then they have a valid mail.\n  // For anonymous users, though, we verify that they entered a mail and let comment.module validate it is real.\n  if (!$user->uid && $comment['notify_settings']['notify']['#value'] && empty($comment['author']['mail']['#value'])) {\n    form_set_error('mail', t('If you want to subscribe to comments you must supply a valid e-mail address.'));\n  }\n}\n\nfunction comment_notify_comment_publish($comment) {\n  // And send notifications - the real purpose of the module.\n  _comment_notify_mailalert($comment);\n}\n\n/**\n * Implements hook_comment_update().\n */\nfunction comment_notify_comment_update($comment) {\n  module_load_include('inc', 'comment_notify', 'comment_notify');\n\n  // Take the status of the \"notify\" checkbox if they unchecked it.\n  if (empty($comment->notify)) {\n    $status = $comment->notify;\n  }\n  else {\n    $status = $comment->notify_type;\n  }\n  // In case they have changed their status, save it in the database.\n  if (isset($status)) {\n    comment_notify_update_notification($comment->cid, $status);\n  }\n  // And send notifications - the real purpose of the module.\n  if ($comment->status == COMMENT_PUBLISHED) {\n    _comment_notify_mailalert($comment);\n  }\n\n}\n\nfunction comment_notify_comment_insert($comment) {\n  module_load_include('inc', 'comment_notify', 'comment_notify');\n\n  global $user;\n  // For new comments, we first build up a string to be used as the identifier for the alert.\n  // This identifier is used to later unsubscribe the user or allow them to\n  // potentially edit their comment / preferences if they are anonymous.\n  // The string is built with token and their host and comment identifier.\n  // It is stored and referenced, we really just need something unique/unguessable.\n  $hostname = isset($comment->hostname) ? $comment->hostname : (isset($user->hostname) ? $user->hostname : '');\n  $notify_hash = drupal_get_token($hostname . $comment->cid);\n\n  if (!empty($comment->notify)) {\n    $notify = $comment->notify_type;\n    // If they don't have a preference, save one.\n    $current = comment_notify_get_user_comment_notify_preference($user->uid);\n    if ($current == 0 && $user->uid) {\n      comment_notify_set_user_notification_setting($user->uid, NULL, $comment->notify_type);\n    }\n  }\n  else {\n    $notify = 0;\n  }\n  // And then save the data.\n  comment_notify_add_notification($comment->cid, $notify, $notify_hash);\n\n  // And send notifications - the real purpose of the module.\n  if ($comment->status == COMMENT_PUBLISHED) {\n    _comment_notify_mailalert($comment);\n  }\n}\n\nfunction comment_notify_comment_delete($comment) {\n  module_load_include('inc', 'comment_notify', 'comment_notify');\n  comment_notify_remove_all_notifications($comment->cid);\n}\n\n\n/**\n * Implement hook_form_alter().\n */\nfunction comment_notify_form_alter(&$form, &$form_state, $form_id) {\n  module_load_include('inc', 'comment_notify', 'comment_notify');\n\n  if (!($form_id == 'user_register_form' || $form_id == 'user_profile_form')) {\n    return;\n  }\n  elseif ($form['#user_category'] != 'account') {\n    return;\n  }\n\n  $user = $form['#user'];\n  if ($user->comment_notify_settings) {\n    $node_notify = $user->comment_notify_settings->node_notify;\n    $comment_notify = $user->comment_notify_settings->comment_notify;\n  }\n\n  $form['comment_notify_settings'] = array(\n    '#type' => 'fieldset',\n    '#title' => t('Comment follow-up notification settings'),\n    '#weight' => 4,\n    '#collapsible' => TRUE\n  );\n\n  // Only show the node followup UI if the user has permission to create nodes.\n  $nodes = FALSE;\n  foreach (node_type_get_names() as $type => $name) {\n    if (node_access('create', $type)) {\n      $nodes = TRUE;\n      break;\n    }\n  }\n\n  if (user_access('administer nodes') || $nodes) {\n    $form['comment_notify_settings']['node_notify'] = array(\n      '#type' => 'checkbox',\n      '#title' => t('Receive content follow-up notification e-mails'),\n      '#default_value' => isset($node_notify) ? $node_notify : comment_notify_variable_registry_get('node_notify_default_mailalert'),\n      '#description' => t('Check this box to receive an e-mail notification for follow-ups on your content. You can not disable notifications for individual threads.')\n    );\n  }\n  else {\n    $form['comment_notify_settings']['node_notify'] = array(\n      '#type' => 'hidden',\n      '#value' => COMMENT_NOTIFY_DISABLED,\n    );\n  }\n\n  $available_options[COMMENT_NOTIFY_DISABLED] = t('No notifications');\n  $available_options += _comment_notify_options();\n  $form['comment_notify_settings']['comment_notify'] = array(\n    '#type' => 'select',\n    '#title' => t('Receive comment follow-up notification e-mails'),\n    '#default_value' => isset($comment_notify) ? array($comment_notify) : array(comment_notify_variable_registry_get('default_registered_mailalert')),\n    '#options' => $available_options,\n    '#description' => t(\"Check this box to receive e-mail notification for follow-up comments to comments you posted. You can later disable this on a post-by-post basis... so if you leave this to YES, you can still disable follow-up notifications for comments you don't want follow-up mails anymore - i.e. for very popular posts.\")\n  );\n  return $form;\n  // Construct the user form\n}\n\nfunction comment_notify_user_update(&$edit, $account, $category) {\n  if ($category != 'account') {\n    return;\n  }\n  if (isset($edit['node_notify']) && isset($edit['comment_notify'])) {\n    module_load_include('inc', 'comment_notify', 'comment_notify');\n\n    // Save the values of node_notify_mailalert and comment_notify_mailalert\n    // to {comment_notify_user_settings}.\n    comment_notify_set_user_notification_setting($account->uid, $edit['node_notify'], $edit['comment_notify']);\n  }\n  // Unset them from $user so they don't also get saved into {users}.data.\n  unset($edit['node_notify']);\n  unset($edit['comment_notify']);\n\n}\n\nfunction comment_notify_user_load($users) {\n  module_load_include('inc', 'comment_notify', 'comment_notify');\n\n  // @todo: Why would we want to load this on every user load?\n  foreach ($users as &$user) {\n    $user->comment_notify_settings = comment_notify_get_user_notification_setting($user->uid);\n  }\n\n  return;\n}\n\nfunction comment_notify_user_cancel(&$edit, $account, $method) {\n  module_load_include('inc', 'comment_notify', 'comment_notify');\n  comment_notify_delete_user_notification_setting($account->uid);\n}\n\n/**\n * Implements hook_comment_load().\n */\nfunction comment_notify_comment_load($comments) {\n  // Load some comment_notify specific information into the comment object.\n  $query = db_select('comment_notify', 'cn');\n  $query->join('comment', 'c', 'c.cid = cn.cid');\n  $query->leftJoin('users', 'u', 'c.uid = u.uid');\n  $query->condition('c.cid', array_keys($comments));\n  $query->fields('cn', array('cid', 'notify', 'notify_hash', 'notified'));\n  $query->addField('c', 'mail', 'cmail');\n  $query->addField('u', 'init', 'uinit');\n  $query->addField('u', 'mail', 'umail');\n\n  $records = $query->execute()->fetchAllAssoc('cid');\n  foreach ($records as $cid => $record) {\n    $comments[$cid]->notify = $record->notify;\n    $comments[$cid]->notify_hash = $record->notify_hash;\n    $comments[$cid]->notified = $record->notified;\n    $comments[$cid]->cmail = $record->cmail;\n    $comments[$cid]->uinit = $record->uinit;\n    $comments[$cid]->umail = $record->umail;\n  }\n}\n\n/**\n * Private function to send the notifications.\n *\n * @param $comment\n *   The comment array as found in hook_comment $op = publish.\n */\nfunction _comment_notify_mailalert($comment) {\n  module_load_include('inc', 'comment_notify', 'comment_notify');\n\n  $comment = (object) $comment;\n  global $language;\n  global $base_url;\n  global $user;\n  $initial_language = $language;\n\n  $nid = $comment->nid;\n  $cid = $comment->cid;\n\n  // Check to see if a notification has already been sent for this\n  // comment so that edits to a comment don't trigger an additional\n  // notification.\n  if (!empty($comment->notified)) {\n    return;\n  }\n\n  $node = node_load($nid);\n\n  // No mails if this is not an enabled content type.\n  $enabled_types = variable_get('comment_notify_node_types', array($node->type => TRUE));\n  if (empty($enabled_types[$node->type])) {\n    return;\n  }\n\n  if (empty($comment->mail)) {\n    $comment_account = user_load_by_name($comment->name);\n    $comment_mail = isset($comment_account->mail) ? $comment_account->mail : '';\n  }\n  else {\n    $comment_mail = $comment->mail;\n  }\n  $sent_to = array();\n\n  // Send to a subscribed author if they are not the current commenter\n  $author = user_load($node->uid);\n\n  if (!empty($author->comment_notify_settings->node_notify) && $author->comment_notify_settings->node_notify == 1 && $user->uid != $author->uid && node_access('view', $node, $author)) {\n    // Get the author's language.\n    $language = user_preferred_language($author);\n    $raw_values = array(\n      'subject' => comment_notify_variable_registry_get('author_subject'),\n      'body'  => comment_notify_variable_registry_get('node_notify_default_mailtext'), //JS @todo:change this.\n    );\n    foreach ($raw_values as $k => $v) {\n      $message[$k] = token_replace(t($v), array('comment' => $comment), array('sanitize' => FALSE));\n    }\n\n    drupal_mail('comment_notify', 'comment_notify_mail', $author->mail, $language, $message);\n    $sent_to[] = $author->mail;\n  }\n\n  // For \"reply to my comments\" notifications, figure out what thread this is.\n  $thread = isset($comment->thread) ? $comment->thread : '';\n\n  // Get the list of commenters to notify.\n  $watchers = comment_notify_get_watchers($nid);\n\n  foreach ($watchers as $alert) {\n    // If the user is not anonymous, always load the current e-mail address\n    // from his or her user account instead of trusting $comment->mail.\n    $recipient_user = !empty($alert->uid) ? user_load($alert->uid) : drupal_anonymous_user();\n    $mail = !empty($recipient_user->mail) ? $recipient_user->mail : $alert->cmail;\n\n    $relevant_thread = drupal_substr($thread, 0, drupal_strlen($alert->thread) -1);\n    if ($alert->notify == COMMENT_NOTIFY_COMMENT && strcmp($relevant_thread . '/', $alert->thread) != 0) {\n      continue;\n    }\n\n    if ($mail != $comment_mail && !in_array($mail, $sent_to) && ($alert->uid != $comment->uid || $alert->uid == 0)) {\n\n      $message = array();\n      $language = !empty($alert->uid) ? user_preferred_language($recipient_user) : language_default();\n\n      // Make sure they have access to this node before showing a bunch of node information.\n      if (!node_access('view', $node, $recipient_user)) {\n        continue;\n      }\n\n      $raw_values = array(\n        'subject' => comment_notify_variable_registry_get('watcher_subject'),\n        'body'  => comment_notify_variable_registry_get('comment_notify_default_mailtext'), //JS @todo:change this var name.\n      );\n\n      foreach ($raw_values as $k => $v) {\n        $message[$k] = token_replace(t($v), array('comment' => $comment, 'comment-subscribed' => $alert), array('sanitize' => FALSE));\n      }\n\n      drupal_mail('comment_notify', 'comment_notify_mail', $mail, $language, $message);\n      $sent_to[] = $mail;\n\n      // Make the mail link to user's /edit, unless it's an anonymous user.\n      if ($alert->uid != 0) {\n        $user_mail = l($mail, 'user/' . $alert->uid . '/edit');\n      }\n      else {\n        $user_mail = check_plain($mail);\n      }\n\n      // Add an entry to the watchdog log.\n      watchdog(\n        'comment_notify',\n        'Notified: @user_mail',\n        array('@user_mail' => $user_mail),\n          WATCHDOG_NOTICE,\n          l(t('source comment'), 'node/' . $nid, array(\n            'fragment' => 'comment-' . $alert->cid,\n          ))\n      );\n\n      // Revert to previous (site default) locale.\n      $language = $initial_language;\n    }\n  }\n  // Record that a notification was sent for this comment so that\n  // notifications aren't sent again if the comment is later edited.\n  comment_notify_mark_comment_as_notified($comment);\n}\n\n/**\n * Implements hook_mail().\n */\nfunction comment_notify_mail($key, &$message, $params) {\n  $message['subject'] = $params['subject'];\n  $message['body'][] = $params['body'];\n}\n\n/**\n * Callback for an administrative form to unsubscribe users by e-mail address.\n */\nfunction comment_notify_unsubscribe($form, &$form_state) {\n  $form['comment_notify_unsubscribe'] = array();\n  $form['comment_notify_unsubscribe']['email_to_unsubscribe'] = array(\n    '#type' => 'textfield',\n    '#title' => t('Email to unsubscribe'),\n  );\n  $form['comment_notify_unsubscribe']['submit'] = array(\n    '#type' => 'submit',\n    '#value' => t('Unsubscribe this e-mail'),\n  );\n  return $form;\n}\n\n/**\n * Based on admin submit, do the actual unsubscribe from notifications.\n */\nfunction comment_notify_unsubscribe_submit($form, &$form_state) {\n  module_load_include('inc', 'comment_notify', 'comment_notify');\n  $email = trim($form_state['values']['email_to_unsubscribe']);\n  $comments = comment_notify_unsubscribe_by_email($email);\n  // Update the admin about the state of this comment notification subscription.\n  if ($comments == 0) {\n    drupal_set_message(t(\"There were no active comment notifications for that email.\"));\n  }\n  else {\n    drupal_set_message(format_plural($comments, \"Email unsubscribed from 1 comment notification.\",\n      \"Email unsubscribed from @count comment notifications.\"));\n  }\n}\n\n/*\n * Page callback for administrative settings form.\n */\nfunction comment_notify_settings() {\n  module_load_include('inc', 'comment_notify', 'comment_notify');\n\n  $form['comment_notify_settings'] = array();\n\n  // Only perform comment_notify for certain node types.\n  $enabled_types = comment_notify_variable_registry_get('node_types');\n  $anonymous_problems = '';\n  foreach (node_type_get_names() as $type => $name) {\n    $checkboxes[$type] = check_plain($name);\n    $default[] = $type;\n\n    // If they don't have the ability to leave contact info, then we make a report\n    if (isset($enabled_types[$type]) && $enabled_types[$type] && variable_get('comment_anonymous_' . $type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MAYNOT_CONTACT) {\n      $account = drupal_anonymous_user();\n      if (user_access('subscribe to comments', $account)) {\n        $anonymous_problems[] = l(t('@content-type', array('@content-type' => $name)), 'admin/structure/types/manage/' . $type);\n      }\n    }\n  }\n\n  if (!empty($anonymous_problems)) {\n    drupal_set_message(t('Anonymous commenters have the permission to subscribe to comments but cannot leave their contact information on the following content types: !types.  You should either disable subscriptions on those types here, revoke the permission for anonymous users, or enable anonymous users to leave their contact information in the comment settings.', array('!types' => implode(', ', $anonymous_problems))), 'status', FALSE);\n  }\n\n  $form['comment_notify_settings']['comment_notify_node_types'] = array(\n    '#type' => 'checkboxes',\n    '#title' => t('Content types to enable for comment notification'),\n    '#default_value' => $enabled_types,\n    '#options' => $checkboxes,\n    '#description' => t('Comments on content types enabled here will have the option of comment notification.'),\n  );\n\n  $form['comment_notify_settings']['comment_notify_available_alerts'] = array(\n    '#type' => 'checkboxes',\n    '#title' => t('Available subscription modes'),\n    '#return_value' => 1,\n    '#default_value' => comment_notify_variable_registry_get('available_alerts'),\n    '#description' => t('Choose which notification subscription styles are available for users'),\n    '#options' => array(\n  COMMENT_NOTIFY_NODE     => t('All comments'),\n  COMMENT_NOTIFY_COMMENT  => t('Replies to my comment')\n  )\n  );\n\n  $available_options[COMMENT_NOTIFY_DISABLED] = t('No notifications');\n  $available_options += _comment_notify_options();\n  $form['comment_notify_settings']['comment_notify_default_anon_mailalert'] = array(\n    '#type' => 'select',\n    '#title' => t('Default state for the notification selection box for anonymous users'),\n    '#return_value' => 1,\n    '#default_value' => comment_notify_variable_registry_get('default_anon_mailalert'),\n    '#options' => $available_options,\n  );\n\n  $form['comment_notify_settings']['comment_notify_default_registered_mailalert'] = array(\n    '#type' => 'select',\n    '#title' => t('Default state for the notification selection box for registered users'),\n    '#return_value' => 1,\n    '#default_value' => comment_notify_variable_registry_get('default_registered_mailalert'),\n    '#description' => t('This flag presets the flag for the follow-up notification on the form that anon users will see when posting a comment'),\n    '#options' => $available_options,\n  );\n\n  $form['comment_notify_settings']['comment_notify_node_notify_default_mailalert'] = array(\n    '#type' => 'checkbox',\n    '#title' => t('Subscribe users to their node follow-up notification emails by default'),\n    '#default_value' => comment_notify_variable_registry_get('node_notify_default_mailalert'),\n    '#description' => t('If this is checked, new users will receive e-mail notifications for follow-ups on their nodes by default until they individually disable the feature.'),\n  );\n\n  $form['comment_notify_settings']['comment_notify_comment_notify_default_mailtext'] = array(\n    '#type' => 'textarea',\n    '#title' => t('Default mail text for sending out notifications to commenters'),\n    '#default_value' => comment_notify_variable_registry_get('comment_notify_default_mailtext'),\n    '#return_value' => 1,\n    '#cols' => 80,\n    '#rows' => 15,\n    '#token_types' => array('comment'),\n    '#element_validate' => array('token_element_validate'),\n  );\n\n  $form['comment_notify_settings']['comment_notify_node_notify_default_mailtext'] = array(\n    '#type' => 'textarea',\n    '#title' => t('Default mail text for sending out the notifications to node authors'),\n    '#default_value' => comment_notify_variable_registry_get('node_notify_default_mailtext'),\n     '#return_value' => 1,\n     '#cols' => 80,\n     '#rows' => 15,\n     '#token_types' => array('comment'),\n     '#element_validate' => array('token_element_validate'),\n  );\n\n  $form['comment_notify_settings']['token_help'] = array(\n    '#theme' => 'token_tree',\n    '#token_types' => array('comment'),\n  );\n\n  $form['#validate'] = array('comment_notify_settings_validate');\n\n  return system_settings_form($form);\n}\n\nfunction comment_notify_settings_validate($form, &$form_state) {\n  $sum_enabled = 0;\n  foreach ($form_state['values']['comment_notify_available_alerts'] as $enabled) {\n    $sum_enabled += $enabled;\n  }\n  if (!$sum_enabled) {\n    form_set_error('comment_notify_available_alerts', 'You must enable at least one subscription mode.');\n  }\n}\n\n/**\n * Get the unsubscribe link for a comment subscriber.\n *\n * @param $comment\n *   The subscribed comment object.\n *\n * @return\n *   A string with the internal path to the unsubscribe link, ready to be\n *   passed to the url() function.\n */\nfunction comment_notify_get_unsubscribe_url($comment) {\n  module_load_include('inc', 'comment_notify', 'comment_notify');\n  if (!empty($comment->notify_hash)) {\n    return 'comment_notify/disable/' . $comment->notify_hash;\n  }\n}\n/**\n * Implements hook_field_extra_fields().\n */\nfunction comment_notify_field_extra_fields() {\n  $extras['user']['user']['form']['comment_notify_settings'] = array(\n    'label' => t('Comment notify settings'),\n    'description' => t('User settings for Comment notify'),\n    'weight' => 4,\n  );\n  return $extras;\n}\n
===================================================================
--- sites/all/modules/contrib/comment_notify/comment_notify.module	(revision c9eafafee554e9a69a2adbc13723c2287d0a81db)
+++ sites/all/modules/contrib/comment_notify/comment_notify.module	(revision )
@@ -393,7 +393,7 @@
   return;
 }
 
-function comment_notify_user_cancel(&$edit, $account, $method) {
+function comment_notify_user_cancel($edit, $account, $method) {
   module_load_include('inc', 'comment_notify', 'comment_notify');
   comment_notify_delete_user_notification_setting($account->uid);
 }
