1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 04:10:38 +02:00

IPV6 handling - basics

This commit is contained in:
e107steved
2008-11-22 12:57:42 +00:00
parent 5c99758db5
commit 45859f6adb
7 changed files with 239 additions and 89 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/admin_log.php,v $
| $Revision: 1.17 $
| $Date: 2008-08-10 11:41:01 $
| $Revision: 1.18 $
| $Date: 2008-11-22 12:57:25 $
| $Author: e107steved $
|
| Preferences:
@@ -107,12 +107,12 @@ if (isset($_POST['deleteitems']) && ($action == 'comments'))
unset($back_count);
if (isset($_POST['deleteoldadmin']) && isset($_POST['rolllog_clearadmin']))
{
$back_count = $_POST['rolllog_clearadmin'];
$back_count = intval($_POST['rolllog_clearadmin']);
$next_action = 'confdel';
}
elseif (isset($_POST['deleteoldaudit']) && isset($_POST['rolllog_clearaudit']))
{
$back_count = $_POST['rolllog_clearaudit'];
$back_count = intval($_POST['rolllog_clearaudit']);
$next_action = 'auditdel';
}
@@ -252,41 +252,41 @@ $last_noted_time = 0;
$rl_cookiename = $pref['cookie_name']."_rl_admin";
if (isset($_POST['updatefilters']) || isset($_POST['clearfilters']))
{ // Need to put the filter values into the cookie
if (!isset($_POST['clearfilters']))
{ // Only update filter values from S_POST[] if 'clear filters' not active
$start_time = $_POST['starttimedate'] + $_POST['starttimehours']*3600 + $_POST['starttimemins']*60;
$start_enabled = isset($_POST['start_enabled']);
if (isset($_POST['timelength']))
{
$end_time = intval($_POST['timelength'])*60 + $start_time;
}
else
{
$end_time = $_POST['endtimedate'] + $_POST['endtimehours']*3600 + $_POST['endtimemins']*60;
}
$end_enabled = isset($_POST['end_enabled']);
$user_filter = $_POST['roll_user_filter'];
$event_filter = $_POST['roll_event_filter'];
$pri_filter_cond = $_POST['roll_pri_cond'];
$pri_filter_val = $_POST['roll_pri_val'];
$caller_filter = $_POST['roll_caller_filter'];
$ipaddress_filter = $_POST['roll_ipaddress_filter'];
$downloadid_filter = $_POST['roll_downloadid_filter'];
}
$cookie_string = implode("|",array($start_time,$start_enabled,$end_time,$end_enabled,$user_filter,$event_filter,$pri_filter_cond,$pri_filter_val,$caller_filter,$ipaddress_filter,$downloadid_filter));
if (!isset($_POST['clearfilters']))
{ // Only update filter values from S_POST[] if 'clear filters' not active
$start_time = intval($_POST['starttimedate'] + $_POST['starttimehours']*3600 + $_POST['starttimemins']*60);
$start_enabled = isset($_POST['start_enabled']);
if (isset($_POST['timelength']))
{
$end_time = intval($_POST['timelength'])*60 + $start_time;
}
else
{
$end_time = intval($_POST['endtimedate'] + $_POST['endtimehours']*3600 + $_POST['endtimemins']*60);
}
$end_enabled = isset($_POST['end_enabled']);
$user_filter = intval($_POST['roll_user_filter']);
$event_filter = $tp->toDB($_POST['roll_event_filter']);
$pri_filter_cond = $tp->toDB($_POST['roll_pri_cond']);
$pri_filter_val = $tp->toDB($_POST['roll_pri_val']);
$caller_filter = $tp->toDB($_POST['roll_caller_filter']);
$ipaddress_filter = $e107->ipEncode($tp->toDB($_POST['roll_ipaddress_filter']));
$downloadid_filter = $tp->toDB($_POST['roll_downloadid_filter']);
}
$cookie_string = implode("|",array($start_time,$start_enabled,$end_time,$end_enabled,$user_filter,$event_filter,$pri_filter_cond,$pri_filter_val,$caller_filter,$ipaddress_filter,$downloadid_filter));
// echo $cookie_string."<br />";
// Create session cookie to store values
cookie($rl_cookiename,$cookie_string,0); // Use session cookie
cookie($rl_cookiename,$cookie_string,0); // Use session cookie
}
else
{
// Now try and get the filters from the cookie
if (isset($_COOKIE[$rl_cookiename]))
list($start_time,$start_enabled,$end_time,$end_enabled,$user_filter,$event_filter,$pri_filter_cond,$pri_filter_val, $caller_filter,$ipaddress_filter,$downloadid_filter) = explode("|",$_COOKIE[$rl_cookiename]);
if (isset($qs[1]) && isset($qs[2]) && ($qs[1] == 'user') && ctype_digit($qs[2]) && (intval($qs[2]) > 0))
{
$user_filter = intval($qs[2]);
}
if (isset($_COOKIE[$rl_cookiename]))
list($start_time,$start_enabled,$end_time,$end_enabled,$user_filter,$event_filter,$pri_filter_cond,$pri_filter_val, $caller_filter,$ipaddress_filter,$downloadid_filter) = explode("|",$_COOKIE[$rl_cookiename]);
if (isset($qs[1]) && isset($qs[2]) && ($qs[1] == 'user') && ctype_digit($qs[2]) && (intval($qs[2]) > 0))
{
$user_filter = intval($qs[2]);
}
}
$timelength = 5;
@@ -789,7 +789,7 @@ $sort_fields = array(
break;
case 'ipfilter' :
$text .= "<td class='forumheader3'>".RL_LAN_060."<br /><span class='smalltext'><em>".RL_LAN_061."</em></span></td>
<td class='forumheader3'><input class='tbox' type='text' name='roll_ipaddress_filter' size='20' value='".$ipaddress_filter."' maxlength='20' /></td>";
<td class='forumheader3'><input class='tbox' type='text' name='roll_ipaddress_filter' size='20' value='".$e107->ipDecode($ipaddress_filter)."' maxlength='20' /></td>";
$filter_cols += 2;
break;
case 'userfilter' :
@@ -923,13 +923,16 @@ function log_process($matches)
// Look for pseudo-code for newlines, link insertion
$val = preg_replace_callback("#\[!(\w+?)(=.+?){0,1}!]#",'log_process',$row['dblog_remarks']);
break;
case 'dblog_ip' :
$val = $e107->ipDecode($row['dblog_ip']);
break;
case 'comment_ip' :
$val = $row['comment_ip'];
if (strlen($val) == 8)
$val = $e107->ipDecode($row['comment_ip']);
/* if (strlen($val) == 8) // New decoder should handle this automatically
{
$hexip = explode('.', chunk_split($val, 2, '.'));
$val = hexdec($hexip[0]). '.' . hexdec($hexip[1]) . '.' . hexdec($hexip[2]) . '.' . hexdec($hexip[3]);
}
} */
break;
case 'comment_comment' :
$val =$tp->text_truncate($row['comment_comment'],100,'...'); // Just display first bit of comment

View File

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/banlist.php,v $
| $Revision: 1.10 $
| $Date: 2008-11-14 06:01:06 $
| $Author: e107coders $
| $Revision: 1.11 $
| $Date: 2008-11-22 12:57:25 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@@ -92,7 +92,11 @@ if (isset($_POST['ban_ip']))
'whedit' - Editing whitelist
'whadd' - Adding to whitelist
*/
$new_vals = array('banlist_ip' => $_POST['ban_ip']);
if ($e107->whatIsThis($new_ban_ip) == 'ip')
{
$new_ban_ip = $e107->IPencode($new_ban_ip); // Normalise numeric IP addresses
}
$new_vals = array('banlist_ip' => $new_ban_ip);
if (isset($_POST['add_ban']))
{
$new_vals['banlist_datestamp'] = time();
@@ -400,7 +404,7 @@ switch ($action)
<tr>
<td style='width:30%' class='forumheader3'><input type='hidden' name='entry_intent' value='{$action}' />".BANLAN_5.": </td>
<td style='width:70%' class='forumheader3'>
<input class='tbox' type='text' name='ban_ip' size='40' value='".$banlist_ip."' maxlength='200' />{$rdns_warn}
<input class='tbox' type='text' name='ban_ip' size='40' value='".$e107->ipDecode($banlist_ip)."' maxlength='200' />{$rdns_warn}
</td>
</tr>";
@@ -587,7 +591,7 @@ switch ($action)
$val = "<a title='".constant('BANLAN_11'.$banlist_bantype)."'>".constant('BANLAN_10'.$banlist_bantype)."</a>";
break;
case 'ip_reason' :
$val = $banlist_ip."<br />".$fv.": ".$banlist_reason;
$val = $e107->ipDecode($banlist_ip)."<br />".$fv.": ".$banlist_reason;
break;
case 'banlist_banexpires' :
$val = ($banlist_banexpires ? strftime(BAN_TIME_FORMAT,$banlist_banexpires).(($banlist_banexpires < time()) ? ' ('.BANLAN_34.')' : '')
@@ -596,7 +600,7 @@ switch ($action)
case 'ban_options' :
$val = "<a href='".e_SELF."?{$edit_action}-{$banlist_ip}'><img src='".$images_path."edit_16.png' alt='".LAN_EDIT."' title='".LAN_EDIT."' style='border:0px' /></a>
<input name='delete_ban_entry' type='image' src='".$images_path."delete_16.png' alt='".LAN_DELETE."' title='".LAN_DELETE."' style='border:0px'
onclick=\" var r = jsconfirm('".$tp->toJS(LAN_CONFIRMDEL." [".$banlist_ip."]")."');
onclick=\" var r = jsconfirm('".$tp->toJS(LAN_CONFIRMDEL." [".$e107->ipDecode($banlist_ip)."]")."');
if (r) { document.getElementById('ban_form').action='".e_SELF."?{$del_action}-{$banlist_ip}'; } return r; \" />";
break;
case 'banlist_notes' :
@@ -669,7 +673,7 @@ function parse_date($instr)
// Return a message
function process_csv($filename, $override_imports, $override_expiry, $separator = ',', $quote = '"')
{
global $sql, $pref;
global $sql, $pref, $e107;
// echo "Read CSV: {$filename} separator: {$separator}, quote: {$quote} override imports: {$override_imports} override expiry: {$override_expiry}<br />";
// Renumber imported bans
if ($override_imports) $sql->db_Update('banlist', "`banlist_bantype`=".BAN_TYPE_TEMPORARY." WHERE `banlist_bantype` = ".BAN_TYPE_IMPORTED);
@@ -703,7 +707,7 @@ function process_csv($filename, $override_imports, $override_expiry, $separator
switch ($field_num)
{
case 1 : // IP address
$field_list['banlist_ip'] = $f;
$field_list['banlist_ip'] = $e107->ipEncode($f);
break;
case 2 : // Original date of ban
$field_list['banlist_datestamp'] = parse_date($f);