-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpbb_settings.php
More file actions
124 lines (94 loc) · 3.15 KB
/
phpbb_settings.php
File metadata and controls
124 lines (94 loc) · 3.15 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
<?php
// not for directly open
if (! defined('IN_ADMIN'))
{
exit;
}
//current case
$current_case = g('case', 'str', 'view');
//current template
$stylee = 'admin_phpbb_settings';
// template variables
$styleePath = dirname(__FILE__);
$action = basename(ADMIN_PATH) . '?cp=' . basename(__file__, '.php');
$H_FORM_KEYS = kleeja_add_form_key('adm_phpbb_settings');
$H_FORM_KEYS_GET = kleeja_add_form_key_get('adm_phpbb_settings');
switch ($current_case)
{
/**
* show a list of current ftp accounts
*/
default:
case 'view':
$kjauth_file_content = str_replace('{___API_KEY___}', $config['phpbb_intr_api_key'], file_get_contents(__DIR__ . '/kjauth.php'));
break;
/**
* test connection
*/
case 'test':
if (! kleeja_check_form_key_get('adm_phpbb_settings'))
{
header('HTTP/1.1 405 Method Not Allowed');
$adminAjaxContent = $lang['INVALID_FORM_KEY'];
}
else
{
$phpbb_folder_path = PATH . rtrim($config['phpbb_intr_path'], '/') . '/';
if (file_exists($phpbb_folder_path . 'phpbb/user.php'))
{
@file_put_contents($phpbb_folder_path . 'kjauth.php',
str_replace('{___API_KEY___}', $config['phpbb_intr_api_key'], file_get_contents(__DIR__ . '/kjauth.php'))
);
}
$adminAjaxContent = phpbb_auth_test() !== false ? 'done' : 'none';
}
break;
case 'regenerate':
if (! kleeja_check_form_key_get('adm_phpbb_settings'))
{
header('HTTP/1.1 405 Method Not Allowed');
kleeja_admin_err($lang['INVALID_FORM_KEY'], $action);
}
else
{
update_config('phpbb_intr_api_key', sha1(mt_rand()));
$phpbb_folder_path = PATH . rtrim($config['phpbb_intr_path'], '/') . '/';
if (file_exists($phpbb_folder_path . 'phpbb/user.php'))
{
@file_put_contents($phpbb_folder_path . 'kjauth.php',
str_replace('{___API_KEY___}', $config['phpbb_intr_api_key'], file_get_contents(__DIR__ . '/kjauth.php'))
);
}
kleeja_admin_info(sprintf($lang['ITEM_UPDATED'], $olang['PHPBB_INTR_API_KEY']), $action);
}
break;
case 'update':
if (! kleeja_check_form_key('adm_phpbb_settings', 1000))
{
header('HTTP/1.1 405 Method Not Allowed');
$adminAjaxContent = $lang['INVALID_FORM_KEY'];
}
else
{
$list = [
'phpbb_intr_enabled',
'phpbb_intr_path',
'phpbb_intr_link',
];
if (! ip('phpbb_intr_enabled'))
{
$_POST['phpbb_intr_enabled'] = 0;
}
foreach ($list as $item)
{
if(! ig('force') && $item == 'phpbb_intr_enabled')
{
continue;
}
update_config($item, p($item, 'str'));
}
delete_cache('data_config');
$adminAjaxContent = 'done';
}
break;
}