PluginProbe
Redirection / 3.3
Redirection v3.3
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 3.3, at actions/pass.php

74 lines 1.6 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 is_file( $target ) {
51 return substr( $target, 0, 7 ) === 'file://';
52 }
53
54 public function process_before( $code, $target ) {
55 // External target
56 if ( $this->is_external( $target ) ) {
57 $this->process_external( $target );
58 exit();
59 }
60
61 // file:// targetw
62 if ( $this->is_file( $target ) ) {
63 if ( defined( 'REDIRECTION_SUPPORT_PASS_FILE' ) && REDIRECTION_SUPPORT_PASS_FILE ) {
64 $this->process_file( $target );
65 exit();
66 }
67
68 return;
69 }
70
71 return $this->process_internal( $target );
72 }
73 }
74