? 1)
? restrict_by_ip-[415902].patch
Index: restrict_by_ip.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/restrict_by_ip/restrict_by_ip.module,v
retrieving revision 1.14.2.1
diff -u -p -r1.14.2.1 restrict_by_ip.module
--- restrict_by_ip.module 30 Jul 2010 18:39:17 -0000 1.14.2.1
+++ restrict_by_ip.module 15 Sep 2010 19:14:29 -0000
@@ -156,12 +156,17 @@ function restrict_by_ip_settings() {
$form['restrict_by_ip_error_page'] = array(
'#type' => 'textfield',
'#title' => t('Login denied page'),
- '#description' => t("This the address of the page to which the user will be redirected if they are not allowed to login. If you don't set this the user will not know why they couldn't login"),
+ '#description' => t("This is the address of the page to which the user will be redirected if they are not allowed to login. If you don't set this the user will not know why they couldn't login"),
'#weight' => -5,
'#default_value' => variable_get('restrict_by_ip_error_page', ''),
'#required' => TRUE,
);
-
+ $form['restrict_by_ip_restrict_user_1'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Restrict Admin account as well (Your Current IP address is: '.$_SERVER['REMOTE_ADDR'].')'),
+ '#description' => t("Restrict the admin account (user 1) by IP as well. WARNING: Be sure you know what you're doing, or you could lock yourself completely out of the site"),
+ '#default_value' => variable_get('restrict_by_ip_restrict_user_1', '0'),
+ );
return system_settings_form($form);
}
@@ -201,7 +206,8 @@ global $user;
* allow logon to continue. If not redirect to a designated page
*/
function _restrict_by_ip_login(&$user) {
- if ($user -> uid > 1) {
+// if ($user -> uid > 1) {
+ if (($user->uid == 1 && variable_get('restrict_by_ip_restrict_user_1', '0') == '1') || $user->uid > 1) {
$usrdata = db_fetch_object(db_query('SELECT * FROM {restrict_by_ip} WHERE uid = %d', $user->uid));
$logonvalid = FALSE;
$ip2check = $_SERVER['REMOTE_ADDR'];