mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-18 12:11:36 +00:00
Empty commit
This commit is contained in:
parent
7748742c9f
commit
b1324098d8
@ -6,22 +6,25 @@ class Tools {
|
||||
* @param string $IP
|
||||
*/
|
||||
public static function site_ban_ip($IP) {
|
||||
global $DB, $Cache;
|
||||
$IPNum = Tools::ip_to_unsigned($IP);
|
||||
$IPBans = $Cache->get_value('ip_bans');
|
||||
if (!is_array($IPBans)) {
|
||||
$DB->query("SELECT ID, FromIP, ToIP FROM ip_bans");
|
||||
$IPBans = $DB->to_array(0, MYSQLI_NUM);
|
||||
$Cache->cache_value('ip_bans', $IPBans, 0);
|
||||
}
|
||||
foreach ($IPBans as $Index => $IPBan) {
|
||||
list ($ID, $FromIP, $ToIP) = $IPBan;
|
||||
if ($IPNum >= $FromIP && $IPNum <= $ToIP) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
global $DB, $Cache, $Debug;
|
||||
$A = substr($IP, 0, strcspn($IP, '.'));
|
||||
$IPNum = Tools::ip_to_unsigned($IP);
|
||||
$IPBans = $Cache->get_value('ip_bans_'.$A);
|
||||
if (!is_array($IPBans)) {
|
||||
$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_'.$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) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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` (
|
||||
|
@ -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 {
|
||||
|
@ -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>
|
||||
|
@ -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&chf=bg,s,FFFFFF00" />
|
||||
<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&chf=bg,s,FFFFFF00" alt="User Flow vs. Time" />
|
||||
</div>
|
||||
<? } ?>
|
||||
<div class="linkbox">
|
||||
|
@ -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>
|
||||
@ -53,19 +52,20 @@
|
||||
|
||||
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>
|
||||
<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>
|
||||
<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>
|
||||
<? }?>
|
||||
|
@ -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,14 +14,14 @@ function confirmDelete(id) {
|
||||
<div class="header">
|
||||
<div class="linkbox">
|
||||
[<a href="tools.php?action=permissions&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>
|
||||
<?
|
||||
$DB->query("SELECT p.ID,p.Name,p.Level,p.Secondary,COUNT(u.ID)+COUNT(DISTINCT l.UserID)
|
||||
FROM permissions AS p
|
||||
LEFT JOIN users_main AS u ON u.PermissionID=p.ID
|
||||
LEFT JOIN users_levels AS l ON l.PermissionID=p.ID
|
||||
$DB->query("SELECT p.ID,p.Name,p.Level,p.Secondary,COUNT(u.ID)+COUNT(DISTINCT l.UserID)
|
||||
FROM permissions AS p
|
||||
LEFT JOIN users_main AS u ON u.PermissionID=p.ID
|
||||
LEFT JOIN users_levels AS l ON l.PermissionID=p.ID
|
||||
GROUP BY p.ID ORDER BY p.Secondary ASC, p.Level ASC");
|
||||
if($DB->record_count()) {
|
||||
?>
|
||||
|
@ -4,45 +4,45 @@
|
||||
|
||||
View::show_header('Tag Aliases');
|
||||
|
||||
$orderby = ($_GET['order']) == "badtags" ? "BadTag" : "AliasTag";
|
||||
$orderby = ($_GET['order']) == "badtags" ? "BadTag" : "AliasTag";
|
||||
|
||||
if (isset($_POST['newalias'])) {
|
||||
$badtag = mysql_escape_string($_POST['badtag']);
|
||||
$aliastag = mysql_escape_string($_POST['aliastag']);
|
||||
$badtag = mysql_escape_string($_POST['badtag']);
|
||||
$aliastag = mysql_escape_string($_POST['aliastag']);
|
||||
|
||||
$DB -> query("INSERT INTO tag_aliases (BadTag, AliasTag) VALUES ('$badtag', '$aliastag')");
|
||||
$DB -> query("INSERT INTO tag_aliases (BadTag, AliasTag) VALUES ('$badtag', '$aliastag')");
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['changealias'])) {
|
||||
$aliasid = $_POST['aliasid'];
|
||||
$badtag = mysql_escape_string($_POST['badtag']);
|
||||
$aliastag = mysql_escape_string($_POST['aliastag']);
|
||||
$aliasid = $_POST['aliasid'];
|
||||
$badtag = mysql_escape_string($_POST['badtag']);
|
||||
$aliastag = mysql_escape_string($_POST['aliastag']);
|
||||
|
||||
if ($_POST['save']) {
|
||||
$DB -> query("UPDATE tag_aliases SET BadTag = '$badtag', AliasTag = '$aliastag' WHERE ID = '$aliasid' ");
|
||||
}
|
||||
if ($_POST['delete']) {
|
||||
$DB -> query("DELETE FROM tag_aliases WHERE ID = '$aliasid'");
|
||||
}
|
||||
if ($_POST['save']) {
|
||||
$DB -> query("UPDATE tag_aliases SET BadTag = '$badtag', AliasTag = '$aliastag' WHERE ID = '$aliasid' ");
|
||||
}
|
||||
if ($_POST['delete']) {
|
||||
$DB -> query("DELETE FROM tag_aliases WHERE ID = '$aliasid'");
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="header">
|
||||
<h2>Tag Aliases</h2>
|
||||
<div class="linkbox">
|
||||
[<a href="tools.php?action=tag_aliases&order=goodtags">Sort by Good Tags</a>]
|
||||
[<a href="tools.php?action=tag_aliases&order=badtags">Sort by Bad Tags</a>]
|
||||
</div>
|
||||
[<a href="tools.php?action=tag_aliases&order=goodtags">Sort by good tags</a>]
|
||||
[<a href="tools.php?action=tag_aliases&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" />
|
||||
|
@ -3,21 +3,21 @@
|
||||
if(!check_perms('admin_manage_ipbans')) { error(403); }
|
||||
if(isset($_GET['perform'])) {
|
||||
if($_GET['perform'] == 'delete') {
|
||||
if(!is_number($_GET['id']) || $_GET['id'] == ''){ error(0); }
|
||||
$DB->query('DELETE FROM ip_bans WHERE ID='.$_GET['id']);
|
||||
if(!is_number($_GET['id']) || $_GET['id'] == ''){ error(0); }
|
||||
$DB->query('DELETE FROM ip_bans WHERE ID='.$_GET['id']);
|
||||
$Bans = $Cache->delete_value('ip_bans');
|
||||
}
|
||||
elseif($_GET['perform'] == 'create') {
|
||||
$Notes = db_string($_GET['notes']);
|
||||
$IP = Tools::ip_to_unsigned($_GET['ip']); //Sanitized by Validation regex
|
||||
$DB->query("INSERT INTO ip_bans
|
||||
(FromIP, ToIP, Reason) VALUES
|
||||
('$IP','$IP', '$Notes')");
|
||||
$ID = $DB->inserted_id();
|
||||
$Bans = $Cache->get_value('ip_bans');
|
||||
$Bans[$ID] = array($ID, $Start, $End);
|
||||
$Cache->cache_value('ip_bans', $Bans, 0);
|
||||
}
|
||||
$IP = Tools::ip_to_unsigned($_GET['ip']); //Sanitized by Validation regex
|
||||
$DB->query("INSERT INTO ip_bans
|
||||
(FromIP, ToIP, Reason) VALUES
|
||||
('$IP','$IP', '$Notes')");
|
||||
$ID = $DB->inserted_id();
|
||||
$Bans = $Cache->get_value('ip_bans');
|
||||
$Bans[$ID] = array($ID, $Start, $End);
|
||||
$Cache->cache_value('ip_bans', $Bans, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user