You are here

function cloudflare_form_comment_admin_overview_submit in CloudFlare 7

1 string reference to 'cloudflare_form_comment_admin_overview_submit'
cloudflare_form_comment_admin_overview_alter in ./cloudflare.module
Implementation of hook_form_FORM_ID_alter().

File

./cloudflare.module, line 86

Code

function cloudflare_form_comment_admin_overview_submit($form, &$form_state) {
  if (isset($form_state['values']['operation'])) {
    $operation = $form_state['input']['operation'];
    if (isset($form_state['values']['comments'])) {
      $cids = $form_state['values']['comments'];
      foreach ($cids as $cid => $value) {
        switch ($operation) {
          case 'cloudflare_ban_ip':
            _cloudflare_ban_comment($cid, FALSE);
            break;
          case 'cloudflare_ban_ip_delete':
            _cloudflare_ban_comment($cid, TRUE);
            break;
          case 'cloudflare_whitelist_ip':
            _cloudflare_whitelist_comment($cid, FALSE);
            break;
          case 'cloudflare_whitelist_ip_publish':
            _cloudflare_whitelist_comment($cid, TRUE);
            break;
          case 'cloudflare_spam':
            _cloudflare_spam_report($cid, FALSE);
            break;
          case 'cloudflare_spam_delete':
            _cloudflare_spam_report($cid, TRUE);
            break;
        }
      }
      cache_clear_all();
    }
  }
  return $form;
}