OSDN Git Service

MERGE: リビジョン1873〜1893。skinnable-masterのマージ
[nucleus-jp/nucleus-next.git] / nucleus / libs / NOTIFICATION.php
index e756712..1d708d1 100644 (file)
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * Class used to represent a collection of e-mail addresses, to which a\r
- * message can be sent (e.g. comment or karma vote notification).\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: NOTIFICATION.php 1534 2011-06-22 06:13:23Z sakamocchi $\r
- */\r
-class Notification\r
-{\r
-       static private $charset;\r
-       static private $scheme = 'B';\r
-       \r
-       /**\r
-        * NOTIFICATION::address_validation()\r
-        * Validating the string as address\r
-        * \r
-        * FIXME: this is just migrated from globalfunctions.php\r
-        *  we should confirm this regular expression refering to RFC 5322\r
-        * \r
-        * @link        http://www.ietf.org/rfc/rfc5322.txt\r
-        * @see         3.4. Address Specification\r
-        * \r
-        * @static\r
-        * @param       String  $address        Address\r
-        * @return      Boolean valid or not\r
-        */\r
-       static public function address_validation($address)\r
-       {\r
-               return (boolean) preg_match('#^(?!\\.)(?:\\.?[-a-zA-Z0-9!\\#$%&\'*+/=?^_`{|}~]+)+@(?!\\.)(?:\\.?(?!-)[-a-zA-Z0-9]+(?<!-)){2,}$#', $address);\r
-       }\r
-       \r
-       /**\r
-        * NOTIFICATION::get_mail_footer()\r
-        * Return mail footer with Nucleus CMS singnature\r
-        * \r
-        * @static\r
-        * @param       void\r
-        * @return      String  Message body with \r
-        */\r
-       static public function get_mail_footer()\r
-       {\r
-               $message  = "\n";\r
-               $message .= "\n";\r
-               $message .= "-----------------------------\n";\r
-               $message .=  "   Powered by Nucleus CMS\n";\r
-               $message .=  "(http://www.nucleuscms.org/)\n";\r
-               return $message;\r
-       }\r
-       \r
-       /**\r
-        * NOTIFICATION::mail\r
-        * Send mails with headers including 7bit-encoded multibyte string\r
-        * \r
-        * @static\r
-        * @param       string  $to             receivers including singlebyte and multibyte strings, based on RFC 5322\r
-        * @param       string  $subject        subject including singlebyte and multibyte strings\r
-        * @param       string  $message        message including singlebyte and multibyte strings\r
-        * @param       string  $from           senders including singlebyte and multibyte strings, based on RFC 5322\r
-        * @param       string(B/Q)     $scheme 7bit-encoder scheme based on RFC 2047\r
-        * @return      boolean accepted delivery or not\r
-        */\r
-       static public function mail($to, $subject, $message, $from, $charset, $scheme='B')\r
-       {\r
-               self::$charset = $charset;\r
-               self::$scheme = $scheme;\r
-               \r
-               $to = self::mailbox_list_encoder($to);\r
-               $subject = self::seven_bit_characters_encoder($subject);\r
-               $from = 'From: ' . self::mailbox_list_encoder($from);\r
-               \r
-               /*\r
-                * All of 7bit character encoding derives from ISO/IEC 646\r
-                * So we can decide the body's encoding bit count by this regular expression.\r
-                * \r
-                */\r
-               $bitcount = '8bit';\r
-               if ( preg_match('#\A[\x00-\x7f]*\z#', $message) )\r
-               {\r
-                       $bitcount = '7bit';\r
-               }\r
-               \r
-               $header  = 'Content-Type: text/html; charset=' . self::$charset . "; format=flowed; delsp=yes\n";\r
-               $header .= "Content-Transfer-Encoding: {$bitcount}\n";\r
-               $header .= "X-Mailer: Nucleus CMS NOTIFICATION class\n";\r
-               \r
-               return mail($to, $subject, $message, "{$from}\n{$header}");\r
-       }\r
-       \r
-       /**\r
-        * NOTIFICATION::mailbox_list_encoder\r
-        * Encode multi byte strings included in mailbox.\r
-        * The format of mailbox is based on RFC 5322, which obsoletes RFC 2822\r
-        * \r
-        * @link        http://www.ietf.org/rfc/rfc5322.txt\r
-        * @see         3.4. Address Specification\r
-        * \r
-        * @static\r
-        * @param       string  $mailbox_list           mailbox list\r
-        * @return      string  encoded string  \r
-        * \r
-        */\r
-       static private function mailbox_list_encoder ($mailbox_list)\r
-       {\r
-               $encoded_mailboxes = array();\r
-               $mailboxes = preg_split('#,#', $mailbox_list);\r
-               foreach ( $mailboxes as $mailbox )\r
-               {\r
-                       if ( preg_match("#^([^,]+)?<([^,]+)?@([^,]+)?>$#", $mailbox, $match) )\r
-                       {\r
-                               $display_name = self::seven_bit_characters_encoder(trim($match[1]));\r
-                               $local_part = trim($match[2]);\r
-                               $domain = trim($match[3]);\r
-                               $encoded_mailboxes[] = "{$display_name} <{$local_part}@{$domain}>";\r
-                       }\r
-                       else if ( preg_match("#([^,]+)?@([^,]+)?#", $mailbox) )\r
-                       {\r
-                               $encoded_mailboxes[] = $mailbox;\r
-                       }\r
-                       else\r
-                       {\r
-                               continue;\r
-                       }\r
-               }\r
-               if ( $encoded_mailboxes == array() )\r
-               {\r
-                       return FALSE;\r
-               }\r
-               return implode(',', $encoded_mailboxes);\r
-       }\r
-       \r
-       /**\r
-        * NOTIFICATION::seven_bit_characters_encoder\r
-        * Encoder into 7bit ASCII expression for Non-ASCII Text based on RFC 2047.\r
-        * \r
-        * @link http://www.ietf.org/rfc/rfc2047.txt\r
-        * @see 2. Syntax of encoded-words\r
-        * \r
-        * NOTE: RFC 2047 has a ambiguousity for dealing with 'linear-white-space'.\r
-        *  This causes a trouble related to line breaking between single byte and multi-byte strings.\r
-        *  To avoid this, single byte string is encoded as well as multi byte string here.\r
-        * \r
-        * NOTE: RFC 2231 also defines the way to use non-ASCII characters in MIME header.\r
-        * http://www.ietf.org/rfc/rfc2231.txt\r
-        * \r
-        * NOTE: iconv extension give the same functions as this in PHP5\r
-        * iconv_mime_encode():\r
-        * http://www.php.net/manual/en/function.iconv-mime-encode.php\r
-        * \r
-        * @static\r
-        * @param       string  $charset        Character set encoding\r
-        * @param       string  $type   type of 7 bit encoding, should be 'B' or 'Q'\r
-        * @param       string  $string Target string with header field\r
-        * @return      string  encoded string\r
-        * \r
-        */\r
-       static private function seven_bit_characters_encoder($string)\r
-       {\r
-               $header = chr(13) . chr(10) . chr(32) . '=?' . self::$charset . '?' . self::$scheme . '?';\r
-               $footer = "?=";\r
-               $restriction = 78 - strlen($header) - strlen($footer) ;\r
-               \r
-               $encoded_words = array();\r
-               for ( $i = 0; $i < i18n::strlen($string); $i++ )\r
-               {\r
-                       if ( self::$scheme == 'B' )\r
-                       {\r
-                               if ( $i == 0 )\r
-                               {\r
-                                       $letters = '';\r
-                               }\r
-                               \r
-                               $letter = i18n::substr($string, $i, 1);\r
-                               $expected_length = strlen($letters) + strlen($letter) * 4 / 3;\r
-                               \r
-                               if ( $expected_length > $restriction )\r
-                               {\r
-                                       $encoded_text = self::b_encoder($letters);\r
-                                       $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
-                                       $letters = '';\r
-                               }\r
-                               \r
-                               $letters .= $letter;\r
-                               \r
-                               if ( $i == i18n::strlen($string) - 1 )\r
-                               {\r
-                                       $encoded_text = self::b_encoder($letters);\r
-                                       $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
-                                       break;\r
-                               }\r
-                               continue;\r
-                       }\r
-                       else\r
-                       {\r
-                               if ( $i == 0 )\r
-                               {\r
-                                       $encoded_text = '';\r
-                               }\r
-                               \r
-                               $encoded_letter = self::q_encoder(self::substr($string, $i, 1));\r
-                               $expected_length = strlen($encoded_text) + strlen($encoded_letter);\r
-                               \r
-                               if ( $expected_length > $restriction )\r
-                               {\r
-                                       $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
-                                       $letters = '';\r
-                               }\r
-                               \r
-                               $encoded_text .= $encoded_letter;\r
-                               \r
-                               if ( $i == i18n::strlen($string) - 1 )\r
-                               {\r
-                                       $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
-                                       break;\r
-                               }\r
-                               continue;\r
-                       }\r
-               }\r
-               \r
-               return implode('', $encoded_words);\r
-       }\r
-       \r
-       /**\r
-        * NOTIFICATION::b_encoder()\r
-        * \r
-        * B encoder according to RFC 2047.\r
-        * The "B" encoding is identical to the "BASE64" encoding defined by RFC 4648.\r
-        * \r
-        * @link http://www.ietf.org/rfc/rfc4648.txt\r
-        * @see 6.8. Base64 Content-Transfer-Encoding\r
-        * \r
-        * NOTE: According to RFC 4648\r
-        * (1)  The final quantum of encoding input is an integral multiple of 24 bits;\r
-        *              here, the final unit of encoded output will be an integral multiple\r
-        *              of 4 characters with no "=" padding.\r
-        * (2)  The final quantum of encoding input is exactly 8 bits; here,\r
-        *              the final unit of encoded output will be two characters followed\r
-        *              by two "=" padding characters.\r
-        * (3)  The final quantum of encoding input is exactly 16 bits; here,\r
-        *              the final unit of encoded output will be three characters followed\r
-        *              by one "=" padding character.\r
-        * \r
-        * @static\r
-        * @param       string  $target targetted string\r
-        * @return      string  encoded string\r
-        */\r
-       static private function b_encoder($target)\r
-       {\r
-               return base64_encode($target);\r
-       }\r
-       \r
-       /**\r
-        * NOTIFICATION::q_encoder()\r
-        * \r
-        * Q encoder according to RFC 2047.\r
-        * The "Q" encoding is similar to "Quoted-Printable" content-transfer-encoding defined in RFC 2045,\r
-        *  but the "Q" encoding and the "Quoted-Printable" are different a bit.\r
-        * \r
-        * @link http://www.ietf.org/rfc/rfc2047.txt\r
-        * @see 4.2. The "Q" encoding\r
-        * \r
-        * NOTE: According to RFC 2047\r
-        * (1)  Any 8-bit value may be represented by a "=" followed by two hexadecimal digits.\r
-        *              For example, if the character set in use were ISO-8859-1,\r
-        *              the "=" character would thus be encoded as "=3D", and a SPACE by "=20".\r
-        *              (Upper case should be used for hexadecimal digits "A" through "F".)\r
-        * (2)  The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be\r
-        *              represented as "_" (underscore, ASCII 95.).\r
-        *              (This character may not pass through some internetwork mail gateways,\r
-        *              but its use will greatly enhance readability of "Q" encoded data\r
-        *              with mail readers that do not support this encoding.)\r
-        *              Note that the "_" always represents hexadecimal 20,\r
-        *              even if the SPACE character occupies a different code position\r
-        *              in the character set in use.\r
-        * (3)  8-bit values which correspond to printable ASCII characters\r
-        *              other than "=", "?", and "_" (underscore), MAY be represented as those characters.\r
-        *              (But see section 5 for restrictions.)\r
-        *              In particular, SPACE and TAB MUST NOT be represented as themselves within encoded words.\r
-        * \r
-        * @static\r
-        * @param       string  $target targetted string\r
-        * @return      string  encoded string\r
-        */\r
-       static private function q_encoder($target)\r
-       {\r
-               $string = '';\r
-               \r
-               for ( $i = 0; $i < strlen($target); $i++ )\r
-               {\r
-                       $letter = substr ($target, $i, 1);\r
-                       $order = ord($letter);\r
-                       \r
-                       // Printable ASCII characters without "=", "?", "_"\r
-                       if ((33 <= $order && $order <= 60)\r
-                        || (62 == $order)\r
-                        || (64 <= $order && $order <= 94)\r
-                        || (96 <= $order && $order <= 126))\r
-                       {\r
-                               $string .= strtoupper(dechex($order));\r
-                       }\r
-                       // Space shuold be encoded as the same strings as "_"\r
-                       else if ($order == 32)\r
-                       {\r
-                               $string .= '_';\r
-                       }\r
-                       // Other characters\r
-                       else\r
-                       {\r
-                               $string .= '=' . strtoupper(dechex($order));\r
-                       }\r
-               }\r
-               \r
-               return $string;\r
-       }\r
-       \r
-       /**\r
-        * NOTICE: Deprecated\r
-        * NOTIFICATION::$addresses\r
-        * \r
-        * @deprecated\r
-        */\r
-       private $addresses = array();\r
-       \r
-       /**\r
-        * NOTICE: Deprecated\r
-        * takes one string as argument, containing multiple e-mail addresses\r
-        * separated by semicolons\r
-        * eg: site@demuynck.org;nucleus@demuynck.org;foo@bar.com\r
-        * \r
-        * @deprecated\r
-        */\r
-       function __construct($addresses)\r
-       {\r
-               $this->addresses = preg_split('#;#' , $addresses);\r
-       }\r
-       \r
-       /**\r
-        * NOTICE: Deprecated\r
-        * NOTIFICATION::validAddresses()\r
-        * \r
-        * returns true if all addresses are valid\r
-        * \r
-        * @deprecated\r
-        * @param       Void\r
-        * @return      Boolean\r
-        */\r
-       function validAddresses()\r
-       {\r
-               foreach ( $this->addresses as $address )\r
-               {\r
-                       if ( !self::address_validation(trim($address)) )\r
-                       {\r
-                               return 0;\r
-                       }\r
-               }\r
-               return 1;\r
-       }\r
-       \r
-       /**\r
-        * NOTICE: Deprecated\r
-        * NOTIFICATION::notify()\r
-        * \r
-        * Sends email messages to all the email addresses\r
-        * \r
-        * @deprecated\r
-        * @param       String  $title  \r
-        * @param       String  $message        \r
-        * @param       String  $from   \r
-        * @return      Void\r
-        */\r
-       function notify($title, $message, $from)\r
-       {\r
-               global $member;\r
-               $addresses = array();\r
-               \r
-               foreach ($this->addresses as $address)\r
-               {\r
-                       if ( $member->isLoggedIn() && ($member->getEmail() == $address) )\r
-                       {\r
-                               continue;\r
-                       }\r
-                       $addresses[] = $address;\r
-               }\r
-               \r
-               self::mail(implode(',', $addresses), $title, $message , $from);\r
-               return;\r
-       }\r
-}\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * Class used to represent a collection of e-mail addresses, to which a
+ * message can be sent (e.g. comment or karma vote notification).
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: NOTIFICATION.php 1836 2012-05-12 10:38:31Z sakamocchi $
+ */
+class Notification
+{
+       static private $charset;
+       static private $scheme = 'B';
+       
+       /**
+        * NOTIFICATION::address_validation()
+        * Validating the string as address
+        * 
+        * FIXME: this is just migrated from globalfunctions.php
+        *  we should confirm this regular expression refering to RFC 5322
+        * 
+        * @link        http://www.ietf.org/rfc/rfc5322.txt
+        * @see         3.4. Address Specification
+        * 
+        * @static
+        * @param       String  $address        Address
+        * @return      Boolean valid or not
+        */
+       static public function address_validation($address)
+       {
+               return (boolean) preg_match('#^(?!\\.)(?:\\.?[-a-zA-Z0-9!\\#$%&\'*+/=?^_`{|}~]+)+@(?!\\.)(?:\\.?(?!-)[-a-zA-Z0-9]+(?<!-)){2,}$#', $address);
+       }
+       
+       /**
+        * NOTIFICATION::get_mail_footer()
+        * Return mail footer with Nucleus CMS singnature
+        * 
+        * @static
+        * @param       void
+        * @return      String  Message body with 
+        */
+       static public function get_mail_footer()
+       {
+               $message  = "\n";
+               $message .= "\n";
+               $message .= "-----------------------------\n";
+               $message .=  "   Powered by Nucleus CMS\n";
+               $message .=  "(http://www.nucleuscms.org/)\n";
+               return $message;
+       }
+       
+       /**
+        * NOTIFICATION::mail
+        * Send mails with headers including 7bit-encoded multibyte string
+        * 
+        * @static
+        * @param       string  $to             receivers including singlebyte and multibyte strings, based on RFC 5322
+        * @param       string  $subject        subject including singlebyte and multibyte strings
+        * @param       string  $message        message including singlebyte and multibyte strings
+        * @param       string  $from           senders including singlebyte and multibyte strings, based on RFC 5322
+        * @param       string(B/Q)     $scheme 7bit-encoder scheme based on RFC 2047
+        * @return      boolean accepted delivery or not
+        */
+       static public function mail($to, $subject, $message, $from, $charset, $scheme='B')
+       {
+               self::$charset = $charset;
+               self::$scheme = $scheme;
+               
+               $to = self::mailbox_list_encoder($to);
+               $subject = self::seven_bit_characters_encoder($subject);
+               $from = 'From: ' . self::mailbox_list_encoder($from);
+               
+               /*
+                * All of 7bit character encoding derives from ISO/IEC 646
+                * So we can decide the body's encoding bit count by this regular expression.
+                * 
+                */
+               $bitcount = '8bit';
+               if ( preg_match('#\A[\x00-\x7f]*\z#', $message) )
+               {
+                       $bitcount = '7bit';
+               }
+               
+               $header  = 'Content-Type: text/plain; charset=' . self::$charset . "; format=flowed; delsp=yes\n";
+               $header .= "Content-Transfer-Encoding: {$bitcount}\n";
+               $header .= "X-Mailer: Nucleus CMS NOTIFICATION class\n";
+               
+               return mail($to, $subject, $message, "{$from}\n{$header}");
+       }
+       
+       /**
+        * NOTIFICATION::mailbox_list_encoder
+        * Encode multi byte strings included in mailbox.
+        * The format of mailbox is based on RFC 5322, which obsoletes RFC 2822
+        * 
+        * @link        http://www.ietf.org/rfc/rfc5322.txt
+        * @see         3.4. Address Specification
+        * 
+        * @static
+        * @param       string  $mailbox_list           mailbox list
+        * @return      string  encoded string  
+        * 
+        */
+       static private function mailbox_list_encoder ($mailbox_list)
+       {
+               $encoded_mailboxes = array();
+               $mailboxes = preg_split('#,#', $mailbox_list);
+               foreach ( $mailboxes as $mailbox )
+               {
+                       if ( preg_match("#^([^,]+)?<([^,]+)?@([^,]+)?>$#", $mailbox, $match) )
+                       {
+                               $display_name = self::seven_bit_characters_encoder(trim($match[1]));
+                               $local_part = trim($match[2]);
+                               $domain = trim($match[3]);
+                               $encoded_mailboxes[] = "{$display_name} <{$local_part}@{$domain}>";
+                       }
+                       else if ( preg_match("#([^,]+)?@([^,]+)?#", $mailbox) )
+                       {
+                               $encoded_mailboxes[] = $mailbox;
+                       }
+                       else
+                       {
+                               continue;
+                       }
+               }
+               if ( $encoded_mailboxes == array() )
+               {
+                       return FALSE;
+               }
+               return implode(',', $encoded_mailboxes);
+       }
+       
+       /**
+        * NOTIFICATION::seven_bit_characters_encoder
+        * Encoder into 7bit ASCII expression for Non-ASCII Text based on RFC 2047.
+        * 
+        * @link http://www.ietf.org/rfc/rfc2047.txt
+        * @see 2. Syntax of encoded-words
+        * 
+        * NOTE: RFC 2047 has a ambiguousity for dealing with 'linear-white-space'.
+        *  This causes a trouble related to line breaking between single byte and multi-byte strings.
+        *  To avoid this, single byte string is encoded as well as multi byte string here.
+        * 
+        * NOTE: RFC 2231 also defines the way to use non-ASCII characters in MIME header.
+        * http://www.ietf.org/rfc/rfc2231.txt
+        * 
+        * NOTE: iconv extension give the same functions as this in PHP5
+        * iconv_mime_encode():
+        * http://www.php.net/manual/en/function.iconv-mime-encode.php
+        * 
+        * @static
+        * @param       string  $charset        Character set encoding
+        * @param       string  $type   type of 7 bit encoding, should be 'B' or 'Q'
+        * @param       string  $string Target string with header field
+        * @return      string  encoded string
+        * 
+        */
+       static private function seven_bit_characters_encoder($string)
+       {
+               $header = chr(13) . chr(10) . chr(32) . '=?' . self::$charset . '?' . self::$scheme . '?';
+               $footer = "?=";
+               $restriction = 78 - strlen($header) - strlen($footer) ;
+               
+               $encoded_words = array();
+               for ( $i = 0; $i < i18n::strlen($string); $i++ )
+               {
+                       if ( self::$scheme == 'B' )
+                       {
+                               if ( $i == 0 )
+                               {
+                                       $letters = '';
+                               }
+                               
+                               $letter = i18n::substr($string, $i, 1);
+                               $expected_length = strlen($letters) + strlen($letter) * 4 / 3;
+                               
+                               if ( $expected_length > $restriction )
+                               {
+                                       $encoded_text = self::b_encoder($letters);
+                                       $encoded_words[] = "{$header}{$encoded_text}{$footer}";
+                                       $letters = '';
+                               }
+                               
+                               $letters .= $letter;
+                               
+                               if ( $i == i18n::strlen($string) - 1 )
+                               {
+                                       $encoded_text = self::b_encoder($letters);
+                                       $encoded_words[] = "{$header}{$encoded_text}{$footer}";
+                                       break;
+                               }
+                               continue;
+                       }
+                       else
+                       {
+                               if ( $i == 0 )
+                               {
+                                       $encoded_text = '';
+                               }
+                               
+                               $encoded_letter = self::q_encoder(i18n::substr($string, $i, 1));
+                               $expected_length = strlen($encoded_text) + strlen($encoded_letter);
+                               
+                               if ( $expected_length > $restriction )
+                               {
+                                       $encoded_words[] = "{$header}{$encoded_text}{$footer}";
+                                       $letters = '';
+                               }
+                               
+                               $encoded_text .= $encoded_letter;
+                               
+                               if ( $i == i18n::strlen($string) - 1 )
+                               {
+                                       $encoded_words[] = "{$header}{$encoded_text}{$footer}";
+                                       break;
+                               }
+                               continue;
+                       }
+               }
+               
+               return implode('', $encoded_words);
+       }
+       
+       /**
+        * NOTIFICATION::b_encoder()
+        * 
+        * B encoder according to RFC 2047.
+        * The "B" encoding is identical to the "BASE64" encoding defined by RFC 4648.
+        * 
+        * @link http://www.ietf.org/rfc/rfc4648.txt
+        * @see 6.8. Base64 Content-Transfer-Encoding
+        * 
+        * NOTE: According to RFC 4648
+        * (1)  The final quantum of encoding input is an integral multiple of 24 bits;
+        *              here, the final unit of encoded output will be an integral multiple
+        *              of 4 characters with no "=" padding.
+        * (2)  The final quantum of encoding input is exactly 8 bits; here,
+        *              the final unit of encoded output will be two characters followed
+        *              by two "=" padding characters.
+        * (3)  The final quantum of encoding input is exactly 16 bits; here,
+        *              the final unit of encoded output will be three characters followed
+        *              by one "=" padding character.
+        * 
+        * @static
+        * @param       string  $target targetted string
+        * @return      string  encoded string
+        */
+       static private function b_encoder($target)
+       {
+               return base64_encode($target);
+       }
+       
+       /**
+        * NOTIFICATION::q_encoder()
+        * 
+        * Q encoder according to RFC 2047.
+        * The "Q" encoding is similar to "Quoted-Printable" content-transfer-encoding defined in RFC 2045,
+        *  but the "Q" encoding and the "Quoted-Printable" are different a bit.
+        * 
+        * @link http://www.ietf.org/rfc/rfc2047.txt
+        * @see 4.2. The "Q" encoding
+        * 
+        * NOTE: According to RFC 2047
+        * (1)  Any 8-bit value may be represented by a "=" followed by two hexadecimal digits.
+        *              For example, if the character set in use were ISO-8859-1,
+        *              the "=" character would thus be encoded as "=3D", and a SPACE by "=20".
+        *              (Upper case should be used for hexadecimal digits "A" through "F".)
+        * (2)  The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be
+        *              represented as "_" (underscore, ASCII 95.).
+        *              (This character may not pass through some internetwork mail gateways,
+        *              but its use will greatly enhance readability of "Q" encoded data
+        *              with mail readers that do not support this encoding.)
+        *              Note that the "_" always represents hexadecimal 20,
+        *              even if the SPACE character occupies a different code position
+        *              in the character set in use.
+        * (3)  8-bit values which correspond to printable ASCII characters
+        *              other than "=", "?", and "_" (underscore), MAY be represented as those characters.
+        *              (But see section 5 for restrictions.)
+        *              In particular, SPACE and TAB MUST NOT be represented as themselves within encoded words.
+        * 
+        * @static
+        * @param       string  $target targetted string
+        * @return      string  encoded string
+        */
+       static private function q_encoder($target)
+       {
+               $string = '';
+               
+               for ( $i = 0; $i < strlen($target); $i++ )
+               {
+                       $letter = substr ($target, $i, 1);
+                       $order = ord($letter);
+                       
+                       // Printable ASCII characters without "=", "?", "_"
+                       if ((33 <= $order && $order <= 60)
+                        || (62 == $order)
+                        || (64 <= $order && $order <= 94)
+                        || (96 <= $order && $order <= 126))
+                       {
+                               $string .= strtoupper(dechex($order));
+                       }
+                       // Space shuold be encoded as the same strings as "_"
+                       else if ($order == 32)
+                       {
+                               $string .= '_';
+                       }
+                       // Other characters
+                       else
+                       {
+                               $string .= '=' . strtoupper(dechex($order));
+                       }
+               }
+               
+               return $string;
+       }
+       
+       /**
+        * NOTICE: Deprecated
+        * NOTIFICATION::$addresses
+        * 
+        * @deprecated
+        */
+       private $addresses = array();
+       
+       /**
+        * NOTICE: Deprecated
+        * takes one string as argument, containing multiple e-mail addresses
+        * separated by semicolons
+        * eg: site@demuynck.org;nucleus@demuynck.org;foo@bar.com
+        * 
+        * @deprecated
+        */
+       function __construct($addresses)
+       {
+               $this->addresses = preg_split('#;#' , $addresses);
+       }
+       
+       /**
+        * NOTICE: Deprecated
+        * NOTIFICATION::validAddresses()
+        * 
+        * returns true if all addresses are valid
+        * 
+        * @deprecated
+        * @param       Void
+        * @return      Boolean
+        */
+       function validAddresses()
+       {
+               foreach ( $this->addresses as $address )
+               {
+                       if ( !self::address_validation(trim($address)) )
+                       {
+                               return 0;
+                       }
+               }
+               return 1;
+       }
+       
+       /**
+        * NOTICE: Deprecated
+        * NOTIFICATION::notify()
+        * 
+        * Sends email messages to all the email addresses
+        * 
+        * @deprecated
+        * @param       String  $title  
+        * @param       String  $message        
+        * @param       String  $from   
+        * @return      Void
+        */
+       function notify($title, $message, $from)
+       {
+               global $member;
+               $addresses = array();
+               
+               foreach ($this->addresses as $address)
+               {
+                       if ( $member->isLoggedIn() && ($member->getEmail() == $address) )
+                       {
+                               continue;
+                       }
+                       $addresses[] = $address;
+               }
+               
+               self::mail(implode(',', $addresses), $title, $message , $from);
+               return;
+       }
+}