/
index.php
143 lines (116 loc) · 3.59 KB
/
index.php
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
<?php
// p2 - インデックスページ
require_once './conf/conf.inc.php';
$_login->authorize(); // ユーザ認証
// アクセス拒否用の.htaccessをデータディレクトリに自動作成する
_makeDenyHtaccess($_conf['pref_dir']);
_makeDenyHtaccess($_conf['dat_dir']);
_makeDenyHtaccess($_conf['idx_dir']);
if (UA::isK() || UA::isIPhoneGroup()) {
// GETクエリーでurlの指定があれば、そのままスレッド読みへ飛ばす
_locationReadPhpIfGetUrl(); // void|exit
if (UA::isIPhoneGroup()) {
require_once P2_IPHONE_LIB_DIR . '/index_print_k.inc.php';
} else {
require_once P2_LIB_DIR . '/index_print_k.inc.php';
}
index_print_k();
} else {
// {{{ PC用 変数
$title_page = 'title.php';
$read_page = _getReadPage();
$sidebar = isset($_GET['sidebar']) ? $_GET['sidebar'] : null;
$ptitle = "rep2";
// }}}
// {{{ PC用 HTMLプリント
P2Util::headerNoCache();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html lang="ja">
<head>
<?php
P2View::printExtraHeadersHtml($frameset = true);
?>
<title><?php eh($ptitle); ?></title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
</head>
<?php if (!$sidebar) { ?>
<frameset cols="
<?php if (!$_conf['pane_mode']) { ?><?php eh($_conf['frame_menu_width']); ?>,*
<?php } else { ?><?php eh($_conf['frame_menu_width']); ?>,<?php eh($_conf['frame_subject_width']); ?>,<?php eh($_conf['frame_read_width']); ?><?php } ?>
" frameborder="1" border="1">
<frame src="<?php eh($_conf['menu_php']); ?>" name="menu" scrolling="auto">
<?php } ?>
<?php if (!$_conf['pane_mode']) { ?>
<frameset id="fsright" name="fsright" rows="<?php eh($_conf['frame_subject_width']); ?>,<?php eh($_conf['frame_read_width']); ?>" frameborder="1" border="2">
<?php } ?>
<frame id="subject" name="subject" src="<?php eh($title_page); ?>" scrolling="auto">
<frame id="read" name="read" src="<?php eh($read_page); ?>" scrolling="auto">
<?php if (!$_conf['pane_mode']) { ?>
</frameset>
<?php } ?>
<?php if (!$sidebar) { ?>
</frameset>
<?php } ?>
</html><?php
// }}}
}
exit;
//============================================================================
// 関数(このファイル内でのみ利用)
//============================================================================
/**
* ディレクトリに(アクセス拒否のための) .htaccess がなければ、自動で生成する
*
* @return void
*/
function _makeDenyHtaccess($dir)
{
$hta = $dir . '/.htaccess';
if (!file_exists($hta)) {
$data = 'Order allow,deny' . "\n"
. 'Deny from all' . "\n";
file_put_contents($hta, $data, LOCK_EX);
}
}
/**
* GETクエリーでurlの指定があれば、そのままスレッド読みへ飛ばす
*
* @return void|exit
*/
function _locationReadPhpIfGetUrl()
{
global $_conf;
if (!empty($_GET['url']) || !empty($_GET['nama_url'])) {
header(sprintf('Location: %s/%s?%s',
dirname(UriUtil::getMyUri()), $_conf['read_php'], $_SERVER['QUERY_STRING'])
);
exit;
}
}
/**
* read(右下)frameのsrc用ページURLを取得する
*
* @return string
*/
function _getReadPage()
{
global $_conf;
if (!empty($_GET['url']) || !empty($_GET['nama_url'])) {
$read_page = $_conf['read_php'] . '?' . $_SERVER['QUERY_STRING'];
} else {
$read_page = $_conf['first_page'] ? $_conf['first_page'] : 'first_cont.php';
}
return $read_page;
}
/*
* 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: