source: extensions/ContactForm/admin/cf_emails.tab.php @ 6529

Last change on this file since 6529 was 3810, checked in by Criss, 15 years ago

bug 0001150

Add e-mail address management

File size: 1.2 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3check_status(ACCESS_ADMINISTRATOR);
4
5$cf_emails = $cf_config->get_value(CF_CFG_ADMIN_MAILS);
6$save = false;
7if (isset($_POST['refresh'])) {
8  $cf_emails = cf_get_admins_contacts();
9 
10  $cf_config->set_value(CF_CFG_ADMIN_MAILS, $cf_emails);
11  $save = true;
12}
13if (isset($_POST['submit'])) {
14  $webmaster = trim(stripslashes($_POST['webmaster']));
15  if (isset($_POST['active']) and (is_array($_POST['active']))) {
16    foreach($_POST['active'] as $email => $active) {
17      $email = trim(stripslashes($email));
18      $active = (1 == $active)?1:0;
19      $cf_emails[$email]['ACTIVE'] = $active;
20      if (0 == strcmp($webmaster, $email)) {
21        $cf_emails[$email]['WEBMASTER'] = 1;
22      } else {
23        $cf_emails[$email]['WEBMASTER'] = 0;
24      }
25    }
26    $cf_config->set_value(CF_CFG_ADMIN_MAILS, $cf_emails);
27    $save = true;
28  }
29}
30if ($save) {
31  // Save config
32  $cf_config->save_config();
33  $saved = $cf_config->save_config();
34  if ($saved) {
35    CF_Log::add_message(l10n('cf_config_saved'));
36  } else {
37    CF_Log::add_error(l10n('cf_config_saved_with_errors'));
38  }
39}
40$template->assign('CF_OPTIONS', array(
41    '1' => l10n('Yes'),
42    '0' => l10n('No'),
43   ));
44$template->assign('CF_EMAILS', $cf_emails);
45?>
Note: See TracBrowser for help on using the repository browser.