30 lines
960 B
PHP
30 lines
960 B
PHP
<?php
|
|
// File name: rfc1521.inc.php
|
|
// Description: PHP subroutine for RFC 1521 MIME related patterns
|
|
// Date: 2004-07-04
|
|
// Author: imacat <imacat@pristine.com.tw>
|
|
// Copyright: Copyright (C) 2004-2007 Pristine Communications
|
|
|
|
// Set the include path
|
|
if (!defined("INCPATH_SET")) {
|
|
require_once dirname(__FILE__) . "/incpath.inc.php";
|
|
}
|
|
// Referenced subroutines
|
|
require_once "monica/rfc822.inc.php";
|
|
|
|
define("RFC1521_TSPECIALS", "[()<>@,;:\\\\\"\\/\\[\\]?=]");
|
|
define("RFC1521_TOKEN", "[^()<>@,;:\\\\\"\\/\\[\\]?= \\x01-\\x1F\\x7F]");
|
|
|
|
define("RFC1521_ATTRIBUTE", RFC1521_TOKEN);
|
|
define("RFC1521_VALUE", "(?:" . RFC1521_TOKEN . "|" . RFC822_QUOTED_STR . ")");
|
|
define("RFC1521_PARAMETER", RFC1521_ATTRIBUTE . "=" . RFC1521_VALUE);
|
|
|
|
// rfc1521_value_need_quoting: Whether a value need to be quoted by RFC-1521
|
|
function rfc1521_value_need_quoting($a)
|
|
{
|
|
return preg_match("/[()<>@,;:\\\\\"\\/\\[\\]?= \\x01-\\x1F\\x7F]/", $a)?
|
|
true: false;
|
|
}
|
|
|
|
?>
|