source: extensions/ContactForm/admin/cf_config.tab.php @ 7715

Last change on this file since 7715 was 7197, checked in by plg, 14 years ago

feature 1897 added: the core "Contact Webmaster" link in footer is replaced by
a link to the ContactForm page. It works with a smarty prefilter, so it should
work with all themes.

The configurable template variable name was removed. It is hard coded as
$ContactFormLink. I've seen no example using another variable name. It was
hard to understand for users in the administration panel and not very useful.
The corresponding language keys were removed from all languages.

bug 1916 fixed: apply the same rule for link display in footer as in menu. If
the administrator has allowed the ContactForm page for guests, let's display
it in the menu + footer.

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