-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathtitle.php
More file actions
250 lines (219 loc) · 7.98 KB
/
title.php
File metadata and controls
250 lines (219 loc) · 7.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<?php
/**
* rep2 - タイトルページ
*/
require_once './conf/conf.inc.php';
$_login->authorize(); // ユーザ認証
//=========================================================
// 変数
//=========================================================
if (!empty($GLOBALS['pref_dir_realpath_failed_msg'])) {
P2Util::pushInfoHtml('<p>' . $GLOBALS['pref_dir_realpath_failed_msg'] . '</p>');
}
$p2web_url_r = P2Util::throughIme($_conf['p2web_url']);
$expack_url_r = P2Util::throughIme($_conf['expack.web_url']);
$expack_dl_url_r = P2Util::throughIme($_conf['expack.download_url']);
$expack_hist_url_r = P2Util::throughIme($_conf['expack.history_url']);
// {{{ データ保存ディレクトリのパーミッションの注意を喚起する
P2Util::checkDirWritable($_conf['dat_dir']);
$checked_dirs[] = $_conf['dat_dir']; // チェック済みのディレクトリを格納する配列に
// まだチェックしていなければ
if (!in_array($_conf['idx_dir'], $checked_dirs)) {
P2Util::checkDirWritable($_conf['idx_dir']);
$checked_dirs[] = $_conf['idx_dir'];
}
if (!in_array($_conf['pref_dir'], $checked_dirs)) {
P2Util::checkDirWritable($_conf['pref_dir']);
$checked_dirs[] = $_conf['pref_dir'];
}
// }}}
//=========================================================
// 前処理
//=========================================================
// ●ID 2ch オートログイン
if ($array = P2Util::readIdPw2ch()) {
list($login2chID, $login2chPW, $autoLogin2ch) = $array;
if ($autoLogin2ch) {
require_once P2_LIB_DIR . '/login2ch.inc.php';
login2ch();
}
}
//=========================================================
// プリント設定
//=========================================================
// 最新版チェック
$newversion_found = '';
if (!empty($_conf['updatan_haahaa'])) {
$newversion_found = checkUpdatan();
}
// ログインユーザ情報
$htm['auth_user'] = "<p>ログインユーザ: {$_login->user_u} - " . date("Y/m/d (D) G:i") . "</p>\n";
// (携帯)ログイン用URL
$base_url = rtrim(dirname(P2Util::getMyUrl()), '/') . '/';
$url_b = $base_url . '?user=' . rawurlencode($_login->user_u) . '&b=';
$url_b_ht = htmlspecialchars($url_b, ENT_QUOTES);
// 携帯用ビューを開くブックマークレット
$bookmarklet = <<<JS
(function (u, w, v, x, y) {
var t;
if (typeof window.outerHeight === 'number') {
t = y + window.outerHeight;
if (v < t){
v = t;
}
}
t = window.open(u, '', 'width=' + w + ',height=' + v + ',' +
'scrollbars=yes,resizable=yes,toolbar=no,menubar=no,status=no'
);
if (t) {
t.resizeTo(w, v);
t.focus();
return false;
} else {
return true;
}
})
JS;
$bookmarklet = preg_replace('/\\b(var|return|typeof) +/', '$1{%space%}', $bookmarklet);
$bookmarklet = preg_replace('/\\s+/', '', $bookmarklet);
$bookmarklet = str_replace('{%space%}', ' ', $bookmarklet);
$bookmarklet_k = $bookmarklet . "('{$url_b}k',240,320,20,-100)";
$bookmarklet_i = $bookmarklet . "('{$url_b}i',320,480,20,-100)";
$bookmarklet_k_ht = htmlspecialchars($bookmarklet_k, ENT_QUOTES);
$bookmarklet_i_ht = htmlspecialchars($bookmarklet_i, ENT_QUOTES);
$bookmarklet_k_en = rawurlencode($bookmarklet_k);
$bookmarklet_i_en = rawurlencode($bookmarklet_i);
$htm['ktai_url'] = <<<EOT
<table border="0" cellspacing="0" cellpadding="1">
<tbody>
<tr>
<th>携帯用URL:</th>
<td><a href="{$url_b_ht}k" target="_blank" onclick="return {$bookmarklet_k_ht};">{$url_b_ht}k</a></td>
<td>[<a href="javascript:{$bookmarklet_k_en};">bookmarklet</a>]</td>
</tr>
<tr>
<th>iPhone用URL:</th>
<td><a href="{$url_b_ht}i" target="_blank" onclick="return {$bookmarklet_i_ht};">{$url_b_ht}i</a></td>
<td>[<a href="javascript:{$bookmarklet_i_en};">bookmarklet</a>]</td>
</tr>
</tbody>
</table>
EOT;
// 前回のログイン情報
$htm['log'] = '';
$htm['last_login'] = '';
if ($_conf['login_log_rec'] && $_conf['last_login_log_show']) {
if (($log = P2Util::getLastAccessLog($_conf['login_log_file'])) !== false) {
$htm['log'] = array_map('htmlspecialchars', $log);
$htm['last_login'] = <<<EOT
<br>
<table border="0" cellspacing="0" cellpadding="1">
<caption>前回のログイン情報 - {$htm['log']['date']}</caption>
<tbody>
<tr><th>ユーザ:</th><td>{$htm['log']['user']}</td></tr>
<tr><th>IP:</th><td>{$htm['log']['ip']}</td></tr>
<tr><th>HOST:</th><td>{$htm['log']['host']}</td></tr>
<tr><th>UA:</th><td>{$htm['log']['ua']}</td></tr>
<tr><th>REFERER:</th><td>{$htm['log']['referer']}</td></tr>
</tbody>
</table>
EOT;
}
}
//=========================================================
// HTMLプリント
//=========================================================
$ptitle = 'rep2 - title';
echo $_conf['doctype'];
echo <<<EOP
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
{$_conf['extra_headers_ht']}
<title>{$ptitle}</title>
<base target="read">
<link rel="stylesheet" type="text/css" href="css.php?css=style&skin={$skin_en}">
<link rel="stylesheet" type="text/css" href="css.php?css=title&skin={$skin_en}">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
</head>
<body>\n
EOP;
// 情報メッセージ表示
P2Util::printInfoHtml();
echo <<<EOP
<br>
<div class="container">
{$newversion_found}
<p>rep2-expack rev.{$_conf['p2expack']}; extends rep2-{$_conf['p2version']}<br>
<a href="{$expack_url_r}"{$_conf['ext_win_target_at']}>{$_conf['expack.web_url']}</a><br>
<a href="{$p2web_url_r}"{$_conf['ext_win_target_at']}>{$_conf['p2web_url']}</a></p>
<ul>
<li><a href="viewtxt.php?file=doc/README.txt">README.txt</a></li>
<li><a href="viewtxt.php?file=doc/README-EX.txt">README-EX.txt</a></li>
<li><a href="img/how_to_use.png">ごく簡単な操作法</a></li>
<li><a href="{$expack_hist_url_r}"{$_conf['ext_win_target_at']}>拡張パック 更新記録</a></li>
<!-- <li><a href="viewtxt.php?file=doc/ChangeLog.txt">ChangeLog(rep2 更新記録)</a></li> -->
</ul>
{$htm['auth_user']}
{$htm['ktai_url']}
{$htm['last_login']}
</div>
</body>
</html>
EOP;
//==================================================
// 関数
//==================================================
// {{{ checkUpdatan()
/**
* オンライン上のrep2-expack最新版をチェックする
*
* @return string HTML
*/
function checkUpdatan()
{
global $_conf, $p2web_url_r, $expack_url_r, $expack_dl_url_r, $expack_hist_url_r;
$no_p2status_dl_flag = false;
$ver_txt_url = $_conf['expack.web_url'] . 'version.txt';
$cachefile = P2Util::cacheFileForDL($ver_txt_url);
FileCtl::mkdirFor($cachefile);
if (file_exists($cachefile)) {
// キャッシュの更新が指定時間以内なら
if (filemtime($cachefile) > time() - $_conf['p2status_dl_interval'] * 86400) {
$no_p2status_dl_flag = true;
}
}
if (empty($no_p2status_dl_flag)) {
P2Util::fileDownload($ver_txt_url, $cachefile);
}
$ver_txt = FileCtl::file_read_lines($cachefile, FILE_IGNORE_NEW_LINES);
$update_ver = $ver_txt[0];
$kita = 'キタ━━━━(゚∀゚)━━━━!!!!!!';
//$kita = 'キタ*・゚゚・*:.。..。.:*・゚(゚∀゚)゚・*:.。. .。.:*・゚゚・*!!!!!';
$newversion_found_html = '';
if ($update_ver && version_compare($update_ver, $_conf['p2expack'], '>')) {
$newversion_found_html = <<<EOP
<div class="kakomi">
{$kita}<br>
オンライン上に 拡張パック の最新バージョンを見つけますた。<br>
rep2-expack rev.{$update_ver} → <a href="{$expack_dl_url_r}"{$_conf['ext_win_target_at']}>ダウンロード</a> / <a href="{$expack_hist_url_r}"{$_conf['ext_win_target_at']}>更新記録</a>
</div>
<hr class="invisible">
EOP;
}
return $newversion_found_html;
}
// }}}
/*
* Local Variables:
* mode: php
* coding: cp932
* tab-width: 4
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
// vim: set syn=php fenc=cp932 ai et ts=4 sw=4 sts=4 fdm=marker: