Initial commit
[2ch-be.git] / dev-test / bak / inbox_bak.php
blob1e42c6b5a1d586822c853394a95ada11fff5a638
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-danger\">Message has been successfully deleted.</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;
47 <body>
48 <div class="well well-sm pad3">
49 <!-- navigation-->
50 <?php require 'include/nav.php' ?>
53 <!-- <div class="pad panel panel-default sp fxmrgn b "> -->
54 <!--Showing messages -->
56 <?php
57 $inbox = new inboxRead();
58 $files = $inbox->getInbox();
60 <?php
62 echo "<div class=\"alert alert-danger\" id=\"delmsg\" style=\"display:none;\">
63 ‚ ‚È‚½‚ª‰ï˜b‚ð�í�œ‚µ‚Ä‚à‚æ‚낵‚¢‚Å‚·‚©�H<input type=\"submit\" class=\"btn btn-default btn-sm\" id=\"deleteM\" value=\"�í�œ\"name=\"block\">
64 <input type=\"button\" class=\"btn btn-default btn-sm\" value=\"ƒLƒƒƒ“ƒZƒ‹\" name=\"cancel\" onclick=\"document.getElementById('delmsg').style.display='none';\">
65 </div>";
68 <!-- List of messages -->
69 <div id="page" class="pagination2" >
71 <ul class="list-group" id="list">
72 <?php
73 if(!empty($_SESSION['msg'])){
74 echo $_SESSION['msg'];
75 $_SESSION['msg'] = '';
77 if($files){
78 foreach($files as $filename){
79 $value = $init->getContent($filename);
80 $from = $init->within_str($value[0], "<from>", "</from>");
81 $to = $init->within_str($value[0], "<to>", "</to>");
82 $id = $init->within_str(max($value), "<id>", "</id>");
83 $subj = $init->within_str($value[0], "<subj>", "</subj>");
84 $read = $init->within_str($value[0], "<read>", "</read>");
85 $msg = $init->within_str($value[0], "<msg>", "</msg>");
87 $array[$filename] = array("id" => $id, "subj" =>$subj, "read"=>$read, "msg"=>$msg ,"from" => $from, "to" => $to, );
89 // echo "<pre>";
90 // print_r($array);
91 // echo "</pre>";
92 // sort associative array
93 $array = $init->array_sort($array, 'id', SORT_DESC);
94 // echo "<pre>";
95 // print_r($array);
96 // echo "</pre>";
98 foreach ($array as $key => $value) {
99 if (trim(urldecode($value["from"])) == trim($uid)) {
100 $ucode = urldecode($value["to"]);
101 } else {
102 $ucode = urldecode($value["from"]);
104 $ucode = $init->FindUser($ucode,$id_mail_path);
105 $ucode = trim($init->GetImgTrip($ucode));
106 $ucode = explode("\n", $ucode);
107 $uimg = trim($ucode[5]);
108 if (isset($ucode[7]) && ($ucode[7] != NULL || $ucode[7] != "")) {
109 $utrip = $ucode[7];
110 } else {
111 $utrip = $ucode[0];
113 $url = substr($key, 0,-4);
114 $ff = urldecode($value["subj"]);
116 if($init->countMessage($key) > 0 ){
117 $unreadMessage = "<span class='badge pull-right'>{$init->countMessage($key)}</span>";
118 $class="unread";
119 }else{
120 $unreadMessage = '';
121 $class="read";
123 // $unreadCounter = ($init->within_str(max($value), "<read>", "</read>")==1) ? 'read' : 'unread' ;
125 echo "<li class='list-group-item ".$class."' style=\"overflow:auto !important;\">
126 <div class='media panel6'>
129 <div class=\"dropdown pull-right\">
130 <a data-toggle=\"dropdown\" href=\"#\"><span class=\"caret\"></span></a>
132 <ul class=\"dropdown-menu dropdown-menu-right cuzdropdown-menu\" role=\"menu\" aria-labelledby=\"dLabel\">
133 <li>
134 <form method=\"POST\" class='deleteForm'>
135 <input type='hidden' name='delete' value='{$url}'>
136 <small><a href='#' class='destroy'>��</a></small>
137 </form>
138 </li>
140 </ul><div class=\"clearfix\"></div>
141 </div>
150 <a class='pull-left' href='#'>
151 <div class='ic2'>
152 <img class='pic2' src=\"".$livesitePath2."/ico/{$uimg}\" >
153 </div><!--ic2-->
154 </a>
155 <div class='media-body'>
156 <div class='panel6'>
157 <a href='message.php?d={$url}' class='pull-left'>
158 <h5 class='media-heading'>{$utrip}</h5>
159 <div class='limit'>{$ff}</div>
160 </a>"
161 .$unreadMessage.
162 "</div><!--panel6-->
163 </div><!--media-body-->
164 </div> <!--media-->
165 </li>";
172 </ul>
173 </div><!--hide/"" pagination-->
174 </div><!--pad panel panel-default-->
175 </div><!--well well-lg-->
177 <?php
178 require 'include/footer.php';