. * * Consult LICENSE file for details ************************************************/ if (!function_exists("quoted_printable_encode")) { /** * Process a string to fit the requirements of RFC2045 section 6.7. Note that * this works, but replaces more characters than the minimum set. For readability * the spaces and CRLF pairs aren't encoded though. * * @param string $string string to be encoded * * @see http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 */ function quoted_printable_encode($string) { return preg_replace('/[^\r\n]{73}[^=\r\n]{2}/', "$0=\n", str_replace(array('%20', '%0D%0A', '%'), array(' ', "\r\n", '='), rawurlencode($string))); } } /* if (!function_exists("apache_request_headers")) { // // When using other webservers or using php as cgi in apache // the function apache_request_headers() is not available. // This function parses the environment variables to extract // the necessary headers for Z-Push // function apache_request_headers() { $headers = array(); foreach ($_SERVER as $key => $value) if (substr($key, 0, 5) == 'HTTP_') $headers[strtr(substr($key, 5), '_', '-')] = $value; return $headers; } } */ if (!function_exists("apache_request_headers")) { // // When using other webservers or using php as cgi in apache // the function apache_request_headers() is not available. // This function parses the environment variables to extract // the necessary headers for Z-Push // function apache_request_headers() { $header = array(); if(isset($_SERVER['HTTP_MS_ASPROTOCOLVERSION'])) { $header['Ms-Asprotocolversion'] = $_SERVER['HTTP_MS_ASPROTOCOLVERSION']; } if(isset($_SERVER['REDIRECT_HTTP_MS_ASPROTOCOLVERSION'])) { $header['Ms-Asprotocolversion'] = $_SERVER['REDIRECT_HTTP_MS_ASPROTOCOLVERSION']; } if(isset($_SERVER['HTTP_X_MS_POLICYKEY'])) { $header['X-Ms-Policykey'] = $_SERVER['HTTP_X_MS_POLICYKEY']; } if(isset($_SERVER['REDIRECT_HTTP_X_MS_POLICYKEY'])) { $header['X-Ms-Policykey'] = $_SERVER['REDIRECT_HTTP_X_MS_POLICYKEY']; } $header['User-Agent'] = $_SERVER['HTTP_USER_AGENT']; return $header; } /* $header = apache_request_headers(); if(isset($header['Authorization'])) { list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($header['Authorization'], 6))); } /*/ if(isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6))); } if(isset($_SERVER['HTTP_AUTHORIZATION'])) { list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); } //*/ } if (!function_exists("hex2bin")) { /** * Complementary function to bin2hex() which converts a hex entryid to a binary entryid. * Since PHP 5.4 an internal hex2bin() implementation is available. * * @param string $data the hexadecimal string * * @returns string */ function hex2bin($data) { return pack("H*", $data); } } ?>