| | |
| | | | | |
| | | | This file is part of the Roundcube PHP suite | |
| | | | Copyright (C) 2005-2007, The Roundcube Dev Team | |
| | | | Licensed under the GNU GPL | |
| | | | | |
| | | | Licensed under the GNU General Public License version 3 or | |
| | | | any later version with exceptions for skins & plugins. | |
| | | | See the README file for a full license statement. | |
| | | | | |
| | | | CONTENTS: | |
| | | | Shared functions and classes used in PHP projects | |
| | |
| | | if (headers_sent()) |
| | | return; |
| | | |
| | | header("Expires: ".gmdate("D, d M Y H:i:s", mktime()+$offset)." GMT"); |
| | | header("Expires: ".gmdate("D, d M Y H:i:s", time()+$offset)." GMT"); |
| | | header("Cache-Control: max-age=$offset"); |
| | | header("Pragma: "); |
| | | } |
| | |
| | | function in_array_nocase($needle, $haystack) |
| | | { |
| | | $needle = mb_strtolower($needle); |
| | | foreach ($haystack as $value) |
| | | if ($needle===mb_strtolower($value)) |
| | | return true; |
| | | foreach ((array)$haystack as $value) { |
| | | if ($needle === mb_strtolower($value)) { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | |
| | | $unit = 's'; |
| | | } |
| | | |
| | | $ts = mktime(); |
| | | $ts = time(); |
| | | switch ($unit) |
| | | { |
| | | case 'w': |
| | |
| | | |
| | | |
| | | /** |
| | | * Format e-mail address |
| | | * |
| | | * @param string $email E-mail address |
| | | * |
| | | * @return string Formatted e-mail address |
| | | */ |
| | | function format_email($email) |
| | | { |
| | | $email = trim($email); |
| | | $parts = explode('@', $email); |
| | | $count = count($parts); |
| | | |
| | | if ($count > 1) { |
| | | $parts[$count-1] = mb_strtolower($parts[$count-1]); |
| | | |
| | | $email = implode('@', $parts); |
| | | } |
| | | |
| | | return $email; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * mbstring replacement functions |
| | | */ |
| | | |