2 if(!isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH']!='XMLHttpRequest' )){
3 header('location: index.php');
5 header('Content-Type: application/json', true);
6 include('encrypt.php');
8 $uid = $inbox->GetID($_COOKIE['DMDM'],$id_mail_path);
9 $user = $inbox->FindUser($uid,$id_mail_path);
12 // function Smilify($subject, $livesitePath){
17 // ':-o' => 'surprised',
18 // ':-O' => 'surprised',
19 // ':o' => 'surprised',
20 // ':O' => 'surprised',
23 // // ':p' => 'tongue',
24 // // ':-p' => 'tongue',
25 // // ':P' => 'tongue',
26 // // ':-P' => 'tongue',
50 // $replace = array();
51 // foreach ($smilies as $smiley => $imgName)
53 // $size = $sizes[$imgName];
54 // array_push($replace, '<img src="'.$livesitePath.'imagess/'.$imgName.'.png" alt="'.$smiley.'" style="width:'.$size.'px;"/>');
56 // $subject = str_replace(array_keys($smilies), $replace, $subject);
59 function specificMDB($user, $dat, $turn) {
60 // Turn is yung incrementation.
62 $fdir = substr($user, 0, 1);
63 $sdir = substr($user, 1, 1);
64 $udir = str_replace("@", "-", $user);
65 $path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}";
70 if(file_exists($path."/{$dat}.dat")){
72 $messages = file("{$path}/{$dat}.dat");
73 $count = sizeof($messages);
74 $total = $count-$turn;
75 $start = $total-$turn;
78 return array($messages, TRUE, $total, 0);
80 return array($messages, FALSE, $total, $start);
87 $d = strip_tags(addslashes(trim($_POST['data'])));
88 $messages = specificMDB($user, $d, $_POST['load']);
89 $senderCounter = $inbox->specificMDB($user, $d, TRUE);
91 $returnValues['breaker'] = $messages[1];
92 $returnValues["total"] = abs($messages[2]);
93 $returnValues['start'] = abs($messages[3]);
95 if ($uid <> trim($inbox->within_str($senderCounter, "<from>", "</from>"))) {
97 for ($i=$returnValues['start']; $i < $returnValues['total']; $i++
) {
99 // $getid = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? ($inbox->within_str($senderCounter, "<from>", "</from>")) : ($inbox->within_str($senderCounter, "<to>", "</to>"));
100 // $getid = $inbox->FindUser($getid,$id_mail_path);
101 // $getid = trim($inbox->GetImgTrip($getid));
102 // $getid = explode("\n", $getid);
103 // $uimg = trim($getid[5]);
104 // $lr = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? "pull-left" : "pull-right";
106 // $leftRightCounter = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? "r mdes panel panel-default pull-left txt" : "s mdes panel panel-default pull-right txt";
107 if ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) {
108 $leftRightCounter = "r mdes panel panel-default pull-left txt";
109 $getid = $inbox->within_str($senderCounter, "<to>", "</to>");
111 $leftRightCounter = "s mdes panel panel-default pull-right txt";
112 $getid = $inbox->within_str($senderCounter, "<from>", "</from>");
115 $getid = $inbox->FindUser($getid,$id_mail_path);
116 $getid = trim($inbox->GetImgTrip($getid));
117 $getid = explode("\n", $getid);
118 $uimg = trim($getid[5]);
119 if (strpos($uimg, "-PREM")) {
120 $ico = explode("-PREM", $uimg);
121 $uimg = "<img src=\"".$livesitePath2."/premium/".$ico[0]."\" class='pic2'/>";
123 $uimg = "<img src=\"".$livesitePath2."/ico/".$uimg."\" class='pic2'/>";
126 $lr = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ?
"pull-left" : "pull-right";
127 $tripcode = trim($getid[7]);
128 $tripcode = (empty($tripcode)) ?
$getid[0] : $getid[7];
130 $returnValues["array"][] = "<div class=\"panel panel-default ic4 {$lr}\"><a href=\"".$livesitePath."test/p.php?i=".$getid[0]."\" target=\"_blank\">{$uimg}</a></div><div class=\"".$leftRightCounter."\">".
131 Smilify(mb_convert_encoding(urldecode($inbox->within_str($messages[0][$i], "<msg>", "</msg>")), "UTF-8", "SHIFT-JIS"),$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> <div class='clearfix'></div>";
135 for ($i=$returnValues['start']; $i < $returnValues['total']; $i++
) {
137 // $getid = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? ($inbox->within_str($senderCounter, "<from>", "</from>")) : ($inbox->within_str($senderCounter, "<to>", "</to>"));
138 // $getid = $inbox->FindUser($getid,$id_mail_path);
139 // $getid = trim($inbox->GetImgTrip($getid));
140 // $getid = explode("\n", $getid);
141 // $uimg = trim($getid[5]);
142 // $lr = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? "pull-left" : "pull-right";
144 // $leftRightCounter = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? "r mdes panel panel-default pull-left txt" : "s mdes panel panel-default pull-right txt";
145 if ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) {
146 $leftRightCounter = "r mdes panel panel-default pull-left txt";
147 $getid = $inbox->within_str($senderCounter, "<from>", "</from>");
149 $leftRightCounter = "s mdes panel panel-default pull-right txt";
150 $getid = $inbox->within_str($senderCounter, "<to>", "</to>");
154 $getid = $inbox->FindUser($getid,$id_mail_path);
155 $getid = trim($inbox->GetImgTrip($getid));
156 $getid = explode("\n", $getid);
157 $uimg = trim($getid[5]);
158 if (strpos($uimg, "-PREM")) {
159 $ico = explode("-PREM", $uimg);
160 $uimg = "<img src=\"".$livesitePath2."/premium/".$ico[0]."\" class='pic2'/>";
162 $uimg = "<img src=\"".$livesitePath2."/ico/".$uimg."\" class='pic2'/>";
164 $lr = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ?
"pull-left" : "pull-right";
165 $tripcode = trim($getid[7]);
166 $tripcode = (empty($tripcode)) ?
$getid[0] : $getid[7];
168 $returnValues["array"][] = "<div class=\"panel panel-default ic4 {$lr}\"><a href=\"".$livesitePath."test/p.php?i=".$getid[0]."\" target=\"_blank\">{$uimg}</a></div><div class=\"".$leftRightCounter."\">".
170 Smilify(mb_convert_encoding(urldecode($inbox->within_str($messages[0][$i], "<msg>", "</msg>")), "UTF-8", "SHIFT-JIS"),$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> <div class='clearfix'></div>";
174 // for ($i=$returnValues['start']; $i < $returnValues['total']; $i++) {
176 // $getid = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? ($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";
183 // $leftRightCounter = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? "r mdes panel panel-default pull-left txt" : "s mdes panel panel-default pull-right txt";
184 // $returnValues["array"][] = "<div class=\"panel panel-default ic4 {$lr}\"><img src=\"".$livesitePath2."/ico/{$uimg}\" class=\"pic2\" ></div><div class=\"".$leftRightCounter."\">".
185 // mb_convert_encoding(urldecode($inbox->within_str($messages[0][$i], "<msg>", "</msg>")), "UTF-8", "SHIFT-JIS"). "<br><small class=\"d pull-right\">". date("Y-m-d g:i a",urldecode($inbox->within_str($messages[0][$i], "<id>", "</id>"))) ."</small></div> <div class='clearfix'></div>";
189 if(isset($returnValues["array"])){
190 echo json_encode($returnValues);