summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-02-18 23:29:31 -0800
committerPatrick Davison <snapwilliam@gmail.com>2013-02-18 23:29:31 -0800
commit895690e7e54079851d534bea2b35a25840434ac7 (patch)
tree0759ec35c368ce965380860153ac744482c299dd
parent05b682c22f2dadf483b8a2842b4065acc34872af (diff)
downloadpathery-895690e7e54079851d534bea2b35a25840434ac7.tar.xz
More chat fixes
-rw-r--r--ajax/chat.ajax.php2
-rw-r--r--includes/chats.php12
-rw-r--r--pages/admin.php19
-rw-r--r--pages/chat.php2
4 files changed, 17 insertions, 18 deletions
diff --git a/ajax/chat.ajax.php b/ajax/chat.ajax.php
index 55f7718..1cbd6be 100644
--- a/ajax/chat.ajax.php
+++ b/ajax/chat.ajax.php
@@ -20,7 +20,7 @@ if ($_REQUEST['messages']) {
$r[0]['message'] = 'You have been muted; You are muted until '.$date." (The current time is: ".date("Y-m-d H:i:s").")";
$r[0]['secondsSince'] = 0;
$r[0]['displayName'] = 'SERVER';
- $r[0]['ID'] = -1;
+ $r[0]['userID'] = -1;
echo json_encode($r);
exit;
}
diff --git a/includes/chats.php b/includes/chats.php
index a399d86..dcd46c9 100644
--- a/includes/chats.php
+++ b/includes/chats.php
@@ -12,7 +12,7 @@ function isMuted($userID) {
$sql = "SELECT `dateChatGaggedUntil` FROM `users`
WHERE `ID` = ?
- AND `dateChatGaggedUntil` > CURDATE()";
+ AND `dateChatGaggedUntil` > NOW()";
$stmt = $mysqli->prepare($sql);
$stmt->bind_param("i", $userID);
$stmt->execute();
@@ -22,6 +22,16 @@ function isMuted($userID) {
else return false;
}
+function muteUser($userID, $numMinutes) {
+ global $mysqli;
+ $stmt = $mysqli->prepare("UPDATE `users`
+ SET `dateChatGaggedUntil` = ADDDATE(NOW(), INTERVAL ? MINUTE)
+ WHERE `ID` = ?");
+ $stmt->bind_param('ii', $numMinutes, $userID);
+ $stmt->execute();
+ return;
+}
+
function addChat($userID, $message) {
global $mysqli;
if ($message == '') return;
diff --git a/pages/admin.php b/pages/admin.php
index d86d042..24feda4 100644
--- a/pages/admin.php
+++ b/pages/admin.php
@@ -11,6 +11,7 @@ include_once('./includes/maps.php');
include_once('./includes/mapoftheday.php');
include_once('./includes/sqli.php');
include_once('./includes/playerStats.php');
+include_once('./includes/chats.php');
if ($_GET['applyall'] == 'true') {
echo "Apply-All command heard. Executing...";
@@ -43,22 +44,10 @@ else if ($_GET['deleteErrors'] == 'true') {
}
else if ($_POST['muteUser'] == 'true') {
- muteUser($_POST['muteUserID'], $_POST['muteHours']);
- echo "User ID ".$_POST['muteUserID']." muted for ".$_POST['muteHours']." hours";
+ muteUser($_POST['muteUserID'], $_POST['muteMinutes']);
+ echo "User ID ".$_POST['muteUserID']." muted for ".$_POST['muteMinutes']." minutes";
}
-function muteUser($userID, $numHours) {
- global $mysqli;
- $stmt = $mysqli->prepare("UPDATE `users`
- SET `dateChatGaggedUntil` = ADDDATE(CURDATE(), INTERVAL ? HOUR)
- WHERE `ID` = ?");
- $stmt->bind_param('ii', $numHours, $userID);
- $stmt->execute();
- return;
-}
-
-
-
$sql = "SELECT `ID`, `displayName`, `dateJoined`, `dateLogin`, `email`, `isAdmin` FROM `users`";
$result = mysql_query($sql);
@@ -79,7 +68,7 @@ $result = mysql_query($sql);
<input type="hidden" name="muteUser" value="true">
<input type="submit" value='MUTE USER'>
USERID:<input type="text" name="muteUserID" id="muteUserID" value="" maxlength="20" autocomplete="off" >
- LENGTH IN HOURS:<input type="text" name="muteHours" id="muteHours" value="" maxlength="20" autocomplete="off" >
+ LENGTH IN MINUTES:<input type="text" name="muteMinutes" id="muteMinutes" value="" maxlength="20" autocomplete="off" >
</form>
</center>
diff --git a/pages/chat.php b/pages/chat.php
index 8aec336..ba99694 100644
--- a/pages/chat.php
+++ b/pages/chat.php
@@ -87,7 +87,7 @@ function getChatDone(data) {
p = p+ " <div class='chatColumn2'>";
if (user.userID == '-1') {
- p = p+ "<span class='chatUsername'><a href='home' style='color:#FA3'>";
+ p = p+ "<span class='chatUsername'><a href='home'>";
} else {
p = p+ "<span class='chatUsername'><a href='achievements?id="+user.userID+"' style='color:"+user.displayColor+"'>";
}