mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-10 06:36:07 +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;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ include("menu.tpl");
|
||||
<input class="check" type="checkbox" id="s10" name="s10" onclick="Allmsg(this.form);" />
|
||||
</th>
|
||||
<th colspan="2" class="buttons">
|
||||
<button name="delmsg" value="delete" id="btn_delete" class="trav_buttons" alt="delete" /> Delete </button <button name="start" value="Back" alt="Back" id="btn_back" class="trav_buttons" /> Back </button</th>
|
||||
<button name="delmsg" value="delete" id="btn_delete" class="trav_buttons">Delete</button> <button name="start" value="Back" id="btn_back" class="trav_buttons">Back</button></th>
|
||||
<th class="navi"><?php
|
||||
if(!isset($_GET['s']) && count($message->archived1) < 10) {
|
||||
echo "«»";
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<?php } ?>
|
||||
</th>
|
||||
<th colspan="2" class="buttons">
|
||||
<button name="delmsg" value="delete" id="btn_delete" class="trav_buttons" alt="delete" /> Delete </button>
|
||||
<button name="delmsg" value="delete" id="btn_delete" class="trav_buttons"> Delete </button>
|
||||
<?php if($session->plus) { echo "<button name=\"archive\" value=\"Archive\" id=\"btn_archiv\" class=\"trav_buttons\" alt=\"Archive\" /> Archive </button>"; } ?>
|
||||
<input name="ft" value="m3" type="hidden" />
|
||||
</th><th class="navi"><?php
|
||||
|
||||
@@ -43,7 +43,7 @@ include("menu.tpl");
|
||||
<input type="hidden" name="ft" value="m1" />
|
||||
<input type="hidden" name="t" value="1" />
|
||||
<p class="btn">
|
||||
<button value="" name="s1" id="btn_reply" class="trav_buttons" alt="answer" /> Answer </button>
|
||||
<button value="" name="s1" id="btn_reply" class="trav_buttons">Answer</button>
|
||||
</p>
|
||||
</div>
|
||||
<div id="read_foot" class="msg_foot"></div>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<?php } else { ?>
|
||||
<input class="check" type="checkbox" id="s10" name="s10" onclick="Allmsg(this.form);" />
|
||||
<?php } ?></th>
|
||||
<th colspan="2" class="buttons"><input name="delmsg" value="delete" type="image" id="btn_delete" class="dynamic_img" src="img/x.gif" alt="delete" /></th><th class="navi"><?php
|
||||
<th colspan="2" class="buttons"><button value="delete" name="delmsg" id="btn_delete" class="trav_buttons">Delete</button></th><th class="navi"><?php
|
||||
if(!isset($_GET['s']) && count($message->sent1) < 10) {
|
||||
echo "«»";
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ Reply: ".$database->getUserField($id,'username',0)."
|
||||
</script>
|
||||
<p class="btn">
|
||||
<input type="hidden" name="ft" value="m2" />
|
||||
<input type="image" value="" name="s1" id="btn_send" class="dynamic_img" src="img/x.gif" alt="send" onclick="this.disabled=true;this.form.submit();" tabindex=4; />
|
||||
<button name="delmsg" value="" id="btn_save" class="trav_buttons" onclick="this.disabled=true;this.form.submit();" tabindex="4">Send</button>
|
||||
<?php
|
||||
if ($session->access == ADMIN && ADMIN_RECEIVE_SUPPORT_MESSAGES && !empty($_GET['mid'])) {
|
||||
?><br />
|
||||
|
||||
Reference in New Issue
Block a user