| 1 |
<?php |
| 2 |
|
| 3 |
class Pass_Action extends Red_Action |
| 4 |
{ |
| 5 |
function process_before ($code, $target) |
| 6 |
{ |
| 7 |
// Determine what we are passing to: local URL, remote URL, file |
| 8 |
if (substr ($target, 0, 7) == 'http://' || substr ($target, 0, 8) == 'https://') { |
| 9 |
echo @wp_remote_fopen ($target); |
| 10 |
die(); |
| 11 |
} |
| 12 |
else if (substr ($target, 0, 7) == 'file://') |
| 13 |
{ |
| 14 |
$parts = explode ('?', substr ($target, 7)); |
| 15 |
if (count ($parts) > 1) |
| 16 |
{ |
| 17 |
// Put parameters into the environment |
| 18 |
$args = explode ('&', $parts[1]); |
| 19 |
if (count ($args) > 0) |
| 20 |
{ |
| 21 |
foreach ($args AS $arg) |
| 22 |
{ |
| 23 |
$tmp = explode ('=', $arg); |
| 24 |
if (count ($tmp) == 1) |
| 25 |
$_GET[$arg] = ''; |
| 26 |
else |
| 27 |
$_GET[$tmp[0]] = $tmp[1]; |
| 28 |
} |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
include ($parts[0]); |
| 33 |
exit (); |
| 34 |
} |
| 35 |
else |
| 36 |
{ |
| 37 |
$_SERVER['REQUEST_URI'] = $target; |
| 38 |
if (strpos ($target, '?')) |
| 39 |
{ |
| 40 |
$_SERVER['QUERY_STRING'] = substr ($target, strpos ($target, '?') + 1); |
| 41 |
parse_str ($_SERVER['QUERY_STRING'], $_GET); |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
return true; |
| 46 |
} |
| 47 |
} |
| 48 |
|