1 | <?php |
---|
2 | if (!defined('CONTACT_FORM_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | // save config |
---|
5 | if (isset($_POST['save_config'])) |
---|
6 | { |
---|
7 | if ($_POST['cf_redirect_url']=='http://') |
---|
8 | { |
---|
9 | $_POST['cf_redirect_url'] = null; |
---|
10 | } |
---|
11 | else if (!empty($_POST['cf_redirect_url'])) |
---|
12 | { |
---|
13 | if (strpos($_POST['cf_redirect_url'], 'http') !== 0) |
---|
14 | { |
---|
15 | $_POST['cf_redirect_url'] = 'http://' . $_POST['cf_redirect_url']; |
---|
16 | } |
---|
17 | if (!url_check_format($_POST['cf_redirect_url'])) |
---|
18 | { |
---|
19 | $page['errors'][] = l10n('Invalid redirect URL'); |
---|
20 | $_POST['cf_redirect_url'] = $conf['ContactForm']['cf_redirect_url']; |
---|
21 | } |
---|
22 | } |
---|
23 | |
---|
24 | $conf['ContactForm'] = array( |
---|
25 | 'cf_must_initialize' => false, |
---|
26 | 'cf_menu_link' => isset($_POST['cf_menu_link']), |
---|
27 | 'cf_subject_prefix' => trim($_POST['cf_subject_prefix']), |
---|
28 | 'cf_default_subject' => trim($_POST['cf_default_subject']), |
---|
29 | 'cf_allow_guest' => isset($_POST['cf_allow_guest']), |
---|
30 | 'cf_mandatory_mail' => isset($_POST['cf_mandatory_mail']), |
---|
31 | 'cf_mandatory_name' => isset($_POST['cf_mandatory_name']), |
---|
32 | 'cf_mail_type' => $_POST['cf_mail_type'], |
---|
33 | 'cf_redirect_url' => $_POST['cf_redirect_url'], |
---|
34 | ); |
---|
35 | $conf['ContactForm_before'] = $_POST['cf_before']; |
---|
36 | $conf['ContactForm_after'] = $_POST['cf_after']; |
---|
37 | |
---|
38 | conf_update_param('ContactForm', serialize($conf['ContactForm'])); |
---|
39 | conf_update_param('ContactForm_before', $conf['ContactForm_before']); |
---|
40 | conf_update_param('ContactForm_after', $conf['ContactForm_after']); |
---|
41 | |
---|
42 | $page['infos'][] = l10n('Information data registered in database'); |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | // display config |
---|
47 | $template->assign($conf['ContactForm']); |
---|
48 | $template->assign(array( |
---|
49 | 'cf_before' => stripslashes($conf['ContactForm_before']), |
---|
50 | 'cf_after' => stripslashes($conf['ContactForm_after']), |
---|
51 | )); |
---|
52 | |
---|
53 | $template->set_filename('contact_form', realpath(CONTACT_FORM_PATH . 'admin/template/config.tpl')); |
---|