| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: secondlife.module,v 1.4.2.2 2008/12/16 03:37:52 kbahey Exp $ |
// $Id: secondlife.module,v 1.4.2.3 2008/12/16 16:05:54 kbahey Exp $ |
| 4 |
|
|
| 5 |
define('SECONDLIFE_LINDEN_SERVERS', '8.2.32.0/22,63.210.156.0/22,64.129.40.0/22,64.129.44.0/22,64.154.220.0/22,8.4.128.0/22,8.10.144.0/21,216.82.0.0/18'); |
define('SECONDLIFE_LINDEN_SERVERS', '8.2.32.0/22,63.210.156.0/22,64.129.40.0/22,64.129.44.0/22,64.154.220.0/22,8.4.128.0/22,8.10.144.0/21,216.82.0.0/18'); |
| 6 |
|
|
| 50 |
'#description' => t('Enter the allowed Ips separated by a comma.'), |
'#description' => t('Enter the allowed Ips separated by a comma.'), |
| 51 |
); |
); |
| 52 |
|
|
| 53 |
|
$form['secondlife_use_proxy'] = array( |
| 54 |
|
'#type' => 'radios', |
| 55 |
|
'#title' => t('Use proxy'), |
| 56 |
|
'#default_value' => variable_get('secondlife_use_proxy', 0), |
| 57 |
|
'#options' => array( 0 => t('No'), 1 => t('Yes') ), |
| 58 |
|
'#description' => t('Select "yes" if your website is behind a proxy.'), |
| 59 |
|
); |
| 60 |
|
|
| 61 |
$form['secondlife_debug'] = array( |
$form['secondlife_debug'] = array( |
| 62 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 63 |
'#title' => t('Debugging enabled ?'), |
'#title' => t('Debugging enabled ?'), |
| 117 |
// check for server ips |
// check for server ips |
| 118 |
$is_ll = FALSE; |
$is_ll = FALSE; |
| 119 |
$ll_subnets = explode(",", variable_get('secondlife_allowed_ips', SECONDLIFE_LINDEN_SERVERS) ); |
$ll_subnets = explode(",", variable_get('secondlife_allowed_ips', SECONDLIFE_LINDEN_SERVERS) ); |
| 120 |
|
$remote_addr = $_SERVER['REMOTE_ADDR']; |
| 121 |
|
if (variable_get('secondlife_use_proxy', 0)) { |
| 122 |
|
$tempa = split(", ", $_SERVER['HTTP_X_FORWARDED_FOR']); |
| 123 |
|
$remote_addr = trim($tempa[1]); |
| 124 |
|
} |
| 125 |
foreach( $ll_subnets as $network) { |
foreach( $ll_subnets as $network) { |
| 126 |
if(secondlife_netmatch($network,$_SERVER['REMOTE_ADDR'] )) { |
if(secondlife_netmatch($network, $remote_addr)) { |
| 127 |
$is_ll = TRUE; |
$is_ll = TRUE; |
| 128 |
break; |
break; |
| 129 |
} |
} |