Project

General

Profile

1
<?php
2

    
3
// $Id: tool.php 998 2009-06-17 20:59:09Z ruud $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9

    
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

    
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

    
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

    
24
*/
25

    
26
// prevent this file from being accessed directly
27
if(!defined('WB_PATH')) die(header('Location: ../index.php'));
28

    
29
// check if module language file exists for the language set by the user (e.g. DE, EN)
30
$MOD_MAIL_FILTER['WARNING']	= '<p style="color: red; line-height:1.5em;"><strong>Warning: </strong>This function is now available as a Droplet. The next major release of website baker will not include this filter anymore. Please concider using the <a href="?tool=droplets">Droplet</a> [[EmailFilter]]</p>';
31
if(!file_exists(WB_PATH .'/modules/output_filter/languages/'.LANGUAGE .'.php')) {
32
	// no module language file exists for the language set by the user, include default module language file EN.php
33
	require_once(WB_PATH .'/modules/output_filter/languages/EN.php');
34
} else {
35
	// a module language file exists for the language defined by the user, load it
36
	require_once(WB_PATH .'/modules/output_filter/languages/'.LANGUAGE .'.php');
37
}
38
// check if data was submitted
39
if(isset($_POST['save_settings'])) {
40
	// get overall output filter settings
41
	$email_filter = (isset($_POST['email_filter']) && $_POST['email_filter'] == '1') ? '1' : '0';
42
	$mailto_filter = (isset($_POST['mailto_filter']) && $_POST['mailto_filter'] == '1') ? '1' : '0';
43
	
44
	// get email replacement settings
45
	$at_replacement = isset($_POST['at_replacement']) ?strip_tags($_POST['at_replacement']) : '';
46
	$at_replacement = (strlen(trim($at_replacement)) > 0) ? $admin->add_slashes($at_replacement) : '(at)';
47
	$dot_replacement = isset($_POST['dot_replacement']) ?strip_tags($_POST['dot_replacement']) : '';
48
	$dot_replacement = (strlen(trim($dot_replacement)) > 0) ? $admin->add_slashes($dot_replacement) : '(dot)';
49
	
50
	// update database settings
51
	$database->query("UPDATE " .TABLE_PREFIX ."mod_output_filter SET email_filter = '$email_filter', 
52
		mailto_filter = '$mailto_filter', at_replacement = '$at_replacement', dot_replacement = '$dot_replacement'");
53

    
54
	// check if there is a database error, otherwise say successful
55
	if($database->is_error()) {
56
		$admin->print_error($database->get_error(), $js_back);
57
	} else {
58
		$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/admintools/tool.php?tool=output_filter');
59
	}
60

    
61
} else {
62
	// write out heading
63
	echo '<h2>' .$MOD_MAIL_FILTER['HEADING'] .'</h2>';
64

    
65
	// include filter functions
66
	require_once(WB_PATH .'/modules/output_filter/filter-routines.php');
67
	
68
	// read the mail filter settings from the database 
69
	$data = get_output_filter_settings();
70
	
71
	// output the form with values from the database
72
	echo '<p>' .$MOD_MAIL_FILTER['HOWTO'] .'</p>';
73
	echo $MOD_MAIL_FILTER['WARNING'];
74
?>
75
<form name="store_settings" action="<?php echo $_SERVER['REQUEST_URI'];?>" method="post">
76
	<table width="98%" cellspacing="0" cellpadding="5px" class="row_a">
77
	<tr><td colspan="2"><strong><?php echo $MOD_MAIL_FILTER['BASIC_CONF'];?>:</strong></td></tr>
78
	<tr>
79
		<td width="35%"><?php echo $MOD_MAIL_FILTER['EMAIL_FILTER'];?>:</td>
80
		<td>
81
			<input type="radio" <?php echo ($data['email_filter']=='1') ?'checked="checked"' :'';?>
82
				name="email_filter" value="1"><?php echo $MOD_MAIL_FILTER['ENABLED'];?>
83
			<input type="radio" <?php echo (($data['email_filter'])=='0') ?'checked="checked"' :'';?>
84
				name="email_filter" value="0"><?php echo $MOD_MAIL_FILTER['DISABLED'];?>
85
		</td>
86
	</tr>
87
	<tr>
88
		<td><?php echo $MOD_MAIL_FILTER['MAILTO_FILTER'];?>:</td>
89
		<td>
90
			<input type="radio" <?php echo ($data['mailto_filter']=='1') ?'checked="checked"' :'';?>
91
				name="mailto_filter" value="1"><?php echo $MOD_MAIL_FILTER['ENABLED'];?>
92
			<input type="radio" <?php echo (($data['mailto_filter'])=='0') ?'checked="checked"' :'';?>
93
				name="mailto_filter" value="0"><?php echo $MOD_MAIL_FILTER['DISABLED'];?>
94
		</td>
95
	</tr>
96
	<tr><td colspan="2"><br /><strong><?php echo $MOD_MAIL_FILTER['REPLACEMENT_CONF'];?>:</strong></td></tr>
97
	<tr>
98
		<td><?php echo $MOD_MAIL_FILTER['AT_REPLACEMENT'];?>:</td>
99
		<td><input type="text" style="width: 160px" value="<?php echo $data['at_replacement'];?>" 
100
			name="at_replacement"/></td>
101
	</tr>
102
	<tr>
103
		<td><?php echo $MOD_MAIL_FILTER['DOT_REPLACEMENT'];?>:</td>
104
		<td><input type="text" style="width: 160px" value="<?php echo $data['dot_replacement'];?>" 
105
			name="dot_replacement"/></td>
106
	</tr>
107
	</table>
108
	<input type="submit" name="save_settings" style="margin-top:10px; width:140px;" value="<?php echo $TEXT['SAVE']; ?>" />
109
</form>
110
<?php
111
}
112

    
113
?>
(5-5/6)