PluginProbe
Redirection / 4.2
Redirection v4.2
5.10.0 5.9.0 5.8.1 5.8.0 3.7.2 3.7.3 4.0 4.0.1 4.1 4.1.1 4.2 4.2.1 4.2.2 4.2.3 4.3 4.3.1 4.3.2 4.3.3 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6.2 4.7.1 All 130 releases
redirection / actions / pass.php

pass.php in Redirection 4.2, at actions/pass.php

64 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class Pass_Action extends Red_Action {
4 public function process_external( $url ) {
5 echo @wp_remote_fopen( $url );
6 }
7
8 /**
9 * This is deprecated and will be removed in a future version
10 */
11 public function process_file( $url ) {
12 $parts = explode( '?', substr( $url, 7 ) );
13
14 if ( count( $parts ) > 1 ) {
15 // Put parameters into the environment
16 $args = explode( '&', $parts[1] );
17
18 if ( count( $args ) > 0 ) {
19 foreach ( $args as $arg ) {
20 $tmp = explode( '=', $arg );
21
22 if ( count( $tmp ) === 1 ) {
23 $_GET[ $arg ] = '';
24 } else {
25 $_GET[ $tmp[0] ] = $tmp[1];
26 }
27 }
28 }
29 }
30
31 @include $parts[0];
32 }
33
34 public function process_internal( $target ) {
35 // Another URL on the server
36 $_SERVER['REQUEST_URI'] = $target;
37
38 if ( strpos( $target, '?' ) ) {
39 $_SERVER['QUERY_STRING'] = substr( $target, strpos( $target, '?' ) + 1 );
40 parse_str( $_SERVER['QUERY_STRING'], $_GET );
41 }
42
43 return true;
44 }
45
46 public function is_external( $target ) {
47 return substr( $target, 0, 7 ) === 'http://' || substr( $target, 0, 8 ) === 'https://';
48 }
49
50 public function process_before( $code, $target ) {
51 // External target
52 if ( $this->is_external( $target ) ) {
53 $this->process_external( $target );
54 exit();
55 }
56
57 return $this->process_internal( $target );
58 }
59
60 public function needs_target() {
61 return true;
62 }
63 }
64