Initial commit
[2ch-be.git] / dev-test / message2.php
blob48440d5c46f8e17ccebb60b83c2db6475d2eb720
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 $lr = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? "pull-left" : "pull-right";
152 $tripcode = trim($getid[7]);
153 $tripcode = (empty($tripcode)) ? $getid[0] : $getid[7];
154 if(detect_device2($_SERVER['HTTP_USER_AGENT']) == "PLSDISPLAY")
155 echo "<div class=\"panel panel-default ic4 {$lr}\"><a href=\"".$livesitePath."test/p.php?i=".$getid[0]."\" target=\"_blank\"><img src=\"".$livesitePath2."/ico/{$uimg}\" class=\"pic2\" ></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>";
156 else
157 echo "<div class=\"panel panel-default ic4 {$lr}\"><img src=\"".$livesitePath2."/ico/{$uimg}\" class=\"pic2\" ></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>";
158 echo "<div class='clearfix'></div>";
160 } else {
161 $ss = "<input type=\"hidden\" name=\"zxcvbnm\" value=\"".Encrypt($uid.$inbox->within_str($senderCounter, "<to>", "</to>").$d, KEY)."\">";
162 for ($i=0; $i < count($messages[0]); $i++) {
163 //$leftRightCounter = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ?
164 //"r mdes panel panel-default pull-left txt" : "s mdes panel panel-default pull-right txt";
165 // echo substr($messages[0][$i], 14);
166 if ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) {
167 $leftRightCounter = "r mdes panel panel-default pull-left txt";
168 $getid = $inbox->within_str($senderCounter, "<from>", "</from>");
169 } else {
170 $leftRightCounter = "s mdes panel panel-default pull-right txt";
171 $getid = $inbox->within_str($senderCounter, "<to>", "</to>");
174 // $getid = ($inbox->within_str($messages[0][$i], "<from>", "</from>")!=$uid) ?
175 // $inbox->within_str($senderCounter, "<from>", "</from>") : $inbox->within_str($senderCounter, "<to>", "</to>");
177 $getid = $inbox->FindUser($getid,$id_mail_path);
178 $getid = trim($inbox->GetImgTrip($getid));
179 $getid = explode("\n", $getid);
180 $uimg = trim($getid[5]);
181 $lr = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? "pull-left" : "pull-right";
182 $tripcode = trim($getid[7]);
183 $tripcode = (empty($tripcode)) ? $getid[0] : $getid[7];
184 if(detect_device2($_SERVER['HTTP_USER_AGENT']) == "PLSDISPLAY")
185 echo "<div class=\"panel panel-default ic4 {$lr}\"><a href=\"".$livesitePath."test/p.php?i=".$getid[0]."\" target=\"_blank\"><img src=\"".$livesitePath2."/ico/{$uimg}\" class=\"pic2\" ></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>";
186 else
187 echo "<div class=\"panel panel-default ic4 {$lr}\"><img src=\"".$livesitePath2."/ico/{$uimg}\" class=\"pic2\" ></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>";
188 echo "<div class='clearfix'></div>";
192 echo "</div>";
193 $emoticon = array(
194 'amazed' => '::amazed::',
195 'cry' => '::cry::',
196 'okay' => '::okay::',
197 'treasure' => '::treasure::',
198 'angry' => '::angry::',
199 'gangster' => '::gangster::',
200 'shame' => '::shame::',
201 'wink' => '::wink::',
202 'annoyed' => '::annoyed::',
203 'laugh' => '::laugh::',
204 'sick' => '::sick::',
205 'blush' => '::blush::',
206 'sing' => '::sing::',
207 'chocked' => '::chocked::',
208 'smile' => '::smile::',
209 'confused' => '::confused::',
210 'ninja' => '::ninja::',
211 'tongue' => '::tongue::',
212 'lawyer' => '::lawyer::',
213 'guru' => '::guru::',
216 $ultravariable = array();
217 foreach ($emoticon as $key => $value) {
218 $ultravariable[] = "<li class=\"lialign\"><img src='{$livesitePath}images/{$key}.gif' data-alt='{$value}'></li>";
220 $sEmote = implode("", $ultravariable);
221 // print_r($ultravariable);
222 echo "<div id=\"replyForm\" class=\"panel panel-default b\">
224 <form method=\"post\" action=\"reply.php\">".@$ss.
226 <textarea id='messageBox' rows=\"5\" name=\"msg\" class=\"form-control\" required></textarea><br>
227 <div class=\"pull-right\" >
228 <div class=\"btn-group\">
229 <button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\">ŠG•¶Žš</button>
230 <ul class=\"dropdown-menu dropdown-menu-right\" role=\"menu\" id=\"emoji\">"
231 .$sEmote.
233 </ul>
234 </div>
235 <button type=\"submit\" class=\"btn btn-default\">‘—�M</button>
236 </div>
237 <div class=\"clearfix\"></div>
238 <input type=\"hidden\" name=\"sbj\" value=\"".urldecode($inbox->within_str($senderCounter, "<subj>", "</subj>"))."\">
239 </form>
240 </div>";
241 } else {
242 // echo "Doesn't Exist!";
243 header("Location: index.php");
245 echo "</div>";
246 require 'include/footer.php';
247 echo $_SERVER['HTTP_USER_AGENT'];