mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-24 05:26:19 +00:00
General fixes
+Fixed a bug that didn't permit to delete/archive/unarchive messages
This commit is contained in:
+5
-13
@@ -4239,7 +4239,6 @@ References: User ID/Message ID, Mode
|
||||
}
|
||||
}
|
||||
|
||||
global $session;
|
||||
switch($mode) {
|
||||
case 1:
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target IN($id) and send = 0 and archived = 0 ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC');
|
||||
@@ -4252,19 +4251,13 @@ References: User ID/Message ID, Mode
|
||||
break;
|
||||
case 4:
|
||||
$show_target = $session->uid;
|
||||
|
||||
if ($session->access == ADMIN && ADMIN_RECEIVE_SUPPORT_MESSAGES) {
|
||||
$show_target .= ',1';
|
||||
}
|
||||
|
||||
if ($session->access == MULTIHUNTER) {
|
||||
$show_target .= ',5';
|
||||
}
|
||||
if ($session->access == ADMIN && ADMIN_RECEIVE_SUPPORT_MESSAGES) $show_target .= ',1';
|
||||
if ($session->access == MULTIHUNTER) $show_target .= ',5';
|
||||
|
||||
$q = "UPDATE " . TB_PREFIX . "mdata set viewed = 1 where id = $id AND target IN(".$show_target.")";
|
||||
break;
|
||||
case 5:
|
||||
$q = "UPDATE " . TB_PREFIX . "mdata set deltarget = 1,viewed = 1 where id IN(".implode(', ', $id).")";
|
||||
$q = "UPDATE " . TB_PREFIX . "mdata set deltarget = 1, viewed = 1 where id IN(".implode(', ', $id).")";
|
||||
break;
|
||||
case 6:
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "mdata where target IN($id) and send = 0 and archived = 1 ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC');
|
||||
@@ -4273,7 +4266,7 @@ References: User ID/Message ID, Mode
|
||||
$q = "UPDATE " . TB_PREFIX . "mdata set delowner = 1 where id IN(".implode(', ', $id).")";
|
||||
break;
|
||||
case 8:
|
||||
$q = "UPDATE " . TB_PREFIX . "mdata set deltarget = 1,delowner = 1,viewed = 1 where IN(".implode(', ', $id).")";
|
||||
$q = "UPDATE " . TB_PREFIX . "mdata set deltarget = 1, delowner = 1, viewed = 1 where id IN(".implode(', ', $id).")";
|
||||
break;
|
||||
case 9:
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target IN($id) and send = 0 and archived = 0 and deltarget = 0 ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC');
|
||||
@@ -4289,9 +4282,8 @@ References: User ID/Message ID, Mode
|
||||
if($mode <= 3 || $mode == 6 || $mode > 8) {
|
||||
$result = mysqli_query($this->dblink,$q);
|
||||
return $this->mysqli_fetch_all($result);
|
||||
} else {
|
||||
return mysqli_query($this->dblink,$q);
|
||||
}
|
||||
else return mysqli_query($this->dblink,$q);
|
||||
}
|
||||
|
||||
function unarchiveNotice($id) {
|
||||
|
||||
+10
-22
@@ -48,6 +48,7 @@ class Message {
|
||||
}
|
||||
|
||||
public function procMessage($post) {
|
||||
|
||||
if(isset($post['ft'])) {
|
||||
switch($post['ft']) {
|
||||
case "m1":
|
||||
@@ -61,12 +62,9 @@ class Message {
|
||||
case "m3":
|
||||
case "m4":
|
||||
case "m5":
|
||||
if(isset($post['delmsg_x'])) {
|
||||
$this->removeMessage($post);
|
||||
$this->header($get);
|
||||
}
|
||||
if(isset($post['archive_x'])) $this->archiveMessage($post);
|
||||
if(isset($post['start_x'])) $this->unarchiveMessage($post);
|
||||
if(isset($post['delmsg']))$this->removeMessage($post);
|
||||
if(isset($post['archive'])) $this->archiveMessage($post);
|
||||
if(isset($post['start'])) $this->unarchiveMessage($post);
|
||||
break;
|
||||
case "m6":
|
||||
$this->createNote($post);
|
||||
@@ -209,7 +207,7 @@ class Message {
|
||||
|
||||
private function removeMessage($post) {
|
||||
global $database, $session;
|
||||
|
||||
|
||||
$post = $database->escape($post);
|
||||
$mode5updates = $mode7updates = $mode8updates = [];
|
||||
|
||||
@@ -218,9 +216,7 @@ class Message {
|
||||
$message1 = mysqli_query($database->dblink, "SELECT target, owner FROM " . TB_PREFIX . "mdata where id = " . (int)$post['n' . $i] . "");
|
||||
$message = mysqli_fetch_array($message1);
|
||||
|
||||
if($message['target'] == $session->uid && $message['owner'] == $session->uid){
|
||||
$mode8updates[] = $post['n' . $i];
|
||||
}
|
||||
if($message['target'] == $session->uid && $message['owner'] == $session->uid) $mode8updates[] = $post['n' . $i];
|
||||
else if($message['target'] == $session->uid) $mode5updates[] = $post['n' . $i];
|
||||
else if($message['owner'] == $session->uid) $mode7updates[] = $post['n' . $i];
|
||||
}
|
||||
@@ -239,11 +235,8 @@ class Message {
|
||||
|
||||
$archIDs = [];
|
||||
for($i = 1; $i <= 10; $i++) {
|
||||
if(isset($post['n' . $i])) {
|
||||
$archIDs[] = $post['n' . $i];
|
||||
}
|
||||
if(isset($post['n'.$i])) $archIDs[] = $post['n'.$i];
|
||||
}
|
||||
|
||||
$database->setArchived($archIDs);
|
||||
|
||||
header("Location: nachrichten.php");
|
||||
@@ -255,11 +248,8 @@ class Message {
|
||||
|
||||
$normIDs = [];
|
||||
for($i = 1; $i <= 10; $i++) {
|
||||
if(isset($post['n' . $i])) {
|
||||
$normIDs[] = $post['n' . $i];
|
||||
}
|
||||
if(isset($post['n'.$i])) $normIDs[] = $post['n'.$i];
|
||||
}
|
||||
|
||||
$database->setNorm($normIDs);
|
||||
|
||||
header("Location: nachrichten.php");
|
||||
@@ -626,12 +616,11 @@ class Message {
|
||||
}
|
||||
|
||||
private function findInbox($id) {
|
||||
if(count($this->inbox)){
|
||||
if(!empty($this->inbox)){
|
||||
foreach($this->inbox as $message){
|
||||
if($message['id'] == $id) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -640,8 +629,7 @@ class Message {
|
||||
foreach($this->sent as $message){
|
||||
if($message['id'] == $id) return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user