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