OSDN Git Service

trpgchat ver2.6
[trpgtools-onweb/AjaxChat.git] / mindex.php
1 <?php
2 /*
3  Ajax Chat for TRPG ver.2.6
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 require_once './lib/trpgchat.php';
11 require_once './trpgchat-ini-2.php';
12 if (!file_exists('./trpgchat-ini.php')) {
13     exit('NOT ABAILABLE');
14 }
15
16 // 設定ファイルの読み込み
17 require_once './trpgchat-ini.php';
18 require_once './lib/trpgchat.php';
19 require_once './lib/mobile.php';
20
21 // 設定セット
22 set_config(read_config());
23
24 // 携帯使用設定
25 if (!USE_MOBILE) {
26     mobile_error('携帯からはご利用できません。');
27 }
28
29 // 携帯以外のアクセス禁止
30 if (!is_mobile_access($ua)) {
31     mobile_error('携帯以外からはご利用できません。');
32 }
33
34 // 書き込みブロック
35 write_block();
36
37 // アクセスブロック
38 access_block();
39
40 // リクエスト受信
41 $request = $_GET;
42 // 受信データの成形
43 if ($request) {
44     foreach($request as $k => $v) {
45         $data[$k] = htmlspecialchars($v);
46     }
47 }
48 if ($request['r']) {
49     $rows = $request['r'];
50 } else {
51     $rows = MOBILE_COMMENTS_DEFAULT;
52 }
53
54 // HTML出力
55 mb_http_output("SJIS-win");
56 ob_start("mb_output_handler");
57 html_mobile_header(CHAT_TITLE);
58
59 if ($request['msg']) {
60     print '<p>'.$request['msg'].'</p>'."\n";
61 }
62 ?>
63
64 <form action="./mwrite.php">
65 <table width="100%">
66
67 <?php
68 if (!UNPUBLIC_LAST_PASTLOG || is_show_mobile_body()) {
69     print '<tr>';
70     print '<td><font size="'.MOBILE_FONT_SIZE.'">';
71     print '<a href="./mindex.php?'.http_build_query($request).'">更新</a>';
72
73     if ($GLOBALS['AJAX_CHAT_TRPG']['MOBILE_COMMENTS']) {
74         print ' 表示数 ';
75         $param['c'] = $request['c'];
76         foreach ($GLOBALS['AJAX_CHAT_TRPG']['MOBILE_COMMENTS'] as $v) {
77             if ($v == $rows) {
78                 print $v." ";
79             } else {
80                 $param['r'] = $v;
81                 print '<a href="./mindex.php?'.http_build_query($param).'">'.$v.'</a> ';
82             }
83         }
84     }
85
86     print '</font></td>';
87     print '</tr>';
88 }
89 ?>
90 <tr>
91 <td>
92 <?php 
93 if ($request['c']) {
94     print '<input type="hidden" name="n" value="">';
95     print '<input type="hidden" name="c" value="'.$request['c'].'">';
96 } else {
97     print '<font size="'.MOBILE_FONT_SIZE.'">お名前:</font><input type="text" name="n" size="8" istyle="1" mode="hiragana" value="">';
98 }
99 print '<input type="hidden" name="r" value="'.$rows.'">';
100 ?>
101 </td>
102 </tr>
103 <td><input type="text" name="m" istyle="1" mode="hiragana" value=""></td>
104 </tr>
105 <td><font size="<?php print MOBILE_FONT_SIZE; ?>">
106 <input type="submit" value="発言" name="submit">
107 </font></td>
108 </tr>
109 </table>
110 </form>
111
112 <?php
113 // 本文表示モードのチェック
114 if (UNPUBLIC_LAST_PASTLOG) {
115     if (is_show_mobile_body()) {
116         // 本文出力
117         print mobile_read_log($rows, SHOW_SYSTEM_LOG);
118     } else {
119         print nl2br(NO_LAST_PASTLOG_MSG);
120     }
121 } else {
122     // 本文出力
123     print mobile_read_log($rows, SHOW_SYSTEM_LOG);
124 }
125
126 // ログアウト
127 if ($request['c']) {
128     print '<hr><a href="./mwrite.php?n='.$request['c'].'&m=ログアウト&mode=logout">ログアウト</a><br>';
129 }
130 // フッター
131 html_mobile_footer(true);
132
133 exit;
134  ?>