// Accepted charsets if (isset($_SERVER['HTTP_ACCEPT_CHARSET'])) { $toSet[CURLOPT_HTTPHEADER][] = 'Accept-Charset: ' . $_SERVER['HTTP_ACCEPT_CHARSET']; } /***************************************************************** * Browser options * Allows customization of a "virtual" browser via /extras/edit-browser.php ******************************************************************/ // Send user agent if ($_SESSION['custom_browser']['user_agent']) { $toSet[CURLOPT_USERAGENT] = $_SESSION['custom_browser']['user_agent']; } // Set referrer if ($_SESSION['custom_browser']['referrer'] == 'real') { // Automatically determine referrer if (isset($_SERVER['HTTP_REFERER']) && strpos($tmp = deproxifyURL($_SERVER['HTTP_REFERER']), GLYPE_URL) === false) { $toSet[CURLOPT_REFERER] = $tmp; } } else { if ($_SESSION['custom_browser']['referrer']) { // Send custom referrer $toSet[CURLOPT_REFERER] = $_SESSION['custom_browser']['referrer']; } } // Tunnel through another proxy if ($_SESSION['custom_browser']['tunnel']) { $toSet[CURLOPT_PROXY] = $_SESSION['custom_browser']['tunnel']; $toSet[CURLOPT_PROXYPORT] = $_SESSION['custom_browser']['tunnel_port']; $toSet[CURLOPT_PROXYTYPE] = $_SESSION['custom_browser']['tunnel_type'] == 'http' ? CURLPROXY_HTTP : CURLPROXY_SOCKS5; } /*****************************************************************
$args = array(); } // Did we find any args to pass? if ($args) { // Add phrase to start of array (to give to call_user_func_array()) $args = array_merge((array) $phrases[$_GET['e']], $args); $error = call_user_func_array('sprintf', $args); } else { // Just a simple print $error = $phrases[$_GET['e']]; } // Finally add it to the $themeReplace array to get it in there $themeReplace['error'] = '<div id="error">' . $error . '</div>'; // And a link to try again? if (!empty($_GET['return'])) { $themeReplace['error'] .= '<p style="text-align:right">[<a href="' . $_GET['return'] . '">Reload ' . deproxifyURL($_GET['return']) . '</a>]</p>'; } } /***************************************************************** * Check PHP version ******************************************************************/ if (version_compare(PHP_VERSION, 5) < 0) { $themeReplace['error'] = '<div id="error">You need PHP 5 to run this script. You are currently running ' . PHP_VERSION . '</div>'; } /***************************************************************** * Maintenance - check if we want to do anything now ******************************************************************/ if ($CONFIG['tmp_cleanup_interval']) { // Do we have a next run time? if (file_exists($file = $CONFIG['tmp_dir'] . 'cron.php')) { // Load the next runtime
// Accept encoding in any format (allows compressed pages to be downloaded => less bandwidth) $toSet[CURLOPT_HTTPHEADER] = array('Expect:'); // Send custom headers (an empty Expect should prevent 100 continue responses) // Set max filesize if (defined('CURLOPT_MAXFILESIZE') && optMAXSIZE) { $toSet[CURLOPT_MAXFILESIZE] = optMAXSIZE; } // Forward the custom headers if (isset($_SERVER['HTTP_USER_AGENT'])) { $toSet[CURLOPT_USERAGENT] = $_SERVER['HTTP_USER_AGENT']; } // Show SSL without verifying $toSet[CURLOPT_SSL_VERIFYPEER] = false; $toSet[CURLOPT_SSL_VERIFYHOST] = false; // Set referrer (but only if their browser sends referrer) if (!empty($_SERVER['HTTP_REFERER']) && strpos($referrer = deproxifyURL($_SERVER['HTTP_REFERER'], $options['encodeURL']), optURL) === false && strpos($referrer, 'http') === 0) { $toSet[CURLOPT_REFERER] = $referrer; } ########################################## ## Manage basic auth ########################################## if (isset($_COOKIE['auth'][urlDOMAIN])) { $toSet[CURLOPT_HTTPAUTH] = CURLAUTH_BASIC; $toSet[CURLOPT_USERPWD] = stripEscape($_COOKIE['auth'][urlDOMAIN]); } ########################################## ## Handle caching ########################################## ## If client sends "if modified since", pass it to cURL ## and (hopefully) we can send back a 304 response instead ## of the whole file