4 +-----------------------------------------------------------------------+
5 | program/bin/modcss.php |
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2007, RoundCube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Modify CSS source from a URL |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com> |
16 +-----------------------------------------------------------------------+
22 define('INSTALL_PATH', realpath('./../') . '/');
23 require INSTALL_PATH.'program/include/iniset.php';
26 if ($url = preg_replace('/[^a-z0-9.-_\?\$&=%]/i', '', $_GET['u']))
28 $a_uri = parse_url($url);
29 $port = $a_uri['port'] ? $a_uri['port'] : 80;
30 $host = $a_uri['host'];
31 $path = $a_uri['path'] . ($a_uri['query'] ? '?'.$a_uri['query'] : '');
34 if ($fp = fsockopen($host, $port, $errno, $errstr, 30))
36 $out = "GET $path HTTP/1.0\r\n";
37 $out .= "Host: $host\r\n";
38 $out .= "Connection: Close\r\n\r\n";
44 $line = trim(fgets($fp, 4048));
46 if ($header && preg_match('/^HTTP\/1\..\s+(\d+)/', $line, $regs) && intval($regs[1]) != 200)
48 else if (empty($line) && $header)
59 header("Content-Type: text/css");
60 echo rcmail_mod_css_styles($source, preg_replace('/[^a-z0-9]/i', '', $_GET['c']), $url);
63 header("HTTP/1.0 404 Not Found");