Please contact our support department if you feel this is in error
"); } } function checkRemoteFile($url) { //some hosts might not have curl enabled, so hush that request $ch = @curl_init(); @curl_setopt($ch, CURLOPT_URL, $url); // don't download content @curl_setopt($ch, CURLOPT_NOBODY, 1); @curl_setopt($ch, CURLOPT_FAILONERROR, 1); @curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); @curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); if (@curl_exec($ch) !== FALSE) { return true; } else { return false; } } /*end tom here*/ //051714 - fixed x-forwarded-for which was somehow removed class proxy { private $config; private $cache; private $remote; private $request; private $errors; private $fastDebug = false; public function __construct() { $this->errors = array(); } public function start() { require_once(APPPATH . DIRECTORY_SEPARATOR . "cache.php"); require_once(APPPATH . DIRECTORY_SEPARATOR . "remote.php"); $this->cache = new cache($_SERVER["HTTP_HOST"], $_SERVER["REQUEST_URI"]); $this->remote = new remote(); $config = json_decode(file_get_contents(BASEPATH . DIRECTORY_SEPARATOR . "config.json")); switch ($config->mode) { case 1: $this->processSingleConfig($config); break; case 2: $this->processMultiConfig($config->sites); break; } $this->config->host = $_SERVER["HTTP_HOST"]; $this->cache->setConfig($this->config); $this->obtainRequest(); if ($this->request->url == "/remote.php") { $in = json_decode(file_get_contents("php://input")); $out = new stdClass(); $accessKey = "9260ac5dafb37027cf6d7fa698e0a6c90015ec2fb87b18802dad38bfa367a080e770820ef90d885c19e70a1d2a9139b5b79024a86a83f111ba5e1d4be55ff131"; if ($in->apiKey != $accessKey) { $out = new stdClass(); $out->keyStatus = 0; $out->msg = "Key mismatch"; echo json_encode($out); die(); } else { $out->keyStatus = 1; } $this->remote->setConfig($this->config); $function = $in->function; $args = (!empty($in->args) ? $in->args : false); if ($function == "checkPage") { $out = $this->remote->$function($this, $args); } elseif ($function == "getInfo") { $out = $this->remote->$function($this, $args); } else { $out = $this->remote->$function($args); } echo json_encode($out); } else { $this->process(); } } private function processSingleConfig($config) { foreach ($config->sites as $key => $site) { $this->config = $config->sites->$key; return true; } } private function processMultiConfig($config) { $config = (array)$config; $config = array_change_key_case($config, CASE_LOWER); $httpHost = strtolower($_SERVER["HTTP_HOST"]); if (array_key_exists($httpHost, $config)) { $this->config = (object)$config[$httpHost]; } elseif (array_key_exists("www." . $httpHost, $config)) { $this->config = (object)$config["www." . $httpHost]; } elseif (array_key_exists(str_replace("www.", "", $httpHost), $config)) { $this->config = (object)$config[str_replace("www.", "", $httpHost)]; } else { echo "INVALID HOST"; die(); } } private function obtainRequest() { $requestURI = (object)parse_url($_SERVER['REQUEST_URI']); $request = new stdClass(); $request->url = $requestURI->path; $request->pathInfo = (object)pathinfo($requestURI->path); $request->headers = getallheaders(); if (!empty($requestURI->query)) { parse_str($requestURI->query, $request->query); } if (!empty($request->query)) { if (isset($request->query["CHDEBUG"])) { $this->fastDebug = true; $this->errors["MD5"] = "MD5: " . md5($_SERVER["HTTP_HOST"]); unset($request->query["CHDEBUG"]); } } $this->request = $request; $this->request->uri = $_SERVER["REQUEST_URI"]; } private function process() { ob_end_clean(); if (!$this->config->active) { header("HTTP/1.0 404 Not Found"); die(); } // Default page causes a nice refresh-loop... if ($this->request->url == "/cgi-sys/defaultwebpage.cgi") { header("HTTP/1.0 404 Not Found"); die(); } if ($this->cache->isInCache()) { if ($this->cache->isValid()) { $cached = $this->cache->retrieve(); header("Content-Type: {$cached->mime}"); http_response_code($cached->status); echo $cached->content; } else { $this->updateCache(); } } else { $this->updateCache(); } } public function updateCache() { $requestInit = $this->pullBackend($this->config->host, $this->request->uri); if (!empty($requestInit->headers["Set-Cookie"])) { if (is_array($requestInit->headers["Set-Cookie"])) { foreach ($requestInit->headers["Set-Cookie"] as $cookie) { $crumbles = array(); $cookieSplit = explode('; ', $cookie); foreach ($cookieSplit as $num => $option) { preg_match("#(?'key'.*?)=(?'value'.*)#", $option, $match); if (!empty($match["key"]) && !empty($match["value"])) { if ($num == 0) { $crumbles["key"] = $match["key"]; } $crumbles[$match["key"]] = $match["value"]; } } $key = $crumbles["key"]; $val = $crumbles[$crumbles["key"]]; $expires = (!empty($crumbles["expires"]) ? strtotime($crumbles["expires"]) : 0); $path = (!empty($crumbles["path"]) ? $crumbles["path"] : ""); $domain = (!empty($crumbles["domain"]) ? $crumbles["domain"] : ""); $secure = (!empty($crumbles["secure"]) ? $crumbles["secure"] : false); $httpOnly = (!empty($crumbles["httpOnly"]) ? $crumbles["httpOnly"] : false); setcookie($key, $val, $expires, $path, $domain, $secure, $httpOnly); } } else { header("Set-Cookie: {$requestInit->headers["Set-Cookie"]}"); } } if (isset($requestInit->headers["Location"])) { switch ($requestInit->status) { case 301: header('HTTP/1.1 301 Moved Permanently'); break; case 302: header('HTTP/1.1 302'); break; case 303: header('HTTP/1.1 303 See Other'); break; } header("Location: {$requestInit->headers["Location"]}"); } else { $this->processBackendRequest($requestInit); } } public function processBackendRequest($request) { if ($_SERVER['REQUEST_METHOD'] == "POST" && preg_match("#(xmlrpc\.php|post-new\.php|wp-admin\/edit\.php|wp-admin\/post\.php|wp-admin\/themes\.php|wp-admin\/customize\.php|wp-admin\/widgets\.php|wp-admin\/nav-menus\.php|wp-admin\/theme-editor\.php|wp-admin/plugin.*?\.php|wp-admin\/options-reading\.php|wp-admin\/options-general\.php)#", $this->request->url)) { $this->remote->clearCache(); } if ($this->cache->isCacheable() && empty($_COOKIE) && empty($_POST)) { $this->cache->store($request->content, $request->headers["Content-Type"], $request->status); } else { header("Cache-Control: no-cache"); } http_response_code($request->status); header("Content-Type: " . (is_array($request->headers["Content-Type"]) ? $request->headers["Content-Type"][0] : $request->headers["Content-Type"])); echo $request->content; } public function pullBackend($host, $url) { $cookie_string = ""; if (!empty($_COOKIE)) { foreach ($_COOKIE as $key => $value) { $cookie_string .= "$key=$value;"; } } $ch = curl_init(); $options = array(CURLOPT_HEADER => 1, CURLOPT_HTTPHEADER => array("Host: {$host}", "Cache-Control: no-cache", "CH: YES", "Accept: {$_SERVER["HTTP_ACCEPT"]}"), CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_URL => "http://{$this->config->ipAddress}{$url}", CURLOPT_FOLLOWLOCATION => false, CURLOPT_COOKIE => $cookie_string, CURLOPT_USERAGENT => $_SERVER["HTTP_USER_AGENT"], CURLOPT_REFERER => $_SERVER["HTTP_REFERER"]); if (isset($_SERVER["HTTP_X_REQUESTED_WITH"])) { $options[CURLOPT_HTTPHEADER][] = "X-Requested-With: {$_SERVER["HTTP_X_REQUESTED_WITH"]}"; } if (isset($_SERVER['REMOTE_ADDR'])) { $options[CURLOPT_HTTPHEADER][] = "X-Forwarded-For: {$_SERVER["REMOTE_ADDR"]}"; $options[CURLOPT_HTTPHEADER][] = "X-Real-IP: {$_SERVER["REMOTE_ADDR"]}"; } foreach($this->request->headers as $header => $value) { if (strstr($header, "MWP-")) { $options[CURLOPT_HTTPHEADER][] = "{$header}: {$value}"; } } if ($_SERVER['REQUEST_METHOD'] == "POST") { if (!empty($_POST)) { $files = array(); if (!empty($_FILES)) { $this->handleFileData($files, $_FILES); } $postData = array_merge($_POST, $files); $postArray = array(); $this->handlePostData($postArray, $postData); } $postString = file_get_contents("php://input"); if (!empty($postString)) { $postArray = $postString; } $options[CURLOPT_POST] = 1; $options[CURLOPT_POSTFIELDS] = $postArray; } curl_setopt_array($ch, $options); $output = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); $header = substr($output, 0, $info['header_size']); $body = substr($output, $info['header_size']); if (stripos($output, $host)) { $output = str_replace($host, $this->config->domain, $output); } $out = new stdClass(); $out->status = $info["http_code"]; $out->content = $body; $out->headers = $this->parseHeaders($header); $out->curlInfo = $info; return $out; } private function handlePostData(&$outArray, $postData, $parent = null) { foreach ($postData as $name => $value) { if (is_array($value)) { if (!empty($parent)) { $name = "{$parent}[{$name}]"; } $this->handlePostData($outArray, $value, $name); } else { if (!empty($parent)) { $outArray["{$parent}[{$name}]"] = (!empty($value) ? $value : ""); } else { $outArray[$name] = (!empty($value) ? $value : ""); } } } } private function handleFileData(&$outArray, $fileData, $parent = null) { foreach ($fileData as $key => $value) { if (is_array($value)) { if (array_key_exists("name", $value)) { if (is_array($value["name"])) { foreach ($value["name"] as $id => $fileName) { $outArray[$key][$id] = "@" . $value["tmp_name"][$id] . ";type={$value["type"][$id]};filename={$value["name"][$id]}";; } } else { $outArray[$key] = "@" . $value["tmp_name"] . ";type={$value["type"]};filename={$value["name"]}"; } } else { if (!empty($parent)) { $key = "{$parent}[{$key}]"; } $this->handleFileData($outArray, $value, $key); } } } } private function parseHeaders($headerString) { $headers = array(); $header = explode("\r\n", $headerString); foreach ($header as $line) { if (!empty($line)) { $split = explode(": ", $line); if (!empty($split[0]) && !empty($split[1])) { if (substr_count($headerString, $split[0]) > 1) { if (!empty($headers[$split[0]])) { $headers[$split[0]][] = $split[1]; } else { $headers[$split[0]] = array($split[1]); } } else { $headers[$split[0]] = $split[1]; } } } } return $headers; } public function handleError($errno, $errstr, $errfile, $errline) { $this->errors[] = "[Error] {$errstr} ({$errno}) on line {$errline} of file {$errfile}"; } public function __destruct() { if ((CHDEBUG == true || $this->fastDebug == true) && count($this->errors) > 0) { $errors = implode("
", $this->errors); error_log($errors); $out = "
CH Debugger

