File: index.php - Tab length: 1 2 4 8 - Lines: on off - No wrap: on off

01: <?php
02: 
03: define ('SPECIAL',  '_url');
04: define ('URL_ABS',  'http://www.yaronet.com/');
05: define ('URL_REL',  'http://www.yaronet.com/blogs/');
06: 
07: if (isset ($_GET[SPECIAL]))
08: {
09:     $preserve = implode ('|', array
10:     (
11:         'js'
12:     ));
13: 
14:     $qs = '';
15: 
16:     foreach ($_GET as $key => $val)
17:         if ($key != SPECIAL)
18:             $qs = $qs . ($qs ? '&' : '?') . urlencode ($key) . '=' . urlencode ($val);
19: 
20:     $data = file_get_contents ('http://www.yaronet.com/blogs/' . $_GET[SPECIAL] . $qs);
21: 
22:     $data = preg_replace ('@=[\'"]/([^\'":]+\\.(' . $preserve . '))[\'"]@i', '="' . URL_ABS . '$1"', $data);
23:     $data = preg_replace ('@=[\'"]([^\'":]+\\.(' . $preserve . '))[\'"]@i', '="' . URL_REL . '$1"', $data);
24: 
25:     header ('Content-Type: text/html; charset=iso-8859-1');
26: 
27:     echo $data;
28: }