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('include/config.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 $lr = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ?
"pull-left" : "pull-right";
120 $tripcode = trim($getid[7]);
121 $tripcode = (empty($tripcode)) ?
$getid[0] : $getid[7];
123 $returnValues["array"][] = "<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."\">".
124 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>";
128 for ($i=$returnValues['start']; $i < $returnValues['total']; $i++
) {
130 // $getid = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? ($inbox->within_str($senderCounter, "<from>", "</from>")) : ($inbox->within_str($senderCounter, "<to>", "</to>"));
131 // $getid = $inbox->FindUser($getid,$id_mail_path);
132 // $getid = trim($inbox->GetImgTrip($getid));
133 // $getid = explode("\n", $getid);
134 // $uimg = trim($getid[5]);
135 // $lr = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? "pull-left" : "pull-right";
137 // $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";
138 if ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) {
139 $leftRightCounter = "r mdes panel panel-default pull-left txt";
140 $getid = $inbox->within_str($senderCounter, "<from>", "</from>");
142 $leftRightCounter = "s mdes panel panel-default pull-right txt";
143 $getid = $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];
155 $returnValues["array"][] = "<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."\">".
157 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>";
161 // for ($i=$returnValues['start']; $i < $returnValues['total']; $i++) {
163 // $getid = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? ($inbox->within_str($senderCounter, "<from>", "</from>")) : ($inbox->within_str($senderCounter, "<to>", "</to>"));
164 // $getid = $inbox->FindUser($getid,$id_mail_path);
165 // $getid = trim($inbox->GetImgTrip($getid));
166 // $getid = explode("\n", $getid);
167 // $uimg = trim($getid[5]);
168 // $lr = ($inbox->within_str($messages[0][$i], "<from>", "</from>")==$uid) ? "pull-left" : "pull-right";
170 // $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";
171 // $returnValues["array"][] = "<div class=\"panel panel-default ic4 {$lr}\"><img src=\"".$livesitePath2."/ico/{$uimg}\" class=\"pic2\" ></div><div class=\"".$leftRightCounter."\">".
172 // 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>";
176 if(isset($returnValues["array"])){
177 echo json_encode($returnValues);