| 1 |
<?php |
<?php |
| 2 |
// $Id: troll.module,v 1.26.2.11.2.7 2009/06/13 02:55:13 deekayen Exp $ |
// $Id: troll.module,v 1.26.2.11.2.8 2009/06/19 13:36:04 deekayen Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 120 |
'#description' => t("Page for relocating users banned based on their IP address or domain name. If left blank, users will be redirected to blocked.html in the troll module's directory. Do not use a drupal path here! You will cause a loop since IP banning completely blocks all access to the site! Edit the blocked.html file, or redirect to http://localhost."), |
'#description' => t("Page for relocating users banned based on their IP address or domain name. If left blank, users will be redirected to blocked.html in the troll module's directory. Do not use a drupal path here! You will cause a loop since IP banning completely blocks all access to the site! Edit the blocked.html file, or redirect to http://localhost."), |
| 121 |
); |
); |
| 122 |
|
|
| 123 |
$roles = user_roles(); |
$roles = array(t(' -Select Role- ')) + user_roles(); |
|
array_unshift($roles, t(' -Select Role- ')); |
|
| 124 |
$form['role_settings'] = array( |
$form['role_settings'] = array( |
| 125 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 126 |
'#title' => t('User Blocking') |
'#title' => t('User Blocking') |
| 233 |
'path' => 'admin/user/troll/ip_blacklist/summary', |
'path' => 'admin/user/troll/ip_blacklist/summary', |
| 234 |
'title' => t('Summary'), |
'title' => t('Summary'), |
| 235 |
'callback' => 'troll_blacklist_summary', |
'callback' => 'troll_blacklist_summary', |
| 236 |
'access' => array('administer troll'), |
'access' => user_access('administer troll'), |
| 237 |
'type' => MENU_DEFAULT_LOCAL_TASK, |
'type' => MENU_DEFAULT_LOCAL_TASK, |
| 238 |
'weight' => 0 |
'weight' => 0 |
| 239 |
); |
); |
| 321 |
} |
} |
| 322 |
|
|
| 323 |
/** |
/** |
| 324 |
|
* Menu callback: block a user and redirect to search page. |
| 325 |
|
* |
| 326 |
|
* @param $uid |
| 327 |
|
*/ |
| 328 |
|
function troll_confirm_block_user_form($uid) { |
| 329 |
|
$account = user_load(array('uid' => $uid)); |
| 330 |
|
if (!$account) { |
| 331 |
|
drupal_goto('admin/user/troll'); |
| 332 |
|
} |
| 333 |
|
$form['uid'] = array( |
| 334 |
|
'#type' => 'value', |
| 335 |
|
'#value' => $uid, |
| 336 |
|
); |
| 337 |
|
$form['#redirect'] = 'admin/user/troll'; |
| 338 |
|
return confirm_form($form, t('Block user %username?', array('%username' => $account->name)), 'admin/user/troll', t('Are you sure you want to block this user?')); |
| 339 |
|
} |
| 340 |
|
|
| 341 |
|
function troll_confirm_block_user_form_submit($form_id, $form_values /*$form, &$form_state*/) { |
| 342 |
|
troll_block_user($form_values['uid']); |
| 343 |
|
} |
| 344 |
|
|
| 345 |
|
/** |
| 346 |
* Menu callback: user IP banning. |
* Menu callback: user IP banning. |
| 347 |
*/ |
*/ |
| 348 |
function troll_ip_ban() { |
function troll_ip_ban() { |
| 560 |
* @param array $edit |
* @param array $edit |
| 561 |
*/ |
*/ |
| 562 |
function troll_blacklist_import_url($edit) { |
function troll_blacklist_import_url($edit) { |
| 563 |
$url_parts = parse_url($edit['custom_list']); |
$url_parts = parse_url($edit); |
| 564 |
$file_parts = pathinfo($url_parts['path']); |
$file_parts = pathinfo($url_parts['path']); |
| 565 |
troll_blacklist_parse_save($edit['custom_list'], $file_parts['extension']); |
troll_blacklist_parse_save($edit, $file_parts['extension']); |
| 566 |
} |
} |
| 567 |
|
|
| 568 |
/** |
/** |