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 loggedEmail($email, $directory){
18 $strReplaced = str_replace("@", "-", $email);
19 $firstChar = substr($email, 0, 1);
20 $secondChar = substr($email, 1, 1);
21 $strReplaced = trim($strReplaced);
22 $directory = $directory.$firstChar."/".$secondChar."/".$strReplaced."/";
25 function FindUser($id,$id_mail_path) {
26 $list = file($id_mail_path);
29 foreach ($list as $key => $value) {
30 if (substr(trim($value), 0, 9) == $id) {
31 $r = explode("<><>", $value);
42 function GetID($cookie,$id_mail_path) {
44 $list = file($id_mail_path);
47 foreach ($list as $key => $value) {
48 $mail = explode("<><>", trim($value));
49 if ($mail[1] == trim($email)) {
61 function WriteMDB($user, $inf, $sender, $subj, $to) {
62 $fdir = substr($user, 0, 1);
63 $sdir = substr($user, 1, 1);
64 $udir = str_replace("@", "-", $user);
65 $path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}";
66 if (!file_exists($path)) {
67 @mkdir
(MDB_PATH
."{$fdir}");
68 @mkdir
(MDB_PATH
."{$fdir}/{$sdir}");
69 @mkdir
(MDB_PATH
."{$fdir}/{$sdir}/{$udir}");
71 if (file_exists($path."/ban.txt")) {
72 $banlist = file($path."/ban.txt");
73 foreach ($banlist as $key => $value) {
74 if (trim($sender) == trim($value)) {
75 echo "Message sending failed, You have been blocked by the user";
81 $writeData = "<id>{$time}</id><from>{$sender}</from><to>{$to}</to><subj>{$subj}</subj><msg>{$inf}</msg><read>0</read>\n";
82 $filename = $path."/".$time.".dat";
83 if (!file_exists($filename)) {
84 if(!file_put_contents($filename,$writeData)) {
91 $handle = fopen($filename, "w");
92 if(!fwrite($handle, $writeData)) {
102 function BlockUser($user,$kausap) {
103 $fdir = substr($user, 0, 1);
104 $sdir = substr($user, 1, 1);
105 $udir = str_replace("@", "-", $user);
106 $path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}/ban.txt";
107 $banlist = file($path);
109 foreach ($banlist as $key => $value) {
110 if (trim($value) == trim($kausap))
114 $handle = fopen($path, "a");
115 $bandata = trim($kausap)."\n";
116 if(!fwrite($handle, $bandata))
123 function UnblockUser($user,$kausap) {
124 $fdir = substr($user, 0, 1);
125 $sdir = substr($user, 1, 1);
126 $udir = str_replace("@", "-", $user);
127 $path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}/ban.txt";
128 $banlist = file($path);
129 foreach ($banlist as $key => $value) {
130 if (trim($value) == trim($kausap))
131 unset($banlist[$key]);
133 $banlist = implode("\n", $banlist);
134 if (empty($banlist)) {
135 if(!file_put_contents($path, $banlist))
138 if(!file_put_contents($path, $banlist))
144 function CheckBanList($user,$kausap) {
145 $fdir = substr($user, 0, 1);
146 $sdir = substr($user, 1, 1);
147 $udir = str_replace("@", "-", $user);
148 $path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}/ban.txt";
149 $banlist = file($path);
150 foreach ($banlist as $key => $value) {
151 if (trim($value) == trim($kausap))
157 function ReadMDB($user) {
158 $fdir = substr($user, 0, 1);
159 $sdir = substr($user, 1, 1);
160 $udir = str_replace("@", "-", $user);
161 $path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}";
164 foreach (glob($path."/*.dat") as $filename) {
165 $m = file($filename);
167 foreach ($m as $key => $value) {
168 $messages[$i][$j] = $value;
176 function specificMDB($user, $dat, $bool = FALSE) {
177 $fdir = substr($user, 0, 1);
178 $sdir = substr($user, 1, 1);
179 $udir = str_replace("@", "-", $user);
180 $path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}";
181 // echo $dat."<br />";
183 if(file_exists($path."/{$dat}.dat")){
185 $messages = file("{$path}/{$dat}.dat");
190 // $messages = array_slice($messages, -4, 4);
197 // function specificMDB($user, $dat) {
198 // $fdir = substr($user, 0, 1);
199 // $sdir = substr($user, 1, 1);
200 // $udir = str_replace("@", "-", $user);
201 // $path = MDB_PATH."{$fdir}/{$sdir}/{$udir}";
202 // $messages = array();
203 // if(file_exists($path."/{$dat}.dat")){
205 // //$dat = (!preg_match("/u_/i", $dat)) ? $dat : "u_".$dat;
207 // foreach (glob($path."/{$dat}.dat") as $filename) {
208 // $m = file($filename);
210 // foreach ($m as $key => $value) {
211 // // print_r($messages);
212 // $messages[$i][$j] = $value;
223 // function renameMDB($user, $dat) {
224 // $fdir = substr($user, 0, 1);
225 // $sdir = substr($user, 1, 1);
226 // $udir = str_replace("@", "-", $user);
227 // $path = MDB_PATH."{$fdir}/{$sdir}/{$udir}";
228 // $messages = array();
230 // $substr = $dat.".dat";
231 // $substr2 = substr($substr, 2);
232 // if(preg_match("/u_/i", $substr)){
233 // rename($_SESSION['sLoggedDir'] ."/".$substr, $_SESSION['sLoggedDir'] ."/".$substr2);
237 function within_str($subject, $lsearch, $rsearch) {
238 $data = strstr($subject, $lsearch);
239 $data = str_replace($lsearch, "", $data);
240 $trim = strstr($data, $rsearch);
242 return(str_replace($trim, "", $data));
245 // function getContent($files) {
248 // $homepage = file_get_contents($files);
249 // $test = explode(PHP_EOL, $homepage);
250 // foreach($test as $value){
251 // // echo $value."<br>";
252 // $valueTest = preg_replace('/\<[a-z]*>/', '', $value);
253 // $trim = preg_replace('/\<\/[a-z]*>/', '|', $valueTest);
254 // $valueTest1[] = rtrim($trim, '|');
256 // return $valueTest1;
257 // // print_r($valueTest1);
260 function getContent($files) {
263 $homepage = file_get_contents($files);
264 $test = explode(PHP_EOL
, $homepage);
268 function getContent2($files) {
271 $homepage = file($files);
274 // print_r($valueTest1);
277 function passContent($array) {
279 foreach ($array as $formidable) {
282 $fetch[] = explode('|', $formidable);
285 // print_r($array)."<br>";
290 function GetImgTrip($mail) {
292 $fdir = substr($mail, 0, 1);
293 $sdir = substr($mail, 1, 1);
294 $impo = file_get_contents(DB_PATH
."$fdir/$sdir/$mail");
295 if ($impo != NULL && $impo != "") {
302 function AddPostLimit($id,$plimit_path,$mah) {
304 $handle = fopen($plimit_path.$id.".txt", "a");
305 if(!fwrite($handle,"1\n"))
310 $handle = fopen($plimit_path.$id.".txt", "a");
311 if(!fwrite($handle,"1\n"))
318 function CheckPostLimit($id,$plimit_path,$mah) {
320 if (file_exists($plimit_path.$id.".txt")) {
321 $post_number = file($plimit_path.$id.".txt");
322 $post_number = count($post_number);
327 if (file_exists($plimit_path.$id.".txt")) {
328 $post_number = file($plimit_path.$id.".txt");
329 $post_number = count($post_number);