Initial commit
[2ch-be.git] / dev-test / rewrite / inbox.php
blob1fca0750754e537112f2f3fa2250452fb5272f96
1 <?php
2 include('include/config.php');
3 require 'include/inbox.class.php';
5 $title = 'Žó�MƒgƒŒƒC';
7 require 'include/header.php';
9 if (!isset($_COOKIE['DMDM']) && !isset($_COOKIE['MDMD'])) {
10 header('location:index.php');
11 exit;
13 $init = new Message;
14 $uid = $init->GetID($_COOKIE['DMDM'],$id_mail_path);
16 if(isset($_POST['delete'])){
17 if(!file_exists($_SESSION['sLoggedDir'].'del')){
18 chdir($_SESSION['sLoggedDir']);
19 mkdir('del');
22 if(is_dir($_SESSION['sLoggedDir'].'del')){
23 $delete = $_POST['delete'].".dat";
24 if(file_exists($_SESSION['sLoggedDir'].$delete)){
25 rename($_SESSION['sLoggedDir'].$delete, $_SESSION['sLoggedDir'].'del/'.$delete);
26 $_SESSION['msg'] = "<div class=\"alert alert-success\">‰ï˜b‚ð�í�œ‚µ‚Ü‚µ‚½�B</div>";
27 header('Location: '.$livesitePath.'inbox.php');
28 exit;
29 }else{
30 $_SESSION['msg'] = "<div class=\"alert alert-danger\">Doesn't Exists</div>";
31 header('Location: '.$livesitePath.'inbox.php');
32 exit;
37 if(isset($_POST['msgSubmit'])){
39 $id = strip_tags(addslashes(trim($_POST['zxcvbnm'])));
40 $id = (filter_var($id, FILTER_VALIDATE_INT)) ? $id : FALSE;
41 $subj = trim($_POST['subj']);
42 $inf = trim($_POST['msg']);
44 $message = new Message;
45 if($id && $id > 0){
46 $subj = $message->BeSanitize($subj);
47 $sanitize = $message->BeSanitize($inf);
49 if ($sanitize<>false) {
50 $user = $message->FindUser($id,$id_mail_path);
51 $sender = $message->GetID($_COOKIE['DMDM'],$id_mail_path);
52 if($message->CheckBanMessaging()) {
53 echo "ƒ�ƒbƒZ�[ƒW‚ð‘—�M‚·‚é‚É‚Í1000BEƒ|ƒCƒ“ƒgˆÈ�ã�ŠŽ�‚µ‚Ä‚¢‚é•K—v‚ª‚ ‚è‚Ü‚·�B";
54 exit;
56 $ckp = $message->CheckPostLimit($sender,$plimit_path,TRUE);
57 if (($ckp >= 60) && ($ckp != false)) {
58 echo "“ž’B‚µ‚½Œã‚Ì�§ŒÀ‚Í�AŽŸ‚Ì•ª‚¨‘Ò‚¿‚­‚¾‚³‚¢";
59 exit;
61 $ckp = $message->CheckPostLimit($sender,$plimit_hpath,FALSE);
62 if (($ckp >= 600) && ($ckp != false)) {
63 echo "“ž’B‚µ‚½Œã‚Ì�§ŒÀ‚Í�AŽŸ‚Ì1ŽžŠÔ‚¨‘Ò‚¿‚­‚¾‚³‚¢";
64 exit;
66 $write = $message->WriteMDB($user,$sanitize,$sender,$subj,$id);
68 if ($write) {
69 $message->AddPostLimit($sender,$plimit_path,TRUE);
70 $message->AddPostLimit($sender,$plimit_hpath,FALSE);
71 $_SESSION['msg'] = "<div class=\"alert alert-success\">ƒ�ƒbƒZ�[ƒW‚ð‘—�M‚µ‚Ü‚µ‚½�B</div>";
72 } else {
73 $_SESSION['msg'] = "<div class=\"alert alert-danger\">ƒAƒJƒEƒ“ƒg‚ª‘¶�Ý‚µ‚Ü‚¹‚ñ�B</div>";
76 } else {
77 echo "’·‚·‚¬‚éƒRƒ“ƒeƒ“ƒc";
79 }else{
80 $_SESSION['msg'] = "<div class=\"alert alert-danger\">ƒ�ƒbƒZ�[ƒW‚Í‘—�M‚³‚ê‚Ü‚¹‚ñ‚Å‚µ‚½</div>";
84 $ultravariable = array();
86 foreach ($emoticon as $key => $value) {
87 $ultravariable[] = "<li class=\"lialign\"><img src='{$livesitePath}images/{$key}.gif' data-alt='{$value}'></li>";
89 $sEmote = implode("", $ultravariable);
93 <body>
95 <!-- Modal -->
96 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
97 <div class="modal-dialog">
98 <div class="modal-content">
99 <div class="modal-header">
100 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
101 <h4 class="modal-title" id="myModalLabel">ƒ�ƒbƒZ�[ƒW‚ð‘—‚é</h4>
102 </div>
103 <form class="form" method="post" id="sendMessage">
104 <div class="modal-body">
105 <div class="form-group">
106 <div class="input-group">
107 <span class="input-group-addon">Žó�MŽÒ ID:</span>
108 <input type="text" class="form-control" name="zxcvbnm" required>
109 <div class="clearfix"></div>
110 </div>
111 </div>
112 <div class="form-group">
113 <div class="input-group">
114 <span class="input-group-addon">Œ�–¼ :</span>
115 <input type="text" class="form-control" name="subj" required>
116 <div class="clearfix"></div>
117 </div>
118 </div>
119 <!--input type="hidden" value="" name="rec"/> <!--receiver -->
120 <div class="form-group">
121 <textarea rows="4" class="form-control top" id='messageBox' name="msg" maxlength="250" id="msg"></textarea>
122 </div>
123 <div class="clearfix"></div>
124 </div>
125 <div class="modal-footer">
126 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">ŠG•¶Žš</button>
127 <ul class="dropdown-menu dropdown-menu-right" role="menu" id="emoji">
128 <?php echo $sEmote ?>
129 </ul>
130 <button type="submit" class="btn btn-primary" name="msgSubmit">‘—‚é</button>
131 </div>
132 </div>
133 </form>
134 </div>
135 </div>
136 </div>
138 <div class="well well-sm pad3">
139 <!-- navigation-->
140 <?php require 'include/nav.php' ?>
143 <!-- <div class="pad panel panel-default sp fxmrgn b "> -->
144 <!--Showing messages -->
146 <?php
147 $inbox = new inboxRead();
148 $files = $inbox->getInbox();
151 echo " <!-- List of messages -->
152 <div class=\"btn-group akinlang\">
153 <button type=\"button\" class=\"btn btn-default\" id=\"btnMsg\" data-toggle=\"modal\" data-target=\"#myModal\">
154 <span class=\"glyphicon glyphicon-envelope\"></span>
155 </button>
156 </div><div class=\"clearfix\"></div><br> ";
157 echo "<div class=\"alert alert-danger\" id=\"delmsg\" style=\"display:none;\">
158 ‚±‚̉ï˜b‚ð�í�œ‚µ‚Ü‚·‚©�H<input type=\"submit\" class=\"btn btn-default btn-sm\" id=\"deleteM\" value=\"�í�œ\"name=\"block\">
159 <input type=\"button\" class=\"btn btn-default btn-sm\" value=\"ƒLƒƒƒ“ƒZƒ‹\" name=\"cancel\" onclick=\"document.getElementById('delmsg').style.display='none';\">
160 </div>";
164 if(!empty($_SESSION['msg'])){
165 echo $_SESSION['msg'];
166 $_SESSION['msg'] = '';
170 <div id="page" class="pagination2" >
171 <ul class="list-group" id="list">
172 <?php
173 if($files){
174 foreach($files as $filename){
175 $value = $init->getContent($filename);
176 $from = $init->within_str($value[0], "<from>", "</from>");
177 $to = $init->within_str($value[0], "<to>", "</to>");
178 $id = $init->within_str(max($value), "<id>", "</id>");
179 $subj = $init->within_str($value[0], "<subj>", "</subj>");
180 $read = $init->within_str($value[0], "<read>", "</read>");
181 $msg = $init->within_str($value[0], "<msg>", "</msg>");
183 $array[$filename] = array("id" => $id, "subj" =>$subj, "read"=>$read, "msg"=>$msg ,"from" => $from, "to" => $to, );
185 // sort associative array
186 $array = $init->array_sort($array, 'id', SORT_DESC);
188 foreach ($array as $key => $value) {
189 if (trim(urldecode($value["from"])) == trim($uid)) {
190 $ucode = urldecode($value["to"]);
191 } else {
192 $ucode = urldecode($value["from"]);
194 $ucode = $init->FindUser($ucode,$id_mail_path);
195 $ucode = trim($init->GetImgTrip($ucode));
196 $ucode = explode("\n", $ucode);
197 $uimg = trim($ucode[5]);
198 if (isset($ucode[7]) && ($ucode[7] != NULL || $ucode[7] != "")) {
199 $utrip = $ucode[7];
200 } else {
201 $utrip = $ucode[0];
203 $url = substr($key, 0,-4);
204 $ff = urldecode($value["subj"]);
206 if($init->countMessage($key) > 0 ){
207 $unreadMessage = "<span class='badge pull-right'>{$init->countMessage($key)}</span>";
208 $class="unread";
209 }else{
210 $unreadMessage = '';
211 $class="read";
214 echo "<li class='list-group-item ".$class."' style=\"overflow:auto !important;\">
215 <div class='media panel6'>
218 <div class=\"dropdown pull-right\">
219 <a data-toggle=\"dropdown\" href=\"#\"><span class=\"caret\"></span></a>
221 <ul class=\"dropdown-menu dropdown-menu-right cuzdropdown-menu\" role=\"menu\" aria-labelledby=\"dLabel\">
222 <li>
223 <form method=\"POST\" class='deleteForm'>
224 <input type='hidden' name='delete' value='{$url}'>
225 <small><a href='#' class='destroy'>��</a></small>
226 </form>
227 </li>
229 </ul><div class=\"clearfix\"></div>
230 </div>
232 <a class='pull-left' href='#'>
233 <div class='ic2'>
234 <img class='pic2' src=\"".$livesitePath2."/ico/{$uimg}\" >
235 </div><!--ic2-->
236 </a>
237 <div class='media-body'>
238 <div class='panel6'>
239 <a href='message.php?d={$url}' class='pull-left'>
240 <h5 class='media-heading'>{$utrip}</h5>
241 <div class='limit'>{$ff}</div>
242 </a>"
243 .$unreadMessage.
244 "</div><!--panel6-->
245 </div><!--media-body-->
246 </div> <!--media-->
247 </li>";
250 }else{
251 echo "<h5> ‚²—˜—p‚¢‚½‚¾‚¯‚Ü‚¹‚ñƒ�ƒbƒZ�[ƒW </h5>";
255 </ul>
256 </div><!--hide/"" pagination-->
257 </div><!--pad panel panel-default-->
258 </div><!--well well-lg-->
260 <?php
261 require 'include/footer.php';