1 | <?php |
---|
2 | /** |
---|
3 | * @copyright 2005-2007 OpenPNE Project |
---|
4 | * @license http://www.php.net/license/3_01.txt PHP License 3.01 |
---|
5 | */ |
---|
6 | |
---|
7 | |
---|
8 | //デフォルトページ |
---|
9 | $GLOBALS['__Framework']['default_page'] = 'h_home'; |
---|
10 | |
---|
11 | //<PCKTAI |
---|
12 | if (!OPENPNE_ENABLE_KTAI) { |
---|
13 | // disable ktai module |
---|
14 | exit; |
---|
15 | } |
---|
16 | //> |
---|
17 | |
---|
18 | // User-Agent判別 |
---|
19 | if (CHECK_KTAI_UA && !isKtaiUserAgent()) { |
---|
20 | openpne_redirect('pc'); |
---|
21 | } |
---|
22 | |
---|
23 | // IPアドレスチェック |
---|
24 | if (CHECK_KTAI_IP) { |
---|
25 | require_once 'Net/IPv4.php'; |
---|
26 | $is_valid_ip = false; |
---|
27 | for ($i = 0; $i < count($GLOBALS['_OPENPNE_KTAI_IP_LIST']); $i++) { |
---|
28 | if (Net_IPv4::ipInNetwork($_SERVER['REMOTE_ADDR'], $GLOBALS['_OPENPNE_KTAI_IP_LIST'][$i]) |
---|
29 | || Net_IPv4::ipInNetwork($_SERVER['HTTP_X_FORWARDED_FOR'], $GLOBALS['_OPENPNE_KTAI_IP_LIST'][$i])) { |
---|
30 | $is_valid_ip = true; |
---|
31 | break; |
---|
32 | } |
---|
33 | } |
---|
34 | |
---|
35 | if (!$is_valid_ip) { |
---|
36 | openpne_redirect('pc'); |
---|
37 | } |
---|
38 | } |
---|
39 | |
---|
40 | $agent = new OpenPNE_KtaiUA(); |
---|
41 | if ($agent->is_docomo()) { |
---|
42 | $GLOBALS['__Framework']['carrier'] = 'i'; |
---|
43 | } elseif ($agent->is_au()) { |
---|
44 | $GLOBALS['__Framework']['carrier'] = 'e'; |
---|
45 | } elseif ($agent->is_vodafone()) { |
---|
46 | $GLOBALS['__Framework']['carrier'] = 's'; |
---|
47 | } |
---|
48 | |
---|
49 | // 文字コード変換 |
---|
50 | function ktai_convert_encoding($arr) |
---|
51 | { |
---|
52 | return is_array($arr) ? |
---|
53 | array_map('ktai_convert_encoding', $arr) : |
---|
54 | mb_convert_encoding($arr, 'UTF-8', 'SJIS-win'); |
---|
55 | } |
---|
56 | |
---|
57 | // 絵文字変換 |
---|
58 | function ktai_convert_emoji($arr) |
---|
59 | { |
---|
60 | return is_array($arr) ? |
---|
61 | array_map('ktai_convert_emoji', $arr) : |
---|
62 | emoji_escape($arr); |
---|
63 | } |
---|
64 | |
---|
65 | function ktai_convert($arr) |
---|
66 | { |
---|
67 | $arr = ktai_convert_emoji($arr); |
---|
68 | $arr = ktai_convert_encoding($arr); |
---|
69 | return $arr; |
---|
70 | } |
---|
71 | |
---|
72 | $_GET = ktai_convert($_GET); |
---|
73 | $_POST = ktai_convert($_POST); |
---|
74 | $_REQUEST = ktai_convert($_REQUEST); |
---|
75 | |
---|
76 | ini_set('session.use_cookies', '0'); |
---|
77 | |
---|
78 | function init_ktai_page(&$smarty) |
---|
79 | { |
---|
80 | //---- inc_ テンプレート用 変数 ----// |
---|
81 | $smarty->assign('inc_ktai_header', fetch_inc_ktai_header()); |
---|
82 | $smarty->assign('inc_ktai_footer', fetch_inc_ktai_footer()); |
---|
83 | |
---|
84 | //全ページ共通変数のアサイン |
---|
85 | $smarty->assign('msg', k_p_common_msg4msg_id($_REQUEST['msg'])); |
---|
86 | $smarty->assign('WORD_FRIEND', WORD_FRIEND); |
---|
87 | $smarty->assign('WORD_MY_FRIEND', WORD_MY_FRIEND); |
---|
88 | $smarty->assign('WORD_FRIEND_HALF', WORD_FRIEND_HALF); |
---|
89 | $smarty->assign('WORD_MY_FRIEND_HALF', WORD_MY_FRIEND_HALF); |
---|
90 | $smarty->assign('ktai_color_config', db_select_c_sns_config_ktai()); |
---|
91 | |
---|
92 | $is_secure = $GLOBALS['__Framework']['is_secure']; |
---|
93 | |
---|
94 | if ($is_secure) { |
---|
95 | $smarty->assign('u', $GLOBALS['KTAI_C_MEMBER_ID']); |
---|
96 | $smarty->assign('tail', $GLOBALS['KTAI_URL_TAIL']); |
---|
97 | @session_start(); |
---|
98 | $smarty->assign('PHPSESSID', session_id()); |
---|
99 | } |
---|
100 | |
---|
101 | // set SJIS |
---|
102 | $smarty->setOutputCharset('SJIS'); |
---|
103 | } |
---|
104 | |
---|
105 | ?> |
---|