source: extensions/ContactForm/admin/config.php @ 28839

Last change on this file since 28839 was 28839, checked in by mistic100, 10 years ago

use new maintain class

File size: 1.8 KB
Line 
1<?php
2if (!defined('CONTACT_FORM_PATH')) die('Hacking attempt!');
3
4// save config
5if (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' =>    stripslashes(trim($_POST['cf_subject_prefix'])),
28    'cf_default_subject' =>   stripslashes(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
36  conf_update_param('ContactForm', $conf['ContactForm']);
37  conf_update_param('ContactForm_before', trim($_POST['cf_before']), true);
38  conf_update_param('ContactForm_after', trim($_POST['cf_after']), true);
39
40  $page['infos'][] = l10n('Information data registered in database');
41}
42
43
44// display config
45$template->assign($conf['ContactForm']);
46$template->assign(array(
47  'cf_before' => stripslashes($conf['ContactForm_before']),
48  'cf_after' => stripslashes($conf['ContactForm_after']),
49  ));
50
51$template->set_filename('contact_form', realpath(CONTACT_FORM_PATH . 'admin/template/config.tpl'));
Note: See TracBrowser for help on using the repository browser.