/[drupal]/contributions/modules/troll/troll.admin.inc
ViewVC logotype

Diff of /contributions/modules/troll/troll.admin.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.7, Sat May 9 03:12:00 2009 UTC revision 1.8, Sat May 9 03:54:04 2009 UTC
# Line 1049  function troll_search_user_detail($uid) Line 1049  function troll_search_user_detail($uid)
1049    }    }
1050    return $content;    return $content;
1051  }  }
1052    
1053    function troll_dnsbl_settings() {
1054      $form = array();
1055    
1056      $form['troll_dnsbl_ip_test'] = array(
1057        '#type' => 'markup',
1058         '#value' => l(t('IP test'), 'admin/user/troll/dnsbl/test'),
1059      );
1060      $form['troll_dnsbl_active'] = array(
1061        '#type' => 'checkbox',
1062        '#title' => t('Enable Operations'),
1063        '#default_value' => variable_get('troll_dnsbl_active', 0)
1064      );
1065      $form['troll_dnsbl_list'] = array(
1066        '#type' => 'textarea',
1067        '#title' => t('Servers to query'),
1068        '#default_value' => _troll_dnsbl_default_servers(),
1069        '#description' => t('DNS servers to query. Each on a separate line.')
1070      );
1071      $form['troll_dnsbl_threshold'] = array(
1072        '#type' => 'select',
1073        '#title' => t('How many servers should the IP be listed in'),
1074        '#default_value' => variable_get('troll_dnsbl_threshold', 1),
1075        '#description' => t('How many servers should list the IP before we unpublish its comment ?'),
1076        '#options' => drupal_map_assoc(range(1, 10)),
1077      );
1078    
1079      return system_settings_form($form);
1080    }
1081    
1082    function troll_dnsbl_test_form() {
1083      $form = array();
1084    
1085      $form['ip'] = array(
1086        '#type' => 'textfield',
1087        '#title' => t('IP to test'),
1088        '#size' => 15,
1089        '#required' => TRUE,
1090      );
1091    
1092      $form['submit'] = array(
1093        '#type' => 'submit',
1094        '#value' => t('Test')
1095      );
1096    
1097      $form['#redirect'] = FALSE;
1098    
1099      return $form;
1100    }
1101    
1102    function troll_dnsbl_test_form_submit($form, &$form_state) {
1103    
1104      if (_troll_dnsbl_blacklisted($form_state['values']['ip'])) {
1105        $message = t('The IP %ip is blacklisted', array('%ip' => $form_state['values']['ip']));
1106      }
1107      else {
1108        $message = t('The IP %ip is not blacklisted', array('%ip' => $form_state['values']['ip']));
1109      }
1110      drupal_set_message($message);
1111    }
1112    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.2