Project

General

Profile

« Previous | Next » 

Revision 673

Added by doc over 16 years ago

Removed module mail_filter and added revised version under new module name output filter. Bugs with regular expression fixed.

View differences:

trunk/CHANGELOG
10 10
# = Bugfix
11 11
! = Update/Change
12 12

  
13
------------------------------------- 2.7.0 -------------------------------------
14
08-Feb-2008 Thomas Hornik
15
-	Removed unused function is_access_denied() from search
16
04-Feb-2008 Thomas Hornik
17
!	email-addresses are excluded from search-results page.
13
------------------------------------- 2.7.0 -------------------------------------
14
08-Feb-2008 Christian Sommer
15
-	Removed admin module mail_filter
16
+	Added revised version of the output filter module
17
08-Feb-2008 Thomas Hornik
18
-	Removed unused function is_access_denied() from search
19
04-Feb-2008 Thomas Hornik
20
!	email-addresses are excluded from search-results page.
18 21
#	Fixed possible XSS in account/login.php and forgot-form.php
19 22
04-Feb-2008 Christian Sommer
20 23
#	allowed usage of tags in settings fields: website_header, website_footer
trunk/wb/framework/frontend.functions.php
370 370
			}
371 371
    	}
372 372
  		// include the Javascript email protection function
373
  		if($file_id != 'css' && file_exists(WB_PATH .'/modules/mail_filter/js/mdcr.js')) {
374
			$head_links .= '<script type="text/javascript" src="'.WB_URL.'/modules/mail_filter/js/mdcr.js"></script>' ."\n";
373
  		if($file_id != 'css' && file_exists(WB_PATH .'/modules/output_filter/js/mdcr.js')) {
374
			$head_links .= '<script type="text/javascript" src="'.WB_URL.'/modules/output_filter/js/mdcr.js"></script>' ."\n";
375 375
		}
376 376
  		
377 377
		// write out links with all external module javascript/CSS files, remove last line feed
trunk/wb/index.php
79 79
	}
