Initial commit
[2ch-be.git] / dev-test / message4.php
blob0d53c8c44774e0bf2050641238d9f69e48225958
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 date_default_timezone_set("Asia/Tokyo");
8 if ($user<>false) {
9 $d = strip_tags(addslashes(trim($_GET['d'])));
10 $messages = $inbox->specificMDB($user, $d, FALSE);
11 $senderCounter = $inbox->specificMDB($user, $d, TRUE);
12 $file = $_SESSION['sLoggedDir'].$d.".dat";
13 $value = $inbox->getContent2($_SESSION['sLoggedDir'].$d.".dat");
14 $max = max($value);
15 $ff = $inbox->within_str(max($value), "<read>", "</read>");
17 if ($uid <> trim($inbox->within_str($senderCounter, "<from>", "</from>"))) {
18 $kausap = trim($inbox->within_str($senderCounter, "<from>", "</from>"));
19 } else {
20 $kausap = trim($inbox->within_str($senderCounter, "<to>", "</to>"));
22 $checkifban = $inbox->CheckBanList($user,$kausap);
23 if ($checkifban)
24 $bansya = true;
25 else
26 $bansya = false;
27 // End of set, check for user block
29 if($ff==0){
30 if(file_exists($file)){
31 $arr = file($file);
32 $newLine = substr($max, 0, -15)."<read>1</read>";
33 $lastLine = count($value)-1;
34 unset($arr[$lastLine]);
35 $arr[$lastLine] = $newLine.PHP_EOL;
36 file_put_contents($file,implode($arr));
37 header("Location: message.php?d=$d");
38 }else{
39 header("Location: inbox.php");
43 if (isset($_POST['block'])) {
44 $block = $inbox->BlockUser($user,$kausap);
45 if ($block) {
46 echo "ƒ†�[ƒU�[‚ªƒuƒ�ƒbƒN‚³‚ꂽ�I‚±‚̃†�[ƒU�[‚©‚çƒ�ƒbƒZ�[ƒW‚ðŽó�M‚·‚邱‚Æ‚Í‚Å‚«‚Ü‚¹‚ñ";
47 header('Location: '.$_SERVER['REQUEST_URI']);
48 } else {
49 echo "ƒGƒ‰�[�Iƒ†�[ƒU�[‚ðƒuƒ�ƒbƒN‚·‚邱‚Æ‚Í‚Å‚«‚Ü‚¹‚ñ�I";
52 if (isset($_POST['ublock'])) {
53 $block = $inbox->UnblockUser($user,$kausap);
54 if ($block) {
55 echo "ƒ†�[ƒU�[‚ªƒuƒ�ƒbƒN‚³‚ê‚Ä‚¢‚È‚¢�I‚±‚ê‚Å�A‚±‚̃†�[ƒU�[‚©‚ç‚̃�ƒbƒZ�[ƒW‚ðŽó‚¯Žæ‚邱‚Æ‚ª‚Å‚«‚Ü‚·";
56 header('Location: '.$_SERVER['REQUEST_URI']);
57 } else {
58 echo "ƒGƒ‰�[�Iƒ†�[ƒU�[ƒuƒ�ƒbƒN‚ð‰ð�œ‚·‚邱‚Æ‚Í‚Å‚«‚Ü‚¹‚ñ�I";
62 <div class="well well-lg">
63 <?php
64 include "include/nav.php";
65 echo "<h4>”íŽÊ‘Ì: ".urldecode($inbox->within_str($senderCounter, "<subj>", "</subj>"))."</h4>";
67 <div id="block_user" style="display:none" class="alert alert-warning">
68 <form method="post">
69 ‚ ‚È‚½‚Í‚±‚̃†�[ƒU�[‚ðƒuƒ�ƒbƒN‚µ‚Ü‚·‚©�H
70 <input type="submit" class="btn btn-default btn-sm" name="block" value="‚Í‚¢">&nbsp;&nbsp;
71 <input type="button" class="btn btn-default btn-sm" name="cancel" onclick="document.getElementById('block_user').style.display='none';" value="Žæ‚è�Á‚·">
72 </form>
73 </div>
74 <div id="ublock_user" style="display:none" class="alert alert-warning">
75 <form method="post">
76 ‚ ‚È‚½‚Í�A‚±‚̃†�[ƒU�[‚̃uƒ�ƒbƒN‚ð‰ð�œ‚µ‚Ä‚à‚æ‚낵‚¢‚Å‚·‚©�H
77 <input type="submit" class="btn btn-default btn-sm" name="ublock" value="‚Í‚¢">&nbsp;&nbsp;
78 <input type="button" class="btn btn-default btn-sm" name="cancel" onclick="document.getElementById('ublock_user').style.display='none';" value="Žæ‚è�Á‚·">
79 </form>
80 </div>
81 <?php if (!$bansya) {
83 echo "<input type=\"button\" class=\"btn btn-danger btn-xs\" name=\"block\" onclick=\"document.getElementById('block_user').style.display='block';\" value=ƒuƒ�ƒbƒNƒ†�[ƒU�[\"><small>";
84 } else {
85 echo "<input type=\"button\" class=\"btn btn-danger btn-xs\" name=\"ublock\" onclick=\"document.getElementById('ublock_user').style.display='block';\" value=ƒ†�[ƒU�[ƒuƒ�ƒbƒN‚ð‰ð�œ\">";
86 } ?>
87 <div class="pagination panel panel-default mdes" id="pageMessage">
88 <?php
89 // print_r($messages);
90 // die();
91 for ($i=0; $i < count($messages); $i++) {
92 $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";
93 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>";
94 echo "<div class='clearfix'></div>";
96 if ($uid <> trim($inbox->within_str($senderCounter, "<from>", "</from>"))) {
97 $ss = "<input type=\"hidden\" name=\"zxcvbnm\" value=\"".Encrypt($uid.$inbox->within_str($senderCounter, "<from>", "</from>").$inbox->within_str($senderCounter, "<id>", "</id>"), KEY)."\">";
98 } else {
99 $ss = "<input type=\"hidden\" name=\"zxcvbnm\" value=\"".Encrypt($uid.$inbox->within_str($senderCounter, "<to>", "</to>").$inbox->within_str($senderCounter, "<id>", "</id>"), KEY)."\">";
101 echo "</div>";
102 echo "<div id=\"replyForm\" style=\"\">
103 <form method=\"post\" action=\"reply.php\">".@$ss.
104 "<textarea rows=\"5\" name=\"msg\" class=\"form-control\" required></textarea><br>
105 <button type=\"submit\">Send</button>
106 </form>
107 </div>";
108 } else {
109 // echo "Doesn't Exist!";
110 header("Location: index.php");
112 echo "</div>";
113 require 'include/footer.php';