1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +02:00

Bugtracker #4671 - hardcoded text

This commit is contained in:
e107steved
2009-02-03 21:16:29 +00:00
parent 90d244601a
commit 46d7bd0db2
2 changed files with 50 additions and 45 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/online_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/online_class.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2008-11-22 12:57:25 $ | $Date: 2009-02-03 21:16:15 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -21,30 +21,30 @@ class e_online
{ {
function online($online_tracking = false, $flood_control = false) function online($online_tracking = false, $flood_control = false)
{ {
global $sql, $pref, $e107, $e_event, $tp, $online_timeout, $online_warncount, $online_bancount; global $sql, $pref, $e107, $e_event, $tp, $online_timeout, $online_warncount, $online_bancount;
global $members_online, $total_online, $member_list, $listuserson; global $members_online, $total_online, $member_list, $listuserson;
if($online_tracking == true || $flood_control == true) if($online_tracking == true || $flood_control == true)
{
if(!isset($online_timeout)) $online_timeout = 300;
if(!isset($online_bancount))
{
list($ban_access_guest,$ban_access_member) = explode(',',varset($pref['ban_max_online_access'],'100,200'));
$online_bancount = max($ban_access_guest,50); // Safety net for incorrect values
if (USER)
{
$online_bancount = max($online_bancount,$ban_access_member);
}
}
$online_warncount = $online_bancount * 0.9; // Set warning threshold at 90% of ban threshold
$page = (strpos(e_SELF, "forum_") !== FALSE) ? e_SELF.".".e_QUERY : e_SELF;
$page = (strpos(e_SELF, "comment") !== FALSE) ? e_SELF.".".e_QUERY : $page;
$page = (strpos(e_SELF, "content") !== FALSE) ? e_SELF.".".e_QUERY : $page;
$page = $tp -> toDB($page, true);
$ip = $e107->getip();
$udata = (USER === true ? USERID.".".USERNAME : "0");
if (USER)
{ {
if(!isset($online_timeout)) $online_timeout = 300;
if(!isset($online_bancount))
{
list($ban_access_guest,$ban_access_member) = explode(',',varset($pref['ban_max_online_access'],'100,200'));
$online_bancount = max($ban_access_guest,50); // Safety net for incorrect values
if (USER)
{
$online_bancount = max($online_bancount,$ban_access_member);
}
}
$online_warncount = $online_bancount * 0.9; // Set warning threshold at 90% of ban threshold
$page = (strpos(e_SELF, "forum_") !== FALSE) ? e_SELF.".".e_QUERY : e_SELF;
$page = (strpos(e_SELF, "comment") !== FALSE) ? e_SELF.".".e_QUERY : $page;
$page = (strpos(e_SELF, "content") !== FALSE) ? e_SELF.".".e_QUERY : $page;
$page = $tp -> toDB($page, true);
$ip = $e107->getip();
$udata = (USER === true ? USERID.".".USERNAME : "0");
if (USER)
{
// Find record that matches IP or visitor, or matches user info // Find record that matches IP or visitor, or matches user info
if ($sql->db_Select("online", "*", "(`online_ip` = '{$ip}' AND `online_user_id` = '0') OR `online_user_id` = '{$udata}'")) if ($sql->db_Select("online", "*", "(`online_ip` = '{$ip}' AND `online_user_id` = '0') OR `online_user_id` = '{$udata}'"))
{ {
@@ -83,42 +83,47 @@ class e_online
{ {
$sql->db_Insert("online", " '".time()."', '0', '{$udata}', '{$ip}', '{$page}', 1, 0"); $sql->db_Insert("online", " '".time()."', '0', '{$udata}', '{$ip}', '{$page}', 1, 0");
} }
} }
else else
{ {
//Current page request is from a visitor //Current page request is from a visitor
if ($sql->db_Select("online", "*", "`online_ip` = '{$ip}' AND `online_user_id` = '0'")) { if ($sql->db_Select("online", "*", "`online_ip` = '{$ip}' AND `online_user_id` = '0'"))
{
$row = $sql->db_Fetch(); $row = $sql->db_Fetch();
if ($row['online_timestamp'] < (time() - $online_timeout)) //It has been at least 'timeout' seconds since this ip has connected if ($row['online_timestamp'] < (time() - $online_timeout)) //It has been at least 'timeout' seconds since this ip has connected
{ {
//Update record with timestamp, current page, and set pagecount to 1 //Update record with timestamp, current page, and set pagecount to 1
$query = "`online_timestamp` = '".time()."', `online_location` = '{$page}', `online_pagecount` = 1 WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0' LIMIT 1"; $query = "`online_timestamp` = '".time()."', `online_location` = '{$page}', `online_pagecount` = 1 WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0' LIMIT 1";
} else { }
else
{
//Update record with current page and increment pagecount //Update record with current page and increment pagecount
$row['online_pagecount'] ++; $row['online_pagecount'] ++;
// echo "here {$online_pagecount}"; // echo "here {$online_pagecount}";
$query="`online_location` = '{$page}', `online_pagecount` = {$row['online_pagecount']} WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0' LIMIT 1"; $query="`online_location` = '{$page}', `online_pagecount` = {$row['online_pagecount']} WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0' LIMIT 1";
} }
$sql->db_Update("online", $query); $sql->db_Update("online", $query);
} else { }
else
{
$sql->db_Insert("online", " '".time()."', '0', '0', '{$ip}', '{$page}', 1, 0"); $sql->db_Insert("online", " '".time()."', '0', '0', '{$ip}', '{$page}', 1, 0");
} }
} }
if (ADMIN || ($pref['autoban'] != 1 && $pref['autoban'] != 2) || (!isset($row['online_pagecount']))) // Auto-Ban is switched off. (0 or 3) if (ADMIN || ($pref['autoban'] != 1 && $pref['autoban'] != 2) || (!isset($row['online_pagecount']))) // Auto-Ban is switched off. (0 or 3)
{ {
$row['online_pagecount'] = 1; $row['online_pagecount'] = 1;
} }
if ($row['online_pagecount'] > $online_bancount && ($e107->ipDecode($row['online_ip'],TRUE) != "127.0.0.1")) if ($row['online_pagecount'] > $online_bancount && ($e107->ipDecode($row['online_ip'],TRUE) != "127.0.0.1"))
{ {
// $sql->db_Insert("banlist", "'{$ip}', '0', 'Hit count exceeded ({$row['online_pagecount']} requests within allotted time)' "); include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_banlist.php');
if ($e107->add_ban(2,"Hit count exceeded ({$row['online_pagecount']} requests within allotted time)",$ip,0)) if ($e107->add_ban(2,str_replace('--HITS--',$row['online_pagecount'],BANLAN_78),$ip,0))
{ {
$e_event->trigger("flood", $ip); $e_event->trigger("flood", $ip);
exit; exit;
} }
} }
if ($row['online_pagecount'] >= $online_warncount && $row['online_ip'] != "127.0.0.1") if ($row['online_pagecount'] >= $online_warncount && $row['online_ip'] != "127.0.0.1")
{ {

View File

@@ -4,9 +4,9 @@
| e107 website system - Language File. | e107 website system - Language File.
| |
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_banlist.php,v $ | $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_banlist.php,v $
| $Revision: 1.8 $ | $Revision: 1.9 $
| $Date: 2008-12-23 15:18:31 $ | $Date: 2009-02-03 21:16:15 $
| $Author: secretr $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
define("BANLAN_1", "Ban removed."); define("BANLAN_1", "Ban removed.");
@@ -85,7 +85,7 @@ define('BANLAN_74','Banlist Maintenance');
define('BANLAN_75','Remove expired bans from list'); define('BANLAN_75','Remove expired bans from list');
define('BANLAN_76','Execute'); define('BANLAN_76','Execute');
define('BANLAN_77','Messages/Ban Periods'); define('BANLAN_77','Messages/Ban Periods');
define('BANLAN_78',''); define('BANLAN_78','Hit count exceeded (--HITS-- requests within allotted time)');
define('BANLAN_79',''); define('BANLAN_79','');
define('BANLAN_80',''); define('BANLAN_80','');