big update

This commit is contained in:
unknown
2012-05-13 18:51:08 +03:00
parent 185227c5d2
commit 10df3e2068
24 changed files with 336 additions and 115 deletions
+1 -3
View File
@@ -485,7 +485,7 @@ private function loyaltyRegeneration() {
$database->query($q);
$q = "UPDATE ".TB_PREFIX."odata set `crop` = `maxcrop` WHERE `crop` > `maxcrop`";
$database->query($q);
$q = "UPDATE ".TB_PREFIX."odata set `crop` = 100 WHERE `crop` < 0";
$q = "UPDATE ".TB_PREFIX."odata set `crop` = 0 WHERE `crop` < 0";
$database->query($q);
$q = "UPDATE ".TB_PREFIX."odata set `wood` = 0 WHERE `wood` < 0";
$database->query($q);
@@ -510,8 +510,6 @@ private function loyaltyRegeneration() {
$database->query($q);
$q = "UPDATE ".TB_PREFIX."vdata set `crop` = `maxcrop` WHERE `crop` > `maxcrop`";
$database->query($q);
$q = "UPDATE ".TB_PREFIX."vdata set `crop` = 100 WHERE `crop` < 0";
$database->query($q);
$q = "UPDATE ".TB_PREFIX."vdata set `wood` = 0 WHERE `wood` < 0";
$database->query($q);
$q = "UPDATE ".TB_PREFIX."vdata set `clay` = 0 WHERE `clay` < 0";
+25 -3
View File
@@ -1424,7 +1424,7 @@
function sendMessage($client, $owner, $topic, $message, $send) {
$time = time();
$q = "INSERT INTO " . TB_PREFIX . "mdata values (0,$client,$owner,'$topic',\"$message\",0,0,$send,$time)";
$q = "INSERT INTO " . TB_PREFIX . "mdata values (0,$client,$owner,'$topic',\"$message\",0,0,$send,$time,0,0)";
return mysql_query($q, $this->connection);
}
@@ -1455,7 +1455,6 @@
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target = $id and send = 0 and archived = 0 ORDER BY time DESC";
break;
case 2:
// removed send no longer needed as we dont send 2 messages any more just 1
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE owner = $id ORDER BY time DESC";
break;
case 3:
@@ -1465,11 +1464,17 @@
$q = "UPDATE " . TB_PREFIX . "mdata set viewed = 1 where id = $id AND target = $session->uid";
break;
case 5:
$q = "DELETE FROM " . TB_PREFIX . "mdata where id = $id";
$q = "UPDATE " . TB_PREFIX . "mdata set deltarget = 1,viewed = 1 where id = $id";
break;
case 6:
$q = "SELECT * FROM " . TB_PREFIX . "mdata where target = $id and send = 0 and archived = 1";
break;
case 7:
$q = "UPDATE " . TB_PREFIX . "mdata set delowner = 1 where id = $id";
break;
case 8:
$q = "UPDATE " . TB_PREFIX . "mdata set deltarget = 1,delowner = 1,viewed = 1 where id = $id";
break;
}
if($mode <= 3 || $mode == 6) {
$result = mysql_query($q, $this->connection);
@@ -1479,6 +1484,23 @@
}
}
function getDelSent($uid) {
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE owner = $uid and delowner = 1 ORDER BY time DESC";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
}
function getDelInbox($uid) {
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target = $uid and deltarget = 1 ORDER BY time DESC";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
}
function getDelArchive($uid) {
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target = $uid and archived = 1 and deltarget = 1 OR owner = $uid and archived = 1 and delowner = 1 ORDER BY time DESC";
return mysql_query($q, $this->connection);
}
function unarchiveNotice($id) {
$q = "UPDATE " . TB_PREFIX . "ndata set ntype = archive, archive = 0 where id = $id";
return mysql_query($q, $this->connection);
+9 -1
View File
@@ -220,10 +220,18 @@
}
private function removeMessage($post) {
global $database;
global $database,$session;
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$message1 = mysql_query("SELECT * FROM " . TB_PREFIX . "mdata where id = ".$post['n' . $i]."");
$message = mysql_fetch_array($message1);
if($message['target'] == $session->uid && $message['owner'] == $session->uid){
$database->getMessage($post['n' . $i], 8);
}else if($message['target'] == $session->uid){
$database->getMessage($post['n' . $i], 5);
}else if($message['owner'] == $session->uid){
$database->getMessage($post['n' . $i], 7);
}
}
}
header("Location: nachrichten.php");