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 "メッセージ送信が失敗し、ユーザーによってブロックされた<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 $messages = array_slice($messages, -4, 4);
188 // function specificMDB($user, $dat) {
189 // $fdir = substr($user, 0, 1);
190 // $sdir = substr($user, 1, 1);
191 // $udir = str_replace("@", "-", $user);
192 // $path = MDB_PATH."{$fdir}/{$sdir}/{$udir}";
193 // $messages = array();
194 // if(file_exists($path."/{$dat}.dat")){
196 // //$dat = (!preg_match("/u_/i", $dat)) ? $dat : "u_".$dat;
198 // foreach (glob($path."/{$dat}.dat") as $filename) {
199 // $m = file($filename);
201 // foreach ($m as $key => $value) {
202 // // print_r($messages);
203 // $messages[$i][$j] = $value;
214 // function renameMDB($user, $dat) {
215 // $fdir = substr($user, 0, 1);
216 // $sdir = substr($user, 1, 1);
217 // $udir = str_replace("@", "-", $user);
218 // $path = MDB_PATH."{$fdir}/{$sdir}/{$udir}";
219 // $messages = array();
221 // $substr = $dat.".dat";
222 // $substr2 = substr($substr, 2);
223 // if(preg_match("/u_/i", $substr)){
224 // rename($_SESSION['sLoggedDir'] ."/".$substr, $_SESSION['sLoggedDir'] ."/".$substr2);
228 function within_str($subject, $lsearch, $rsearch) {
229 $data = strstr($subject, $lsearch);
230 $data = str_replace($lsearch, "", $data);
231 $trim = strstr($data, $rsearch);
233 return(str_replace($trim, "", $data));
236 // function getContent($files) {
239 // $homepage = file_get_contents($files);
240 // $test = explode(PHP_EOL, $homepage);
241 // foreach($test as $value){
242 // // echo $value."<br>";
243 // $valueTest = preg_replace('/\<[a-z]*>/', '', $value);
244 // $trim = preg_replace('/\<\/[a-z]*>/', '|', $valueTest);
245 // $valueTest1[] = rtrim($trim, '|');
247 // return $valueTest1;
248 // // print_r($valueTest1);
251 function getContent($files) {
254 $homepage = file_get_contents($files);
255 $test = explode(PHP_EOL
, $homepage);
259 function getContent2($files) {
262 $homepage = file($files);
265 // print_r($valueTest1);
268 function passContent($array) {
270 foreach ($array as $formidable) {
273 $fetch[] = explode('|', $formidable);
276 // print_r($array)."<br>";
281 function GetImgTrip($mail) {
283 $fdir = substr($mail, 0, 1);
284 $sdir = substr($mail, 1, 1);
285 $impo = file_get_contents(DB_PATH
."$fdir/$sdir/$mail");
286 if ($impo != NULL && $impo != "") {
293 function AddPostLimit($id,$plimit_path,$mah) {
295 $handle = fopen($plimit_path.$id.".txt", "a");
296 if(!fwrite($handle,"1\n"))
301 $handle = fopen($plimit_path.$id.".txt", "a");
302 if(!fwrite($handle,"1\n"))
309 function CheckPostLimit($id,$plimit_path,$mah) {
311 if (file_exists($plimit_path.$id.".txt")) {
312 $post_number = file($plimit_path.$id.".txt");
313 $post_number = count($post_number);
318 if (file_exists($plimit_path.$id.".txt")) {
319 $post_number = file($plimit_path.$id.".txt");
320 $post_number = count($post_number);