1 | <?php |
---|
2 | /** |
---|
3 | * @copyright 2005-2008 OpenPNE Project |
---|
4 | * @license http://www.php.net/license/3_01.txt PHP License 3.01 |
---|
5 | */ |
---|
6 | |
---|
7 | /** |
---|
8 | * メッセージコードからメッセージを得る |
---|
9 | */ |
---|
10 | function k_p_common_msg4msg_id($msg_id) |
---|
11 | { |
---|
12 | if (is_null($msg_id)) return ''; |
---|
13 | |
---|
14 | $msg = |
---|
15 | array( |
---|
16 | 0 => "ログインに失敗しました", |
---|
17 | 1 => "本文を入力してください", |
---|
18 | 2 => "タイトルを入力してください", |
---|
19 | 3 => "承認が完了しました", |
---|
20 | 4 => "承認依頼を削除しました", |
---|
21 | 5 => "このメンバーは、現在リンク承認待ちです", |
---|
22 | 6 => "このメンバーは、すでにリンク済みです", |
---|
23 | 7 => "教える".WORD_MY_FRIEND_HALF."を選択してださい", |
---|
24 | 8 => "メッセージを入力してください", |
---|
25 | 9 => "このメンバーは既に登録済みです", |
---|
26 | 10 => "管理者なので退会できません", |
---|
27 | 11 => "このコミュニティのメンバーではありません", |
---|
28 | 12 => "メールアドレスを入力してください", |
---|
29 | 13 => "携帯メールアドレスには送信できません", |
---|
30 | 14 => "かんたんログインに失敗しました。通常ログイン後、設定してください", |
---|
31 | 15 => "ログインしてください", |
---|
32 | 16 => "携帯メールアドレス以外は指定できません", |
---|
33 | 17 => "このメールアドレスはすでに登録されています", |
---|
34 | 18 => "パスワードが違います", |
---|
35 | 19 => "携帯メールアドレスを登録しました", |
---|
36 | 20 => "パスワードは6~12文字の半角英数で入力してください", |
---|
37 | 21 => "パスワードを変更しました", |
---|
38 | 22 => "質問を選択してください", |
---|
39 | 23 => "答えを入力してください", |
---|
40 | 24 => "秘密の質問・答えを変更しました", |
---|
41 | 25 => "パスワード再発行できませんでした", |
---|
42 | 26 => "新しいパスワードをメールで送信しました", |
---|
43 | 27 => "携帯個体識別番号を取得できませんでした", |
---|
44 | 28 => "かんたんログイン設定を完了しました", |
---|
45 | 29 => "かんたんログイン設定を解除しました", |
---|
46 | 30 => "招待メールを送信しました", |
---|
47 | 31 => "メールアドレスを正しく入力してください", |
---|
48 | 32 => "メール受信設定を変更しました", |
---|
49 | 33 => "紹介文を入力してください", |
---|
50 | 34 => "あしあとお知らせメール設定を変更しました", |
---|
51 | 35 => "日記の公開設定を変更しました", |
---|
52 | 36 => "アクセスブロック設定を変更しました", |
---|
53 | 37 => "このメールアドレスでは登録できません", |
---|
54 | 38 => "退会理由を入力して下さい", |
---|
55 | 39 => "この携帯個体識別番号はすでに登録されています", |
---|
56 | 40 => "日記の公開範囲を一括変更しました", |
---|
57 | 41 => "無効なメンバーIDが含まれています", |
---|
58 | 42 => "登録できませんでした", |
---|
59 | 44 => "この携帯個体識別番号は登録することができません", |
---|
60 | 45 => "イベントの参加者数制限を超えています", |
---|
61 | 46 => "ログアウトしました", |
---|
62 | ); |
---|
63 | |
---|
64 | return $msg[$msg_id]; |
---|
65 | } |
---|
66 | |
---|
67 | /** |
---|
68 | * 携帯端末からのアクセスかどうかを User-Agent の値から判別する |
---|
69 | * |
---|
70 | * @return bool |
---|
71 | */ |
---|
72 | function isKtaiUserAgent() |
---|
73 | { |
---|
74 | include_once 'OpenPNE/KtaiUA.php'; |
---|
75 | $ktaiUA = new OpenPNE_KtaiUA(); |
---|
76 | return $ktaiUA->is_ktai(); |
---|
77 | } |
---|
78 | |
---|
79 | /** |
---|
80 | * fhページのタイプを取得 |
---|
81 | */ |
---|
82 | function k_p_fh_common_get_type($target_c_member_id, $u) |
---|
83 | { |
---|
84 | // ナビゲーションタイプ : "h" | "f" |
---|
85 | if ($target_c_member_id && $target_c_member_id != $u) { |
---|
86 | return 'f'; |
---|
87 | } else { |
---|
88 | return 'h'; |
---|
89 | } |
---|
90 | } |
---|
91 | |
---|
92 | /** 関数 |
---|
93 | * k_p_c_bbs_c_member_admin4c_commu_topic_id($c_commu_topic_id) |
---|
94 | * |
---|
95 | * |
---|
96 | */ |
---|
97 | function k_p_h_message_ktai_url4url($str, $tail) |
---|
98 | { |
---|
99 | $matches = array(); |
---|
100 | |
---|
101 | // 旧形式のURL |
---|
102 | $pat = '|https?://.+page.php\?p=(c_home.+target_c_commu_id=\d+)$|'; |
---|
103 | if (preg_match($pat, $str, $matches)) { |
---|
104 | if (!empty($matches[1])) { |
---|
105 | $com_url = OPENPNE_URL."?m=ktai&a=page_".$matches[1]."&$tail"; |
---|
106 | } |
---|
107 | $str = preg_replace($pat, "", $str); |
---|
108 | } |
---|
109 | $pat = '|https?://.+page.php\?p=(f_home.+target_c_member_id=\d+)$|'; |
---|
110 | if (preg_match($pat, $str, $matches)) { |
---|
111 | if (!empty($matches[1])) { |
---|
112 | $friend_url = OPENPNE_URL."?m=ktai&a=page_".$matches[1]."&$tail"; |
---|
113 | } |
---|
114 | $str = preg_replace($pat, "", $str); |
---|
115 | } |
---|
116 | |
---|
117 | // 新形式のURL |
---|
118 | $pat = '|https?://.+\?m=pc(&a=page_c_home.+target_c_commu_id=\d+)$|'; |
---|
119 | if (preg_match($pat, $str, $matches)) { |
---|
120 | if (!empty($matches[1])) { |
---|
121 | $com_url = OPENPNE_URL."?m=ktai".$matches[1]."&$tail"; |
---|
122 | } |
---|
123 | $str = preg_replace($pat, "", $str); |
---|
124 | } |
---|
125 | $pat = '|https?://.+\?m=pc(&a=page_f_home.+target_c_member_id=\d+)$|'; |
---|
126 | if (preg_match($pat, $str, $matches)) { |
---|
127 | if (!empty($matches[1])) { |
---|
128 | $friend_url = OPENPNE_URL."?m=ktai".$matches[1]."&$tail"; |
---|
129 | } |
---|
130 | $str = preg_replace($pat, "", $str); |
---|
131 | } |
---|
132 | |
---|
133 | return array($str, $com_url, $friend_url); |
---|
134 | } |
---|
135 | |
---|
136 | function fetch_inc_ktai_header() |
---|
137 | { |
---|
138 | $inc_smarty = new OpenPNE_Smarty($GLOBALS['SMARTY']); |
---|
139 | $inc_smarty->templates_dir = 'ktai/templates'; |
---|
140 | |
---|
141 | require_once 'OpenPNE/KtaiUA.php'; |
---|
142 | $ktai = new OpenPNE_KtaiUA(); |
---|
143 | $inc_smarty->assign('is_au', $ktai->is_au()); |
---|
144 | $inc_smarty->assign('is_softbank', $ktai->is_vodafone()); |
---|
145 | $inc_smarty->assign('is_docomo', $ktai->is_docomo()); |
---|
146 | |
---|
147 | $inc_smarty->assign('ktai_color_config', util_get_color_config_ktai()); |
---|
148 | |
---|
149 | if (SNS_TITLE) { |
---|
150 | $inc_smarty->assign('title', SNS_TITLE); |
---|
151 | } else { |
---|
152 | $inc_smarty->assign('title', SNS_NAME); |
---|
153 | } |
---|
154 | $inc_smarty->assign('inc_ktai_html_head', p_common_c_siteadmin4target_pagename('inc_ktai_html_head')); |
---|
155 | $inc_smarty->assign('inc_ktai_header', p_common_c_siteadmin4target_pagename('inc_ktai_header')); |
---|
156 | |
---|
157 | return $inc_smarty->ext_fetch('inc_ktai_header.tpl'); |
---|
158 | } |
---|
159 | |
---|
160 | function fetch_inc_ktai_footer() |
---|
161 | { |
---|
162 | $inc_smarty = new OpenPNE_Smarty($GLOBALS['SMARTY']); |
---|
163 | $inc_smarty->templates_dir = 'ktai/templates'; |
---|
164 | |
---|
165 | $inc_smarty->assign('inc_ktai_footer', p_common_c_siteadmin4target_pagename('inc_ktai_footer')); |
---|
166 | $inc_smarty->assign('tail', $GLOBALS['KTAI_URL_TAIL']); |
---|
167 | $inc_smarty->assign('page', $GLOBALS['__Framework']['current_action']); |
---|
168 | $inc_smarty->assign('ktai_color_config', util_get_color_config_ktai()); |
---|
169 | |
---|
170 | return $inc_smarty->ext_fetch('inc_ktai_footer.tpl'); |
---|
171 | } |
---|
172 | |
---|
173 | function t_get_user_hash($c_member_id, $length = 12) |
---|
174 | { |
---|
175 | $hashed_password = k_common_hashed_password4c_member_id($c_member_id); |
---|
176 | $seed = strval($c_member_id) . $hashed_password; |
---|
177 | |
---|
178 | return substr(md5($seed), 0, $length); |
---|
179 | } |
---|
180 | |
---|
181 | /** |
---|
182 | * 携帯端末からのアクセスかどうかを IPアドレスから判別する |
---|
183 | * |
---|
184 | * @return bool |
---|
185 | */ |
---|
186 | function is_ktai_ip() |
---|
187 | { |
---|
188 | require_once 'Net/IPv4.php'; |
---|
189 | require_once 'ktaiIP.php'; |
---|
190 | $is_valid_ip = false; |
---|
191 | foreach ($GLOBALS['_OPENPNE_KTAI_IP_LIST'] as $ktai_ip) { |
---|
192 | if (Net_IPv4::ipInNetwork($_SERVER[SERVER_IP_KEY], $ktai_ip)) { |
---|
193 | $is_valid_ip = true; |
---|
194 | break; |
---|
195 | } |
---|
196 | } |
---|
197 | |
---|
198 | return $is_valid_ip; |
---|
199 | } |
---|
200 | |
---|
201 | function ktai_display_error($errors) |
---|
202 | { |
---|
203 | $smarty = new OpenPNE_Smarty($GLOBALS['SMARTY']); |
---|
204 | $smarty->setOutputCharset('SJIS'); |
---|
205 | $smarty->templates_dir = 'ktai/templates'; |
---|
206 | $smarty->assign('inc_ktai_header', fetch_inc_ktai_header()); |
---|
207 | $smarty->assign('inc_ktai_footer', fetch_inc_ktai_footer()); |
---|
208 | $smarty->assign('errors', (array)$errors); |
---|
209 | $smarty->assign('ktai_color_config', util_get_color_config_ktai()); |
---|
210 | $smarty->ext_display('error.tpl'); |
---|
211 | exit; |
---|
212 | } |
---|
213 | |
---|
214 | ?> |
---|