Back to index

d-push  2.0
compat.php
Go to the documentation of this file.
00001 <?php
00002 /***********************************************
00003 * File      :   compat.php
00004 * Project   :   Z-Push
00005 * Descr     :   Help function for files
00006 *
00007 * Created   :   01.10.2007
00008 *
00009 * Copyright 2007 - 2011 Zarafa Deutschland GmbH
00010 *
00011 * This program is free software: you can redistribute it and/or modify
00012 * it under the terms of the GNU Affero General Public License, version 3,
00013 * as published by the Free Software Foundation with the following additional
00014 * term according to sec. 7:
00015 *
00016 * According to sec. 7 of the GNU Affero General Public License, version 3,
00017 * the terms of the AGPL are supplemented with the following terms:
00018 *
00019 * "Zarafa" is a registered trademark of Zarafa B.V.
00020 * "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
00021 * The licensing of the Program under the AGPL does not imply a trademark license.
00022 * Therefore any rights, title and interest in our trademarks remain entirely with us.
00023 *
00024 * However, if you propagate an unmodified version of the Program you are
00025 * allowed to use the term "Z-Push" to indicate that you distribute the Program.
00026 * Furthermore you may use our trademarks where it is necessary to indicate
00027 * the intended purpose of a product or service provided you use it in accordance
00028 * with honest practices in industrial or commercial matters.
00029 * If you want to propagate modified versions of the Program under the name "Z-Push",
00030 * you may only do so if you have a written permission by Zarafa Deutschland GmbH
00031 * (to acquire a permission please contact Zarafa at trademark@zarafa.com).
00032 *
00033 * This program is distributed in the hope that it will be useful,
00034 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00035 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00036 * GNU Affero General Public License for more details.
00037 *
00038 * You should have received a copy of the GNU Affero General Public License
00039 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00040 *
00041 * Consult LICENSE file for details
00042 ************************************************/
00043 
00044 if (!function_exists("quoted_printable_encode")) {
00054     function quoted_printable_encode($string) {
00055         return preg_replace('/[^\r\n]{73}[^=\r\n]{2}/', "$0=\n", str_replace(array('%20', '%0D%0A', '%'), array(' ', "\r\n", '='), rawurlencode($string)));
00056     }
00057 }
00058 
00059 if (!function_exists("apache_request_headers")) {
00066     function apache_request_headers() {
00067         $headers = array();
00068         foreach ($_SERVER as $key => $value)
00069             if (substr($key, 0, 5) == 'HTTP_')
00070                 $headers[strtr(substr($key, 5), '_', '-')] = $value;
00071 
00072         return $headers;
00073     }
00074 }
00075 
00076 if (!function_exists("hex2bin")) {
00085     function hex2bin($data) {
00086         return pack("H*", $data);
00087     }
00088 }
00089 ?>