OSDN Git Service

trpgchat ver2.6.1
[trpgtools-onweb/AjaxChat.git] / lib / write.php
1 <?php
2 /*
3  Ajax Chat for TRPG ver.2.6.1
4  (c)2007-2009 Cake All Rights Reserved.
5  Mail : cake_67@users.sourceforge.jp
6  Home : http://trpgtools-onweb.sourceforge.jp/
7  */
8
9 /*****************
10  *  PHPライブラリ:書きこみ用
11  *****************/
12
13 /*
14  * HTMLタグ変換
15  */
16 function convert_html_tag($str)
17 {
18     if (ALLOW_TAG) {
19         // fontタグ
20         $str = preg_replace("/&lt;font(\s{1,}size=[1-7\+\-][0-4]{0,}||\s{1,}color=[#]{0,}[0-9a-z]{1,7}||\s{1,}size=[1-7\+\-][0-4]{0,}\s{1,}color=[#]{0,}[0-9a-z]{1,7}||\s{1,}color=[#]{0,}[0-9a-z]{1,7}\s{1,}size=[1-7\+\-][0-4]{0,})&gt;(.*?)&lt;\/font&gt;/i", "<font$1>$2</font>", $str);
21         // iniで指定のタグ
22         foreach($GLOBALS['AJAX_CHAT_TRPG']['TAGS'] as $t) {
23             if ($t[1]) {
24             $str = preg_replace("/&lt;($t[0])&gt;(.*?)&lt;\/$t[0]&gt;/i", "<$1>$2</$1>", $str);
25             }
26         }
27     }
28     return $str;
29 }
30
31 /*
32  * オートリンク変換
33  */
34 function convert_autolink($str)
35 {
36     if (AUTOLINK) {
37         $str = preg_replace("/((http)|(https)):\/\/[0-9a-zA-Z\+\-\$\;\?\/\.,!#%&=~@*:_]+/i", "<a href=\"$0\" target=\"_blank\">$0</a>", $str);
38     }
39     return $str;
40 }
41
42
43 /*
44  * 直近の過去ログ取得
45  */
46 function write_recent_past($write, $pdata) {
47     $pfp = @fopen($pdata, "a+") or die("過去ログファイルを開けません。");
48
49     fwrite($pfp, $write);
50
51     return true;
52 }
53
54  ?>