Project

General

Profile

1
<?php
2

    
3
// $Id: tool.php 586 2008-01-22 12:44:14Z Ruebenwurzel $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2008, 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
// direct access prevention
27
defined('WB_PATH') OR die(header('Location: ../index.php'));
28

    
29
// check if data was submitted
30
if(isset($_POST['save_settings'])) {
31
	// get configuration settings
32
	$email_filter = ($_POST['email_filter'] == '1') ? '1' : '0';
33
	$mailto_filter = ($_POST['mailto_filter'] == '1') ? '1' : '0';
34
	
35
	// get replacement settings
36
	$at_replacement = strip_tags($_POST['at_replacement']);
37
	$at_replacement = (strlen(trim($at_replacement)) > 0) ? $admin->add_slashes($at_replacement) : '(at)';
38
	$dot_replacement = strip_tags($_POST['dot_replacement']);
39
	$dot_replacement = (strlen(trim($dot_replacement)) > 0) ? $admin->add_slashes($dot_replacement) : '(dot)';
40
	
41
	// update database settings
42
	$database->query("UPDATE " .TABLE_PREFIX ."mod_mail_filter SET email_filter = '$email_filter', 
43
		mailto_filter = '$mailto_filter', at_replacement = '$at_replacement', dot_replacement = '$dot_replacement'");
44

    
45
	// check if there is a database error, otherwise say successful
46
	if($database->is_error()) {
47
		$admin->print_error($database->get_error(), $js_back);
48
	} else {
49
		$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/admintools/tool.php?tool=mail_filter');
50
	}
51

    
52
} else {
53
	// write out heading
54
	echo '<h2>Email Output Filter</h2>';
55

    
56
	// include filter functions
57
	require_once(WB_PATH .'/modules/mail_filter/filter-routines.php');
58
	
59
	// read the mail filter settings from the database 
60
	$data = get_mail_filter_settings();
61
	
62
	// output the form with values from the database
63
?>
64

    
65
<p>You can enable/disable the output filtering of email adresses with the options below. The Javascript mailto: encryption requires to enable the register_frontend_modfiles in your browser.</p>
66
<form name="store_settings" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
67
	<table width="98%" cellspacing="0" cellpadding="5px" class="row_a">
68
	<tr><td colspan="2"><strong>Basic Configuration:</strong></td></tr>
69
	<tr>
70
		<td width="35%">Email Output Filter:</td>
71
		<td>
72
			<input type="radio" <?php echo ($data['email_filter']=='1') ?'checked="checked"' :'';?> 
73
				name="email_filter" value="1">Enabled
74
			<input type="radio" <?php echo ($data['email_filter']=='0') ?'checked="checked"' :'';?> 
75
				name="email_filter" value="0">Disabled
76
		</td>
77
	</tr>
78
	<tr>
79
		<td>Javascript Encryption (mailto):</td>
80
		<td>
81
			<input type="radio" <?php echo ($data['mailto_filter']=='1') ?'checked="checked"' :'';?>
82
				name="mailto_filter" value="1">Enabled
83
			<input type="radio" <?php echo (($data['mailto_filter'])=='0') ?'checked="checked"' :'';?>
84
				name="mailto_filter" value="0">Disabled
85
		</td>
86
	</tr>
87
	<tr><td colspan="2"><br /><strong>Email Replacements:</strong></td></tr>
88
	<tr>
89
		<td>Replacement for "@":</td>
90
		<td><input type="text" style="width: 160px" value="<?php echo $data['at_replacement'];?>" 
91
			name="at_replacement"/></td>
92
	</tr>
93
	<tr>
94
		<td>Replacement for ".":</td>
95
		<td><input type="text" style="width: 160px" value="<?php echo $data['dot_replacement'];?>" 
96
			name="dot_replacement"/></td>
97
	</tr>
98
	</table>
99
	<input type="submit" name="save_settings" style="margin-top:10px; width:140px;" value="<?php echo $TEXT['SAVE']; ?>" />
100
</form>
101
<?php
102
}
103

    
104
?>
(5-5/6)