3 function BeSanitize($string) {
4 if (strlen($string) > 250) {
5 $echo = "Content too long";
8 $string = str_replace("<", "<", $string);
9 $string = str_replace(">", ">", $string);
10 $string = str_replace("\n", "<br>", $string);
11 $string = str_replace(" ", " ", $string);
12 $string = urlencode($string);
17 function FindUser($id,$id_mail_path) {
18 $list = file($id_mail_path);
21 foreach ($list as $key => $value) {
22 if (substr(trim($value), 0, 9) == $id) {
23 $r = explode("<><>", $value);
34 function GetID($cookie,$id_mail_path) {
35 $email = Decrypt($_COOKIE['DMDM'], KEY
);
36 $list = file($id_mail_path);
39 foreach ($list as $key => $value) {
40 $mail = explode("<><>", trim($value));
41 if ($mail[1] == trim($email)) {
53 function WriteMDB($user, $inf, $sender, $subj, $to) {
54 $fdir = substr($user, 0, 1);
55 $sdir = substr($user, 1, 1);
56 $udir = str_replace("@", "-", $user);
57 $path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}";
58 if (!file_exists($path)) {
59 @mkdir
(MDB_PATH
."{$fdir}");
60 @mkdir
(MDB_PATH
."{$fdir}/{$sdir}");
61 @mkdir
(MDB_PATH
."{$fdir}/{$sdir}/{$udir}");
63 if (file_exists($path."/ban.txt")) {
64 $banlist = file($path."/ban.txt");
65 foreach ($banlist as $key => $value) {
66 if (trim($sender) == trim($value)) {
67 echo "ƒ�ƒbƒZ�[ƒW‘—�M‚ªŽ¸”s‚µ�Aƒ†�[ƒU�[‚É‚æ‚Á‚ăuƒ�ƒbƒN‚³‚ꂽ<br>";
73 $writeData = "<id>{$time}</id><from>{$sender}</from><to>{$to}</to><subj>{$subj}</subj><msg>{$inf}</msg><read>0</read>\n";
74 $filename = $path."/".$time.".dat";
75 if (!file_exists($filename)) {
76 if(!file_put_contents($filename,$writeData)) {
83 $handle = fopen($filename, "w");
84 if(!fwrite($handle, $writeData)) {
94 function BlockUser($user,$kausap) {
95 $fdir = substr($user, 0, 1);
96 $sdir = substr($user, 1, 1);
97 $udir = str_replace("@", "-", $user);
98 $path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}/ban.txt";
99 $banlist = file($path);
101 foreach ($banlist as $key => $value) {
102 if (trim($value) == trim($kausap))
106 $handle = fopen($path, "a");
107 $bandata = trim($kausap)."\n";
108 if(!fwrite($handle, $bandata))
115 function UnblockUser($user,$kausap) {
116 $fdir = substr($user, 0, 1);
117 $sdir = substr($user, 1, 1);
118 $udir = str_replace("@", "-", $user);
119 $path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}/ban.txt";
120 $banlist = file($path);
121 foreach ($banlist as $key => $value) {
122 if (trim($value) == trim($kausap))
123 unset($banlist[$key]);
125 $banlist = implode("\n", $banlist);
126 if (empty($banlist)) {
127 if(!file_put_contents($path, $banlist))
130 if(!file_put_contents($path, $banlist))
136 function CheckBanList($user,$kausap) {
137 $fdir = substr($user, 0, 1);
138 $sdir = substr($user, 1, 1);
139 $udir = str_replace("@", "-", $user);
140 $path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}/ban.txt";
141 $banlist = file($path);
142 foreach ($banlist as $key => $value) {
143 if (trim($value) == trim($kausap))
149 function ReadMDB($user) {
150 $fdir = substr($user, 0, 1);
151 $sdir = substr($user, 1, 1);
152 $udir = str_replace("@", "-", $user);
153 $path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}";
156 foreach (glob($path."/*.dat") as $filename) {
157 $m = file($filename);
159 foreach ($m as $key => $value) {
160 $messages[$i][$j] = $value;
168 function specificMDB($user, $dat, $bool = FALSE) {
169 $fdir = substr($user, 0, 1);
170 $sdir = substr($user, 1, 1);
171 $udir = str_replace("@", "-", $user);
172 $path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}";
174 if(file_exists($path."/{$dat}.dat")){
176 $messages = file("{$path}/{$dat}.dat");
181 $count = (count($messages) <= 4) ?
"TRUE" : "FALSE";
182 $messages = array_slice($messages, -4, 4);
183 return array($messages, $count);
189 // function specificMDB($user, $dat) {
190 // $fdir = substr($user, 0, 1);
191 // $sdir = substr($user, 1, 1);
192 // $udir = str_replace("@", "-", $user);
193 // $path = MDB_PATH."{$fdir}/{$sdir}/{$udir}";
194 // $messages = array();
195 // if(file_exists($path."/{$dat}.dat")){
197 // //$dat = (!preg_match("/u_/i", $dat)) ? $dat : "u_".$dat;
199 // foreach (glob($path."/{$dat}.dat") as $filename) {
200 // $m = file($filename);
202 // foreach ($m as $key => $value) {
203 // // print_r($messages);
204 // $messages[$i][$j] = $value;
215 // function renameMDB($user, $dat) {
216 // $fdir = substr($user, 0, 1);
217 // $sdir = substr($user, 1, 1);
218 // $udir = str_replace("@", "-", $user);
219 // $path = MDB_PATH."{$fdir}/{$sdir}/{$udir}";
220 // $messages = array();
222 // $substr = $dat.".dat";
223 // $substr2 = substr($substr, 2);
224 // if(preg_match("/u_/i", $substr)){
225 // rename($_SESSION['sLoggedDir'] ."/".$substr, $_SESSION['sLoggedDir'] ."/".$substr2);
229 function within_str($subject, $lsearch, $rsearch) {
230 $data = strstr($subject, $lsearch);
231 $data = str_replace($lsearch, "", $data);
232 $trim = strstr($data, $rsearch);
234 return(str_replace($trim, "", $data));
237 function countMessage($subject) {
239 $str = $this->getContent3($subject);
240 foreach($str as $key){
241 if($this->within_str($key, "<read>", "</read>")==0 && !empty($key)){
248 // function getContent($files) {
251 // $homepage = file_get_contents($files);
252 // $test = explode(PHP_EOL, $homepage);
253 // foreach($test as $value){
254 // // echo $value."<br>";
255 // $valueTest = preg_replace('/\<[a-z]*>/', '', $value);
256 // $trim = preg_replace('/\<\/[a-z]*>/', '|', $valueTest);
257 // $valueTest1[] = rtrim($trim, '|');
259 // return $valueTest1;
260 // // print_r($valueTest1);
263 function getContent($files) {
266 $homepage = file_get_contents($files);
267 $test = explode(PHP_EOL
, $homepage);
270 function getContent3($files) {
273 $homepage = file_get_contents($files);
274 $test = explode(PHP_EOL
, $homepage);
278 function getContent2($files) {
281 $homepage = file($files);
284 // print_r($valueTest1);
287 function passContent($array) {
289 foreach ($array as $formidable) {
292 $fetch[] = explode('|', $formidable);
295 // print_r($array)."<br>";
300 function GetImgTrip($mail) {
302 $fdir = substr($mail, 0, 1);
303 $sdir = substr($mail, 1, 1);
304 $impo = file_get_contents(DB_PATH
."$fdir/$sdir/$mail");
305 if ($impo != NULL && $impo != "") {
312 function AddPostLimit($id,$plimit_path,$mah) {
314 $handle = fopen($plimit_path.$id.".txt", "a");
315 if(!fwrite($handle,"1\n"))
320 $handle = fopen($plimit_path.$id.".txt", "a");
321 if(!fwrite($handle,"1\n"))
328 function CheckPostLimit($id,$plimit_path,$mah) {
330 if (file_exists($plimit_path.$id.".txt")) {
331 $post_number = file($plimit_path.$id.".txt");
332 $post_number = count($post_number);
337 if (file_exists($plimit_path.$id.".txt")) {
338 $post_number = file($plimit_path.$id.".txt");
339 $post_number = count($post_number);
346 function CheckBanMessaging() {
347 $email = Decrypt($_COOKIE['DMDM'], KEY
);
348 $fdir = substr($email, 0, 1);
349 $sdir = substr($email, 1, 1);
350 $info = file(DB_PATH
."$fdir/$sdir/$email");
351 if(abs(trim($info[3])) < 1000)
358 function array_sort($array, $on, $order=SORT_ASC
) {
359 $new_array = array();
360 $sortable_array = array();
361 if (count($array) > 0) {
362 foreach ($array as $k => $v) {
364 foreach ($v as $k2 => $v2) {
366 $sortable_array[$k] = $v2;
370 $sortable_array[$k] = $v;
376 asort($sortable_array);
379 arsort($sortable_array);
383 foreach ($sortable_array as $k => $v) {
384 $new_array[$k] = $array[$k];
392 $email = Decrypt($_COOKIE['DMDM'], KEY
);
393 $fdir = substr($email, 0, 1);
394 $sdir = substr($email, 1, 1);
395 $tmp = strrpos($email, "@");
400 $info = MDB_PATH
."$fdir/$sdir/$zz";