1
0
mirror of https://github.com/e107inc/e107.git synced 2025-09-02 10:53:29 +02:00

Various banlist/logging updates

This commit is contained in:
e107steved
2007-12-26 13:21:34 +00:00
parent 0b7bdffe3c
commit 9162ce692a
11 changed files with 204 additions and 99 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/banlist.php,v $
| $Revision: 1.6 $
| $Date: 2007-12-23 21:15:48 $
| $Revision: 1.7 $
| $Date: 2007-12-26 13:21:34 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@@ -217,7 +217,7 @@ function ban_time_dropdown($click_js = '', $zero_text=BANLAN_21, $curval=-1,$dro
// Character options for import & export
$separator_char = array(1 => ',', 2 => '|');
$quote_char = array(1 => '', 2 => "'", 3 => '"');
$quote_char = array(1 => '(none)', 2 => "'", 3 => '"');
function select_box($name, $data, $curval = FALSE)
@@ -274,7 +274,7 @@ switch ($action)
<textarea class='tbox' name='ban_text[]' cols='50' rows='4'>{$pref['ban_messages'][$i]}</textarea>
</td>
<td class='forumheader3'>".ban_time_dropdown('',BANLAN_32,$pref['ban_durations'][$i],'ban_time[]')."</td>
";
</tr>";
}
$text .= "<tr><td class='forumheader3' colspan='3' style='text-align:center'><input class='button' type='submit' name='update_ban_prefs' value='".LAN_UPDATE."' /></td></tr>
</table>\n";
@@ -293,10 +293,9 @@ switch ($action)
// Edit/add form first
$text .= "<div style='text-align:center'>
<form method='post' action='".e_SELF.$next."'>
<input type='hidden' name='entry_intent' value='{$action}' />
<table style='".ADMIN_WIDTH."' class='fborder'>
<tr>
<td style='width:30%' class='forumheader3'>".BANLAN_5.": </td>
<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}
</td>
@@ -398,8 +397,8 @@ switch ($action)
if ($message) $ns->tablerender(BANLAN_48, "<div style='text-align:center; font-weight:bold'>{$message}</div>");
$text = "<div style='text-align:center'>
<form method='post' action='".e_ADMIN."banlist_export.php' name='ban_export_form' >
<div><table>
<form method='post' action='".e_ADMIN."banlist_export.php' id='ban_export_form' >
<table>
<colgroup>
<col style='width:70%' />
<col style='width:30%' />
@@ -409,7 +408,7 @@ switch ($action)
$spacer = '';
for ($i = 0; $i < BAN_REASON_COUNT; $i++)
{
$text .= $spacer."<input type='checkbox' name='ban_types[{$i}]' value='".($i)."'>&nbsp;".constant('BANLAN_10'.$i)." - ".constant('BANLAN_11'.$i);
$text .= $spacer."<input type='checkbox' name='ban_types[{$i}]' value='".($i)."' />&nbsp;".constant('BANLAN_10'.$i)." - ".constant('BANLAN_11'.$i);
$spacer = "<br />\n";
}
$text .= "</td><td class='forumheader3'>".select_box('ban_separator',$separator_char).' '.BANLAN_37;
@@ -421,16 +420,16 @@ switch ($action)
// Now do the import options
$text = "<div style='text-align:center'>
<form enctype=\"multipart/form-data\" method='post' action='".e_SELF."?transfer' name='ban_import_form' >
<div><table>
<form enctype=\"multipart/form-data\" method='post' action='".e_SELF."?transfer' id='ban_import_form' >
<table>
<colgroup>
<col style='width:70%' />
<col style='width:30%' />
</colgroup>
<tr><td class='fcaption'>".BANLAN_42."</td><td class='fcaption'>".BANLAN_15."</td></tr>";
$text .= "<tr><td class='forumheader3' rowspan='2'>\n";
$text .= "<input type='checkbox' name='ban_over_import' value='1'>&nbsp;".BANLAN_43.'<br />';
$text .= "<input type='checkbox' name='ban_over_expiry' value='1'>&nbsp;".BANLAN_44;
$text .= "<input type='checkbox' name='ban_over_import' value='1' />&nbsp;".BANLAN_43.'<br />';
$text .= "<input type='checkbox' name='ban_over_expiry' value='1' />&nbsp;".BANLAN_44;
$text .= "</td><td class='forumheader3'>".select_box('ban_separator',$separator_char).' '.BANLAN_37;
$text .= "</td></tr><tr><td class='forumheader3'>".select_box('ban_quote',$quote_char).' '.BANLAN_38."</td></tr>
@@ -503,6 +502,7 @@ switch ($action)
}
$text .= "<td class='forumheader3'>{$val}</td>";
}
$text .= '</tr>';
}
$text .= "</table>\n";
}

View File

