Empty commit

This commit is contained in:
Git 2013-02-06 08:00:17 +00:00
parent 7748742c9f
commit b1324098d8
10 changed files with 79 additions and 78 deletions

View File

@ -6,14 +6,17 @@ class Tools {
* @param string $IP
*/
public static function site_ban_ip($IP) {
global $DB, $Cache;
global $DB, $Cache, $Debug;
$A = substr($IP, 0, strcspn($IP, '.'));
$IPNum = Tools::ip_to_unsigned($IP);
$IPBans = $Cache->get_value('ip_bans');
$IPBans = $Cache->get_value('ip_bans_'.$A);
if (!is_array($IPBans)) {
$DB->query("SELECT ID, FromIP, ToIP FROM ip_bans");
$SQL = sprintf("SELECT ID, FromIP, ToIP FROM ip_bans WHERE FromIP BETWEEN %d << 24 AND (%d << 24) - 1", $A, $A+1);
$DB->query($SQL);
$IPBans = $DB->to_array(0, MYSQLI_NUM);
$Cache->cache_value('ip_bans', $IPBans, 0);
$Cache->cache_value('ip_bans_'.$A, $IPBans, 0);
}
$Debug->log_var($IPBans, 'IP bans for class '.$A);
foreach ($IPBans as $Index => $IPBan) {
list ($ID, $FromIP, $ToIP) = $IPBan;
if ($IPNum >= $FromIP && $IPNum <= $ToIP) {

View File

@ -420,7 +420,6 @@ CREATE TABLE `ip_bans` (
`Reason` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `FromIP_2` (`FromIP`,`ToIP`),
KEY `FromIP` (`FromIP`,`ToIP`),
KEY `ToIP` (`ToIP`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@ -1575,7 +1574,8 @@ CREATE TABLE `wiki_revisions` (
`Title` varchar(100) DEFAULT NULL,
`Body` mediumtext,
`Date` datetime DEFAULT NULL,
`Author` int(10) DEFAULT NULL
`Author` int(10) DEFAULT NULL,
KEY `ID_Revision` (`ID`,`Revision`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `wiki_torrents` (

View File

@ -172,7 +172,7 @@
// Function to log a user's login attempt
function log_attempt($UserID) {
global $DB, $AttemptID, $Attempts, $Bans, $BannedUntil, $Time;
global $DB, $Cache, $AttemptID, $Attempts, $Bans, $BannedUntil, $Time;
if($AttemptID) { // User has attempted to log in recently
$Attempts++;
if ($Attempts>5) { // Only 6 allowed login attempts, ban user's IP
@ -200,7 +200,8 @@ function log_attempt($UserID) {
$DB->query("INSERT INTO ip_bans
(FromIP, ToIP, Reason) VALUES
('$IP','$IP', 'Automated ban per >60 failed login attempts')");
$Cache->delete_value('ip_bans');
$A = substr($_SERVER['REMOTE_ADDR'], 0, strcspn($_SERVER['REMOTE_ADDR'], '.'));
$Cache->delete_value('ip_bans_'.$A);
}
}
} else {

View File

@ -47,7 +47,7 @@
<td>Down</td>
<td>Ratio</td>
<td>Required Ratio</td>
<td>Defecit</td>
<td>Deficit</td>
<td>Gamble</td>
<td>Registered</td>
<td>Remaining</td>

View File

@ -104,7 +104,7 @@
<div class="thin">
<? if(!isset($_GET['page'])) { ?>
<div class="box pad">
<img src="http://chart.apis.google.com/chart?cht=lc&chs=820x160&chco=000D99,99000D&chg=0,-1,1,1&chxt=y,x&chxs=0,h&chxl=1:|<?=implode('|',$Labels)?>&chxr=0,0,<?=$Max?>&chd=t:<?=implode(',',$InFlow)?>|<?=implode(',',$OutFlow)?>&chls=2,4,0&chdl=New+Registrations|Disabled+Users&amp;chf=bg,s,FFFFFF00" />
<img src="http://chart.apis.google.com/chart?cht=lc&amp;chs=820x160&amp;chco=000D99,99000D&amp;chg=0,-1,1,1&amp;chxt=y,x&amp;chxs=0,h&amp;chxl=1:|<?=implode('|',$Labels)?>&amp;chxr=0,0,<?=$Max?>&amp;chd=t:<?=implode(',',$InFlow)?>|<?=implode(',',$OutFlow)?>&amp;chls=2,4,0&amp;chdl=New+Registrations|Disabled+Users&amp;chf=bg,s,FFFFFF00" alt="User Flow vs. Time" />
</div>
<? } ?>
<div class="linkbox">

View File

@ -40,10 +40,9 @@
<td colspan="4">Add Email or Domain to Blacklist</td>
</tr>
<tr class="rowa">
<form class="add_form" name="email_blacklist" action="tools.php"
method="post">
<input type="hidden" name="action" value="eb_alter" /> <input
type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<form class="add_form" name="email_blacklist" action="tools.php" method="post">
<input type="hidden" name="action" value="eb_alter" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<td><input type="text" name="email" size="30" /></td>
<td colspan="2"><input type="text" name="comment" size="60" /></td>
<td><input type="submit" value="Create" /></td>
@ -54,18 +53,19 @@
foreach ($Results as $Result) {
?>
<tr>
<form class="manage_form" name="email_blacklist" action="tools.php"
method="post">
<td><input type="hidden" name="action" value="eb_alter" /> <input
type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input
type="hidden" name="id" value="<?=$Result['ID']?>" /> <input
type="text" name="email" value="<?=display_str($Result['Email'])?>"
size="30" /></td>
<td><input type="text" name="comment"
value="<?=display_str($Result['Comment'])?>" size="60" /></td>
<form class="manage_form" name="email_blacklist" action="tools.php" method="post">
<td>
<input type="hidden" name="action" value="eb_alter" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="id" value="<?=$Result['ID']?>" />
<input type="text" name="email" value="<?=display_str($Result['Email'])?>" size="30" />
</td>
<td><input type="text" name="comment" value="<?=display_str($Result['Comment'])?>" size="60" /></td>
<td><?=Users::format_username($Result ['UserID'], false, false, false)?><br /><?=time_diff($Result ['Time'], 1)?></td>
<td><input type="submit" name="submit" value="Edit" /> <input
type="submit" name="submit" value="Delete" /></td>
<td>
<input type="submit" name="submit" value="Edit" />
<input type="submit" name="submit" value="Delete" />
</td>
</form>
</tr>
<? }?>

View File

@ -1,8 +1,7 @@
<?
View::show_header('Manage Permissions');
?>
<script type="text/javascript" language="javascript">
//<![CDATA[
<script type="text/javascript">//<![CDATA[
function confirmDelete(id) {
if (confirm("Are you sure you want to remove this permission class?")) {
location.href="tools.php?action=permissions&removeid="+id;
@ -15,7 +14,7 @@ function confirmDelete(id) {
<div class="header">
<div class="linkbox">
[<a href="tools.php?action=permissions&amp;id=new">Create a new permission set</a>]
[<a href="tools.php">Back to Tools</a>]
[<a href="tools.php">Back to tools</a>]
</div>
</div>
<?

View File

@ -30,19 +30,19 @@
<div class="header">
<h2>Tag Aliases</h2>
<div class="linkbox">
[<a href="tools.php?action=tag_aliases&amp;order=goodtags">Sort by Good Tags</a>]
[<a href="tools.php?action=tag_aliases&amp;order=badtags">Sort by Bad Tags</a>]
[<a href="tools.php?action=tag_aliases&amp;order=goodtags">Sort by good tags</a>]
[<a href="tools.php?action=tag_aliases&amp;order=badtags">Sort by bad tags</a>]
</div>
</div>
<table width="100%">
<tr class="colhead">
<td>Tag</td>
<td>Renamed From</td>
<td>Renamed from</td>
<td>Submit</td>
</tr>
<tr/>
<tr>
<form class="add_form" name="aliases" action="" method="post">
<form class="add_form" name="aliases" method="post" action="">
<input type="hidden" name="newalias" value="1" />
<td>
<input type="text" name="aliastag" />

View File

@ -24,11 +24,9 @@ function CollageSubscribe(collageid) {
ajax.get("userhistory.php?action=collage_subscribe&collageid=" + collageid + "&auth=" + authkey, function() {
var subscribeLink = $("#subscribelink" + collageid).raw();
if(subscribeLink) {
if(subscribeLink.firstChild.nodeValue.substr(1,1) == 'U') {
subscribeLink.firstChild.nodeValue = "[Subscribe]";
} else {
subscribeLink.firstChild.nodeValue = "[Unsubscribe]";
}
subscribeLink.firstChild.nodeValue = subscribeLink.firstChild.nodeValue.charAt(0) == 'U'
? "Subscribe"
: "Unsubscribe";
}
});
}