Project

General

Profile

1
<?php
2

    
3
// $Id: tool.php 915 2009-01-21 19:27:01Z Ruebenwurzel $
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
if(!file_exists(WB_PATH .'/modules/output_filter/languages/'.LANGUAGE .'.php')) {
31
	// no module language file exists for the language set by the user, include default module language file EN.php
32
	require_once(WB_PATH .'/modules/output_filter/languages/EN.php');
33
} else {
34
	// a module language file exists for the language defined by the user, load it
35
	require_once(WB_PATH .'/modules/output_filter/languages/'.LANGUAGE .'.php');
36
}
37
// check if data was submitted
38
if(isset($_POST['save_settings'])) {
39
	// get overall output filter settings
40
	$email_filter = (isset($_POST['email_filter']) && $_POST['email_filter'] == '1') ? '1' : '0';
41
	$mailto_filter = (isset($_POST['mailto_filter']) && $_POST['mailto_filter'] == '1') ? '1' : '0';
42
	
43
	// get email replacement settings
44
	$at_replacement = isset($_POST['at_replacement']) ?strip_tags($_POST['at_replacement']) : '';
45
	$at_replacement = (strlen(trim($at_replacement)) > 0) ? $admin->add_slashes($at_replacement) : '(at)';
46
	$dot_replacement = isset($_POST['dot_replacement']) ?strip_tags($_POST['dot_replacement']) : '';
47
	$dot_replacement = (strlen(trim($dot_replacement)) > 0) ? $admin->add_slashes($dot_replacement) : '(dot)';
48
	
49
	// update database settings
50
	$database->query("UPDATE " .TABLE_PREFIX ."mod_output_filter SET email_filter = '$email_filter', 
51
		mailto_filter = '$mailto_filter', at_replacement = '$at_replacement', dot_replacement = '$dot_replacement'");
52

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

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

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

    
111
?>
(5-5/6)