Initial commit
[2ch-be.git] / dev-test / bak / message2.php
blob8a7a48f0a668fbe61cd872df41d227373e249498
1 <?php
2 include('encrypt.php');
3 require 'include/header.php';
4 $inbox = new Message;
5 $uid = $inbox->GetID($_COOKIE['DMDM'],$id_mail_path);
6 $user = $inbox->FindUser($uid,$id_mail_path);
7 if ($user<>false) {
8 $d = strip_tags(addslashes(trim($_GET['d'])));
9 $messages = $inbox->specificMDB($user, $d, FALSE);
10 $senderCounter = $inbox->specificMDB($user, $d, TRUE);
11 $file = $_SESSION['sLoggedDir'].$d.".dat";
12 $value = $inbox->getContent2($_SESSION['sLoggedDir'].$d.".dat");
13 $max = max($value);
14 $ff = $inbox->within_str(max($value), "<read>", "</read>");
16 if ($uid <> trim($inbox->within_str($senderCounter, "<from>", "</from>"))) {
17 $kausap = trim($inbox->within_str($senderCounter, "<from>", "</from>"));
18 } else {
19 $kausap = trim($inbox->within_str($senderCounter, "<to>", "</to>"));
21 $checkifban = $inbox->CheckBanList($user,$kausap);
22 if ($checkifban)
23 $bansya = true;
24 else
25 $bansya = false;
26 // End of set, check for user block
28 if($ff==0){
29 if(file_exists($file)){
30 $arr = file($file);
31 $newLine = substr($max, 0, -15)."<read>1</read>";
32 $lastLine = count($value)-1;
33 unset($arr[$lastLine]);
34 $arr[$lastLine] = $newLine.PHP_EOL;
35 file_put_contents($file,implode($arr));
36 header("Location: message.php?d=$d");
37 }else{
38 header("Location: inbox.php");
42 if (isset($_POST['block'])) {
43 $block = $inbox->BlockUser($user,$kausap);
44 if ($block) {
45 echo "ユーザーがブロックされた!このユーザーからメッセージを受信することはできません";
46 header('Location: '.$_SERVER['REQUEST_URI']);
47 } else {
48 echo "エラー!ユーザーをブロックすることはできません!";
51 if (isset($_POST['ublock'])) {
52 $block = $inbox->UnblockUser($user,$kausap);
53 if ($block) {
54 echo "ユーザーがブロックされていない!これで、このユーザーからのメッセージを受け取ることができます";
55 header('Location: '.$_SERVER['REQUEST_URI']);
56 } else {
57 echo "エラー!ユーザーブロックを解除することはできません!";
61 <div class="well well-lg">
62 <?php
63 include "include/nav.php";
64 echo "<h4>被写体: ".urldecode($inbox->within_str($senderCounter, "<subj>", "</subj>"))."</h4>";
66 <div id="block_user" style="display:none" class="alert alert-warning">
67 <form method="post">
68 あなたはこのユーザーをブロックしますか?
69 <input type="submit" class="btn btn-default btn-sm" name="block" value="はい">&nbsp;&nbsp;
70 <input type="button" class="btn btn-default btn-sm" name="cancel" onclick="document.getElementById('block_user').style.display='none';" value="取り消す">
71 </form>
72 </div>
73 <div id="ublock_user" style="display:none" class="alert alert-warning">
74 <form method="post">
75 あなたは、このユーザーのブロックを解除してもよろしいですか?
76 <input type="submit" class="btn btn-default btn-sm" name="ublock" value="はい">&nbsp;&nbsp;
77 <input type="button" class="btn btn-default btn-sm" name="cancel" onclick="document.getElementById('ublock_user').style.display='none';" value="取り消す">
78 </form>
79 </div>
80 <?php if (!$bansya) {
82 echo "<input type=Â¥"buttonÂ¥" class=Â¥"btn btn-danger btn-xsÂ¥" name=Â¥"blockÂ¥" onclick=Â¥"document.getElementById('block_user').style.display='block';Â¥" value=Âブロックユーザー¥"><small>"
83 } else {
84 echo "<input type=Â¥"buttonÂ¥" class=Â¥"btn btn-danger btn-xsÂ¥" name=Â¥"ublockÂ¥" onclick=Â¥"document.getElementById('ublock_user').style.display='block';Â¥" value=Âユーザーブロックを解除¥">
85 } ?>
86 <div class="pagination panel panel-default mdes" id="pageMessage">
87 <?php
88 // print_r($messages);
89 // die();
90 for ($i=0; $i < count($messages); $i++) {
91 $leftRightCounter = ($inbox->within_str($messages[$i], "<from>", "</from>")==$uid) ? "r mdes panel panel-default pull-left txt" : "s mdes panel panel-default pull-right txt";
92 echo "<div class=¥"".$leftRightCounter."¥">". urldecode($inbox->within_str($messages[$i], "<msg>", "</msg>")) . "<br><small class=¥"d pull-right¥">". date("Y-m-d g:i a",urldecode($inbox->within_str($messages[$i], "<id>", "</id>"))) ."</small></div>";
93 echo "<div class='clearfix'></div>";
95 if ($uid <> trim($inbox->within_str($senderCounter, "<from>", "</from>"))) {
96 $ss = "<input type=¥"hidden¥" name=¥"zxcvbnm¥" value=¥"".Encrypt($uid.$inbox->within_str($senderCounter, "<from>", "</from>").$inbox->within_str($senderCounter, "<id>", "</id>"), KEY)."¥">";
97 } else {
98 $ss = "<input type=¥"hidden¥" name=¥"zxcvbnm¥" value=¥"".Encrypt($uid.$inbox->within_str($senderCounter, "<to>", "</to>").$inbox->within_str($senderCounter, "<id>", "</id>"), KEY)."¥">";
100 echo "</div>";
101 echo "<div id=¥"replyForm¥" style=¥"¥">
102 <form method=¥"post¥" action=¥"reply.php¥">".@$ss.
103 "<textarea rows=¥"5¥" name=¥"msg¥" class=¥"form-control¥" required></textarea><br>
104 <button type=¥"submit¥">Send</button>
105 </form>
106 </div>";
107 } else {
108 // echo "Doesn't Exist!";
109 header("Location: index.php");
111 echo "</div>";
112 require 'include/footer.php';