1 | <?php |
---|
2 | /** |
---|
3 | * @copyright 2005-2006 OpenPNE Project |
---|
4 | * @license http://www.php.net/license/3_01.txt PHP License 3.01 |
---|
5 | */ |
---|
6 | |
---|
7 | // admin モジュール initialize 処理 |
---|
8 | |
---|
9 | // auth関連設定 |
---|
10 | session_name('OpenPNEadmin'); |
---|
11 | isset($GLOBALS['OpenPNE']['admin']['session_lifetime']) |
---|
12 | or $GLOBALS['OpenPNE']['admin']['session_lifetime'] = 0; |
---|
13 | isset($GLOBALS['OpenPNE']['admin']['session_idletime']) |
---|
14 | or $GLOBALS['OpenPNE']['admin']['session_idletime'] = 0; |
---|
15 | |
---|
16 | // ライブラリ読み込み |
---|
17 | $module_lib_dir = dirname(__FILE__) . '/lib'; |
---|
18 | require_once $module_lib_dir . '/db_admin.php'; |
---|
19 | require_once $module_lib_dir . '/etc_admin.php'; |
---|
20 | require_once $module_lib_dir . '/hash_admin.php'; |
---|
21 | |
---|
22 | // デフォルトページ |
---|
23 | $GLOBALS['__Framework']['default_page'] = 'top'; |
---|
24 | |
---|
25 | // ハッシュから action名を取得 |
---|
26 | $hash_tbl =& AdminHashTable::singleton(); |
---|
27 | $action = $hash_tbl->action($action, $type); |
---|
28 | |
---|
29 | $GLOBALS['_OPENPNE_ADMIN_AUTH_ACTIONS'] = array( |
---|
30 | 'normal_type' => array( |
---|
31 | 'page_delete_c_image_confirm', |
---|
32 | 'page_delete_c_member_confirm', |
---|
33 | 'page_delete_kakikomi', |
---|
34 | 'page_edit_c_image', |
---|
35 | 'page_insert_c_admin_user', |
---|
36 | 'page_list_c_admin_user', |
---|
37 | 'page_list_c_image', |
---|
38 | 'page_list_c_member', |
---|
39 | 'page_manage_c_commu', |
---|
40 | 'page_passwd', |
---|
41 | 'page_send_invites_confirm', |
---|
42 | 'page_send_invites', |
---|
43 | 'page_send_messages_all', |
---|
44 | 'page_send_messages', |
---|
45 | 'page_send_messages_history_detail', |
---|
46 | 'page_send_messages_history_list', |
---|
47 | 'do_delete_c_admin_user', |
---|
48 | 'do_delete_c_image', |
---|
49 | 'do_delete_c_image4c_image_id', |
---|
50 | 'do_delete_c_member', |
---|
51 | 'do_delete_kakikomi_c_commu_topic', |
---|
52 | 'do_delete_kakikomi_c_commu', |
---|
53 | 'do_delete_kakikomi_c_diary', |
---|
54 | 'do_insert_c_admin_user', |
---|
55 | 'do_insert_c_image', |
---|
56 | 'do_passwd', |
---|
57 | 'do_send_invites', |
---|
58 | 'do_send_messages_all', |
---|
59 | 'do_send_messages', |
---|
60 | 'do_update_c_commu_is_regist_join', |
---|
61 | 'do_update_is_login_rejected', |
---|
62 | ), |
---|
63 | '_type' => array( |
---|
64 | 'page_delete_c_member_confirm', |
---|
65 | 'page_insert_c_admin_user', |
---|
66 | 'page_list_c_admin_user', |
---|
67 | 'page_list_c_member', |
---|
68 | 'page_passwd', |
---|
69 | 'page_send_messages_all', |
---|
70 | 'page_send_messages', |
---|
71 | 'do_delete_c_admin_user', |
---|
72 | 'do_delete_c_member', |
---|
73 | 'do_insert_c_admin_user', |
---|
74 | 'do_passwd', |
---|
75 | 'do_send_messages_all', |
---|
76 | 'do_send_messages', |
---|
77 | 'do_update_is_login_rejected', |
---|
78 | ), |
---|
79 | ); |
---|
80 | |
---|
81 | function init_admin_page(&$smarty) |
---|
82 | { |
---|
83 | $is_secure = $GLOBALS['__Framework']['is_secure']; |
---|
84 | $smarty->assign('inc_header', admin_fetch_inc_header($is_secure)); |
---|
85 | $smarty->assign('inc_footer', admin_fetch_inc_footer($is_secure)); |
---|
86 | $v['module_name'] = ADMIN_MODULE_NAME; |
---|
87 | $smarty->assign($v); |
---|
88 | $smarty->assign_by_ref('hash_tbl', AdminHashTable::singleton()); |
---|
89 | |
---|
90 | if ($is_secure) { |
---|
91 | @session_start(); |
---|
92 | $smarty->assign('PHPSESSID', md5(session_id())); |
---|
93 | |
---|
94 | $auth_type = admin_get_auth_type(); |
---|
95 | $smarty->assign('auth_type', $auth_type); |
---|
96 | $act = sprintf('page_%s', $GLOBALS['__Framework']['current_action']); |
---|
97 | if ($auth_type != 'all' && in_array($act, $GLOBALS['_OPENPNE_ADMIN_AUTH_ACTIONS'][$auth_type.'_type'])) { |
---|
98 | admin_client_redirect('top', '指定されたページにはアクセスできません'); |
---|
99 | } |
---|
100 | } |
---|
101 | } |
---|
102 | |
---|
103 | function init_admin_do() |
---|
104 | { |
---|
105 | $is_secure = $GLOBALS['__Framework']['is_secure']; |
---|
106 | |
---|
107 | if ($is_secure) { |
---|
108 | @session_start(); |
---|
109 | if ($_REQUEST['sessid'] !== md5(session_id())) { |
---|
110 | openpne_display_error('前の画面を再読み込みして、操作をやり直してください'); |
---|
111 | } |
---|
112 | $auth_type = admin_get_auth_type(); |
---|
113 | $act = sprintf('do_%s', $GLOBALS['__Framework']['current_action']); |
---|
114 | if ($auth_type != 'all' && in_array($act, $GLOBALS['_OPENPNE_ADMIN_AUTH_ACTIONS'][$auth_type.'_type'])) { |
---|
115 | admin_client_redirect('top', '指定されたページにはアクセスできません'); |
---|
116 | } |
---|
117 | } |
---|
118 | } |
---|
119 | |
---|
120 | ?> |
---|