~fivefilters/fivefilters/explore-independent-media

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
error_reporting(0);
/**
* Validate URL
* Allows for port, path and query string validations
* @param    string      $url	   string containing url user input
* @return   boolean     Returns TRUE/FALSE
*/
function validateURL($url)
{
$pattern = '/^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&amp;?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/';
return preg_match($pattern, $url);
}
$text = trim(@$_POST['input_text']);

if (validateURL($text)) {
	$opts = array(
	  'http'=>array(
	    'method'=>"GET",
	    'header'=>"Accept-language: en\r\n",
		'max_redirects'=>2,
		'timeout'=>5
	  )
	);
	$context = stream_context_create($opts);
	$text = file_get_contents($text, false, $context, 0, 50000);
	if (preg_match('/<body[^>]*>(.*)/is', $text, $matches)) {
		$text = $matches[1];
	}
}
$text = trim(strip_tags($text));
if ($text == '') $text = 'Last week, the Media Standards Trust (MST), an independent charity, published a report assessing the British media\'s capacity to regulate itself under the leadership of the Press Complaints Commission (PCC). The MST report found that the current system is neither independent nor effective.';
?>
<html>
<head>
<title>Five Filters: Explore Alternative Media</title>
<style>
html, body { margin:0; padding:0; }
</style>
</head>
<body>
		<div id="content">		
			<!--[if !IE]> -->
				<object classid="java:FiveFiltersMain.class" 
            			type="application/x-java-applet"
            			archive="fivefilters.jar"
            			width="100%" height="100%"
            			standby="Loading Processing software..." >
            			
					<param name="archive" value="fivefilters.jar" />
				
					<param name="mayscript" value="true" />
					<param name="scriptable" value="true" />
				
					<param name="image" value="loading.gif" />
					<param name="boxmessage" value="Loading Processing software..." />

					<param name="boxbgcolor" value="#FFFFFF" />
				
					<param name="test_string" value="outer" />
					<param name="text" value="<?php echo htmlspecialchars($text); ?>" />
			<!--<![endif]-->
				
				<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" 
						codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0_15-windows-i586.cab"
						width="100%" height="100%"
						standby="Loading Processing software..."  >
						
					<param name="code" value="FiveFiltersMain" />
					<param name="archive" value="fivefilters.jar" />
					
					<param name="mayscript" value="true" />
					<param name="scriptable" value="true" />
					
					<param name="image" value="loading.gif" />

					<param name="boxmessage" value="Loading Processing software..." />
					<param name="boxbgcolor" value="#FFFFFF" />
					
					<param name="test_string" value="inner" />
					<param name="text" value="<?php echo htmlspecialchars($text); ?>" />
					
					<p>
						<strong>
							This browser does not have a Java Plug-in.
							<br />
							<a href="http://java.sun.com/products/plugin/downloads/index.html" title="Download Java Plug-in">
								Get the latest Java Plug-in here.
							</a>

						</strong>
					</p>
				
				</object>
				
			<!--[if !IE]> -->
				</object>
			<!--<![endif]-->
			
		</div>
</body>
</html>