80 80
}
81 81

  
82
if(file_exists(WB_PATH .'/modules/mail_filter/filter-routines.php')) {
83
	// include the filter routines
84
	require_once(WB_PATH .'/modules/mail_filter/filter-routines.php');
82
if(file_exists(WB_PATH .'/modules/output_filter/filter-routines.php')) {
83
	// include the output filter module routines
84
	@require_once(WB_PATH .'/modules/output_filter/filter-routines.php');
85 85
	
86
	// get the mail filter settings from the database 
87
	$mail_filter_settings = get_mail_filter_settings();
88
	// check if we should filter emails before displaying them
89
	if($mail_filter_settings['email_filter'] == '1') {
90
		// filter email addresses before displaying them
86
	if(function_exists('filter_frontend_output')) {
87
		// store output in variable for filtering
91 88
		ob_start();
92 89
		require(WB_PATH.'/templates/'.TEMPLATE.'/index.php');
93 90
		$frontend_output = ob_get_contents();
94 91
		ob_end_clean();
95
		$frontend_output = filter_email_links($frontend_output);
96
		echo $frontend_output;
92
		// Display the filtered output on the frontend
93
		echo filter_frontend_output($frontend_output);
97 94
		die;
98 95
	}
99
}
96
}	
97

  
100 98
// Display the template (no output filtering)
101 99
require(WB_PATH.'/templates/'.TEMPLATE.'/index.php');
102 100

  
trunk/wb/modules/mail_filter/uninstall.php
1
<?php
2

  
3
// $Id$
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
// prevent this file from being accessed directly
27
if(!defined('WB_PATH')) { exit('Cannot access this file directly'); }
28

  
29
$table = TABLE_PREFIX .'mod_mail_filter';
30
$database->query("DROP TABLE `$table`");
31

  
32
?>
33 0

  
trunk/wb/modules/mail_filter/install.php
1
<?php
2

  
3
// $Id$
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
// prevent this file from being accessed directly
27
if(!defined('WB_PATH')) { exit('Cannot access this file directly'); }
28

  
29
$table = TABLE_PREFIX .'mod_mail_filter';
30
$database->query("DROP TABLE IF EXISTS `$table`");
31

  
32
$database->query("CREATE TABLE `$table` (
33
	`email_filter` VARCHAR(1) NOT NULL DEFAULT '0',
34
	`mailto_filter` VARCHAR(1) NOT NULL DEFAULT '0',
35
	`at_replacement` VARCHAR(255) NOT NULL DEFAULT '(at)',
36
	`dot_replacement` VARCHAR(255) NOT NULL DEFAULT '(dot)'
37
	)"
38
);
39

  
40
// add new row using the table default values defined above
41
//$database->query("INSERT INTO ".TABLE_PREFIX."mod_mail_filter");
42
$database->query("INSERT INTO ".TABLE_PREFIX."mod_mail_filter (email_filter, mailto_filter, at_replacement, dot_replacement) VALUES ('0', '0', '(at)', '(dot)')");
43

  
44

  
45
?>
46 0

  
trunk/wb/modules/mail_filter/index.php
1
<?php
2

  
3
// $Id$
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
header('Location: ../index.php');
27

  
28
?>
29 0

  
trunk/wb/modules/mail_filter/js/mdcr.js
1
/*
2
--------------------------------------------------------------------------------
3
  MDCR (Mail DeCrypt Routine) for Website Baker v2.6.x
4
  Licencsed under GNU, written by Christian Sommer (Doc)
5
--------------------------------------------------------------------------------
6
*/
7

  
8
function mdcr(s) {
9
  location.href=dcstr(s);
10
}
11

  
12
function dcstr(s) {
13
  var m = unescape(s);
14
  var x = m.charCodeAt(7)-97;
15
  var c = m.substr(0,7) + m.substr(8);
16
  var n=0;
17
  var r="";
18

  
19
  for(var i=0; i<c.length; i++) {
20
    r+=String.fromCharCode(c.charCodeAt(i) - x);
21
  }
22
  return r;
23
}
24 0

  
trunk/wb/modules/mail_filter/js/index.php
1
<?php
2

  
3
// $Id$
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
header("Location: ../../../index.php");
27

  
28
?>
29 0

  
trunk/wb/modules/mail_filter/tool.php
1
<?php
2

  
3
// $Id$
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 module language file exists for the language set by the user (e.g. DE, EN)
30
if(!file_exists(WB_PATH .'/modules/mail_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/mail_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/mail_filter/languages/'.LANGUAGE .'.php');
36
}
37
// check if data was submitted
38
if(isset($_POST['save_settings'])) {
39
	// get configuration settings
40
	$email_filter = ($_POST['email_filter'] == '1') ? '1' : '0';
41
	$mailto_filter = ($_POST['mailto_filter'] == '1') ? '1' : '0';
42
	
43
	// get replacement settings
44
	$at_replacement = strip_tags($_POST['at_replacement']);
45
	$at_replacement = (strlen(trim($at_replacement)) > 0) ? $admin->add_slashes($at_replacement) : '(at)';
46
	$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_mail_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=mail_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/mail_filter/filter-routines.php');
66
	
67
	// read the mail filter settings from the database 
68
	$data = get_mail_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
?>
112 0

  
trunk/wb/modules/mail_filter/info.php
1
<?php
2

  
3
// $Id$
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
  Email Output Filter tool for Website Baker v2.7
26
  Licencsed under GNU, written by Christian Sommer (Doc)
27
 -----------------------------------------------------------------------------------------
28
   v0.10  (doc; 21 Jan, 2008)
29
    + initial module release (Note: requires WB 2.7 core file changes to work)
30

  
31
*/
32

  
33
$module_directory 	= 'mail_filter';
34
$module_name 			= 'Email Output Filter';
35
$module_function 		= 'tool';
36
$module_version 		= '0.10';
37
$module_platform 		= '2.7.x';
38
$module_author 		= 'Christian Sommer (doc)';
39
$module_license 		= 'GNU General Public License';
40
$module_description 	= 'This module allows you to define rewrite rules for emails (e.g. <em>name@mail.com</em> --> <em>name(at)mail(dot).com</em>).';
41

  
42
?>
43 0

  
trunk/wb/modules/mail_filter/languages/DE.php
1
<?php
2

  
3
// $Id$
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
  DEUTSCHE SPRACHDATEI FUER DAS MODUL: MAIL_FILTER
26
 -----------------------------------------------------------------------------------------
27
*/
28

  
29
// Deutsche Modulbeschreibung
30
$module_description 	= 'Dieses Modul erlaubt Emailfilterung vor der Ausgabe (z.B. <em>name@email.de</em> --> <em>name(at)email(dot).de</em>).';
31

  
32
// ?berschriften und Textausgaben
33
$MOD_MAIL_FILTER['HEADING']				= 'Email Ausgabe Filterung';
34
$MOD_MAIL_FILTER['HOWTO']					= 'Mit nachfolgenden Optionen kann die Emailfilterung ein- und ausgeschaltet werden. Um die Javascript mailto: Verschl&uuml;sselung zu aktivieren, muss die PHP Funktion <em>register_frontend_modfiles(\'js\')</em> in der index.php des Templates eingebunden werden.';
35

  
36
// Text and captions of form elements
37
$MOD_MAIL_FILTER['BASIC_CONF']			= 'Grundeinstellungen';
38
$MOD_MAIL_FILTER['EMAIL_FILTER']			= 'Textmail Filterung';
39
$MOD_MAIL_FILTER['MAILTO_FILTER']		= 'Mailto Filterung (Javascript)';
40
$MOD_MAIL_FILTER['ENABLED']				= 'Aktiviert';
41
$MOD_MAIL_FILTER['DISABLED']				= 'Ausgeschaltet';
42

  
43
$MOD_MAIL_FILTER['REPLACEMENT_CONF']	= 'Email Ersetzungen';
44
$MOD_MAIL_FILTER['AT_REPLACEMENT']		= 'Ersetzte "@" durch';
45
$MOD_MAIL_FILTER['DOT_REPLACEMENT']		= 'Ersetze "." durch';
46

  
47
?>
48 0

  
trunk/wb/modules/mail_filter/languages/EN.php
1
<?php
2

  
3
// $Id$
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
  ENGLISH LANGUAGE FILE FOR THE ADDON: MAIL FILTER
26
 -----------------------------------------------------------------------------------------
27
*/
28

  
29
// Headings and text outputs
30
$MOD_MAIL_FILTER['HEADING']				= 'Email Output Filter';
31
$MOD_MAIL_FILTER['HOWTO']					= 'You can enable/disable the output filtering of emails with the options below. For Javascript mailto: encryption you need to add the <em>register_frontend_modfiles(\'js\')</em> PHP function call to the index.php of your template.';
32

  
33
// Text and captions of form elements
34
$MOD_MAIL_FILTER['BASIC_CONF']			= 'Basic Configuration';
35
$MOD_MAIL_FILTER['EMAIL_FILTER']			= 'Email Output Filter';
36
$MOD_MAIL_FILTER['MAILTO_FILTER']		= 'Javascript Encryption (mailto)';
37
$MOD_MAIL_FILTER['ENABLED']				= 'Enabled';
38
$MOD_MAIL_FILTER['DISABLED']				= 'Disabled';
39

  
40
$MOD_MAIL_FILTER['REPLACEMENT_CONF']	= 'Email Replacements';
41
$MOD_MAIL_FILTER['AT_REPLACEMENT']		= 'Replace "@" by';
42
$MOD_MAIL_FILTER['DOT_REPLACEMENT']		= 'Replace "." by';
43

  
44
?>
45 0

  
trunk/wb/modules/mail_filter/languages/index.php
1
<?php
2

  
3
// $Id$
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
header("Location: ../../../index.php");
27

  
28
?>
29 0

  
trunk/wb/modules/mail_filter/filter-routines.php
1
<?php
2

  
3
// $Id$
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

  
30
// function to read the current filter settings
31
if (!function_exists('get_mail_filter_settings')) {
32
	function get_mail_filter_settings() {
33
		global $database, $admin;
34
		// connect to database and read out filter settings
35
		$result = $database->query("SELECT * FROM " .TABLE_PREFIX ."mod_mail_filter");
36
		if($result->numRows() > 0) {
37
			// get all data
38
			$data = $result->fetchRow();
39
			$filter_settings['email_filter'] = $admin->strip_slashes($data['email_filter']);
40
			$filter_settings['mailto_filter'] = $admin->strip_slashes($data['mailto_filter']);
41
			$filter_settings['at_replacement'] = $admin->strip_slashes($data['at_replacement']);
42
			$filter_settings['dot_replacement'] = $admin->strip_slashes($data['dot_replacement']);
43
		} else {
44
			// something went wrong, use dummy value
45
			$filter_settings['email_filter'] = '0';
46
			$filter_settings['mailto_filter'] = '0';
47
			$filter_settings['at_replacement'] = '(at)';
48
			$filter_settings['dot_replacement'] = '(dot)';
49
		}
50
		
51
		// return array with filter settings
52
		return $filter_settings;
53
	}
54
}
55

  
56

  
57
// function to rewrite email before beeing displayed the frontend
58
if (!function_exists('filter_email_links')) {
59
	function filter_email_links($content) {
60
		// get the mailer settings from the global variable defined in /wb/index.php
61
		global $mail_filter_settings;
62

  
63
		// check if there is anything to do
64
		global $mail_filter_settings;
65
		if(!isset($mail_filter_settings['email_filter']) || $mail_filter_settings['email_filter'] !=='1' ||
66
			!isset($mail_filter_settings['mailto_filter']) || !isset($mail_filter_settings['at_replacement']) || 
67
			!isset($mail_filter_settings['dot_replacement'])) {
68
			return $content;
69
		}
70

  
71
		// search pattern to find all mail addresses embedded in the frontend content (both text and mailto emails)
72
		$pattern = '#(<a href="mailto:)?(\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,})([^">]*">)?([^<]*</a>)?#i';
73
		/*
74
			exp 1:  (<a href=mailto:)?	-> Optional: search for <a href=mailto:
75
			exp 2a: (\w[\w|\.|\-]+@ 	 	-> 1st char word element, one ore more (+) word elements, or (|) . or (|) - followed by @
76
			exp 2b: \w[\w|\.|\-]+ 		-> see exp 2 for explanation
77
			exp 2c: \.[a-zA-Z]{2,})  	-> dot followed by at least 2 characters (TLD filter: .de, .com, .info) 
78
			exp 3: ([^">]*">)?  			-> Optional: all characters except > followed by ">; could contain ?subject=...&body=...
79
			exp 4: ([^<]*</a>)?  			-> Optional: all characters except <; email link message
80
			? 1 or 0 matches, # encapsulate regex, () subpattern as additional array element, i.. inherent (not case sensitive)
81
		*/
82

  
83
		// find all email addresses embedded in the content and encrypt them via callback function encrypt_emails
84
		$content = preg_replace_callback($pattern, 'encrypt_emails', $content);
85
		return $content;
86
	}
87
}
88

  
89

  
90
// function to encrypt mailto links before beeing displayed at the frontend
91
if (!function_exists('encrypt_emails')) {
92
	function encrypt_emails($match) { 
93
		// get the mailer settings from the global variable defined in /wb/index.php
94
		global $mail_filter_settings;
95

  
96
		// check if there is anything to do
97
		if(!isset($mail_filter_settings['email_filter']) || $mail_filter_settings['email_filter'] !=='1' ||
98
			!isset($mail_filter_settings['mailto_filter']) || !isset($mail_filter_settings['at_replacement']) || 
99
			!isset($mail_filter_settings['dot_replacement'])) {
100
			return $match[0];
101
		}
102
		
103
		// work out replacements
104
		$at_replace = strip_tags($mail_filter_settings['at_replacement']);
105
		$dot_replace = strip_tags($mail_filter_settings['dot_replacement']);
106

  
107
		// check if extracted email address is mailto or text ($match[0] contains entire regexp pattern)
108
		if (strpos($match[0], "mailto:") > 0) {
109
			// mailto email
110

  
111
			// do we need to consider mailto links
112
			if($mail_filter_settings['mailto_filter'] !='1') {
113
				// do not touch mailto links
114
				return $match[0];
115
			}
116
			
117
			// email sub parts: [<a href="mailto:] [name@domain.com] [?subject=blubb&Body=text">] [Mail description</a>]
118
			$email_href			= $match[1];	// a href part
119
			$email_address		= $match[2];	// email address
120
			$email_options 	= $match[3];	// optional: subject or body text for mail clients
121
			$email_link_text 	= $match[4];	// optional: mail description
122

  
123
			// do some cleaning
124
			$email_options 	= str_replace("\">", "", $email_options);					// strip off '">'
125
			$email_link_text 	= str_replace("</a>", "", trim($email_link_text));		// strip off closing </a>
126

  
127
			// make sure that all emails have a description
128
			if(strlen($email_link_text) == 0 ) {
129
				$email_link_text = $email_address;
130
			}
131

  
132
			// replace "@" and "." within top level domain (TLD) if link text is a valid email address
133
			if(preg_match('#\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,}#i', $email_link_text, $email)) {
134
				$email_link_text = str_replace("@", $at_replace, $email_address);		// replace @
135
				// remove "." from top level domain (TLD) part
136
				if (preg_match('#\.[a-zA-Z]{2,}$#im', $email_link_text, $tld) !==0) {
137
					$tld_replace =  str_replace(".", $dot_replace, $tld[0]);
138
					$email_link_text = str_replace($tld[0], $tld_replace, $email_link_text);				// replace . in email TLD part
139
				}
140
			}
141
		
142
			//////////////////////////////////////////////////////////////////////////////////////////////////////////////
143
			// encrypt the email address
144
			//////////////////////////////////////////////////////////////////////////////////////////////////////////////
145
			// create random encryption key
146
			mt_srand((double)microtime()*1000000);			// initialize the randomizer (PHP < 4.2.0)
147
			$char_shift = mt_rand(1, 5);						// shift:=1; a->b, shift:=5; a-->f
148
			$decryption_key = chr($char_shift+97);			// ASCII a:=97
149
		
150
			// prepare mailto string for encryption (mail protocol, decryption key, mail address)
151
			$email_address = "mailto:" .$decryption_key .$email_address;
152
		
153
			// encrypt email address by shifting characters
154
		  	$encrypted_email = "";
155
			for($i=0; $i<strlen($email_address); $i++) {
156
				$encrypted_email .= chr(ord($email_address[$i]) + $char_shift);
157
			}
158
			$encrypted_email[7] = $decryption_key;			// replace first character after mailto: with decryption key 
159
			$encrypted_email = rawurlencode($encrypted_email);
160

  
161
			// return encrypted javascript mailto link
162
			$mailto_link  = "<a href=\"javascript:mdcr('";		// a href part with javascript function to decrypt the email address
163
			$mailto_link .= "$encrypted_email')\">";				// add encrypted email address as paramter to JS function mdcr
164
			$mailto_link .= $email_link_text ."</a>";				// add email link text and closing </a> tag
165
			return $mailto_link;
166
		
167
		} else {
168
			// text email (e.g. name@domain.com)
169
			$match[0] = str_replace("@", $at_replace, $match[0]);		// replace @
170
			// remove "." from top level domain (TLD) part
171
			if (preg_match('#\.[a-zA-Z]{2,}$#im', $match[0], $tld) !==0) {
172
				$tld_replace =  str_replace(".", $dot_replace, $tld[0]);
173
				return str_replace($tld[0], $tld_replace, $match[0]);							// replace . in email TLD part
174
			}
175
		}
176
	}
177
}
178

  
179
?>
180 0

  
trunk/wb/modules/output_filter/uninstall.php
1
<?php
2

  
3
// $Id$
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
// prevent this file from being accessed directly
27
if(!defined('WB_PATH')) die(header('Location: ../index.php'));
28

  
29
$table = TABLE_PREFIX .'mod_output_filter';
30
$database->query("DROP TABLE IF EXISTS `$table`");
31

  
32
?>
trunk/wb/modules/output_filter/filter-routines.php
1
<?php
2

  
3
// $Id$
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
// prevent this file from being accessed directly
27
if(!defined('WB_PATH')) die(header('Location: ../index.php'));
28

  
29
// function to read the current filter settings
30
if (!function_exists('get_output_filter_settings')) {
31
	function get_output_filter_settings() {
32
		global $database, $admin;
33
		// connect to database and read out filter settings
34
		$result = $database->query("SELECT * FROM " .TABLE_PREFIX ."mod_output_filter");
35
		if($result->numRows() > 0) {
36
			// get all data
37
			$data = $result->fetchRow();
38
			$filter_settings['email_filter'] = $admin->strip_slashes($data['email_filter']);
39
			$filter_settings['mailto_filter'] = $admin->strip_slashes($data['mailto_filter']);
40
			$filter_settings['at_replacement'] = $admin->strip_slashes($data['at_replacement']);
41
			$filter_settings['dot_replacement'] = $admin->strip_slashes($data['dot_replacement']);
42
		} else {
43
			// something went wrong, use default values
44
			$filter_settings['email_filter'] = '0';
45
			$filter_settings['mailto_filter'] = '0';
46
			$filter_settings['at_replacement'] = '(at)';
47
			$filter_settings['dot_replacement'] = '(dot)';
48
		}
49
		
50
		// return array with filter settings
51
		return $filter_settings;
52
	}
53
}
54

  
55
// function to filter the output before displaying it on the frontend
56
if (!function_exists('filter_frontend_output')) {
57
	function filter_frontend_output($content) {
58
		// get output filter settings from database
59
		$filter_settings = get_output_filter_settings();
60
		
61
		// work out the defined output filter mode: possible output filter modes: [0], 1, 2, 3, 6, 7
62
		// 2^0 * (0.. disable, 1.. enable) filtering of mail addresses in text
63
		// 2^1 * (0.. disable, 1.. enable) filtering of mail addresses in mailto links
64
		// 2^2 * (0.. disable, 1.. enable) Javascript mailto encryption (only if mailto filtering enabled)
65

  
66
		// only filter output if we are supposed to
67
		if($filter_settings['email_filter'] != '1' && $filter_settings['mailto_filter'] != '1'){
68
			// nothing to do ...
69
			return $content;
70
		}
71

  
72
		// check if non mailto mail addresses needs to be filtered
73
		$output_filter_mode = ($filter_settings['email_filter'] == '1') ? 1 : 0;		// 0|1
74
		
75
		// check if mailto mail addresses needs to be filtered
76
		if($filter_settings['mailto_filter'] == '1') {
77
			$output_filter_mode = $output_filter_mode + 2;														// 0|2
78
						
79
			// check if Javascript mailto encryption is enabled (call register_frontend_functions in the template)
80
			$search = '<script type="text/javascript" src="' .WB_URL .'/modules/output_filter/js/mdcr.js"></script>';
81
			if(strpos($content, $search) !== false) { 
82
				$output_filter_mode = $output_filter_mode + 4;													// 0|4
83
			}
84
		}
85
		
86
		// define some constants so we do not call the database in the callback function again
87
		define('OUTPUT_FILTER_MODE', (int) $output_filter_mode);
88
		define('OUTPUT_FILTER_AT_REPLACEMENT', $filter_settings['at_replacement']);
89
		define('OUTPUT_FILTER_DOT_REPLACEMENT', $filter_settings['dot_replacement']);
90
		
91
		// first search part to find all mailto email addresses
92
		$pattern = '#(<a.*?href\s*?=\s*?"\s*?mailto\s*?:\s*?)([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})([^"]*?)"([^>]*>)(.*?)</a>';
93
		// second part to find all non mailto email addresses
94
		$pattern .= '|\b([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})\b#i';
95
		/*
96
		Sub 1:(<a.*?href\s*?=\s*?"\s*?mailto\s*?:\s*?)					-->	"<a id="yyy" class="xxx" href = " mailto :" ignoring white spaces
97
		Sub 2:([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})			-->	the email address in the mailto: part of the mail link
98
		Sub 3:([^"]*?)"																					--> possible ?Subject&cc... stuff attached to the mail address
99
		Sub 4:([^>]*>)																					--> all class or id statements after the mailto but before closing ..>
100
		Sub 5:(.*?)</a>																					--> the mailto text; all characters between >xxxxx</a>
101
		Sub 6:|\b([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})\b	--> email addresses which may appear in the text (require word boundaries)
102
		*/
103
			
104
		// find all email addresses embedded in the content and filter them using a callback function
105
		$content = preg_replace_callback($pattern, 'filter_mail_addresses', $content);
106
		return $content;
107
	}
108
}		
109

  
110

  
111
// function to filter mail addresses embedded in text or mailto links before outputing them on the frontend
112
if (!function_exists('filter_mail_addresses')) {
113
	function filter_mail_addresses($match) { 
114
		
115
		// check if required output filter mode is defined
116
		if(!(defined('OUTPUT_FILTER_MODE') && defined('OUTPUT_FILTER_MODE') && defined('OUTPUT_FILTER_MODE'))) {
117
			return $match[0];
118
		}
119
		
120
		$search = array('@', '.');
121
		$replace = array(OUTPUT_FILTER_AT_REPLACEMENT ,OUTPUT_FILTER_DOT_REPLACEMENT);
122
		
123
		// check if the match contains the expected number of subpatterns (6|7)
124
		if(count($match) == 7) {
125
			/**
126
				OUTPUT FILTER FOR EMAIL ADDRESSES EMBEDDED IN TEXT
127
			**/
128
			
129
			// 1.. text mails only, 3.. text mails + mailto (no JS), 7 text mails + mailto (JS)
130
			if(!in_array(OUTPUT_FILTER_MODE, array(1,3,7))) return $match[0];
131
			
132
			// filtering of non mailto email addresses enabled
133
			return str_replace($search, $replace, $match[0]);
134
				
135
		} elseif(count($match) == 6) {
136
			/**
137
				OUTPUT FILTER FOR EMAIL ADDRESSES EMBEDDED IN MAILTO LINKS
138
			**/
139

  
140
			// 2.. mailto only (no JS), 3.. text mails + mailto (no JS), 6.. mailto only (JS), 7.. all filters active
141
			if(!in_array(OUTPUT_FILTER_MODE, array(2,3,6,7))) return $match[0];
142
			
143
			// check if last part of the a href link: >xxxx</a> contains a email address we need to filter
144
			$pattern = '#\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b#i';
145
			if(preg_match($pattern, $match[5])) {
146
				$match[5] = str_replace($search, $replace, $match[5]);
147
			}
148

  
149
			// check if Javascript encryption routine is enabled
150
			if(in_array(OUTPUT_FILTER_MODE, array(6,7))) {
151
				/** USE JAVASCRIPT ENCRYPTION FOR MAILTO LINKS **/
152

  
153
				// create random encryption key
154
				mt_srand((double)microtime()*1000000);						// initialize the randomizer (PHP < 4.2.0)
155
				$char_shift = mt_rand(1, 5);											// shift:=1; a->b, shift:=5; a-->f
156
				$decryption_key = chr($char_shift+97);						// ASCII a:=97
157
		
158
				// prepare mailto string for encryption (mail protocol, decryption key, mail address)
159
				$email_address = "mailto:" .$decryption_key .$match[2] .$match[3];
160
		
161
				// encrypt email address by shifting characters
162
		  	$encrypted_email = "";
163
				for($i=0; $i<strlen($email_address); $i++) {
164
					$encrypted_email .= chr(ord($email_address[$i]) + $char_shift);
165
				}
166
				$encrypted_email[7] = $decryption_key;						// replace first character after mailto: with decryption key 
167
				$encrypted_email = rawurlencode($encrypted_email);
168

  
169
				// return encrypted javascript mailto link
170
				$mailto_link  = "<a href=\"javascript:mdcr('";		// a href part with javascript function to decrypt the email address
171
				$mailto_link .= "$encrypted_email')\">";					// add encrypted email address as paramter to JS function mdcr
172
				$mailto_link .= $match[5] ."</a>";								// add email link text and closing </a> tag
173
				return $mailto_link;	
174

  
175
			} else {
176
				/** DO NOT USE JAVASCRIPT ENCRYPTION FOR MAILTO LINKS **/
177

  
178
				// as minimum protection, replace replace @ in the mailto part by (at)
179
				// dots are not transformed as this would required as my.name@domain.com would look like: my(dot)name(at)domain(dot)com
180
				
181
				// rebuild the mailto link from the subpatterns (at the missing characters " and </a>")
182
				return $match[1] .str_replace('@', OUTPUT_FILTER_AT_REPLACEMENT, $match[2]) .$match[3] .'"' .$match[4] .$match[5] .'</a>';
183
				// if you want to protect both, @ and dots, comment out the line above and remove the comment from the line below
184
				// return $match[1] .str_replace($search, $replace, $match[2]) .$match[3] .'"' .$match[4] .$match[5] .'</a>';
185
			}
186
		
187
		}
188
		
189
		// number of subpatterns do not match the requirements ... do nothing
190
		return $match[0];
191
	}		
192
}
193

  
194
?>
trunk/wb/modules/output_filter/info.php
1
<?php
2

  
3
// $Id$
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
  Output Filter tool for Website Baker v2.7
26
  Licencsed under GNU, written by Christian Sommer (Doc)
27
 -----------------------------------------------------------------------------------------
28
   v0.11  (Chritian Sommer; 06 Feb, 2008)
29
    ~ renamed module to output filter, splitted email filter in two functions (text emails, mailto links)
30

  
31
   v0.10  (Christian Sommer; 21 Jan, 2008)
32
    ~ initial module release (Note: requires WB 2.7 core file changes to work)
33

  
34
*/
35

  
36
$module_directory 	= 'output_filter';
37
$module_name 				= 'Frontend Output Filter';
38
$module_function 		= 'tool';
39
$module_version 		= '0.11';
40
$module_platform 		= '2.7.x';
41
$module_author 			= 'Christian Sommer (doc)';
42
$module_license 		= 'GNU General Public License';
43
$module_description = 'This module allows to filter the output before displaying it on the frontend. Support for filtering mailto links and mail addresses in strings.';
44

  
45
?>
trunk/wb/modules/output_filter/tool.php
1
<?php
2

  
3
// $Id$
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
// 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
?>
trunk/wb/modules/output_filter/languages/EN.php
1
<?php
2

  
3
// $Id$
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
  ENGLISH LANGUAGE FILE FOR THE ADDON: OUTPUT_FILTER
26
 -----------------------------------------------------------------------------------------
27
*/
28

  
29
// Headings and text outputs
30
$MOD_MAIL_FILTER['HEADING']				= 'Options: Output Filter';
31
$MOD_MAIL_FILTER['HOWTO']						= 'You can configure the output filtering with the options below.<p style="line-height:1.5em;"><strong>Tip: </strong>Mailto links can be encrypted by a Javascript function. To make use of this option, one needs to add the PHP code <code style="background:#FFA;color:#900;">&lt;?php register_frontend_modfiles(\'js\');?&gt;</code> into the &lt;head&gt; section of the index.php of your template. Without this modification, only the @ character in the mailto part will be replaced.</p>';
32

  
33
// Text and captions of form elements
34
$MOD_MAIL_FILTER['BASIC_CONF']			= 'Basic Email Configuration';
35
$MOD_MAIL_FILTER['EMAIL_FILTER']		= 'Filter Email addresses in text';
36
$MOD_MAIL_FILTER['MAILTO_FILTER']		= 'Filter Email addresses in mailto links';
37
$MOD_MAIL_FILTER['ENABLED']					= 'Enabled';
38
$MOD_MAIL_FILTER['DISABLED']				= 'Disabled';
39

  
40
$MOD_MAIL_FILTER['REPLACEMENT_CONF']= 'Email Replacements';
41
$MOD_MAIL_FILTER['AT_REPLACEMENT']	= 'Replace "@" by';
42
$MOD_MAIL_FILTER['DOT_REPLACEMENT']	= 'Replace "." by';
43

  
44
?>
trunk/wb/modules/output_filter/languages/index.php
1
<?php
2

  
3
// $Id$
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
header("Location: ../../../index.php");
27

  
28
?>
trunk/wb/modules/output_filter/languages/DE.php
1
<?php
2

  
3
// $Id$
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
  DEUTSCHE SPRACHDATEI FUER DAS MODUL: OUTPUT_FILTER
26
 -----------------------------------------------------------------------------------------
27
*/
28

  
29
// Deutsche Modulbeschreibung
30
$module_description 								= 'Dieses Modul erlaubt die Filterung von Inhalten vor der Anzeige im Frontendbereich. Unterst&uuml;zt die Filterung von Emailadressen in mailto Links und Text.';
31

  
32
// ?berschriften und Textausgaben
33
$MOD_MAIL_FILTER['HEADING']					= 'Optionen: Ausgabe Filterung';
34
$MOD_MAIL_FILTER['HOWTO']						= '&Uuml;ber nachfolgende Optionen kann die Ausgabefilterung konfiguriert werden.<p style="line-height:1.5em;"><strong>Tipp: </strong>Mailto Links k&ouml;nnen mit einer Javascript Routine verschl&uuml;sselt werden. Um diese Option zu aktivieren muss der PHP Befehl <code style="background:#FFA;color:#900;">&lt;?php register_frontend_modfiles(\'js\');?&gt;</code> im &lt;head&gt; Bereich der index.php Ihres Templates eingebunden werden. Ohne diese &Auml;nderungen wird nur das @ Zeichen im mailto: Teil ersetzt.</p>';
35

  
36
// Text von form Elementen
37
$MOD_MAIL_FILTER['BASIC_CONF']			= 'Grundeinstellungen';
38
$MOD_MAIL_FILTER['EMAIL_FILTER']		= 'Filtere E-Mail Adressen im Text';
39
$MOD_MAIL_FILTER['MAILTO_FILTER']		= 'Filtere E-Mail Adressen in mailto Links';
40
$MOD_MAIL_FILTER['ENABLED']					= 'Aktiviert';
41
$MOD_MAIL_FILTER['DISABLED']				= 'Ausgeschaltet';
42

  
43
$MOD_MAIL_FILTER['REPLACEMENT_CONF']= 'Email Ersetzungen';
44
$MOD_MAIL_FILTER['AT_REPLACEMENT']	= 'Ersetzte "@" durch';
45
$MOD_MAIL_FILTER['DOT_REPLACEMENT']	= 'Ersetze "." durch';
46

  
47
?>
trunk/wb/modules/output_filter/install.php
1
<?php
2

  
3
// $Id$
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
// prevent this file from being accessed directly
27
if(!defined('WB_PATH')) die(header('Location: ../index.php'));
28

  
29
$table = TABLE_PREFIX .'mod_output_filter';
30
$database->query("DROP TABLE IF EXISTS `$table`");
31

  
32
$database->query("CREATE TABLE `$table` (
33
	`email_filter` VARCHAR(1) NOT NULL DEFAULT '0',
34
	`mailto_filter` VARCHAR(1) NOT NULL DEFAULT '0',
35
	`at_replacement` VARCHAR(255) NOT NULL DEFAULT '(at)',
36
	`dot_replacement` VARCHAR(255) NOT NULL DEFAULT '(dot)'
37
	)"
38
);
39

  
40
// add default values to the module table
41
$database->query("INSERT INTO ".TABLE_PREFIX
42
	."mod_output_filter (email_filter, mailto_filter, at_replacement, dot_replacement) VALUES ('0', '0', '(at)', '(dot)')");
43

  
44
?>
trunk/wb/modules/output_filter/js/mdcr.js
1

  
2
// $Id$
3

  
4
/*
5
--------------------------------------------------------------------------------
6
  JAVASCRIPT ROUTINE FOR THE WEBSITE BAKER 2.7 OUTPUT FILTER MODULE
7
  Licencsed under GNU, written by Christian Sommer (Doc)
8
--------------------------------------------------------------------------------
9
*/
10

  
11
function mdcr(s) {
12
  location.href=dcstr(s);
13
}
14

  
15
function dcstr(s) {
16
  var m = unescape(s);
17
  var x = m.charCodeAt(7)-97;
18
  var c = m.substr(0,7) + m.substr(8);
19
  var n=0;
20
  var r="";
21

  
22
  for(var i=0; i<c.length; i++) {
23
    r+=String.fromCharCode(c.charCodeAt(i) - x);
24
  }
25
  return r;
26
}
trunk/wb/modules/output_filter/js/index.php
1
<?php
2

  
3
// $Id$
4

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff