1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | check_status(ACCESS_ADMINISTRATOR); |
---|
4 | |
---|
5 | |
---|
6 | if (isset($_POST['submit'])) { |
---|
7 | |
---|
8 | // Menu link |
---|
9 | $new_value = false; |
---|
10 | if (isset($_POST['cf_menu_link'])) { |
---|
11 | if ('1' == $_POST['cf_menu_link']) { |
---|
12 | $new_value = true; |
---|
13 | } |
---|
14 | } |
---|
15 | $cf_config->set_value(CF_CFG_MENU_LINK, $new_value); |
---|
16 | |
---|
17 | // Allow guest |
---|
18 | $new_value = false; |
---|
19 | if (isset($_POST['cf_guest_allowed'])) { |
---|
20 | if ('1' == $_POST['cf_guest_allowed']) { |
---|
21 | $new_value = true; |
---|
22 | } |
---|
23 | } |
---|
24 | $cf_config->set_value(CF_CFG_ALLOW_GUEST, $new_value); |
---|
25 | |
---|
26 | // Mandatory name |
---|
27 | $new_value = false; |
---|
28 | if (isset($_POST['cf_mandatory_name'])) { |
---|
29 | if ('1' == $_POST['cf_mandatory_name']) { |
---|
30 | $new_value = true; |
---|
31 | } |
---|
32 | } |
---|
33 | $cf_config->set_value(CF_CFG_NAME_MANDATORY, $new_value); |
---|
34 | |
---|
35 | // Mandatory mail |
---|
36 | $new_value = false; |
---|
37 | if (isset($_POST['cf_mandatory_mail'])) { |
---|
38 | if ('1' == $_POST['cf_mandatory_mail']) { |
---|
39 | $new_value = true; |
---|
40 | } |
---|
41 | } |
---|
42 | $cf_config->set_value(CF_CFG_MAIL_MANDATORY, $new_value); |
---|
43 | |
---|
44 | // Prefix |
---|
45 | $new_value = ''; |
---|
46 | if (isset($_POST['cf_mail_prefix'])) { |
---|
47 | $new_value = trim(stripslashes($_POST['cf_mail_prefix'])); |
---|
48 | $cf_config->set_value(CF_CFG_SUBJECT_PREFIX, $new_value); |
---|
49 | } |
---|
50 | |
---|
51 | // Separator |
---|
52 | $new_value = ''; |
---|
53 | if (isset($_POST['cf_separator'])) { |
---|
54 | $new_value = trim(stripslashes($_POST['cf_separator'])); |
---|
55 | $cf_config->set_value(CF_CFG_SEPARATOR, $new_value); |
---|
56 | } |
---|
57 | if (isset($_POST['cf_separator_length'])) { |
---|
58 | $new_value = trim(stripslashes($_POST['cf_separator_length'])); |
---|
59 | if (ctype_digit($new_value)) { |
---|
60 | $cf_config->set_value(CF_CFG_SEPARATOR_LEN, $new_value); |
---|
61 | } else { |
---|
62 | CF_Log::add_error(l10n('cf_length_not_integer')); |
---|
63 | } |
---|
64 | } |
---|
65 | |
---|
66 | // Redirect delay |
---|
67 | if (isset($_POST['cf_redirect_delay'])) { |
---|
68 | $new_value = trim(stripslashes($_POST['cf_redirect_delay'])); |
---|
69 | if (ctype_digit($new_value)) { |
---|
70 | $cf_config->set_value(CF_CFG_REDIRECT_DELAY, $new_value); |
---|
71 | } else { |
---|
72 | CF_Log::add_error(l10n('cf_delay_not_integer')); |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | // Save config |
---|
77 | $cf_config->save_config(); |
---|
78 | $saved = $cf_config->save_config(); |
---|
79 | if ($saved) { |
---|
80 | CF_Log::add_message(l10n('cf_config_saved')); |
---|
81 | } else { |
---|
82 | CF_Log::add_error(l10n('cf_config_saved_with_errors')); |
---|
83 | } |
---|
84 | |
---|
85 | } |
---|
86 | |
---|
87 | $config_values = array( |
---|
88 | 'MENU_LINK' => $cf_config->get_value(CF_CFG_MENU_LINK)? |
---|
89 | CF_CHECKED:'', |
---|
90 | 'GUEST' => $cf_config->get_value(CF_CFG_ALLOW_GUEST)? |
---|
91 | CF_CHECKED:'', |
---|
92 | 'NEED_NAME' => $cf_config->get_value(CF_CFG_NAME_MANDATORY)? |
---|
93 | CF_CHECKED:'', |
---|
94 | 'NEED_MAIL' => $cf_config->get_value(CF_CFG_MAIL_MANDATORY)? |
---|
95 | CF_CHECKED:'', |
---|
96 | 'PREFIX' => $cf_config->get_value(CF_CFG_SUBJECT_PREFIX), |
---|
97 | 'SEPARATOR' => $cf_config->get_value(CF_CFG_SEPARATOR), |
---|
98 | 'SEPARATOR_LENGTH' => $cf_config->get_value(CF_CFG_SEPARATOR_LEN), |
---|
99 | 'REDIRECT_DELAY' => $cf_config->get_value(CF_CFG_REDIRECT_DELAY), |
---|
100 | ); |
---|
101 | |
---|
102 | $template->assign('CF_CONFIG', $config_values); |
---|
103 | |
---|
104 | ?> |
---|