Initial commit
[2ch-be.git] / dev-test / message.php
blob50a594dc0ba6c5e9e8150e0d6f87b003d7901ce8
1 <?php
2 include('encrypt.php');
3 require 'include/header.php';
4 session_start();
5 $inbox = new Message;
7 $uid = $inbox->GetID($_COOKIE['DMDM'],$id_mail_path);
8 $user = $inbox->FindUser($uid,$id_mail_path);
10 if ($user<>false) {
11 $d = strip_tags(addslashes(trim($_GET['d'])));
12 $messages = $inbox->specificMDB($user, $d, FALSE);
13 $senderCounter = $inbox->specificMDB($user, $d, TRUE);
14 $file = $_SESSION['sLoggedDir'].$d.".dat";
15 $value = $inbox->getContent2($_SESSION['sLoggedDir'].$d.".dat");
16 date_default_timezone_set("Asia/Tokyo");
18 $ff = 0;
19 foreach ($value as $key) {
20 if($inbox->within_str($key, "<read>", "</read>") == 0){
21 $ff++;
25 if ($uid <> trim($inbox->within_str($senderCounter, "<from>", "</from>"))) {
26 $kausap = trim($inbox->within_str($senderCounter, "<from>", "</from>"));
27 } else {
28 $kausap = trim($inbox->within_str($senderCounter, "<to>", "</to>"));
30 $checkifban = $inbox->CheckBanList($user,$kausap);
31 if ($checkifban)
32 $bansya = true;
33 else
34 $bansya = false;
35 // End of set, check for user block
37 if(file_exists($file)){
38 if($ff>0){
39 // $arr = file($file);
40 // $newLine = substr($max, 0, -15)."<read>1</read>";
41 // $lastLine = count($value)-1;
42 // unset($arr[$lastLine]);
43 // $arr[$lastLine] = $newLine.PHP_EOL;
44 // file_put_contents($file,implode($arr));
45 // header("Location: message.php?d=$d");
46 $arr = file($file);
47 foreach ($arr as $key => $value) {
48 // echo urldecode($value)."<br />";
49 if($inbox->within_str($value, "<read>", "</read>") == 0){
50 $newLine = substr($value, 0, -15)."<read>1</read>";
51 unset($arr[$key]);
52 $arr[$key] = $newLine.PHP_EOL;
54 // echo urldecode($value)."<br />";
58 asort($arr);
59 // echo "<pre>";
60 // print_r($arr);
61 // echo "</pre>";
62 // $lastLine = count($value)-1;
63 // unset($arr[$lastLine]);
64 // if(!empty($_SESSION['msg'])){
65 // $_SESSION['msg'] = $_SESSION['msg'] ;
66 // }
67 file_put_contents($file,implode($arr));
68 // header("Location: message.php?d=$d");
70 }else{
71 header("Location: inbox.php");
72 exit;
75 if (isset($_POST['block'])) {
76 $block = $inbox->BlockUser($user,$kausap);
77 if ($block) {
78 echo "ƒ†�[ƒU�[‚ªƒuƒ�ƒbƒN‚³‚ꂽ�I‚±‚̃†�[ƒU�[‚©‚çƒ�ƒbƒZ�[ƒW‚ðŽó�M‚·‚邱‚Æ‚Í‚Å‚«‚Ü‚¹‚ñ";
79 header('Location: '.$_SERVER['REQUEST_URI']);
80 } else {
81 echo "ƒGƒ‰�[�Iƒ†�[ƒU�[‚ðƒuƒ�ƒbƒN‚·‚邱‚Æ‚Í‚Å‚«‚Ü‚¹‚ñ�I";
84 if (isset($_POST['ublock'])) {
85 $block = $inbox->UnblockUser($user,$kausap);
86 if ($block) {
87 echo "ƒ†�[ƒU�[‚ªƒuƒ�ƒbƒN‚³‚ê‚Ä‚¢‚È‚¢�I‚±‚ê‚Å�A‚±‚̃†�[ƒU�[‚©‚ç‚̃�ƒbƒZ�[ƒW‚ðŽó‚¯Žæ‚邱‚Æ‚ª‚Å‚«‚Ü‚·";
88 header('Location: '.$_SERVER['REQUEST_URI']);
89 } else {
90 echo "ƒGƒ‰�[�Iƒ†�[ƒU�[ƒuƒ�ƒbƒN‚ð‰ð�œ‚·‚邱‚Æ‚Í‚Å‚«‚Ü‚¹‚ñ�I";
94 <div class="well well-lg">
95 <?php
96 include "include/nav.php";
97 echo "<h4>Œ�–¼ : ".urldecode($inbox->within_str($senderCounter, "<subj>", "</subj>"))."</h4>";
98 if(!empty($_SESSION['msg'])){
99 echo $_SESSION['msg'];
100 $_SESSION['msg'] = '';// $_S// $_SESSION['msg'] = '';ESSION['msg'] = '';
103 <div id="block_user" style="display:none" class="alert alert-warning">
104 <form method="post">
105 ‚±‚̃†�[ƒU�[‚ðƒuƒ�ƒbƒN‚µ‚Ü‚·‚©�H
106 <input type="submit" class="btn btn-default btn-sm" name="block" value="‚Í‚¢">&nbsp;&nbsp;
107 <input type="button" class="btn btn-default btn-sm" name="cancel" onclick="document.getElementById('block_user').style.display='none';" value="Žæ‚è�Á‚·">
108 </form>
109 </div>
110 <div id="ublock_user" style="display:none" class="alert alert-warning">
111 <form method="post">
112 ƒuƒ�ƒbƒN‚ð‰ð�œ‚µ‚Ü‚·‚©�H
113 <input type="submit" class="btn btn-default btn-sm" name="ublock" value="‚Í‚¢">&nbsp;&nbsp;
114 <input type="button" class="btn btn-default btn-sm" name="cancel" onclick="document.getElementById('ublock_user').style.display='none';" value="Žæ‚è�Á‚·">
115 </form>
116 </div>
117 <?php if (!$bansya) {
119 echo "<input type=\"button\" class=\"btn btn-danger btn-xs\" name=\"block\" onclick=\"document.getElementById('block_user').style.display='block';\" value=\"ƒuƒ�ƒbƒN\"><small>";
120 } else {
121 echo "<input type=\"button\" class=\"btn btn-danger btn-xs\" name=\"ublock\" onclick=\"document.getElementById('ublock_user').style.display='block';\" value=\"ƒuƒ�ƒbƒN‚ð‰ð�œ\">";
122 } ?>
123 <div class="pagination overflow panel panel-default mdes" id="pageMessage">
124 <?php
125 // echo $senderCounter;
126 // exit();
127 //var_dump($messages);
128 //exit();
130 if ($uid <> trim($inbox->within_str($senderCounter, "<from>", "</from>"))) {
131 $ss = "<input type=\"hidden\" name=\"zxcvbnm\" value=\"".Encrypt($uid.$inbox->within_str($senderCounter, "<from>", "</from>").$d, KEY)."\">";
132 for ($i=0; $i < count($messages[0]); $i++) {
133 //$leftRightCounter = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ?
134 //"r mdes panel panel-default pull-left txt" : "s mdes panel panel-default pull-right txt";
135 // echo substr($messages[0][$i], 14);
136 if ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) {
137 $leftRightCounter = "r mdes panel panel-default pull-left txt";
138 $getid = $inbox->within_str($senderCounter, "<to>", "</to>");
139 } else {
140 $leftRightCounter = "s mdes panel panel-default pull-right txt";
141 $getid = $inbox->within_str($senderCounter, "<from>", "</from>");
144 // $getid = ($inbox->within_str($messages[0][$i], "<from>", "</from>")!=$uid) ?
145 // $inbox->within_str($senderCounter, "<from>", "</from>") : $inbox->within_str($senderCounter, "<to>", "</to>");
147 $getid = $inbox->FindUser($getid,$id_mail_path);
148 $getid = trim($inbox->GetImgTrip($getid));
149 $getid = explode("\n", $getid);
150 $uimg = trim($getid[5]);
151 if (strpos($uimg, "-PREM")) {
152 $ico = explode("-PREM", $uimg);
153 $uimg = "<img src=\"".$livesitePath2."/premium/".$ico[0]."\" class='pic2'/>";
154 } else {
155 $uimg = "<img src=\"".$livesitePath2."/ico/".$uimg."\" class='pic2'/>";
157 $lr = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? "pull-left" : "pull-right";
158 $tripcode = trim($getid[7]);
159 $tripcode = (empty($tripcode)) ? $getid[0] : $getid[7];
160 if(detect_device2($_SERVER['HTTP_USER_AGENT']) == "PLSDISPLAY")
161 echo "<div class=\"panel panel-default ic4 {$lr}\"><a href=\"".$livesitePath."test/p.php?i=".$getid[0]."\" target=\"_blank\">{$uimg}</a></div><div class=\"".$leftRightCounter."\">". Smilify(urldecode($inbox->within_str($messages[0][$i], "<msg>", "</msg>")), $livesitePath) . "<br><small class=\"d pull-left\">".$tripcode."</small><small class=\"d pull-right\">". date("Y-m-d g:i a",urldecode($inbox->within_str($messages[0][$i], "<id>", "</id>"))) ."</small></div>";
162 else
163 echo "<div class=\"panel panel-default ic4 {$lr}\">{$uimg}</div><div class=\"".$leftRightCounter."\">". Smilify(urldecode($inbox->within_str($messages[0][$i], "<msg>", "</msg>")), $livesitePath) . "<br><small class=\"d pull-left\">".$tripcode."</small><small class=\"d pull-right\">". date("Y-m-d g:i a",urldecode($inbox->within_str($messages[0][$i], "<id>", "</id>"))) ."</small></div>";
164 echo "<div class='clearfix'></div>";
166 } else {
167 $ss = "<input type=\"hidden\" name=\"zxcvbnm\" value=\"".Encrypt($uid.$inbox->within_str($senderCounter, "<to>", "</to>").$d, KEY)."\">";
168 for ($i=0; $i < count($messages[0]); $i++) {
169 //$leftRightCounter = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ?
170 //"r mdes panel panel-default pull-left txt" : "s mdes panel panel-default pull-right txt";
171 // echo substr($messages[0][$i], 14);
172 if ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) {
173 $leftRightCounter = "r mdes panel panel-default pull-left txt";
174 $getid = $inbox->within_str($senderCounter, "<from>", "</from>");
175 } else {
176 $leftRightCounter = "s mdes panel panel-default pull-right txt";
177 $getid = $inbox->within_str($senderCounter, "<to>", "</to>");
180 // $getid = ($inbox->within_str($messages[0][$i], "<from>", "</from>")!=$uid) ?
181 // $inbox->within_str($senderCounter, "<from>", "</from>") : $inbox->within_str($senderCounter, "<to>", "</to>");
183 $getid = $inbox->FindUser($getid,$id_mail_path);
184 $getid = trim($inbox->GetImgTrip($getid));
185 $getid = explode("\n", $getid);
186 $uimg = trim($getid[5]);
187 if (strpos($uimg, "-PREM")) {
188 $ico = explode("-PREM", $uimg);
189 $uimg = "<img src=\"".$livesitePath2."/premium/".$ico[0]."\" class='pic2'/>";
190 } else {
191 $uimg = "<img src=\"".$livesitePath2."/ico/".$uimg."\" class='pic2'/>";
194 $lr = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? "pull-left" : "pull-right";
195 $tripcode = trim($getid[7]);
196 $tripcode = (empty($tripcode)) ? $getid[0] : $getid[7];
197 if(detect_device2($_SERVER['HTTP_USER_AGENT']) == "PLSDISPLAY")
198 echo "<div class=\"panel panel-default ic4 {$lr}\"><a href=\"".$livesitePath."test/p.php?i=".$getid[0]."\" target=\"_blank\">{$uimg}</a></div><div class=\"".$leftRightCounter."\">". Smilify(urldecode($inbox->within_str($messages[0][$i], "<msg>", "</msg>")), $livesitePath) . "<br><small class=\"d pull-left\">".$tripcode."</small><small class=\"d pull-right\">". date("Y-m-d g:i a",urldecode($inbox->within_str($messages[0][$i], "<id>", "</id>"))) ."</small></div>";
199 else
200 echo "<div class=\"panel panel-default ic4 {$lr}\">{$uimg}</div><div class=\"".$leftRightCounter."\">". Smilify(urldecode($inbox->within_str($messages[0][$i], "<msg>", "</msg>")), $livesitePath) . "<br><small class=\"d pull-left\">".$tripcode."</small><small class=\"d pull-right\">". date("Y-m-d g:i a",urldecode($inbox->within_str($messages[0][$i], "<id>", "</id>"))) ."</small></div>";
201 echo "<div class='clearfix'></div>";
205 echo "</div>";
206 $emoticon = array(
207 'amazed' => '::amazed::',
208 'cry' => '::cry::',
209 'okay' => '::okay::',
210 'treasure' => '::treasure::',
211 'angry' => '::angry::',
212 'gangster' => '::gangster::',
213 'shame' => '::shame::',
214 'wink' => '::wink::',
215 'annoyed' => '::annoyed::',
216 'laugh' => '::laugh::',
217 'sick' => '::sick::',
218 'blush' => '::blush::',
219 'sing' => '::sing::',
220 'chocked' => '::chocked::',
221 'smile' => '::smile::',
222 'confused' => '::confused::',
223 'ninja' => '::ninja::',
224 'tongue' => '::tongue::',
225 'lawyer' => '::lawyer::',
226 'guru' => '::guru::',
229 $ultravariable = array();
230 foreach ($emoticon as $key => $value) {
231 $ultravariable[] = "<li class=\"lialign\"><img src='{$livesitePath}images/{$key}.gif' data-alt='{$value}'></li>";
233 $sEmote = implode("", $ultravariable);
234 // print_r($ultravariable);
235 echo "<div id=\"replyForm\" class=\"panel panel-default b\">
237 <form method=\"post\" action=\"reply.php\">".@$ss.
239 <textarea id='messageBox' rows=\"5\" name=\"msg\" class=\"form-control\" maxlength=\"250\" required></textarea><br>
240 <input type=\"text\" id=\"textarea_feedback\" class=\"form-control\" readonly=\"readonly\">
241 <span>ƒLƒƒƒ‰ƒNƒ^�[�¶</span>
242 <div class=\"pull-right\" >
243 <div class=\"btn-group\">
244 <button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\">ŠG•¶Žš</button>
245 <ul class=\"dropdown-menu dropdown-menu-right\" role=\"menu\" id=\"emoji\">"
246 .$sEmote.
248 </ul>
249 </div>
250 <button type=\"submit\" class=\"btn btn-default\">‘—�M</button>
251 </div>
252 <div class=\"clearfix\"></div>
253 <input type=\"hidden\" name=\"sbj\" value=\"".urldecode($inbox->within_str($senderCounter, "<subj>", "</subj>"))."\">
254 </form>
255 </div>";
256 } else {
257 // echo "Doesn't Exist!";
258 header("Location: index.php");
260 echo "</div>";
261 require 'include/footer.php';