{$errors}

"; echo $out; } } } if (!function_exists('getallheaders')) { function getallheaders() { $headers = ''; foreach ($_SERVER as $name => $value) { if (substr($name, 0, 5) == 'HTTP_') { $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; } } return $headers; } } if (!function_exists('http_response_code')) { function http_response_code($code = NULL) { if ($code !== NULL) { switch ($code) { case 100: $text = 'Continue'; break; case 101: $text = 'Switching Protocols'; break; case 200: $text = 'OK'; break; case 201: $text = 'Created'; break; case 202: $text = 'Accepted'; break; case 203: $text = 'Non-Authoritative Information'; break; case 204: $text = 'No Content'; break; case 205: $text = 'Reset Content'; break; case 206: $text = 'Partial Content'; break; case 300: $text = 'Multiple Choices'; break; case 301: $text = 'Moved Permanently'; break; case 302: $text = 'Moved Temporarily'; break; case 303: $text = 'See Other'; break; case 304: $text = 'Not Modified'; break; case 305: $text = 'Use Proxy'; break; case 400: $text = 'Bad Request'; break; case 401: $text = 'Unauthorized'; break; case 402: $text = 'Payment Required'; break; case 403: $text = 'Forbidden'; break; case 404: $text = 'Not Found'; break; case 405: $text = 'Method Not Allowed'; break; case 406: $text = 'Not Acceptable'; break; case 407: $text = 'Proxy Authentication Required'; break; case 408: $text = 'Request Time-out'; break; case 409: $text = 'Conflict'; break; case 410: $text = 'Gone'; break; case 411: $text = 'Length Required'; break; case 412: $text = 'Precondition Failed'; break; case 413: $text = 'Request Entity Too Large'; break; case 414: $text = 'Request-URI Too Large'; break; case 415: $text = 'Unsupported Media Type'; break; case 500: $text = 'Internal Server Error'; break; case 501: $text = 'Not Implemented'; break; case 502: $text = 'Bad Gateway'; break; case 503: $text = 'Service Unavailable'; break; case 504: $text = 'Gateway Time-out'; break; case 505: $text = 'HTTP Version not supported'; break; default: exit('Unknown http status code "' . htmlentities($code) . '"'); break; } $protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0'); header($protocol . ' ' . $code . ' ' . $text); $GLOBALS['http_response_code'] = $code; } else { $code = (isset($GLOBALS['http_response_code']) ? $GLOBALS['http_response_code'] : 200); } return $code; } } Fatal error: Class 'proxy' not found in /home/fkcrtlby/public_html/index.php on line 15