@@ -11,13 +11,14 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/fla.php,v $
| $Revision: 1.2 $
| $Date: 2007-12-09 16:42:22 $
| $Revision: 1.3 $
| $Date: 2007-12-26 13:21:34 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
require_once("../class2.php");
if (!getperms("4")) {
if (!getperms("4"))
{
header("location:".e_BASE."index.php");
exit;
}
@@ -26,20 +27,25 @@ $e_sub_cat = 'failed_login';
require_once("auth.php");
$tmp = (e_QUERY) ? explode(".", e_QUERY) : "";
$from = (!$tmp[0]) ? 0 : intval($tmp[0]);
$amount = (!$tmp[1]) ? 50 : intval($tmp[1]);
$from = intval(varset($tmp[0], 0));
$amount = intval(varset($tmp[1], 50));
if(isset($_POST['delbanSubmit']))
{
$message = '';
$delcount = 0;
$spacer = '';
foreach($_POST['fladelete'] as $delete)
{
$delcount ++;
$sql -> db_Delete("generic", "gen_id='$delete' ");
$delcount ++;
$sql -> db_Delete("generic", "gen_id='{$delete}' ");
}
if ($delcount)
{
$message .= FLALAN_3.": ".$delcount;
$spacer = '<br />';
}
$message = FLALAN_3.": ".$delcount;
$bancount = 0;
foreach($_POST['flaban'] as $ban)
@@ -47,14 +53,18 @@ if(isset($_POST['delbanSubmit']))
if($sql -> db_Select("generic", "*", "gen_id={$ban}"))
{
$at = $sql -> db_Fetch();
$e107->add_ban(4,FLALAN_4,$at['gen_ip'],ADMINID);
if (!$e107->add_ban(4,FLALAN_4,$at['gen_ip'],ADMINID))
{ // IP on whitelist (although possibly we shouldn't get to this stage, but check anyway
$message .= $spacer.str_replace(FLALAN_18,'--IP--',$at['gen_ip']);
$spacer = '<br />';
}
// $banlist_ip = $at['gen_ip'];
// $sql->db_Insert("banlist", "'$banlist_ip', '".ADMINID."', '".FLALAN_4."' ");
$sql -> db_Delete("generic", "gen_id='$ban' ");
$sql -> db_Delete("generic", "gen_id='{$ban}' ");
$bancount ++;
}
}
$message .= ", ".FLALAN_5.": ".$bancount;
$message .= $spacer.FLALAN_5.": ".$bancount;
}

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/users.php,v $
| $Revision: 1.8 $
| $Date: 2007-12-09 16:42:22 $
| $Revision: 1.9 $
| $Date: 2007-12-26 13:21:34 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@@ -249,7 +249,7 @@ if (isset($_POST['useraction']) && $_POST['useraction'] == "ban")
// $sub_action = $_POST['userid'];
$sql->db_Select("user", "*", "user_id='".$_POST['userid']."'");
$row = $sql->db_Fetch();
if ($row['user_perms'] == "0")
if (($row['user_perms'] == "0") || ($row['user_perms'] == "0."))
{
$user->show_message(USRLAN_7);
}
@@ -257,24 +257,29 @@ if (isset($_POST['useraction']) && $_POST['useraction'] == "ban")
{
if($sql->db_Update("user", "user_ban='1' WHERE user_id='".$_POST['userid']."' "))
{
$user->show_message(USRLAN_8);
$user->show_message(USRLAN_8);
}
if(trim($row['user_ip']) == "")
{
$user->show_message(USRLAN_135);
$user->show_message(USRLAN_135);
}
else
{
if($sql->db_Count("user", "(*)", "WHERE user_ip = '{$row['user_ip']}'") > 1)
{
$user->show_message(str_replace("{IP}", $row['user_ip'], USRLAN_136));
}
else
{
$e107->add_ban(6,USRLAN_149.$row['user_name'].'/'.$row['user_loginname'],$row['user_ip'],USERID);
// $sql -> db_Insert("banlist", "'".$row['user_ip']."', '".USERID."', '".$row['user_name']."' ");
if($sql->db_Count("user", "(*)", "WHERE user_ip = '{$row['user_ip']}'") > 1)
{ // Multiple users have same IP address
$user->show_message(str_replace("{IP}", $row['user_ip'], USRLAN_136));
}
else
{
if ($e107->add_ban(6,USRLAN_149.$row['user_name'].'/'.$row['user_loginname'],$row['user_ip'],USERID))
{ // Successful IP ban
$user->show_message(str_replace("{IP}", $row['user_ip'], USRLAN_137));
}
else
{ // IP address on whitelist
$user->show_message(str_replace("{IP}", $row['user_ip'], USRLAN_150));
}
}
}
}
$action = "main";
@@ -780,7 +785,7 @@ class users
$text .= "<div style='cursor:pointer' onclick=\"expandit('sdisp')\">".LAN_DISPLAYOPT."</div>";
$text .= "<div id='sdisp' style='padding-top:4px;display:none;text-align:center;margin-left:auto;margin-right:auto'>
<table class='forumheader3' style='width:95%'><tr>";
<table class='forumheader3' style='width:95%'>";
$fields = mysql_list_fields($mySQLdefaultdb, MPREFIX."user");
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) {
@@ -789,19 +794,26 @@ class users
// include extended fields in the list.
$sql -> db_Select("user_extended_struct");
while($row = $sql-> db_Fetch()){
$fname[] = "user_".$row['user_extended_struct_name'];
while($row = $sql-> db_Fetch())
{
$fname[] = "user_".$row['user_extended_struct_name'];
}
$m = 0;
foreach($fname as $fcol){
$checked = (in_array($fcol,$search_display)) ? "checked='checked'" : "";
$text .= "<td style='text-align:left; padding:0px'>";
$text .= "<input type='checkbox' name='searchdisp[]' value='".$fcol."' $checked />".str_replace("user_","",$fcol) . "</td>\n";
$m++;
if($m == 5){
$text .= "</tr><tr>";
$m = 0;
}
foreach($fname as $fcol)
{
if($m == 0)
{
$text .= "<tr>";
}
$checked = (in_array($fcol,$search_display)) ? "checked='checked'" : "";
$text .= "<td style='text-align:left; padding:0px'>";
$text .= "<input type='checkbox' name='searchdisp[]' value='".$fcol."' $checked />".str_replace("user_","",$fcol) . "</td>\n";
$m++;
if($m == 5)
{
$text .= "</tr>";
$m = 0;
}
}
$text .= "</table></div>