Initial commit
[2ch-be.git] / dev-test / old_dev / inbox2.php
blob9e1be6d93785e4e6034e1a780f5f6a1018621626
1 <?php
2 include('encrypt.php');
3 require 'include/inbox.class.php';
4 require 'include/header.php';
6 if (!isset($_COOKIE['DMDM']) && !isset($_COOKIE['MDMD'])) {
7 header('location:index.php');
8 exit;
11 /*********************************************
12 function GetImgTrip($mail) {
13 $mail = trim($mail);
14 $fdir = substr($mail, 0, 1);
15 $sdir = substr($mail, 1, 1);
16 $impo = file_get_contents(DB_PATH."$fdir/$sdir/$mail");
17 return $impo;
19 1402473560
20 //*********************************************/
21 // $init = new Message;
22 $init = new Message;
23 $uid = $init->GetID($_COOKIE['DMDM'],$id_mail_path);
24 // echo
25 if(isset($_POST['delete'])){
26 if(!file_exists($_SESSION['sLoggedDir'].'del')){
27 chdir($_SESSION['sLoggedDir']);
28 mkdir('del');
31 if(is_dir($_SESSION['sLoggedDir'].'del')){
32 $delete = $_POST['delete'].".dat";
33 if(file_exists($_SESSION['sLoggedDir'].$delete)){
34 rename($_SESSION['sLoggedDir'].$delete, $_SESSION['sLoggedDir'].'del/'.$delete);
35 $_SESSION['msg'] = "<div class=¥"alert alert-success¥">メッセージが正常に削除されました。</div>";
36 header('Location: '.$livesitePath.'inbox.php');
37 exit;
38 }else{
39 $_SESSION['msg'] = "<div class=¥"alert alert-danger¥">Doesn't Exists</div>";
40 header('Location: '.$livesitePath.'inbox.php');
41 exit;
46 if(isset($_POST['msgSubmit'])){
48 $id = strip_tags(addslashes(trim($_POST['zxcvbnm'])));
49 $id = (filter_var($id, FILTER_VALIDATE_INT)) ? $id : FALSE;
50 $subj = trim($_POST['subj']);
51 $inf = trim($_POST['msg']);
53 $message = new Message;
54 if($id && $id > 0){
55 $subj = $message->BeSanitize($subj);
56 $sanitize = $message->BeSanitize($inf);
58 if ($sanitize<>false) {
59 $user = $message->FindUser($id,$id_mail_path);
60 $sender = $message->GetID($_COOKIE['DMDM'],$id_mail_path);
61 if($message->CheckBanMessaging()) {
62 echo "メッセージを送信することはできません、低すぎるの点BE";
63 exit;
65 $ckp = $message->CheckPostLimit($sender,$plimit_path,TRUE);
66 if (($ckp >= 60) && ($ckp != false)) {
67 echo "到達した後の制限は、次の分お待ちください";
68 exit;
70 $ckp = $message->CheckPostLimit($sender,$plimit_hpath,FALSE);
71 if (($ckp >= 600) && ($ckp != false)) {
72 echo "到達した後の制限は、次の1時間お待ちください";
73 exit;
75 $write = $message->WriteMDB($user,$sanitize,$sender,$subj,$id);
77 if ($write) {
78 $message->AddPostLimit($sender,$plimit_path,TRUE);
79 $message->AddPostLimit($sender,$plimit_hpath,FALSE);
80 $_SESSION['msg'] = "<div class=¥"alert alert-success¥">正常に送信されたメッセー</div>";
81 } else {
82 $_SESSION['msg'] = "<div class=¥"alert alert-danger¥">メッセージは送信されませんでした</div>";
85 } else {
86 echo "長すぎるコンテンツ";
88 }else{
89 $_SESSION['msg'] = "<div class=¥"alert alert-danger¥">メッセージは送信されませんでした</div>";
93 $emoticon = array(
94 'amazed' => '::amazed::',
95 'cry' => '::cry::',
96 'okay' => '::okay::',
97 'treasure' => '::treasure::',
98 'angry' => '::angry::',
99 'gangster' => '::gangster::',
100 'shame' => '::shame::',
101 'wink' => '::wink::',
102 'annoyed' => '::annoyed::',
103 'laugh' => '::laugh::',
104 'sick' => '::sick::',
105 'blush' => '::blush::',
106 'sing' => '::sing::',
107 'chocked' => '::chocked::',
108 'smile' => '::smile::',
109 'confused' => '::confused::',
110 'ninja' => '::ninja::',
111 'tongue' => '::tongue::',
112 'lawyer' => '::lawyer::',
113 'guru' => '::guru::',
116 $ultravariable = array();
117 foreach ($emoticon as $key => $value) {
118 $ultravariable[] = "<li class=¥"lialign¥"><img src='{$livesitePath}images/{$key}.gif' data-alt='{$value}'></li>";
120 $sEmote = implode("", $ultravariable);
123 <body>
125 <!-- Modal -->
126 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
127 <div class="modal-dialog">
128 <div class="modal-content">
129 <div class="modal-header">
130 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
131 <h4 class="modal-title" id="myModalLabel">メッセージを送る</h4>
132 </div>
133 <form class="form" method="post" id="sendMessage">
134 <div class="modal-body">
135 <div class="form-group">
136 <div class="input-group">
137 <span class="input-group-addon">受信者 :</span>
138 <input type="text" class="form-control" name="zxcvbnm" required>
139 <div class="clearfix"></div>
140 </div>
141 </div>
142 <div class="form-group">
143 <div class="input-group">
144 <span class="input-group-addon">件名 :</span>
145 <input type="text" class="form-control" name="subj" required>
146 <div class="clearfix"></div>
147 </div>
148 </div>
149 <!--input type="hidden" value="" name="rec"/> <!--receiver -->
150 <div class="form-group">
151 <textarea rows="4" class="form-control top" id='messageBox' name="msg" maxlength="250" id="msg"></textarea>
152 </div>
153 <div class="clearfix"></div>
154 </div>
155 <div class="modal-footer">
156 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">絵文字</button>
157 <ul class="dropdown-menu dropdown-menu-right" role="menu" id="emoji">
158 <?php echo $sEmote ?>
159 </ul>
160 <button type="submit" class="btn btn-primary" name="msgSubmit">送る</button>
161 </div>
162 </div>
163 </form>
164 </div>
165 </div>
166 </div>
168 <div class="well well-sm pad3">
169 <!-- navigation-->
170 <?php require 'include/nav.php' ?>
173 <!-- <div class="pad panel panel-default sp fxmrgn b "> -->
174 <!--Showing messages -->
176 <?php
177 $inbox = new inboxRead();
178 $files = $inbox->getInbox();
181 echo " <!-- List of messages -->
182 <div class=¥"btn-group¥">
183 <button type=¥"button¥" class=¥"btn btn-default¥" id=¥"btnMsg¥" data-toggle=¥"modal¥" data-target=¥"#myModal¥">
184 <span class=¥"glyphicon glyphicon-envelope¥"></span>
185 </button>
186 </div><br> ";
187 echo "<div class=¥"alert alert-danger¥" id=¥"delmsg¥" style=¥"display:none;¥">
188 あなたが会話を削除してもよろしいですか?<input type=¥"submit¥" class=¥"btn btn-default btn-sm¥" id=¥"deleteM¥" value=¥"削除¥"name=¥"block¥">
189 <input type=¥"button¥" class=¥"btn btn-default btn-sm¥" value=¥"キャンセル¥" name=¥"cancel¥" onclick=¥"document.getElementById('delmsg').style.display='none';¥">
190 </div>";
194 if(!empty($_SESSION['msg'])){
195 echo $_SESSION['msg'];
196 $_SESSION['msg'] = '';
200 <div id="page" class="pagination2" >
203 <div class="clearfix"></div>
204 <br/>
205 <ul class="list-group" id="list">
206 <?php
207 if($files){
208 foreach($files as $filename){
209 $value = $init->getContent($filename);
210 $from = $init->within_str($value[0], "<from>", "</from>");
211 $to = $init->within_str($value[0], "<to>", "</to>");
212 $id = $init->within_str(max($value), "<id>", "</id>");
213 $subj = $init->within_str($value[0], "<subj>", "</subj>");
214 $read = $init->within_str($value[0], "<read>", "</read>");
215 $msg = $init->within_str($value[0], "<msg>", "</msg>");
217 $array[$filename] = array("id" => $id, "subj" =>$subj, "read"=>$read, "msg"=>$msg ,"from" => $from, "to" => $to, );
219 // echo "<pre>";
220 // print_r($array);
221 // echo "</pre>";
222 // sort associative array
223 $array = $init->array_sort($array, 'id', SORT_DESC);
224 // echo "<pre>";
225 // print_r($array);
226 // echo "</pre>";
228 foreach ($array as $key => $value) {
229 if (trim(urldecode($value["from"])) == trim($uid)) {
230 $ucode = urldecode($value["to"]);
231 } else {
232 $ucode = urldecode($value["from"]);
234 $ucode = $init->FindUser($ucode,$id_mail_path);
235 $ucode = trim($init->GetImgTrip($ucode));
236 $ucode = explode("¥n", $ucode);
237 $uimg = trim($ucode[5]);
238 if (isset($ucode[7]) && ($ucode[7] != NULL || $ucode[7] != "")) {
239 $utrip = $ucode[7];
240 } else {
241 $utrip = $ucode[0];
243 $url = substr($key, 0,-4);
244 $ff = urldecode($value["subj"]);
246 if($init->countMessage($key) > 0 ){
247 $unreadMessage = "<span class='badge pull-right'>{$init->countMessage($key)}</span>";
248 $class="unread";
249 }else{
250 $unreadMessage = '';
251 $class="read";
253 // $unreadCounter = ($init->within_str(max($value), "<read>", "</read>")==1) ? 'read' : 'unread' ;
255 echo "<li class='list-group-item ".$class."' style=¥"overflow:auto !important;¥">
256 <div class='media panel6'>
259 <div class=¥"dropdown pull-right¥">
260 <a data-toggle=¥"dropdown¥" href=¥"#¥"><span class=¥"caret¥"></span></a>
262 <ul class=¥"dropdown-menu dropdown-menu-right cuzdropdown-menu¥" role=¥"menu¥" aria-labelledby=¥"dLabel¥">
263 <li>
264 <form method=¥"POST¥" class='deleteForm'>
265 <input type='hidden' name='delete' value='{$url}'>
266 <small><a href='#' class='destroy'>削除</a></small>
267 </form>
268 </li>
270 </ul><div class=¥"clearfix¥"></div>
271 </div>
280 <a class='pull-left' href='#'>
281 <div class='ic2'>
282 <img class='pic2' src=¥"".$livesitePath2."/ico/{$uimg}¥" >
283 </div><!--ic2-->
284 </a>
285 <div class='media-body'>
286 <div class='panel6'>
287 <a href='message.php?d={$url}' class='pull-left'>
288 <h5 class='media-heading'>{$utrip}</h5>
289 <div class='limit'>{$ff}</div>
290 </a>"
291 .$unreadMessage.
292 "</div><!--panel6-->
293 </div><!--media-body-->
294 </div> <!--media-->
295 </li>";
302 </ul>
303 </div><!--hide/"" pagination-->
304 </div><!--pad panel panel-default-->
305 </div><!--well well-lg-->
307 <?php
308 require 'include/footer.php';