Project

General

Profile

« Previous | Next » 

Revision 1513

Added by Dietmar over 12 years ago

outputfilter now check and add missing slash in empty href if relative urls are enabled

View differences:

filter-routines.php
58 58
		// get output filter settings from database
59 59
		$filter_settings = get_output_filter_settings();
60 60
		$location = '';
61
        if($filter_settings['sys_rel'] == '1'){
62
			if( !isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off' )
63
			{
61
		if($filter_settings['sys_rel'] == '1'){
62
			if( !isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off' ) {
64 63
				define('SYS_HTTPS', false);
65 64
				define('SYS_PORT', (($_SERVER['SERVER_PORT'] != '80') ? ':'.$_SERVER['SERVER_PORT'] : '') );
66 65
				define('SYS_PROTOCOL', 'http');
67
			}else
68
			{
66
			} else {
69 67
				define('SYS_HTTPS', true);
70 68
				define('SYS_PORT', (($_SERVER['SERVER_PORT'] != '443') ? ':'.$_SERVER['SERVER_PORT'] : '') );
71 69
				define('SYS_PROTOCOL', 'https');
72 70
			}
73 71
			$tmp = '';
74
			if( isset($_SERVER['HTTP_HOST']) )
75
			{
72
			if( isset($_SERVER['HTTP_HOST']) ) {
76 73
				$tmp = $_SERVER['HTTP_HOST'];
77
			}elseif( isset($_SERVER['SERVER_NAME']) )
78
			{
74
			} elseif( isset($_SERVER['SERVER_NAME']) ) {
79 75
				$tmp = $_SERVER['SERVER_NAME'];
80 76
			}
81 77

  
82 78
			define('WB_HOST', preg_replace('/:[0-9]*$/', '', $tmp));
83
	        $location = SYS_PROTOCOL.'://'.WB_HOST.SYS_PORT;
79
			$location = SYS_PROTOCOL.'://'.WB_HOST.SYS_PORT;
80
			$searchfor = '/(<.*?=\s*?\")(?:'.preg_quote($location, '/').'\/?)(.*?\".*?>)/i';
81
			$content = preg_replace($searchfor, '$1/$2', $content);
82
			$content = preg_replace('/(<.*?(?:href|src)\s*=\s*?\")(\".*?>)/i', '$1/$2', $content);
84 83

  
85
        }
84
		}
86 85

  
87 86
		// work out the defined output filter mode: possible output filter modes: [0], 1, 2, 3, 6, 7
88 87
		// 2^0 * (0.. disable, 1.. enable) filtering of mail addresses in text
......
91 90

  
92 91
		// only filter output if we are supposed to
93 92
		if($filter_settings['email_filter'] != '1' && $filter_settings['mailto_filter'] != '1'){
94
			$searchfor = '/(<.*?=\s*?\")(?:'.preg_quote($location, '/').')(.*?\".*?>)/i';
95
			$content = preg_replace($searchfor, '$1$2', $content);
93
			// do nothing more
96 94
			return $content;
97 95
		}
98 96

  

Also available in: Unified diff