Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) {
- Phar::interceptFileFuncs();
- set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path());
- Phar::webPhar(null, $web);
- include 'phar://' . __FILE__ . '/' . Extract_Phar::START;
- return;
- }
- if (@(isset($_SERVER['REQUEST_URI']) && isset($_SERVER['REQUEST_METHOD']) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'POST'))) {
- Extract_Phar::go(true);
- $mimes = array(
- 'phps' => 2,
- 'c' => 'text/plain',
- 'cc' => 'text/plain',
- 'cpp' => 'text/plain',
- 'c++' => 'text/plain',
- 'dtd' => 'text/plain',
- 'h' => 'text/plain',
- 'log' => 'text/plain',
- 'rng' => 'text/plain',
- 'txt' => 'text/plain',
- 'xsd' => 'text/plain',
- 'php' => 1,
- 'inc' => 1,
- 'avi' => 'video/avi',
- 'bmp' => 'image/bmp',
- 'css' => 'text/css',
- 'gif' => 'image/gif',
- 'htm' => 'text/html',
- 'html' => 'text/html',
- 'htmls' => 'text/html',
- 'ico' => 'image/x-ico',
- 'jpe' => 'image/jpeg',
- 'jpg' => 'image/jpeg',
- 'jpeg' => 'image/jpeg',
- 'js' => 'application/x-javascript',
- 'midi' => 'audio/midi',
- 'mid' => 'audio/midi',
- 'mod' => 'audio/mod',
- 'mov' => 'movie/quicktime',
- 'mp3' => 'audio/mp3',
- 'mpg' => 'video/mpeg',
- 'mpeg' => 'video/mpeg',
- 'pdf' => 'application/pdf',
- 'png' => 'image/png',
- 'swf' => 'application/shockwave-flash',
- 'tif' => 'image/tiff',
- 'tiff' => 'image/tiff',
- 'wav' => 'audio/wav',
- 'xbm' => 'image/xbm',
- 'xml' => 'text/xml',
- );
- header("Cache-Control: no-cache, must-revalidate");
- header("Pragma: no-cache");
- $basename = basename(__FILE__);
- if (!strpos($_SERVER['REQUEST_URI'], $basename)) {
- chdir(Extract_Phar::$temp);
- include $web;
- return;
- }
- $pt = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $basename) + strlen($basename));
- if (!$pt || $pt == '/') {
- $pt = $web;
- header('HTTP/1.1 301 Moved Permanently');
- header('Location: ' . $_SERVER['REQUEST_URI'] . '/' . $pt);
- exit;
- }
- $a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
- if (!$a || strlen(dirname($a)) < strlen(
- 0x65f1855, 760, Extract_Phar::$temp)) {
- header('HTTP/1.0 404 Not Found');
- echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File ", $pt, " Not Found</h1>\n </body>\n</html>";
- exit;
- }
- $b = pathinfo($a);
- if (!isset($b['extension'])) {
- header('Content-Type: text/plain');
- header('Content-Length: ' . filesize($a));
- readfile($a);
- exit;
- }
- if (isset($mimes[$b['extension']])) {
- if ($mimes[$b['extension']] === 1) {
- include $a;
- exit;
- }
- if ($mimes[$b['extension']] === 2) {
- highlight_file($a);
- exit;
- }
- header('Content-Type: ' .$mimes[$b['extension']]);
- header('Content-Length: ' . filesize($a));
- readfile($a);
- exit;
- }
- }
- class Extract_Phar
- {
- static $temp;
- static $origdir;
- const GZ = 0x1000;
- const BZ2 = 0x2000;
- const MASK = 0x3000;
- const START = '
Add Comment
Please, Sign In to add comment