PluginProbe
Redirection / 2.10
Redirection v2.10
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 2.10, at actions/pass.php

71 lines 1.5 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 public function process_file( $url ) {
9 $parts = explode( '?', substr( $url, 7 ) );
10
11 if ( count( $parts ) > 1 ) {
12 // Put parameters into the environment
13 $args = explode( '&', $parts[1] );
14
15 if ( count( $args ) > 0 ) {
16 foreach ( $args as $arg ) {
17 $tmp = explode( '=', $arg );
18
19 if ( count( $tmp ) === 1 ) {
20 $_GET[ $arg ] = '';
21 } else {
22 $_GET[ $tmp[0] ] = $tmp[1];
23 }
24 }
25 }
26 }
27
28 @include $parts[0];
29 }
30
31 public function process_internal( $target ) {
32 // Another URL on the server
33 $_SERVER['REQUEST_URI'] = $target;
34
35 if ( strpos( $target, '?' ) ) {
36 $_SERVER['QUERY_STRING'] = substr( $target, strpos( $target, '?' ) + 1 );
37 parse_str( $_SERVER['QUERY_STRING'], $_GET );
38 }
39
40 return true;
41 }
42
43 public function is_external( $target ) {
44 return substr( $target, 0, 7 ) === 'http://' || substr( $target, 0, 8 ) === 'https://';
45 }
46
47 public function is_file( $target ) {
48 return substr( $target, 0, 7 ) === 'file://';
49 }
50
51 public function process_before( $code, $target ) {
52 // External target
53 if ( $this->is_external( $target ) ) {
54 $this->process_external( $target );
55 exit();
56 }
57
58 // file:// targetw
59 if ( $this->is_file( $target ) ) {
60 if ( defined( 'REDIRECTION_SUPPORT_PASS_FILE' ) && REDIRECTION_SUPPORT_PASS_FILE ) {
61 $this->process_file( $target );
62 exit();
63 }
64
65 return;
66 }
67
68 return $this->process_internal( $target );
69 }
70 }
71