Revision 1475
Added by Dietmar almost 13 years ago
filter-routines.php | ||
---|---|---|
28 | 28 |
if($result && $result->numRows() > 0) { |
29 | 29 |
// get all data |
30 | 30 |
$data = $result->fetchRow(); |
31 |
$filter_settings['sys_rel'] = $admin->strip_slashes($data['sys_rel']); |
|
31 | 32 |
$filter_settings['email_filter'] = $admin->strip_slashes($data['email_filter']); |
32 | 33 |
$filter_settings['mailto_filter'] = $admin->strip_slashes($data['mailto_filter']); |
33 | 34 |
$filter_settings['at_replacement'] = $admin->strip_slashes($data['at_replacement']); |
34 | 35 |
$filter_settings['dot_replacement'] = $admin->strip_slashes($data['dot_replacement']); |
35 | 36 |
} else { |
36 | 37 |
// something went wrong, use default values |
38 |
$filter_settings['sys_rel'] = '0'; |
|
37 | 39 |
$filter_settings['email_filter'] = '0'; |
38 | 40 |
$filter_settings['mailto_filter'] = '0'; |
39 | 41 |
$filter_settings['at_replacement'] = '(at)'; |
... | ... | |
50 | 52 |
function filter_frontend_output($content) { |
51 | 53 |
// get output filter settings from database |
52 | 54 |
$filter_settings = get_output_filter_settings(); |
53 |
|
|
55 |
$location = ''; |
|
56 |
if($filter_settings['sys_rel'] == '1'){ |
|
57 |
if( !isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off' ) |
|
58 |
{ |
|
59 |
define('SYS_HTTPS', false); |
|
60 |
define('SYS_PORT', (($_SERVER['SERVER_PORT'] != '80') ? ':'.$_SERVER['SERVER_PORT'] : '') ); |
|
61 |
define('SYS_PROTOCOL', 'http'); |
|
62 |
}else |
|
63 |
{ |
|
64 |
define('SYS_HTTPS', true); |
|
65 |
define('SYS_PORT', (($_SERVER['SERVER_PORT'] != '443') ? ':'.$_SERVER['SERVER_PORT'] : '') ); |
|
66 |
define('SYS_PROTOCOL', 'https'); |
|
67 |
} |
|
68 |
$tmp = ''; |
|
69 |
if( isset($_SERVER['HTTP_HOST']) ) |
|
70 |
{ |
|
71 |
$tmp = $_SERVER['HTTP_HOST']; |
|
72 |
}elseif( isset($_SERVER['SERVER_NAME']) ) |
|
73 |
{ |
|
74 |
$tmp = $_SERVER['SERVER_NAME']; |
|
75 |
} |
|
76 |
|
|
77 |
define('WB_HOST', preg_replace('/:[0-9]*$/', '', $tmp)); |
|
78 |
$location = SYS_PROTOCOL.'://'.WB_HOST.SYS_PORT; |
|
79 |
|
|
80 |
} |
|
81 |
|
|
54 | 82 |
// work out the defined output filter mode: possible output filter modes: [0], 1, 2, 3, 6, 7 |
55 | 83 |
// 2^0 * (0.. disable, 1.. enable) filtering of mail addresses in text |
56 | 84 |
// 2^1 * (0.. disable, 1.. enable) filtering of mail addresses in mailto links |
... | ... | |
58 | 86 |
|
59 | 87 |
// only filter output if we are supposed to |
60 | 88 |
if($filter_settings['email_filter'] != '1' && $filter_settings['mailto_filter'] != '1'){ |
61 |
// nothing to do ... |
|
89 |
$searchfor = '/(<.*?=\s*?\")(?:'.preg_quote($location, '/').')(.*?\".*?>)/i'; |
|
90 |
$content = preg_replace($searchfor, '$1$2', $content); |
|
62 | 91 |
return $content; |
63 | 92 |
} |
64 | 93 |
|
... | ... | |
104 | 133 |
|
105 | 134 |
// find all email addresses embedded in the content and filter them using a callback function |
106 | 135 |
$content = preg_replace_callback($pattern, 'filter_mail_addresses', $content); |
136 |
// href can't be empty |
|
137 |
$searchfor = '/(<.*?=\s*?\")(?:'.preg_quote($location, '/').')(.*?\".*?>)/i'; |
|
138 |
$content = preg_replace($searchfor, '$1$2', $content); |
|
107 | 139 |
return $content; |
108 | 140 |
} |
109 | 141 |
} |
110 | 142 |
Also available in: Unified diff
! security fixes media, groups, users, sections
! reworked add sections in pages
! fix set empty href in show_menu2
! set show_menu2 version to 4.9.6
! reworked Droplet LoginBox, add redirect query
- remove unneeded folder js
! set Droplet to version 1.1.0
+ add checkboxes to change frontend absolute url to relative urls
! set output_filter version to 0.2