diff --git a/inc/app/sitellite/boxes/util/contact/index.php b/inc/app/sitellite/boxes/util/contact/index.php index 2c515ec9..efc4fc1f 100644 --- a/inc/app/sitellite/boxes/util/contact/index.php +++ b/inc/app/sitellite/boxes/util/contact/index.php @@ -99,7 +99,7 @@ function onSubmit ($vals) { $this->parameters['email'], '[' . site_domain () . '] ' . intl_get ('Contact Form'), template_simple ('util_contact_email.spt', $vals), - 'From: ' . $vals['name'] . ' <' . $vals['from'] . '>', //noreply@' . preg_replace ('/^www\./i', '', site_domain ()) + 'From: ' . $vals['from'], //noreply@' . preg_replace ('/^www\./i', '', site_domain ()) array ("Is_HTML" => true) )) { page_title (intl_get ('An Error Occurred')); diff --git a/inc/app/sitellite/boxes/util/custom/index.php b/inc/app/sitellite/boxes/util/custom/index.php index 9b9b9cdf..749f80ad 100644 --- a/inc/app/sitellite/boxes/util/custom/index.php +++ b/inc/app/sitellite/boxes/util/custom/index.php @@ -261,17 +261,22 @@ function onSubmit ($vals) { } if ($this->parameters['cc'] == 'yes' || $vals['cc'] == 'yes') { - $cc = "\r\nCC: " . $vals['email_address']; + $cc = $vals['email_address']; } else { $cc = ''; } - if (! @mail ( + if (! site_mail ( $this->parameters['email'], '[' . site_domain () . '] ' . $this->parameters['title'], template_simple ('util_custom_email.spt', $vals), - 'From: ' . $vals['first_name'] . ' ' . $vals['last_name'] . ' <' . $vals['email_address'] . '>' . $cc - )) { + null, + array ( + "CC" => $cc, + "from_name" => $vals['first_name']. ' ' . $vals['last_name'], + "from_email" => $vals['email_address'] + ) + )) { page_title (intl_get ('An Error Occurred')); echo '

' . intl_get ('Our apologies, your form failed to be submitted. Please try again later.') . '

'; return; diff --git a/inc/app/sitellite/forms/send/index.php b/inc/app/sitellite/forms/send/index.php index 0b86267d..5a45d9ca 100644 --- a/inc/app/sitellite/forms/send/index.php +++ b/inc/app/sitellite/forms/send/index.php @@ -81,7 +81,7 @@ function onSubmit ($vals) { $email, $vals['subject'], $vals['message'], - 'From: ' . $vals['from_name'] . ' <' . $vals['from_email'] . ">\r\n", + 'From: ' . $vals['from_email'], array ("Is_HTML" => true) ); } @@ -91,7 +91,7 @@ function onSubmit ($vals) { $vals['from_email'], $vals['subject'], $vals['message'], - 'From: ' . $vals['from_name'] . ' <' . $vals['from_email'] . ">\r\n", + 'From: ' . $vals['from_email'], array ("Is_HTML" => true) ); //END: SEMIAS. diff --git a/saf/lib/Ext/phpmailer/README b/saf/lib/Ext/phpmailer/README index f451b89e..f66012d4 100644 --- a/saf/lib/Ext/phpmailer/README +++ b/saf/lib/Ext/phpmailer/README @@ -1,7 +1,130 @@ +/******************************************************************* +* http://code.google.com/a/apache-extras.org/p/phpmailer/ * +********************************************************************/ + PHPMailer Full Featured Email Transfer Class for PHP ========================================== +Version 5.2.1 (January 16, 2012) + +Patch release (see changelog.txt). + +Version 5.2.0 (July 19, 2011) + +With the release of this version, PHPMailer has moved to Apache +Extras: + http://code.google.com/a/apache-extras.org/p/phpmailer/ + +Version 5.0.0 (April 02, 2009) + +With the release of this version, we are initiating a new version numbering +system to differentiate from the PHP4 version of PHPMailer. + +Most notable in this release is fully object oriented code. + +We now have available the PHPDocumentor (phpdocs) documentation. This is +separate from the regular download to keep file sizes down. Please see the +download area of http://phpmailer.codeworxtech.com. + +We also have created a new test script (see /test_script) that you can use +right out of the box. Copy the /test_script folder directly to your server (in +the same structure ... with class.phpmailer.php and class.smtp.php in the +folder above it. Then launch the test script with: +http://www.yourdomain.com/phpmailer/test_script/index.php +from this one script, you can test your server settings for mail(), sendmail (or +qmail), and SMTP. This will email you a sample email (using contents.html for +the email body) and two attachments. One of the attachments is used as an inline +image to demonstrate how PHPMailer will automatically detect if attachments are +the same source as inline graphics and only include one version. Once you click +the Submit button, the results will be displayed including any SMTP debug +information and send status. We will also display a version of the script that +you can cut and paste to include in your projects. Enjoy! + +Version 2.3 (November 08, 2008) + +We have removed the /phpdoc from the downloads. All documentation is now on +the http://phpmailer.codeworxtech.com website. + +The phpunit.php has been updated to support PHP5. + +For all other changes and notes, please see the changelog. + +Donations are accepted at PayPal with our id "paypal@worxteam.com". + +Version 2.2 (July 15 2008) + +- see the changelog. + +Version 2.1 (June 04 2008) + +With this release, we are announcing that the development of PHPMailer for PHP5 +will be our focus from this date on. We have implemented all the enhancements +and fixes from the latest release of PHPMailer for PHP4. + +Far more important, though, is that this release of PHPMailer (v2.1) is +fully tested with E_STRICT error checking enabled. + +** NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS. + IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE + APPRECIATED. + +We have now added S/MIME functionality (ability to digitally sign emails). +BIG THANKS TO "sergiocambra" for posting this patch back in November 2007. +The "Signed Emails" functionality adds the Sign method to pass the private key +filename and the password to read it, and then email will be sent with +content-type multipart/signed and with the digital signature attached. + +A quick note on E_STRICT: + +- In about half the test environments the development version was subjected + to, an error was thrown for the date() functions (used at line 1565 and 1569). + This is NOT a PHPMailer error, it is the result of an incorrectly configured + PHP5 installation. The fix is to modify your 'php.ini' file and include the + date.timezone = America/New York + directive, (for your own server timezone) +- If you do get this error, and are unable to access your php.ini file, there is + a workaround. In your PHP script, add + date_default_timezone_set('America/Toronto'); + + * do NOT try to use + $myVar = date_default_timezone_get(); + as a test, it will throw an error. + +We have also included more example files to show the use of "sendmail", "mail()", +"smtp", and "gmail". + +We are also looking for more programmers to join the volunteer development team. +If you have an interest in this, please let us know. + +Enjoy! + + +Version 2.1.0beta1 & beta2 + +please note, this is BETA software +** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS +INTENDED STRICTLY FOR TESTING + +** NOTE: + +As of November 2007, PHPMailer has a new project team headed by industry +veteran Andy Prevost (codeworxtech). The first release in more than two +years will focus on fixes, adding ease-of-use enhancements, provide +basic compatibility with PHP4 and PHP5 using PHP5 backwards compatibility +features. A new release is planned before year-end 2007 that will provide +full compatiblity with PHP4 and PHP5, as well as more bug fixes. + +We are looking for project developers to assist in restoring PHPMailer to +its leadership position. Our goals are to simplify use of PHPMailer, provide +good documentation and examples, and retain backward compatibility to level +1.7.3 standards. + +If you are interested in helping out, visit http://sourceforge.net/projects/phpmailer +and indicate your interest. + +** + http://phpmailer.sourceforge.net/ This software is licenced under the LGPL. Please read LICENSE for information on the @@ -28,7 +151,7 @@ easy to use classes: AspEmail(tm) and AspMail. Both of these programs are COM components only available on Windows. They are also a little pricey for smaller projects. -Since I do Linux development I’ve missed these tools for my PHP coding. +Since I do Linux development I�ve missed these tools for my PHP coding. So I built a version myself that implements the same methods (object calls) that the Windows-based components do. It is open source and the LGPL license allows you to place the class in your proprietary PHP @@ -39,18 +162,18 @@ Installation: Copy class.phpmailer.php into your php.ini include_path. If you are using the SMTP mailer then place class.smtp.php in your path as well. -In the language directory you will find several files like -phpmailer.lang-en.php. If you look right before the .php extension -that there are two letters. These represent the language type of the -translation file. For instance "en" is the English file and "br" is -the Portuguese file. Chose the file that best fits with your language -and place it in the PHP include path. If your language is English -then you have nothing more to do. If it is a different language then -you must point PHPMailer to the correct translation. To do this, call +In the language directory you will find several files like +phpmailer.lang-en.php. If you look right before the .php extension +that there are two letters. These represent the language type of the +translation file. For instance "en" is the English file and "br" is +the Portuguese file. Chose the file that best fits with your language +and place it in the PHP include path. If your language is English +then you have nothing more to do. If it is a different language then +you must point PHPMailer to the correct translation. To do this, call the PHPMailer SetLanguage method like so: // To load the Portuguese version -$mail->SetLanguage("br", "/optional/path/to/language/directory"); +$mail->SetLanguage("br", "/optional/path/to/language/directory/"); That's it. You should now be ready to use PHPMailer! @@ -64,9 +187,9 @@ $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "smtp1.example.com;smtp2.example.com"; // specify main and backup server -$mail->SMTPAuth = true // turn on SMTP authentication -$mail->Username = "jswan" // SMTP username -$mail->Password = "secret" // SMTP password +$mail->SMTPAuth = true; // turn on SMTP authentication +$mail->Username = "jswan"; // SMTP username +$mail->Password = "secret"; // SMTP password $mail->From = "from@example.com"; $mail->FromName = "Mailer"; @@ -99,4 +222,4 @@ See ChangeLog.txt Download: http://sourceforge.net/project/showfiles.php?group_id=26031 -Brent R. Matzelle +Andy Prevost diff --git a/saf/lib/Ext/phpmailer/changelog.txt b/saf/lib/Ext/phpmailer/changelog.txt new file mode 100644 index 00000000..e2c982db --- /dev/null +++ b/saf/lib/Ext/phpmailer/changelog.txt @@ -0,0 +1,421 @@ +ChangeLog + +NOTE: THIS VERSION OF PHPMAILER IS DESIGNED FOR PHP5/PHP6. + IT WILL NOT WORK WITH PHP4. + +Version 5.2.1 (January 16, 2012) +* Closed several bugs +* Performance improvements +* MsgHTML() now returns the message as required. +* New method: GetSentMIMEMessage() (returns full copy of sent message) + +Version 5.2 (July 19, 2011) +* protected MIME body and header +* better DKIM DNS Resource Record support +* better aly handling +* htmlfilter class added to extras +* moved to Apache Extras + +Version 5.1 (October 20, 2009) +* fixed filename issue with AddStringAttachment (thanks to Tony) +* fixed "SingleTo" property, now works with Senmail, Qmail, and SMTP in + addition to PHP mail() +* added DKIM digital signing functionality + New properties: + - DKIM_domain (sets the domain name) + - DKIM_private (holds DKIM private key) + - DKIM_passphrase (holds your DKIM passphrase) + - DKIM_selector (holds the DKIM "selector") + - DKIM_identity (holds the identifying email address) +* added callback function support + - callback function parameters include: + result, to, cc, bcc, subject and body + * see the test/test_callback.php file for usage. +* added "auto" identity functionality + - can automatically add: + - Return-path (if Sender not set) + - Reply-To (if ReplyTo not set) + - can be disabled: + - $mail->SetFrom('yourname@yourdomain.com','First Last',false); + - or by adding the $mail->Sender and/or $mail->ReplyTo properties + Note: "auto" identity added to help with emails ending up in spam + or junk boxes because of missing headers + +Version 5.0.2 (May 24, 2009) +* Fix for missing attachments when inline graphics are present +* Fix for missing Cc in header when using SMTP (mail was sent, + but not displayed in header -- Cc receiver only saw email To: + line and no Cc line, but did get the email (To receiver + saw same) + +Version 5.0.1 (April 05, 2009) +* Temporary fix for missing attachments + +Version 5.0.0 (April 02, 2009) + +* With the release of this version, we are initiating a new version numbering + system to differentiate from the PHP4 version of PHPMailer. +* Most notable in this release is fully object oriented code. +class.smtp.php: +* Refactored class.smtp.php to support new exception handling + code size reduced from 29.2 Kb to 25.6 Kb +* Removed unnecessary functions from class.smtp.php: + public function Expand($name) { + public function Help($keyword="") { + public function Noop() { + public function Send($from) { + public function SendOrMail($from) { + public function Verify($name) { +class.phpmailer.php: +* Refactored class.phpmailer.php with new exception handling +* Changed processing functionality of Sendmail and Qmail so they cannot be + inadvertently used +* removed getFile() function, just became a simple wrapper for + file_get_contents() +* added check for PHP version (will gracefully exit if not at least PHP 5.0) +class.phpmailer.php enhancements +* enhanced code to check if an attachment source is the same as an embedded or + inline graphic source to eliminate duplicate attachments +New /test_script +* We have written a test script you can use to test the script as part of your + installation. Once you press submit, the test script will send a multi-mime + email with either the message you type in or an HTML email with an inline + graphic. Two attachments are included in the email (one of the attachments + is also the inline graphic so you can see that only one copy of the graphic + is sent in the email). The test script will also display the functional + script that you can copy/paste to your editor to duplicate the functionality. +New examples +* All new examples in both basic and advanced modes. Advanced examples show + Exception handling. +PHPDocumentator (phpdocs) documentation for PHPMailer version 5.0.0 +* all new documentation + +Please note: the website has been updated to reflect the changes in PHPMailer +version 5.0.0. http://phpmailer.codeworxtech.com/ + +Version 2.3 (November 06, 2008) + +* added Arabic language (many thanks to Bahjat Al Mostafa) +* removed English language from language files and made it a default within + class.phpmailer.php - if no language is found, it will default to use + the english language translation +* fixed public/private declarations +* corrected line 1728, $basedir to $directory +* added $sign_cert_file to avoid improper duplicate use of $sign_key_file +* corrected $this->Hello on line 612 to $this->Helo +* changed default of $LE to "\r\n" to comply with RFC 2822. Can be set by the user + if default is not acceptable +* removed trim() from return results in EncodeQP +* /test and three files it contained are removed from version 2.3 +* fixed phpunit.php for compliance with PHP5 +* changed $this->AltBody = $textMsg; to $this->AltBody = html_entity_decode($textMsg); +* We have removed the /phpdoc from the downloads. All documentation is now on + the http://phpmailer.codeworxtech.com website. + +Version 2.2.1 () July 19 2008 + +* fixed line 1092 in class.smtp.php (my apologies, error on my part) + +Version 2.2 () July 15 2008 + +* Fixed redirect issue (display of UTF-8 in thank you redirect) +* fixed error in getResponse function declaration (class.pop3.php) +* PHPMailer now PHP6 compliant +* fixed line 1092 in class.smtp.php (endless loop from missing = sign) + +Version 2.1 (Wed, June 04 2008) + +** NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS. + IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE + APPRECIATED. + +* added S/MIME functionality (ability to digitally sign emails) + BIG THANKS TO "sergiocambra" for posting this patch back in November 2007. + The "Signed Emails" functionality adds the Sign method to pass the private key + filename and the password to read it, and then email will be sent with + content-type multipart/signed and with the digital signature attached. +* fully compatible with E_STRICT error level + - Please note: + In about half the test environments this development version was subjected + to, an error was thrown for the date() functions used (line 1565 and 1569). + This is NOT a PHPMailer error, it is the result of an incorrectly configured + PHP5 installation. The fix is to modify your 'php.ini' file and include the + date.timezone = America/New York + directive, to your own server timezone + - If you do get this error, and are unable to access your php.ini file: + In your PHP script, add + date_default_timezone_set('America/Toronto'); + - do not try to use + $myVar = date_default_timezone_get(); + as a test, it will throw an error. +* added ability to define path (mainly for embedded images) + function MsgHTML($message,$basedir='') ... where: + $basedir is the fully qualified path +* fixed MsgHTML() function: + - Embedded Images where images are specified by :// will not be altered or embedded +* fixed the return value of SMTP exit code ( pclose ) +* addressed issue of multibyte characters in subject line and truncating +* added ability to have user specified Message ID + (default is still that PHPMailer create a unique Message ID) +* corrected unidentified message type to 'application/octet-stream' +* fixed chunk_split() multibyte issue (thanks to Colin Brown, et al). +* added check for added attachments +* enhanced conversion of HTML to text in MsgHTML (thanks to "brunny") + +Version 2.1.0beta2 (Sun, Dec 02 2007) +* implemented updated EncodeQP (thanks to coolbru, aka Marcus Bointon) +* finished all testing, all known bugs corrected, enhancements tested +- note: will NOT work with PHP4. + +please note, this is BETA software +** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS +INTENDED STRICTLY FOR TESTING + +Version 2.1.0beta1 +please note, this is BETA software +** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS +INTENDED STRICTLY FOR TESTING + +Version 2.0.0 rc2 (Fri, Nov 16 2007), interim release +* implements new property to control VERP in class.smtp.php + example (requires instantiating class.smtp.php): + $mail->do_verp = true; +* POP-before-SMTP functionality included, thanks to Richard Davey + (see class.pop3.php & pop3_before_smtp_test.php for examples) +* included example showing how to use PHPMailer with GMAIL +* fixed the missing Cc in SendMail() and Mail() + +****************** +A note on sending bulk emails: + +If the email you are sending is not personalized, consider using the +"undisclosed-recipient:;" strategy. That is, put all of your recipients +in the Bcc field and set the To field to "undisclosed-recipients:;". +It's a lot faster (only one send) and saves quite a bit on resources. +Contrary to some opinions, this will not get you listed in spam engines - +it's a legitimate way for you to send emails. + +A partial example for use with PHPMailer: + +$mail->AddAddress("undisclosed-recipients:;"); +$mail->AddBCC("email1@anydomain.com,email2@anyotherdomain.com,email3@anyalternatedomain.com"); + +Many email service providers restrict the number of emails that can be sent +in any given time period. Often that is between 50 - 60 emails maximum +per hour or per send session. + +If that's the case, then break up your Bcc lists into chunks that are one +less than your limit, and put a pause in your script. +******************* + +Version 2.0.0 rc1 (Thu, Nov 08 2007), interim release +* dramatically simplified using inline graphics ... it's fully automated and requires no user input +* added automatic document type detection for attachments and pictures +* added MsgHTML() function to replace Body tag for HTML emails +* fixed the SendMail security issues (input validation vulnerability) +* enhanced the AddAddresses functionality so that the "Name" portion is used in the email address +* removed the need to use the AltBody method (set from the HTML, or default text used) +* set the PHP Mail() function as the default (still support SendMail, SMTP Mail) +* removed the need to set the IsHTML property (set automatically) +* added Estonian language file by Indrek Päri +* added header injection patch +* added "set" method to permit users to create their own pseudo-properties like 'X-Headers', etc. + example of use: + $mail->set('X-Priority', '3'); + $mail->set('X-MSMail-Priority', 'Normal'); +* fixed warning message in SMTP get_lines method +* added TLS/SSL SMTP support + example of use: + $mail = new PHPMailer(); + $mail->Mailer = "smtp"; + $mail->Host = "smtp.example.com"; + $mail->SMTPSecure = "tls"; // option + //$mail->SMTPSecure = "ssl"; // option + ... + $mail->Send(); +* PHPMailer has been tested with PHP4 (4.4.7) and PHP5 (5.2.7) +* Works with PHP installed as a module or as CGI-PHP +- NOTE: will NOT work with PHP5 in E_STRICT error mode + +Version 1.73 (Sun, Jun 10 2005) +* Fixed denial of service bug: http://www.cybsec.com/vuln/PHPMailer-DOS.pdf +* Now has a total of 20 translations +* Fixed alt attachments bug: http://tinyurl.com/98u9k + +Version 1.72 (Wed, May 25 2004) +* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations. +* Received: Removed this method because spam filter programs like +SpamAssassin reject this header. +* Fixed error count bug. +* SetLanguage default is now "language/". +* Fixed magic_quotes_runtime bug. + +Version 1.71 (Tue, Jul 28 2003) +* Made several speed enhancements +* Added German and Italian translation files +* Fixed HELO/AUTH bugs on keep-alive connects +* Now provides an error message if language file does not load +* Fixed attachment EOL bug +* Updated some unclear documentation +* Added additional tests and improved others + +Version 1.70 (Mon, Jun 20 2003) +* Added SMTP keep-alive support +* Added IsError method for error detection +* Added error message translation support (SetLanguage) +* Refactored many methods to increase library performance +* Hello now sends the newer EHLO message before HELO as per RFC 2821 +* Removed the boundary class and replaced it with GetBoundary +* Removed queue support methods +* New $Hostname variable +* New Message-ID header +* Received header reformat +* Helo variable default changed to $Hostname +* Removed extra spaces in Content-Type definition (#667182) +* Return-Path should be set to Sender when set +* Adds Q or B encoding to headers when necessary +* quoted-encoding should now encode NULs \000 +* Fixed encoding of body/AltBody (#553370) +* Adds "To: undisclosed-recipients:;" when all recipients are hidden (BCC) +* Multiple bug fixes + +Version 1.65 (Fri, Aug 09 2002) +* Fixed non-visible attachment bug (#585097) for Outlook +* SMTP connections are now closed after each transaction +* Fixed SMTP::Expand return value +* Converted SMTP class documentation to phpDocumentor format + +Version 1.62 (Wed, Jun 26 2002) +* Fixed multi-attach bug +* Set proper word wrapping +* Reduced memory use with attachments +* Added more debugging +* Changed documentation to phpDocumentor format + +Version 1.60 (Sat, Mar 30 2002) +* Sendmail pipe and address patch (Christian Holtje) +* Added embedded image and read confirmation support (A. Ognio) +* Added unit tests +* Added SMTP timeout support (*nix only) +* Added possibly temporary PluginDir variable for SMTP class +* Added LE message line ending variable +* Refactored boundary and attachment code +* Eliminated SMTP class warnings +* Added SendToQueue method for future queuing support + +Version 1.54 (Wed, Dec 19 2001) +* Add some queuing support code +* Fixed a pesky multi/alt bug +* Messages are no longer forced to have "To" addresses + +Version 1.50 (Thu, Nov 08 2001) +* Fix extra lines when not using SMTP mailer +* Set WordWrap variable to int with a zero default + +Version 1.47 (Tue, Oct 16 2001) +* Fixed Received header code format +* Fixed AltBody order error +* Fixed alternate port warning + +Version 1.45 (Tue, Sep 25 2001) +* Added enhanced SMTP debug support +* Added support for multiple ports on SMTP +* Added Received header for tracing +* Fixed AddStringAttachment encoding +* Fixed possible header name quote bug +* Fixed wordwrap() trim bug +* Couple other small bug fixes + +Version 1.41 (Wed, Aug 22 2001) +* Fixed AltBody bug w/o attachments +* Fixed rfc_date() for certain mail servers + +Version 1.40 (Sun, Aug 12 2001) +* Added multipart/alternative support (AltBody) +* Documentation update +* Fixed bug in Mercury MTA + +Version 1.29 (Fri, Aug 03 2001) +* Added AddStringAttachment() method +* Added SMTP authentication support + +Version 1.28 (Mon, Jul 30 2001) +* Fixed a typo in SMTP class +* Fixed header issue with Imail (win32) SMTP server +* Made fopen() calls for attachments use "rb" to fix win32 error + +Version 1.25 (Mon, Jul 02 2001) +* Added RFC 822 date fix (Patrice) +* Added improved error handling by adding a $ErrorInfo variable +* Removed MailerDebug variable (obsolete with new error handler) + +Version 1.20 (Mon, Jun 25 2001) +* Added quoted-printable encoding (Patrice) +* Set Version as public and removed PrintVersion() +* Changed phpdoc to only display public variables and methods + +Version 1.19 (Thu, Jun 21 2001) +* Fixed MS Mail header bug +* Added fix for Bcc problem with mail(). *Does not work on Win32* + (See PHP bug report: http://www.php.net/bugs.php?id=11616) +* mail() no longer passes a fifth parameter when not needed + +Version 1.15 (Fri, Jun 15 2001) +[Note: these changes contributed by Patrice Fournier] +* Changed all remaining \n to \r\n +* Bcc: header no longer writen to message except +when sent directly to sendmail +* Added a small message to non-MIME compliant mail reader +* Added Sender variable to change the Sender email +used in -f for sendmail/mail and in 'MAIL FROM' for smtp mode +* Changed boundary setting to a place it will be set only once +* Removed transfer encoding for whole message when using multipart +* Message body now uses Encoding in multipart messages +* Can set encoding and type to attachments 7bit, 8bit +and binary attachment are sent as is, base64 are encoded +* Can set Encoding to base64 to send 8 bits body +through 7 bits servers + +Version 1.10 (Tue, Jun 12 2001) +* Fixed win32 mail header bug (printed out headers in message body) + +Version 1.09 (Fri, Jun 08 2001) +* Changed date header to work with Netscape mail programs +* Altered phpdoc documentation + +Version 1.08 (Tue, Jun 05 2001) +* Added enhanced error-checking +* Added phpdoc documentation to source + +Version 1.06 (Fri, Jun 01 2001) +* Added optional name for file attachments + +Version 1.05 (Tue, May 29 2001) +* Code cleanup +* Eliminated sendmail header warning message +* Fixed possible SMTP error + +Version 1.03 (Thu, May 24 2001) +* Fixed problem where qmail sends out duplicate messages + +Version 1.02 (Wed, May 23 2001) +* Added multiple recipient and attachment Clear* methods +* Added Sendmail public variable +* Fixed problem with loading SMTP library multiple times + +Version 0.98 (Tue, May 22 2001) +* Fixed problem with redundant mail hosts sending out multiple messages +* Added additional error handler code +* Added AddCustomHeader() function +* Added support for Microsoft mail client headers (affects priority) +* Fixed small bug with Mailer variable +* Added PrintVersion() function + +Version 0.92 (Tue, May 15 2001) +* Changed file names to class.phpmailer.php and class.smtp.php to match + current PHP class trend. +* Fixed problem where body not being printed when a message is attached +* Several small bug fixes + +Version 0.90 (Tue, April 17 2001) +* Intial public release diff --git a/saf/lib/Ext/phpmailer/class.phpmailer.php b/saf/lib/Ext/phpmailer/class.phpmailer.php index 69a81b96..af089d59 100644 --- a/saf/lib/Ext/phpmailer/class.phpmailer.php +++ b/saf/lib/Ext/phpmailer/class.phpmailer.php @@ -1,1535 +1,2532 @@ ContentType = "text/html"; - else - $this->ContentType = "text/plain"; - } - - /** - * Sets Mailer to send message using SMTP. - * @return void - */ - function IsSMTP() { - $this->Mailer = "smtp"; - } - - /** - * Sets Mailer to send message using PHP mail() function. - * @return void - */ - function IsMail() { - $this->Mailer = "mail"; - } - - /** - * Sets Mailer to send message using the $Sendmail program. - * @return void - */ - function IsSendmail() { - $this->Mailer = "sendmail"; - } - - /** - * Sets Mailer to send message using the qmail MTA. - * @return void - */ - function IsQmail() { - $this->Sendmail = "/var/qmail/bin/sendmail"; - $this->Mailer = "sendmail"; - } - - - ///////////////////////////////////////////////// - // RECIPIENT METHODS - ///////////////////////////////////////////////// - - /** - * Adds a "To" address. - * @param string $address - * @param string $name - * @return void - */ - function AddAddress($address, $name = "") { - $cur = count($this->to); - $this->to[$cur][0] = trim($address); - $this->to[$cur][1] = $name; - } - - /** - * Adds a "Cc" address. Note: this function works - * with the SMTP mailer on win32, not with the "mail" - * mailer. - * @param string $address - * @param string $name - * @return void - */ - function AddCC($address, $name = "") { - $cur = count($this->cc); - $this->cc[$cur][0] = trim($address); - $this->cc[$cur][1] = $name; - } - - /** - * Adds a "Bcc" address. Note: this function works - * with the SMTP mailer on win32, not with the "mail" - * mailer. - * @param string $address - * @param string $name - * @return void - */ - function AddBCC($address, $name = "") { - $cur = count($this->bcc); - $this->bcc[$cur][0] = trim($address); - $this->bcc[$cur][1] = $name; - } - - /** - * Adds a "Reply-to" address. - * @param string $address - * @param string $name - * @return void - */ - function AddReplyTo($address, $name = "") { - $cur = count($this->ReplyTo); - $this->ReplyTo[$cur][0] = trim($address); - $this->ReplyTo[$cur][1] = $name; - } - - - ///////////////////////////////////////////////// - // MAIL SENDING METHODS - ///////////////////////////////////////////////// - - /** - * Creates message and assigns Mailer. If the message is - * not sent successfully then it returns false. Use the ErrorInfo - * variable to view description of the error. - * @return bool - */ - function Send() { - $header = ""; - $body = ""; - - if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) - { - $this->SetError($this->Lang("provide_address")); - return false; - } - // Set whether the message is multipart/alternative - if(!empty($this->AltBody)) - $this->ContentType = "multipart/alternative"; +if (version_compare(PHP_VERSION, '5.0.0', '<') ) exit("Sorry, this version of PHPMailer will only run on PHP version 5 or greater!\n"); + +class PHPMailer { + + ///////////////////////////////////////////////// + // PROPERTIES, PUBLIC + ///////////////////////////////////////////////// + + /** + * Email priority (1 = High, 3 = Normal, 5 = low). + * @var int + */ + public $Priority = 3; + + /** + * Sets the CharSet of the message. + * @var string + */ + public $CharSet = 'iso-8859-1'; + + /** + * Sets the Content-type of the message. + * @var string + */ + public $ContentType = 'text/plain'; + + /** + * Sets the Encoding of the message. Options for this are + * "8bit", "7bit", "binary", "base64", and "quoted-printable". + * @var string + */ + public $Encoding = '8bit'; + + /** + * Holds the most recent mailer error message. + * @var string + */ + public $ErrorInfo = ''; + + /** + * Sets the From email address for the message. + * @var string + */ + public $From = 'root@localhost'; + + /** + * Sets the From name of the message. + * @var string + */ + public $FromName = 'Root User'; + + /** + * Sets the Sender email (Return-Path) of the message. If not empty, + * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. + * @var string + */ + public $Sender = ''; + + /** + * Sets the Subject of the message. + * @var string + */ + public $Subject = ''; + + /** + * Sets the Body of the message. This can be either an HTML or text body. + * If HTML then run IsHTML(true). + * @var string + */ + public $Body = ''; + + /** + * Sets the text-only body of the message. This automatically sets the + * email to multipart/alternative. This body can be read by mail + * clients that do not have HTML email capability such as mutt. Clients + * that can read HTML will view the normal Body. + * @var string + */ + public $AltBody = ''; + + /** + * Stores the complete compiled MIME message body. + * @var string + * @access protected + */ + protected $MIMEBody = ''; + + /** + * Stores the complete compiled MIME message headers. + * @var string + * @access protected + */ + protected $MIMEHeader = ''; + + /** + * Stores the complete sent MIME message (Body and Headers) + * @var string + * @access protected + */ + protected $SentMIMEMessage = ''; + + /** + * Sets word wrapping on the body of the message to a given number of + * characters. + * @var int + */ + public $WordWrap = 0; + + /** + * Method to send mail: ("mail", "sendmail", or "smtp"). + * @var string + */ + public $Mailer = 'mail'; + + /** + * Sets the path of the sendmail program. + * @var string + */ + public $Sendmail = '/usr/sbin/sendmail'; + + /** + * Path to PHPMailer plugins. Useful if the SMTP class + * is in a different directory than the PHP include path. + * @var string + */ + public $PluginDir = ''; + + /** + * Sets the email address that a reading confirmation will be sent. + * @var string + */ + public $ConfirmReadingTo = ''; + + /** + * Sets the hostname to use in Message-Id and Received headers + * and as default HELO string. If empty, the value returned + * by SERVER_NAME is used or 'localhost.localdomain'. + * @var string + */ + public $Hostname = ''; + + /** + * Sets the message ID to be used in the Message-Id header. + * If empty, a unique id will be generated. + * @var string + */ + public $MessageID = ''; + + ///////////////////////////////////////////////// + // PROPERTIES FOR SMTP + ///////////////////////////////////////////////// + + /** + * Sets the SMTP hosts. All hosts must be separated by a + * semicolon. You can also specify a different port + * for each host by using this format: [hostname:port] + * (e.g. "smtp1.example.com:25;smtp2.example.com"). + * Hosts will be tried in order. + * @var string + */ + public $Host = 'localhost'; + + /** + * Sets the default SMTP server port. + * @var int + */ + public $Port = 25; + + /** + * Sets the SMTP HELO of the message (Default is $Hostname). + * @var string + */ + public $Helo = ''; + + /** + * Sets connection prefix. + * Options are "", "ssl" or "tls" + * @var string + */ + public $SMTPSecure = ''; + + /** + * Sets SMTP authentication. Utilizes the Username and Password variables. + * @var bool + */ + public $SMTPAuth = false; + + /** + * Sets SMTP username. + * @var string + */ + public $Username = ''; + + /** + * Sets SMTP password. + * @var string + */ + public $Password = ''; + + /** + * Sets the SMTP server timeout in seconds. + * This function will not work with the win32 version. + * @var int + */ + public $Timeout = 10; + + /** + * Sets SMTP class debugging on or off. + * @var bool + */ + public $SMTPDebug = false; + + /** + * Prevents the SMTP connection from being closed after each mail + * sending. If this is set to true then to close the connection + * requires an explicit call to SmtpClose(). + * @var bool + */ + public $SMTPKeepAlive = false; + + /** + * Provides the ability to have the TO field process individual + * emails, instead of sending to entire TO addresses + * @var bool + */ + public $SingleTo = false; + + /** + * If SingleTo is true, this provides the array to hold the email addresses + * @var bool + */ + public $SingleToArray = array(); + + /** + * Provides the ability to change the line ending + * @var string + */ + public $LE = "\n"; + + /** + * Used with DKIM DNS Resource Record + * @var string + */ + public $DKIM_selector = 'phpmailer'; + + /** + * Used with DKIM DNS Resource Record + * optional, in format of email address 'you@yourdomain.com' + * @var string + */ + public $DKIM_identity = ''; + + /** + * Used with DKIM DNS Resource Record + * @var string + */ + public $DKIM_passphrase = ''; + + /** + * Used with DKIM DNS Resource Record + * optional, in format of email address 'you@yourdomain.com' + * @var string + */ + public $DKIM_domain = ''; + + /** + * Used with DKIM DNS Resource Record + * optional, in format of email address 'you@yourdomain.com' + * @var string + */ + public $DKIM_private = ''; + + /** + * Callback Action function name + * the function that handles the result of the send email action. Parameters: + * bool $result result of the send action + * string $to email address of the recipient + * string $cc cc email addresses + * string $bcc bcc email addresses + * string $subject the subject + * string $body the email body + * @var string + */ + public $action_function = ''; //'callbackAction'; + + /** + * Sets the PHPMailer Version number + * @var string + */ + public $Version = '5.2.1'; + + /** + * What to use in the X-Mailer header + * @var string + */ + public $XMailer = ''; + + ///////////////////////////////////////////////// + // PROPERTIES, PRIVATE AND PROTECTED + ///////////////////////////////////////////////// + + protected $smtp = NULL; + protected $to = array(); + protected $cc = array(); + protected $bcc = array(); + protected $ReplyTo = array(); + protected $all_recipients = array(); + protected $attachment = array(); + protected $CustomHeader = array(); + protected $message_type = ''; + protected $boundary = array(); + protected $language = array(); + protected $error_count = 0; + protected $sign_cert_file = ''; + protected $sign_key_file = ''; + protected $sign_key_pass = ''; + protected $exceptions = false; + + ///////////////////////////////////////////////// + // CONSTANTS + ///////////////////////////////////////////////// + + const STOP_MESSAGE = 0; // message only, continue processing + const STOP_CONTINUE = 1; // message?, likely ok to continue processing + const STOP_CRITICAL = 2; // message, plus full stop, critical error reached + + ///////////////////////////////////////////////// + // METHODS, VARIABLES + ///////////////////////////////////////////////// + + /** + * Constructor + * @param boolean $exceptions Should we throw external exceptions? + */ + public function __construct($exceptions = false) { + $this->exceptions = ($exceptions == true); + } + + /** + * Sets message type to HTML. + * @param bool $ishtml + * @return void + */ + public function IsHTML($ishtml = true) { + if ($ishtml) { + $this->ContentType = 'text/html'; + } else { + $this->ContentType = 'text/plain'; + } + } + + /** + * Sets Mailer to send message using SMTP. + * @return void + */ + public function IsSMTP() { + $this->Mailer = 'smtp'; + } + + /** + * Sets Mailer to send message using PHP mail() function. + * @return void + */ + public function IsMail() { + $this->Mailer = 'mail'; + } + + /** + * Sets Mailer to send message using the $Sendmail program. + * @return void + */ + public function IsSendmail() { + if (!stristr(ini_get('sendmail_path'), 'sendmail')) { + $this->Sendmail = '/var/qmail/bin/sendmail'; + } + $this->Mailer = 'sendmail'; + } + + /** + * Sets Mailer to send message using the qmail MTA. + * @return void + */ + public function IsQmail() { + if (stristr(ini_get('sendmail_path'), 'qmail')) { + $this->Sendmail = '/var/qmail/bin/sendmail'; + } + $this->Mailer = 'sendmail'; + } + + ///////////////////////////////////////////////// + // METHODS, RECIPIENTS + ///////////////////////////////////////////////// + + /** + * Adds a "To" address. + * @param string $address + * @param string $name + * @return boolean true on success, false if address already used + */ + public function AddAddress($address, $name = '') { + return $this->AddAnAddress('to', $address, $name); + } + + /** + * Adds a "Cc" address. + * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. + * @param string $address + * @param string $name + * @return boolean true on success, false if address already used + */ + public function AddCC($address, $name = '') { + return $this->AddAnAddress('cc', $address, $name); + } + + /** + * Adds a "Bcc" address. + * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. + * @param string $address + * @param string $name + * @return boolean true on success, false if address already used + */ + public function AddBCC($address, $name = '') { + return $this->AddAnAddress('bcc', $address, $name); + } + + /** + * Adds a "Reply-to" address. + * @param string $address + * @param string $name + * @return boolean + */ + public function AddReplyTo($address, $name = '') { + return $this->AddAnAddress('Reply-To', $address, $name); + } + + /** + * Adds an address to one of the recipient arrays + * Addresses that have been added already return false, but do not throw exceptions + * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo' + * @param string $address The email address to send to + * @param string $name + * @return boolean true on success, false if address already used or invalid in some way + * @access protected + */ + protected function AddAnAddress($kind, $address, $name = '') { + if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) { + $this->SetError($this->Lang('Invalid recipient array').': '.$kind); + if ($this->exceptions) { + throw new phpmailerException('Invalid recipient array: ' . $kind); + } + if ($this->SMTPDebug) { + echo $this->Lang('Invalid recipient array').': '.$kind; + } + return false; + } + $address = trim($address); + $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim + if (!self::ValidateAddress($address)) { + $this->SetError($this->Lang('invalid_address').': '. $address); + if ($this->exceptions) { + throw new phpmailerException($this->Lang('invalid_address').': '.$address); + } + if ($this->SMTPDebug) { + echo $this->Lang('invalid_address').': '.$address; + } + return false; + } + if ($kind != 'Reply-To') { + if (!isset($this->all_recipients[strtolower($address)])) { + array_push($this->$kind, array($address, $name)); + $this->all_recipients[strtolower($address)] = true; + return true; + } + } else { + if (!array_key_exists(strtolower($address), $this->ReplyTo)) { + $this->ReplyTo[strtolower($address)] = array($address, $name); + return true; + } + } + return false; +} - $this->SetMessageType(); - $header .= $this->CreateHeader(); - $body = $this->CreateBody(); +/** + * Set the From and FromName properties + * @param string $address + * @param string $name + * @return boolean + */ + public function SetFrom($address, $name = '', $auto = 1) { + $address = trim($address); + $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim + if (!self::ValidateAddress($address)) { + $this->SetError($this->Lang('invalid_address').': '. $address); + if ($this->exceptions) { + throw new phpmailerException($this->Lang('invalid_address').': '.$address); + } + if ($this->SMTPDebug) { + echo $this->Lang('invalid_address').': '.$address; + } + return false; + } + $this->From = $address; + $this->FromName = $name; + if ($auto) { + if (empty($this->ReplyTo)) { + $this->AddAnAddress('Reply-To', $address, $name); + } + if (empty($this->Sender)) { + $this->Sender = $address; + } + } + return true; + } + + /** + * Check that a string looks roughly like an email address should + * Static so it can be used without instantiation + * Tries to use PHP built-in validator in the filter extension (from PHP 5.2), falls back to a reasonably competent regex validator + * Conforms approximately to RFC2822 + * @link http://www.hexillion.com/samples/#Regex Original pattern found here + * @param string $address The email address to check + * @return boolean + * @static + * @access public + */ + public static function ValidateAddress($address) { + if (function_exists('filter_var')) { //Introduced in PHP 5.2 + if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) { + return false; + } else { + return true; + } + } else { + return preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address); + } + } + + ///////////////////////////////////////////////// + // METHODS, MAIL SENDING + ///////////////////////////////////////////////// + + /** + * Creates message and assigns Mailer. If the message is + * not sent successfully then it returns false. Use the ErrorInfo + * variable to view description of the error. + * @return bool + */ + public function Send() { + try { + if(!$this->PreSend()) return false; + return $this->PostSend(); + } catch (phpmailerException $e) { + $this->SentMIMEMessage = ''; + $this->SetError($e->getMessage()); + if ($this->exceptions) { + throw $e; + } + return false; + } + } - if($body == "") { return false; } + protected function PreSend() { + try { + $mailHeader = ""; + if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { + throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL); + } - // Choose the mailer - if($this->Mailer == "sendmail") - { - if(!$this->SendmailSend($header, $body)) - return false; - } - elseif($this->Mailer == "mail") - { - if(!$this->MailSend($header, $body)) - return false; - } - elseif($this->Mailer == "smtp") - { - if(!$this->SmtpSend($header, $body)) - return false; - } - else - { - $this->SetError($this->Mailer . $this->Lang("mailer_not_supported")); - return false; + // Set whether the message is multipart/alternative + if(!empty($this->AltBody)) { + $this->ContentType = 'multipart/alternative'; + } + + $this->error_count = 0; // reset errors + $this->SetMessageType(); + //Refuse to send an empty message + if (empty($this->Body)) { + throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL); + } + + $this->MIMEHeader = $this->CreateHeader(); + $this->MIMEBody = $this->CreateBody(); + + // To capture the complete message when using mail(), create + // an extra header list which CreateHeader() doesn't fold in + if ($this->Mailer == 'mail') { + if (count($this->to) > 0) { + $mailHeader .= $this->AddrAppend("To", $this->to); + } else { + $mailHeader .= $this->HeaderLine("To", "undisclosed-recipients:;"); } + $mailHeader .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader(trim($this->Subject)))); + // if(count($this->cc) > 0) { + // $mailHeader .= $this->AddrAppend("Cc", $this->cc); + // } + } - return true; + // digitally sign with DKIM if enabled + if ($this->DKIM_domain && $this->DKIM_private) { + $header_dkim = $this->DKIM_Add($this->MIMEHeader, $this->EncodeHeader($this->SecureHeader($this->Subject)), $this->MIMEBody); + $this->MIMEHeader = str_replace("\r\n", "\n", $header_dkim) . $this->MIMEHeader; + } + + $this->SentMIMEMessage = sprintf("%s%s\r\n\r\n%s",$this->MIMEHeader,$mailHeader,$this->MIMEBody); + return true; + + } catch (phpmailerException $e) { + $this->SetError($e->getMessage()); + if ($this->exceptions) { + throw $e; + } + return false; } - - /** - * Sends mail using the $Sendmail program. - * @access private - * @return bool - */ - function SendmailSend($header, $body) { - if ($this->Sender != "") - $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender); - else - $sendmail = sprintf("%s -oi -t", $this->Sendmail); - - if(!@$mail = popen($sendmail, "w")) - { - $this->SetError($this->Lang("execute") . $this->Sendmail); - return false; - } + } + + protected function PostSend() { + try { + // Choose the mailer and send through it + switch($this->Mailer) { + case 'sendmail': + return $this->SendmailSend($this->MIMEHeader, $this->MIMEBody); + case 'smtp': + return $this->SmtpSend($this->MIMEHeader, $this->MIMEBody); + case 'mail': + return $this->MailSend($this->MIMEHeader, $this->MIMEBody); + default: + return $this->MailSend($this->MIMEHeader, $this->MIMEBody); + } + } catch (phpmailerException $e) { + $this->SetError($e->getMessage()); + if ($this->exceptions) { + throw $e; + } + if ($this->SMTPDebug) { + echo $e->getMessage()."\n"; + } + return false; + } + } + + /** + * Sends mail using the $Sendmail program. + * @param string $header The message headers + * @param string $body The message body + * @access protected + * @return bool + */ + protected function SendmailSend($header, $body) { + if ($this->Sender != '') { + $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); + } else { + $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail)); + } + if ($this->SingleTo === true) { + foreach ($this->SingleToArray as $key => $val) { + if(!@$mail = popen($sendmail, 'w')) { + throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); + } + fputs($mail, "To: " . $val . "\n"); fputs($mail, $header); fputs($mail, $body); - - $result = pclose($mail) >> 8 & 0xFF; - if($result != 0) - { - $this->SetError($this->Lang("execute") . $this->Sendmail); - return false; + $result = pclose($mail); + // implement call back function if it exists + $isSent = ($result == 0) ? 1 : 0; + $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body); + if($result != 0) { + throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } - - return true; + } + } else { + if(!@$mail = popen($sendmail, 'w')) { + throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); + } + fputs($mail, $header); + fputs($mail, $body); + $result = pclose($mail); + // implement call back function if it exists + $isSent = ($result == 0) ? 1 : 0; + $this->doCallback($isSent, $this->to, $this->cc, $this->bcc, $this->Subject, $body); + if($result != 0) { + throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); + } } + return true; + } + + /** + * Sends mail using the PHP mail() function. + * @param string $header The message headers + * @param string $body The message body + * @access protected + * @return bool + */ + protected function MailSend($header, $body) { + $toArr = array(); + foreach($this->to as $t) { + $toArr[] = $this->AddrFormat($t); + } + $to = implode(', ', $toArr); - /** - * Sends mail using the PHP mail() function. - * @access private - * @return bool - */ - function MailSend($header, $body) { - // Cannot add Bcc's to the $to - $to = $this->to[0][0]; // no extra comma - for($i = 1; $i < count($this->to); $i++) - $to .= sprintf(",%s", $this->to[$i][0]); - - if ($this->Sender != "" && PHP_VERSION >= "4.0") - { - $old_from = ini_get("sendmail_from"); - ini_set("sendmail_from", $this->Sender); + if (empty($this->Sender)) { + $params = "-oi "; + } else { + $params = sprintf("-oi -f %s", $this->Sender); + } + if ($this->Sender != '' and !ini_get('safe_mode')) { + $old_from = ini_get('sendmail_from'); + ini_set('sendmail_from', $this->Sender); + if ($this->SingleTo === true && count($toArr) > 1) { + foreach ($toArr as $key => $val) { + $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); + // implement call back function if it exists + $isSent = ($rt == 1) ? 1 : 0; + $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body); } - - if ($this->Sender != "" && PHP_VERSION >= "4.0.5") - { - $params = sprintf("-oi -f %s", $this->Sender); - $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header, $params); + } else { + $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); + // implement call back function if it exists + $isSent = ($rt == 1) ? 1 : 0; + $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body); + } + } else { + if ($this->SingleTo === true && count($toArr) > 1) { + foreach ($toArr as $key => $val) { + $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); + // implement call back function if it exists + $isSent = ($rt == 1) ? 1 : 0; + $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body); } - else - $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header); + } else { + $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); + // implement call back function if it exists + $isSent = ($rt == 1) ? 1 : 0; + $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body); + } + } + if (isset($old_from)) { + ini_set('sendmail_from', $old_from); + } + if(!$rt) { + throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL); + } + return true; + } + + /** + * Sends mail via SMTP using PhpSMTP + * Returns false if there is a bad MAIL FROM, RCPT, or DATA input. + * @param string $header The message headers + * @param string $body The message body + * @uses SMTP + * @access protected + * @return bool + */ + protected function SmtpSend($header, $body) { + require_once $this->PluginDir . 'class.smtp.php'; + $bad_rcpt = array(); + + if(!$this->SmtpConnect()) { + throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL); + } + $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender; + if(!$this->smtp->Mail($smtp_from)) { + throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL); + } - if (isset($old_from)) - ini_set("sendmail_from", $old_from); + // Attempt to send attach all recipients + foreach($this->to as $to) { + if (!$this->smtp->Recipient($to[0])) { + $bad_rcpt[] = $to[0]; + // implement call back function if it exists + $isSent = 0; + $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body); + } else { + // implement call back function if it exists + $isSent = 1; + $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body); + } + } + foreach($this->cc as $cc) { + if (!$this->smtp->Recipient($cc[0])) { + $bad_rcpt[] = $cc[0]; + // implement call back function if it exists + $isSent = 0; + $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body); + } else { + // implement call back function if it exists + $isSent = 1; + $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body); + } + } + foreach($this->bcc as $bcc) { + if (!$this->smtp->Recipient($bcc[0])) { + $bad_rcpt[] = $bcc[0]; + // implement call back function if it exists + $isSent = 0; + $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body); + } else { + // implement call back function if it exists + $isSent = 1; + $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body); + } + } - if(!$rt) - { - $this->SetError($this->Lang("instantiate")); - return false; - } - return true; + if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses + $badaddresses = implode(', ', $bad_rcpt); + throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses); + } + if(!$this->smtp->Data($header . $body)) { + throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL); + } + if($this->SMTPKeepAlive == true) { + $this->smtp->Reset(); + } + return true; + } + + /** + * Initiates a connection to an SMTP server. + * Returns false if the operation failed. + * @uses SMTP + * @access public + * @return bool + */ + public function SmtpConnect() { + if(is_null($this->smtp)) { + $this->smtp = new SMTP(); } - /** - * Sends mail via SMTP using PhpSMTP (Author: - * Chris Ryan). Returns bool. Returns false if there is a - * bad MAIL FROM, RCPT, or DATA input. - * @access private - * @return bool - */ - function SmtpSend($header, $body) { - // Include SMTP class code, but not twice - include_once($this->PluginDir . "class.smtp.php"); - $error = ""; - $bad_rcpt = array(); - - if($this->smtp == NULL) - { - if(!$this->SmtpConnect()) - return false; + $this->smtp->do_debug = $this->SMTPDebug; + $hosts = explode(';', $this->Host); + $index = 0; + $connection = $this->smtp->Connected(); + + // Retry while there is no connection + try { + while($index < count($hosts) && !$connection) { + $hostinfo = array(); + if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) { + $host = $hostinfo[1]; + $port = $hostinfo[2]; + } else { + $host = $hosts[$index]; + $port = $this->Port; } - // Must perform HELO before authentication - if ($this->Helo != '') - $this->smtp->Hello($this->Helo); - else - $this->smtp->Hello($this->ServerHostname()); - - // If user requests SMTP authentication - if($this->SMTPAuth) - { - if(!$this->smtp->Authenticate($this->Username, $this->Password)) - { - $this->SetError($this->Lang("authenticate")); - $this->smtp->Reset(); - return false; - } - } + $tls = ($this->SMTPSecure == 'tls'); + $ssl = ($this->SMTPSecure == 'ssl'); - $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender; - if(!$this->smtp->Mail($smtp_from)) - { - $error = $this->Lang("from_failed") . $smtp_from; - $this->SetError($error); - $this->smtp->Reset(); - return false; - } + if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) { - // Attempt to send attach all recipients - for($i = 0; $i < count($this->to); $i++) - { - if(!$this->smtp->Recipient($this->to[$i][0])) - $bad_rcpt[] = $this->to[$i][0]; - } - for($i = 0; $i < count($this->cc); $i++) - { - if(!$this->smtp->Recipient($this->cc[$i][0])) - $bad_rcpt[] = $this->cc[$i][0]; - } - for($i = 0; $i < count($this->bcc); $i++) - { - if(!$this->smtp->Recipient($this->bcc[$i][0])) - $bad_rcpt[] = $this->bcc[$i][0]; - } + $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname()); + $this->smtp->Hello($hello); - // Create error message - if(count($bad_rcpt) > 0) - { - for($i = 0; $i < count($bad_rcpt); $i++) - { - if($i != 0) { $error .= ", "; } - $error .= $bad_rcpt[$i]; + if ($tls) { + if (!$this->smtp->StartTLS()) { + throw new phpmailerException($this->Lang('tls')); } - $error = $this->Lang("recipients_failed") . $error; - $this->SetError($error); - $this->smtp->Reset(); - return false; - } - if(!$this->smtp->Data($header . $body)) - { - $this->SetError($this->Lang("data_not_accepted")); - $this->smtp->Reset(); - return false; - } - if($this->SMTPKeepAlive == true) - $this->smtp->Reset(); - else - $this->SmtpClose(); + //We must resend HELO after tls negotiation + $this->smtp->Hello($hello); + } - return true; + $connection = true; + if ($this->SMTPAuth) { + if (!$this->smtp->Authenticate($this->Username, $this->Password)) { + throw new phpmailerException($this->Lang('authenticate')); + } + } + } + $index++; + if (!$connection) { + throw new phpmailerException($this->Lang('connect_host')); + } + } + } catch (phpmailerException $e) { + $this->smtp->Reset(); + if ($this->exceptions) { + throw $e; + } + } + return true; + } + + /** + * Closes the active SMTP session if one exists. + * @return void + */ + public function SmtpClose() { + if(!is_null($this->smtp)) { + if($this->smtp->Connected()) { + $this->smtp->Quit(); + $this->smtp->Close(); + } + } + } + + /** + * Sets the language for all class error messages. + * Returns false if it cannot load the language file. The default language is English. + * @param string $langcode ISO 639-1 2-character language code (e.g. Portuguese: "br") + * @param string $lang_path Path to the language file directory + * @access public + */ + function SetLanguage($langcode = 'en', $lang_path = 'language/') { + //Define full set of translatable strings + $PHPMAILER_LANG = array( + 'provide_address' => 'You must provide at least one recipient email address.', + 'mailer_not_supported' => ' mailer is not supported.', + 'execute' => 'Could not execute: ', + 'instantiate' => 'Could not instantiate mail function.', + 'authenticate' => 'SMTP Error: Could not authenticate.', + 'from_failed' => 'The following From address failed: ', + 'recipients_failed' => 'SMTP Error: The following recipients failed: ', + 'data_not_accepted' => 'SMTP Error: Data not accepted.', + 'connect_host' => 'SMTP Error: Could not connect to SMTP host.', + 'file_access' => 'Could not access file: ', + 'file_open' => 'File Error: Could not open file: ', + 'encoding' => 'Unknown encoding: ', + 'signing' => 'Signing Error: ', + 'smtp_error' => 'SMTP server error: ', + 'empty_message' => 'Message body empty', + 'invalid_address' => 'Invalid address', + 'variable_set' => 'Cannot set or reset variable: ' + ); + //Overwrite language-specific strings. This way we'll never have missing translations - no more "language string failed to load"! + $l = true; + if ($langcode != 'en') { //There is no English translation file + $l = @include $lang_path.'phpmailer.lang-'.$langcode.'.php'; + } + $this->language = $PHPMAILER_LANG; + return ($l == true); //Returns false if language not found + } + + /** + * Return the current array of language strings + * @return array + */ + public function GetTranslations() { + return $this->language; + } + + ///////////////////////////////////////////////// + // METHODS, MESSAGE CREATION + ///////////////////////////////////////////////// + + /** + * Creates recipient headers. + * @access public + * @return string + */ + public function AddrAppend($type, $addr) { + $addr_str = $type . ': '; + $addresses = array(); + foreach ($addr as $a) { + $addresses[] = $this->AddrFormat($a); + } + $addr_str .= implode(', ', $addresses); + $addr_str .= $this->LE; + + return $addr_str; + } + + /** + * Formats an address correctly. + * @access public + * @return string + */ + public function AddrFormat($addr) { + if (empty($addr[1])) { + return $this->SecureHeader($addr[0]); + } else { + return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">"; + } + } + + /** + * Wraps message for use with mailers that do not + * automatically perform wrapping and for quoted-printable. + * Original written by philippe. + * @param string $message The message to wrap + * @param integer $length The line length to wrap to + * @param boolean $qp_mode Whether to run in Quoted-Printable mode + * @access public + * @return string + */ + public function WrapText($message, $length, $qp_mode = false) { + $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; + // If utf-8 encoding is used, we will need to make sure we don't + // split multibyte characters when we wrap + $is_utf8 = (strtolower($this->CharSet) == "utf-8"); + + $message = $this->FixEOL($message); + if (substr($message, -1) == $this->LE) { + $message = substr($message, 0, -1); } - /** - * Initiates a connection to an SMTP server. Returns false if the - * operation failed. - * @access private - * @return bool - */ - function SmtpConnect() { - if($this->smtp == NULL) { $this->smtp = new SMTP(); } - - $this->smtp->do_debug = $this->SMTPDebug; - $hosts = explode(";", $this->Host); - $index = 0; - $connection = ($this->smtp->Connected()); - - // Retry while there is no connection - while($index < count($hosts) && $connection == false) - { - if(strstr($hosts[$index], ":")) - list($host, $port) = explode(":", $hosts[$index]); - else - { - $host = $hosts[$index]; - $port = $this->Port; + $line = explode($this->LE, $message); + $message = ''; + for ($i = 0 ;$i < count($line); $i++) { + $line_part = explode(' ', $line[$i]); + $buf = ''; + for ($e = 0; $e $length)) { + $space_left = $length - strlen($buf) - 1; + if ($e != 0) { + if ($space_left > 20) { + $len = $space_left; + if ($is_utf8) { + $len = $this->UTF8CharBoundary($word, $len); + } elseif (substr($word, $len - 1, 1) == "=") { + $len--; + } elseif (substr($word, $len - 2, 1) == "=") { + $len -= 2; + } + $part = substr($word, 0, $len); + $word = substr($word, $len); + $buf .= ' ' . $part; + $message .= $buf . sprintf("=%s", $this->LE); + } else { + $message .= $buf . $soft_break; + } + $buf = ''; + } + while (strlen($word) > 0) { + $len = $length; + if ($is_utf8) { + $len = $this->UTF8CharBoundary($word, $len); + } elseif (substr($word, $len - 1, 1) == "=") { + $len--; + } elseif (substr($word, $len - 2, 1) == "=") { + $len -= 2; } + $part = substr($word, 0, $len); + $word = substr($word, $len); - if($this->smtp->Connect($host, $port, $this->Timeout)) - $connection = true; - $index++; - } - if(!$connection) - $this->SetError($this->Lang("connect_host")); - - return $connection; - } - - /** - * Closes the active SMTP session if one exists. - * @return void - */ - function SmtpClose() { - if($this->smtp != NULL) - { - if($this->smtp->Connected()) - { - $this->smtp->Quit(); - $this->smtp->Close(); + if (strlen($word) > 0) { + $message .= $part . sprintf("=%s", $this->LE); + } else { + $buf = $part; } + } + } else { + $buf_o = $buf; + $buf .= ($e == 0) ? $word : (' ' . $word); + + if (strlen($buf) > $length and $buf_o != '') { + $message .= $buf_o . $soft_break; + $buf = $word; + } } + } + $message .= $buf . $this->LE; } - /** - * Sets the language for all class error messages. Returns false - * if it cannot load the language file. The default language type - * is English. - * @param string $lang_type Type of language (e.g. Portuguese: "br") - * @param string $lang_path Path to the language file directory - * @access public - * @return bool - */ - function SetLanguage($lang_type, $lang_path = "") { - if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) - include($lang_path.'phpmailer.lang-'.$lang_type.'.php'); - else if(file_exists($lang_path.'phpmailer.lang-en.php')) - include($lang_path.'phpmailer.lang-en.php'); - else - { - $this->SetError("Could not load language file"); - return false; + return $message; + } + + /** + * Finds last character boundary prior to maxLength in a utf-8 + * quoted (printable) encoded string. + * Original written by Colin Brown. + * @access public + * @param string $encodedText utf-8 QP text + * @param int $maxLength find last character boundary prior to this length + * @return int + */ + public function UTF8CharBoundary($encodedText, $maxLength) { + $foundSplitPos = false; + $lookBack = 3; + while (!$foundSplitPos) { + $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack); + $encodedCharPos = strpos($lastChunk, "="); + if ($encodedCharPos !== false) { + // Found start of encoded character byte within $lookBack block. + // Check the encoded byte value (the 2 chars after the '=') + $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2); + $dec = hexdec($hex); + if ($dec < 128) { // Single byte character. + // If the encoded char was found at pos 0, it will fit + // otherwise reduce maxLength to start of the encoded char + $maxLength = ($encodedCharPos == 0) ? $maxLength : + $maxLength - ($lookBack - $encodedCharPos); + $foundSplitPos = true; + } elseif ($dec >= 192) { // First byte of a multi byte character + // Reduce maxLength to split at start of character + $maxLength = $maxLength - ($lookBack - $encodedCharPos); + $foundSplitPos = true; + } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back + $lookBack += 3; } - $this->language = $PHPMAILER_LANG; - - return true; + } else { + // No encoded character found + $foundSplitPos = true; + } + } + return $maxLength; + } + + + /** + * Set the body wrapping. + * @access public + * @return void + */ + public function SetWordWrap() { + if($this->WordWrap < 1) { + return; + } + + switch($this->message_type) { + case 'alt': + case 'alt_inline': + case 'alt_attach': + case 'alt_inline_attach': + $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap); + break; + default: + $this->Body = $this->WrapText($this->Body, $this->WordWrap); + break; + } + } + + /** + * Assembles message header. + * @access public + * @return string The assembled header + */ + public function CreateHeader() { + $result = ''; + + // Set the boundaries + $uniq_id = md5(uniqid(time())); + $this->boundary[1] = 'b1_' . $uniq_id; + $this->boundary[2] = 'b2_' . $uniq_id; + $this->boundary[3] = 'b3_' . $uniq_id; + + $result .= $this->HeaderLine('Date', self::RFCDate()); + if($this->Sender == '') { + $result .= $this->HeaderLine('Return-Path', trim($this->From)); + } else { + $result .= $this->HeaderLine('Return-Path', trim($this->Sender)); } - ///////////////////////////////////////////////// - // MESSAGE CREATION METHODS - ///////////////////////////////////////////////// - - /** - * Creates recipient headers. - * @access private - * @return string - */ - function AddrAppend($type, $addr) { - $addr_str = $type . ": "; - $addr_str .= $this->AddrFormat($addr[0]); - if(count($addr) > 1) - { - for($i = 1; $i < count($addr); $i++) - $addr_str .= sprintf(", %s", $this->AddrFormat($addr[$i])); - $addr_str .= $this->LE; + // To be created automatically by mail() + if($this->Mailer != 'mail') { + if ($this->SingleTo === true) { + foreach($this->to as $t) { + $this->SingleToArray[] = $this->AddrFormat($t); } - else - $addr_str .= $this->LE; - - return $addr_str; - } - - /** - * Formats an address correctly. - * @access private - * @return string - */ - function AddrFormat($addr) { - if(empty($addr[1])) - $formatted = $addr[0]; - else - $formatted = sprintf('%s <%s>', $this->EncodeHeader($addr[1], 'phrase'), $addr[0]); - - return $formatted; - } - - /** - * Wraps message for use with mailers that do not - * automatically perform wrapping and for quoted-printable. - * Original written by philippe. - * @access private - * @return string - */ - function WrapText($message, $length, $qp_mode = false) { - $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; - - $message = $this->FixEOL($message); - if (substr($message, -1) == $this->LE) - $message = substr($message, 0, -1); - - $line = explode($this->LE, $message); - $message = ""; - for ($i=0 ;$i < count($line); $i++) - { - $line_part = explode(" ", $line[$i]); - $buf = ""; - for ($e = 0; $e $length)) - { - $space_left = $length - strlen($buf) - 1; - if ($e != 0) - { - if ($space_left > 20) - { - $len = $space_left; - if (substr($word, $len - 1, 1) == "=") - $len--; - elseif (substr($word, $len - 2, 1) == "=") - $len -= 2; - $part = substr($word, 0, $len); - $word = substr($word, $len); - $buf .= " " . $part; - $message .= $buf . sprintf("=%s", $this->LE); - } - else - { - $message .= $buf . $soft_break; - } - $buf = ""; - } - while (strlen($word) > 0) - { - $len = $length; - if (substr($word, $len - 1, 1) == "=") - $len--; - elseif (substr($word, $len - 2, 1) == "=") - $len -= 2; - $part = substr($word, 0, $len); - $word = substr($word, $len); - - if (strlen($word) > 0) - $message .= $part . sprintf("=%s", $this->LE); - else - $buf = $part; - } - } - else - { - $buf_o = $buf; - $buf .= ($e == 0) ? $word : (" " . $word); - - if (strlen($buf) > $length and $buf_o != "") - { - $message .= $buf_o . $soft_break; - $buf = $word; - } - } - } - $message .= $buf . $this->LE; + } else { + if(count($this->to) > 0) { + $result .= $this->AddrAppend('To', $this->to); + } elseif (count($this->cc) == 0) { + $result .= $this->HeaderLine('To', 'undisclosed-recipients:;'); } + } + } - return $message; - } - - /** - * Set the body wrapping. - * @access private - * @return void - */ - function SetWordWrap() { - if($this->WordWrap < 1) - return; - - switch($this->message_type) - { - case "alt": - // fall through - case "alt_attachment": - $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap); - break; - default: - $this->Body = $this->WrapText($this->Body, $this->WordWrap); - break; - } + $from = array(); + $from[0][0] = trim($this->From); + $from[0][1] = $this->FromName; + $result .= $this->AddrAppend('From', $from); + + // sendmail and mail() extract Cc from the header before sending + if(count($this->cc) > 0) { + $result .= $this->AddrAppend('Cc', $this->cc); } - /** - * Assembles message header. - * @access private - * @return string - */ - function CreateHeader() { - $result = ""; - - // Set the boundaries - $uniq_id = md5(uniqid(time())); - $this->boundary[1] = "b1_" . $uniq_id; - $this->boundary[2] = "b2_" . $uniq_id; - - $result .= $this->Received(); - $result .= $this->HeaderLine("Date", $this->RFCDate()); - if($this->Sender == "") - $result .= $this->HeaderLine("Return-Path", trim($this->From)); - else - $result .= $this->HeaderLine("Return-Path", trim($this->Sender)); - - // To be created automatically by mail() - if($this->Mailer != "mail") - { - if(count($this->to) > 0) - $result .= $this->AddrAppend("To", $this->to); - else if (count($this->cc) == 0) - $result .= $this->HeaderLine("To", "undisclosed-recipients:;"); - } + // sendmail and mail() extract Bcc from the header before sending + if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) { + $result .= $this->AddrAppend('Bcc', $this->bcc); + } - $from = array(); - $from[0][0] = trim($this->From); - $from[0][1] = $this->FromName; - $result .= $this->AddrAppend("From", $from); - - if(count($this->cc) > 0) - $result .= $this->AddrAppend("Cc", $this->cc); - - // sendmail and mail() extract Bcc from the header before sending - if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0)) - $result .= $this->AddrAppend("Bcc", $this->bcc); - - if(count($this->ReplyTo) > 0) - $result .= $this->AddrAppend("Reply-to", $this->ReplyTo); - - // mail() sets the subject itself - if($this->Mailer != "mail") - $result .= $this->HeaderLine("Subject", $this->EncodeHeader(trim($this->Subject))); - - $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); - $result .= $this->HeaderLine("X-Priority", $this->Priority); - $result .= $this->HeaderLine("X-Mailer", "PHPMailer [version " . $this->Version . "]"); - - if($this->ConfirmReadingTo != "") - { - $result .= $this->HeaderLine("Disposition-Notification-To", - "<" . trim($this->ConfirmReadingTo) . ">"); - } + if(count($this->ReplyTo) > 0) { + $result .= $this->AddrAppend('Reply-To', $this->ReplyTo); + } - // Add custom headers - for($index = 0; $index < count($this->CustomHeader); $index++) - { - $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), - $this->EncodeHeader(trim($this->CustomHeader[$index][1]))); - } - $result .= $this->HeaderLine("MIME-Version", "1.0"); - - switch($this->message_type) - { - case "plain": - $result .= $this->HeaderLine("Content-Transfer-Encoding", $this->Encoding); - $result .= sprintf("Content-Type: %s; charset=\"%s\"", - $this->ContentType, $this->CharSet); - break; - case "attachments": - // fall through - case "alt_attachments": - if($this->EmbeddedImageCount() > 0) - { - $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", - "multipart/related", $this->LE, $this->LE, - $this->boundary[1], $this->LE); - } - else - { - $result .= $this->HeaderLine("Content-Type", "multipart/mixed;"); - $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); - } - break; - case "alt": - $result .= $this->HeaderLine("Content-Type", "multipart/alternative;"); - $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - } + // mail() sets the subject itself + if($this->Mailer != 'mail') { + $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject))); + } - if($this->Mailer != "mail") - $result .= $this->LE.$this->LE; - - return $result; - } - - /** - * Assembles the message body. Returns an empty string on failure. - * @access private - * @return string - */ - function CreateBody() { - $result = ""; - - $this->SetWordWrap(); - - switch($this->message_type) - { - case "alt": - $result .= $this->GetBoundary($this->boundary[1], "", - "text/plain", ""); - $result .= $this->EncodeString($this->AltBody, $this->Encoding); - $result .= $this->LE.$this->LE; - $result .= $this->GetBoundary($this->boundary[1], "", - "text/html", ""); - - $result .= $this->EncodeString($this->Body, $this->Encoding); - $result .= $this->LE.$this->LE; - - $result .= $this->EndBoundary($this->boundary[1]); - break; - case "plain": - $result .= $this->EncodeString($this->Body, $this->Encoding); - break; - case "attachments": - $result .= $this->GetBoundary($this->boundary[1], "", "", ""); - $result .= $this->EncodeString($this->Body, $this->Encoding); - $result .= $this->LE; - - $result .= $this->AttachAll(); - break; - case "alt_attachments": - $result .= sprintf("--%s%s", $this->boundary[1], $this->LE); - $result .= sprintf("Content-Type: %s;%s" . - "\tboundary=\"%s\"%s", - "multipart/alternative", $this->LE, - $this->boundary[2], $this->LE.$this->LE); - - // Create text body - $result .= $this->GetBoundary($this->boundary[2], "", - "text/plain", "") . $this->LE; - - $result .= $this->EncodeString($this->AltBody, $this->Encoding); - $result .= $this->LE.$this->LE; - - // Create the HTML body - $result .= $this->GetBoundary($this->boundary[2], "", - "text/html", "") . $this->LE; - - $result .= $this->EncodeString($this->Body, $this->Encoding); - $result .= $this->LE.$this->LE; - - $result .= $this->EndBoundary($this->boundary[2]); - - $result .= $this->AttachAll(); - break; - } - if($this->IsError()) - $result = ""; - - return $result; - } - - /** - * Returns the start of a message boundary. - * @access private - */ - function GetBoundary($boundary, $charSet, $contentType, $encoding) { - $result = ""; - if($charSet == "") { $charSet = $this->CharSet; } - if($contentType == "") { $contentType = $this->ContentType; } - if($encoding == "") { $encoding = $this->Encoding; } - - $result .= $this->TextLine("--" . $boundary); - $result .= sprintf("Content-Type: %s; charset = \"%s\"", - $contentType, $charSet); - $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding); - $result .= $this->LE; - - return $result; - } - - /** - * Returns the end of a message boundary. - * @access private - */ - function EndBoundary($boundary) { - return $this->LE . "--" . $boundary . "--" . $this->LE; - } - - /** - * Sets the message type. - * @access private - * @return void - */ - function SetMessageType() { - if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) - $this->message_type = "plain"; - else - { - if(count($this->attachment) > 0) - $this->message_type = "attachments"; - if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) - $this->message_type = "alt"; - if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) - $this->message_type = "alt_attachments"; - } + if($this->MessageID != '') { + $result .= $this->HeaderLine('Message-ID', $this->MessageID); + } else { + $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); + } + $result .= $this->HeaderLine('X-Priority', $this->Priority); + if($this->XMailer) { + $result .= $this->HeaderLine('X-Mailer', $this->XMailer); + } else { + $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (http://code.google.com/a/apache-extras.org/p/phpmailer/)'); } - /** - * Returns a formatted header line. - * @access private - * @return string - */ - function HeaderLine($name, $value) { - return $name . ": " . $value . $this->LE; - } - - /** - * Returns a formatted mail line. - * @access private - * @return string - */ - function TextLine($value) { - return $value . $this->LE; - } - - ///////////////////////////////////////////////// - // ATTACHMENT METHODS - ///////////////////////////////////////////////// - - /** - * Adds an attachment from a path on the filesystem. - * Returns false if the file could not be found - * or accessed. - * @param string $path Path to the attachment. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension type. - * @return bool - */ - function AddAttachment($path, $name = "", $encoding = "base64", - $type = "application/octet-stream") { - if(!@is_file($path)) - { - $this->SetError($this->Lang("file_access") . $path); - return false; - } + if($this->ConfirmReadingTo != '') { + $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>'); + } - $filename = basename($path); - if($name == "") - $name = $filename; - - // Append to $attachment array - $cur = count($this->attachment); - $this->attachment[$cur][0] = $path; - $this->attachment[$cur][1] = $filename; - $this->attachment[$cur][2] = $name; - $this->attachment[$cur][3] = $encoding; - $this->attachment[$cur][4] = $type; - $this->attachment[$cur][5] = false; // isStringAttachment - $this->attachment[$cur][6] = "attachment"; - $this->attachment[$cur][7] = 0; + // Add custom headers + for($index = 0; $index < count($this->CustomHeader); $index++) { + $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1]))); + } + if (!$this->sign_key_file) { + $result .= $this->HeaderLine('MIME-Version', '1.0'); + $result .= $this->GetMailMIME(); + } - return true; + return $result; + } + + /** + * Returns the message MIME. + * @access public + * @return string + */ + public function GetMailMIME() { + $result = ''; + switch($this->message_type) { + case 'plain': + $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding); + $result .= $this->TextLine('Content-Type: '.$this->ContentType.'; charset="'.$this->CharSet.'"'); + break; + case 'inline': + $result .= $this->HeaderLine('Content-Type', 'multipart/related;'); + $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); + break; + case 'attach': + case 'inline_attach': + case 'alt_attach': + case 'alt_inline_attach': + $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;'); + $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); + break; + case 'alt': + case 'alt_inline': + $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;'); + $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); + break; } - /** - * Attaches all fs, string, and binary attachments to the message. - * Returns an empty string on failure. - * @access private - * @return string - */ - function AttachAll() { - // Return text of body - $mime = array(); - - // Add all attachments - for($i = 0; $i < count($this->attachment); $i++) - { - // Check for string attachment - $bString = $this->attachment[$i][5]; - if ($bString) - $string = $this->attachment[$i][0]; - else - $path = $this->attachment[$i][0]; - - $filename = $this->attachment[$i][1]; - $name = $this->attachment[$i][2]; - $encoding = $this->attachment[$i][3]; - $type = $this->attachment[$i][4]; - $disposition = $this->attachment[$i][6]; - $cid = $this->attachment[$i][7]; - - $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE); - $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE); - $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE); - - if($disposition == "inline") - $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); - - $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", - $disposition, $name, $this->LE.$this->LE); - - // Encode as string attachment - if($bString) - { - $mime[] = $this->EncodeString($string, $encoding); - if($this->IsError()) { return ""; } - $mime[] = $this->LE.$this->LE; - } - else - { - $mime[] = $this->EncodeFile($path, $encoding); - if($this->IsError()) { return ""; } - $mime[] = $this->LE.$this->LE; - } + if($this->Mailer != 'mail') { + $result .= $this->LE.$this->LE; + } + + return $result; + } + + /** + * Returns the MIME message (headers and body). Only really valid post PreSend(). + * @access public + * @return string + */ + public function GetSentMIMEMessage() { + return $this->SentMIMEMessage; + } + + + /** + * Assembles the message body. Returns an empty string on failure. + * @access public + * @return string The assembled message body + */ + public function CreateBody() { + $body = ''; + + if ($this->sign_key_file) { + $body .= $this->GetMailMIME(); + } + + $this->SetWordWrap(); + + switch($this->message_type) { + case 'plain': + $body .= $this->EncodeString($this->Body, $this->Encoding); + break; + case 'inline': + $body .= $this->GetBoundary($this->boundary[1], '', '', ''); + $body .= $this->EncodeString($this->Body, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->AttachAll("inline", $this->boundary[1]); + break; + case 'attach': + $body .= $this->GetBoundary($this->boundary[1], '', '', ''); + $body .= $this->EncodeString($this->Body, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->AttachAll("attachment", $this->boundary[1]); + break; + case 'inline_attach': + $body .= $this->TextLine("--" . $this->boundary[1]); + $body .= $this->HeaderLine('Content-Type', 'multipart/related;'); + $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"'); + $body .= $this->LE; + $body .= $this->GetBoundary($this->boundary[2], '', '', ''); + $body .= $this->EncodeString($this->Body, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->AttachAll("inline", $this->boundary[2]); + $body .= $this->LE; + $body .= $this->AttachAll("attachment", $this->boundary[1]); + break; + case 'alt': + $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', ''); + $body .= $this->EncodeString($this->AltBody, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->GetBoundary($this->boundary[1], '', 'text/html', ''); + $body .= $this->EncodeString($this->Body, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->EndBoundary($this->boundary[1]); + break; + case 'alt_inline': + $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', ''); + $body .= $this->EncodeString($this->AltBody, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->TextLine("--" . $this->boundary[1]); + $body .= $this->HeaderLine('Content-Type', 'multipart/related;'); + $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"'); + $body .= $this->LE; + $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', ''); + $body .= $this->EncodeString($this->Body, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->AttachAll("inline", $this->boundary[2]); + $body .= $this->LE; + $body .= $this->EndBoundary($this->boundary[1]); + break; + case 'alt_attach': + $body .= $this->TextLine("--" . $this->boundary[1]); + $body .= $this->HeaderLine('Content-Type', 'multipart/alternative;'); + $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"'); + $body .= $this->LE; + $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', ''); + $body .= $this->EncodeString($this->AltBody, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', ''); + $body .= $this->EncodeString($this->Body, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->EndBoundary($this->boundary[2]); + $body .= $this->LE; + $body .= $this->AttachAll("attachment", $this->boundary[1]); + break; + case 'alt_inline_attach': + $body .= $this->TextLine("--" . $this->boundary[1]); + $body .= $this->HeaderLine('Content-Type', 'multipart/alternative;'); + $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"'); + $body .= $this->LE; + $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', ''); + $body .= $this->EncodeString($this->AltBody, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->TextLine("--" . $this->boundary[2]); + $body .= $this->HeaderLine('Content-Type', 'multipart/related;'); + $body .= $this->TextLine("\tboundary=\"" . $this->boundary[3] . '"'); + $body .= $this->LE; + $body .= $this->GetBoundary($this->boundary[3], '', 'text/html', ''); + $body .= $this->EncodeString($this->Body, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->AttachAll("inline", $this->boundary[3]); + $body .= $this->LE; + $body .= $this->EndBoundary($this->boundary[2]); + $body .= $this->LE; + $body .= $this->AttachAll("attachment", $this->boundary[1]); + break; + } + + if ($this->IsError()) { + $body = ''; + } elseif ($this->sign_key_file) { + try { + $file = tempnam('', 'mail'); + file_put_contents($file, $body); //TODO check this worked + $signed = tempnam("", "signed"); + if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), NULL)) { + @unlink($file); + $body = file_get_contents($signed); + @unlink($signed); + } else { + @unlink($file); + @unlink($signed); + throw new phpmailerException($this->Lang("signing").openssl_error_string()); + } + } catch (phpmailerException $e) { + $body = ''; + if ($this->exceptions) { + throw $e; } + } + } - $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE); - - return join("", $mime); - } - - /** - * Encodes attachment in requested format. Returns an - * empty string on failure. - * @access private - * @return string - */ - function EncodeFile ($path, $encoding = "base64") { - if(!@$fd = fopen($path, "rb")) - { - $this->SetError($this->Lang("file_open") . $path); - return ""; + return $body; + } + + /** + * Returns the start of a message boundary. + * @access protected + * @return string + */ + protected function GetBoundary($boundary, $charSet, $contentType, $encoding) { + $result = ''; + if($charSet == '') { + $charSet = $this->CharSet; + } + if($contentType == '') { + $contentType = $this->ContentType; + } + if($encoding == '') { + $encoding = $this->Encoding; + } + $result .= $this->TextLine('--' . $boundary); + $result .= sprintf("Content-Type: %s; charset=\"%s\"", $contentType, $charSet); + $result .= $this->LE; + $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding); + $result .= $this->LE; + + return $result; + } + + /** + * Returns the end of a message boundary. + * @access protected + * @return string + */ + protected function EndBoundary($boundary) { + return $this->LE . '--' . $boundary . '--' . $this->LE; + } + + /** + * Sets the message type. + * @access protected + * @return void + */ + protected function SetMessageType() { + $this->message_type = array(); + if($this->AlternativeExists()) $this->message_type[] = "alt"; + if($this->InlineImageExists()) $this->message_type[] = "inline"; + if($this->AttachmentExists()) $this->message_type[] = "attach"; + $this->message_type = implode("_", $this->message_type); + if($this->message_type == "") $this->message_type = "plain"; + } + + /** + * Returns a formatted header line. + * @access public + * @return string + */ + public function HeaderLine($name, $value) { + return $name . ': ' . $value . $this->LE; + } + + /** + * Returns a formatted mail line. + * @access public + * @return string + */ + public function TextLine($value) { + return $value . $this->LE; + } + + ///////////////////////////////////////////////// + // CLASS METHODS, ATTACHMENTS + ///////////////////////////////////////////////// + + /** + * Adds an attachment from a path on the filesystem. + * Returns false if the file could not be found + * or accessed. + * @param string $path Path to the attachment. + * @param string $name Overrides the attachment name. + * @param string $encoding File encoding (see $Encoding). + * @param string $type File extension (MIME) type. + * @return bool + */ + public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { + try { + if ( !@is_file($path) ) { + throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE); + } + $filename = basename($path); + if ( $name == '' ) { + $name = $filename; + } + + $this->attachment[] = array( + 0 => $path, + 1 => $filename, + 2 => $name, + 3 => $encoding, + 4 => $type, + 5 => false, // isStringAttachment + 6 => 'attachment', + 7 => 0 + ); + + } catch (phpmailerException $e) { + $this->SetError($e->getMessage()); + if ($this->exceptions) { + throw $e; + } + if ($this->SMTPDebug) { + echo $e->getMessage()."\n"; + } + if ( $e->getCode() == self::STOP_CRITICAL ) { + return false; + } + } + return true; + } + + /** + * Return the current array of attachments + * @return array + */ + public function GetAttachments() { + return $this->attachment; + } + + /** + * Attaches all fs, string, and binary attachments to the message. + * Returns an empty string on failure. + * @access protected + * @return string + */ + protected function AttachAll($disposition_type, $boundary) { + // Return text of body + $mime = array(); + $cidUniq = array(); + $incl = array(); + + // Add all attachments + foreach ($this->attachment as $attachment) { + // CHECK IF IT IS A VALID DISPOSITION_FILTER + if($attachment[6] == $disposition_type) { + // Check for string attachment + $bString = $attachment[5]; + if ($bString) { + $string = $attachment[0]; + } else { + $path = $attachment[0]; } - $file_buffer = fread($fd, filesize($path)); - $file_buffer = $this->EncodeString($file_buffer, $encoding); - fclose($fd); - - return $file_buffer; - } - - /** - * Encodes string to requested format. Returns an - * empty string on failure. - * @access private - * @return string - */ - function EncodeString ($str, $encoding = "base64") { - $encoded = ""; - switch(strtolower($encoding)) { - case "base64": - // chunk_split is found in PHP >= 3.0.6 - $encoded = chunk_split(base64_encode($str), 76, $this->LE); - break; - - case "7bit": - case "8bit": - $encoded = $this->FixEOL($str); - if (substr($encoded, -(strlen($this->LE))) != $this->LE) - $encoded .= $this->LE; - break; - - case "binary": - $encoded = $str; - break; - - case "quoted-printable": - $encoded = $this->EncodeQP($str); - break; - - default: - $this->SetError($this->Lang("encoding") . $encoding); - break; + + $inclhash = md5(serialize($attachment)); + if (in_array($inclhash, $incl)) { continue; } + $incl[] = $inclhash; + $filename = $attachment[1]; + $name = $attachment[2]; + $encoding = $attachment[3]; + $type = $attachment[4]; + $disposition = $attachment[6]; + $cid = $attachment[7]; + if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; } + $cidUniq[$cid] = true; + + $mime[] = sprintf("--%s%s", $boundary, $this->LE); + $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE); + $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE); + + if($disposition == 'inline') { + $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); } - return $encoded; - } - - /** - * Encode a header string to best of Q, B, quoted or none. - * @access private - * @return string - */ - function EncodeHeader ($str, $position = 'text') { - $x = 0; - - switch (strtolower($position)) { - case 'phrase': - if (!preg_match('/[\200-\377]/', $str)) { - // Can't use addslashes as we don't know what value has magic_quotes_sybase. - $encoded = addcslashes($str, "\0..\37\177\\\""); - - if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) - return ($encoded); - else - return ("\"$encoded\""); + + $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE); + + // Encode as string attachment + if($bString) { + $mime[] = $this->EncodeString($string, $encoding); + if($this->IsError()) { + return ''; } - $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); - break; - case 'comment': - $x = preg_match_all('/[()"]/', $str, $matches); - // Fall-through - case 'text': - default: - $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); - break; + $mime[] = $this->LE.$this->LE; + } else { + $mime[] = $this->EncodeFile($path, $encoding); + if($this->IsError()) { + return ''; + } + $mime[] = $this->LE.$this->LE; + } + } + } + + $mime[] = sprintf("--%s--%s", $boundary, $this->LE); + + return implode("", $mime); + } + + /** + * Encodes attachment in requested format. + * Returns an empty string on failure. + * @param string $path The full path to the file + * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' + * @see EncodeFile() + * @access protected + * @return string + */ + protected function EncodeFile($path, $encoding = 'base64') { + try { + if (!is_readable($path)) { + throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE); + } + if (function_exists('get_magic_quotes')) { + function get_magic_quotes() { + return false; + } } + $magic_quotes = get_magic_quotes_runtime(); + if ($magic_quotes) { + if (version_compare(PHP_VERSION, '5.3.0', '<')) { + set_magic_quotes_runtime(0); + } else { + ini_set('magic_quotes_runtime', 0); + } + } + $file_buffer = file_get_contents($path); + $file_buffer = $this->EncodeString($file_buffer, $encoding); + if ($magic_quotes) { + if (version_compare(PHP_VERSION, '5.3.0', '<')) { + set_magic_quotes_runtime($magic_quotes); + } else { + ini_set('magic_quotes_runtime', $magic_quotes); + } + } + return $file_buffer; + } catch (Exception $e) { + $this->SetError($e->getMessage()); + return ''; + } + } + + /** + * Encodes string to requested format. + * Returns an empty string on failure. + * @param string $str The text to encode + * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' + * @access public + * @return string + */ + public function EncodeString($str, $encoding = 'base64') { + $encoded = ''; + switch(strtolower($encoding)) { + case 'base64': + $encoded = chunk_split(base64_encode($str), 76, $this->LE); + break; + case '7bit': + case '8bit': + $encoded = $this->FixEOL($str); + //Make sure it ends with a line break + if (substr($encoded, -(strlen($this->LE))) != $this->LE) + $encoded .= $this->LE; + break; + case 'binary': + $encoded = $str; + break; + case 'quoted-printable': + $encoded = $this->EncodeQP($str); + break; + default: + $this->SetError($this->Lang('encoding') . $encoding); + break; + } + return $encoded; + } + + /** + * Encode a header string to best (shortest) of Q, B, quoted or none. + * @access public + * @return string + */ + public function EncodeHeader($str, $position = 'text') { + $x = 0; + + switch (strtolower($position)) { + case 'phrase': + if (!preg_match('/[\200-\377]/', $str)) { + // Can't use addslashes as we don't know what value has magic_quotes_sybase + $encoded = addcslashes($str, "\0..\37\177\\\""); + if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { + return ($encoded); + } else { + return ("\"$encoded\""); + } + } + $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); + break; + case 'comment': + $x = preg_match_all('/[()"]/', $str, $matches); + // Fall-through + case 'text': + default: + $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); + break; + } - if ($x == 0) - return ($str); + if ($x == 0) { + return ($str); + } - $maxlen = 75 - 7 - strlen($this->CharSet); - // Try to select the encoding which should produce the shortest output - if (strlen($str)/3 < $x) { - $encoding = 'B'; + $maxlen = 75 - 7 - strlen($this->CharSet); + // Try to select the encoding which should produce the shortest output + if (strlen($str)/3 < $x) { + $encoding = 'B'; + if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) { + // Use a custom function which correctly encodes and wraps long + // multibyte strings without breaking lines within a character + $encoded = $this->Base64EncodeWrapMB($str); + } else { $encoded = base64_encode($str); $maxlen -= $maxlen % 4; $encoded = trim(chunk_split($encoded, $maxlen, "\n")); - } else { - $encoding = 'Q'; - $encoded = $this->EncodeQ($str, $position); - $encoded = $this->WrapText($encoded, $maxlen, true); - $encoded = str_replace("=".$this->LE, "\n", trim($encoded)); } + } else { + $encoding = 'Q'; + $encoded = $this->EncodeQ($str, $position); + $encoded = $this->WrapText($encoded, $maxlen, true); + $encoded = str_replace('='.$this->LE, "\n", trim($encoded)); + } - $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded); - $encoded = trim(str_replace("\n", $this->LE, $encoded)); - - return $encoded; - } - - /** - * Encode string to quoted-printable. - * @access private - * @return string - */ - function EncodeQP ($str) { - $encoded = $this->FixEOL($str); - if (substr($encoded, -(strlen($this->LE))) != $this->LE) - $encoded .= $this->LE; - - // Replace every high ascii, control and = characters - $encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e', - "'='.sprintf('%02X', ord('\\1'))", $encoded); - // Replace every spaces and tabs when it's the last character on a line - $encoded = preg_replace("/([\011\040])".$this->LE."/e", - "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded); - - // Maximum line length of 76 characters before CRLF (74 + space + '=') - $encoded = $this->WrapText($encoded, 74, true); - - return $encoded; - } - - /** - * Encode string to q encoding. - * @access private - * @return string - */ - function EncodeQ ($str, $position = "text") { - // There should not be any EOL in the string - $encoded = preg_replace("[\r\n]", "", $str); - - switch (strtolower($position)) { - case "phrase": - $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); - break; - case "comment": - $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); - case "text": - default: - // Replace every high ascii, control =, ? and _ characters - $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e', - "'='.sprintf('%02X', ord('\\1'))", $encoded); - break; - } - - // Replace every spaces to _ (more readable than =20) - $encoded = str_replace(" ", "_", $encoded); - - return $encoded; - } - - /** - * Adds a string or binary attachment (non-filesystem) to the list. - * This method can be used to attach ascii or binary data, - * such as a BLOB record from a database. - * @param string $string String attachment data. - * @param string $filename Name of the attachment. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension type. - * @return void - */ - function AddStringAttachment($string, $filename, $encoding = "base64", - $type = "application/octet-stream") { - // Append to $attachment array - $cur = count($this->attachment); - $this->attachment[$cur][0] = $string; - $this->attachment[$cur][1] = $filename; - $this->attachment[$cur][2] = $filename; - $this->attachment[$cur][3] = $encoding; - $this->attachment[$cur][4] = $type; - $this->attachment[$cur][5] = true; // isString - $this->attachment[$cur][6] = "attachment"; - $this->attachment[$cur][7] = 0; - } - - /** - * Adds an embedded attachment. This can include images, sounds, and - * just about any other document. - * @param string $path Path to the attachment. - * @param string $cid Content ID of the attachment. Use this to identify - * the Id for accessing the image in an HTML form. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension type. - * @return bool - */ - function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", - $type = "application/octet-stream") { - - if(!@is_file($path)) - { - $this->SetError($this->Lang("file_access") . $path); - return false; - } + $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded); + $encoded = trim(str_replace("\n", $this->LE, $encoded)); + + return $encoded; + } + + /** + * Checks if a string contains multibyte characters. + * @access public + * @param string $str multi-byte text to wrap encode + * @return bool + */ + public function HasMultiBytes($str) { + if (function_exists('mb_strlen')) { + return (strlen($str) > mb_strlen($str, $this->CharSet)); + } else { // Assume no multibytes (we can't handle without mbstring functions anyway) + return false; + } + } + + /** + * Correctly encodes and wraps long multibyte strings for mail headers + * without breaking lines within a character. + * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php + * @access public + * @param string $str multi-byte text to wrap encode + * @return string + */ + public function Base64EncodeWrapMB($str) { + $start = "=?".$this->CharSet."?B?"; + $end = "?="; + $encoded = ""; + + $mb_length = mb_strlen($str, $this->CharSet); + // Each line must have length <= 75, including $start and $end + $length = 75 - strlen($start) - strlen($end); + // Average multi-byte ratio + $ratio = $mb_length / strlen($str); + // Base64 has a 4:3 ratio + $offset = $avgLength = floor($length * $ratio * .75); + + for ($i = 0; $i < $mb_length; $i += $offset) { + $lookBack = 0; + + do { + $offset = $avgLength - $lookBack; + $chunk = mb_substr($str, $i, $offset, $this->CharSet); + $chunk = base64_encode($chunk); + $lookBack++; + } + while (strlen($chunk) > $length); - $filename = basename($path); - if($name == "") - $name = $filename; - - // Append to $attachment array - $cur = count($this->attachment); - $this->attachment[$cur][0] = $path; - $this->attachment[$cur][1] = $filename; - $this->attachment[$cur][2] = $name; - $this->attachment[$cur][3] = $encoding; - $this->attachment[$cur][4] = $type; - $this->attachment[$cur][5] = false; // isStringAttachment - $this->attachment[$cur][6] = "inline"; - $this->attachment[$cur][7] = $cid; - - return true; + $encoded .= $chunk . $this->LE; } - - /** - * Returns the number of embedded images in an email. - * @access private - * @return int - */ - function EmbeddedImageCount() { - $result = 0; - for($i = 0; $i < count($this->attachment); $i++) - { - if($this->attachment[$i][6] == "inline") - $result++; + + // Chomp the last linefeed + $encoded = substr($encoded, 0, -strlen($this->LE)); + return $encoded; + } + + /** + * Encode string to quoted-printable. + * Only uses standard PHP, slow, but will always work + * @access public + * @param string $string the text to encode + * @param integer $line_max Number of chars allowed on a line before wrapping + * @return string + */ + public function EncodeQPphp( $input = '', $line_max = 76, $space_conv = false) { + $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'); + $lines = preg_split('/(?:\r\n|\r|\n)/', $input); + $eol = "\r\n"; + $escape = '='; + $output = ''; + while( list(, $line) = each($lines) ) { + $linlen = strlen($line); + $newline = ''; + for($i = 0; $i < $linlen; $i++) { + $c = substr( $line, $i, 1 ); + $dec = ord( $c ); + if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E + $c = '=2E'; } - - return $result; - } - - ///////////////////////////////////////////////// - // MESSAGE RESET METHODS - ///////////////////////////////////////////////// - - /** - * Clears all recipients assigned in the TO array. Returns void. - * @return void - */ - function ClearAddresses() { - $this->to = array(); - } - - /** - * Clears all recipients assigned in the CC array. Returns void. - * @return void - */ - function ClearCCs() { - $this->cc = array(); - } - - /** - * Clears all recipients assigned in the BCC array. Returns void. - * @return void - */ - function ClearBCCs() { - $this->bcc = array(); - } - - /** - * Clears all recipients assigned in the ReplyTo array. Returns void. - * @return void - */ - function ClearReplyTos() { - $this->ReplyTo = array(); - } - - /** - * Clears all recipients assigned in the TO, CC and BCC - * array. Returns void. - * @return void - */ - function ClearAllRecipients() { - $this->to = array(); - $this->cc = array(); - $this->bcc = array(); - } - - /** - * Clears all previously set filesystem, string, and binary - * attachments. Returns void. - * @return void - */ - function ClearAttachments() { - $this->attachment = array(); - } - - /** - * Clears all custom headers. Returns void. - * @return void - */ - function ClearCustomHeaders() { - $this->CustomHeader = array(); - } - - - ///////////////////////////////////////////////// - // MISCELLANEOUS METHODS - ///////////////////////////////////////////////// - - /** - * Adds the error message to the error container. - * Returns void. - * @access private - * @return void - */ - function SetError($msg) { - $this->error_count++; - $this->ErrorInfo = $msg; - } - - /** - * Returns the proper RFC 822 formatted date. Returns string. - * @access private - * @return string - */ - function RFCDate() { - $tz = date("Z"); - $tzs = ($tz < 0) ? "-" : "+"; - $tz = abs($tz); - $tz = ($tz/3600)*100 + ($tz%3600)/60; - $result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz); - - return $result; - } - - /** - * Returns Received header for message tracing. Returns string. - * @access private - * @return string - */ - function Received() { - if ($this->ServerVar('SERVER_NAME') != '') - { - $protocol = ($this->ServerVar('HTTPS') == 'on') ? 'HTTPS' : 'HTTP'; - $remote = $this->ServerVar('REMOTE_HOST'); - if($remote == "") - $remote = 'phpmailer'; - $remote .= ' (['.$this->ServerVar('REMOTE_ADDR').'])'; + if ( $dec == 32 ) { + if ( $i == ( $linlen - 1 ) ) { // convert space at eol only + $c = '=20'; + } else if ( $space_conv ) { + $c = '=20'; + } + } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required + $h2 = floor($dec/16); + $h1 = floor($dec%16); + $c = $escape.$hex[$h2].$hex[$h1]; } - else - { - $protocol = 'local'; - $remote = $this->ServerVar('USER'); - if($remote == '') - $remote = 'phpmailer'; + if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted + $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay + $newline = ''; + // check if newline first character will be point or not + if ( $dec == 46 ) { + $c = '=2E'; + } } + $newline .= $c; + } // end of for + $output .= $newline.$eol; + } // end of while + return $output; + } + + /** + * Encode string to RFC2045 (6.7) quoted-printable format + * Uses a PHP5 stream filter to do the encoding about 64x faster than the old version + * Also results in same content as you started with after decoding + * @see EncodeQPphp() + * @access public + * @param string $string the text to encode + * @param integer $line_max Number of chars allowed on a line before wrapping + * @param boolean $space_conv Dummy param for compatibility with existing EncodeQP function + * @return string + * @author Marcus Bointon + */ + public function EncodeQP($string, $line_max = 76, $space_conv = false) { + if (function_exists('quoted_printable_encode')) { //Use native function if it's available (>= PHP5.3) + return quoted_printable_encode($string); + } + $filters = stream_get_filters(); + if (!in_array('convert.*', $filters)) { //Got convert stream filter? + return $this->EncodeQPphp($string, $line_max, $space_conv); //Fall back to old implementation + } + $fp = fopen('php://temp/', 'r+'); + $string = preg_replace('/\r\n?/', $this->LE, $string); //Normalise line breaks + $params = array('line-length' => $line_max, 'line-break-chars' => $this->LE); + $s = stream_filter_append($fp, 'convert.quoted-printable-encode', STREAM_FILTER_READ, $params); + fputs($fp, $string); + rewind($fp); + $out = stream_get_contents($fp); + stream_filter_remove($s); + $out = preg_replace('/^\./m', '=2E', $out); //Encode . if it is first char on a line, workaround for bug in Exchange + fclose($fp); + return $out; + } + + /** + * Encode string to q encoding. + * @link http://tools.ietf.org/html/rfc2047 + * @param string $str the text to encode + * @param string $position Where the text is going to be used, see the RFC for what that means + * @access public + * @return string + */ + public function EncodeQ($str, $position = 'text') { + // There should not be any EOL in the string + $encoded = preg_replace('/[\r\n]*/', '', $str); + + switch (strtolower($position)) { + case 'phrase': + $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); + break; + case 'comment': + $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); + case 'text': + default: + // Replace every high ascii, control =, ? and _ characters + //TODO using /e (equivalent to eval()) is probably not a good idea + $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e', + "'='.sprintf('%02X', ord(stripslashes('\\1')))", $encoded); + break; + } + + // Replace every spaces to _ (more readable than =20) + $encoded = str_replace(' ', '_', $encoded); + + return $encoded; + } + + /** + * Adds a string or binary attachment (non-filesystem) to the list. + * This method can be used to attach ascii or binary data, + * such as a BLOB record from a database. + * @param string $string String attachment data. + * @param string $filename Name of the attachment. + * @param string $encoding File encoding (see $Encoding). + * @param string $type File extension (MIME) type. + * @return void + */ + public function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') { + // Append to $attachment array + $this->attachment[] = array( + 0 => $string, + 1 => $filename, + 2 => basename($filename), + 3 => $encoding, + 4 => $type, + 5 => true, // isStringAttachment + 6 => 'attachment', + 7 => 0 + ); + } + + /** + * Adds an embedded attachment. This can include images, sounds, and + * just about any other document. Make sure to set the $type to an + * image type. For JPEG images use "image/jpeg" and for GIF images + * use "image/gif". + * @param string $path Path to the attachment. + * @param string $cid Content ID of the attachment. Use this to identify + * the Id for accessing the image in an HTML form. + * @param string $name Overrides the attachment name. + * @param string $encoding File encoding (see $Encoding). + * @param string $type File extension (MIME) type. + * @return bool + */ + public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { + + if ( !@is_file($path) ) { + $this->SetError($this->Lang('file_access') . $path); + return false; + } - $result = sprintf("Received: from %s %s\tby %s " . - "with %s (PHPMailer);%s\t%s%s", $remote, $this->LE, - $this->ServerHostname(), $protocol, $this->LE, - $this->RFCDate(), $this->LE); - - return $result; - } - - /** - * Returns the appropriate server variable. Should work with both - * PHP 4.1.0+ as well as older versions. Returns an empty string - * if nothing is found. - * @access private - * @return mixed - */ - function ServerVar($varName) { - global $HTTP_SERVER_VARS; - global $HTTP_ENV_VARS; - - if(!isset($_SERVER)) - { - $_SERVER = $HTTP_SERVER_VARS; - if(!isset($_SERVER["REMOTE_ADDR"])) - $_SERVER = $HTTP_ENV_VARS; // must be Apache + $filename = basename($path); + if ( $name == '' ) { + $name = $filename; + } + + // Append to $attachment array + $this->attachment[] = array( + 0 => $path, + 1 => $filename, + 2 => $name, + 3 => $encoding, + 4 => $type, + 5 => false, // isStringAttachment + 6 => 'inline', + 7 => $cid + ); + + return true; + } + + public function AddStringEmbeddedImage($string, $cid, $filename = '', $encoding = 'base64', $type = 'application/octet-stream') { + // Append to $attachment array + $this->attachment[] = array( + 0 => $string, + 1 => $filename, + 2 => basename($filename), + 3 => $encoding, + 4 => $type, + 5 => true, // isStringAttachment + 6 => 'inline', + 7 => $cid + ); + } + + /** + * Returns true if an inline attachment is present. + * @access public + * @return bool + */ + public function InlineImageExists() { + foreach($this->attachment as $attachment) { + if ($attachment[6] == 'inline') { + return true; + } + } + return false; + } + + public function AttachmentExists() { + foreach($this->attachment as $attachment) { + if ($attachment[6] == 'attachment') { + return true; + } + } + return false; + } + + public function AlternativeExists() { + return strlen($this->AltBody)>0; + } + + ///////////////////////////////////////////////// + // CLASS METHODS, MESSAGE RESET + ///////////////////////////////////////////////// + + /** + * Clears all recipients assigned in the TO array. Returns void. + * @return void + */ + public function ClearAddresses() { + foreach($this->to as $to) { + unset($this->all_recipients[strtolower($to[0])]); + } + $this->to = array(); + } + + /** + * Clears all recipients assigned in the CC array. Returns void. + * @return void + */ + public function ClearCCs() { + foreach($this->cc as $cc) { + unset($this->all_recipients[strtolower($cc[0])]); + } + $this->cc = array(); + } + + /** + * Clears all recipients assigned in the BCC array. Returns void. + * @return void + */ + public function ClearBCCs() { + foreach($this->bcc as $bcc) { + unset($this->all_recipients[strtolower($bcc[0])]); + } + $this->bcc = array(); + } + + /** + * Clears all recipients assigned in the ReplyTo array. Returns void. + * @return void + */ + public function ClearReplyTos() { + $this->ReplyTo = array(); + } + + /** + * Clears all recipients assigned in the TO, CC and BCC + * array. Returns void. + * @return void + */ + public function ClearAllRecipients() { + $this->to = array(); + $this->cc = array(); + $this->bcc = array(); + $this->all_recipients = array(); + } + + /** + * Clears all previously set filesystem, string, and binary + * attachments. Returns void. + * @return void + */ + public function ClearAttachments() { + $this->attachment = array(); + } + + /** + * Clears all custom headers. Returns void. + * @return void + */ + public function ClearCustomHeaders() { + $this->CustomHeader = array(); + } + + ///////////////////////////////////////////////// + // CLASS METHODS, MISCELLANEOUS + ///////////////////////////////////////////////// + + /** + * Adds the error message to the error container. + * @access protected + * @return void + */ + protected function SetError($msg) { + $this->error_count++; + if ($this->Mailer == 'smtp' and !is_null($this->smtp)) { + $lasterror = $this->smtp->getError(); + if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) { + $msg .= '

' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "

\n"; + } + } + $this->ErrorInfo = $msg; + } + + /** + * Returns the proper RFC 822 formatted date. + * @access public + * @return string + * @static + */ + public static function RFCDate() { + $tz = date('Z'); + $tzs = ($tz < 0) ? '-' : '+'; + $tz = abs($tz); + $tz = (int)($tz/3600)*100 + ($tz%3600)/60; + $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz); + + return $result; + } + + /** + * Returns the server hostname or 'localhost.localdomain' if unknown. + * @access protected + * @return string + */ + protected function ServerHostname() { + if (!empty($this->Hostname)) { + $result = $this->Hostname; + } elseif (isset($_SERVER['SERVER_NAME'])) { + $result = $_SERVER['SERVER_NAME']; + } else { + $result = 'localhost.localdomain'; + } + + return $result; + } + + /** + * Returns a message in the appropriate language. + * @access protected + * @return string + */ + protected function Lang($key) { + if(count($this->language) < 1) { + $this->SetLanguage('en'); // set the default language + } + + if(isset($this->language[$key])) { + return $this->language[$key]; + } else { + return 'Language string failed to load: ' . $key; + } + } + + /** + * Returns true if an error occurred. + * @access public + * @return bool + */ + public function IsError() { + return ($this->error_count > 0); + } + + /** + * Changes every end of line from CR or LF to CRLF. + * @access public + * @return string + */ + public function FixEOL($str) { + $str = str_replace("\r\n", "\n", $str); + $str = str_replace("\r", "\n", $str); + $str = str_replace("\n", $this->LE, $str); + return $str; + } + + /** + * Adds a custom header. + * @access public + * @return void + */ + public function AddCustomHeader($custom_header) { + $this->CustomHeader[] = explode(':', $custom_header, 2); + } + + /** + * Evaluates the message and returns modifications for inline images and backgrounds + * @access public + * @return $message + */ + public function MsgHTML($message, $basedir = '') { + preg_match_all("/(src|background)=[\"'](.*)[\"']/Ui", $message, $images); + if(isset($images[2])) { + foreach($images[2] as $i => $url) { + // do not change urls for absolute images (thanks to corvuscorax) + if (!preg_match('#^[A-z]+://#', $url)) { + $filename = basename($url); + $directory = dirname($url); + ($directory == '.') ? $directory='': ''; + $cid = 'cid:' . md5($filename); + $ext = pathinfo($filename, PATHINFO_EXTENSION); + $mimeType = self::_mime_types($ext); + if ( strlen($basedir) > 1 && substr($basedir, -1) != '/') { $basedir .= '/'; } + if ( strlen($directory) > 1 && substr($directory, -1) != '/') { $directory .= '/'; } + if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType) ) { + $message = preg_replace("/".$images[1][$i]."=[\"']".preg_quote($url, '/')."[\"']/Ui", $images[1][$i]."=\"".$cid."\"", $message); + } } - - if(isset($_SERVER[$varName])) - return $_SERVER[$varName]; - else - return ""; - } - - /** - * Returns the server hostname or 'localhost.localdomain' if unknown. - * @access private - * @return string - */ - function ServerHostname() { - if ($this->Hostname != "") - $result = $this->Hostname; - elseif ($this->ServerVar('SERVER_NAME') != "") - $result = $this->ServerVar('SERVER_NAME'); - else - $result = "localhost.localdomain"; - - return $result; - } - - /** - * Returns a message in the appropriate language. - * @access private - * @return string - */ - function Lang($key) { - if(count($this->language) < 1) - $this->SetLanguage("en"); // set the default language - - if(isset($this->language[$key])) - return $this->language[$key]; - else - return ""; - } - - /** - * Returns true if an error occurred. - * @return bool - */ - function IsError() { - return ($this->error_count > 0); - } - - /** - * Changes every end of line from CR or LF to CRLF. Returns string. - * @access private - * @return string - */ - function FixEOL($str) { - $str = str_replace("\r\n", "\n", $str); - $str = str_replace("\r", "\n", $str); - $str = str_replace("\n", $this->LE, $str); - return $str; - } - - /** - * Adds a custom header. Returns void. - * @return void - */ - function AddCustomHeader($custom_header) { - $this->CustomHeader[] = explode(":", $custom_header, 2); + } + } + $this->IsHTML(true); + $this->Body = $message; + if (empty($this->AltBody)) { + $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $message))); + if (!empty($textMsg)) { + $this->AltBody = html_entity_decode($textMsg, ENT_QUOTES, $this->CharSet); + } + } + if (empty($this->AltBody)) { + $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n"; } + return $message; + } + + /** + * Gets the MIME type of the embedded or inline image + * @param string File extension + * @access public + * @return string MIME type of ext + * @static + */ + public static function _mime_types($ext = '') { + $mimes = array( + 'hqx' => 'application/mac-binhex40', + 'cpt' => 'application/mac-compactpro', + 'doc' => 'application/msword', + 'bin' => 'application/macbinary', + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => 'application/octet-stream', + 'class' => 'application/octet-stream', + 'psd' => 'application/octet-stream', + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => 'application/pdf', + 'ai' => 'application/postscript', + 'eps' => 'application/postscript', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => 'application/vnd.ms-excel', + 'ppt' => 'application/vnd.ms-powerpoint', + 'wbxml' => 'application/vnd.wap.wbxml', + 'wmlc' => 'application/vnd.wap.wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'php' => 'application/x-httpd-php', + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => 'application/x-javascript', + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => 'application/x-tar', + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'zip' => 'application/zip', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'aif' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => 'audio/x-wav', + 'bmp' => 'image/bmp', + 'gif' => 'image/gif', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'jpe' => 'image/jpeg', + 'png' => 'image/png', + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'css' => 'text/css', + 'html' => 'text/html', + 'htm' => 'text/html', + 'shtml' => 'text/html', + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => 'text/plain', + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => 'text/xml', + 'xsl' => 'text/xml', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => 'video/x-msvideo', + 'movie' => 'video/x-sgi-movie', + 'doc' => 'application/msword', + 'word' => 'application/msword', + 'xl' => 'application/excel', + 'eml' => 'message/rfc822' + ); + return (!isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)]; + } + + /** + * Set (or reset) Class Objects (variables) + * + * Usage Example: + * $page->set('X-Priority', '3'); + * + * @access public + * @param string $name Parameter Name + * @param mixed $value Parameter Value + * NOTE: will not work with arrays, there are no arrays to set/reset + * @todo Should this not be using __set() magic function? + */ + public function set($name, $value = '') { + try { + if (isset($this->$name) ) { + $this->$name = $value; + } else { + throw new phpmailerException($this->Lang('variable_set') . $name, self::STOP_CRITICAL); + } + } catch (Exception $e) { + $this->SetError($e->getMessage()); + if ($e->getCode() == self::STOP_CRITICAL) { + return false; + } + } + return true; + } + + /** + * Strips newlines to prevent header injection. + * @access public + * @param string $str String + * @return string + */ + public function SecureHeader($str) { + $str = str_replace("\r", '', $str); + $str = str_replace("\n", '', $str); + return trim($str); + } + + /** + * Set the private key file and password to sign the message. + * + * @access public + * @param string $key_filename Parameter File Name + * @param string $key_pass Password for private key + */ + public function Sign($cert_filename, $key_filename, $key_pass) { + $this->sign_cert_file = $cert_filename; + $this->sign_key_file = $key_filename; + $this->sign_key_pass = $key_pass; + } + + /** + * Set the private key file and password to sign the message. + * + * @access public + * @param string $key_filename Parameter File Name + * @param string $key_pass Password for private key + */ + public function DKIM_QP($txt) { + $tmp = ''; + $line = ''; + for ($i = 0; $i < strlen($txt); $i++) { + $ord = ord($txt[$i]); + if ( ((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E)) ) { + $line .= $txt[$i]; + } else { + $line .= "=".sprintf("%02X", $ord); + } + } + return $line; + } + + /** + * Generate DKIM signature + * + * @access public + * @param string $s Header + */ + public function DKIM_Sign($s) { + $privKeyStr = file_get_contents($this->DKIM_private); + if ($this->DKIM_passphrase != '') { + $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase); + } else { + $privKey = $privKeyStr; + } + if (openssl_sign($s, $signature, $privKey)) { + return base64_encode($signature); + } + } + + /** + * Generate DKIM Canonicalization Header + * + * @access public + * @param string $s Header + */ + public function DKIM_HeaderC($s) { + $s = preg_replace("/\r\n\s+/", " ", $s); + $lines = explode("\r\n", $s); + foreach ($lines as $key => $line) { + list($heading, $value) = explode(":", $line, 2); + $heading = strtolower($heading); + $value = preg_replace("/\s+/", " ", $value) ; // Compress useless spaces + $lines[$key] = $heading.":".trim($value) ; // Don't forget to remove WSP around the value + } + $s = implode("\r\n", $lines); + return $s; + } + + /** + * Generate DKIM Canonicalization Body + * + * @access public + * @param string $body Message Body + */ + public function DKIM_BodyC($body) { + if ($body == '') return "\r\n"; + // stabilize line endings + $body = str_replace("\r\n", "\n", $body); + $body = str_replace("\n", "\r\n", $body); + // END stabilize line endings + while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") { + $body = substr($body, 0, strlen($body) - 2); + } + return $body; + } + + /** + * Create the DKIM header, body, as new header + * + * @access public + * @param string $headers_line Header lines + * @param string $subject Subject + * @param string $body Body + */ + public function DKIM_Add($headers_line, $subject, $body) { + $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms + $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body + $DKIMquery = 'dns/txt'; // Query method + $DKIMtime = time() ; // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone) + $subject_header = "Subject: $subject"; + $headers = explode($this->LE, $headers_line); + foreach($headers as $header) { + if (strpos($header, 'From:') === 0) { + $from_header = $header; + } elseif (strpos($header, 'To:') === 0) { + $to_header = $header; + } + } + $from = str_replace('|', '=7C', $this->DKIM_QP($from_header)); + $to = str_replace('|', '=7C', $this->DKIM_QP($to_header)); + $subject = str_replace('|', '=7C', $this->DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable + $body = $this->DKIM_BodyC($body); + $DKIMlen = strlen($body) ; // Length of body + $DKIMb64 = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body + $ident = ($this->DKIM_identity == '')? '' : " i=" . $this->DKIM_identity . ";"; + $dkimhdrs = "DKIM-Signature: v=1; a=" . $DKIMsignatureType . "; q=" . $DKIMquery . "; l=" . $DKIMlen . "; s=" . $this->DKIM_selector . ";\r\n". + "\tt=" . $DKIMtime . "; c=" . $DKIMcanonicalization . ";\r\n". + "\th=From:To:Subject;\r\n". + "\td=" . $this->DKIM_domain . ";" . $ident . "\r\n". + "\tz=$from\r\n". + "\t|$to\r\n". + "\t|$subject;\r\n". + "\tbh=" . $DKIMb64 . ";\r\n". + "\tb="; + $toSign = $this->DKIM_HeaderC($from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs); + $signed = $this->DKIM_Sign($toSign); + return "X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n".$dkimhdrs.$signed."\r\n"; + } + + protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body) { + if (!empty($this->action_function) && function_exists($this->action_function)) { + $params = array($isSent, $to, $cc, $bcc, $subject, $body); + call_user_func_array($this->action_function, $params); + } + } } +class phpmailerException extends Exception { + public function errorMessage() { + $errorMsg = '' . $this->getMessage() . "
\n"; + return $errorMsg; + } +} ?> diff --git a/saf/lib/Ext/phpmailer/class.pop3.php b/saf/lib/Ext/phpmailer/class.pop3.php new file mode 100644 index 00000000..adde15fb --- /dev/null +++ b/saf/lib/Ext/phpmailer/class.pop3.php @@ -0,0 +1,410 @@ +pop_conn = 0; + $this->connected = false; + $this->error = null; + } + + /** + * Combination of public events - connect, login, disconnect + * @access public + * @param string $host + * @param integer $port + * @param integer $tval + * @param string $username + * @param string $password + */ + public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) { + $this->host = $host; + + // If no port value is passed, retrieve it + if ($port == false) { + $this->port = $this->POP3_PORT; + } else { + $this->port = $port; + } + + // If no port value is passed, retrieve it + if ($tval == false) { + $this->tval = $this->POP3_TIMEOUT; + } else { + $this->tval = $tval; + } + + $this->do_debug = $debug_level; + $this->username = $username; + $this->password = $password; + + // Refresh the error log + $this->error = null; + + // Connect + $result = $this->Connect($this->host, $this->port, $this->tval); + + if ($result) { + $login_result = $this->Login($this->username, $this->password); + + if ($login_result) { + $this->Disconnect(); + + return true; + } + + } + + // We need to disconnect regardless if the login succeeded + $this->Disconnect(); + + return false; + } + + /** + * Connect to the POP3 server + * @access public + * @param string $host + * @param integer $port + * @param integer $tval + * @return boolean + */ + public function Connect ($host, $port = false, $tval = 30) { + // Are we already connected? + if ($this->connected) { + return true; + } + + /* + On Windows this will raise a PHP Warning error if the hostname doesn't exist. + Rather than supress it with @fsockopen, let's capture it cleanly instead + */ + + set_error_handler(array(&$this, 'catchWarning')); + + // Connect to the POP3 server + $this->pop_conn = fsockopen($host, // POP3 Host + $port, // Port # + $errno, // Error Number + $errstr, // Error Message + $tval); // Timeout (seconds) + + // Restore the error handler + restore_error_handler(); + + // Does the Error Log now contain anything? + if ($this->error && $this->do_debug >= 1) { + $this->displayErrors(); + } + + // Did we connect? + if ($this->pop_conn == false) { + // It would appear not... + $this->error = array( + 'error' => "Failed to connect to server $host on port $port", + 'errno' => $errno, + 'errstr' => $errstr + ); + + if ($this->do_debug >= 1) { + $this->displayErrors(); + } + + return false; + } + + // Increase the stream time-out + + // Check for PHP 4.3.0 or later + if (version_compare(phpversion(), '5.0.0', 'ge')) { + stream_set_timeout($this->pop_conn, $tval, 0); + } else { + // Does not work on Windows + if (substr(PHP_OS, 0, 3) !== 'WIN') { + socket_set_timeout($this->pop_conn, $tval, 0); + } + } + + // Get the POP3 server response + $pop3_response = $this->getResponse(); + + // Check for the +OK + if ($this->checkResponse($pop3_response)) { + // The connection is established and the POP3 server is talking + $this->connected = true; + return true; + } + + } + + /** + * Login to the POP3 server (does not support APOP yet) + * @access public + * @param string $username + * @param string $password + * @return boolean + */ + public function Login ($username = '', $password = '') { + if ($this->connected == false) { + $this->error = 'Not connected to POP3 server'; + + if ($this->do_debug >= 1) { + $this->displayErrors(); + } + } + + if (empty($username)) { + $username = $this->username; + } + + if (empty($password)) { + $password = $this->password; + } + + $pop_username = "USER $username" . $this->CRLF; + $pop_password = "PASS $password" . $this->CRLF; + + // Send the Username + $this->sendString($pop_username); + $pop3_response = $this->getResponse(); + + if ($this->checkResponse($pop3_response)) { + // Send the Password + $this->sendString($pop_password); + $pop3_response = $this->getResponse(); + + if ($this->checkResponse($pop3_response)) { + return true; + } else { + return false; + } + } else { + return false; + } + } + + /** + * Disconnect from the POP3 server + * @access public + */ + public function Disconnect () { + $this->sendString('QUIT'); + + fclose($this->pop_conn); + } + + ///////////////////////////////////////////////// + // Private Methods + ///////////////////////////////////////////////// + + /** + * Get the socket response back. + * $size is the maximum number of bytes to retrieve + * @access private + * @param integer $size + * @return string + */ + private function getResponse ($size = 128) { + $pop3_response = fgets($this->pop_conn, $size); + + return $pop3_response; + } + + /** + * Send a string down the open socket connection to the POP3 server + * @access private + * @param string $string + * @return integer + */ + private function sendString ($string) { + $bytes_sent = fwrite($this->pop_conn, $string, strlen($string)); + + return $bytes_sent; + } + + /** + * Checks the POP3 server response for +OK or -ERR + * @access private + * @param string $string + * @return boolean + */ + private function checkResponse ($string) { + if (substr($string, 0, 3) !== '+OK') { + $this->error = array( + 'error' => "Server reported an error: $string", + 'errno' => 0, + 'errstr' => '' + ); + + if ($this->do_debug >= 1) { + $this->displayErrors(); + } + + return false; + } else { + return true; + } + + } + + /** + * If debug is enabled, display the error message array + * @access private + */ + private function displayErrors () { + echo '
';
+
+    foreach ($this->error as $single_error) {
+      print_r($single_error);
+    }
+
+    echo '
'; + } + + /** + * Takes over from PHP for the socket warning handler + * @access private + * @param integer $errno + * @param string $errstr + * @param string $errfile + * @param integer $errline + */ + private function catchWarning ($errno, $errstr, $errfile, $errline) { + $this->error[] = array( + 'error' => "Connecting to the POP3 server raised a PHP warning: ", + 'errno' => $errno, + 'errstr' => $errstr + ); + } + + // End of class +} +?> diff --git a/saf/lib/Ext/phpmailer/class.smtp.php b/saf/lib/Ext/phpmailer/class.smtp.php index 6b45c3ae..6977bffa 100644 --- a/saf/lib/Ext/phpmailer/class.smtp.php +++ b/saf/lib/Ext/phpmailer/class.smtp.php @@ -1,1039 +1,818 @@ smtp_conn = 0; - $this->error = null; - $this->helo_rply = null; - $this->do_debug = 0; +class SMTP { + /** + * SMTP server port + * @var int + */ + public $SMTP_PORT = 25; + + /** + * SMTP reply line ending + * @var string + */ + public $CRLF = "\r\n"; + + /** + * Sets whether debugging is turned on + * @var bool + */ + public $do_debug; // the level of debug to perform + + /** + * Sets VERP use on/off (default is off) + * @var bool + */ + public $do_verp = false; + + /** + * Sets the SMTP PHPMailer Version number + * @var string + */ + public $Version = '5.2.1'; + + ///////////////////////////////////////////////// + // PROPERTIES, PRIVATE AND PROTECTED + ///////////////////////////////////////////////// + + private $smtp_conn; // the socket to the server + private $error; // error if any on the last call + private $helo_rply; // the reply the server sent to us for HELO + + /** + * Initialize the class so that the data is in a known state. + * @access public + * @return void + */ + public function __construct() { + $this->smtp_conn = 0; + $this->error = null; + $this->helo_rply = null; + + $this->do_debug = 0; + } + + ///////////////////////////////////////////////// + // CONNECTION FUNCTIONS + ///////////////////////////////////////////////// + + /** + * Connect to the server specified on the port specified. + * If the port is not specified use the default SMTP_PORT. + * If tval is specified then a connection will try and be + * established with the server for that number of seconds. + * If tval is not specified the default is 30 seconds to + * try on the connection. + * + * SMTP CODE SUCCESS: 220 + * SMTP CODE FAILURE: 421 + * @access public + * @return bool + */ + public function Connect($host, $port = 0, $tval = 30) { + // set the error val to null so there is no confusion + $this->error = null; + + // make sure we are __not__ connected + if($this->connected()) { + // already connected, generate error + $this->error = array("error" => "Already connected to a server"); + return false; } - /************************************************************* - * CONNECTION FUNCTIONS * - ***********************************************************/ - - /** - * Connect to the server specified on the port specified. - * If the port is not specified use the default SMTP_PORT. - * If tval is specified then a connection will try and be - * established with the server for that number of seconds. - * If tval is not specified the default is 30 seconds to - * try on the connection. - * - * SMTP CODE SUCCESS: 220 - * SMTP CODE FAILURE: 421 - * @access public - * @return bool - */ - function Connect($host,$port=0,$tval=30) { - # set the error val to null so there is no confusion - $this->error = null; - - # make sure we are __not__ connected - if($this->connected()) { - # ok we are connected! what should we do? - # for now we will just give an error saying we - # are already connected - $this->error = - array("error" => "Already connected to a server"); - return false; - } - - if(empty($port)) { - $port = $this->SMTP_PORT; - } - - #connect to the smtp server - $this->smtp_conn = fsockopen($host, # the host of the server - $port, # the port to use - $errno, # error number if any - $errstr, # error message if any - $tval); # give up after ? secs - # verify we connected properly - if(empty($this->smtp_conn)) { - $this->error = array("error" => "Failed to connect to server", - "errno" => $errno, - "errstr" => $errstr); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": $errstr ($errno)" . $this->CRLF; - } - return false; - } + if(empty($port)) { + $port = $this->SMTP_PORT; + } - # sometimes the SMTP server takes a little longer to respond - # so we will give it a longer timeout for the first read - // Windows still does not have support for this timeout function - if(substr(PHP_OS, 0, 3) != "WIN") - socket_set_timeout($this->smtp_conn, $tval, 0); + // connect to the smtp server + $this->smtp_conn = @fsockopen($host, // the host of the server + $port, // the port to use + $errno, // error number if any + $errstr, // error message if any + $tval); // give up after ? secs + // verify we connected properly + if(empty($this->smtp_conn)) { + $this->error = array("error" => "Failed to connect to server", + "errno" => $errno, + "errstr" => $errstr); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF . '
'; + } + return false; + } - # get any announcement stuff - $announce = $this->get_lines(); + // SMTP server can take longer to respond, give longer timeout for first read + // Windows does not have support for this timeout function + if(substr(PHP_OS, 0, 3) != "WIN") + socket_set_timeout($this->smtp_conn, $tval, 0); - # set the timeout of any socket functions at 1/10 of a second - //if(function_exists("socket_set_timeout")) - // socket_set_timeout($this->smtp_conn, 0, 100000); + // get any announcement + $announce = $this->get_lines(); - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce; - } - - return true; + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $announce . $this->CRLF . '
'; } - /** - * Performs SMTP authentication. Must be run after running the - * Hello() method. Returns true if successfully authenticated. - * @access public - * @return bool - */ - function Authenticate($username, $password) { - // Start authentication - fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($code != 334) { - $this->error = - array("error" => "AUTH not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } + return true; + } + + /** + * Initiate a TLS communication with the server. + * + * SMTP CODE 220 Ready to start TLS + * SMTP CODE 501 Syntax error (no parameters allowed) + * SMTP CODE 454 TLS not available due to temporary reason + * @access public + * @return bool success + */ + public function StartTLS() { + $this->error = null; # to avoid confusion + + if(!$this->connected()) { + $this->error = array("error" => "Called StartTLS() without being connected"); + return false; + } - // Send encoded username - fputs($this->smtp_conn, base64_encode($username) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($code != 334) { - $this->error = - array("error" => "Username not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } + fputs($this->smtp_conn,"STARTTLS" . $this->CRLF); - // Send encoded password - fputs($this->smtp_conn, base64_encode($password) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($code != 235) { - $this->error = - array("error" => "Password not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } + $rply = $this->get_lines(); + $code = substr($rply,0,3); - return true; + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; } - /** - * Returns true if connected to a server otherwise false - * @access private - * @return bool - */ - function Connected() { - if(!empty($this->smtp_conn)) { - $sock_status = socket_get_status($this->smtp_conn); - if($sock_status["eof"]) { - # hmm this is an odd situation... the socket is - # valid but we aren't connected anymore - if($this->do_debug >= 1) { - echo "SMTP -> NOTICE:" . $this->CRLF . - "EOF caught while checking if connected"; - } - $this->Close(); - return false; - } - return true; # everything looks good - } - return false; + if($code != 220) { + $this->error = + array("error" => "STARTTLS not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; } - /** - * Closes the socket and cleans up the state of the class. - * It is not considered good to use this function without - * first trying to use QUIT. - * @access public - * @return void - */ - function Close() { - $this->error = null; # so there is no confusion - $this->helo_rply = null; - if(!empty($this->smtp_conn)) { - # close the connection and cleanup - fclose($this->smtp_conn); - $this->smtp_conn = 0; - } + // Begin encrypted connection + if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { + return false; } + return true; + } + + /** + * Performs SMTP authentication. Must be run after running the + * Hello() method. Returns true if successfully authenticated. + * @access public + * @return bool + */ + public function Authenticate($username, $password) { + // Start authentication + fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($code != 334) { + $this->error = + array("error" => "AUTH not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } - /*************************************************************** - * SMTP COMMANDS * - *************************************************************/ - - /** - * Issues a data command and sends the msg_data to the server - * finializing the mail transaction. $msg_data is the message - * that is to be send with the headers. Each header needs to be - * on a single line followed by a with the message headers - * and the message body being seperated by and additional . - * - * Implements rfc 821: DATA - * - * SMTP CODE INTERMEDIATE: 354 - * [data] - * . - * SMTP CODE SUCCESS: 250 - * SMTP CODE FAILURE: 552,554,451,452 - * SMTP CODE FAILURE: 451,554 - * SMTP CODE ERROR : 500,501,503,421 - * @access public - * @return bool - */ - function Data($msg_data) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Data() without being connected"); - return false; - } - - fputs($this->smtp_conn,"DATA" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 354) { - $this->error = - array("error" => "DATA command not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } + // Send encoded username + fputs($this->smtp_conn, base64_encode($username) . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($code != 334) { + $this->error = + array("error" => "Username not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } - # the server is ready to accept data! - # according to rfc 821 we should not send more than 1000 - # including the CRLF - # characters on a single line so we will break the data up - # into lines by \r and/or \n then if needed we will break - # each of those into smaller lines to fit within the limit. - # in addition we will be looking for lines that start with - # a period '.' and append and additional period '.' to that - # line. NOTE: this does not count towards are limit. - - # normalize the line breaks so we know the explode works - $msg_data = str_replace("\r\n","\n",$msg_data); - $msg_data = str_replace("\r","\n",$msg_data); - $lines = explode("\n",$msg_data); - - # we need to find a good way to determine is headers are - # in the msg_data or if it is a straight msg body - # currently I'm assuming rfc 822 definitions of msg headers - # and if the first field of the first line (':' sperated) - # does not contain a space then it _should_ be a header - # and we can process all lines before a blank "" line as - # headers. - $field = substr($lines[0],0,strpos($lines[0],":")); - $in_headers = false; - if(!empty($field) && !strstr($field," ")) { - $in_headers = true; - } + // Send encoded password + fputs($this->smtp_conn, base64_encode($password) . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($code != 235) { + $this->error = + array("error" => "Password not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } - $max_line_length = 998; # used below; set here for ease in change - - while(list(,$line) = @each($lines)) { - $lines_out = null; - if($line == "" && $in_headers) { - $in_headers = false; - } - # ok we need to break this line up into several - # smaller lines - while(strlen($line) > $max_line_length) { - $pos = strrpos(substr($line,0,$max_line_length)," "); - $lines_out[] = substr($line,0,$pos); - $line = substr($line,$pos + 1); - # if we are processing headers we need to - # add a LWSP-char to the front of the new line - # rfc 822 on long msg headers - if($in_headers) { - $line = "\t" . $line; - } - } - $lines_out[] = $line; - - # now send the lines to the server - while(list(,$line_out) = @each($lines_out)) { - if(strlen($line_out) > 0) - { - if(substr($line_out, 0, 1) == ".") { - $line_out = "." . $line_out; - } - } - fputs($this->smtp_conn,$line_out . $this->CRLF); - } + return true; + } + + /** + * Returns true if connected to a server otherwise false + * @access public + * @return bool + */ + public function Connected() { + if(!empty($this->smtp_conn)) { + $sock_status = socket_get_status($this->smtp_conn); + if($sock_status["eof"]) { + // the socket is valid but we are not connected + if($this->do_debug >= 1) { + echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected"; } + $this->Close(); + return false; + } + return true; // everything looks good + } + return false; + } + + /** + * Closes the socket and cleans up the state of the class. + * It is not considered good to use this function without + * first trying to use QUIT. + * @access public + * @return void + */ + public function Close() { + $this->error = null; // so there is no confusion + $this->helo_rply = null; + if(!empty($this->smtp_conn)) { + // close the connection and cleanup + fclose($this->smtp_conn); + $this->smtp_conn = 0; + } + } + + ///////////////////////////////////////////////// + // SMTP COMMANDS + ///////////////////////////////////////////////// + + /** + * Issues a data command and sends the msg_data to the server + * finializing the mail transaction. $msg_data is the message + * that is to be send with the headers. Each header needs to be + * on a single line followed by a with the message headers + * and the message body being seperated by and additional . + * + * Implements rfc 821: DATA + * + * SMTP CODE INTERMEDIATE: 354 + * [data] + * . + * SMTP CODE SUCCESS: 250 + * SMTP CODE FAILURE: 552,554,451,452 + * SMTP CODE FAILURE: 451,554 + * SMTP CODE ERROR : 500,501,503,421 + * @access public + * @return bool + */ + public function Data($msg_data) { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Data() without being connected"); + return false; + } - # ok all the message data has been sent so lets get this - # over with aleady - fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF); + fputs($this->smtp_conn,"DATA" . $this->CRLF); - $rply = $this->get_lines(); - $code = substr($rply,0,3); + $rply = $this->get_lines(); + $code = substr($rply,0,3); - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; + } - if($code != 250) { - $this->error = - array("error" => "DATA not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; + if($code != 354) { + $this->error = + array("error" => "DATA command not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; } - /** - * Expand takes the name and asks the server to list all the - * people who are members of the _list_. Expand will return - * back and array of the result or false if an error occurs. - * Each value in the array returned has the format of: - * [ ] - * The definition of is defined in rfc 821 - * - * Implements rfc 821: EXPN - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE FAILURE: 550 - * SMTP CODE ERROR : 500,501,502,504,421 - * @access public - * @return string array + /* the server is ready to accept data! + * according to rfc 821 we should not send more than 1000 + * including the CRLF + * characters on a single line so we will break the data up + * into lines by \r and/or \n then if needed we will break + * each of those into smaller lines to fit within the limit. + * in addition we will be looking for lines that start with + * a period '.' and append and additional period '.' to that + * line. NOTE: this does not count towards limit. */ - function Expand($name) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Expand() without being connected"); - return false; - } - - fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "EXPN not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - # parse the reply and place in our array to return to user - $entries = explode($this->CRLF,$rply); - while(list(,$l) = @each($entries)) { - $list[] = substr($l,4); - } - - return $list; - } - /** - * Sends the HELO command to the smtp server. - * This makes sure that we and the server are in - * the same known state. - * - * Implements from rfc 821: HELO - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE ERROR : 500, 501, 504, 421 - * @access public - * @return bool + // normalize the line breaks so we know the explode works + $msg_data = str_replace("\r\n","\n",$msg_data); + $msg_data = str_replace("\r","\n",$msg_data); + $lines = explode("\n",$msg_data); + + /* we need to find a good way to determine is headers are + * in the msg_data or if it is a straight msg body + * currently I am assuming rfc 822 definitions of msg headers + * and if the first field of the first line (':' sperated) + * does not contain a space then it _should_ be a header + * and we can process all lines before a blank "" line as + * headers. */ - function Hello($host="") { - $this->error = null; # so no confusion is caused - if(!$this->connected()) { - $this->error = array( - "error" => "Called Hello() without being connected"); - return false; - } + $field = substr($lines[0],0,strpos($lines[0],":")); + $in_headers = false; + if(!empty($field) && !strstr($field," ")) { + $in_headers = true; + } - # if a hostname for the HELO wasn't specified determine - # a suitable one to send - if(empty($host)) { - # we need to determine some sort of appopiate default - # to send to the server - $host = "localhost"; - } + $max_line_length = 998; // used below; set here for ease in change - // Send extended hello first (RFC 2821) - if(!$this->SendHello("EHLO", $host)) + while(list(,$line) = @each($lines)) { + $lines_out = null; + if($line == "" && $in_headers) { + $in_headers = false; + } + // ok we need to break this line up into several smaller lines + while(strlen($line) > $max_line_length) { + $pos = strrpos(substr($line,0,$max_line_length)," "); + + // Patch to fix DOS attack + if(!$pos) { + $pos = $max_line_length - 1; + $lines_out[] = substr($line,0,$pos); + $line = substr($line,$pos); + } else { + $lines_out[] = substr($line,0,$pos); + $line = substr($line,$pos + 1); + } + + /* if processing headers add a LWSP-char to the front of new line + * rfc 822 on long msg headers + */ + if($in_headers) { + $line = "\t" . $line; + } + } + $lines_out[] = $line; + + // send the lines to the server + while(list(,$line_out) = @each($lines_out)) { + if(strlen($line_out) > 0) { - if(!$this->SendHello("HELO", $host)) - return false; + if(substr($line_out, 0, 1) == ".") { + $line_out = "." . $line_out; + } } - - return true; + fputs($this->smtp_conn,$line_out . $this->CRLF); + } } - /** - * Sends a HELO/EHLO command. - * @access private - * @return bool - */ - function SendHello($hello, $host) { - fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF); + // message data has been sent + fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF); - $rply = $this->get_lines(); - $code = substr($rply,0,3); + $rply = $this->get_lines(); + $code = substr($rply,0,3); - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => $hello . " not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - $this->helo_rply = $rply; - - return true; + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; } - /** - * Gets help information on the keyword specified. If the keyword - * is not specified then returns generic help, ussually contianing - * A list of keywords that help is available on. This function - * returns the results back to the user. It is up to the user to - * handle the returned data. If an error occurs then false is - * returned with $this->error set appropiately. - * - * Implements rfc 821: HELP [ ] - * - * SMTP CODE SUCCESS: 211,214 - * SMTP CODE ERROR : 500,501,502,504,421 - * @access public - * @return string - */ - function Help($keyword="") { - $this->error = null; # to avoid confusion - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Help() without being connected"); - return false; - } - - $extra = ""; - if(!empty($keyword)) { - $extra = " " . $keyword; - } - - fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 211 && $code != 214) { - $this->error = - array("error" => "HELP not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - return $rply; + if($code != 250) { + $this->error = + array("error" => "DATA not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; } - - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. - * - * Implements rfc 821: MAIL FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552,451,452 - * SMTP CODE SUCCESS: 500,501,421 - * @access public - * @return bool - */ - function Mail($from) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Mail() without being connected"); - return false; - } - - fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "MAIL not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; + return true; + } + + /** + * Sends the HELO command to the smtp server. + * This makes sure that we and the server are in + * the same known state. + * + * Implements from rfc 821: HELO + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE ERROR : 500, 501, 504, 421 + * @access public + * @return bool + */ + public function Hello($host = '') { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Hello() without being connected"); + return false; } - /** - * Sends the command NOOP to the SMTP server. - * - * Implements from rfc 821: NOOP - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE ERROR : 500, 421 - * @access public - * @return bool - */ - function Noop() { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Noop() without being connected"); - return false; - } - - fputs($this->smtp_conn,"NOOP" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "NOOP not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; + // if hostname for HELO was not specified send default + if(empty($host)) { + // determine appropriate default to send to server + $host = "localhost"; } - /** - * Sends the quit command to the server and then closes the socket - * if there is no error or the $close_on_error argument is true. - * - * Implements from rfc 821: QUIT - * - * SMTP CODE SUCCESS: 221 - * SMTP CODE ERROR : 500 - * @access public - * @return bool - */ - function Quit($close_on_error=true) { - $this->error = null; # so there is no confusion - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Quit() without being connected"); - return false; - } - - # send the quit command to the server - fputs($this->smtp_conn,"quit" . $this->CRLF); - - # get any good-bye messages - $byemsg = $this->get_lines(); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg; - } - - $rval = true; - $e = null; - - $code = substr($byemsg,0,3); - if($code != 221) { - # use e as a tmp var cause Close will overwrite $this->error - $e = array("error" => "SMTP server rejected quit command", - "smtp_code" => $code, - "smtp_rply" => substr($byemsg,4)); - $rval = false; - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $e["error"] . ": " . - $byemsg . $this->CRLF; - } - } - - if(empty($e) || $close_on_error) { - $this->Close(); - } - - return $rval; + // Send extended hello first (RFC 2821) + if(!$this->SendHello("EHLO", $host)) { + if(!$this->SendHello("HELO", $host)) { + return false; + } } - /** - * Sends the command RCPT to the SMTP server with the TO: argument of $to. - * Returns true if the recipient was accepted false if it was rejected. - * - * Implements from rfc 821: RCPT TO: - * - * SMTP CODE SUCCESS: 250,251 - * SMTP CODE FAILURE: 550,551,552,553,450,451,452 - * SMTP CODE ERROR : 500,501,503,421 - * @access public - * @return bool - */ - function Recipient($to) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Recipient() without being connected"); - return false; - } + return true; + } - fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF); + /** + * Sends a HELO/EHLO command. + * @access private + * @return bool + */ + private function SendHello($hello, $host) { + fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF); - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } + $rply = $this->get_lines(); + $code = substr($rply,0,3); - if($code != 250 && $code != 251) { - $this->error = - array("error" => "RCPT not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . '
'; } - /** - * Sends the RSET command to abort and transaction that is - * currently in progress. Returns true if successful false - * otherwise. - * - * Implements rfc 821: RSET - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE ERROR : 500,501,504,421 - * @access public - * @return bool - */ - function Reset() { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Reset() without being connected"); - return false; - } - - fputs($this->smtp_conn,"RSET" . $this->CRLF); + if($code != 250) { + $this->error = + array("error" => $hello . " not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } - $rply = $this->get_lines(); - $code = substr($rply,0,3); + $this->helo_rply = $rply; + + return true; + } + + /** + * Starts a mail transaction from the email address specified in + * $from. Returns true if successful or false otherwise. If True + * the mail transaction is started and then one or more Recipient + * commands may be called followed by a Data command. + * + * Implements rfc 821: MAIL FROM: + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE SUCCESS: 552,451,452 + * SMTP CODE SUCCESS: 500,501,421 + * @access public + * @return bool + */ + public function Mail($from) { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Mail() without being connected"); + return false; + } - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } + $useVerp = ($this->do_verp ? "XVERP" : ""); + fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF); - if($code != 250) { - $this->error = - array("error" => "RSET failed", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } + $rply = $this->get_lines(); + $code = substr($rply,0,3); - return true; + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; } - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. This command - * will send the message to the users terminal if they are logged - * in. - * - * Implements rfc 821: SEND FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552,451,452 - * SMTP CODE SUCCESS: 500,501,502,421 - * @access public - * @return bool - */ - function Send($from) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Send() without being connected"); - return false; - } - - fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF); + if($code != 250) { + $this->error = + array("error" => "MAIL not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + return true; + } + + /** + * Sends the quit command to the server and then closes the socket + * if there is no error or the $close_on_error argument is true. + * + * Implements from rfc 821: QUIT + * + * SMTP CODE SUCCESS: 221 + * SMTP CODE ERROR : 500 + * @access public + * @return bool + */ + public function Quit($close_on_error = true) { + $this->error = null; // so there is no confusion + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Quit() without being connected"); + return false; + } - $rply = $this->get_lines(); - $code = substr($rply,0,3); + // send the quit command to the server + fputs($this->smtp_conn,"quit" . $this->CRLF); - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } + // get any good-bye messages + $byemsg = $this->get_lines(); - if($code != 250) { - $this->error = - array("error" => "SEND not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '
'; } - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. This command - * will send the message to the users terminal if they are logged - * in and send them an email. - * - * Implements rfc 821: SAML FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552,451,452 - * SMTP CODE SUCCESS: 500,501,502,421 - * @access public - * @return bool - */ - function SendAndMail($from) { - $this->error = null; # so no confusion is caused + $rval = true; + $e = null; + + $code = substr($byemsg,0,3); + if($code != 221) { + // use e as a tmp var cause Close will overwrite $this->error + $e = array("error" => "SMTP server rejected quit command", + "smtp_code" => $code, + "smtp_rply" => substr($byemsg,4)); + $rval = false; + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '
'; + } + } - if(!$this->connected()) { - $this->error = array( - "error" => "Called SendAndMail() without being connected"); - return false; - } + if(empty($e) || $close_on_error) { + $this->Close(); + } - fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF); + return $rval; + } + + /** + * Sends the command RCPT to the SMTP server with the TO: argument of $to. + * Returns true if the recipient was accepted false if it was rejected. + * + * Implements from rfc 821: RCPT TO: + * + * SMTP CODE SUCCESS: 250,251 + * SMTP CODE FAILURE: 550,551,552,553,450,451,452 + * SMTP CODE ERROR : 500,501,503,421 + * @access public + * @return bool + */ + public function Recipient($to) { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Recipient() without being connected"); + return false; + } - $rply = $this->get_lines(); - $code = substr($rply,0,3); + fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF); - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } + $rply = $this->get_lines(); + $code = substr($rply,0,3); - if($code != 250) { - $this->error = - array("error" => "SAML not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; } - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. This command - * will send the message to the users terminal if they are logged - * in or mail it to them if they are not. - * - * Implements rfc 821: SOML FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552,451,452 - * SMTP CODE SUCCESS: 500,501,502,421 - * @access public - * @return bool - */ - function SendOrMail($from) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called SendOrMail() without being connected"); - return false; - } - - fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF); + if($code != 250 && $code != 251) { + $this->error = + array("error" => "RCPT not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + return true; + } + + /** + * Sends the RSET command to abort and transaction that is + * currently in progress. Returns true if successful false + * otherwise. + * + * Implements rfc 821: RSET + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE ERROR : 500,501,504,421 + * @access public + * @return bool + */ + public function Reset() { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Reset() without being connected"); + return false; + } - $rply = $this->get_lines(); - $code = substr($rply,0,3); + fputs($this->smtp_conn,"RSET" . $this->CRLF); - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } + $rply = $this->get_lines(); + $code = substr($rply,0,3); - if($code != 250) { - $this->error = - array("error" => "SOML not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; } - /** - * This is an optional command for SMTP that this class does not - * support. This method is here to make the RFC821 Definition - * complete for this class and __may__ be implimented in the future - * - * Implements from rfc 821: TURN - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE FAILURE: 502 - * SMTP CODE ERROR : 500, 503 - * @access public - * @return bool - */ - function Turn() { - $this->error = array("error" => "This method, TURN, of the SMTP ". - "is not implemented"); - if($this->do_debug >= 1) { - echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF; - } - return false; + if($code != 250) { + $this->error = + array("error" => "RSET failed", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; } - /** - * Verifies that the name is recognized by the server. - * Returns false if the name could not be verified otherwise - * the response from the server is returned. - * - * Implements rfc 821: VRFY - * - * SMTP CODE SUCCESS: 250,251 - * SMTP CODE FAILURE: 550,551,553 - * SMTP CODE ERROR : 500,501,502,421 - * @access public - * @return int - */ - function Verify($name) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Verify() without being connected"); - return false; - } + return true; + } + + /** + * Starts a mail transaction from the email address specified in + * $from. Returns true if successful or false otherwise. If True + * the mail transaction is started and then one or more Recipient + * commands may be called followed by a Data command. This command + * will send the message to the users terminal if they are logged + * in and send them an email. + * + * Implements rfc 821: SAML FROM: + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE SUCCESS: 552,451,452 + * SMTP CODE SUCCESS: 500,501,502,421 + * @access public + * @return bool + */ + public function SendAndMail($from) { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called SendAndMail() without being connected"); + return false; + } - fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF); + fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF); - $rply = $this->get_lines(); - $code = substr($rply,0,3); + $rply = $this->get_lines(); + $code = substr($rply,0,3); - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250 && $code != 251) { - $this->error = - array("error" => "VRFY failed on name '$name'", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return $rply; + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; } - /******************************************************************* - * INTERNAL FUNCTIONS * - ******************************************************************/ - - /** - * Read in as many lines as possible - * either before eof or socket timeout occurs on the operation. - * With SMTP we can tell if we have more lines to read if the - * 4th character is '-' symbol. If it is a space then we don't - * need to read anything else. - * @access private - * @return string - */ - function get_lines() { - $data = ""; - while($str = fgets($this->smtp_conn,515)) { - if($this->do_debug >= 4) { - echo "SMTP -> get_lines(): \$data was \"$data\"" . - $this->CRLF; - echo "SMTP -> get_lines(): \$str is \"$str\"" . - $this->CRLF; - } - $data .= $str; - if($this->do_debug >= 4) { - echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF; - } - # if the 4th character is a space then we are done reading - # so just break the loop - if(substr($str,3,1) == " ") { break; } - } - return $data; + if($code != 250) { + $this->error = + array("error" => "SAML not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + return true; + } + + /** + * This is an optional command for SMTP that this class does not + * support. This method is here to make the RFC821 Definition + * complete for this class and __may__ be implimented in the future + * + * Implements from rfc 821: TURN + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE FAILURE: 502 + * SMTP CODE ERROR : 500, 503 + * @access public + * @return bool + */ + public function Turn() { + $this->error = array("error" => "This method, TURN, of the SMTP ". + "is not implemented"); + if($this->do_debug >= 1) { + echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '
'; } + return false; + } + + /** + * Get the current error + * @access public + * @return array + */ + public function getError() { + return $this->error; + } + + ///////////////////////////////////////////////// + // INTERNAL FUNCTIONS + ///////////////////////////////////////////////// + + /** + * Read in as many lines as possible + * either before eof or socket timeout occurs on the operation. + * With SMTP we can tell if we have more lines to read if the + * 4th character is '-' symbol. If it is a space then we don't + * need to read anything else. + * @access private + * @return string + */ + private function get_lines() { + $data = ""; + while(!feof($this->smtp_conn)) { + $str = @fgets($this->smtp_conn,515); + if($this->do_debug >= 4) { + echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '
'; + echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '
'; + } + $data .= $str; + if($this->do_debug >= 4) { + echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . '
'; + } + // if 4th character is a space, we are done reading, break the loop + if(substr($str,3,1) == " ") { break; } + } + return $data; + } } - - ?> +?> diff --git a/saf/lib/Ext/phpmailer/docs.ini b/saf/lib/Ext/phpmailer/docs.ini new file mode 100644 index 00000000..6906eb0d --- /dev/null +++ b/saf/lib/Ext/phpmailer/docs.ini @@ -0,0 +1,92 @@ +;; phpDocumentor parse configuration file +;; +;; This file is designed to cut down on repetitive typing on the command-line or web interface +;; You can copy this file to create a number of configuration files that can be used with the +;; command-line switch -c, as in phpdoc -c default.ini or phpdoc -c myini.ini. The web +;; interface will automatically generate a list of .ini files that can be used. +;; +;; default.ini is used to generate the online manual at http://www.phpdoc.org/docs +;; +;; ALL .ini files must be in the user subdirectory of phpDocumentor with an extension of .ini +;; +;; Copyright 2002, Greg Beaver +;; +;; WARNING: do not change the name of any command-line parameters, phpDocumentor will ignore them + +[Parse Data] +;; title of all the documentation +;; legal values: any string +title = PHPMailer Documentation + +;; parse files that start with a . like .bash_profile +;; legal values: true, false +hidden = false + +;; show elements marked @access private in documentation by setting this to on +;; legal values: on, off +parseprivate = on + +;; parse with javadoc-like description (first sentence is always the short description) +;; legal values: on, off +javadocdesc = off + +;; add any custom @tags separated by commas here +;; legal values: any legal tagname separated by commas. +;customtags = mytag1,mytag2 + +;; This is only used by the XML:DocBook/peardoc2 converter +defaultcategoryname = Documentation + +;; what is the main package? +;; legal values: alphanumeric string plus - and _ +defaultpackagename = PHPMailer + +;; output any parsing information? set to on for cron jobs +;; legal values: on +;quiet = on + +;; parse a PEAR-style repository. Do not turn this on if your project does +;; not have a parent directory named "pear" +;; legal values: on/off +;pear = on + +;; where should the documentation be written? +;; legal values: a legal path +target = ./phpdoc + +;; limit output to the specified packages, even if others are parsed +;; legal values: package names separated by commas +;packageoutput = package1,package2 + +;; comma-separated list of files to parse +;; legal values: paths separated by commas +;filename = /path/to/file1,/path/to/file2,fileincurrentdirectory +filename = *.php + +;; comma-separated list of directories to parse +;; legal values: directory paths separated by commas +;directory = /path1,/path2,.,..,subdirectory +;directory = /home/jeichorn/cvs/pear +;;directory = . + +;; template base directory (the equivalent directory of /phpDocumentor) +;templatebase = /path/to/my/templates + +;; comma-separated list of files, directories or wildcards ? and * (any wildcard) to ignore +;; legal values: any wildcard strings separated by commas +;ignore = /path/to/ignore*,*list.php,myfile.php,subdirectory/ +ignore = templates_c/,*HTML/default/*,spec/,*CVS*,*.txt,docs/,phpdoc/,examples/,test/ + +;; comma-separated list of Converters to use in outputformat:Convertername:templatedirectory format +;; legal values: HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib, +;; HTML:frames:earthli, +;; HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de, +;; HTML:frames:DOM/phphtmllib,HTML:frames:DOM/earthli +;; HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS +;; PDF:default:default,CHM:default:default,XML:DocBook/peardoc2:default +;;output=HTML:frames:earthli +output=HTML:Smarty:HandS + +;; turn this option on if you want highlighted source code for every file +;; legal values: on/off +sourcecode = on diff --git a/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/blank.html b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/blank.html new file mode 100644 index 00000000..79af21b2 --- /dev/null +++ b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/blank.html @@ -0,0 +1,13 @@ + + + PHPMailer version 5.0.0 + + + + +

PHPMailer version 5.0.0

+Welcome to PHPMailer!
+
+This documentation was generated by phpDocumentor v1.3.0RC3
+ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/classtrees_PHPMailer.html b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/classtrees_PHPMailer.html new file mode 100644 index 00000000..00eb8b87 --- /dev/null +++ b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/classtrees_PHPMailer.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + +

+ +

+

Root class PHPMailer

+ + +

Root class phpmailerException

+ + +

Root class POP3

+ + +

Root class SMTP

+ + +

+ Documentation generated on Thu, 02 Apr 2009 17:51:23 -0400 by phpDocumentor 1.3.0RC3 +

+ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/elementindex.html b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/elementindex.html new file mode 100644 index 00000000..744ad66b --- /dev/null +++ b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/elementindex.html @@ -0,0 +1,1152 @@ + + + + + + + + + + + +

Full index

+

Package indexes

+ +
+
+ a + b + c + d + e + f + g + h + i + l + m + p + q + r + s + t + u + v + w + _ +
+ + +
+
a
+ +
+
+
+
+ $AltBody +
+
+
PHPMailer::$AltBody in class.phpmailer.php
+
Sets the text-only body of the message. This automatically sets the email to multipart/alternative. This body can be read by mail clients that do not have HTML email capability such as mutt. Clients that can read HTML will view the normal Body.
+
+
+ AddAddress +
+
+
PHPMailer::AddAddress() in class.phpmailer.php
+
Adds a "To" address.
+
+
+ AddAttachment +
+
+
PHPMailer::AddAttachment() in class.phpmailer.php
+
Adds an attachment from a path on the filesystem.
+
+
+ AddBCC +
+
+
PHPMailer::AddBCC() in class.phpmailer.php
+
Adds a "Bcc" address.
+
+
+ AddCC +
+
+
PHPMailer::AddCC() in class.phpmailer.php
+
Adds a "Cc" address.
+
+
+ AddCustomHeader +
+
+
PHPMailer::AddCustomHeader() in class.phpmailer.php
+
Adds a custom header.
+
+
+ AddEmbeddedImage +
+
+
PHPMailer::AddEmbeddedImage() in class.phpmailer.php
+
Adds an embedded attachment. This can include images, sounds, and just about any other document. Make sure to set the $type to an image type. For JPEG images use "image/jpeg" and for GIF images use "image/gif".
+
+
+ AddrAppend +
+
+
PHPMailer::AddrAppend() in class.phpmailer.php
+
Creates recipient headers.
+
+
+ AddReplyTo +
+
+
PHPMailer::AddReplyTo() in class.phpmailer.php
+
Adds a "Reply-to" address.
+
+
+ AddrFormat +
+
+
PHPMailer::AddrFormat() in class.phpmailer.php
+
Formats an address correctly.
+
+
+ AddStringAttachment +
+
+
PHPMailer::AddStringAttachment() in class.phpmailer.php
+
Adds a string or binary attachment (non-filesystem) to the list.
+
+
+ Authenticate +
+
+
SMTP::Authenticate() in class.smtp.php
+
Performs SMTP authentication. Must be run after running the Hello() method. Returns true if successfully authenticated.
+
+
+ Authorise +
+
+
POP3::Authorise() in class.pop3.php
+
Combination of public events - connect, login, disconnect
+
+
+ +
+
b
+ +
+
+
+
+ $Body +
+
+
PHPMailer::$Body in class.phpmailer.php
+
Sets the Body of the message. This can be either an HTML or text body.
+
+
+ Base64EncodeWrapMB +
+
+
PHPMailer::Base64EncodeWrapMB() in class.phpmailer.php
+
Correctly encodes and wraps long multibyte strings for mail headers without breaking lines within a character.
+
+
+ +
+
c
+ +
+
+
+
+ $CharSet +
+
+
PHPMailer::$CharSet in class.phpmailer.php
+
Sets the CharSet of the message.
+
+
+ $ConfirmReadingTo +
+
+
PHPMailer::$ConfirmReadingTo in class.phpmailer.php
+
Sets the email address that a reading confirmation will be sent.
+
+
+ $ContentType +
+
+
PHPMailer::$ContentType in class.phpmailer.php
+
Sets the Content-type of the message.
+
+
+ $CRLF +
+
+
POP3::$CRLF in class.pop3.php
+
POP3 Carriage Return + Line Feed
+
+
+ $CRLF +
+
+
SMTP::$CRLF in class.smtp.php
+
SMTP reply line ending
+
+
+ class.phpmailer.php +
+
+
class.phpmailer.php in class.phpmailer.php
+
+
+ class.pop3.php +
+
+
class.pop3.php in class.pop3.php
+
+
+ class.smtp.php +
+
+
class.smtp.php in class.smtp.php
+
+
+ ClearAddresses +
+
+
PHPMailer::ClearAddresses() in class.phpmailer.php
+
Clears all recipients assigned in the TO array. Returns void.
+
+
+ ClearAllRecipients +
+
+
PHPMailer::ClearAllRecipients() in class.phpmailer.php
+
Clears all recipients assigned in the TO, CC and BCC array. Returns void.
+
+
+ ClearAttachments +
+
+
PHPMailer::ClearAttachments() in class.phpmailer.php
+
Clears all previously set filesystem, string, and binary attachments. Returns void.
+
+
+ ClearBCCs +
+
+
PHPMailer::ClearBCCs() in class.phpmailer.php
+
Clears all recipients assigned in the BCC array. Returns void.
+
+
+ ClearCCs +
+
+
PHPMailer::ClearCCs() in class.phpmailer.php
+
Clears all recipients assigned in the CC array. Returns void.
+
+
+ ClearCustomHeaders +
+
+
PHPMailer::ClearCustomHeaders() in class.phpmailer.php
+
Clears all custom headers. Returns void.
+
+
+ ClearReplyTos +
+
+
PHPMailer::ClearReplyTos() in class.phpmailer.php
+
Clears all recipients assigned in the ReplyTo array. Returns void.
+
+
+ Close +
+
+
SMTP::Close() in class.smtp.php
+
Closes the socket and cleans up the state of the class.
+
+
+ Connect +
+
+
POP3::Connect() in class.pop3.php
+
Connect to the POP3 server
+
+
+ Connect +
+
+
SMTP::Connect() in class.smtp.php
+
Connect to the server specified on the port specified.
+
+
+ Connected +
+
+
SMTP::Connected() in class.smtp.php
+
Returns true if connected to a server otherwise false
+
+
+ CreateBody +
+
+
PHPMailer::CreateBody() in class.phpmailer.php
+
Assembles the message body. Returns an empty string on failure.
+
+
+ CreateHeader +
+
+
PHPMailer::CreateHeader() in class.phpmailer.php
+
Assembles message header.
+
+
+ +
+
d
+ +
+
+
+
+ $do_debug +
+
+
POP3::$do_debug in class.pop3.php
+
Displaying Debug warnings? (0 = now, 1+ = yes)
+
+
+ $do_debug +
+
+
SMTP::$do_debug in class.smtp.php
+
Sets whether debugging is turned on
+
+
+ $do_verp +
+
+
SMTP::$do_verp in class.smtp.php
+
Sets VERP use on/off (default is off)
+
+
+ Data +
+
+
SMTP::Data() in class.smtp.php
+
Issues a data command and sends the msg_data to the server
+
+
+ Disconnect +
+
+
POP3::Disconnect() in class.pop3.php
+
Disconnect from the POP3 server
+
+
+ +
+
e
+ +
+
+
+
+ $Encoding +
+
+
PHPMailer::$Encoding in class.phpmailer.php
+
Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".
+
+
+ $ErrorInfo +
+
+
PHPMailer::$ErrorInfo in class.phpmailer.php
+
Holds the most recent mailer error message.
+
+
+ EncodeHeader +
+
+
PHPMailer::EncodeHeader() in class.phpmailer.php
+
Encode a header string to best (shortest) of Q, B, quoted or none.
+
+
+ EncodeQ +
+
+
PHPMailer::EncodeQ() in class.phpmailer.php
+
Encode string to q encoding.
+
+
+ EncodeQP +
+
+
PHPMailer::EncodeQP() in class.phpmailer.php
+
Encode string to RFC2045 (6.7) quoted-printable format
+
+
+ EncodeQPphp +
+
+
PHPMailer::EncodeQPphp() in class.phpmailer.php
+
Encode string to quoted-printable.
+
+
+ EncodeString +
+
+
PHPMailer::EncodeString() in class.phpmailer.php
+
Encodes string to requested format.
+
+
+ errorMessage +
+
+
phpmailerException::errorMessage() in class.phpmailer.php
+
+
+ VERSION +
+
+
PHPMailer::VERSION in class.phpmailer.php
+
+
+ +
+
f
+ +
+
+
+
+ $From +
+
+
PHPMailer::$From in class.phpmailer.php
+
Sets the From email address for the message.
+
+
+ $FromName +
+
+
PHPMailer::$FromName in class.phpmailer.php
+
Sets the From name of the message.
+
+
+ +
+
g
+ +
+
+
+
+ GetAttachments +
+
+
PHPMailer::GetAttachments() in class.phpmailer.php
+
Return the current array of attachments
+
+
+ getError +
+
+
SMTP::getError() in class.smtp.php
+
Get the current error
+
+
+ GetMailMIME +
+
+
PHPMailer::GetMailMIME() in class.phpmailer.php
+
Returns the message MIME.
+
+
+ GetTranslations +
+
+
PHPMailer::GetTranslations() in class.phpmailer.php
+
Return the current array of language strings
+
+
+ +
+
h
+ +
+
+
+
+ $Helo +
+
+
PHPMailer::$Helo in class.phpmailer.php
+
Sets the SMTP HELO of the message (Default is $Hostname).
+
+
+ $Host +
+
+
PHPMailer::$Host in class.phpmailer.php
+
Sets the SMTP hosts. All hosts must be separated by a semicolon. You can also specify a different port for each host by using this format: [hostname:port] (e.g. "smtp1.example.com:25;smtp2.example.com").
+
+
+ $host +
+
+
POP3::$host in class.pop3.php
+
POP3 Mail Server
+
+
+ $Hostname +
+
+
PHPMailer::$Hostname in class.phpmailer.php
+
Sets the hostname to use in Message-Id and Received headers and as default HELO string. If empty, the value returned by SERVER_NAME is used or 'localhost.localdomain'.
+
+
+ HasMultiBytes +
+
+
PHPMailer::HasMultiBytes() in class.phpmailer.php
+
Checks if a string contains multibyte characters.
+
+
+ HeaderLine +
+
+
PHPMailer::HeaderLine() in class.phpmailer.php
+
Returns a formatted header line.
+
+
+ Hello +
+
+
SMTP::Hello() in class.smtp.php
+
Sends the HELO command to the smtp server.
+
+
+ +
+
i
+ +
+
+
+
+ InlineImageExists +
+
+
PHPMailer::InlineImageExists() in class.phpmailer.php
+
Returns true if an inline attachment is present.
+
+
+ IsError +
+
+
PHPMailer::IsError() in class.phpmailer.php
+
Returns true if an error occurred.
+
+
+ IsHTML +
+
+
PHPMailer::IsHTML() in class.phpmailer.php
+
Sets message type to HTML.
+
+
+ IsMail +
+
+
PHPMailer::IsMail() in class.phpmailer.php
+
Sets Mailer to send message using PHP mail() function.
+
+
+ IsQmail +
+
+
PHPMailer::IsQmail() in class.phpmailer.php
+
Sets Mailer to send message using the qmail MTA.
+
+
+ IsSendmail +
+
+
PHPMailer::IsSendmail() in class.phpmailer.php
+
Sets Mailer to send message using the $Sendmail program.
+
+
+ IsSMTP +
+
+
PHPMailer::IsSMTP() in class.phpmailer.php
+
Sets Mailer to send message using SMTP.
+
+
+ +
+
l
+ +
+
+
+
+ $language +
+
+
PHPMailer::$language in class.phpmailer.php
+
+
+ $LE +
+
+
PHPMailer::$LE in class.phpmailer.php
+
Provides the ability to change the line ending
+
+
+ Login +
+
+
POP3::Login() in class.pop3.php
+
Login to the POP3 server (does not support APOP yet)
+
+
+ +
+
m
+ +
+
+
+
+ $Mailer +
+
+
PHPMailer::$Mailer in class.phpmailer.php
+
Method to send mail: ("mail", "sendmail", or "smtp").
+
+
+ $MessageID +
+
+
PHPMailer::$MessageID in class.phpmailer.php
+
Sets the message ID to be used in the Message-Id header.
+
+
+ Mail +
+
+
SMTP::Mail() in class.smtp.php
+
Starts a mail transaction from the email address specified in $from. Returns true if successful or false otherwise. If True the mail transaction is started and then one or more Recipient commands may be called followed by a Data command.
+
+
+ MailSend +
+
+
PHPMailer::MailSend() in class.phpmailer.php
+
Sends mail using the PHP mail() function.
+
+
+ MsgHTML +
+
+
PHPMailer::MsgHTML() in class.phpmailer.php
+
Evaluates the message and returns modifications for inline images and backgrounds
+
+
+ +
+
p
+ +
+
+
+
+ $Password +
+
+
PHPMailer::$Password in class.phpmailer.php
+
Sets SMTP password.
+
+
+ $password +
+
+
POP3::$password in class.pop3.php
+
POP3 Password
+
+
+ $PluginDir +
+
+
PHPMailer::$PluginDir in class.phpmailer.php
+
Path to PHPMailer plugins. Useful if the SMTP class is in a different directory than the PHP include path.
+
+
+ $POP3_PORT +
+
+
POP3::$POP3_PORT in class.pop3.php
+
Default POP3 port
+
+
+ $POP3_TIMEOUT +
+
+
POP3::$POP3_TIMEOUT in class.pop3.php
+
Default Timeout
+
+
+ $port +
+
+
POP3::$port in class.pop3.php
+
POP3 Port
+
+
+ $Port +
+
+
PHPMailer::$Port in class.phpmailer.php
+
Sets the default SMTP server port.
+
+
+ $Priority +
+
+
PHPMailer::$Priority in class.phpmailer.php
+
Email priority (1 = High, 3 = Normal, 5 = low).
+
+
+ PHPMailer +
+
+
PHPMailer in class.phpmailer.php
+
PHPMailer - PHP email transport class
+
+
+ phpmailerException +
+
+
phpmailerException in class.phpmailer.php
+
+
+ POP3 +
+
+
POP3 in class.pop3.php
+
POP Before SMTP Authentication Class Version 5.0.0
+
+
+ +
+
q
+ +
+
+
+
+ Quit +
+
+
SMTP::Quit() in class.smtp.php
+
Sends the quit command to the server and then closes the socket if there is no error or the $close_on_error argument is true.
+
+
+ +
+
r
+ +
+
+
+
+ Recipient +
+
+
SMTP::Recipient() in class.smtp.php
+
Sends the command RCPT to the SMTP server with the TO: argument of $to.
+
+
+ Reset +
+
+
SMTP::Reset() in class.smtp.php
+
Sends the RSET command to abort and transaction that is currently in progress. Returns true if successful false otherwise.
+
+
+ RFCDate +
+
+
PHPMailer::RFCDate() in class.phpmailer.php
+
Returns the proper RFC 822 formatted date.
+
+
+ +
+
s
+ +
+
+
+
+ $Sender +
+
+
PHPMailer::$Sender in class.phpmailer.php
+
Sets the Sender email (Return-Path) of the message. If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
+
+
+ $Sendmail +
+
+
PHPMailer::$Sendmail in class.phpmailer.php
+
Sets the path of the sendmail program.
+
+
+ $SingleTo +
+
+
PHPMailer::$SingleTo in class.phpmailer.php
+
Provides the ability to have the TO field process individual
+
+
+ $SMTPAuth +
+
+
PHPMailer::$SMTPAuth in class.phpmailer.php
+
Sets SMTP authentication. Utilizes the Username and Password variables.
+
+
+ $SMTPDebug +
+
+
PHPMailer::$SMTPDebug in class.phpmailer.php
+
Sets SMTP class debugging on or off.
+
+
+ $SMTPKeepAlive +
+
+
PHPMailer::$SMTPKeepAlive in class.phpmailer.php
+
Prevents the SMTP connection from being closed after each mail sending. If this is set to true then to close the connection requires an explicit call to SmtpClose().
+
+
+ $SMTPSecure +
+
+
PHPMailer::$SMTPSecure in class.phpmailer.php
+
Sets connection prefix.
+
+
+ $SMTP_PORT +
+
+
SMTP::$SMTP_PORT in class.smtp.php
+
SMTP server port
+
+
+ $Subject +
+
+
PHPMailer::$Subject in class.phpmailer.php
+
Sets the Subject of the message.
+
+
+ SecureHeader +
+
+
PHPMailer::SecureHeader() in class.phpmailer.php
+
Strips newlines to prevent header injection.
+
+
+ Send +
+
+
PHPMailer::Send() in class.phpmailer.php
+
Creates message and assigns Mailer. If the message is not sent successfully then it returns false. Use the ErrorInfo variable to view description of the error.
+
+
+ SendAndMail +
+
+
SMTP::SendAndMail() in class.smtp.php
+
Starts a mail transaction from the email address specified in
+
+
+ SendmailSend +
+
+
PHPMailer::SendmailSend() in class.phpmailer.php
+
Sends mail using the $Sendmail program.
+
+
+ set +
+
+
PHPMailer::set() in class.phpmailer.php
+
Set (or reset) Class Objects (variables)
+
+
+ SetError +
+
+
PHPMailer::SetError() in class.phpmailer.php
+
Adds the error message to the error container.
+
+
+ SetFrom +
+
+
PHPMailer::SetFrom() in class.phpmailer.php
+
Set the From and FromName properties
+
+
+ SetLanguage +
+
+
PHPMailer::SetLanguage() in class.phpmailer.php
+
Sets the language for all class error messages.
+
+
+ SetWordWrap +
+
+
PHPMailer::SetWordWrap() in class.phpmailer.php
+
Set the body wrapping.
+
+
+ Sign +
+
+
PHPMailer::Sign() in class.phpmailer.php
+
Set the private key file and password to sign the message.
+
+
+ SMTP +
+
+
SMTP in class.smtp.php
+
SMTP is rfc 821 compliant and implements all the rfc 821 SMTP commands except TURN which will always return a not implemented error. SMTP also provides some utility methods for sending mail to an SMTP server.
+
+
+ SmtpClose +
+
+
PHPMailer::SmtpClose() in class.phpmailer.php
+
Closes the active SMTP session if one exists.
+
+
+ SmtpConnect +
+
+
PHPMailer::SmtpConnect() in class.phpmailer.php
+
Initiates a connection to an SMTP server.
+
+
+ SmtpSend +
+
+
PHPMailer::SmtpSend() in class.phpmailer.php
+
Sends mail via SMTP using PhpSMTP Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
+
+
+ StartTLS +
+
+
SMTP::StartTLS() in class.smtp.php
+
Initiate a TLS communication with the server.
+
+
+ +
+
t
+ +
+
+
+
+ $Timeout +
+
+
PHPMailer::$Timeout in class.phpmailer.php
+
Sets the SMTP server timeout in seconds.
+
+
+ $tval +
+
+
POP3::$tval in class.pop3.php
+
POP3 Timeout Value
+
+
+ STOP_CONTINUE +
+
+
PHPMailer::STOP_CONTINUE in class.phpmailer.php
+
+
+ STOP_CRITICAL +
+
+
PHPMailer::STOP_CRITICAL in class.phpmailer.php
+
+
+ STOP_MESSAGE +
+
+
PHPMailer::STOP_MESSAGE in class.phpmailer.php
+
+
+ TextLine +
+
+
PHPMailer::TextLine() in class.phpmailer.php
+
Returns a formatted mail line.
+
+
+ Turn +
+
+
SMTP::Turn() in class.smtp.php
+
This is an optional command for SMTP that this class does not support. This method is here to make the RFC821 Definition complete for this class and __may__ be implimented in the future
+
+
+ +
+
u
+ +
+
+
+
+ $Username +
+
+
PHPMailer::$Username in class.phpmailer.php
+
Sets SMTP username.
+
+
+ $username +
+
+
POP3::$username in class.pop3.php
+
POP3 Username
+
+
+ UTF8CharBoundary +
+
+
PHPMailer::UTF8CharBoundary() in class.phpmailer.php
+
Finds last character boundary prior to maxLength in a utf-8 quoted (printable) encoded string.
+
+
+ +
+
v
+ +
+
+
+
+ ValidateAddress +
+
+
PHPMailer::ValidateAddress() in class.phpmailer.php
+
Check that a string looks roughly like an email address should
+
+
+ +
+
w
+ +
+
+
+
+ $WordWrap +
+
+
PHPMailer::$WordWrap in class.phpmailer.php
+
Sets word wrapping on the body of the message to a given number of characters.
+
+
+ WrapText +
+
+
PHPMailer::WrapText() in class.phpmailer.php
+
Wraps message for use with mailers that do not automatically perform wrapping and for quoted-printable.
+
+
+ +
+
_
+ +
+
+
+
+ _mime_types +
+
+
PHPMailer::_mime_types() in class.phpmailer.php
+
Gets the MIME type of the embedded or inline image
+
+
+ __construct +
+
+
SMTP::__construct() in class.smtp.php
+
Initialize the class so that the data is in a known state.
+
+
+ __construct +
+
+
POP3::__construct() in class.pop3.php
+
Constructor, sets the initial values
+
+
+ __construct +
+
+
PHPMailer::__construct() in class.phpmailer.php
+
Constructor
+
+
+ +
+ a + b + c + d + e + f + g + h + i + l + m + p + q + r + s + t + u + v + w + _ +
+ \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/elementindex_PHPMailer.html b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/elementindex_PHPMailer.html new file mode 100644 index 00000000..c99461ba --- /dev/null +++ b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/elementindex_PHPMailer.html @@ -0,0 +1,1149 @@ + + + + + + + + + + + +

[PHPMailer] element index

+All elements +
+
+ a + b + c + d + e + f + g + h + i + l + m + p + q + r + s + t + u + v + w + _ +
+ + +
+
_
+ +
+
+
+
+ _mime_types +
+
+
PHPMailer::_mime_types() in class.phpmailer.php
+
Gets the MIME type of the embedded or inline image
+
+
+ __construct +
+
+
SMTP::__construct() in class.smtp.php
+
Initialize the class so that the data is in a known state.
+
+
+ __construct +
+
+
POP3::__construct() in class.pop3.php
+
Constructor, sets the initial values
+
+
+ __construct +
+
+
PHPMailer::__construct() in class.phpmailer.php
+
Constructor
+
+
+ +
+
a
+ +
+
+
+
+ $AltBody +
+
+
PHPMailer::$AltBody in class.phpmailer.php
+
Sets the text-only body of the message. This automatically sets the email to multipart/alternative. This body can be read by mail clients that do not have HTML email capability such as mutt. Clients that can read HTML will view the normal Body.
+
+
+ AddAddress +
+
+
PHPMailer::AddAddress() in class.phpmailer.php
+
Adds a "To" address.
+
+
+ AddAttachment +
+
+
PHPMailer::AddAttachment() in class.phpmailer.php
+
Adds an attachment from a path on the filesystem.
+
+
+ AddBCC +
+
+
PHPMailer::AddBCC() in class.phpmailer.php
+
Adds a "Bcc" address.
+
+
+ AddCC +
+
+
PHPMailer::AddCC() in class.phpmailer.php
+
Adds a "Cc" address.
+
+
+ AddCustomHeader +
+
+
PHPMailer::AddCustomHeader() in class.phpmailer.php
+
Adds a custom header.
+
+
+ AddEmbeddedImage +
+
+
PHPMailer::AddEmbeddedImage() in class.phpmailer.php
+
Adds an embedded attachment. This can include images, sounds, and just about any other document. Make sure to set the $type to an image type. For JPEG images use "image/jpeg" and for GIF images use "image/gif".
+
+
+ AddrAppend +
+
+
PHPMailer::AddrAppend() in class.phpmailer.php
+
Creates recipient headers.
+
+
+ AddReplyTo +
+
+
PHPMailer::AddReplyTo() in class.phpmailer.php
+
Adds a "Reply-to" address.
+
+
+ AddrFormat +
+
+
PHPMailer::AddrFormat() in class.phpmailer.php
+
Formats an address correctly.
+
+
+ AddStringAttachment +
+
+
PHPMailer::AddStringAttachment() in class.phpmailer.php
+
Adds a string or binary attachment (non-filesystem) to the list.
+
+
+ Authenticate +
+
+
SMTP::Authenticate() in class.smtp.php
+
Performs SMTP authentication. Must be run after running the Hello() method. Returns true if successfully authenticated.
+
+
+ Authorise +
+
+
POP3::Authorise() in class.pop3.php
+
Combination of public events - connect, login, disconnect
+
+
+ +
+
b
+ +
+
+
+
+ $Body +
+
+
PHPMailer::$Body in class.phpmailer.php
+
Sets the Body of the message. This can be either an HTML or text body.
+
+
+ Base64EncodeWrapMB +
+
+
PHPMailer::Base64EncodeWrapMB() in class.phpmailer.php
+
Correctly encodes and wraps long multibyte strings for mail headers without breaking lines within a character.
+
+
+ +
+
c
+ +
+
+
+
+ $CharSet +
+
+
PHPMailer::$CharSet in class.phpmailer.php
+
Sets the CharSet of the message.
+
+
+ $ConfirmReadingTo +
+
+
PHPMailer::$ConfirmReadingTo in class.phpmailer.php
+
Sets the email address that a reading confirmation will be sent.
+
+
+ $ContentType +
+
+
PHPMailer::$ContentType in class.phpmailer.php
+
Sets the Content-type of the message.
+
+
+ $CRLF +
+
+
POP3::$CRLF in class.pop3.php
+
POP3 Carriage Return + Line Feed
+
+
+ $CRLF +
+
+
SMTP::$CRLF in class.smtp.php
+
SMTP reply line ending
+
+
+ class.phpmailer.php +
+
+
class.phpmailer.php in class.phpmailer.php
+
+
+ class.pop3.php +
+
+
class.pop3.php in class.pop3.php
+
+
+ class.smtp.php +
+
+
class.smtp.php in class.smtp.php
+
+
+ ClearAddresses +
+
+
PHPMailer::ClearAddresses() in class.phpmailer.php
+
Clears all recipients assigned in the TO array. Returns void.
+
+
+ ClearAllRecipients +
+
+
PHPMailer::ClearAllRecipients() in class.phpmailer.php
+
Clears all recipients assigned in the TO, CC and BCC array. Returns void.
+
+
+ ClearAttachments +
+
+
PHPMailer::ClearAttachments() in class.phpmailer.php
+
Clears all previously set filesystem, string, and binary attachments. Returns void.
+
+
+ ClearBCCs +
+
+
PHPMailer::ClearBCCs() in class.phpmailer.php
+
Clears all recipients assigned in the BCC array. Returns void.
+
+
+ ClearCCs +
+
+
PHPMailer::ClearCCs() in class.phpmailer.php
+
Clears all recipients assigned in the CC array. Returns void.
+
+
+ ClearCustomHeaders +
+
+
PHPMailer::ClearCustomHeaders() in class.phpmailer.php
+
Clears all custom headers. Returns void.
+
+
+ ClearReplyTos +
+
+
PHPMailer::ClearReplyTos() in class.phpmailer.php
+
Clears all recipients assigned in the ReplyTo array. Returns void.
+
+
+ Close +
+
+
SMTP::Close() in class.smtp.php
+
Closes the socket and cleans up the state of the class.
+
+
+ Connect +
+
+
POP3::Connect() in class.pop3.php
+
Connect to the POP3 server
+
+
+ Connect +
+
+
SMTP::Connect() in class.smtp.php
+
Connect to the server specified on the port specified.
+
+
+ Connected +
+
+
SMTP::Connected() in class.smtp.php
+
Returns true if connected to a server otherwise false
+
+
+ CreateBody +
+
+
PHPMailer::CreateBody() in class.phpmailer.php
+
Assembles the message body. Returns an empty string on failure.
+
+
+ CreateHeader +
+
+
PHPMailer::CreateHeader() in class.phpmailer.php
+
Assembles message header.
+
+
+ +
+
d
+ +
+
+
+
+ $do_debug +
+
+
POP3::$do_debug in class.pop3.php
+
Displaying Debug warnings? (0 = now, 1+ = yes)
+
+
+ $do_debug +
+
+
SMTP::$do_debug in class.smtp.php
+
Sets whether debugging is turned on
+
+
+ $do_verp +
+
+
SMTP::$do_verp in class.smtp.php
+
Sets VERP use on/off (default is off)
+
+
+ Data +
+
+
SMTP::Data() in class.smtp.php
+
Issues a data command and sends the msg_data to the server
+
+
+ Disconnect +
+
+
POP3::Disconnect() in class.pop3.php
+
Disconnect from the POP3 server
+
+
+ +
+
e
+ +
+
+
+
+ $Encoding +
+
+
PHPMailer::$Encoding in class.phpmailer.php
+
Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".
+
+
+ $ErrorInfo +
+
+
PHPMailer::$ErrorInfo in class.phpmailer.php
+
Holds the most recent mailer error message.
+
+
+ EncodeHeader +
+
+
PHPMailer::EncodeHeader() in class.phpmailer.php
+
Encode a header string to best (shortest) of Q, B, quoted or none.
+
+
+ EncodeQ +
+
+
PHPMailer::EncodeQ() in class.phpmailer.php
+
Encode string to q encoding.
+
+
+ EncodeQP +
+
+
PHPMailer::EncodeQP() in class.phpmailer.php
+
Encode string to RFC2045 (6.7) quoted-printable format
+
+
+ EncodeQPphp +
+
+
PHPMailer::EncodeQPphp() in class.phpmailer.php
+
Encode string to quoted-printable.
+
+
+ EncodeString +
+
+
PHPMailer::EncodeString() in class.phpmailer.php
+
Encodes string to requested format.
+
+
+ errorMessage +
+
+
phpmailerException::errorMessage() in class.phpmailer.php
+
+
+ VERSION +
+
+
PHPMailer::VERSION in class.phpmailer.php
+
+
+ +
+
f
+ +
+
+
+
+ $From +
+
+
PHPMailer::$From in class.phpmailer.php
+
Sets the From email address for the message.
+
+
+ $FromName +
+
+
PHPMailer::$FromName in class.phpmailer.php
+
Sets the From name of the message.
+
+
+ +
+
g
+ +
+
+
+
+ GetAttachments +
+
+
PHPMailer::GetAttachments() in class.phpmailer.php
+
Return the current array of attachments
+
+
+ getError +
+
+
SMTP::getError() in class.smtp.php
+
Get the current error
+
+
+ GetMailMIME +
+
+
PHPMailer::GetMailMIME() in class.phpmailer.php
+
Returns the message MIME.
+
+
+ GetTranslations +
+
+
PHPMailer::GetTranslations() in class.phpmailer.php
+
Return the current array of language strings
+
+
+ +
+
h
+ +
+
+
+
+ $Helo +
+
+
PHPMailer::$Helo in class.phpmailer.php
+
Sets the SMTP HELO of the message (Default is $Hostname).
+
+
+ $Host +
+
+
PHPMailer::$Host in class.phpmailer.php
+
Sets the SMTP hosts. All hosts must be separated by a semicolon. You can also specify a different port for each host by using this format: [hostname:port] (e.g. "smtp1.example.com:25;smtp2.example.com").
+
+
+ $host +
+
+
POP3::$host in class.pop3.php
+
POP3 Mail Server
+
+
+ $Hostname +
+
+
PHPMailer::$Hostname in class.phpmailer.php
+
Sets the hostname to use in Message-Id and Received headers and as default HELO string. If empty, the value returned by SERVER_NAME is used or 'localhost.localdomain'.
+
+
+ HasMultiBytes +
+
+
PHPMailer::HasMultiBytes() in class.phpmailer.php
+
Checks if a string contains multibyte characters.
+
+
+ HeaderLine +
+
+
PHPMailer::HeaderLine() in class.phpmailer.php
+
Returns a formatted header line.
+
+
+ Hello +
+
+
SMTP::Hello() in class.smtp.php
+
Sends the HELO command to the smtp server.
+
+
+ +
+
i
+ +
+
+
+
+ InlineImageExists +
+
+
PHPMailer::InlineImageExists() in class.phpmailer.php
+
Returns true if an inline attachment is present.
+
+
+ IsError +
+
+
PHPMailer::IsError() in class.phpmailer.php
+
Returns true if an error occurred.
+
+
+ IsHTML +
+
+
PHPMailer::IsHTML() in class.phpmailer.php
+
Sets message type to HTML.
+
+
+ IsMail +
+
+
PHPMailer::IsMail() in class.phpmailer.php
+
Sets Mailer to send message using PHP mail() function.
+
+
+ IsQmail +
+
+
PHPMailer::IsQmail() in class.phpmailer.php
+
Sets Mailer to send message using the qmail MTA.
+
+
+ IsSendmail +
+
+
PHPMailer::IsSendmail() in class.phpmailer.php
+
Sets Mailer to send message using the $Sendmail program.
+
+
+ IsSMTP +
+
+
PHPMailer::IsSMTP() in class.phpmailer.php
+
Sets Mailer to send message using SMTP.
+
+
+ +
+
l
+ +
+
+
+
+ $language +
+
+
PHPMailer::$language in class.phpmailer.php
+
+
+ $LE +
+
+
PHPMailer::$LE in class.phpmailer.php
+
Provides the ability to change the line ending
+
+
+ Login +
+
+
POP3::Login() in class.pop3.php
+
Login to the POP3 server (does not support APOP yet)
+
+
+ +
+
m
+ +
+
+
+
+ $Mailer +
+
+
PHPMailer::$Mailer in class.phpmailer.php
+
Method to send mail: ("mail", "sendmail", or "smtp").
+
+
+ $MessageID +
+
+
PHPMailer::$MessageID in class.phpmailer.php
+
Sets the message ID to be used in the Message-Id header.
+
+
+ Mail +
+
+
SMTP::Mail() in class.smtp.php
+
Starts a mail transaction from the email address specified in $from. Returns true if successful or false otherwise. If True the mail transaction is started and then one or more Recipient commands may be called followed by a Data command.
+
+
+ MailSend +
+
+
PHPMailer::MailSend() in class.phpmailer.php
+
Sends mail using the PHP mail() function.
+
+
+ MsgHTML +
+
+
PHPMailer::MsgHTML() in class.phpmailer.php
+
Evaluates the message and returns modifications for inline images and backgrounds
+
+
+ +
+
p
+ +
+
+
+
+ $Password +
+
+
PHPMailer::$Password in class.phpmailer.php
+
Sets SMTP password.
+
+
+ $password +
+
+
POP3::$password in class.pop3.php
+
POP3 Password
+
+
+ $PluginDir +
+
+
PHPMailer::$PluginDir in class.phpmailer.php
+
Path to PHPMailer plugins. Useful if the SMTP class is in a different directory than the PHP include path.
+
+
+ $POP3_PORT +
+
+
POP3::$POP3_PORT in class.pop3.php
+
Default POP3 port
+
+
+ $POP3_TIMEOUT +
+
+
POP3::$POP3_TIMEOUT in class.pop3.php
+
Default Timeout
+
+
+ $port +
+
+
POP3::$port in class.pop3.php
+
POP3 Port
+
+
+ $Port +
+
+
PHPMailer::$Port in class.phpmailer.php
+
Sets the default SMTP server port.
+
+
+ $Priority +
+
+
PHPMailer::$Priority in class.phpmailer.php
+
Email priority (1 = High, 3 = Normal, 5 = low).
+
+
+ PHPMailer +
+
+
PHPMailer in class.phpmailer.php
+
PHPMailer - PHP email transport class
+
+
+ phpmailerException +
+
+
phpmailerException in class.phpmailer.php
+
+
+ POP3 +
+
+
POP3 in class.pop3.php
+
POP Before SMTP Authentication Class Version 5.0.0
+
+
+ +
+
q
+ +
+
+
+
+ Quit +
+
+
SMTP::Quit() in class.smtp.php
+
Sends the quit command to the server and then closes the socket if there is no error or the $close_on_error argument is true.
+
+
+ +
+
r
+ +
+
+
+
+ Recipient +
+
+
SMTP::Recipient() in class.smtp.php
+
Sends the command RCPT to the SMTP server with the TO: argument of $to.
+
+
+ Reset +
+
+
SMTP::Reset() in class.smtp.php
+
Sends the RSET command to abort and transaction that is currently in progress. Returns true if successful false otherwise.
+
+
+ RFCDate +
+
+
PHPMailer::RFCDate() in class.phpmailer.php
+
Returns the proper RFC 822 formatted date.
+
+
+ +
+
s
+ +
+
+
+
+ $Sender +
+
+
PHPMailer::$Sender in class.phpmailer.php
+
Sets the Sender email (Return-Path) of the message. If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
+
+
+ $Sendmail +
+
+
PHPMailer::$Sendmail in class.phpmailer.php
+
Sets the path of the sendmail program.
+
+
+ $SingleTo +
+
+
PHPMailer::$SingleTo in class.phpmailer.php
+
Provides the ability to have the TO field process individual
+
+
+ $SMTPAuth +
+
+
PHPMailer::$SMTPAuth in class.phpmailer.php
+
Sets SMTP authentication. Utilizes the Username and Password variables.
+
+
+ $SMTPDebug +
+
+
PHPMailer::$SMTPDebug in class.phpmailer.php
+
Sets SMTP class debugging on or off.
+
+
+ $SMTPKeepAlive +
+
+
PHPMailer::$SMTPKeepAlive in class.phpmailer.php
+
Prevents the SMTP connection from being closed after each mail sending. If this is set to true then to close the connection requires an explicit call to SmtpClose().
+
+
+ $SMTPSecure +
+
+
PHPMailer::$SMTPSecure in class.phpmailer.php
+
Sets connection prefix.
+
+
+ $SMTP_PORT +
+
+
SMTP::$SMTP_PORT in class.smtp.php
+
SMTP server port
+
+
+ $Subject +
+
+
PHPMailer::$Subject in class.phpmailer.php
+
Sets the Subject of the message.
+
+
+ SecureHeader +
+
+
PHPMailer::SecureHeader() in class.phpmailer.php
+
Strips newlines to prevent header injection.
+
+
+ Send +
+
+
PHPMailer::Send() in class.phpmailer.php
+
Creates message and assigns Mailer. If the message is not sent successfully then it returns false. Use the ErrorInfo variable to view description of the error.
+
+
+ SendAndMail +
+
+
SMTP::SendAndMail() in class.smtp.php
+
Starts a mail transaction from the email address specified in
+
+
+ SendmailSend +
+
+
PHPMailer::SendmailSend() in class.phpmailer.php
+
Sends mail using the $Sendmail program.
+
+
+ set +
+
+
PHPMailer::set() in class.phpmailer.php
+
Set (or reset) Class Objects (variables)
+
+
+ SetError +
+
+
PHPMailer::SetError() in class.phpmailer.php
+
Adds the error message to the error container.
+
+
+ SetFrom +
+
+
PHPMailer::SetFrom() in class.phpmailer.php
+
Set the From and FromName properties
+
+
+ SetLanguage +
+
+
PHPMailer::SetLanguage() in class.phpmailer.php
+
Sets the language for all class error messages.
+
+
+ SetWordWrap +
+
+
PHPMailer::SetWordWrap() in class.phpmailer.php
+
Set the body wrapping.
+
+
+ Sign +
+
+
PHPMailer::Sign() in class.phpmailer.php
+
Set the private key file and password to sign the message.
+
+
+ SMTP +
+
+
SMTP in class.smtp.php
+
SMTP is rfc 821 compliant and implements all the rfc 821 SMTP commands except TURN which will always return a not implemented error. SMTP also provides some utility methods for sending mail to an SMTP server.
+
+
+ SmtpClose +
+
+
PHPMailer::SmtpClose() in class.phpmailer.php
+
Closes the active SMTP session if one exists.
+
+
+ SmtpConnect +
+
+
PHPMailer::SmtpConnect() in class.phpmailer.php
+
Initiates a connection to an SMTP server.
+
+
+ SmtpSend +
+
+
PHPMailer::SmtpSend() in class.phpmailer.php
+
Sends mail via SMTP using PhpSMTP Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
+
+
+ StartTLS +
+
+
SMTP::StartTLS() in class.smtp.php
+
Initiate a TLS communication with the server.
+
+
+ +
+
t
+ +
+
+
+
+ $Timeout +
+
+
PHPMailer::$Timeout in class.phpmailer.php
+
Sets the SMTP server timeout in seconds.
+
+
+ $tval +
+
+
POP3::$tval in class.pop3.php
+
POP3 Timeout Value
+
+
+ STOP_CONTINUE +
+
+
PHPMailer::STOP_CONTINUE in class.phpmailer.php
+
+
+ STOP_CRITICAL +
+
+
PHPMailer::STOP_CRITICAL in class.phpmailer.php
+
+
+ STOP_MESSAGE +
+
+
PHPMailer::STOP_MESSAGE in class.phpmailer.php
+
+
+ TextLine +
+
+
PHPMailer::TextLine() in class.phpmailer.php
+
Returns a formatted mail line.
+
+
+ Turn +
+
+
SMTP::Turn() in class.smtp.php
+
This is an optional command for SMTP that this class does not support. This method is here to make the RFC821 Definition complete for this class and __may__ be implimented in the future
+
+
+ +
+
u
+ +
+
+
+
+ $Username +
+
+
PHPMailer::$Username in class.phpmailer.php
+
Sets SMTP username.
+
+
+ $username +
+
+
POP3::$username in class.pop3.php
+
POP3 Username
+
+
+ UTF8CharBoundary +
+
+
PHPMailer::UTF8CharBoundary() in class.phpmailer.php
+
Finds last character boundary prior to maxLength in a utf-8 quoted (printable) encoded string.
+
+
+ +
+
v
+ +
+
+
+
+ ValidateAddress +
+
+
PHPMailer::ValidateAddress() in class.phpmailer.php
+
Check that a string looks roughly like an email address should
+
+
+ +
+
w
+ +
+
+
+
+ $WordWrap +
+
+
PHPMailer::$WordWrap in class.phpmailer.php
+
Sets word wrapping on the body of the message to a given number of characters.
+
+
+ WrapText +
+
+
PHPMailer::WrapText() in class.phpmailer.php
+
Wraps message for use with mailers that do not automatically perform wrapping and for quoted-printable.
+
+
+ +
+ a + b + c + d + e + f + g + h + i + l + m + p + q + r + s + t + u + v + w + _ +
+ \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/index.html b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/index.html new file mode 100644 index 00000000..354f2d55 --- /dev/null +++ b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/index.html @@ -0,0 +1,24 @@ + + + + + + PHPMailer version 5.0.0 + + + + + + + + + + + <H2>Frame Alert</H2> + <P>This document is designed to be viewed using the frames feature. + If you see this message, you are using a non-frame-capable web client.</P> + + + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/li_PHPMailer.html b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/li_PHPMailer.html new file mode 100644 index 00000000..9491554b --- /dev/null +++ b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/li_PHPMailer.html @@ -0,0 +1,40 @@ + + + + + + + + + + +
PHPMailer
+
+ +
+ +
Description
+
+ Class trees
+ Index of elements
+ Todo List
+
+ + + +
Classes
+
PHPMailer
+
phpmailerException
+
POP3
+
SMTP
+
Files
+
class.phpmailer.php
+
class.pop3.php
+
class.smtp.php
+ + +
+
+

phpDocumentor v 1.3.0RC3

+ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/packages.html b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/packages.html new file mode 100644 index 00000000..fdf40b0b --- /dev/null +++ b/saf/lib/Ext/phpmailer/docs/5.0-phpdocs/packages.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/docs/Callback_function_notes.txt b/saf/lib/Ext/phpmailer/docs/Callback_function_notes.txt new file mode 100644 index 00000000..461ea508 --- /dev/null +++ b/saf/lib/Ext/phpmailer/docs/Callback_function_notes.txt @@ -0,0 +1,17 @@ +NEW CALLBACK FUNCTION: +====================== + +We have had requests for a method to process the results of sending emails +through PHPMailer. In this new release, we have implemented a callback +function that passes the results of each email sent (to, cc, and/or bcc). +We have provided an example that echos the results back to the screen. The +callback function can be used for any purpose. With minor modifications, the +callback function can be used to create CSV logs, post results to databases, +etc. + +Please review the test.php script for the example. + +It's pretty straight forward. + +Enjoy! +Andy diff --git a/saf/lib/Ext/phpmailer/docs/DomainKeys_notes.txt b/saf/lib/Ext/phpmailer/docs/DomainKeys_notes.txt new file mode 100644 index 00000000..2ad10f15 --- /dev/null +++ b/saf/lib/Ext/phpmailer/docs/DomainKeys_notes.txt @@ -0,0 +1,55 @@ +CREATE DKIM KEYS and DNS Resource Record: +========================================= + +To create DomainKeys Identified Mail keys, visit: +http://dkim.worxware.com/ +... read the information, fill in the form, and download the ZIP file +containing the public key, private key, DNS Resource Record and instructions +to add to your DNS Zone Record, and the PHPMailer code to enable DKIM +digital signing. + +/*** PROTECT YOUR PRIVATE & PUBLIC KEYS ***/ + +You need to protect your DKIM private and public keys from being viewed or +accessed. Add protection to your .htaccess file as in this example: + +# secure htkeyprivate file + + order allow,deny + deny from all + + +# secure htkeypublic file + + order allow,deny + deny from all + + +(the actual .htaccess additions are in the ZIP file sent back to you from +http://dkim.worxware.com/ + +A few notes on using DomainKey Identified Mail (DKIM): + +You do not need to use PHPMailer to DKIM sign emails IF: +- you enable DomainKey support and add the DNS resource record +- you use your outbound mail server + +If you are a third-party emailer that works on behalf of domain owners to +send their emails from your own server: +- you absolutely have to DKIM sign outbound emails +- the domain owner has to add the DNS resource record to match the + private key, public key, selector, identity, and domain that you create +- use caution with the "selector" ... at least one "selector" will already + exist in the DNS Zone Record of the domain at the domain owner's server + you need to ensure that the "selector" you use is unique +Note: since the IP address will not match the domain owner's DNS Zone record +you can be certain that email providers that validate based on DomainKey will +check the domain owner's DNS Zone record for your DNS resource record. Before +sending out emails on behalf of domain owners, ensure they have entered the +DNS resource record you provided them. + +Enjoy! +Andy + +PS. if you need additional information about DKIM, please see: +http://www.dkim.org/info/dkim-faq.html diff --git a/saf/lib/Ext/phpmailer/docs/Note_for_SMTP_debugging.txt b/saf/lib/Ext/phpmailer/docs/Note_for_SMTP_debugging.txt new file mode 100644 index 00000000..afb5b58e --- /dev/null +++ b/saf/lib/Ext/phpmailer/docs/Note_for_SMTP_debugging.txt @@ -0,0 +1,23 @@ +If you are having problems connecting or sending emails through your SMTP server, please note: + +1. The new rewrite of class.smtp.php provides more information about the processing/errors taking place +2. Use the debug functionality of class.smtp.php. To do that, in your own script add the debug level you wish to use. An example of that is: + +$mail->SMTPDebug = 1; +$mail->IsSMTP(); // telling the class to use SMTP +$mail->SMTPAuth = true; // enable SMTP authentication +$mail->Port = 26; // set the SMTP port +$mail->Host = "mail.yourhost.com"; // SMTP server +$mail->Username = "name@yourhost.com"; // SMTP account username +$mail->Password = "your password"; // SMTP account password + +Notes on this: +$mail->SMTPDebug = 0; ... will disable debugging (you can also leave this out completely, 0 is the default +$mail->SMTPDebug = 1; ... will echo errors and messages +$mail->SMTPDebug = 2; ... will echo messages only +... and finally, the options are 0, 1, and 2 ... any number greater than 2 will be interpreted as 2 + +And finally, don't forget to disable debugging before going into production. + +Enjoy! +Andy \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/docs/extending.html b/saf/lib/Ext/phpmailer/docs/extending.html index 25002aaf..310f97a3 100644 --- a/saf/lib/Ext/phpmailer/docs/extending.html +++ b/saf/lib/Ext/phpmailer/docs/extending.html @@ -20,9 +20,9 @@

1. Advanced Example

$mail = new phpmailer(); -$mail->From = "list@mydomain.com"; +$mail->From = "list@example.com"; $mail->FromName = "List manager"; -$mail->Host = "smtp1.site.com;smtp2.site.com"; +$mail->Host = "smtp1.example.com;smtp2.example.com"; $mail->Mailer = "smtp"; @MYSQL_CONNECT("localhost","root","password"); @@ -46,7 +46,7 @@

1. Advanced Example

$mail->Body = $body; $mail->AltBody = $text_body; - $mail->AddAddress($row["email"], $row["full_name"); + $mail->AddAddress($row["email"], $row["full_name"]); $mail->AddStringAttachment($row["photo"], "YourPhoto.jpg"); if(!$mail->Send()) @@ -87,9 +87,9 @@

2. Extending phpmailer

class my_phpmailer extends phpmailer { // Set default variables for all new objects - var $From = "from@email.com"; + var $From = "from@example.com"; var $FromName = "Mailer"; - var $Host = "smtp1.site.com;smtp2.site.com"; + var $Host = "smtp1.example.com;smtp2.example.com"; var $Mailer = "smtp"; // Alternative to IsSMTP() var $WordWrap = 75; @@ -126,7 +126,7 @@

2. Extending phpmailer

$mail = new my_phpmailer; // Now you only need to add the necessary stuff -$mail->AddAddress("josh@site.com", "Josh Adams"); +$mail->AddAddress("josh@example.com", "Josh Adams"); $mail->Subject = "Here is the subject"; $mail->Body = "This is the message body"; $mail->AddAttachment("c:/temp/11-10-00.zip", "new_name.zip"); // optional name diff --git a/saf/lib/Ext/phpmailer/docs/faq.html b/saf/lib/Ext/phpmailer/docs/faq.html index 283e6517..f71c6c89 100644 --- a/saf/lib/Ext/phpmailer/docs/faq.html +++ b/saf/lib/Ext/phpmailer/docs/faq.html @@ -1,66 +1,67 @@ - + -phpmailer FAQ +PHPMailer FAQ + - +
+
+

PHPMailer FAQ

+
    -

    phpmailer FAQ

    +
  • Q: I'm using the SMTP mailer and I keep on getting a timeout message + well before the X seconds I set it for. What gives?
    + A: PHP versions 4.0.4pl1 and earlier have a bug in which sockets timeout + early. You can fix this by re-compiling PHP 4.0.4pl1 with this fix: + timeoutfix.diff. Otherwise you can wait for the new PHP release.

  • -

    -I'm using the SMTP mailer and I keep on getting a timeout message -well before the X seconds I set it for. What gives? -
    -PHP versions 4.0.4pl1 and earlier have a bug in which sockets timeout -early. You can fix this by re-compiling PHP 4.0.4pl1 with this fix: -timeoutfix.diff. Otherwise you can wait -for the new PHP release. -

    +
  • Q: I am concerned that using include files will take up too much + processing time on my computer. How can I make it run faster?
    + A: PHP by itself is very fast. Much faster than ASP or JSP running on + the same type of server. This is because it has very little overhead compared + to its competitors and it pre-compiles all of + its code before it runs each script (in PHP4). However, all of + this compiling and re-compiling can take up a lot of valuable + computer resources. However, there are programs out there that compile + PHP code and store it in memory (or on mmaped files) to reduce the + processing immensely. Two of these: APC + (Alternative PHP Cache) and Afterburner + (Win32 download) + are excellent free tools that do just this. If you have the money + you might also try Zend Cache, it is + even faster than the open source varieties. All of these tools make your + scripts run faster while also reducing the load on your server. I have tried + them myself and they are quite stable too.

  • -

    -I am concerned that using include files will take up too much -processing time on my computer. How can I make it run faster? -
    -PHP by itself is very fast. Much faster than ASP or JSP running on -the same type of server. This is because it has very little overhead compared -to its competitors and it pre-compiles all of -its code before it runs each script (in PHP4). However, all of -this compiling and re-compiling can take up a lot of valuable -computer resources. However, there are programs out there that compile -PHP code and store it in memory (or on mmaped files) to reduce the -processing immensely. Two of these: APC -(Alternative PHP Cache) and Afterburner -(Win32 download) -are excellent free tools that do just this. If you have the money -you might also try Zend Cache, it is -even faster than the open source varieties. All of these tools make your -scripts run faster while also reducing the load on your server. I have tried -them myself and they are quite stable too. -

    +
  • Q: What mailer gives me the best performance?
    + A: On a single machine the sendmail (or Qmail) is fastest overall. + Next fastest is mail() to give you the best performance. Both do not have the overhead of SMTP. + If you have you have your mail server on a another machine then + SMTP is your only option, but you do get the benefit of redundant mail servers.
    + If you are running a mailing list with thousands of names, the fastest mailers in order are: SMTP, sendmail (or Qmail), mail().

  • +
  • Q: When I try to attach a file with on my server I get a + "Could not find {file} on filesystem error". Why is this?
    + A: If you are using a Unix machine this is probably because the user + running your web server does not have read access to the directory in question. If you are using Windows, + then the problem probably is that you have used single backslashes to denote directories (\). + A single backslash has a special meaning to PHP so these are not + valid. Instead use double backslashes ("\\") or a single forward + slash ("/").

  • -

    -What mailer gives me the best performance? -
    -On a single machine the mail() or sendmail mailers give you the best -performance because they do not have the added overhead of SMTP. -If you have you have your mail server on a another machine then -SMTP is your only option, but you do get the benefit of redundant -mail servers. -

    +
-

-When I try to attach a file with on my server I get a -"Could not find {file} on filesystem error". Why is this? -
-If you are using a Unix machine this is probably because the user -running your web server does not have read access to the directory -in question. If you are using Windows, then the problem probably is -that you have used single backslashes to denote directories ("\"). -A single backslash has a special meaning to PHP so these are not -valid. Instead use double backslashes ("\\") or a single forward -slash ("/"). -

+
+
- \ No newline at end of file + diff --git a/saf/lib/Ext/phpmailer/docs/pop3_article.txt b/saf/lib/Ext/phpmailer/docs/pop3_article.txt new file mode 100644 index 00000000..cc54f7c0 --- /dev/null +++ b/saf/lib/Ext/phpmailer/docs/pop3_article.txt @@ -0,0 +1,39 @@ +This is built for PHP Mailer 1.72 and was not tested with any previous version. It was developed under PHP 4.3.11 (E_ALL). It works under PHP 5 and 5.1 with E_ALL, but not in Strict mode due to var deprecation (but then neither does PHP Mailer either!). It follows the RFC 1939 standard explicitly and is fully commented. + +With that noted, here is how to implement it: +Install the class file + +I didn't want to modify the PHP Mailer classes at all, so you will have to include/require this class along with the base one. It can sit quite happily in the phpmailer-1.72 directory: +[geshi lang=php] require 'phpmailer-1.72/class.phpmailer.php'; require 'phpmailer-1.72/class.pop3.php'; [/geshi] +When you need it, create your POP3 object + +Right before I invoke PHP Mailer I activate the POP3 authorisation. POP3 before SMTP is a process whereby you login to your web hosts POP3 mail server BEFORE sending out any emails via SMTP. The POP3 logon 'verifies' your ability to send email by SMTP, which typically otherwise blocks you. On my web host (Pair Networks) a single POP3 logon is enough to 'verify' you for 90 minutes. Here is some sample PHP code that activates the POP3 logon and then sends an email via PHP Mailer: +[geshi lang=php] Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1); $mail = new PHPMailer(); $mail->SMTPDebug = 2; $mail->IsSMTP(); $mail->IsHTML(false); $mail->Host = 'relay.example.com'; $mail->From = 'mailer@example.com'; $mail->FromName = 'Example Mailer'; $mail->Subject = 'My subject'; $mail->Body = 'Hello world'; $mail->AddAddress('rich@corephp.co.uk', 'Richard Davey'); if (!$mail->Send()) { echo $mail->ErrorInfo; } ?> [/geshi] + +The PHP Mailer parts of this code should be obvious to anyone who has used PHP Mailer before. One thing to note - you almost certainly will not need to use SMTP Authentication *and* POP3 before SMTP together. The Authorisation method is a proxy method to all of the others within that class. There are Connect, Logon and Disconnect methods available, but I wrapped them in the single Authorisation one to make things easier. +The Parameters + +The Authorise parameters are as follows: +[geshi lang=php]$pop->Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);[/geshi] + + 1. pop3.example.com - The POP3 Mail Server Name (hostname or IP address) + 2. 110 - The POP3 Port on which to connect (default is usually 110, but check with your host) + 3. 30 - A connection time-out value (in seconds) + 4. mailer - The POP3 Username required to logon + 5. password - The POP3 Password required to logon + 6. 1 - The class debug level (0 = off, 1+ = debug output is echoed to the browser) + +Final Comments + the Download + +1) This class does not support APOP connections. This is only because I did not have an APOP server to test with, but if you'd like to see that added just contact me. + +2) Opening and closing lots of POP3 connections can be quite a resource/network drain. If you need to send a whole batch of emails then just perform the authentication once at the start, and then loop through your mail sending script. Providing this process doesn't take longer than the verification period lasts on your POP3 server, you should be fine. With my host that period is 90 minutes, i.e. plenty of time. + +3) If you have heavy requirements for this script (i.e. send a LOT of email on a frequent basis) then I would advise seeking out an alternative sending method (direct SMTP ideally). If this isn't possible then you could modify this class so the 'last authorised' date is recorded somewhere (MySQL, Flat file, etc) meaning you only open a new connection if the old one has expired, saving you precious overhead. + +4) There are lots of other POP3 classes for PHP available. However most of them implement the full POP3 command set, where-as this one is purely for authentication, and much lighter as a result. However using any of the other POP3 classes to just logon to your server would have the same net result. At the end of the day, use whatever method you feel most comfortable with. +Download + +Here is the full class file plus my test script: POP_before_SMTP_PHPMailer.zip (4 KB) - Please note that it does not include PHPMailer itself. + +My thanks to Chris Ryan for the inspiration (even if indirectly, via his SMTP class) diff --git a/saf/lib/Ext/phpmailer/docs/use_gmail.txt b/saf/lib/Ext/phpmailer/docs/use_gmail.txt new file mode 100644 index 00000000..7519d7d2 --- /dev/null +++ b/saf/lib/Ext/phpmailer/docs/use_gmail.txt @@ -0,0 +1,45 @@ +getFile('contents.html'); +$body = eregi_replace("[\]",'',$body); + +$mail->IsSMTP(); +$mail->SMTPAuth = true; // enable SMTP authentication +$mail->SMTPSecure = "ssl"; // sets the prefix to the servier +$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server +$mail->Port = 465; // set the SMTP port + +$mail->Username = "yourname@gmail.com"; // GMAIL username +$mail->Password = "password"; // GMAIL password + +$mail->From = "replyto@yourdomain.com"; +$mail->FromName = "Webmaster"; +$mail->Subject = "This is the subject"; +$mail->AltBody = "This is the body when user views in plain text format"; //Text Body +$mail->WordWrap = 50; // set word wrap + +$mail->MsgHTML($body); + +$mail->AddReplyTo("replyto@yourdomain.com","Webmaster"); + +$mail->AddAttachment("/path/to/file.zip"); // attachment +$mail->AddAttachment("/path/to/image.jpg", "new.jpg"); // attachment + +$mail->AddAddress("username@domain.com","First Last"); + +$mail->IsHTML(true); // send as HTML + +if(!$mail->Send()) { + echo "Mailer Error: " . $mail->ErrorInfo; +} else { + echo "Message has been sent"; +} + +?> diff --git a/saf/lib/Ext/phpmailer/examples/contents.html b/saf/lib/Ext/phpmailer/examples/contents.html new file mode 100644 index 00000000..fc4c3088 --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/contents.html @@ -0,0 +1,20 @@ + +
+

+
+ This is a test of PHPMailer.
+
+This particular example uses HTML, with a <div> tag and inline
+styles.
+
+Also note the use of the PHPMailer logo above with no specific code to handle +including it.
+Included are two attachments:
+phpmailer.gif is an attachment and used inline as a graphic (above)
+phpmailer_mini.gif is an attachment
+
+PHPMailer:
+Author: Andy Prevost (codeworxtech@users.sourceforge.net)
+Author: Marcus Bointon (coolbru@users.sourceforge.net)
+
+ diff --git a/saf/lib/Ext/phpmailer/examples/images/phpmailer.gif b/saf/lib/Ext/phpmailer/examples/images/phpmailer.gif new file mode 100644 index 00000000..5e269714 Binary files /dev/null and b/saf/lib/Ext/phpmailer/examples/images/phpmailer.gif differ diff --git a/saf/lib/Ext/phpmailer/examples/images/phpmailer_mini.gif b/saf/lib/Ext/phpmailer/examples/images/phpmailer_mini.gif new file mode 100644 index 00000000..dc7d7827 Binary files /dev/null and b/saf/lib/Ext/phpmailer/examples/images/phpmailer_mini.gif differ diff --git a/saf/lib/Ext/phpmailer/examples/index.html b/saf/lib/Ext/phpmailer/examples/index.html new file mode 100644 index 00000000..c829bbcc --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/index.html @@ -0,0 +1,49 @@ +This release of PHPMailer (v5.0.0) sets a new milestone in the development +cycle of PHPMailer. First, class.phpmailer.php has a small footprint (65.7 Kb), +while class.smtp.php is even smaller than before (at only 25.0 Kb).
+
+We have maintained all functionality and added Exception handling unique to +PHP 5/6.
+
+There is only one function that has been removed: that is getFile(). The reason +for this is that getFile() became a wrapper for the PHP function 'file_get_contents()' +and nothing more. Rather than burden the class with a function already available +in PHP, we decided to remove it.
+
+Our new Exception handling provides your own scripts far more power than ever.
+
+We have also enhanced the "packaging" of PHPMailer with an entirely new set of +examples. Included are both basic and advanced examples showing how you can take +advantage of PHP Exception handling to improve your own scripts.
+
+A few things to note about PHPMailer: +
    +
  • the use of $mail->AltBody is completely optional. If not used, PHPMailer + will use the HTML text with htmlentities().
    + We also highly recommend using HTML2Text authored by Jon Abernathy. The class description + and download can be viewed at: http://www.chuggnutt.com/html2text.php. +
  • +
  • there is no specific code to define image or attachment types ... that is handled + automatically by PHPMailer when it parses the images
  • +
+A note to users that want to use SMTP with PHPMailer. The most common problems are: +
    +
  • wrong port ... most ISP (Internet Service Providers) will not allow relaying through + their servers. If that's the case with your ISP, try using port 26. +
  • +
  • wrong authentication information (username and/or password) ... don't forget that + many servers require the account name to be in the format of the full email address. +
  • +
  • ... if these tips do not get your SMTP settings working, we have a debug mode + for helping you determine the problem. Insert this after $mail->IsSMTP();
    + $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
    + note that a setting of 2 will display all errors and messages generated by the SMTP + server
    +
  • +
+Our examples all use an HTML file in the /examples folder. To see what the email SHOULD +look like in your HTML compatible email viewer: click here
+
+From the PHPMailer team:
+Author: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net (and Project Administrator)
+Author: Marcus Bointon (coolbru) coolbru@users.sourceforge.net
diff --git a/saf/lib/Ext/phpmailer/examples/test_db_smtp_basic.php b/saf/lib/Ext/phpmailer/examples/test_db_smtp_basic.php new file mode 100644 index 00000000..9c16fb0b --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/test_db_smtp_basic.php @@ -0,0 +1,58 @@ + + +PHPMailer - MySQL Database - SMTP basic test with authentication + + + +IsSMTP(); // telling the class to use SMTP +$mail->Host = "smtp1.site.com;smtp2.site.com"; +$mail->SMTPAuth = true; // enable SMTP authentication +$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent +$mail->Host = "mail.yourdomain.com"; // sets the SMTP server +$mail->Port = 26; // set the SMTP port for the GMAIL server +$mail->Username = "yourname@yourdomain"; // SMTP account username +$mail->Password = "yourpassword"; // SMTP account password +$mail->SetFrom('list@mydomain.com', 'List manager'); +$mail->AddReplyTo('list@mydomain.com', 'List manager'); + +$mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication"; + +@MYSQL_CONNECT("localhost","root","password"); +@mysql_select_db("my_company"); +$query = "SELECT full_name, email, photo FROM employee WHERE id=$id"; +$result = @MYSQL_QUERY($query); + +while ($row = mysql_fetch_array ($result)) { + $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test + $mail->MsgHTML($body); + $mail->AddAddress($row["email"], $row["full_name"]); + $mail->AddStringAttachment($row["photo"], "YourPhoto.jpg"); + + if(!$mail->Send()) { + echo "Mailer Error (" . str_replace("@", "@", $row["email"]) . ') ' . $mail->ErrorInfo . '
'; + } else { + echo "Message sent to :" . $row["full_name"] . ' (' . str_replace("@", "@", $row["email"]) . ')
'; + } + // Clear all addresses and attachments for next loop + $mail->ClearAddresses(); + $mail->ClearAttachments(); +} +?> + + + diff --git a/saf/lib/Ext/phpmailer/examples/test_mail_advanced.php b/saf/lib/Ext/phpmailer/examples/test_mail_advanced.php new file mode 100644 index 00000000..38e27902 --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/test_mail_advanced.php @@ -0,0 +1,31 @@ + + +PHPMailer - Mail() advanced test + + + +AddReplyTo('name@yourdomain.com', 'First Last'); + $mail->AddAddress('whoto@otherdomain.com', 'John Doe'); + $mail->SetFrom('name@yourdomain.com', 'First Last'); + $mail->AddReplyTo('name@yourdomain.com', 'First Last'); + $mail->Subject = 'PHPMailer Test Subject via mail(), advanced'; + $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically + $mail->MsgHTML(file_get_contents('contents.html')); + $mail->AddAttachment('images/phpmailer.gif'); // attachment + $mail->AddAttachment('images/phpmailer_mini.gif'); // attachment + $mail->Send(); + echo "Message Sent OK

\n"; +} catch (phpmailerException $e) { + echo $e->errorMessage(); //Pretty error messages from PHPMailer +} catch (Exception $e) { + echo $e->getMessage(); //Boring error messages from anything else! +} +?> + + diff --git a/saf/lib/Ext/phpmailer/examples/test_mail_basic.php b/saf/lib/Ext/phpmailer/examples/test_mail_basic.php new file mode 100644 index 00000000..f8411fb0 --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/test_mail_basic.php @@ -0,0 +1,43 @@ + + +PHPMailer - Mail() basic test + + + +AddReplyTo("name@yourdomain.com","First Last"); + +$mail->SetFrom('name@yourdomain.com', 'First Last'); + +$mail->AddReplyTo("name@yourdomain.com","First Last"); + +$address = "whoto@otherdomain.com"; +$mail->AddAddress($address, "John Doe"); + +$mail->Subject = "PHPMailer Test Subject via mail(), basic"; + +$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test + +$mail->MsgHTML($body); + +$mail->AddAttachment("images/phpmailer.gif"); // attachment +$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment + +if(!$mail->Send()) { + echo "Mailer Error: " . $mail->ErrorInfo; +} else { + echo "Message sent!"; +} + +?> + + + diff --git a/saf/lib/Ext/phpmailer/examples/test_pop_before_smtp_advanced.php b/saf/lib/Ext/phpmailer/examples/test_pop_before_smtp_advanced.php new file mode 100644 index 00000000..ee9d839e --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/test_pop_before_smtp_advanced.php @@ -0,0 +1,40 @@ + + +POP before SMTP Test + + + +Authorise('pop3.yourdomain.com', 110, 30, 'username', 'password', 1); + +$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch + +$mail->IsSMTP(); + +try { + $mail->SMTPDebug = 2; + $mail->Host = 'pop3.yourdomain.com'; + $mail->AddReplyTo('name@yourdomain.com', 'First Last'); + $mail->AddAddress('whoto@otherdomain.com', 'John Doe'); + $mail->SetFrom('name@yourdomain.com', 'First Last'); + $mail->AddReplyTo('name@yourdomain.com', 'First Last'); + $mail->Subject = 'PHPMailer Test Subject via mail(), advanced'; + $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically + $mail->MsgHTML(file_get_contents('contents.html')); + $mail->AddAttachment('images/phpmailer.gif'); // attachment + $mail->AddAttachment('images/phpmailer_mini.gif'); // attachment + $mail->Send(); + echo "Message Sent OK

\n"; +} catch (phpmailerException $e) { + echo $e->errorMessage(); //Pretty error messages from PHPMailer +} catch (Exception $e) { + echo $e->getMessage(); //Boring error messages from anything else! +} +?> + + + diff --git a/saf/lib/Ext/phpmailer/examples/test_pop_before_smtp_basic.php b/saf/lib/Ext/phpmailer/examples/test_pop_before_smtp_basic.php new file mode 100644 index 00000000..f01bd824 --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/test_pop_before_smtp_basic.php @@ -0,0 +1,49 @@ + + +POP before SMTP Test + + + +Authorise('pop3.yourdomain.com', 110, 30, 'username', 'password', 1); + +$mail = new PHPMailer(); + +$body = file_get_contents('contents.html'); +$body = eregi_replace("[\]",'',$body); + +$mail->IsSMTP(); +$mail->SMTPDebug = 2; +$mail->Host = 'pop3.yourdomain.com'; + +$mail->SetFrom('name@yourdomain.com', 'First Last'); + +$mail->AddReplyTo("name@yourdomain.com","First Last"); + +$mail->Subject = "PHPMailer Test Subject via POP before SMTP, basic"; + +$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test + +$mail->MsgHTML($body); + +$address = "whoto@otherdomain.com"; +$mail->AddAddress($address, "John Doe"); + +$mail->AddAttachment("images/phpmailer.gif"); // attachment +$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment + + +if(!$mail->Send()) { + echo "Mailer Error: " . $mail->ErrorInfo; +} else { + echo "Message sent!"; +} + +?> + + + diff --git a/saf/lib/Ext/phpmailer/examples/test_sendmail_advanced.php b/saf/lib/Ext/phpmailer/examples/test_sendmail_advanced.php new file mode 100644 index 00000000..937d31e8 --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/test_sendmail_advanced.php @@ -0,0 +1,34 @@ + + +PHPMailer - Sendmail advanced test + + + +IsSendmail(); // telling the class to use SendMail transport + +try { + $mail->AddReplyTo('name@yourdomain.com', 'First Last'); + $mail->AddAddress('whoto@otherdomain.com', 'John Doe'); + $mail->SetFrom('name@yourdomain.com', 'First Last'); + $mail->AddReplyTo('name@yourdomain.com', 'First Last'); + $mail->Subject = 'PHPMailer Test Subject via mail(), advanced'; + $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically + $mail->MsgHTML(file_get_contents('contents.html')); + $mail->AddAttachment('images/phpmailer.gif'); // attachment + $mail->AddAttachment('images/phpmailer_mini.gif'); // attachment + $mail->Send(); + echo "Message Sent OK

\n"; +} catch (phpmailerException $e) { + echo $e->errorMessage(); //Pretty error messages from PHPMailer +} catch (Exception $e) { + echo $e->getMessage(); //Boring error messages from anything else! +} +?> + + + diff --git a/saf/lib/Ext/phpmailer/examples/test_sendmail_basic.php b/saf/lib/Ext/phpmailer/examples/test_sendmail_basic.php new file mode 100644 index 00000000..f70b0f06 --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/test_sendmail_basic.php @@ -0,0 +1,45 @@ + + +PHPMailer - Sendmail basic test + + + +IsSendmail(); // telling the class to use SendMail transport + +$body = file_get_contents('contents.html'); +$body = eregi_replace("[\]",'',$body); + +$mail->AddReplyTo("name@yourdomain.com","First Last"); + +$mail->SetFrom('name@yourdomain.com', 'First Last'); + +$mail->AddReplyTo("name@yourdomain.com","First Last"); + +$address = "whoto@otherdomain.com"; +$mail->AddAddress($address, "John Doe"); + +$mail->Subject = "PHPMailer Test Subject via Sendmail, basic"; + +$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test + +$mail->MsgHTML($body); + +$mail->AddAttachment("images/phpmailer.gif"); // attachment +$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment + +if(!$mail->Send()) { + echo "Mailer Error: " . $mail->ErrorInfo; +} else { + echo "Message sent!"; +} + +?> + + + diff --git a/saf/lib/Ext/phpmailer/examples/test_smtp_advanced.php b/saf/lib/Ext/phpmailer/examples/test_smtp_advanced.php new file mode 100644 index 00000000..9013c8a4 --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/test_smtp_advanced.php @@ -0,0 +1,43 @@ + + +PHPMailer - SMTP advanced test with authentication + + + +IsSMTP(); // telling the class to use SMTP + +try { + $mail->Host = "mail.yourdomain.com"; // SMTP server + $mail->SMTPDebug = 2; // enables SMTP debug information (for testing) + $mail->SMTPAuth = true; // enable SMTP authentication + $mail->Host = "mail.yourdomain.com"; // sets the SMTP server + $mail->Port = 26; // set the SMTP port for the GMAIL server + $mail->Username = "yourname@yourdomain"; // SMTP account username + $mail->Password = "yourpassword"; // SMTP account password + $mail->AddReplyTo('name@yourdomain.com', 'First Last'); + $mail->AddAddress('whoto@otherdomain.com', 'John Doe'); + $mail->SetFrom('name@yourdomain.com', 'First Last'); + $mail->AddReplyTo('name@yourdomain.com', 'First Last'); + $mail->Subject = 'PHPMailer Test Subject via mail(), advanced'; + $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically + $mail->MsgHTML(file_get_contents('contents.html')); + $mail->AddAttachment('images/phpmailer.gif'); // attachment + $mail->AddAttachment('images/phpmailer_mini.gif'); // attachment + $mail->Send(); + echo "Message Sent OK

\n"; +} catch (phpmailerException $e) { + echo $e->errorMessage(); //Pretty error messages from PHPMailer +} catch (Exception $e) { + echo $e->getMessage(); //Boring error messages from anything else! +} +?> + + + diff --git a/saf/lib/Ext/phpmailer/examples/test_smtp_advanced_no_auth.php b/saf/lib/Ext/phpmailer/examples/test_smtp_advanced_no_auth.php new file mode 100644 index 00000000..101d2e2b --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/test_smtp_advanced_no_auth.php @@ -0,0 +1,37 @@ + + +PHPMailer - SMTP advanced test with no authentication + + + +IsSMTP(); // telling the class to use SMTP + +try { + $mail->Host = "mail.yourdomain.com"; // SMTP server + $mail->SMTPDebug = 2; // enables SMTP debug information (for testing) + $mail->AddReplyTo('name@yourdomain.com', 'First Last'); + $mail->AddAddress('whoto@otherdomain.com', 'John Doe'); + $mail->SetFrom('name@yourdomain.com', 'First Last'); + $mail->AddReplyTo('name@yourdomain.com', 'First Last'); + $mail->Subject = 'PHPMailer Test Subject via mail(), advanced'; + $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically + $mail->MsgHTML(file_get_contents('contents.html')); + $mail->AddAttachment('images/phpmailer.gif'); // attachment + $mail->AddAttachment('images/phpmailer_mini.gif'); // attachment + $mail->Send(); + echo "Message Sent OK

\n"; +} catch (phpmailerException $e) { + echo $e->errorMessage(); //Pretty error messages from PHPMailer +} catch (Exception $e) { + echo $e->getMessage(); //Boring error messages from anything else! +} +?> + + + diff --git a/saf/lib/Ext/phpmailer/examples/test_smtp_basic.php b/saf/lib/Ext/phpmailer/examples/test_smtp_basic.php new file mode 100644 index 00000000..145f2acf --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/test_smtp_basic.php @@ -0,0 +1,58 @@ + + +PHPMailer - SMTP basic test with authentication + + + +IsSMTP(); // telling the class to use SMTP +$mail->Host = "mail.yourdomain.com"; // SMTP server +$mail->SMTPDebug = 2; // enables SMTP debug information (for testing) + // 1 = errors and messages + // 2 = messages only +$mail->SMTPAuth = true; // enable SMTP authentication +$mail->Host = "mail.yourdomain.com"; // sets the SMTP server +$mail->Port = 26; // set the SMTP port for the GMAIL server +$mail->Username = "yourname@yourdomain"; // SMTP account username +$mail->Password = "yourpassword"; // SMTP account password + +$mail->SetFrom('name@yourdomain.com', 'First Last'); + +$mail->AddReplyTo("name@yourdomain.com","First Last"); + +$mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication"; + +$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test + +$mail->MsgHTML($body); + +$address = "whoto@otherdomain.com"; +$mail->AddAddress($address, "John Doe"); + +$mail->AddAttachment("images/phpmailer.gif"); // attachment +$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment + +if(!$mail->Send()) { + echo "Mailer Error: " . $mail->ErrorInfo; +} else { + echo "Message sent!"; +} + +?> + + + diff --git a/saf/lib/Ext/phpmailer/examples/test_smtp_basic_no_auth.php b/saf/lib/Ext/phpmailer/examples/test_smtp_basic_no_auth.php new file mode 100644 index 00000000..fe72ffa9 --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/test_smtp_basic_no_auth.php @@ -0,0 +1,53 @@ + + +PHPMailer - SMTP basic test with no authentication + + + +IsSMTP(); // telling the class to use SMTP +$mail->Host = "mail.yourdomain.com"; // SMTP server +$mail->SMTPDebug = 2; // enables SMTP debug information (for testing) + // 1 = errors and messages + // 2 = messages only + +$mail->SetFrom('name@yourdomain.com', 'First Last'); + +$mail->AddReplyTo("name@yourdomain.com","First Last"); + +$mail->Subject = "PHPMailer Test Subject via smtp, basic with no authentication"; + +$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test + +$mail->MsgHTML($body); + +$address = "whoto@otherdomain.com"; +$mail->AddAddress($address, "John Doe"); + +$mail->AddAttachment("images/phpmailer.gif"); // attachment +$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment + +if(!$mail->Send()) { + echo "Mailer Error: " . $mail->ErrorInfo; +} else { + echo "Message sent!"; +} + +?> + + + diff --git a/saf/lib/Ext/phpmailer/examples/test_smtp_gmail_advanced.php b/saf/lib/Ext/phpmailer/examples/test_smtp_gmail_advanced.php new file mode 100644 index 00000000..10d98607 --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/test_smtp_gmail_advanced.php @@ -0,0 +1,43 @@ + + +PHPMailer - SMTP (Gmail) advanced test + + + +IsSMTP(); // telling the class to use SMTP + +try { + $mail->Host = "mail.yourdomain.com"; // SMTP server + $mail->SMTPDebug = 2; // enables SMTP debug information (for testing) + $mail->SMTPAuth = true; // enable SMTP authentication + $mail->SMTPSecure = "ssl"; // sets the prefix to the servier + $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server + $mail->Port = 465; // set the SMTP port for the GMAIL server + $mail->Username = "yourusername@gmail.com"; // GMAIL username + $mail->Password = "yourpassword"; // GMAIL password + $mail->AddReplyTo('name@yourdomain.com', 'First Last'); + $mail->AddAddress('whoto@otherdomain.com', 'John Doe'); + $mail->SetFrom('name@yourdomain.com', 'First Last'); + $mail->AddReplyTo('name@yourdomain.com', 'First Last'); + $mail->Subject = 'PHPMailer Test Subject via mail(), advanced'; + $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically + $mail->MsgHTML(file_get_contents('contents.html')); + $mail->AddAttachment('images/phpmailer.gif'); // attachment + $mail->AddAttachment('images/phpmailer_mini.gif'); // attachment + $mail->Send(); + echo "Message Sent OK

\n"; +} catch (phpmailerException $e) { + echo $e->errorMessage(); //Pretty error messages from PHPMailer +} catch (Exception $e) { + echo $e->getMessage(); //Boring error messages from anything else! +} +?> + + + diff --git a/saf/lib/Ext/phpmailer/examples/test_smtp_gmail_basic.php b/saf/lib/Ext/phpmailer/examples/test_smtp_gmail_basic.php new file mode 100644 index 00000000..abe22c52 --- /dev/null +++ b/saf/lib/Ext/phpmailer/examples/test_smtp_gmail_basic.php @@ -0,0 +1,59 @@ + + +PHPMailer - SMTP (Gmail) basic test + + + +IsSMTP(); // telling the class to use SMTP +$mail->Host = "mail.yourdomain.com"; // SMTP server +$mail->SMTPDebug = 2; // enables SMTP debug information (for testing) + // 1 = errors and messages + // 2 = messages only +$mail->SMTPAuth = true; // enable SMTP authentication +$mail->SMTPSecure = "ssl"; // sets the prefix to the servier +$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server +$mail->Port = 465; // set the SMTP port for the GMAIL server +$mail->Username = "yourusername@gmail.com"; // GMAIL username +$mail->Password = "yourpassword"; // GMAIL password + +$mail->SetFrom('name@yourdomain.com', 'First Last'); + +$mail->AddReplyTo("name@yourdomain.com","First Last"); + +$mail->Subject = "PHPMailer Test Subject via smtp (Gmail), basic"; + +$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test + +$mail->MsgHTML($body); + +$address = "whoto@otherdomain.com"; +$mail->AddAddress($address, "John Doe"); + +$mail->AddAttachment("images/phpmailer.gif"); // attachment +$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment + +if(!$mail->Send()) { + echo "Mailer Error: " . $mail->ErrorInfo; +} else { + echo "Message sent!"; +} + +?> + + + diff --git a/saf/lib/Ext/phpmailer/extras/htmlfilter.php b/saf/lib/Ext/phpmailer/extras/htmlfilter.php new file mode 100644 index 00000000..d75447de --- /dev/null +++ b/saf/lib/Ext/phpmailer/extras/htmlfilter.php @@ -0,0 +1,861 @@ + + * @Version 1.1 ($Date: 2011-07-04 14:02:23 -0400 (Mon, 04 Jul 2011) $) + */ + +/** + * @Author Jim Jagielski + */ + +/** + * This function returns the final tag out of the tag name, an array + * of attributes, and the type of the tag. This function is called by + * tln_sanitize internally. + * + * @param $tagname the name of the tag. + * @param $attary the array of attributes and their values + * @param $tagtype The type of the tag (see in comments). + * @return a string with the final tag representation. + */ +function tln_tagprint($tagname, $attary, $tagtype){ + $me = 'tln_tagprint'; + if ($tagtype == 2){ + $fulltag = ''; + } else { + $fulltag = '<' . $tagname; + if (is_array($attary) && sizeof($attary)){ + $atts = Array(); + while (list($attname, $attvalue) = each($attary)){ + array_push($atts, "$attname=$attvalue"); + } + $fulltag .= ' ' . join(' ', $atts); + } + if ($tagtype == 3){ + $fulltag .= ' /'; + } + $fulltag .= '>'; + } + return $fulltag; +} + +/** + * A small helper function to use with array_walk. Modifies a by-ref + * value and makes it lowercase. + * + * @param $val a value passed by-ref. + * @return void since it modifies a by-ref value. + */ +function tln_casenormalize(&$val){ + $val = strtolower($val); +} + +/** + * This function skips any whitespace from the current position within + * a string and to the next non-whitespace value. + * + * @param $body the string + * @param $offset the offset within the string where we should start + * looking for the next non-whitespace character. + * @return the location within the $body where the next + * non-whitespace char is located. + */ +function tln_skipspace($body, $offset){ + $me = 'tln_skipspace'; + preg_match('/^(\s*)/s', substr($body, $offset), $matches); + if (sizeof($matches[1])){ + $count = strlen($matches[1]); + $offset += $count; + } + return $offset; +} + +/** + * This function looks for the next character within a string. It's + * really just a glorified "strpos", except it catches the failures + * nicely. + * + * @param $body The string to look for needle in. + * @param $offset Start looking from this position. + * @param $needle The character/string to look for. + * @return location of the next occurance of the needle, or + * strlen($body) if needle wasn't found. + */ +function tln_findnxstr($body, $offset, $needle){ + $me = 'tln_findnxstr'; + $pos = strpos($body, $needle, $offset); + if ($pos === FALSE){ + $pos = strlen($body); + } + return $pos; +} + +/** + * This function takes a PCRE-style regexp and tries to match it + * within the string. + * + * @param $body The string to look for needle in. + * @param $offset Start looking from here. + * @param $reg A PCRE-style regex to match. + * @return Returns a false if no matches found, or an array + * with the following members: + * - integer with the location of the match within $body + * - string with whatever content between offset and the match + * - string with whatever it is we matched + */ +function tln_findnxreg($body, $offset, $reg){ + $me = 'tln_findnxreg'; + $matches = Array(); + $retarr = Array(); + $preg_rule = '%^(.*?)(' . $reg . ')%s'; + preg_match($preg_rule, substr($body, $offset), $matches); + if (!isset($matches[0])){ + $retarr = false; + } else { + $retarr[0] = $offset + strlen($matches[1]); + $retarr[1] = $matches[1]; + $retarr[2] = $matches[2]; + } + return $retarr; +} + +/** + * This function looks for the next tag. + * + * @param $body String where to look for the next tag. + * @param $offset Start looking from here. + * @return false if no more tags exist in the body, or + * an array with the following members: + * - string with the name of the tag + * - array with attributes and their values + * - integer with tag type (1, 2, or 3) + * - integer where the tag starts (starting "<") + * - integer where the tag ends (ending ">") + * first three members will be false, if the tag is invalid. + */ +function tln_getnxtag($body, $offset){ + $me = 'tln_getnxtag'; + if ($offset > strlen($body)){ + return false; + } + $lt = tln_findnxstr($body, $offset, '<'); + if ($lt == strlen($body)){ + return false; + } + /** + * We are here: + * blah blah + * \---------^ + */ + $pos = tln_skipspace($body, $lt + 1); + if ($pos >= strlen($body)){ + return Array(false, false, false, $lt, strlen($body)); + } + /** + * There are 3 kinds of tags: + * 1. Opening tag, e.g.: + * + * 2. Closing tag, e.g.: + * + * 3. XHTML-style content-less tag, e.g.: + * + */ + $tagtype = false; + switch (substr($body, $pos, 1)){ + case '/': + $tagtype = 2; + $pos++; + break; + case '!': + /** + * A comment or an SGML declaration. + */ + if (substr($body, $pos+1, 2) == '--'){ + $gt = strpos($body, '-->', $pos); + if ($gt === false){ + $gt = strlen($body); + } else { + $gt += 2; + } + return Array(false, false, false, $lt, $gt); + } else { + $gt = tln_findnxstr($body, $pos, '>'); + return Array(false, false, false, $lt, $gt); + } + break; + default: + /** + * Assume tagtype 1 for now. If it's type 3, we'll switch values + * later. + */ + $tagtype = 1; + break; + } + + $tag_start = $pos; + $tagname = ''; + /** + * Look for next [\W-_], which will indicate the end of the tag name. + */ + $regary = tln_findnxreg($body, $pos, '[^\w\-_]'); + if ($regary == false){ + return Array(false, false, false, $lt, strlen($body)); + } + list($pos, $tagname, $match) = $regary; + $tagname = strtolower($tagname); + + /** + * $match can be either of these: + * '>' indicating the end of the tag entirely. + * '\s' indicating the end of the tag name. + * '/' indicating that this is type-3 xhtml tag. + * + * Whatever else we find there indicates an invalid tag. + */ + switch ($match){ + case '/': + /** + * This is an xhtml-style tag with a closing / at the + * end, like so: . Check if it's followed + * by the closing bracket. If not, then this tag is invalid + */ + if (substr($body, $pos, 2) == '/>'){ + $pos++; + $tagtype = 3; + } else { + $gt = tln_findnxstr($body, $pos, '>'); + $retary = Array(false, false, false, $lt, $gt); + return $retary; + } + case '>': + return Array($tagname, false, $tagtype, $lt, $pos); + break; + default: + /** + * Check if it's whitespace + */ + if (preg_match('/\s/', $match)){ + } else { + /** + * This is an invalid tag! Look for the next closing ">". + */ + $gt = tln_findnxstr($body, $lt, '>'); + return Array(false, false, false, $lt, $gt); + } + } + + /** + * At this point we're here: + * + * \-------^ + * + * At this point we loop in order to find all attributes. + */ + $attname = ''; + $atttype = false; + $attary = Array(); + + while ($pos <= strlen($body)){ + $pos = tln_skipspace($body, $pos); + if ($pos == strlen($body)){ + /** + * Non-closed tag. + */ + return Array(false, false, false, $lt, $pos); + } + /** + * See if we arrived at a ">" or "/>", which means that we reached + * the end of the tag. + */ + $matches = Array(); + preg_match('%^(\s*)(>|/>)%s', substr($body, $pos), $matches); + if (isset($matches[0]) && $matches[0]){ + /** + * Yep. So we did. + */ + $pos += strlen($matches[1]); + if ($matches[2] == '/>'){ + $tagtype = 3; + $pos++; + } + return Array($tagname, $attary, $tagtype, $lt, $pos); + } + + /** + * There are several types of attributes, with optional + * [:space:] between members. + * Type 1: + * attrname[:space:]=[:space:]'CDATA' + * Type 2: + * attrname[:space:]=[:space:]"CDATA" + * Type 3: + * attr[:space:]=[:space:]CDATA + * Type 4: + * attrname + * + * We leave types 1 and 2 the same, type 3 we check for + * '"' and convert to """ if needed, then wrap in + * double quotes. Type 4 we convert into: + * attrname="yes". + */ + $regary = tln_findnxreg($body, $pos, '[^\w\-_]'); + if ($regary == false){ + /** + * Looks like body ended before the end of tag. + */ + return Array(false, false, false, $lt, strlen($body)); + } + list($pos, $attname, $match) = $regary; + $attname = strtolower($attname); + /** + * We arrived at the end of attribute name. Several things possible + * here: + * '>' means the end of the tag and this is attribute type 4 + * '/' if followed by '>' means the same thing as above + * '\s' means a lot of things -- look what it's followed by. + * anything else means the attribute is invalid. + */ + switch($match){ + case '/': + /** + * This is an xhtml-style tag with a closing / at the + * end, like so: . Check if it's followed + * by the closing bracket. If not, then this tag is invalid + */ + if (substr($body, $pos, 2) == '/>'){ + $pos++; + $tagtype = 3; + } else { + $gt = tln_findnxstr($body, $pos, '>'); + $retary = Array(false, false, false, $lt, $gt); + return $retary; + } + case '>': + $attary{$attname} = '"yes"'; + return Array($tagname, $attary, $tagtype, $lt, $pos); + break; + default: + /** + * Skip whitespace and see what we arrive at. + */ + $pos = tln_skipspace($body, $pos); + $char = substr($body, $pos, 1); + /** + * Two things are valid here: + * '=' means this is attribute type 1 2 or 3. + * \w means this was attribute type 4. + * anything else we ignore and re-loop. End of tag and + * invalid stuff will be caught by our checks at the beginning + * of the loop. + */ + if ($char == '='){ + $pos++; + $pos = tln_skipspace($body, $pos); + /** + * Here are 3 possibilities: + * "'" attribute type 1 + * '"' attribute type 2 + * everything else is the content of tag type 3 + */ + $quot = substr($body, $pos, 1); + if ($quot == '\''){ + $regary = tln_findnxreg($body, $pos+1, '\''); + if ($regary == false){ + return Array(false, false, false, $lt, strlen($body)); + } + list($pos, $attval, $match) = $regary; + $pos++; + $attary{$attname} = '\'' . $attval . '\''; + } else if ($quot == '"'){ + $regary = tln_findnxreg($body, $pos+1, '\"'); + if ($regary == false){ + return Array(false, false, false, $lt, strlen($body)); + } + list($pos, $attval, $match) = $regary; + $pos++; + $attary{$attname} = '"' . $attval . '"'; + } else { + /** + * These are hateful. Look for \s, or >. + */ + $regary = tln_findnxreg($body, $pos, '[\s>]'); + if ($regary == false){ + return Array(false, false, false, $lt, strlen($body)); + } + list($pos, $attval, $match) = $regary; + /** + * If it's ">" it will be caught at the top. + */ + $attval = preg_replace('/\"/s', '"', $attval); + $attary{$attname} = '"' . $attval . '"'; + } + } else if (preg_match('|[\w/>]|', $char)) { + /** + * That was attribute type 4. + */ + $attary{$attname} = '"yes"'; + } else { + /** + * An illegal character. Find next '>' and return. + */ + $gt = tln_findnxstr($body, $pos, '>'); + return Array(false, false, false, $lt, $gt); + } + } + } + /** + * The fact that we got here indicates that the tag end was never + * found. Return invalid tag indication so it gets stripped. + */ + return Array(false, false, false, $lt, strlen($body)); +} + +/** + * Translates entities into literal values so they can be checked. + * + * @param $attvalue the by-ref value to check. + * @param $regex the regular expression to check against. + * @param $hex whether the entites are hexadecimal. + * @return True or False depending on whether there were matches. + */ +function tln_deent(&$attvalue, $regex, $hex=false){ + $me = 'tln_deent'; + $ret_match = false; + preg_match_all($regex, $attvalue, $matches); + if (is_array($matches) && sizeof($matches[0]) > 0){ + $repl = Array(); + for ($i = 0; $i < sizeof($matches[0]); $i++){ + $numval = $matches[1][$i]; + if ($hex){ + $numval = hexdec($numval); + } + $repl{$matches[0][$i]} = chr($numval); + } + $attvalue = strtr($attvalue, $repl); + return true; + } else { + return false; + } +} + +/** + * This function checks attribute values for entity-encoded values + * and returns them translated into 8-bit strings so we can run + * checks on them. + * + * @param $attvalue A string to run entity check against. + * @return Nothing, modifies a reference value. + */ +function tln_defang(&$attvalue){ + $me = 'tln_defang'; + /** + * Skip this if there aren't ampersands or backslashes. + */ + if (strpos($attvalue, '&') === false + && strpos($attvalue, '\\') === false){ + return; + } + $m = false; + do { + $m = false; + $m = $m || tln_deent($attvalue, '/\�*(\d+);*/s'); + $m = $m || tln_deent($attvalue, '/\�*((\d|[a-f])+);*/si', true); + $m = $m || tln_deent($attvalue, '/\\\\(\d+)/s', true); + } while ($m == true); + $attvalue = stripslashes($attvalue); +} + +/** + * Kill any tabs, newlines, or carriage returns. Our friends the + * makers of the browser with 95% market value decided that it'd + * be funny to make "java[tab]script" be just as good as "javascript". + * + * @param attvalue The attribute value before extraneous spaces removed. + * @return attvalue Nothing, modifies a reference value. + */ +function tln_unspace(&$attvalue){ + $me = 'tln_unspace'; + if (strcspn($attvalue, "\t\r\n\0 ") != strlen($attvalue)){ + $attvalue = str_replace(Array("\t", "\r", "\n", "\0", " "), + Array('', '', '', '', ''), $attvalue); + } +} + +/** + * This function runs various checks against the attributes. + * + * @param $tagname String with the name of the tag. + * @param $attary Array with all tag attributes. + * @param $rm_attnames See description for tln_sanitize + * @param $bad_attvals See description for tln_sanitize + * @param $add_attr_to_tag See description for tln_sanitize + * @return Array with modified attributes. + */ +function tln_fixatts($tagname, + $attary, + $rm_attnames, + $bad_attvals, + $add_attr_to_tag + ){ + $me = 'tln_fixatts'; + while (list($attname, $attvalue) = each($attary)){ + /** + * See if this attribute should be removed. + */ + foreach ($rm_attnames as $matchtag=>$matchattrs){ + if (preg_match($matchtag, $tagname)){ + foreach ($matchattrs as $matchattr){ + if (preg_match($matchattr, $attname)){ + unset($attary{$attname}); + continue; + } + } + } + } + /** + * Remove any backslashes, entities, or extraneous whitespace. + */ + tln_defang($attvalue); + tln_unspace($attvalue); + + /** + * Now let's run checks on the attvalues. + * I don't expect anyone to comprehend this. If you do, + * get in touch with me so I can drive to where you live and + * shake your hand personally. :) + */ + foreach ($bad_attvals as $matchtag=>$matchattrs){ + if (preg_match($matchtag, $tagname)){ + foreach ($matchattrs as $matchattr=>$valary){ + if (preg_match($matchattr, $attname)){ + /** + * There are two arrays in valary. + * First is matches. + * Second one is replacements + */ + list($valmatch, $valrepl) = $valary; + $newvalue = preg_replace($valmatch,$valrepl,$attvalue); + if ($newvalue != $attvalue){ + $attary{$attname} = $newvalue; + } + } + } + } + } + } + /** + * See if we need to append any attributes to this tag. + */ + foreach ($add_attr_to_tag as $matchtag=>$addattary){ + if (preg_match($matchtag, $tagname)){ + $attary = array_merge($attary, $addattary); + } + } + return $attary; +} + +/** + * + * @param $body the string with HTML you wish to filter + * @param $tag_list see description above + * @param $rm_tags_with_content see description above + * @param $self_closing_tags see description above + * @param $force_tag_closing see description above + * @param $rm_attnames see description above + * @param $bad_attvals see description above + * @param $add_attr_to_tag see description above + * @return tln_sanitized html safe to show on your pages. + */ +function tln_sanitize($body, + $tag_list, + $rm_tags_with_content, + $self_closing_tags, + $force_tag_closing, + $rm_attnames, + $bad_attvals, + $add_attr_to_tag + ) +{ + $me = 'tln_sanitize'; + /** + * Normalize rm_tags and rm_tags_with_content. + */ + $rm_tags = array_shift($tag_list); + @array_walk($tag_list, 'tln_casenormalize'); + @array_walk($rm_tags_with_content, 'tln_casenormalize'); + @array_walk($self_closing_tags, 'tln_casenormalize'); + /** + * See if tag_list is of tags to remove or tags to allow. + * false means remove these tags + * true means allow these tags + */ + $curpos = 0; + $open_tags = Array(); + $trusted = "\n"; + $skip_content = false; + /** + * Take care of netscape's stupid javascript entities like + * &{alert('boo')}; + */ + $body = preg_replace('/&(\{.*?\};)/si', '&\\1', $body); + while (($curtag = tln_getnxtag($body, $curpos)) != FALSE){ + list($tagname, $attary, $tagtype, $lt, $gt) = $curtag; + $free_content = substr($body, $curpos, $lt - $curpos); + if ($skip_content == false){ + $trusted .= $free_content; + } else { + } + if ($tagname != FALSE){ + if ($tagtype == 2){ + if ($skip_content == $tagname){ + /** + * Got to the end of tag we needed to remove. + */ + $tagname = false; + $skip_content = false; + } else { + if ($skip_content == false){ + if (isset($open_tags{$tagname}) && + $open_tags{$tagname} > 0){ + $open_tags{$tagname}--; + } else { + $tagname = false; + } + } else { + } + } + } else { + /** + * $rm_tags_with_content + */ + if ($skip_content == false){ + /** + * See if this is a self-closing type and change + * tagtype appropriately. + */ + if ($tagtype == 1 + && in_array($tagname, $self_closing_tags)){ + $tagtype = 3; + } + /** + * See if we should skip this tag and any content + * inside it. + */ + if ($tagtype == 1 + && in_array($tagname, $rm_tags_with_content)){ + $skip_content = $tagname; + } else { + if (($rm_tags == false + && in_array($tagname, $tag_list)) || + ($rm_tags == true + && !in_array($tagname, $tag_list))){ + $tagname = false; + } else { + if ($tagtype == 1){ + if (isset($open_tags{$tagname})){ + $open_tags{$tagname}++; + } else { + $open_tags{$tagname} = 1; + } + } + /** + * This is where we run other checks. + */ + if (is_array($attary) && sizeof($attary) > 0){ + $attary = tln_fixatts($tagname, + $attary, + $rm_attnames, + $bad_attvals, + $add_attr_to_tag); + } + } + } + } else { + } + } + if ($tagname != false && $skip_content == false){ + $trusted .= tln_tagprint($tagname, $attary, $tagtype); + } + } else { + } + $curpos = $gt + 1; + } + $trusted .= substr($body, $curpos, strlen($body) - $curpos); + if ($force_tag_closing == true){ + foreach ($open_tags as $tagname=>$opentimes){ + while ($opentimes > 0){ + $trusted .= ''; + $opentimes--; + } + } + $trusted .= "\n"; + } + $trusted .= "\n"; + return $trusted; +} + +// +// Use the nifty htmlfilter library +// + + +function HTMLFilter($body, $trans_image_path, $block_external_images = false) { + + $tag_list = Array( + false, + "object", + "meta", + "html", + "head", + "base", + "link", + "frame", + "iframe", + "plaintext", + "marquee" + ); + + $rm_tags_with_content = Array( + "script", + "applet", + "embed", + "title", + "frameset", + "xmp", + "xml" + ); + + $self_closing_tags = Array( + "img", + "br", + "hr", + "input", + "outbind" + ); + + $force_tag_closing = true; + + $rm_attnames = Array( + "/.*/" => + Array( + // "/target/i", + "/^on.*/i", + "/^dynsrc/i", + "/^data.*/i", + "/^lowsrc.*/i" + ) + ); + + $bad_attvals = Array( + "/.*/" => + Array( + "/^src|background/i" => + Array( + Array( + "/^([\'\"])\s*\S+script\s*:.*([\'\"])/si", + "/^([\'\"])\s*mocha\s*:*.*([\'\"])/si", + "/^([\'\"])\s*about\s*:.*([\'\"])/si" + ), + Array( + "\\1$trans_image_path\\2", + "\\1$trans_image_path\\2", + "\\1$trans_image_path\\2", + "\\1$trans_image_path\\2" + ) + ), + "/^href|action/i" => + Array( + Array( + "/^([\'\"])\s*\S+script\s*:.*([\'\"])/si", + "/^([\'\"])\s*mocha\s*:*.*([\'\"])/si", + "/^([\'\"])\s*about\s*:.*([\'\"])/si" + ), + Array( + "\\1#\\1", + "\\1#\\1", + "\\1#\\1", + "\\1#\\1" + ) + ), + "/^style/i" => + Array( + Array( + "/expression/i", + "/binding/i", + "/behaviou*r/i", + "/include-source/i", + "/position\s*:\s*absolute/i", + "/url\s*\(\s*([\'\"])\s*\S+script\s*:.*([\'\"])\s*\)/si", + "/url\s*\(\s*([\'\"])\s*mocha\s*:.*([\'\"])\s*\)/si", + "/url\s*\(\s*([\'\"])\s*about\s*:.*([\'\"])\s*\)/si", + "/(.*)\s*:\s*url\s*\(\s*([\'\"]*)\s*\S+script\s*:.*([\'\"]*)\s*\)/si" + ), + Array( + "idiocy", + "idiocy", + "idiocy", + "idiocy", + "", + "url(\\1#\\1)", + "url(\\1#\\1)", + "url(\\1#\\1)", + "url(\\1#\\1)", + "url(\\1#\\1)", + "\\1:url(\\2#\\3)" + ) + ) + ) + ); + + if ($block_external_images){ + array_push($bad_attvals{'/.*/'}{'/^src|background/i'}[0], + '/^([\'\"])\s*https*:.*([\'\"])/si'); + array_push($bad_attvals{'/.*/'}{'/^src|background/i'}[1], + "\\1$trans_image_path\\1"); + array_push($bad_attvals{'/.*/'}{'/^style/i'}[0], + '/url\(([\'\"])\s*https*:.*([\'\"])\)/si'); + array_push($bad_attvals{'/.*/'}{'/^style/i'}[1], + "url(\\1$trans_image_path\\1)"); + } + + $add_attr_to_tag = Array( + "/^a$/i" => + Array('target'=>'"_blank"') + ); + + $trusted = tln_sanitize($body, + $tag_list, + $rm_tags_with_content, + $self_closing_tags, + $force_tag_closing, + $rm_attnames, + $bad_attvals, + $add_attr_to_tag + ); + return $trusted; +} + +?> diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-ar.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-ar.php new file mode 100644 index 00000000..b7c5057d --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-ar.php @@ -0,0 +1,27 @@ + +*/ + +$PHPMAILER_LANG['authenticate'] = 'SMTP Error: لم نستطع تأكيد الهوية.'; +$PHPMAILER_LANG['connect_host'] = 'SMTP Error: لم نستطع الاتصال بمخدم SMTP.'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: لم يتم قبول المعلومات .'; +//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; +$PHPMAILER_LANG['encoding'] = 'ترميز غير معروÙ: '; +$PHPMAILER_LANG['execute'] = 'لم أستطع تنÙيذ : '; +$PHPMAILER_LANG['file_access'] = 'لم نستطع الوصول للملÙ: '; +$PHPMAILER_LANG['file_open'] = 'File Error: لم نستطع Ùتح الملÙ: '; +$PHPMAILER_LANG['from_failed'] = 'البريد التالي لم نستطع ارسال البريد له : '; +$PHPMAILER_LANG['instantiate'] = 'لم نستطع توÙير خدمة البريد.'; +//$PHPMAILER_LANG['invalid_email'] = 'Not sending, email address is invalid: '; +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer غير مدعوم.'; +//$PHPMAILER_LANG['provide_address'] = 'You must provide at least one recipient email address.'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: الأخطاء التالية ' . + 'Ùشل ÙÙŠ الارسال لكل من : '; +$PHPMAILER_LANG['signing'] = 'خطأ ÙÙŠ التوقيع: '; +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; +?> \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-br.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-br.php index b948c264..6afe60b1 100644 --- a/saf/lib/Ext/phpmailer/language/phpmailer.lang-br.php +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-br.php @@ -1,21 +1,26 @@ +$PHPMAILER_LANG['authenticate'] = 'Erro de SMTP: Não foi possível autenticar.'; +$PHPMAILER_LANG['connect_host'] = 'Erro de SMTP: Não foi possível conectar com o servidor SMTP.'; +$PHPMAILER_LANG['data_not_accepted'] = 'Erro de SMTP: Dados não aceitos.'; +//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; +$PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: '; +$PHPMAILER_LANG['execute'] = 'Não foi possível executar: '; +$PHPMAILER_LANG['file_access'] = 'Não foi possível acessar o arquivo: '; +$PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: Não foi possível abrir o arquivo: '; +$PHPMAILER_LANG['from_failed'] = 'Os endereços de rementente a seguir falharam: '; +$PHPMAILER_LANG['instantiate'] = 'Não foi possível instanciar a função mail.'; +//$PHPMAILER_LANG['invalid_email'] = 'Not sending, email address is invalid: '; +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer não suportado.'; +$PHPMAILER_LANG['provide_address'] = 'Você deve fornecer pelo menos um endereço de destinatário de email.'; +$PHPMAILER_LANG['recipients_failed'] = 'Erro de SMTP: Os endereços de destinatário a seguir falharam: '; +//$PHPMAILER_LANG['signing'] = 'Signing Error: '; +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; +?> \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-ca.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-ca.php new file mode 100644 index 00000000..4a160a21 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-ca.php @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-ch.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-ch.php new file mode 100644 index 00000000..31ebd861 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-ch.php @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-cz.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-cz.php new file mode 100644 index 00000000..1c8b2063 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-cz.php @@ -0,0 +1,25 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-de.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-de.php new file mode 100644 index 00000000..b2a76ce1 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-de.php @@ -0,0 +1,25 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-dk.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-dk.php new file mode 100644 index 00000000..b2625731 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-dk.php @@ -0,0 +1,26 @@ + +*/ + +$PHPMAILER_LANG['authenticate'] = 'SMTP fejl: Kunne ikke logge pÃ¥.'; +$PHPMAILER_LANG['connect_host'] = 'SMTP fejl: Kunne ikke tilslutte SMTP serveren.'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fejl: Data kunne ikke accepteres.'; +//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; +$PHPMAILER_LANG['encoding'] = 'Ukendt encode-format: '; +$PHPMAILER_LANG['execute'] = 'Kunne ikke køre: '; +$PHPMAILER_LANG['file_access'] = 'Ingen adgang til fil: '; +$PHPMAILER_LANG['file_open'] = 'Fil fejl: Kunne ikke Ã¥bne filen: '; +$PHPMAILER_LANG['from_failed'] = 'Følgende afsenderadresse er forkert: '; +$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere email funktionen.'; +//$PHPMAILER_LANG['invalid_email'] = 'Not sending, email address is invalid: '; +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer understøttes ikke.'; +$PHPMAILER_LANG['provide_address'] = 'Du skal indtaste mindst en modtagers emailadresse.'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP fejl: Følgende modtagere er forkerte: '; +//$PHPMAILER_LANG['signing'] = 'Signing Error: '; +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; +?> \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-es.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-es.php new file mode 100644 index 00000000..69b68174 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-es.php @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-et.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-et.php new file mode 100644 index 00000000..cf61779b --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-et.php @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-fi.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-fi.php new file mode 100644 index 00000000..12a845aa --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-fi.php @@ -0,0 +1,27 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-fo.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-fo.php new file mode 100644 index 00000000..6bd9b0a2 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-fo.php @@ -0,0 +1,27 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-fr.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-fr.php new file mode 100644 index 00000000..c99ac3ca --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-fr.php @@ -0,0 +1,25 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-hu.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-hu.php new file mode 100644 index 00000000..caca0b50 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-hu.php @@ -0,0 +1,25 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-it.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-it.php new file mode 100644 index 00000000..fc1fcb8d --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-it.php @@ -0,0 +1,27 @@ + +*/ + +$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Impossibile autenticarsi.'; +$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Impossibile connettersi all\'host SMTP.'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Data non accettati dal server.'; +//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; +$PHPMAILER_LANG['encoding'] = 'Encoding set dei caratteri sconosciuto: '; +$PHPMAILER_LANG['execute'] = 'Impossibile eseguire l\'operazione: '; +$PHPMAILER_LANG['file_access'] = 'Impossibile accedere al file: '; +$PHPMAILER_LANG['file_open'] = 'File Error: Impossibile aprire il file: '; +$PHPMAILER_LANG['from_failed'] = 'I seguenti indirizzi mittenti hanno generato errore: '; +$PHPMAILER_LANG['instantiate'] = 'Impossibile istanziare la funzione mail'; +//$PHPMAILER_LANG['invalid_email'] = 'Not sending, email address is invalid: '; +$PHPMAILER_LANG['provide_address'] = 'Deve essere fornito almeno un indirizzo ricevente'; +$PHPMAILER_LANG['mailer_not_supported'] = 'Mailer non supportato'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: I seguenti indirizzi destinatari hanno generato errore: '; +//$PHPMAILER_LANG['signing'] = 'Signing Error: '; +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; +?> \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-ja.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-ja.php new file mode 100644 index 00000000..63cfb23b --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-ja.php @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-nl.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-nl.php new file mode 100644 index 00000000..d2c380b0 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-nl.php @@ -0,0 +1,25 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-no.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-no.php new file mode 100644 index 00000000..65cb8843 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-no.php @@ -0,0 +1,25 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-pl.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-pl.php new file mode 100644 index 00000000..f4fd801d --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-pl.php @@ -0,0 +1,25 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-ro.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-ro.php new file mode 100644 index 00000000..f6aa9225 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-ro.php @@ -0,0 +1,27 @@ + +*/ + +$PHPMAILER_LANG['authenticate'] = 'Eroare SMTP: Nu a functionat autentificarea.'; +$PHPMAILER_LANG['connect_host'] = 'Eroare SMTP: Nu m-am putut conecta la adresa SMTP.'; +$PHPMAILER_LANG['data_not_accepted'] = 'Eroare SMTP: Continutul mailului nu a fost acceptat.'; +//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; +$PHPMAILER_LANG['encoding'] = 'Encodare necunoscuta: '; +$PHPMAILER_LANG['execute'] = 'Nu pot executa: '; +$PHPMAILER_LANG['file_access'] = 'Nu pot accesa fisierul: '; +$PHPMAILER_LANG['file_open'] = 'Eroare de fisier: Nu pot deschide fisierul: '; +$PHPMAILER_LANG['from_failed'] = 'Urmatoarele adrese From au dat eroare: '; +$PHPMAILER_LANG['instantiate'] = 'Nu am putut instantia functia mail.'; +//$PHPMAILER_LANG['invalid_email'] = 'Not sending, email address is invalid: '; +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nu este suportat.'; +$PHPMAILER_LANG['provide_address'] = 'Trebuie sa adaugati cel putin un recipient (adresa de mail).'; +$PHPMAILER_LANG['recipients_failed'] = 'Eroare SMTP: Urmatoarele adrese de mail au dat eroare: '; +//$PHPMAILER_LANG['signing'] = 'Signing Error: '; +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; +?> \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-ru.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-ru.php new file mode 100644 index 00000000..d6990525 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-ru.php @@ -0,0 +1,25 @@ + +*/ + +$PHPMAILER_LANG['authenticate'] = 'Ошибка SMTP: ошибка авторизации.'; +$PHPMAILER_LANG['connect_host'] = 'Ошибка SMTP: не удаетÑÑ Ð¿Ð¾Ð´ÐºÐ»ÑŽÑ‡Ð¸Ñ‚ÑŒÑÑ Ðº Ñерверу SMTP.'; +$PHPMAILER_LANG['data_not_accepted'] = 'Ошибка SMTP: данные не принÑÑ‚Ñ‹.'; +//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; +$PHPMAILER_LANG['encoding'] = 'ÐеизвеÑтный вид кодировки: '; +$PHPMAILER_LANG['execute'] = 'Ðевозможно выполнить команду: '; +$PHPMAILER_LANG['file_access'] = 'Ðет доÑтупа к файлу: '; +$PHPMAILER_LANG['file_open'] = 'Ð¤Ð°Ð¹Ð»Ð¾Ð²Ð°Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ°: не удаетÑÑ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚ÑŒ файл: '; +$PHPMAILER_LANG['from_failed'] = 'Ðеверный Ð°Ð´Ñ€ÐµÑ Ð¾Ñ‚Ð¿Ñ€Ð°Ð²Ð¸Ñ‚ÐµÐ»Ñ: '; +$PHPMAILER_LANG['instantiate'] = 'Ðевозможно запуÑтить функцию mail.'; +//$PHPMAILER_LANG['invalid_email'] = 'Not sending, email address is invalid: '; +$PHPMAILER_LANG['provide_address'] = 'ПожалуйÑта, введите Ñ…Ð¾Ñ‚Ñ Ð±Ñ‹ один Ð°Ð´Ñ€ÐµÑ e-mail получателÑ.'; +$PHPMAILER_LANG['mailer_not_supported'] = ' - почтовый Ñервер не поддерживаетÑÑ.'; +$PHPMAILER_LANG['recipients_failed'] = 'Ошибка SMTP: отправка по Ñледующим адреÑам получателей не удалаÑÑŒ: '; +//$PHPMAILER_LANG['signing'] = 'Signing Error: '; +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; +?> \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-se.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-se.php new file mode 100644 index 00000000..67e05f59 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-se.php @@ -0,0 +1,26 @@ + +*/ + +$PHPMAILER_LANG['authenticate'] = 'SMTP fel: Kunde inte autentisera.'; +$PHPMAILER_LANG['connect_host'] = 'SMTP fel: Kunde inte ansluta till SMTP-server.'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fel: Data accepterades inte.'; +//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; +$PHPMAILER_LANG['encoding'] = 'Okänt encode-format: '; +$PHPMAILER_LANG['execute'] = 'Kunde inte köra: '; +$PHPMAILER_LANG['file_access'] = 'Ingen Ã¥tkomst till fil: '; +$PHPMAILER_LANG['file_open'] = 'Fil fel: Kunde inte öppna fil: '; +$PHPMAILER_LANG['from_failed'] = 'Följande avsändaradress är felaktig: '; +$PHPMAILER_LANG['instantiate'] = 'Kunde inte initiera e-postfunktion.'; +//$PHPMAILER_LANG['invalid_email'] = 'Not sending, email address is invalid: '; +$PHPMAILER_LANG['provide_address'] = 'Du mÃ¥ste ange minst en mottagares e-postadress.'; +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer stöds inte.'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP fel: Följande mottagare är felaktig: '; +//$PHPMAILER_LANG['signing'] = 'Signing Error: '; +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; +?> \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-tr.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-tr.php new file mode 100644 index 00000000..d24627a4 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-tr.php @@ -0,0 +1,27 @@ + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-zh.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-zh.php new file mode 100644 index 00000000..fef66f8c --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-zh.php @@ -0,0 +1,26 @@ + +*/ + +$PHPMAILER_LANG['authenticate'] = 'SMTP 錯誤:登錄失敗。'; +$PHPMAILER_LANG['connect_host'] = 'SMTP 錯誤:無法連接到 SMTP 主機。'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 錯誤:數據ä¸è¢«æŽ¥å—。'; +//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; +$PHPMAILER_LANG['encoding'] = '未知編碼: '; +$PHPMAILER_LANG['file_access'] = '無法訪å•æ–‡ä»¶ï¼š'; +$PHPMAILER_LANG['file_open'] = '文件錯誤:無法打開文件:'; +$PHPMAILER_LANG['from_failed'] = '發é€åœ°å€éŒ¯èª¤ï¼š'; +$PHPMAILER_LANG['execute'] = '無法執行:'; +$PHPMAILER_LANG['instantiate'] = '未知函數調用。'; +//$PHPMAILER_LANG['invalid_email'] = 'Not sending, email address is invalid: '; +$PHPMAILER_LANG['provide_address'] = 'å¿…é ˆæ供至少一個收件人地å€ã€‚'; +$PHPMAILER_LANG['mailer_not_supported'] = '發信客戶端ä¸è¢«æ”¯æŒã€‚'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP 錯誤:收件人地å€éŒ¯èª¤ï¼š'; +//$PHPMAILER_LANG['signing'] = 'Signing Error: '; +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; +?> \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/language/phpmailer.lang-zh_cn.php b/saf/lib/Ext/phpmailer/language/phpmailer.lang-zh_cn.php new file mode 100644 index 00000000..b1884043 --- /dev/null +++ b/saf/lib/Ext/phpmailer/language/phpmailer.lang-zh_cn.php @@ -0,0 +1,26 @@ + +*/ + +$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:登录失败。'; +$PHPMAILER_LANG['connect_host'] = 'SMTP 错误:无法连接到 SMTP 主机。'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误:数æ®ä¸è¢«æŽ¥å—。'; +//$P$PHPMAILER_LANG['empty_message'] = 'Message body empty'; +$PHPMAILER_LANG['encoding'] = '未知编ç : '; +$PHPMAILER_LANG['execute'] = '无法执行:'; +$PHPMAILER_LANG['file_access'] = '无法访问文件:'; +$PHPMAILER_LANG['file_open'] = '文件错误:无法打开文件:'; +$PHPMAILER_LANG['from_failed'] = 'å‘é€åœ°å€é”™è¯¯ï¼š'; +$PHPMAILER_LANG['instantiate'] = '未知函数调用。'; +//$PHPMAILER_LANG['invalid_email'] = 'Not sending, email address is invalid: '; +$PHPMAILER_LANG['mailer_not_supported'] = 'å‘信客户端ä¸è¢«æ”¯æŒã€‚'; +$PHPMAILER_LANG['provide_address'] = 'å¿…é¡»æ供至少一个收件人地å€ã€‚'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误:收件人地å€é”™è¯¯ï¼š'; +//$PHPMAILER_LANG['signing'] = 'Signing Error: '; +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; +?> \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/test/contents.html b/saf/lib/Ext/phpmailer/test/contents.html new file mode 100644 index 00000000..dbb8bfee --- /dev/null +++ b/saf/lib/Ext/phpmailer/test/contents.html @@ -0,0 +1,10 @@ + + + + Email test + + + +

Here is a test HTML email

+ + diff --git a/saf/lib/Ext/phpmailer/test/phpmailerTest.php b/saf/lib/Ext/phpmailer/test/phpmailerTest.php new file mode 100644 index 00000000..254d9cae --- /dev/null +++ b/saf/lib/Ext/phpmailer/test/phpmailerTest.php @@ -0,0 +1,670 @@ +Mail = new PHPMailer(); + + $this->Mail->Priority = 3; + $this->Mail->Encoding = "8bit"; + $this->Mail->CharSet = "iso-8859-1"; + if (array_key_exists('mail_from', $_REQUEST)) { + $this->Mail->From = $_REQUEST['mail_from']; + } else { + $this->Mail->From = 'unit_test@phpmailer.sf.net'; + } + $this->Mail->FromName = "Unit Tester"; + $this->Mail->Sender = ""; + $this->Mail->Subject = "Unit Test"; + $this->Mail->Body = ""; + $this->Mail->AltBody = ""; + $this->Mail->WordWrap = 0; + if (array_key_exists('mail_host', $_REQUEST)) { + $this->Mail->Host = $_REQUEST['mail_host']; + } else { + $this->Mail->Host = 'mail.example.com'; + } + $this->Mail->Port = 25; + $this->Mail->Helo = "localhost.localdomain"; + $this->Mail->SMTPAuth = false; + $this->Mail->Username = ""; + $this->Mail->Password = ""; + $this->Mail->PluginDir = $INCLUDE_DIR; + $this->Mail->AddReplyTo("no_reply@phpmailer.sf.net", "Reply Guy"); + $this->Mail->Sender = "unit_test@phpmailer.sf.net"; + + if(strlen($this->Mail->Host) > 0) { + $this->Mail->Mailer = "smtp"; + } else { + $this->Mail->Mailer = "mail"; + $this->Sender = "unit_test@phpmailer.sf.net"; + } + + if (array_key_exists('mail_to', $_REQUEST)) { + $this->SetAddress($_REQUEST['mail_to'], 'Test User', 'to'); + } + if (array_key_exists('mail_cc', $_REQUEST) and strlen($_REQUEST['mail_cc']) > 0) { + $this->SetAddress($_REQUEST['mail_cc'], 'Carbon User', 'cc'); + } + } + + /** + * Run after each test is completed. + */ + function tearDown() { + // Clean global variables + $this->Mail = NULL; + $this->ChangeLog = array(); + $this->NoteLog = array(); + } + + + /** + * Build the body of the message in the appropriate format. + * @private + * @returns void + */ + function BuildBody() { + $this->CheckChanges(); + + // Determine line endings for message + if($this->Mail->ContentType == "text/html" || strlen($this->Mail->AltBody) > 0) + { + $eol = "
"; + $bullet = "
  • "; + $bullet_start = "
      "; + $bullet_end = "
    "; + } + else + { + $eol = "\n"; + $bullet = " - "; + $bullet_start = ""; + $bullet_end = ""; + } + + $ReportBody = ""; + + $ReportBody .= "---------------------" . $eol; + $ReportBody .= "Unit Test Information" . $eol; + $ReportBody .= "---------------------" . $eol; + $ReportBody .= "phpmailer version: " . PHPMailer::VERSION . $eol; + $ReportBody .= "Content Type: " . $this->Mail->ContentType . $eol; + + if(strlen($this->Mail->Host) > 0) + $ReportBody .= "Host: " . $this->Mail->Host . $eol; + + // If attachments then create an attachment list + $attachments = $this->Mail->GetAttachments(); + if(count($attachments) > 0) + { + $ReportBody .= "Attachments:" . $eol; + $ReportBody .= $bullet_start; + foreach($attachments as $attachment) { + $ReportBody .= $bullet . "Name: " . $attachment[1] . ", "; + $ReportBody .= "Encoding: " . $attachment[3] . ", "; + $ReportBody .= "Type: " . $attachment[4] . $eol; + } + $ReportBody .= $bullet_end . $eol; + } + + // If there are changes then list them + if(count($this->ChangeLog) > 0) + { + $ReportBody .= "Changes" . $eol; + $ReportBody .= "-------" . $eol; + + $ReportBody .= $bullet_start; + for($i = 0; $i < count($this->ChangeLog); $i++) + { + $ReportBody .= $bullet . $this->ChangeLog[$i][0] . " was changed to [" . + $this->ChangeLog[$i][1] . "]" . $eol; + } + $ReportBody .= $bullet_end . $eol . $eol; + } + + // If there are notes then list them + if(count($this->NoteLog) > 0) + { + $ReportBody .= "Notes" . $eol; + $ReportBody .= "-----" . $eol; + + $ReportBody .= $bullet_start; + for($i = 0; $i < count($this->NoteLog); $i++) + { + $ReportBody .= $bullet . $this->NoteLog[$i] . $eol; + } + $ReportBody .= $bullet_end; + } + + // Re-attach the original body + $this->Mail->Body .= $eol . $eol . $ReportBody; + } + + /** + * Check which default settings have been changed for the report. + * @private + * @returns void + */ + function CheckChanges() { + if($this->Mail->Priority != 3) + $this->AddChange("Priority", $this->Mail->Priority); + if($this->Mail->Encoding != "8bit") + $this->AddChange("Encoding", $this->Mail->Encoding); + if($this->Mail->CharSet != "iso-8859-1") + $this->AddChange("CharSet", $this->Mail->CharSet); + if($this->Mail->Sender != "") + $this->AddChange("Sender", $this->Mail->Sender); + if($this->Mail->WordWrap != 0) + $this->AddChange("WordWrap", $this->Mail->WordWrap); + if($this->Mail->Mailer != "mail") + $this->AddChange("Mailer", $this->Mail->Mailer); + if($this->Mail->Port != 25) + $this->AddChange("Port", $this->Mail->Port); + if($this->Mail->Helo != "localhost.localdomain") + $this->AddChange("Helo", $this->Mail->Helo); + if($this->Mail->SMTPAuth) + $this->AddChange("SMTPAuth", "true"); + } + + /** + * Adds a change entry. + * @private + * @returns void + */ + function AddChange($sName, $sNewValue) { + $cur = count($this->ChangeLog); + $this->ChangeLog[$cur][0] = $sName; + $this->ChangeLog[$cur][1] = $sNewValue; + } + + /** + * Adds a simple note to the message. + * @public + * @returns void + */ + function AddNote($sValue) { + $this->NoteLog[] = $sValue; + } + + /** + * Adds all of the addresses + * @public + * @returns void + */ + function SetAddress($sAddress, $sName = "", $sType = "to") { + switch($sType) + { + case "to": + return $this->Mail->AddAddress($sAddress, $sName); + case "cc": + return $this->Mail->AddCC($sAddress, $sName); + case "bcc": + return $this->Mail->AddBCC($sAddress, $sName); + } + } + + ///////////////////////////////////////////////// + // UNIT TESTS + ///////////////////////////////////////////////// + + /** + * Try a plain message. + */ + function test_WordWrap() { + + $this->Mail->WordWrap = 40; + $my_body = "Here is the main body of this message. It should " . + "be quite a few lines. It should be wrapped at the " . + "40 characters. Make sure that it is."; + $nBodyLen = strlen($my_body); + $my_body .= "\n\nThis is the above body length: " . $nBodyLen; + + $this->Mail->Body = $my_body; + $this->Mail->Subject .= ": Wordwrap"; + + $this->BuildBody(); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Try a plain message. + */ + function test_Low_Priority() { + + $this->Mail->Priority = 5; + $this->Mail->Body = "Here is the main body. There should be " . + "a reply to address in this message."; + $this->Mail->Subject .= ": Low Priority"; + $this->Mail->AddReplyTo("nobody@nobody.com", "Nobody (Unit Test)"); + + $this->BuildBody(); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Simple plain file attachment test. + */ + function test_Multiple_Plain_FileAttachment() { + + $this->Mail->Body = "Here is the text body"; + $this->Mail->Subject .= ": Plain + Multiple FileAttachments"; + + if(!$this->Mail->AddAttachment("test.png")) + { + $this->assertTrue(false, $this->Mail->ErrorInfo); + return; + } + + if(!$this->Mail->AddAttachment(__FILE__, "test.txt")) + { + $this->assertTrue(false, $this->Mail->ErrorInfo); + return; + } + + $this->BuildBody(); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Simple plain string attachment test. + */ + function test_Plain_StringAttachment() { + + $this->Mail->Body = "Here is the text body"; + $this->Mail->Subject .= ": Plain + StringAttachment"; + + $sAttachment = "These characters are the content of the " . + "string attachment.\nThis might be taken from a ". + "database or some other such thing. "; + + $this->Mail->AddStringAttachment($sAttachment, "string_attach.txt"); + + $this->BuildBody(); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Plain quoted-printable message. + */ + function test_Quoted_Printable() { + + $this->Mail->Body = "Here is the main body"; + $this->Mail->Subject .= ": Plain + Quoted-printable"; + $this->Mail->Encoding = "quoted-printable"; + + $this->BuildBody(); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + + //Check that a quoted printable encode and decode results in the same as went in + $t = substr(file_get_contents(__FILE__), 0, 1024); //Just pick a chunk of this file as test content + $this->assertEquals($t, quoted_printable_decode($this->Mail->EncodeQP($t)), 'QP encoding round-trip failed'); + //$this->assertEquals($t, quoted_printable_decode($this->Mail->EncodeQPphp($t)), 'Native PHP QP encoding round-trip failed'); //TODO the PHP qp encoder is quite broken + + } + + /** + * Try a plain message. + */ + function test_Html() { + + $this->Mail->IsHTML(true); + $this->Mail->Subject .= ": HTML only"; + + $this->Mail->Body = "This is a test message written in HTML.
    " . + "Go to " . + "http://phpmailer.sourceforge.net/ for new versions of " . + "phpmailer.

    Thank you!"; + + $this->BuildBody(); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Simple HTML and attachment test + */ + function test_HTML_Attachment() { + + $this->Mail->Body = "This is the HTML part of the email."; + $this->Mail->Subject .= ": HTML + Attachment"; + $this->Mail->IsHTML(true); + + if(!$this->Mail->AddAttachment(__FILE__, "test_attach.txt")) + { + $this->assertTrue(false, $this->Mail->ErrorInfo); + return; + } + + $this->BuildBody(); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * An embedded attachment test. + */ + function test_Embedded_Image() { + + $this->Mail->Body = "Embedded Image: \"phpmailer\"" . + "Here is an image!"; + $this->Mail->Subject .= ": Embedded Image"; + $this->Mail->IsHTML(true); + + if(!$this->Mail->AddEmbeddedImage("test.png", "my-attach", "test.png", + "base64", "image/png")) + { + $this->assertTrue(false, $this->Mail->ErrorInfo); + return; + } + + $this->BuildBody(); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + //For code coverage + $this->Mail->AddEmbeddedImage('thisfiledoesntexist', 'xyz'); //Non-existent file + $this->Mail->AddEmbeddedImage(__FILE__, '123'); //Missing name + + } + + /** + * An embedded attachment test. + */ + function test_Multi_Embedded_Image() { + + $this->Mail->Body = "Embedded Image: \"phpmailer\"" . + "Here is an image!"; + $this->Mail->Subject .= ": Embedded Image + Attachment"; + $this->Mail->IsHTML(true); + + if(!$this->Mail->AddEmbeddedImage("test.png", "my-attach", "test.png", + "base64", "image/png")) + { + $this->assertTrue(false, $this->Mail->ErrorInfo); + return; + } + + if(!$this->Mail->AddAttachment(__FILE__, "test.txt")) + { + $this->assertTrue(false, $this->Mail->ErrorInfo); + return; + } + + $this->BuildBody(); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Simple multipart/alternative test. + */ + function test_AltBody() { + + $this->Mail->Body = "This is the HTML part of the email."; + $this->Mail->AltBody = "Here is the text body of this message. " . + "It should be quite a few lines. It should be wrapped at the " . + "40 characters. Make sure that it is."; + $this->Mail->WordWrap = 40; + $this->AddNote("This is a mulipart alternative email"); + $this->Mail->Subject .= ": AltBody + Word Wrap"; + + $this->BuildBody(); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Simple HTML and attachment test + */ + function test_AltBody_Attachment() { + + $this->Mail->Body = "This is the HTML part of the email."; + $this->Mail->AltBody = "This is the text part of the email."; + $this->Mail->Subject .= ": AltBody + Attachment"; + $this->Mail->IsHTML(true); + + if(!$this->Mail->AddAttachment(__FILE__, "test_attach.txt")) + { + $this->assertTrue(false, $this->Mail->ErrorInfo); + return; + } + + $this->BuildBody(); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + if (is_writable('.')) { + file_put_contents('message.txt', $this->Mail->CreateHeader() . $this->Mail->CreateBody()); + } else { + $this->assertTrue(false, 'Could not write local file - check permissions'); + } + } + + function test_MultipleSend() { + $this->Mail->Body = "Sending two messages without keepalive"; + $this->BuildBody(); + $subject = $this->Mail->Subject; + + $this->Mail->Subject = $subject . ": SMTP 1"; + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + + $this->Mail->Subject = $subject . ": SMTP 2"; + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + function test_SendmailSend() { + $this->Mail->Body = "Sending via sendmail"; + $this->BuildBody(); + $subject = $this->Mail->Subject; + + $this->Mail->Subject = $subject . ": sendmail"; + $this->Mail->IsSendmail(); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + function test_MailSend() { + $this->Mail->Body = "Sending via mail()"; + $this->BuildBody(); + $subject = $this->Mail->Subject; + + $this->Mail->Subject = $subject . ": mail()"; + $this->Mail->IsMail(); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + function test_SmtpKeepAlive() { + $this->Mail->Body = "This was done using the SMTP keep-alive."; + $this->BuildBody(); + $subject = $this->Mail->Subject; + + $this->Mail->SMTPKeepAlive = true; + $this->Mail->Subject = $subject . ": SMTP keep-alive 1"; + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + + $this->Mail->Subject = $subject . ": SMTP keep-alive 2"; + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + $this->Mail->SmtpClose(); + } + + /** + * Tests this denial of service attack: + * http://www.cybsec.com/vuln/PHPMailer-DOS.pdf + */ + function test_DenialOfServiceAttack() { + $this->Mail->Body = "This should no longer cause a denial of service."; + $this->BuildBody(); + + $this->Mail->Subject = str_repeat("A", 998); + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + function test_Error() { + $this->Mail->Subject .= ": This should be sent"; + $this->BuildBody(); + $this->Mail->ClearAllRecipients(); // no addresses should cause an error + $this->assertTrue($this->Mail->IsError() == false, "Error found"); + $this->assertTrue($this->Mail->Send() == false, "Send succeeded"); + $this->assertTrue($this->Mail->IsError(), "No error found"); + $this->assertEquals('You must provide at least one recipient email address.', $this->Mail->ErrorInfo); + $this->Mail->AddAddress($_REQUEST['mail_to']); + $this->assertTrue($this->Mail->Send(), "Send failed"); + } + + function test_Addressing() { + $this->assertFalse($this->Mail->AddAddress('a@example..com'), 'Invalid address accepted'); + $this->assertTrue($this->Mail->AddAddress('a@example.com'), 'Addressing failed'); + $this->assertFalse($this->Mail->AddAddress('a@example.com'), 'Duplicate addressing failed'); + $this->assertTrue($this->Mail->AddCC('b@example.com'), 'CC addressing failed'); + $this->assertFalse($this->Mail->AddCC('b@example.com'), 'CC duplicate addressing failed'); + $this->assertFalse($this->Mail->AddCC('a@example.com'), 'CC duplicate addressing failed (2)'); + $this->assertTrue($this->Mail->AddBCC('c@example.com'), 'BCC addressing failed'); + $this->assertFalse($this->Mail->AddBCC('c@example.com'), 'BCC duplicate addressing failed'); + $this->assertFalse($this->Mail->AddBCC('a@example.com'), 'BCC duplicate addressing failed (2)'); + $this->assertTrue($this->Mail->AddReplyTo('a@example.com'), 'Replyto Addressing failed'); + $this->assertFalse($this->Mail->AddReplyTo('a@example..com'), 'Invalid Replyto address accepted'); + $this->Mail->ClearAddresses(); + $this->Mail->ClearCCs(); + $this->Mail->ClearBCCs(); + $this->Mail->ClearReplyTos(); + } + + /** + * Test language files for missing and excess translations + * All languages are compared with English + */ + function test_Translations() { + $this->Mail->SetLanguage('en'); + $definedStrings = $this->Mail->GetTranslations(); + foreach (new DirectoryIterator('../language') as $fileInfo) { + if($fileInfo->isDot()) continue; + $matches = array(); + //Only look at language files, ignore anything else in there + if (preg_match('/^phpmailer\.lang-([a-z_]{2,})\.php$/', $fileInfo->getFilename(), $matches)) { + $lang = $matches[1]; //Extract language code + $PHPMAILER_LANG = array(); //Language strings get put in here + include $fileInfo->getPathname(); //Get language strings + $missing = array_diff(array_keys($definedStrings), array_keys($PHPMAILER_LANG)); + $extra = array_diff(array_keys($PHPMAILER_LANG), array_keys($definedStrings)); + $this->assertTrue(empty($missing), "Missing translations in $lang: ". implode(', ', $missing)); + $this->assertTrue(empty($extra), "Extra translations in $lang: ". implode(', ', $extra)); + } + } + } + + /** + * Encoding tests + */ + function test_Encodings() { + $this->Mail->Charset = 'iso-8859-1'; + $this->assertEquals('=A1Hola!_Se=F1or!', $this->Mail->EncodeQ('¡Hola! Señor!', 'text'), 'Q Encoding (text) failed'); + $this->assertEquals('=A1Hola!_Se=F1or!', $this->Mail->EncodeQ('¡Hola! Señor!', 'comment'), 'Q Encoding (comment) failed'); + $this->assertEquals('=A1Hola!_Se=F1or!', $this->Mail->EncodeQ('¡Hola! Señor!', 'phrase'), 'Q Encoding (phrase) failed'); + } + + /** + * Signing tests + */ + function test_Signing() { + $this->Mail->Sign('certfile.txt', 'keyfile.txt', 'password'); //TODO this is not really testing signing, but at least helps coverage + } + + /** + * Miscellaneous calls to improve test coverage and some small tests + */ + function test_Miscellaneous() { + $this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf') , 'MIME TYPE lookup failed'); + $this->Mail->AddCustomHeader('SomeHeader: Some Value'); + $this->Mail->ClearCustomHeaders(); + $this->Mail->ClearAttachments(); + $this->Mail->IsHTML(false); + $this->Mail->IsSMTP(); + $this->Mail->IsMail(); + $this->Mail->IsSendMail(); + $this->Mail->IsQmail(); + $this->Mail->SetLanguage('fr'); + $this->Mail->Sender = ''; + $this->Mail->CreateHeader(); + $this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded'); + $this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed'); + $this->Mail->getFile(__FILE__); + } +} + +/** +* This is a sample form for setting appropriate test values through a browser +* These values can also be set using a file called testbootstrap.php (not in svn) in the same folder as this script +* which is probably more useful if you run these tests a lot + + +

    phpmailer Unit Test

    +By entering a SMTP hostname it will automatically perform tests with SMTP. + +
    + +From Address: "/> +
    +To Address: "/> +
    +Cc Address: "/> +
    +SMTP Hostname: "/> +

    + + +

    + + + */ + +?> \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/test/test.png b/saf/lib/Ext/phpmailer/test/test.png new file mode 100644 index 00000000..02de5a7a Binary files /dev/null and b/saf/lib/Ext/phpmailer/test/test.png differ diff --git a/saf/lib/Ext/phpmailer/test/test_callback.php b/saf/lib/Ext/phpmailer/test/test_callback.php new file mode 100644 index 00000000..260a4487 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test/test_callback.php @@ -0,0 +1,84 @@ + + +PHPMailer Lite - DKIM and Callback Function test + + + +\n"; + return true; +} + +$testLite = false; + +if ($testLite) { + require_once '../class.phpmailer-lite.php'; + $mail = new PHPMailerLite(); +} else { + require_once '../class.phpmailer.php'; + $mail = new PHPMailer(); +} + +try { + $mail->IsMail(); // telling the class to use SMTP + $mail->SetFrom('you@yourdomain.com', 'Your Name'); + $mail->AddAddress('another@yourdomain.com', 'John Doe'); + $mail->Subject = 'PHPMailer Lite Test Subject via Mail()'; + $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically + $mail->MsgHTML(file_get_contents('contents.html')); + $mail->AddAttachment('images/phpmailer.gif'); // attachment + $mail->AddAttachment('images/phpmailer_mini.gif'); // attachment + $mail->action_function = 'callbackAction'; + $mail->Send(); + echo "Message Sent OK

    \n"; +} catch (phpmailerException $e) { + echo $e->errorMessage(); //Pretty error messages from PHPMailer +} catch (Exception $e) { + echo $e->getMessage(); //Boring error messages from anything else! +} + +function cleanEmails($str,$type) { + if ($type == 'cc') { + $addy['Email'] = $str[0]; + $addy['Name'] = $str[1]; + return $addy; + } + if (!strstr($str, ' <')) { + $addy['Name'] = ''; + $addy['Email'] = $addy; + return $addy; + } + $addyArr = explode(' <', $str); + if (substr($addyArr[1],-1) == '>') { + $addyArr[1] = substr($addyArr[1],0,-1); + } + $addy['Name'] = $addyArr[0]; + $addy['Email'] = $addyArr[1]; + $addy['Email'] = str_replace('@', '@', $addy['Email']); + return $addy; +} + +?> + + diff --git a/saf/lib/Ext/phpmailer/test/testemail.php b/saf/lib/Ext/phpmailer/test/testemail.php new file mode 100644 index 00000000..d96e2001 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test/testemail.php @@ -0,0 +1,48 @@ +IsSMTP(); // tell the class to use SMTP + $mail->SMTPAuth = true; // enable SMTP authentication + $mail->Port = 25; // set the SMTP server port + $mail->Host = "mail.yourdomain.com"; // SMTP server + $mail->Username = "name@domain.com"; // SMTP server username + $mail->Password = "password"; // SMTP server password + + $mail->IsSendmail(); // tell the class to use Sendmail + + $mail->AddReplyTo("name@domain.com","First Last"); + + $mail->From = "name@domain.com"; + $mail->FromName = "First Last"; + + $to = "someone@example...com"; + + $mail->AddAddress($to); + + $mail->Subject = "First PHPMailer Message"; + + $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test + $mail->WordWrap = 80; // set word wrap + + $mail->MsgHTML($body); + + $mail->IsHTML(true); // send as HTML + + $mail->Send(); + echo 'Message has been sent.'; +} catch (phpmailerException $e) { + echo $e->errorMessage(); +} +?> \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/test_script/LGPLv3.txt b/saf/lib/Ext/phpmailer/test_script/LGPLv3.txt new file mode 100644 index 00000000..3f9959fc --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/LGPLv3.txt @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/test_script/contents.html b/saf/lib/Ext/phpmailer/test_script/contents.html new file mode 100644 index 00000000..741d3d2d --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/contents.html @@ -0,0 +1,14 @@ + +
    +

    +
    + This is a test of PHPMailer v5.0.0 for PHP5/6.
    +
    +This particular example uses HTML, with a <div> tag and inline
    +styles.
    +
    +Also note the use of the PHPMailer at the top with no specific code to handle +including it in the body of the email.
    + + + diff --git a/saf/lib/Ext/phpmailer/test_script/images/aikido.gif b/saf/lib/Ext/phpmailer/test_script/images/aikido.gif new file mode 100644 index 00000000..2a9bcf44 Binary files /dev/null and b/saf/lib/Ext/phpmailer/test_script/images/aikido.gif differ diff --git a/saf/lib/Ext/phpmailer/test_script/images/bkgrnd.gif b/saf/lib/Ext/phpmailer/test_script/images/bkgrnd.gif new file mode 100644 index 00000000..bc89624c Binary files /dev/null and b/saf/lib/Ext/phpmailer/test_script/images/bkgrnd.gif differ diff --git a/saf/lib/Ext/phpmailer/test_script/images/phpmailer.gif b/saf/lib/Ext/phpmailer/test_script/images/phpmailer.gif new file mode 100644 index 00000000..5e269714 Binary files /dev/null and b/saf/lib/Ext/phpmailer/test_script/images/phpmailer.gif differ diff --git a/saf/lib/Ext/phpmailer/test_script/index.php b/saf/lib/Ext/phpmailer/test_script/index.php new file mode 100644 index 00000000..9823b689 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/index.php @@ -0,0 +1,427 @@ + + + + +PHPMailer Test Page + + + + + + + +"; + +if ( substr(phpversion(),0,1) < 5 ) { echo exit("ERROR: Wrong PHP version"); } + +$CFG['smtp_debug'] = 1; +$CFG['smtp_server'] = 'mail.yourserver.com'; +$CFG['smtp_port'] = '25'; +$CFG['smtp_authenticate'] = 'true'; +$CFG['smtp_username'] = 'name@yourserver.com'; +$CFG['smtp_password'] = 'yourpassword'; + +if ( $_POST['submit'] == "Submit" ) { + + class phpmailerAppException extends Exception { + public function errorMessage() { + $errorMsg = '' . $this->getMessage() . "
    "; + return $errorMsg; + } + } + + try { + $to = $_POST['To_Email']; + if(filter_var($to, FILTER_VALIDATE_EMAIL) === FALSE) { + throw new phpmailerAppException("Email address " . $to . " is invalid -- aborting!
    "); + } + } catch (phpmailerAppException $e) { + echo $e->errorMessage(); + return false; + } + + require_once("../class.phpmailer.php"); + + $mail = new PHPMailer(); + + if ( $_POST['Message'] == '' ) { + $body = $mail->getFile('contents.html'); + $body = eregi_replace("[\]",'',$body); + } else { + $body = $_POST['Message']; + } + + if ( $_POST['test_type'] == "smtp" ) { + $mail->IsSMTP(); // telling the class to use SMTP + $mail->SMTPDebug = $_POST['smtp_debug']; + $mail->SMTPAuth = $_POST['smtp_authenticate']; // enable SMTP authentication + $mail->Port = $_POST['smtp_port']; // set the SMTP port + $mail->Host = $_POST['smtp_server']; // SMTP server + $mail->Username = $_POST['authenticate_username']; // SMTP account username + $mail->Password = $_POST['authenticate_password']; // SMTP account password + } elseif ( $_POST['test_type'] == "mail" ) { + $mail->IsMail(); // telling the class to use PHP's Mail() + } elseif ( $_POST['test_type'] == "sendmail" ) { + $mail->IsSendmail(); // telling the class to use Sendmail + } elseif ( $_POST['test_type'] == "qmail" ) { + $mail->IsQmail(); // telling the class to use Qmail + } + + if ( $_POST['From_Name'] != '' ) { + $mail->AddReplyTo($_POST['From_Email'],$_POST['From_Name']); + $mail->From = $_POST['From_Email']; + $mail->FromName = $_POST['From_Name']; + } else { + $mail->AddReplyTo($_POST['From_Email']); + $mail->From = $_POST['From_Email']; + $mail->FromName = $_POST['From_Email']; + } + + if ( $_POST['To_Name'] != '' ) { + $mail->AddAddress($to,$_POST['To_Name']); + } else { + $mail->AddAddress($to); + } + + if ( $_POST['bcc_Email'] != '' ) { + $indiBCC = explode(" ", $_POST['bcc_Email']); + foreach ($indiBCC as $key => $value) { + $mail->AddBCC($value); + } + } + + if ( $_POST['cc_Email'] != '' ) { + $indiCC = explode(" ", $_POST['cc_Email']); + foreach ($indiCC as $key => $value) { + $mail->AddCC($value); + } + } + + $mail->Subject = $_POST['Subject'] . ' (PHPMailer test using ' . strtoupper($_POST['test_type']) . ')'; + + require_once('../class.html2text.inc.php'); + $h2t =& new html2text($body); + $mail->AltBody = $h2t->get_text(); + //$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test + $mail->WordWrap = 80; // set word wrap + + $mail->MsgHTML($body); + + // $mail->IsHTML(true); // send as HTML + + $mail->AddAttachment("images/aikido.gif", "aikido.gif"); // optional name + $mail->AddAttachment("images/phpmailer.gif", "phpmailer.gif"); // optional name + + try { + if ( !$mail->Send() ) { + $error = "Unable to send to: " . $to . "
    "; + throw new phpmailerAppException($error); + } else { + echo 'Message has been sent using ' . strtoupper($_POST['test_type']) . "

    "; + } + } + catch (phpmailerAppException $e) { + $errorMsg[] = $e->errorMessage(); + } + + if ( count($errorMsg) > 0 ) { + foreach ($errorMsg as $key => $value) { + $thisError = $key + 1; + echo $thisError . ': ' . $value; + } + } + ?> +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +
    + Script:
    +
    +class phpmailerAppException extends Exception {
    +  public function errorMessage() {
    +    $errorMsg = '' . $this->getMessage() . "
    "; + return $errorMsg; + } +} + +try { + $to = ; + if(filter_var($to, FILTER_VALIDATE_EMAIL) === FALSE) { + throw new phpmailerAppException("Email address " . $to . " is invalid -- aborting!
    "); + } +} catch (phpmailerAppException $e) { + echo $e->errorMessage(); + return false; +} + +require_once("../class.phpmailer.php"); + +$mail = new PHPMailer(); + +getFile(\'contents.html\');' . "\n"; + echo '$body = eregi_replace("[\]",\'\',$body);' . "\n"; +} else { + echo '$body = ' . $_POST['Message'] . "\n"; +} + +echo "\n"; + +if ( $_POST['test_type'] == "smtp" ) { + echo '$mail->IsSMTP(); // telling the class to use SMTP' . "\n"; + echo '$mail->SMTPDebug = ' . $_POST['smtp_debug'] . "\n"; + echo '$mail->SMTPAuth = ' . $_POST['smtp_authenticate']; // enable SMTP authentication' . "\n"; + echo '$mail->Port = ' . $_POST['smtp_port']; // set the SMTP port' . "\n"; + echo '$mail->Host = ' . $_POST['smtp_server']; // SMTP server' . "\n"; + echo '$mail->Username = ' . $_POST['authenticate_username']; // SMTP account username' . "\n"; + echo '$mail->Password = ' . $_POST['authenticate_password']; // SMTP account password' . "\n"; +} elseif ( $_POST['test_type'] == "mail" ) { + echo '$mail->IsMail(); // telling the class to use PHP\'s Mail()' . "\n"; +} elseif ( $_POST['test_type'] == "sendmail" ) { + echo '$mail->IsSendmail(); // telling the class to use Sendmail' . "\n"; +} elseif ( $_POST['test_type'] == "qmail" ) { + echo '$mail->IsQmail(); // telling the class to use Qmail' . "\n"; +} +?> + +$mail->AddReplyTo('',''); + +$mail->From = ''; +$mail->FromName = ''; + + +$mail->AddAddress('',''); + +$mail->AddAddress(''); + $value) { +echo '$mail->AddBCC(\'' . $value . '\');
    '; + } +} + +if ( $_POST['cc_Email'] != '' ) { + $indiCC = explode(" ", $_POST['cc_Email']); + foreach ($indiCC as $key => $value) { +echo '$mail->AddCC(\'' . $value . '\');
    '; + } +} +?> + +$mail->Subject = (PHPMailer test using ) + +require_once('../class.html2text.inc.php'); +$h2t =& new html2text($body); +$mail->AltBody = $h2t->get_text(); +$mail->WordWrap = 80; // set word wrap + +$mail->MsgHTML($body); + +$mail->AddAttachment("images/aikido.gif", "aikido.gif"); // optional name +$mail->AddAttachment("images/phpmailer.gif", "phpmailer.gif"); // optional name + +try { + if ( !$mail->Send() ) { + $error = "Unable to send to: " . $to . "
    "; + throw new phpmailerAppException($error); + } else { + echo 'Message has been sent using

    '; + } +} catch (phpmailerAppException $e) { + $errorMsg[] = $e->errorMessage(); +} + +if ( count($errorMsg) > 0 ) { + foreach ($errorMsg as $key => $value) { + $thisError = $key + 1; + echo $thisError . ': ' . $value; + } +} +
    + + + + + +
    + + + + + +
    Message

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    From Name
    From Email Address
    To Name
    To Email Address
    cc Email Addresses (separate with commas)
    bcc Email Addresses (separate with commas)
    Subject
    Message
    If blank, will use content.html
    +
    Mail Test Specs

    + + + + + +
    Test Type + + + + + + + + + + + + + + + + +
    >Mail()
    >Sendmail
    >Qmail
    >SMTP
    +
    + If SMTP test:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SMTP Debug ?
    SMTP Server
    SMTP Port
    SMTP Authenticate ? value="">
    Authenticate Username
    Authenticate Password
    +
    +
    + Test will include two attachments, plus one of the attachments is used as an inline graphic in the message body.
    +
    + +
    + \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/clipboard.swf b/saf/lib/Ext/phpmailer/test_script/scripts/clipboard.swf new file mode 100644 index 00000000..1b4d90a0 Binary files /dev/null and b/saf/lib/Ext/phpmailer/test_script/scripts/clipboard.swf differ diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushBash.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushBash.js new file mode 100644 index 00000000..8137f786 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushBash.js @@ -0,0 +1,59 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Bash = function() +{ + var keywords = 'if fi then elif else for do done until while break continue case function return in eq ne gt lt ge le'; + var commands = 'alias apropos awk bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' + + 'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' + + 'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' + + 'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' + + 'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' + + 'import install join kill less let ln local locate logname logout look lpc lpr lprint ' + + 'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' + + 'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' + + 'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' + + 'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' + + 'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' + + 'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' + + 'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' + + 'vi watch wc whereis which who whoami Wget xargs yes' + ; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords + { regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' } // commands + ]; +} + +SyntaxHighlighter.brushes.Bash.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Bash.aliases = ['bash', 'shell']; + diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushCSharp.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushCSharp.js new file mode 100644 index 00000000..e8d111b6 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushCSharp.js @@ -0,0 +1,64 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.CSharp = function() +{ + var keywords = 'abstract as base bool break byte case catch char checked class const ' + + 'continue decimal default delegate do double else enum event explicit ' + + 'extern false finally fixed float for foreach get goto if implicit in int ' + + 'interface internal is lock long namespace new null object operator out ' + + 'override params private protected public readonly ref return sbyte sealed set ' + + 'short sizeof stackalloc static string struct switch this throw true try ' + + 'typeof uint ulong unchecked unsafe ushort using virtual void while'; + + function fixComments(match, regexInfo) + { + var css = (match[0].indexOf("///") == 0) + ? 'color1' + : 'comments' + ; + + return [new SyntaxHighlighter.Match(match[0], match.index, css)]; + } + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments + { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings + { regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // c# keyword + ]; + + this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); +}; + +SyntaxHighlighter.brushes.CSharp.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.CSharp.aliases = ['c#', 'c-sharp', 'csharp']; + diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushCpp.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushCpp.js new file mode 100644 index 00000000..8da0d1bf --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushCpp.js @@ -0,0 +1,99 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Cpp = function() +{ + // Copyright 2006 Shin, YoungJin + + var datatypes = 'ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR ' + + 'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH ' + + 'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP ' + + 'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY ' + + 'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT ' + + 'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE ' + + 'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF ' + + 'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR ' + + 'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR ' + + 'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT ' + + 'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 ' + + 'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR ' + + 'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 ' + + 'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT ' + + 'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ' + + 'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM ' + + 'char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t ' + + 'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS ' + + 'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t ' + + '__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t ' + + 'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler ' + + 'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function ' + + 'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf ' + + 'va_list wchar_t wctrans_t wctype_t wint_t signed'; + + var keywords = 'break case catch class const __finally __exception __try ' + + 'const_cast continue private public protected __declspec ' + + 'default delete deprecated dllexport dllimport do dynamic_cast ' + + 'else enum explicit extern if for friend goto inline ' + + 'mutable naked namespace new noinline noreturn nothrow ' + + 'register reinterpret_cast return selectany ' + + 'sizeof static static_cast struct switch template this ' + + 'thread throw true false try typedef typeid typename union ' + + 'using uuid virtual void volatile whcar_t while'; + + var functions = 'assert isalnum isalpha iscntrl isdigit isgraph islower isprint' + + 'ispunct isspace isupper isxdigit tolower toupper errno localeconv ' + + 'setlocale acos asin atan atan2 ceil cos cosh exp fabs floor fmod ' + + 'frexp ldexp log log10 modf pow sin sinh sqrt tan tanh jmp_buf ' + + 'longjmp setjmp raise signal sig_atomic_t va_arg va_end va_start ' + + 'clearerr fclose feof ferror fflush fgetc fgetpos fgets fopen ' + + 'fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell ' + + 'fwrite getc getchar gets perror printf putc putchar puts remove ' + + 'rename rewind scanf setbuf setvbuf sprintf sscanf tmpfile tmpnam ' + + 'ungetc vfprintf vprintf vsprintf abort abs atexit atof atoi atol ' + + 'bsearch calloc div exit free getenv labs ldiv malloc mblen mbstowcs ' + + 'mbtowc qsort rand realloc srand strtod strtol strtoul system ' + + 'wcstombs wctomb memchr memcmp memcpy memmove memset strcat strchr ' + + 'strcmp strcoll strcpy strcspn strerror strlen strncat strncmp ' + + 'strncpy strpbrk strrchr strspn strstr strtok strxfrm asctime ' + + 'clock ctime difftime gmtime localtime mktime strftime time'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments + { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings + { regex: /^ *#.*/gm, css: 'preprocessor' }, + { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'color1 bold' }, + { regex: new RegExp(this.getKeywords(functions), 'gm'), css: 'functions bold' }, + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword bold' } + ]; +}; + +SyntaxHighlighter.brushes.Cpp.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Cpp.aliases = ['cpp', 'c']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushCss.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushCss.js new file mode 100644 index 00000000..2c6685e8 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushCss.js @@ -0,0 +1,93 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.CSS = function() +{ + function getKeywordsCSS(str) + { + return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b'; + }; + + function getValuesCSS(str) + { + return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b'; + }; + + var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' + + 'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' + + 'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' + + 'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' + + 'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' + + 'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' + + 'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' + + 'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' + + 'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' + + 'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' + + 'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' + + 'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' + + 'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' + + 'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index'; + + var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+ + 'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+ + 'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+ + 'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+ + 'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+ + 'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+ + 'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+ + 'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+ + 'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+ + 'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+ + 'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+ + 'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+ + 'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+ + 'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow'; + + var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings + { regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors + { regex: /(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)/g, css: 'value' }, // sizes + { regex: /!important/g, css: 'color3' }, // !important + { regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords + { regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values + { regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts + ]; + + this.forHtmlScript({ + left: /(<|<)\s*style.*?(>|>)/gi, + right: /(<|<)\/\s*style\s*(>|>)/gi + }); +}; + +SyntaxHighlighter.brushes.CSS.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.CSS.aliases = ['css']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushDelphi.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushDelphi.js new file mode 100644 index 00000000..bc1fdf39 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushDelphi.js @@ -0,0 +1,57 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Delphi = function() +{ + var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' + + 'case char class comp const constructor currency destructor div do double ' + + 'downto else end except exports extended false file finalization finally ' + + 'for function goto if implementation in inherited int64 initialization ' + + 'integer interface is label library longint longword mod nil not object ' + + 'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' + + 'pint64 pointer private procedure program property pshortstring pstring ' + + 'pvariant pwidechar pwidestring protected public published raise real real48 ' + + 'record repeat set shl shortint shortstring shr single smallint string then ' + + 'threadvar to true try type unit until uses val var varirnt while widechar ' + + 'widestring with word write writeln xor'; + + this.regexList = [ + { regex: /\(\*[\s\S]*?\*\)/gm, css: 'comments' }, // multiline comments (* *) + { regex: /{(?!\$)[\s\S]*?}/gm, css: 'comments' }, // multiline comments { } + { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings + { regex: /\{\$[a-zA-Z]+ .+\}/g, css: 'color1' }, // compiler Directives and Region tags + { regex: /\b[\d\.]+\b/g, css: 'value' }, // numbers 12345 + { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // numbers $F5D3 + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword + ]; +}; + +SyntaxHighlighter.brushes.Delphi.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Delphi.aliases = ['delphi', 'pascal']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushDiff.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushDiff.js new file mode 100644 index 00000000..6b4983d7 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushDiff.js @@ -0,0 +1,43 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Diff = function() +{ + this.regexList = [ + { regex: /^\+\+\+.*$/gm, css: 'color2' }, + { regex: /^\-\-\-.*$/gm, css: 'color2' }, + { regex: /^\s.*$/gm, css: 'color1' }, + { regex: /^@@.*@@$/gm, css: 'variable' }, + { regex: /^\+[^\+]{1}.*$/gm, css: 'string' }, + { regex: /^\-[^\-]{1}.*$/gm, css: 'comments' } + ]; +}; + +SyntaxHighlighter.brushes.Diff.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Diff.aliases = ['diff', 'patch']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushGroovy.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushGroovy.js new file mode 100644 index 00000000..582e37ba --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushGroovy.js @@ -0,0 +1,69 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Groovy = function() +{ + // Contributed by Andres Almiray + // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter + + var keywords = 'as assert break case catch class continue def default do else extends finally ' + + 'if in implements import instanceof interface new package property return switch ' + + 'throw throws try while public protected private static'; + var types = 'void boolean byte char short int long float double'; + var constants = 'null'; + var methods = 'allProperties count get size '+ + 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' + + 'findIndexOf grep inject max min reverseEach sort ' + + 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' + + 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' + + 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' + + 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' + + 'transformChar transformLine withOutputStream withPrintWriter withStream ' + + 'withStreams withWriter withWriterAppend write writeLine '+ + 'dump inspect invokeMethod print println step times upto use waitForOrKill '+ + 'getText'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments + { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings + { regex: /""".*"""/g, css: 'string' }, // GStrings + { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword + { regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type + { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants + { regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods + ]; + + this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); +} + +SyntaxHighlighter.brushes.Groovy.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Groovy.aliases = ['groovy']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushJScript.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushJScript.js new file mode 100644 index 00000000..6a1603ac --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushJScript.js @@ -0,0 +1,51 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.JScript = function() +{ + var keywords = 'abstract boolean break byte case catch char class const continue debugger ' + + 'default delete do double else enum export extends false final finally float ' + + 'for function goto if implements import in instanceof int interface long native ' + + 'new null package private protected public return short static super switch ' + + 'synchronized this throw throws transient true try typeof var void volatile while with'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments + { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings + { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords + ]; + + this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags); +}; + +SyntaxHighlighter.brushes.JScript.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.JScript.aliases = ['js', 'jscript', 'javascript']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushJava.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushJava.js new file mode 100644 index 00000000..e1138438 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushJava.js @@ -0,0 +1,55 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Java = function() +{ + var keywords = 'abstract assert boolean break byte case catch char class const ' + + 'continue default do double else enum extends ' + + 'false final finally float for goto if implements import ' + + 'instanceof int interface long native new null ' + + 'package private protected public return ' + + 'short static strictfp super switch synchronized this throw throws true ' + + 'transient try void volatile while'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments + { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings + { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers + { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno + { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword + ]; + + this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); +}; + +SyntaxHighlighter.brushes.Java.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Java.aliases = ['java']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushPerl.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushPerl.js new file mode 100644 index 00000000..1d4ed7ad --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushPerl.js @@ -0,0 +1,74 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Perl = function() +{ + // Contributed by David Simmons-Duffin and Marty Kube + + var funcs = + 'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' + + 'chroot close closedir connect cos crypt defined delete each endgrent ' + + 'endhostent endnetent endprotoent endpwent endservent eof exec exists ' + + 'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' + + 'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' + + 'getnetbyname getnetent getpeername getpgrp getppid getpriority ' + + 'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' + + 'getservbyname getservbyport getservent getsockname getsockopt glob ' + + 'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' + + 'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' + + 'oct open opendir ord pack pipe pop pos print printf prototype push ' + + 'quotemeta rand read readdir readline readlink readpipe recv rename ' + + 'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' + + 'semget semop send setgrent sethostent setnetent setpgrp setpriority ' + + 'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' + + 'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' + + 'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' + + 'system syswrite tell telldir time times tr truncate uc ucfirst umask ' + + 'undef unlink unpack unshift utime values vec wait waitpid warn write'; + + var keywords = + 'bless caller continue dbmclose dbmopen die do dump else elsif eval exit ' + + 'for foreach goto if import last local my next no our package redo ref ' + + 'require return sub tie tied unless untie until use wantarray while'; + + this.regexList = [ + { regex: new RegExp('#[^!].*$', 'gm'), css: 'comments' }, + { regex: new RegExp('^\\s*#!.*$', 'gm'), css: 'preprocessor' }, // shebang + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, + { regex: new RegExp('(\\$|@|%)\\w+', 'g'), css: 'variable' }, + { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } + ]; + + this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags); +} + +SyntaxHighlighter.brushes.Perl.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Perl.aliases = ['perl', 'Perl', 'pl']; \ No newline at end of file diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushPhp.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushPhp.js new file mode 100644 index 00000000..8facae11 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushPhp.js @@ -0,0 +1,91 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Php = function() +{ + var funcs = 'abs acos acosh addcslashes addslashes ' + + 'array_change_key_case array_chunk array_combine array_count_values array_diff '+ + 'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+ + 'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+ + 'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+ + 'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+ + 'array_push array_rand array_reduce array_reverse array_search array_shift '+ + 'array_slice array_splice array_sum array_udiff array_udiff_assoc '+ + 'array_udiff_uassoc array_uintersect array_uintersect_assoc '+ + 'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+ + 'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+ + 'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+ + 'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+ + 'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+ + 'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+ + 'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+ + 'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+ + 'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+ + 'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+ + 'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+ + 'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+ + 'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+ + 'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+ + 'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+ + 'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+ + 'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+ + 'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+ + 'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+ + 'parse_ini_file parse_str parse_url passthru pathinfo readlink realpath rewind rewinddir rmdir '+ + 'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+ + 'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+ + 'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+ + 'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+ + 'strtoupper strtr strval substr substr_compare'; + + var keywords = 'and or xor array as break case ' + + 'cfunction class const continue declare default die do else ' + + 'elseif enddeclare endfor endforeach endif endswitch endwhile ' + + 'extends for foreach function include include_once global if ' + + 'new old_function return static switch use require require_once ' + + 'var while abstract interface public implements extends private protected throw'; + + var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments + { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings + { regex: /\$\w+/g, css: 'variable' }, // variables + { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions + { regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword + ]; + + this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags); +}; + +SyntaxHighlighter.brushes.Php.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Php.aliases = ['php']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushPlain.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushPlain.js new file mode 100644 index 00000000..da9fa6a3 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushPlain.js @@ -0,0 +1,35 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Plain = function() +{ +}; + +SyntaxHighlighter.brushes.Plain.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Plain.aliases = ['text', 'plain']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushPython.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushPython.js new file mode 100644 index 00000000..599633e2 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushPython.js @@ -0,0 +1,56 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Python = function() +{ + // Contributed by Gheorghe Milas + + var keywords = 'and assert break class continue def del elif else ' + + 'except exec finally for from global if import in is ' + + 'lambda not or pass print raise return try yield while'; + + var special = 'None True False self cls class_'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, + { regex: /^\s*@\w+/gm, css: 'decorator' }, + { regex: /(['\"]{3})([^\1])*?\1/gm, css: 'comments' }, + { regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, css: 'string' }, + { regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, css: 'string' }, + { regex: /\+|\-|\*|\/|\%|=|==/gm, css: 'keyword' }, + { regex: /\b\d+\.?\w*/g, css: 'value' }, + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, + { regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' } + ]; + + this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); +}; + +SyntaxHighlighter.brushes.Python.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Python.aliases = ['py', 'python']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushRuby.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushRuby.js new file mode 100644 index 00000000..269bf30c --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushRuby.js @@ -0,0 +1,57 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Ruby = function() +{ + // Contributed by Erik Peterson. + + var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' + + 'END end ensure false for if in module new next nil not or raise redo rescue retry return ' + + 'self super then throw true undef unless until when while yield'; + + var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' + + 'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' + + 'ThreadGroup Thread Time TrueClass'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings + { regex: /\b[A-Z0-9_]+\b/g, css: 'constants' }, // constants + { regex: /:[a-z][A-Za-z0-9_]*/g, css: 'color2' }, // symbols + { regex: /(\$|@@|@)\w+/g, css: 'variable bold' }, // $global, @instance, and @@class variables + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords + { regex: new RegExp(this.getKeywords(builtins), 'gm'), css: 'color1' } // builtins + ]; + + this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); +}; + +SyntaxHighlighter.brushes.Ruby.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Ruby.aliases = ['ruby', 'rails', 'ror']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushScala.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushScala.js new file mode 100644 index 00000000..f26b677c --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushScala.js @@ -0,0 +1,53 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Scala = function() +{ + // Contributed by Yegor Jbanov and David Bernard. + + var keywords = 'val sealed case def true trait implicit forSome import match object null finally super ' + + 'override try lazy for var catch throw type extends class while with new final yield abstract ' + + 'else do if return protected private this package false'; + + var keyops = '[_:=><%#@]+'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments + { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments + { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // multi-line strings + { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double-quoted string + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings + { regex: /0x[a-f0-9]+|\d+(\.\d+)?/gi, css: 'value' }, // numbers + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords + { regex: new RegExp(keyops, 'gm'), css: 'keyword' } // scala keyword + ]; +} + +SyntaxHighlighter.brushes.Scala.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Scala.aliases = ['scala']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushSql.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushSql.js new file mode 100644 index 00000000..bf937470 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushSql.js @@ -0,0 +1,68 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Sql = function() +{ + var funcs = 'abs avg case cast coalesce convert count current_timestamp ' + + 'current_user day isnull left lower month nullif replace right ' + + 'session_user space substring sum system_user upper user year'; + + var keywords = 'absolute action add after alter as asc at authorization begin bigint ' + + 'binary bit by cascade char character check checkpoint close collate ' + + 'column commit committed connect connection constraint contains continue ' + + 'create cube current current_date current_time cursor database date ' + + 'deallocate dec decimal declare default delete desc distinct double drop ' + + 'dynamic else end end-exec escape except exec execute false fetch first ' + + 'float for force foreign forward free from full function global goto grant ' + + 'group grouping having hour ignore index inner insensitive insert instead ' + + 'int integer intersect into is isolation key last level load local max min ' + + 'minute modify move name national nchar next no numeric of off on only ' + + 'open option order out output partial password precision prepare primary ' + + 'prior privileges procedure public read real references relative repeatable ' + + 'restrict return returns revoke rollback rollup rows rule schema scroll ' + + 'second section select sequence serializable set size smallint static ' + + 'statistics table temp temporary then time timestamp to top transaction ' + + 'translation trigger true truncate uncommitted union unique update values ' + + 'varchar varying view when where with work'; + + var operators = 'all and any between cross in join like not null or outer some'; + + this.regexList = [ + { regex: /--(.*)$/gm, css: 'comments' }, // one line and multiline comments + { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings + { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // single quoted strings + { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'color2' }, // functions + { regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such + { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword + ]; +}; + +SyntaxHighlighter.brushes.Sql.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Sql.aliases = ['sql']; + diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushVb.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushVb.js new file mode 100644 index 00000000..84c7b0c4 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushVb.js @@ -0,0 +1,58 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Vb = function() +{ + var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' + + 'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' + + 'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' + + 'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' + + 'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' + + 'Function Get GetType GoSub GoTo Handles If Implements Imports In ' + + 'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' + + 'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' + + 'NotInheritable NotOverridable Object On Option Optional Or OrElse ' + + 'Overloads Overridable Overrides ParamArray Preserve Private Property ' + + 'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' + + 'Return Select Set Shadows Shared Short Single Static Step Stop String ' + + 'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' + + 'Variant When While With WithEvents WriteOnly Xor'; + + this.regexList = [ + { regex: /'.*$/gm, css: 'comments' }, // one line comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings + { regex: /^\s*#.*$/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // vb keyword + ]; + + this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); +}; + +SyntaxHighlighter.brushes.Vb.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Vb.aliases = ['vb', 'vbnet']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shBrushXml.js b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushXml.js new file mode 100644 index 00000000..f5aa67cc --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shBrushXml.js @@ -0,0 +1,71 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +SyntaxHighlighter.brushes.Xml = function() +{ + function process(match, regexInfo) + { + var constructor = SyntaxHighlighter.Match, + code = match[0], + tag = new XRegExp('(<|<)[\\s\\/\\?]*(?[:\\w-\\.]+)', 'xg').exec(code), + result = [] + ; + + if (match.attributes != null) + { + var attributes, + regex = new XRegExp('(? [\\w:\\-\\.]+)' + + '\\s*=\\s*' + + '(? ".*?"|\'.*?\'|\\w+)', + 'xg'); + + while ((attributes = regex.exec(code)) != null) + { + result.push(new constructor(attributes.name, match.index + attributes.index, 'color1')); + result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string')); + } + } + + if (tag != null) + result.push( + new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword') + ); + + return result; + } + + this.regexList = [ + { regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // + { regex: new XRegExp('(\\<|<)!--\\s*.*?\\s*--(\\>|>)', 'gm'), css: 'comments' }, // + { regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process } + ]; +}; + +SyntaxHighlighter.brushes.Xml.prototype = new SyntaxHighlighter.Highlighter(); +SyntaxHighlighter.brushes.Xml.aliases = ['xml', 'xhtml', 'xslt', 'html', 'xhtml']; diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shCore.js b/saf/lib/Ext/phpmailer/test_script/scripts/shCore.js new file mode 100644 index 00000000..f38396f5 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shCore.js @@ -0,0 +1,30 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('f(!1o.31){p 31=h(){p l={5S:{"1e-1c":"","73-2E":1,"2a-1P":u,"1I":u,"6T-6S":U,"1F-1P":4,"5F":O,"5x":U,"1q":U,"5v":O,"6i-6p":U,"6J":O},Q:{5D:u,5i:16,5k:16,7P:O,7I:"5L",1b:{4e:"91 1i",3Y:"92 1i",5l:"93 90 6K",6X:"8Z I 8W 1X 8X 6K 8Y",3u:"3u",6h:"?",1u:"31\\n\\n",5Z:"94\'t 95 7J C: ",7z:"9b 9c\'t 9a C 2j-2n 99: ",6B:"<2j 8G=\\"2y://7A.7E.7o/8D/8E\\"><70><8F 2y-8L=\\"8M-8S\\" 5h=\\"2c/2j; 8T=8R-8\\" /><36>8Q 31<2R 1f=\\"2a-7T:8N,\'7h 8O 8P\',7h,7L;9d-53:#9e;53:#9D;2a-1P:9E;2c-8i:85;\\">3184 2.0.9O (9M 9L 6H)2y://6a.4a9w I 9k 9l.9m 9j-6H 9i 9f."},7j:O},1p:{59:u,3q:u,3o:u,5j:{}},30:{},8a:{9g:/\\/\\*[\\s\\S]*?\\*\\//4M,9h:/\\/\\/.*$/4M,9n:/#.*$/4M,9o:/"(?:\\.|(\\\\\\")|[^\\""\\n])*"/g,9u:/\'(?:\\.|(\\\\\\\')|[^\\\'\'\\n])*\'/g,9v:/"(?:\\.|(\\\\\\")|[^\\""])*"/g,9t:/\'(?:\\.|(\\\\\\\')|[^\\\'\'])*\'/g,3e:/\\w+:\\/\\/[\\w-.\\/?%&=]*/g,9s:{E:/(&1C;|<)\\?=?/g,17:/\\?(&2m;|>)/g},9p:{E:/(&1C;|<)%=?/g,17:/%(&2m;|>)/g},9q:{E:/(&1C;|<)\\s*2n.*?(&2m;|>)/47,17:/(&1C;|<)\\/\\s*2n\\s*(&2m;|>)/47}},1q:{15:h(32){p 38=J.1t("37"),4L=l.1q.77;38.Y="1q";C(p 2N 1X 4L){p 6j=4L[2N],4G=R 6j(32),22=4G.15();32.5E[2N]=4G;f(22==u){1V}f(9r(22)=="9P"){22=l.1q.6C(22,32.1j,2N)}22.Y+="8w "+2N;38.1z(22)}q 38},6C:h(4v,6O,4w){p a=J.1t("a"),5e=a.1f,4F=l.Q,57=4F.5i,5c=4F.5k;a.2q="#"+4w;a.36=4v;a.5P=6O;a.6c=4w;a.1r=4v;f(5z(57)==O){5e.1N=57+"5H"}f(5z(5c)==O){5e.2u=5c+"5H"}a.8q=h(e){8j{l.1q.6f(c,e||1o.6g,c.5P,c.6c)}8m(e){l.B.1u(e.6F)}q O};q a},6f:h(7i,7a,5T,7O,72){p 4Y=l.1p.5j[5T],45;f(4Y==u||(45=4Y.5E[7O])==u){q u}q 45.2h(7i,7a,72)},77:{4e:h(4p){c.15=h(){f(4p.T("5v")!=U){q}q l.Q.1b.4e};c.2h=h(4q,8v,8B){p z=4p.z;4q.71.51(4q);z.Y=z.Y.D("5t","")}},3Y:h(8g){c.15=h(){q l.Q.1b.3Y};c.2h=h(8p,8o,8t){p 33=l.B.3d(8g.5r).D(/"+33+"");2b.J.4N()}},5l:h(4S){p 3x,8y,5M=4S.1j;c.15=h(){p 2A=l.Q;f(2A.5D==u){q u}h 1L(5C){p 5s="";C(p 5A 1X 5C){5s+="<8z 1c=\'"+5A+"\' 1W=\'"+5C[5A]+"\'/>"}q 5s};h 2p(43){p 5p="";C(p 5o 1X 43){5p+=" "+5o+"=\'"+43[5o]+"\'"}q 5p};p 48={1N:2A.5i,2u:2A.5k,1j:5M+"ai",6z:"bu/x-74-79",36:l.Q.1b.5l},46={bl:"bm",bx:"bA",bz:"5P="+5M,bF:"O"},4t=2A.5D,35;f(/aQ/i.1R(61.6b)){35="<8h"+2p({aT:"bd:bf-b9-b5-b4-b7",b8:"2y://ba.be.4a/bb/74/bc/79/b3.b2#84=9,0,0,0"})+2p(48)+">"+1L(46)+1L({aU:4t})+""}F{35=""}3x=J.1t("z");3x.1r=35;q 3x};c.2h=h(aV,aW,4R){p 68=4R.b1;6V(68){2J"7C":p 5d=l.B.2W(l.B.3d(4S.5r).D(/&1C;/g,"<").D(/&2m;/g,">").D(/&b0;/g,"&"));f(1o.6e){1o.6e.aZ("2c",5d)}F{q l.B.2W(5d)}2J"aX":l.B.1u(l.Q.1b.6X);2B;2J"aY":l.B.1u(4R.6F);2B}}},bh:h(4I){c.15=h(){q l.Q.1b.3u};c.2h=h(bg,by,bB){p 25=J.1t("bG"),1J=u;f(l.1p.3o!=u){J.2R.51(l.1p.3o)}l.1p.3o=25;25.1f.bC="bE:bD;1N:6m;2u:6m;E:-6l;4z:-6l;";J.2R.1z(25);1J=25.4J.J;6t(1J,1o.J);1J.3t(""+4I.z.1r+"");1J.4N();25.4J.4A();25.4J.3u();h 6t(6A,6s){p 2S=6s.7M("4K");C(p i=0;i<2S.v;i++){f(2S[i].6r.bk()=="6q"&&/bi\\.12$/.1R(2S[i].2q)){6A.3t("<4K 6z=\\"2c/12\\" 6r=\\"6q\\" 2q=\\""+2S[i].2q+"\\">")}}}}},bj:h(bo){c.15=h(){q l.Q.1b.6h};c.2h=h(bv,bt){p 2b=l.B.4y("","4P",bq,bs,"6n=0"),1J=2b.J;1J.3t(l.Q.1b.6B);1J.4N();2b.4A()}}}},B:{5m:h(6R){q 6R+3z.aN(3z.aa()*ab).2f()},5u:h(4E,4x){p 3l={},1S;C(1S 1X 4E){3l[1S]=4E[1S]}C(1S 1X 4x){3l[1S]=4x[1S]}q 3l},7w:h(4u){6V(4u){2J"U":q U;2J"O":q O}q 4u},4y:h(3e,6M,4D,4C,2I){p x=(6N.1N-4D)/2,y=(6N.2u-4C)/2;2I+=", E="+x+", 4z="+y+", 1N="+4D+", 2u="+4C;2I=2I.D(/^,/,"");p 4Q=1o.9Q(3e,6M,2I);4Q.4A();q 4Q},78:h(1A,29,23){f(1A.6D){1A["e"+29+23]=23;1A[29+23]=h(){1A["e"+29+23](1o.6g)};1A.6D("a6"+29,1A[29+23])}F{1A.a7(29,23,O)}},1u:h(A){1u(l.Q.1b.1u+A)},4c:h(5a,5Y){p 2k=l.1p.59,3j=u;f(2k==u){2k={};C(p 55 1X l.30){p 3g=l.30[55].ac;f(3g==u){1V}C(p i=0;i<3g.v;i++){2k[3g[i]]=55}}l.1p.59=2k}3j=l.30[2k[5a]];f(3j==u&&5Y!=O){l.B.1u(l.Q.1b.5Z+5a)}q 3j},42:h(A,60){p 2T=A.21("\\n");C(p i=0;i<2T.v;i++){2T[i]=60(2T[i])}q 2T.4h("\\n")},6x:h(){p z=J.1t("z"),3h=J.1t("z"),6d=10,i=1;28(i<=aO){f(i%6d===0){z.1r+=i;i+=(i+"").v}F{z.1r+="&ah;";i++}}3h.Y="5F 2E";3h.1z(z);q 3h},6U:h(A){q A.D(/^[ ]*[\\n]+|[\\n]*[ ]*$/g,"")},7d:h(A){p 3i,4V={},5b=R M("^\\\\[(?<54>(.*?))\\\\]$"),69=R M("(?<1c>[\\\\w-]+)"+"\\\\s*:\\\\s*"+"(?<1W>"+"[\\\\w-%#]+|"+"\\\\[.*?\\\\]|"+"\\".*?\\"|"+"\'.*?\'"+")\\\\s*;?","g");28((3i=69.N(A))!=u){p 2g=3i.1W.D(/^[\'"]|[\'"]$/g,"");f(2g!=u&&5b.1R(2g)){p m=5b.N(2g);2g=m.54.v>0?m.54.21(/\\s*,\\s*/):[]}4V[3i.1c]=2g}q 4V},80:h(A,12){f(A==u||A.v==0||A=="\\n"){q A}A=A.D(/"+2i+""})}q A},7f:h(66,67){p 2Z=66.2f();28(2Z.v<67){2Z="0"+2Z}q 2Z},5y:h(){p 3b=J.1t("z"),3f,3a=0,52=J.2R,1j=l.B.5m("5y"),2O="",4W="";3b.1r=2O+"6L\\">"+2O+"26\\">"+2O+"2E\\">"+2O+"5h"+"\\"><1T 1e=\\"7V\\"><1T 1j=\\""+1j+"\\">&1O;"+4W+4W+2Q+2Q+2Q+2Q;52.1z(3b);3f=J.a5(1j);f(/a4/i.1R(61.6b)){p 5Q=1o.9V(3f,u);3a=7l(5Q.9W("1N"))}F{3a=3f.9U}52.51(3b);q 3a},6Q:h(7R,6Y){p 1F="";C(p i=0;i<6Y;i++){1F+=" "}q 7R.D(/\\t/g,1F)},6P:h(2P,41){p 9T=2P.21("\\n"),1F="\\t",5f="";C(p i=0;i<50;i++){5f+=" "}h 7X(3c,18,7Z){q 3c.1M(0,18)+5f.1M(0,7Z)+3c.1M(18+1,3c.v)};2P=l.B.42(2P,h(20){f(20.1h(1F)==-1){q 20}p 18=0;28((18=20.1h(1F))!=-1){p 7U=41-18%41;20=7X(20,18,7U)}q 20});q 2P},3d:h(A){q(l.Q.7P==U)?A.D(/|&1C;br\\s*\\/?&2m;/47,"\\n"):A},3P:h(A){q A.D(/\\s*$/g,"").D(/^\\s*/,"")},2W:h(A){p 1Q=l.B.3d(A).21("\\n"),9X=R 5B(),7S=/^\\s*/,24=9Y;C(p i=0;i<1Q.v&&24>0;i++){p 3V=1Q[i];f(l.B.3P(3V).v==0){1V}p 3S=7S.N(3V);f(3S==u){q A}24=3z.24(3S[0].v,24)}f(24>0){C(p i=0;i<1Q.v;i++){1Q[i]=1Q[i].1M(24)}}q 1Q.4h("\\n")},7B:h(2L,2K){f(2L.H<2K.H){q-1}F{f(2L.H>2K.H){q 1}F{f(2L.v<2K.v){q-1}F{f(2L.v>2K.v){q 1}}}}q 0},2D:h(8d,2G){h 8e(3W,81){q[R l.4i(3W[0],3W.H,81.12)]};p a2=0,3X=u,3y=[],8c=2G.4m?2G.4m:8e;28((3X=2G.3D.N(8d))!=u){3y=3y.2H(8c(3X,2G))}q 3y},6o:h(8f){q 8f.D(l.8a.3e,h(m){q""+m+""})}},1I:h(7c,4l){h 88(4s){p 49=[];C(p i=0;i<4s.v;i++){49.K(4s[i])}q 49};p 3m=4l?[4l]:88(J.7M(l.Q.7I)),7g="1r",2t=u;f(3m.v===0){q}C(p i=0;i<3m.v;i++){p 2F=3m[i],2s=l.B.7d(2F.Y),2Y;2s=l.B.5u(7c,2s);2Y=2s["7J"];f(2Y==u){1V}f(2s["2j-2n"]=="U"){2t=R l.44(2Y)}F{p 4o=l.B.4c(2Y);f(4o){2t=R 4o()}F{1V}}2t.1I(2F[7g],2s);p 2l=2t.z;f(l.Q.7j){2l=J.1t("a0");2l.1W=2t.z.1r;2l.1f.1N="aj";2l.1f.2u="aE"}2F.71.aF(2l,2F)}},aD:h(76){l.B.78(1o,"aC",h(){l.1I(76)})}};l.4i=h(4j,75,12){c.1W=4j;c.H=75;c.v=4j.v;c.12=12};l.4i.Z.2f=h(){q c.1W};l.44=h(4g){p 1H=l.B.4c(4g),4f=R l.30.aA(),aB=u;f(1H==u){q}1H=R 1H();c.4X=4f;f(1H.3K==u){l.B.1u(l.Q.1b.7z+4g);q}4f.4B.K({3D:1H.3K.I,4m:7F});h 39(4d,7G){C(p j=0;j<4d.v;j++){4d[j].H+=7G}};h 7F(14,aH){p 7x=14.I,1E=[],4k=1H.4B,7p=14.H+14.E.v,2X=1H.3K,1n;C(p i=0;i<4k.v;i++){1n=l.B.2D(7x,4k[i]);39(1n,7p);1E=1E.2H(1n)}f(2X.E!=u&&14.E!=u){1n=l.B.2D(14.E,2X.E);39(1n,14.H);1E=1E.2H(1n)}f(2X.17!=u&&14.17!=u){1n=l.B.2D(14.17,2X.17);39(1n,14.H+14[0].aM(14.17));1E=1E.2H(1n)}q 1E}};l.44.Z.1I=h(7u,7t){c.4X.1I(7u,7t);c.z=c.4X.z};l.87=h(){};l.87.Z={T:h(7v,7n){p 5J=c.1L[7v];q l.B.7w(5J==u?7n:5J)},15:h(7y){q J.1t(7y)},7m:h(5G){C(p i=0;i2V.H)&&(5G.H<2V.H+2V.v)){q U}}q O},6v:h(3v,7D){p 2e=[];f(3v!=u){C(p i=0;i<3v.v;i++){2e=2e.2H(l.B.2D(7D,3v[i]))}}2e=2e.aL(l.B.7B);q 2e},6u:h(){C(p i=0;i"+""+82+"."+"<1T 1e=\\"5h\\">"+(1D!=u?""+1D.D(/\\s/g,"&1O;")+"":"")+"<1T 1e=\\"7V\\" 1f=\\"5n-E: "+2w+"5H !aq;\\">"+1s+""+""+""}q 2C},6w:h(5N,5K){p 18=0,3n="",3r=l.B.80;C(p i=0;i<5K.v;i++){p 1y=5K[i];f(1y===u||1y.v===0){1V}3n+=3r(5N.1M(18,1y.H-18),"63")+3r(1y.1W,1y.12);18=1y.H+1y.v}3n+=3r(5N.1M(18),"63");q 3n},1I:h(1g,5R){p am=l.Q,3p=l.1p,z,34;c.1L={};c.z=u;c.26=u;c.I=u;c.2d=u;c.5E={};c.1j=l.B.5m("ar");3p.5j[c.1j]=c;f(1g===u){1g=""}f(3p.3q===u){3p.3q=l.B.5y()}c.1L=l.B.5u(l.5S,5R||{});f(c.T("6J")==U){c.1L.1q=c.1L.5x=O}c.z=z=c.15("37");c.26=c.15("37");c.26.Y="26";z.Y="6L";z.1j=c.1j;f(c.T("5v")){z.Y+=" 5t"}f(c.T("5x")==O){z.Y+=" ax"}z.Y+=" "+c.T("1e-1c");z.1f.av=c.T("2a-1P","");c.5r=1g;c.I=l.B.6U(1g).D(/\\r/g," ");34=c.T("1F-1P");c.I=c.T("6T-6S")==U?l.B.6P(c.I,34):l.B.6Q(c.I,34);c.I=l.B.2W(c.I);f(c.T("1q")){c.2d=c.15("37");c.2d.Y="2d";c.2d.1z(l.1q.15(c));z.1z(c.2d)}f(c.T("5F")){z.1z(l.B.6x())}z.1z(c.26);c.1Y=c.6v(c.4B,c.I);c.6u();1g=c.6w(c.I,c.1Y);1g=c.6k(l.B.3P(1g));f(c.T("6i-6p")){1g=l.B.6o(1g)}c.26.1r=1g},au:h(A){A=A.D(/^\\s+|\\s+$/g,"").D(/\\s+/g,"\\\\b|\\\\b");q"\\\\b"+A+"\\\\b"},at:h(2z){c.3K={E:{3D:2z.E,12:"2n"},17:{3D:2z.17,12:"2n"},I:R M("(?"+2z.E.1i+")"+"(?.*?)"+"(?<17>"+2z.17.1i+")","aw")}}};q l}()}f(!5B.1h){5B.Z.1h=h(5V,3J){3J=3z.as(3J||0,0);C(p i=3J;i|[65]{[^}]+})[\\S\\s]?|\\((?=\\?(?!#|<[\\w$]+>)))+|(\\()(?:\\?(?:(#)[^)]*\\)|<([$\\w]+)>))?|\\\\(?:k<([\\w$]+)>|[65]{([^}]+)})|(\\[\\^?)|([\\S\\s])/g,al:/(?:[^$]+|\\$(?![1-9$&`\']|{[$\\w]+}))+|\\$(?:([1-9]\\d*|[$&`\'])|{([$\\w]+)})/g,3F:/^(?:\\s+|#.*)+/,3R:/^(?:[?*+]|{\\d+(?:,\\d*)?})/,7H:/&&\\[\\^?/g,7q:/]/g},7N=h(5I,7Y,7K){C(p i=7K||0;i<5I.v;i++){f(5I[i]===7Y){q i}}q-1},7k=/()??/.N("")[1]!==3A,3L={};M=h(1d,1U){f(1d 4T V){f(1U!==3A){3G 62("56\'t 58 an 6G ao 5X V ap ay")}q 1d.3I()}p 1U=1U||"",7s=1U.1h("s")>-1,7r=1U.1h("x")>-1,4b=O,3C=[],13=[],11=1G.11,G,3N,3O,3E,3B;11.L=0;28(G=2v.N.2x(11,1d)){f(G[2]){f(!1G.3R.1R(1d.19(11.L))){13.K("(?:)")}}F{f(G[1]){3C.K(G[3]||u);f(G[3]){4b=U}13.K("(")}F{f(G[4]){3E=7N(3C,G[4]);13.K(3E>-1?"\\\\"+(3E+1)+(5z(1d.5O(11.L))?"":"(?:)"):G[0])}F{f(G[5]){13.K(3L.6Z?3L.6Z.7C(G[5],G[0].5O(1)==="P"):G[0])}F{f(G[6]){f(1d.5O(11.L)==="]"){13.K(G[6]==="["?"(?!)":"[\\\\S\\\\s]");11.L++}F{3N=M.6E("&&"+1d.19(G.H),1G.7H,1G.7q,"",{5W:"\\\\"})[0];13.K(G[6]+3N+"]");11.L+=3N.v+1}}F{f(G[7]){f(7s&&G[7]==="."){13.K("[\\\\S\\\\s]")}F{f(7r&&1G.3F.1R(G[7])){3O=2v.N.2x(1G.3F,1d.19(11.L-1))[0].v;f(!1G.3R.1R(1d.19(11.L-1+3O))){13.K("(?:)")}11.L+=3O-1}F{13.K(G[7])}}}F{13.K(G[0])}}}}}}}3B=V(13.4h(""),2v.D.2x(1U,/[aG]+/g,""));3B.1v={1i:1d,2o:4b?3C:u};q 3B};M.ak=h(1c,o){3L[1c]=o};V.Z.N=h(A){p 1a=2v.N.2x(c,A),1c,i,5g;f(1a){f(7k&&1a.v>1){5g=R V("^"+c.1i+"$(?!\\\\s)",c.3U());2v.D.2x(1a[0],5g,h(){C(i=1;i<7b.v-2;i++){f(7b[i]===3A){1a[i]=3A}}})}f(c.1v&&c.1v.2o){C(i=1;i<1a.v;i++){1c=c.1v.2o[i-1];f(1c){1a[1c]=1a[i]}}}f(c.3H&&c.L>(1a.H+1a[0].v)){c.L--}}q 1a}})()}V.Z.3U=h(){q(c.3H?"g":"")+(c.9Z?"i":"")+(c.6W?"m":"")+(c.3F?"x":"")+(c.a1?"y":"")};V.Z.3I=h(7Q){p 3T=R M(c.1i,(7Q||"")+c.3U());f(c.1v){3T.1v={1i:c.1v.1i,2o:c.1v.2o?c.1v.2o.19(0):u}}q 3T};V.Z.2x=h(a3,A){q c.N(A)};V.Z.9S=h(9R,7W){q c.N(7W[0])};M.3Z=h(4r,4Z){p 40="/"+4r+"/"+(4Z||"");q M.3Z[40]||(M.3Z[40]=R M(4r,4Z))};M.3M=h(A){q A.D(/[-[\\]{}()*+?.\\\\^$|,#\\s]/g,"\\\\$&")};M.6E=h(A,E,W,1k,2M){p 2M=2M||{},2U=2M.5W,X=2M.af,1k=1k||"",4O=1k.1h("g")>-1,6y=1k.1h("i")>-1,5U=1k.1h("m")>-1,4H=1k.1h("y")>-1,1k=1k.D(/y/g,""),E=E 4T V?(E.3H?E:E.3I("g")):R M(E,"g"+1k),W=W 4T V?(W.3H?W:W.3I("g")):R M(W,"g"+1k),1K=[],2r=0,1m=0,1l=0,1x=0,27,1Z,1w,1B,3Q,4n;f(2U){f(2U.v>1){3G ae("56\'t 58 ag ad 5X 3M 6I")}f(5U){3G 62("56\'t 58 3M 6I 6G a8 a9 6W aP")}3Q=M.3M(2U);4n=R V("^(?:"+3Q+"[\\\\S\\\\s]|(?:(?!"+E.1i+"|"+W.1i+")[^"+3Q+"])+)+",6y?"i":"")}28(U){E.L=W.L=1l+(2U?(4n.N(A.19(1l))||[""])[0].v:0);1w=E.N(A);1B=W.N(A);f(1w&&1B){f(1w.H<=1B.H){1B=u}F{1w=u}}f(1w||1B){1m=(1w||1B).H;1l=(1w?E:W).L}F{f(!2r){2B}}f(4H&&!2r&&1m>1x){2B}f(1w){f(!2r++){27=1m;1Z=1l}}F{f(1B&&2r){f(!--2r){f(X){f(X[0]&&27>1x){1K.K([X[0],A.19(1x,27),1x,27])}f(X[1]){1K.K([X[1],A.19(27,1Z),27,1Z])}f(X[2]){1K.K([X[2],A.19(1Z,1m),1Z,1m])}f(X[3]){1K.K([X[3],A.19(1m,1l),1m,1l])}}F{1K.K(A.19(1Z,1m))}1x=1l;f(!4O){2B}}}F{E.L=W.L=0;3G b6("bw bp 8l 8u 8A")}}f(1m===1l){1l++}}f(4O&&!4H&&X&&X[0]&&A.v>1x){1K.K([X[0],A.19(1x),1x,A.v])}E.L=W.L=0;q 1K};',62,725,'||||||||||||this|||if||function||||sh||||var|return||||null|length||||div|str|utils|for|replace|left|else|_109|index|code|document|push|lastIndex|XRegExp|exec|false||config|new||getParam|true|RegExp|_121|vN|className|prototype||part|css|_107|_c3|create||right|pos|slice|_111|strings|name|_101|class|style|_ed|indexOf|source|id|_122|_12d|_12c|_ca|window|vars|toolbar|innerHTML|_e0|createElement|alert|_x|_131|_12e|_ec|appendChild|obj|_132|lt|_e5|_c6|tab|lib|_bd|highlight|doc|_12a|params|substr|width|nbsp|size|_97|test|_4b|span|_102|continue|value|in|matches|_130|_91|split|_8|_57|min|_3c|lines|_12f|while|_56|font|wnd|text|bar|_d7|toString|_6e|execute|_75|html|_5b|_b7|gt|script|captureNames|attributes|href|_12b|_b4|_b1|height|_f8|_e1|call|http|_f4|_28|break|_da|getMatches|line|_b3|_a1|concat|_51|case|m2|m1|_123|_5|_80|_88|_81|body|_40|_62|_124|_d4|unindent|_c9|_b5|_7a|brushes|SyntaxHighlighter|_2|_22|_f2|_32|title|DIV|_3|offsetMatches|_7d|_7b|_8e|fixForBlogger|url|_7c|_5e|_65|_6a|_5c|_76|_4a|_af|_e9|printFrame|_f0|spaceWidth|_ea|_dc|write|print|_d5|_db|_25|_a6|Math|undefined|_10d|_106|regex|_10c|extended|throw|global|addFlags|_f6|htmlScript|_100|escape|cc|len|trim|_133|quantifier|_9d|_116|getNativeFlags|_9c|_a2|_a5|viewSource|cache|key|_89|eachLine|_2c|HtmlScript|_18|_30|gi|_2f|_ad|com|_105|findBrush|_c0|expandSource|_be|_bc|join|Match|_b9|_c7|_ab|func|esc|_b6|_19|_1a|_11b|_ac|swf|_4c|_9|_b|_49|popup|top|focus|regexList|_50|_4f|_48|_e|_7|_129|_38|contentWindow|link|_4|gm|close|_126|_blank|win|_35|_24|instanceof|_73|_6b|_82|xmlBrush|_17|_11c||removeChild|_7e|color|values|_5d|can|_f|supply|discoveredBrushes|_59|_6c|_10|_37|_d|_8c|r2|content|toolbarItemWidth|highlighters|toolbarItemHeight|copyToClipboard|guid|margin|_2e|_2d|String|originalCode|_2a|collapsed|merge|collapse|_e2|gutter|measureSpace|isNaN|_2b|Array|_29|clipboardSwf|toolbarCommands|ruler|_d2|px|_fb|_d0|_e7|pre|_27|_e6|charAt|highlighterId|_83|_ee|defaults|_14|_128|_f5|escapeChar|one|_5a|noBrush|_61|navigator|TypeError|plain|match|pP|_78|_79|_36|_6d|alexgorbatchev|userAgent|commandName|_66|clipboardData|executeCommand|event|help|auto|_6|createDisplayLines|500px|0px|scrollbars|processUrls|links|stylesheet|rel|_3f|copyStyles|removeNestedMatches|findMatches|processMatches|createRuler|_127|type|_3e|aboutDialog|createButton|attachEvent|matchRecursive|message|when|2009|character|light|clipboard|syntaxhighlighter|_4e|screen|_a|processSmartTabs|processTabs|_47|tabs|smart|trimFirstAndLastLines|switch|multiline|copyToClipboardConfirmation|_85|unicode|head|parentNode|_16|first|shockwave|_ba|_b8|items|addEvent|flash|_13|arguments|_aa|parseParams|_dd|padNumber|_b0|Times|_12|debug|_ff|parseInt|isMatchNested|_cf|org|_c8|classRight|_104|_103|_cd|_cc|_ce|toBoolean|_c5|_d1|brushNotHtmlScript|www|matchesSortCallback|get|_d6|w3|process|_c1|classLeft|tagName|brush|_fd|serif|getElementsByTagName|_fa|_15|bloggerMode|_115|_84|_99|family|_93|block|args|insertSpaces|_fc|_90|decorate|_a3|_e3|_e4|version|center|xhtml1|Highlighter|toArray|_de|regexLib|DTD|_a7|_a0|defaultAdd|_a8|_1e|object|align|try|resizable|contains|catch|400|_20|_1f|onclick|750|menubar|_21|unbalanced|_1b|item|location|_26|param|delimiters|_1c|sans|1999|xhtml|meta|xmlns|dtd|EN|TR|transitional|equiv|Content|Georgia|New|Roman|About|utf|Type|charset|Transitional|XHTML|is|your|now|The|to|expand|view|copy|Can|find|DOCTYPE|PUBLIC|W3C|option|configured|Brush|wasn|background|fff|Gorbatchev|multiLineCComments|singleLineCComments|Alex|2004|syntax|highlighter|Copyright|singleLinePerlComments|doubleQuotedString|aspScriptTags|scriptScriptTags|typeof|phpScriptTags|multiLineSingleQuotedString|singleQuotedString|multiLineDoubleQuotedString|JavaScript|none|Helvetica|xx|large|Arial|Geneva|000|1em|3em|75em|bottom|target|0099FF|decoration|01|March|4em|296|string|open|_119|apply|_8a|offsetWidth|getComputedStyle|getPropertyValue|_98|1000|ignoreCase|textarea|sticky|_a4|_117|opera|getElementById|on|addEventListener|using|the|random|1000000|aliases|than|SyntaxError|valueNames|more|middot|_clipboard|70em|addPlugin|replaceVar|_ef|flags|constructing|from|important|highlighter_|max|forHtmlScript|getKeywords|fontSize|sgi|nogutter|another|spaces|Xml|_bf|load|all|30em|replaceChild|sx|_c4|highlighted|number|alt|sort|lastIndexOf|round|150|flag|msie|src|embed|classid|movie|_33|_34|ok|error|setData|amp|command|cab|swflash|96b8|11cf|Error|444553540000|codebase|ae6d|download|pub|cabs|clsid|macromedia|d27cdb6e|_39|printSource|shCore|about|toLowerCase|allowScriptAccess|always|printing|_42|data|500||250|_44|application|_43|subject|wmode|_3a|flashVars|transparent|_3b|cssText|absolute|position|menu|IFRAME'.split('|'),0,{})) diff --git a/saf/lib/Ext/phpmailer/test_script/scripts/shLegacy.js b/saf/lib/Ext/phpmailer/test_script/scripts/shLegacy.js new file mode 100644 index 00000000..8a43ee64 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/scripts/shLegacy.js @@ -0,0 +1,30 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 y={d:{}};y.d={F:6(S,l,q,k,m,n){6 J(z,Y){1 V=16 15("^"+Y+"\\\\[(?\\\\w+)\\\\]$","14"),x=2;h(1 i=0;i. + */ +// +// Begin anonymous function. This is used to contain local scope variables without polutting global scope. +// +if (!window.SyntaxHighlighter) var SyntaxHighlighter = function() { + +// Shortcut object which will be assigned to the SyntaxHighlighter variable. +// This is a shorthand for local reference in order to avoid long namespace +// references to SyntaxHighlighter.whatever... +var sh = { + defaults : { + /** Additional CSS class names to be added to highlighter elements. */ + 'class-name' : '', + + /** First line number. */ + 'first-line' : 1, + + /** Font size of the SyntaxHighlighter block. */ + 'font-size' : null, + + /** Lines to highlight. */ + 'highlight' : null, + + /** Enables or disables smart tabs. */ + 'smart-tabs' : true, + + /** Gets or sets tab size. */ + 'tab-size' : 4, + + /** Enables or disables ruler. */ + 'ruler' : false, + + /** Enables or disables gutter. */ + 'gutter' : true, + + /** Enables or disables toolbar. */ + 'toolbar' : true, + + /** Forces code view to be collapsed. */ + 'collapse' : false, + + /** Enables or disables automatic links. */ + 'auto-links' : true, + + /** Gets or sets light mode. Equavalent to turning off gutter and toolbar. */ + 'light' : false + }, + + config : { + /** Path to the copy to clipboard SWF file. */ + clipboardSwf : null, + + /** Width of an item in the toolbar. */ + toolbarItemWidth : 16, + + /** Height of an item in the toolbar. */ + toolbarItemHeight : 16, + + /** Blogger mode flag. */ + bloggerMode : false, + + /** Name of the tag that SyntaxHighlighter will automatically look for. */ + tagName : 'pre', + + strings : { + expandSource : 'expand source', + viewSource : 'view source', + copyToClipboard : 'copy to clipboard', + copyToClipboardConfirmation : 'The code is in your clipboard now', + print : 'print', + help : '?', + alert: 'SyntaxHighlighter\n\n', + noBrush : 'Can\'t find brush for: ', + brushNotHtmlScript : 'Brush wasn\'t configured for html-script option: ', + + // this is populated by the build script + aboutDialog : 'About SyntaxHighlighter
    SyntaxHighlighter
    version 2.0.296 (March 01 2009)
    JavaScript code syntax highlighter.
    Copyright 2004-2009 Alex Gorbatchev.
    ' + }, + + /** If true, output will show HTML produces instead. */ + debug : false + }, + + /** Internal 'global' variables. */ + vars : { + discoveredBrushes : null, + spaceWidth : null, + printFrame : null, + highlighters : {} + }, + + /** This object is populated by user included external brush files. */ + brushes : {}, + + /** Common regular expressions. */ + regexLib : { + multiLineCComments : /\/\*[\s\S]*?\*\//gm, + singleLineCComments : /\/\/.*$/gm, + singleLinePerlComments : /#.*$/gm, + doubleQuotedString : /"(?:\.|(\\\")|[^\""\n])*"/g, + singleQuotedString : /'(?:\.|(\\\')|[^\''\n])*'/g, + multiLineDoubleQuotedString : /"(?:\.|(\\\")|[^\""])*"/g, + multiLineSingleQuotedString : /'(?:\.|(\\\')|[^\''])*'/g, + url : /\w+:\/\/[\w-.\/?%&=]*/g, + + /** tags. */ + phpScriptTags : { left: /(<|<)\?=?/g, right: /\?(>|>)/g }, + + /** <%= %> tags. */ + aspScriptTags : { left: /(<|<)%=?/g, right: /%(>|>)/g }, + + /** tags. */ + scriptScriptTags : { left: /(<|<)\s*script.*?(>|>)/gi, right: /(<|<)\/\s*script\s*(>|>)/gi } + }, + + toolbar : { + /** + * Creates new toolbar for a highlighter. + * @param {Highlighter} highlighter Target highlighter. + */ + create : function(highlighter) + { + var div = document.createElement('DIV'), + items = sh.toolbar.items + ; + + div.className = 'toolbar'; + + for (var name in items) + { + var constructor = items[name], + command = new constructor(highlighter), + element = command.create() + ; + + highlighter.toolbarCommands[name] = command; + + if (element == null) + continue; + + if (typeof(element) == 'string') + element = sh.toolbar.createButton(element, highlighter.id, name); + + element.className += 'item ' + name; + div.appendChild(element); + } + + return div; + }, + + /** + * Create a standard anchor button for the toolbar. + * @param {String} label Label text to display. + * @param {String} highlighterId Highlighter ID that this button would belong to. + * @param {String} commandName Command name that would be executed. + * @return {Element} Returns an 'A' element. + */ + createButton : function(label, highlighterId, commandName) + { + var a = document.createElement('a'), + style = a.style, + config = sh.config, + width = config.toolbarItemWidth, + height = config.toolbarItemHeight + ; + + a.href = '#' + commandName; + a.title = label; + a.highlighterId = highlighterId; + a.commandName = commandName; + a.innerHTML = label; + + if (isNaN(width) == false) + style.width = width + 'px'; + + if (isNaN(height) == false) + style.height = height + 'px'; + + a.onclick = function(e) + { + try + { + sh.toolbar.executeCommand( + this, + e || window.event, + this.highlighterId, + this.commandName + ); + } + catch(e) + { + sh.utils.alert(e.message); + } + + return false; + }; + + return a; + }, + + /** + * Executes a toolbar command. + * @param {Element} sender Sender element. + * @param {MouseEvent} event Original mouse event object. + * @param {String} highlighterId Highlighter DIV element ID. + * @param {String} commandName Name of the command to execute. + * @return {Object} Passes out return value from command execution. + */ + executeCommand : function(sender, event, highlighterId, commandName, args) + { + var highlighter = sh.vars.highlighters[highlighterId], + command + ; + + if (highlighter == null || (command = highlighter.toolbarCommands[commandName]) == null) + return null; + + return command.execute(sender, event, args); + }, + + /** Collection of toolbar items. */ + items : { + expandSource : function(highlighter) + { + this.create = function() + { + if (highlighter.getParam('collapse') != true) + return; + + return sh.config.strings.expandSource; + }; + + this.execute = function(sender, event, args) + { + var div = highlighter.div; + + sender.parentNode.removeChild(sender); + div.className = div.className.replace('collapsed', ''); + }; + }, + + /** + * Command to open a new window and display the original unformatted source code inside. + */ + viewSource : function(highlighter) + { + this.create = function() + { + return sh.config.strings.viewSource; + }; + + this.execute = function(sender, event, args) + { + var code = sh.utils.fixForBlogger(highlighter.originalCode).replace(/' + code + ''); + wnd.document.close(); + }; + }, + + /** + * Command to copy the original source code in to the clipboard. + * Uses Flash method if clipboardSwf is configured. + */ + copyToClipboard : function(highlighter) + { + var flashDiv, flashSwf, + highlighterId = highlighter.id + ; + + this.create = function() + { + var config = sh.config; + + // disable functionality if running locally + if (config.clipboardSwf == null) + return null; + + function params(list) + { + var result = ''; + + for (var name in list) + result += ""; + + return result; + }; + + function attributes(list) + { + var result = ''; + + for (var name in list) + result += " " + name + "='" + list[name] + "'"; + + return result; + }; + + var args1 = { + width : config.toolbarItemWidth, + height : config.toolbarItemHeight, + id : highlighterId + '_clipboard', + type : 'application/x-shockwave-flash', + title : sh.config.strings.copyToClipboard + }, + + // these arguments are used in IE's collection + args2 = { + allowScriptAccess : 'always', + wmode : 'transparent', + flashVars : 'highlighterId=' + highlighterId, + menu : 'false' + }, + swf = config.clipboardSwf, + html + ; + + if (/msie/i.test(navigator.userAgent)) + { + html = '' + + params(args2) + + params({ movie : swf }) + + '' + ; + } + else + { + html = '' + ; + } + + flashDiv = document.createElement('div'); + flashDiv.innerHTML = html; + + return flashDiv; + }; + + this.execute = function(sender, event, args) + { + var command = args.command; + + switch (command) + { + case 'get': + var code = sh.utils.unindent( + sh.utils.fixForBlogger(highlighter.originalCode) + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/&/g, '&') + ); + + if(window.clipboardData) + // will fall through to the confirmation because there isn't a break + window.clipboardData.setData('text', code); + else + return sh.utils.unindent(code); + + case 'ok': + sh.utils.alert(sh.config.strings.copyToClipboardConfirmation); + break; + + case 'error': + sh.utils.alert(args.message); + break; + } + }; + }, + + /** Command to print the colored source code. */ + printSource : function(highlighter) + { + this.create = function() + { + return sh.config.strings.print; + }; + + this.execute = function(sender, event, args) + { + var iframe = document.createElement('IFRAME'), + doc = null + ; + + // make sure there is never more than one hidden iframe created by SH + if (sh.vars.printFrame != null) + document.body.removeChild(sh.vars.printFrame); + + sh.vars.printFrame = iframe; + + // this hides the iframe + iframe.style.cssText = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;'; + + document.body.appendChild(iframe); + doc = iframe.contentWindow.document; + + copyStyles(doc, window.document); + doc.write('
    ' + highlighter.div.innerHTML + '
    '); + doc.close(); + + iframe.contentWindow.focus(); + iframe.contentWindow.print(); + + function copyStyles(destDoc, sourceDoc) + { + var links = sourceDoc.getElementsByTagName('link'); + + for(var i = 0; i < links.length; i++) + if(links[i].rel.toLowerCase() == 'stylesheet' && /shCore\.css$/.test(links[i].href)) + destDoc.write(''); + }; + }; + }, + + /** Command to display the about dialog window. */ + about : function(highlighter) + { + this.create = function() + { + return sh.config.strings.help; + }; + + this.execute = function(sender, event) + { + var wnd = sh.utils.popup('', '_blank', 500, 250, 'scrollbars=0'), + doc = wnd.document + ; + + doc.write(sh.config.strings.aboutDialog); + doc.close(); + wnd.focus(); + }; + } + } + }, + + utils : { + guid : function(prefix) + { + return prefix + Math.round(Math.random() * 1000000).toString(); + }, + + /** + * Merges two objects. Values from obj2 override values in obj1. + * Function is NOT recursive and works only for one dimensional objects. + * @param {Object} obj1 First object. + * @param {Object} obj2 Second object. + * @return {Object} Returns combination of both objects. + */ + merge: function(obj1, obj2) + { + var result = {}, name; + + for (name in obj1) + result[name] = obj1[name]; + + for (name in obj2) + result[name] = obj2[name]; + + return result; + }, + + /** + * Attempts to convert string to boolean. + * @param {String} value Input string. + * @return {Boolean} Returns true if input was "true", false if input was "false" and value otherwise. + */ + toBoolean: function(value) + { + switch (value) + { + case "true": + return true; + + case "false": + return false; + } + + return value; + }, + + /** + * Opens up a centered popup window. + * @param {String} url URL to open in the window. + * @param {String} name Popup name. + * @param {int} width Popup width. + * @param {int} height Popup height. + * @param {String} options window.open() options. + * @return {Window} Returns window instance. + */ + popup: function(url, name, width, height, options) + { + var x = (screen.width - width) / 2, + y = (screen.height - height) / 2 + ; + + options += ', left=' + x + + ', top=' + y + + ', width=' + width + + ', height=' + height + ; + options = options.replace(/^,/, ''); + + var win = window.open(url, name, options); + win.focus(); + return win; + }, + + /** + * Adds event handler to the target object. + * @param {Object} obj Target object. + * @param {String} type Name of the event. + * @param {Function} func Handling function. + */ + addEvent: function(obj, type, func) + { + if (obj.attachEvent) + { + obj['e' + type + func] = func; + obj[type + func] = function() + { + obj['e' + type + func](window.event); + } + obj.attachEvent('on' + type, obj[type + func]); + } + else + { + obj.addEventListener(type, func, false); + } + }, + + /** + * Displays an alert. + * @param {String} str String to display. + */ + alert: function(str) + { + alert(sh.config.strings.alert + str) + }, + + /** + * Finds a brush by its alias. + * + * @param {String} alias Brush alias. + * @param {Boolean} alert Suppresses the alert if false. + * @return {Brush} Returns bursh constructor if found, null otherwise. + */ + findBrush: function(alias, alert) + { + var brushes = sh.vars.discoveredBrushes, + result = null + ; + + if (brushes == null) + { + brushes = {}; + + // Find all brushes + for (var brush in sh.brushes) + { + var aliases = sh.brushes[brush].aliases; + + if (aliases == null) + continue; + + for (var i = 0; i < aliases.length; i++) + brushes[aliases[i]] = brush; + } + + sh.vars.discoveredBrushes = brushes; + } + + result = sh.brushes[brushes[alias]]; + + if (result == null && alert != false) + sh.utils.alert(sh.config.strings.noBrush + alias); + + return result; + }, + + /** + * Executes a callback on each line and replaces each line with result from the callback. + * @param {Object} str Input string. + * @param {Object} callback Callback function taking one string argument and returning a string. + */ + eachLine: function(str, callback) + { + var lines = str.split('\n'); + + for (var i = 0; i < lines.length; i++) + lines[i] = callback(lines[i]); + + return lines.join('\n'); + }, + + /** + * Creates rules looking div. + */ + createRuler: function() + { + var div = document.createElement('div'), + ruler = document.createElement('div'), + showEvery = 10, + i = 1 + ; + + while (i <= 150) + { + if (i % showEvery === 0) + { + div.innerHTML += i; + i += (i + '').length; + } + else + { + div.innerHTML += '·'; + i++; + } + } + + ruler.className = 'ruler line'; + ruler.appendChild(div); + + return ruler; + }, + + /** + * This is a special trim which only removes first and last empty lines + * and doesn't affect valid leading space on the first line. + * + * @param {String} str Input string + * @return {String} Returns string without empty first and last lines. + */ + trimFirstAndLastLines: function(str) + { + return str.replace(/^[ ]*[\n]+|[\n]*[ ]*$/g, ''); + }, + + /** + * Parses key/value pairs into hash object. + * + * Understands the following formats: + * - name: word; + * - name: [word, word]; + * - name: "string"; + * - name: 'string'; + * + * For example: + * name1: value; name2: [value, value]; name3: 'value' + * + * @param {String} str Input string. + * @return {Object} Returns deserialized object. + */ + parseParams: function(str) + { + var match, + result = {}, + arrayRegex = new XRegExp("^\\[(?(.*?))\\]$"), + regex = new XRegExp( + "(?[\\w-]+)" + + "\\s*:\\s*" + + "(?" + + "[\\w-%#]+|" + // word + "\\[.*?\\]|" + // [] array + '".*?"|' + // "" string + "'.*?'" + // '' string + ")\\s*;?", + "g" + ) + ; + + while ((match = regex.exec(str)) != null) + { + var value = match.value + .replace(/^['"]|['"]$/g, '') // strip quotes from end of strings + ; + + // try to parse array value + if (value != null && arrayRegex.test(value)) + { + var m = arrayRegex.exec(value); + value = m.values.length > 0 ? m.values.split(/\s*,\s*/) : []; + } + + result[match.name] = value; + } + + return result; + }, + + /** + * Wraps each line of the string into tag with given style applied to it. + * + * @param {String} str Input string. + * @param {String} css Style name to apply to the string. + * @return {String} Returns input string with each line surrounded by tag. + */ + decorate: function(str, css) + { + if (str == null || str.length == 0 || str == '\n') + return str; + + str = str.replace(/... to them so that + // leading spaces aren't included. + if (css != null) + str = sh.utils.eachLine(str, function(line) + { + if (line.length == 0) + return ''; + + var spaces = ''; + + line = line.replace(/^( | )+/, function(s) + { + spaces = s; + return ''; + }); + + if (line.length == 0) + return spaces; + + return spaces + '' + line + ''; + }); + + return str; + }, + + /** + * Pads number with zeros until it's length is the same as given length. + * + * @param {Number} number Number to pad. + * @param {Number} length Max string length with. + * @return {String} Returns a string padded with proper amount of '0'. + */ + padNumber : function(number, length) + { + var result = number.toString(); + + while (result.length < length) + result = '0' + result; + + return result; + }, + + /** + * Measures width of a single space character. + * @return {Number} Returns width of a single space character. + */ + measureSpace : function() + { + var container = document.createElement('div'), + span, + result = 0, + body = document.body, + id = sh.utils.guid('measureSpace'), + + // variable names will be compressed, so it's better than a plain string + divOpen = '
    ' + + divOpen + 'lines">' + + divOpen + 'line">' + + divOpen + 'content' + + '"> ' + closeSpan + closeSpan + + closeDiv + + closeDiv + + closeDiv + + closeDiv + ; + + body.appendChild(container); + span = document.getElementById(id); + + if (/opera/i.test(navigator.userAgent)) + { + var style = window.getComputedStyle(span, null); + result = parseInt(style.getPropertyValue("width")); + } + else + { + result = span.offsetWidth; + } + + body.removeChild(container); + + return result; + }, + + /** + * Replaces tabs with spaces. + * + * @param {String} code Source code. + * @param {Number} tabSize Size of the tab. + * @return {String} Returns code with all tabs replaces by spaces. + */ + processTabs : function(code, tabSize) + { + var tab = ''; + + for (var i = 0; i < tabSize; i++) + tab += ' '; + + return code.replace(/\t/g, tab); + }, + + /** + * Replaces tabs with smart spaces. + * + * @param {String} code Code to fix the tabs in. + * @param {Number} tabSize Number of spaces in a column. + * @return {String} Returns code with all tabs replaces with roper amount of spaces. + */ + processSmartTabs : function(code, tabSize) + { + var lines = code.split('\n'), + tab = '\t', + spaces = '' + ; + + // Create a string with 1000 spaces to copy spaces from... + // It's assumed that there would be no indentation longer than that. + for (var i = 0; i < 50; i++) + spaces += ' '; // 20 spaces * 50 + + // This function inserts specified amount of spaces in the string + // where a tab is while removing that given tab. + function insertSpaces(line, pos, count) + { + return line.substr(0, pos) + + spaces.substr(0, count) + + line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab + ; + }; + + // Go through all the lines and do the 'smart tabs' magic. + code = sh.utils.eachLine(code, function(line) + { + if (line.indexOf(tab) == -1) + return line; + + var pos = 0; + + while ((pos = line.indexOf(tab)) != -1) + { + // This is pretty much all there is to the 'smart tabs' logic. + // Based on the position within the line and size of a tab, + // calculate the amount of spaces we need to insert. + var spaces = tabSize - pos % tabSize; + line = insertSpaces(line, pos, spaces); + } + + return line; + }); + + return code; + }, + + fixForBlogger : function(str) + { + return (sh.config.bloggerMode == true) ? str.replace(/|<br\s*\/?>/gi, '\n') : str; + }, + + /** + * Removes all white space at the begining and end of a string. + * + * @param {String} str String to trim. + * @return {String} Returns string without leading and following white space characters. + */ + trim: function(str) + { + return str.replace(/\s*$/g, '').replace(/^\s*/, ''); + }, + + /** + * Unindents a block of text by the lowest common indent amount. + * @param {String} str Text to unindent. + * @return {String} Returns unindented text block. + */ + unindent: function(str) + { + var lines = sh.utils.fixForBlogger(str).split('\n'), + indents = new Array(), + regex = /^\s*/, + min = 1000 + ; + + // go through every line and check for common number of indents + for (var i = 0; i < lines.length && min > 0; i++) + { + var line = lines[i]; + + if (sh.utils.trim(line).length == 0) + continue; + + var matches = regex.exec(line); + + // In the event that just one line doesn't have leading white space + // we can't unindent anything, so bail completely. + if (matches == null) + return str; + + min = Math.min(matches[0].length, min); + } + + // trim minimum common number of white space from the begining of every line + if (min > 0) + for (var i = 0; i < lines.length; i++) + lines[i] = lines[i].substr(min); + + return lines.join('\n'); + }, + + /** + * Callback method for Array.sort() which sorts matches by + * index position and then by length. + * + * @param {Match} m1 Left object. + * @param {Match} m2 Right object. + * @return {Number} Returns -1, 0 or -1 as a comparison result. + */ + matchesSortCallback: function(m1, m2) + { + // sort matches by index first + if(m1.index < m2.index) + return -1; + else if(m1.index > m2.index) + return 1; + else + { + // if index is the same, sort by length + if(m1.length < m2.length) + return -1; + else if(m1.length > m2.length) + return 1; + } + + return 0; + }, + + /** + * Executes given regular expression on provided code and returns all + * matches that are found. + * + * @param {String} code Code to execute regular expression on. + * @param {Object} regex Regular expression item info from regexList collection. + * @return {Array} Returns a list of Match objects. + */ + getMatches: function(code, regexInfo) + { + function defaultAdd(match, regexInfo) + { + return [new sh.Match(match[0], match.index, regexInfo.css)]; + }; + + var index = 0, + match = null, + result = [], + func = regexInfo.func ? regexInfo.func : defaultAdd + ; + + while((match = regexInfo.regex.exec(code)) != null) + result = result.concat(func(match, regexInfo)); + + return result; + }, + + processUrls: function(code) + { + return code.replace(sh.regexLib.url, function(m) + { + return '' + m + ''; + }); + } + }, // end of utils + + /** + * Shorthand to highlight all elements on the page that are marked as + * SyntaxHighlighter source code. + * + * @param {Object} globalParams Optional parameters which override element's + * parameters. Only used if element is specified. + * + * @param {Object} element Optional element to highlight. If none is + * provided, all elements in the current document + * are highlighted. + */ + highlight : function(globalParams, element) + { + function toArray(source) + { + var result = []; + + for (var i = 0; i < source.length; i++) + result.push(source[i]); + + return result; + }; + + var elements = element ? [element] : toArray(document.getElementsByTagName(sh.config.tagName)), + propertyName = 'innerHTML', + highlighter = null + ; + + if (elements.length === 0) + return; + + for (var i = 0; i < elements.length; i++) + { + var target = elements[i], + params = sh.utils.parseParams(target.className), + brushName + ; + + // local params take precedence over globals + params = sh.utils.merge(globalParams, params); + brushName = params['brush']; + + if (brushName == null) + continue; + + // Instantiate a brush + if (params['html-script'] == 'true') + { + highlighter = new sh.HtmlScript(brushName); + } + else + { + var brush = sh.utils.findBrush(brushName); + + if (brush) + highlighter = new brush(); + else + continue; + } + + highlighter.highlight(target[propertyName], params); + + var result = highlighter.div; + + if (sh.config.debug) + { + result = document.createElement('textarea'); + result.value = highlighter.div.innerHTML; + result.style.width = '70em'; + result.style.height = '30em'; + } + + target.parentNode.replaceChild(result, target); + } + }, + + /** + * Main entry point for the SyntaxHighlighter. + * @param {Object} params Optional params to apply to all highlighted elements. + */ + all : function(params) + { + sh.utils.addEvent( + window, + 'load', + function() { sh.highlight(params); } + ); + } +}; // end of sh + +/** Match object */ +sh.Match = function(value, index, css) +{ + this.value = value; + this.index = index; + this.length = value.length; + this.css = css; +}; + +sh.Match.prototype.toString = function() +{ + return this.value; +}; + +/** + * Simulates HTML code with a scripting language embedded. + * + * @param {String} scriptBrushName Brush name of the scripting language. + */ +sh.HtmlScript = function(scriptBrushName) +{ + var scriptBrush = sh.utils.findBrush(scriptBrushName), + xmlBrush = new sh.brushes.Xml(), + bracketsRegex = null + ; + + if (scriptBrush == null) + return; + + scriptBrush = new scriptBrush(); + this.xmlBrush = xmlBrush; + + if (scriptBrush.htmlScript == null) + { + sh.utils.alert(sh.config.strings.brushNotHtmlScript + scriptBrushName); + return; + } + + xmlBrush.regexList.push( + { regex: scriptBrush.htmlScript.code, func: process } + ); + + function offsetMatches(matches, offset) + { + for (var j = 0; j < matches.length; j++) + matches[j].index += offset; + } + + function process(match, info) + { + var code = match.code, + matches = [], + regexList = scriptBrush.regexList, + offset = match.index + match.left.length, + htmlScript = scriptBrush.htmlScript, + result + ; + + for (var i = 0; i < regexList.length; i++) + { + result = sh.utils.getMatches(code, regexList[i]); + offsetMatches(result, offset); + matches = matches.concat(result); + } + + if (htmlScript.left != null && match.left != null) + { + result = sh.utils.getMatches(match.left, htmlScript.left); + offsetMatches(result, match.index); + matches = matches.concat(result); + } + + if (htmlScript.right != null && match.right != null) + { + result = sh.utils.getMatches(match.right, htmlScript.right); + offsetMatches(result, match.index + match[0].lastIndexOf(match.right)); + matches = matches.concat(result); + } + + return matches; + } +}; + +sh.HtmlScript.prototype.highlight = function(code, params) +{ + this.xmlBrush.highlight(code, params); + this.div = this.xmlBrush.div; +} + +/** + * Main Highlither class. + * @constructor + */ +sh.Highlighter = function() +{ +}; + +sh.Highlighter.prototype = { + /** + * Returns value of the parameter passed to the highlighter. + * @param {String} name Name of the parameter. + * @param {Object} defaultValue Default value. + * @return {Object} Returns found value or default value otherwise. + */ + getParam : function(name, defaultValue) + { + var result = this.params[name]; + return sh.utils.toBoolean(result == null ? defaultValue : result); + }, + + /** + * Shortcut to document.createElement(). + * @param {String} name Name of the element to create (DIV, A, etc). + * @return {HTMLElement} Returns new HTML element. + */ + create: function(name) + { + return document.createElement(name); + }, + + /** + * Checks if one match is inside another. + * @param {Match} match Match object to check. + * @return {Boolean} Returns true if given match was inside another, false otherwise. + */ + isMatchNested: function(match) + { + for (var i = 0; i < this.matches.length; i++) + { + var item = this.matches[i]; + + if (item === null) + continue; + + if ((match.index > item.index) && (match.index < item.index + item.length)) + return true; + } + + return false; + }, + + /** + * Applies all regular expression to the code and stores all found + * matches in the `this.matches` array. + * @param {Array} regexList List of regular expressions. + * @param {String} code Source code. + * @return {Array} Returns list of matches. + */ + findMatches: function(regexList, code) + { + var result = []; + + if (regexList != null) + for (var i = 0; i < regexList.length; i++) + result = result.concat(sh.utils.getMatches(code, regexList[i])); + + // sort the matches + result = result.sort(sh.utils.matchesSortCallback); + + return result; + }, + + /** + * Checks to see if any of the matches are inside of other matches. + * This process would get rid of highligted strings inside comments, + * keywords inside strings and so on. + */ + removeNestedMatches: function() + { + for (var i = 0; i < this.matches.length; i++) + if (this.isMatchNested(this.matches[i])) + this.matches[i] = null; + }, + + /** + * Splits block of text into individual DIV lines. + * @param {String} code Code to highlight. + * @return {String} Returns highlighted code in HTML form. + */ + createDisplayLines : function(code) + { + var lines = code.split(/\n/g), + firstLine = parseInt(this.getParam('first-line')), + padLength = (firstLine + lines.length).toString().length, + highlightedLines = this.getParam('highlight', []) + ; + + code = ''; + + for (var i = 0; i < lines.length; i++) + { + var line = lines[i], + indent = /^( |\s)+/.exec(line), + lineClass = 'line alt' + (i % 2 == 0 ? 1 : 2), + lineNumber = sh.utils.padNumber(firstLine + i, padLength), + highlighted = highlightedLines.indexOf((firstLine + i).toString()) != -1, + spaces = null + ; + + if (indent != null) + { + spaces = indent[0].toString(); + line = line.substr(spaces.length); + spaces = spaces.replace(/ /g, ' '); + indent = sh.vars.spaceWidth * spaces.length; + } + else + { + indent = 0; + } + + line = sh.utils.trim(line); + + if (line.length == 0) + line = ' '; + + if (highlighted) + lineClass += ' highlighted'; + + code += + '
    ' + + '' + lineNumber + '.' + + '' + + (spaces != null ? '' + spaces.replace(/\s/g, ' ') + '' : '') + + '' + line + '' + + '' + + '
    ' + ; + } + + return code; + }, + + /** + * Finds all matches in the source code. + * @param {String} code Source code to process matches in. + * @param {Array} matches Discovered regex matches. + * @return {String} Returns formatted HTML with processed mathes. + */ + processMatches: function(code, matches) + { + var pos = 0, + result = '', + decorate = sh.utils.decorate // make an alias to save some bytes + ; + + // Finally, go through the final list of matches and pull the all + // together adding everything in between that isn't a match. + for (var i = 0; i < matches.length; i++) + { + var match = matches[i]; + + if (match === null || match.length === 0) + continue; + + result += decorate(code.substr(pos, match.index - pos), 'plain') + + decorate(match.value, match.css) + ; + + pos = match.index + match.length; + } + + // don't forget to add whatever's remaining in the string + result += decorate(code.substr(pos), 'plain'); + + return result; + }, + + /** + * Highlights the code and returns complete HTML. + * @param {String} code Code to highlight. + * @param {Object} params Parameters object. + */ + highlight: function(code, params) + { + var conf = sh.config, + vars = sh.vars, + div, + tabSize + ; + + this.params = {}; + this.div = null; + this.lines = null; + this.code = null; + this.bar = null; + this.toolbarCommands = {}; + this.id = sh.utils.guid('highlighter_'); + + // register this instance in the highlighters list + vars.highlighters[this.id] = this; + + if (code === null) + code = ''; + + // Measure width of a single space. + if (vars.spaceWidth === null) + vars.spaceWidth = sh.utils.measureSpace(); + + // local params take precedence over defaults + this.params = sh.utils.merge(sh.defaults, params || {}); + + // process light mode + if (this.getParam('light') == true) + this.params.toolbar = this.params.gutter = false; + + this.div = div = this.create('DIV'); + this.lines = this.create('DIV'); + this.lines.className = 'lines'; + + div.className = 'syntaxhighlighter'; + div.id = this.id; + + if (this.getParam('collapse')) + div.className += ' collapsed'; + + if (this.getParam('gutter') == false) + div.className += ' nogutter'; + + div.className += ' ' + this.getParam('class-name'); + div.style.fontSize = this.getParam('font-size', ''); // IE7 can't take null + + this.originalCode = code; + this.code = sh.utils.trimFirstAndLastLines(code) + .replace(/\r/g, ' ') // IE lets these buggers through + ; + + tabSize = this.getParam('tab-size'); + + // replace tabs with spaces + this.code = this.getParam('smart-tabs') == true + ? sh.utils.processSmartTabs(this.code, tabSize) + : sh.utils.processTabs(this.code, tabSize) + ; + + this.code = sh.utils.unindent(this.code); + + // add controls toolbar + if (this.getParam('toolbar')) + { + this.bar = this.create('DIV'); + this.bar.className = 'bar'; + this.bar.appendChild(sh.toolbar.create(this)); + div.appendChild(this.bar); + } + + // add columns ruler + if (this.getParam('ruler')) + div.appendChild(sh.utils.createRuler()); + + div.appendChild(this.lines); + + this.matches = this.findMatches(this.regexList, this.code); + this.removeNestedMatches(); + + code = this.processMatches(this.code, this.matches); + + // finally, split all lines so that they wrap well + code = this.createDisplayLines(sh.utils.trim(code)); + + // finally, process the links + if (this.getParam('auto-links')) + code = sh.utils.processUrls(code); + + this.lines.innerHTML = code; + }, + + /** + * Converts space separated list of keywords into a regular expression string. + * @param {String} str Space separated keywords. + * @return {String} Returns regular expression string. + */ + getKeywords: function(str) + { + str = str + .replace(/^\s+|\s+$/g, '') + .replace(/\s+/g, '\\b|\\b') + ; + + return '\\b' + str + '\\b'; + }, + + /** + * Makes a brush compatible with the `html-script` functionality. + * @param {Object} regexGroup Object containing `left` and `right` regular expressions. + */ + forHtmlScript: function(regexGroup) + { + this.htmlScript = { + left : { regex: regexGroup.left, css: 'script' }, + right : { regex: regexGroup.right, css: 'script' }, + code : new XRegExp( + "(?" + regexGroup.left.source + ")" + + "(?.*?)" + + "(?" + regexGroup.right.source + ")", + "sgi" + ) + }; + } +}; // end of Highlighter + +return sh; +}(); // end of anonymous function + +if (!Array.indexOf) + /** + * Finds an index of element in the array. + * @ignore + * @param {Object} searchElement + * @param {Number} fromIndex + * @return {Number} Returns index of element if found; -1 otherwise. + */ + Array.prototype.indexOf = function (searchElement, fromIndex) + { + fromIndex = Math.max(fromIndex || 0, 0); + + for (var i = fromIndex; i < this.length; i++) + if(this[i] == searchElement) + return i; + + return -1; + }; + +/** + * XRegExp 0.6.1 + * (c) 2007-2008 Steven Levithan + * + * MIT License + * + * provides an augmented, cross-browser implementation of regular expressions + * including support for additional modifiers and syntax. several convenience + * methods and a recursive-construct parser are also included. + */ + +// prevent running twice, which would break references to native globals +if (!window.XRegExp) { +// anonymous function to avoid global variables +(function () { +// copy various native globals for reference. can't use the name ``native`` +// because it's a reserved JavaScript keyword. +var real = { + exec: RegExp.prototype.exec, + match: String.prototype.match, + replace: String.prototype.replace, + split: String.prototype.split + }, + /* regex syntax parsing with support for all the necessary cross- + browser and context issues (escapings, character classes, etc.) */ + lib = { + part: /(?:[^\\([#\s.]+|\\(?!k<[\w$]+>|[pP]{[^}]+})[\S\s]?|\((?=\?(?!#|<[\w$]+>)))+|(\()(?:\?(?:(#)[^)]*\)|<([$\w]+)>))?|\\(?:k<([\w$]+)>|[pP]{([^}]+)})|(\[\^?)|([\S\s])/g, + replaceVar: /(?:[^$]+|\$(?![1-9$&`']|{[$\w]+}))+|\$(?:([1-9]\d*|[$&`'])|{([$\w]+)})/g, + extended: /^(?:\s+|#.*)+/, + quantifier: /^(?:[?*+]|{\d+(?:,\d*)?})/, + classLeft: /&&\[\^?/g, + classRight: /]/g + }, + indexOf = function (array, item, from) { + for (var i = from || 0; i < array.length; i++) + if (array[i] === item) return i; + return -1; + }, + brokenExecUndef = /()??/.exec("")[1] !== undefined, + plugins = {}; + +/** + * Accepts a pattern and flags, returns a new, extended RegExp object. + * differs from a native regex in that additional flags and syntax are + * supported and browser inconsistencies are ameliorated. + * @ignore + */ +XRegExp = function (pattern, flags) { + if (pattern instanceof RegExp) { + if (flags !== undefined) + throw TypeError("can't supply flags when constructing one RegExp from another"); + return pattern.addFlags(); // new copy + } + + var flags = flags || "", + singleline = flags.indexOf("s") > -1, + extended = flags.indexOf("x") > -1, + hasNamedCapture = false, + captureNames = [], + output = [], + part = lib.part, + match, cc, len, index, regex; + + part.lastIndex = 0; // in case the last XRegExp compilation threw an error (unbalanced character class) + + while (match = real.exec.call(part, pattern)) { + // comment pattern. this check must come before the capturing group check, + // because both match[1] and match[2] will be non-empty. + if (match[2]) { + // keep tokens separated unless the following token is a quantifier + if (!lib.quantifier.test(pattern.slice(part.lastIndex))) + output.push("(?:)"); + // capturing group + } else if (match[1]) { + captureNames.push(match[3] || null); + if (match[3]) + hasNamedCapture = true; + output.push("("); + // named backreference + } else if (match[4]) { + index = indexOf(captureNames, match[4]); + // keep backreferences separate from subsequent literal numbers + // preserve backreferences to named groups that are undefined at this point as literal strings + output.push(index > -1 ? + "\\" + (index + 1) + (isNaN(pattern.charAt(part.lastIndex)) ? "" : "(?:)") : + match[0] + ); + // unicode element (requires plugin) + } else if (match[5]) { + output.push(plugins.unicode ? + plugins.unicode.get(match[5], match[0].charAt(1) === "P") : + match[0] + ); + // character class opening delimiter ("[" or "[^") + // (non-native unicode elements are not supported within character classes) + } else if (match[6]) { + if (pattern.charAt(part.lastIndex) === "]") { + // for cross-browser compatibility with ECMA-262 v3 behavior, + // convert [] to (?!) and [^] to [\S\s]. + output.push(match[6] === "[" ? "(?!)" : "[\\S\\s]"); + part.lastIndex++; + } else { + // parse the character class with support for inner escapes and + // ES4's infinitely nesting intersection syntax ([&&[^&&[]]]). + cc = XRegExp.matchRecursive("&&" + pattern.slice(match.index), lib.classLeft, lib.classRight, "", {escapeChar: "\\"})[0]; + output.push(match[6] + cc + "]"); + part.lastIndex += cc.length + 1; + } + // dot ("."), pound sign ("#"), or whitespace character + } else if (match[7]) { + if (singleline && match[7] === ".") { + output.push("[\\S\\s]"); + } else if (extended && lib.extended.test(match[7])) { + len = real.exec.call(lib.extended, pattern.slice(part.lastIndex - 1))[0].length; + // keep tokens separated unless the following token is a quantifier + if (!lib.quantifier.test(pattern.slice(part.lastIndex - 1 + len))) + output.push("(?:)"); + part.lastIndex += len - 1; + } else { + output.push(match[7]); + } + } else { + output.push(match[0]); + } + } + + regex = RegExp(output.join(""), real.replace.call(flags, /[sx]+/g, "")); + regex._x = { + source: pattern, + captureNames: hasNamedCapture ? captureNames : null + }; + return regex; +}; + +/** + * Barebones plugin support for now (intentionally undocumented) + * @ignore + * @param {Object} name + * @param {Object} o + */ +XRegExp.addPlugin = function (name, o) { + plugins[name] = o; +}; + +/** + * Adds named capture support, with values returned as ``result.name``. + * + * Also fixes two cross-browser issues, following the ECMA-262 v3 spec: + * - captured values for non-participating capturing groups should be returned + * as ``undefined``, rather than the empty string. + * - the regex's ``lastIndex`` should not be incremented after zero-length + * matches. + * @ignore + */ +RegExp.prototype.exec = function (str) { + var match = real.exec.call(this, str), + name, i, r2; + if (match) { + // fix browsers whose exec methods don't consistently return + // undefined for non-participating capturing groups + if (brokenExecUndef && match.length > 1) { + // r2 doesn't need /g or /y, but they shouldn't hurt + r2 = new RegExp("^" + this.source + "$(?!\\s)", this.getNativeFlags()); + real.replace.call(match[0], r2, function () { + for (i = 1; i < arguments.length - 2; i++) { + if (arguments[i] === undefined) match[i] = undefined; + } + }); + } + // attach named capture properties + if (this._x && this._x.captureNames) { + for (i = 1; i < match.length; i++) { + name = this._x.captureNames[i - 1]; + if (name) match[name] = match[i]; + } + } + // fix browsers that increment lastIndex after zero-length matches + if (this.global && this.lastIndex > (match.index + match[0].length)) + this.lastIndex--; + } + return match; +}; +})(); // end anonymous function +} // end if(!window.XRegExp) + +/** + * intentionally undocumented + * @ignore + */ +RegExp.prototype.getNativeFlags = function () { + return (this.global ? "g" : "") + + (this.ignoreCase ? "i" : "") + + (this.multiline ? "m" : "") + + (this.extended ? "x" : "") + + (this.sticky ? "y" : ""); +}; + +/** + * Accepts flags; returns a new XRegExp object generated by recompiling + * the regex with the additional flags (may include non-native flags). + * The original regex object is not altered. + * @ignore + */ +RegExp.prototype.addFlags = function (flags) { + var regex = new XRegExp(this.source, (flags || "") + this.getNativeFlags()); + if (this._x) { + regex._x = { + source: this._x.source, + captureNames: this._x.captureNames ? this._x.captureNames.slice(0) : null + }; + } + return regex; +}; + +/** + * Accepts a context object and string; returns the result of calling + * ``exec`` with the provided string. the context is ignored but is + * accepted for congruity with ``Function.prototype.call``. + * @ignore + */ +RegExp.prototype.call = function (context, str) { + return this.exec(str); +}; + +/** + * Accepts a context object and arguments array; returns the result of + * calling ``exec`` with the first value in the arguments array. the context + * is ignored but is accepted for congruity with ``Function.prototype.apply``. + * @ignore + */ +RegExp.prototype.apply = function (context, args) { + return this.exec(args[0]); +}; + +/** + * Accepts a pattern and flags; returns an XRegExp object. if the pattern + * and flag combination has previously been cached, the cached copy is + * returned, otherwise the new object is cached. + * @ignore + */ +XRegExp.cache = function (pattern, flags) { + var key = "/" + pattern + "/" + (flags || ""); + return XRegExp.cache[key] || (XRegExp.cache[key] = new XRegExp(pattern, flags)); +}; + +/** + * Accepts a string; returns the string with regex metacharacters escaped. + * the returned string can safely be used within a regex to match a literal + * string. escaped characters are [, ], {, }, (, ), -, *, +, ?, ., \, ^, $, + * |, #, [comma], and whitespace. + * @ignore + */ +XRegExp.escape = function (str) { + return str.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, "\\$&"); +}; + +/** + * Accepts a string to search, left and right delimiters as regex pattern + * strings, optional regex flags (may include non-native s, x, and y flags), + * and an options object which allows setting an escape character and changing + * the return format from an array of matches to a two-dimensional array of + * string parts with extended position data. returns an array of matches + * (optionally with extended data), allowing nested instances of left and right + * delimiters. use the g flag to return all matches, otherwise only the first + * is returned. if delimiters are unbalanced within the subject data, an error + * is thrown. + * + * This function admittedly pushes the boundaries of what can be accomplished + * sensibly without a "real" parser. however, by doing so it provides flexible + * and powerful recursive parsing capabilities with minimal code weight. + * + * Warning: the ``escapeChar`` option is considered experimental and might be + * changed or removed in future versions of XRegExp. + * + * unsupported features: + * - backreferences within delimiter patterns when using ``escapeChar``. + * - although providing delimiters as regex objects adds the minor feature of + * independent delimiter flags, it introduces other limitations and is only + * intended to be done by the ``XRegExp`` constructor (which can't call + * itself while building a regex). + * + * @ignore + */ +XRegExp.matchRecursive = function (str, left, right, flags, options) { + var options = options || {}, + escapeChar = options.escapeChar, + vN = options.valueNames, + flags = flags || "", + global = flags.indexOf("g") > -1, + ignoreCase = flags.indexOf("i") > -1, + multiline = flags.indexOf("m") > -1, + sticky = flags.indexOf("y") > -1, + /* sticky mode has its own handling in this function, which means you + can use flag "y" even in browsers which don't support it natively */ + flags = flags.replace(/y/g, ""), + left = left instanceof RegExp ? (left.global ? left : left.addFlags("g")) : new XRegExp(left, "g" + flags), + right = right instanceof RegExp ? (right.global ? right : right.addFlags("g")) : new XRegExp(right, "g" + flags), + output = [], + openTokens = 0, + delimStart = 0, + delimEnd = 0, + lastOuterEnd = 0, + outerStart, innerStart, leftMatch, rightMatch, escaped, esc; + + if (escapeChar) { + if (escapeChar.length > 1) throw SyntaxError("can't supply more than one escape character"); + if (multiline) throw TypeError("can't supply escape character when using the multiline flag"); + escaped = XRegExp.escape(escapeChar); + /* Escape pattern modifiers: + /g - not needed here + /i - included + /m - **unsupported**, throws error + /s - handled by XRegExp when delimiters are provided as strings + /x - handled by XRegExp when delimiters are provided as strings + /y - not needed here; supported by other handling in this function + */ + esc = new RegExp( + "^(?:" + escaped + "[\\S\\s]|(?:(?!" + left.source + "|" + right.source + ")[^" + escaped + "])+)+", + ignoreCase ? "i" : "" + ); + } + + while (true) { + /* advance the starting search position to the end of the last delimiter match. + a couple special cases are also covered: + - if using an escape character, advance to the next delimiter's starting position, + skipping any escaped characters + - first time through, reset lastIndex in case delimiters were provided as regexes + */ + left.lastIndex = right.lastIndex = delimEnd + + (escapeChar ? (esc.exec(str.slice(delimEnd)) || [""])[0].length : 0); + + leftMatch = left.exec(str); + rightMatch = right.exec(str); + + // only keep the result which matched earlier in the string + if (leftMatch && rightMatch) { + if (leftMatch.index <= rightMatch.index) + rightMatch = null; + else leftMatch = null; + } + + /* paths*: + leftMatch | rightMatch | openTokens | result + 1 | 0 | 1 | ... + 1 | 0 | 0 | ... + 0 | 1 | 1 | ... + 0 | 1 | 0 | throw + 0 | 0 | 1 | throw + 0 | 0 | 0 | break + * - does not include the sticky mode special case + - the loop ends after the first completed match if not in global mode + */ + + if (leftMatch || rightMatch) { + delimStart = (leftMatch || rightMatch).index; + delimEnd = (leftMatch ? left : right).lastIndex; + } else if (!openTokens) { + break; + } + + if (sticky && !openTokens && delimStart > lastOuterEnd) + break; + + if (leftMatch) { + if (!openTokens++) { + outerStart = delimStart; + innerStart = delimEnd; + } + } else if (rightMatch && openTokens) { + if (!--openTokens) { + if (vN) { + if (vN[0] && outerStart > lastOuterEnd) + output.push([vN[0], str.slice(lastOuterEnd, outerStart), lastOuterEnd, outerStart]); + if (vN[1]) output.push([vN[1], str.slice(outerStart, innerStart), outerStart, innerStart]); + if (vN[2]) output.push([vN[2], str.slice(innerStart, delimStart), innerStart, delimStart]); + if (vN[3]) output.push([vN[3], str.slice(delimStart, delimEnd), delimStart, delimEnd]); + } else { + output.push(str.slice(innerStart, delimStart)); + } + lastOuterEnd = delimEnd; + if (!global) + break; + } + } else { + // reset lastIndex in case delimiters were provided as regexes + left.lastIndex = right.lastIndex = 0; + throw Error("subject data contains unbalanced delimiters"); + } + + // if the delimiter matched an empty string, advance delimEnd to avoid an infinite loop + if (delimStart === delimEnd) + delimEnd++; + } + + if (global && !sticky && vN && vN[0] && str.length > lastOuterEnd) + output.push([vN[0], str.slice(lastOuterEnd), lastOuterEnd, str.length]); + + // reset lastIndex in case delimiters were provided as regexes + left.lastIndex = right.lastIndex = 0; + + return output; +}; diff --git a/saf/lib/Ext/phpmailer/test_script/src/shLegacy.js b/saf/lib/Ext/phpmailer/test_script/src/shLegacy.js new file mode 100644 index 00000000..f5cb8d22 --- /dev/null +++ b/saf/lib/Ext/phpmailer/test_script/src/shLegacy.js @@ -0,0 +1,172 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/ + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate + * + * @version + * 2.0.296 (March 01 2009) + * + * @copyright + * Copyright (C) 2004-2009 Alex Gorbatchev. + * + * @license + * This file is part of SyntaxHighlighter. + * + * SyntaxHighlighter 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 3 of the License, or + * (at your option) any later version. + * + * SyntaxHighlighter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SyntaxHighlighter. If not, see . + */ +var dp = { + SyntaxHighlighter : {} +}; + +dp.SyntaxHighlighter = { + parseParams: function( + input, + showGutter, + showControls, + collapseAll, + firstLine, + showColumns + ) + { + function getValue(list, name) + { + var regex = new XRegExp('^' + name + '\\[(?\\w+)\\]$', 'gi'), + match = null + ; + + for (var i = 0; i < list.length; i++) + if ((match = regex.exec(list[i])) != null) + return match.value; + + return null; + }; + + function defaultValue(value, def) + { + return value != null ? value : def; + }; + + function asString(value) + { + return value != null ? value.toString() : null; + }; + + var parts = input.split(':'), + brushName = parts[0], + options = {}, + straight = { 'true' : 'true' } + reverse = { 'true' : 'false' }, + result = null, + defaults = SyntaxHighlighter.defaults + ; + + for (var i in parts) + options[parts[i]] = 'true'; + + showGutter = asString(defaultValue(showGutter, defaults.gutter)); + showControls = asString(defaultValue(showControls, defaults.toolbar)); + collapseAll = asString(defaultValue(collapseAll, defaults.collapse)); + showColumns = asString(defaultValue(showColumns, defaults.ruler)); + firstLine = asString(defaultValue(firstLine, defaults['first-line'])); + + result = { + brush : brushName, + gutter : defaultValue(reverse[options.nogutter], showGutter), + toolbar : defaultValue(reverse[options.nocontrols], showControls), + collapse : defaultValue(straight[options.collapse], collapseAll), + ruler : defaultValue(straight[options.showcolumns], showColumns), + 'first-line' : defaultValue(getValue(parts, 'firstline'), firstLine) + }; + + return result; + }, + + HighlightAll: function( + name, + showGutter /* optional */, + showControls /* optional */, + collapseAll /* optional */, + firstLine /* optional */, + showColumns /* optional */ + ) + { + function findValue() + { + var a = arguments; + + for (var i = 0; i < a.length; i++) + { + if (a[i] === null) + continue; + + if (typeof(a[i]) == 'string' && a[i] != '') + return a[i] + ''; + + if (typeof(a[i]) == 'object' && a[i].value != '') + return a[i].value + ''; + } + + return null; + }; + + function findTagsByName(list, name, tagName) + { + var tags = document.getElementsByTagName(tagName); + + for (var i = 0; i < tags.length; i++) + if (tags[i].getAttribute('name') == name) + list.push(tags[i]); + } + + var elements = [], + highlighter = null, + registered = {}, + propertyName = 'innerHTML' + ; + + // for some reason IE doesn't find
     by name, however it does see them just fine by tag name... 
    +		findTagsByName(elements, name, 'pre');
    +		findTagsByName(elements, name, 'textarea');
    +
    +		if (elements.length === 0)
    +			return;
    +		
    +		for (var i = 0; i < elements.length; i++)
    +		{
    +			var element = elements[i],
    +				params = findValue(
    +					element.attributes['class'], element.className, 
    +					element.attributes['language'], element.language
    +					),
    +				language = ''
    +				;
    +			
    +			if (params === null) 
    +				continue;
    +
    +			params = dp.SyntaxHighlighter.parseParams(
    +				params,
    +				showGutter, 
    +				showControls, 
    +				collapseAll, 
    +				firstLine, 
    +				showColumns
    +				);
    +
    +			SyntaxHighlighter.highlight(params, element);
    +		}
    +	}
    +};
    diff --git a/saf/lib/Ext/phpmailer/test_script/styles/help.png b/saf/lib/Ext/phpmailer/test_script/styles/help.png
    new file mode 100644
    index 00000000..5c870176
    Binary files /dev/null and b/saf/lib/Ext/phpmailer/test_script/styles/help.png differ
    diff --git a/saf/lib/Ext/phpmailer/test_script/styles/magnifier.png b/saf/lib/Ext/phpmailer/test_script/styles/magnifier.png
    new file mode 100644
    index 00000000..cf3d97f7
    Binary files /dev/null and b/saf/lib/Ext/phpmailer/test_script/styles/magnifier.png differ
    diff --git a/saf/lib/Ext/phpmailer/test_script/styles/page_white_code.png b/saf/lib/Ext/phpmailer/test_script/styles/page_white_code.png
    new file mode 100644
    index 00000000..0c76bd12
    Binary files /dev/null and b/saf/lib/Ext/phpmailer/test_script/styles/page_white_code.png differ
    diff --git a/saf/lib/Ext/phpmailer/test_script/styles/page_white_copy.png b/saf/lib/Ext/phpmailer/test_script/styles/page_white_copy.png
    new file mode 100644
    index 00000000..a9f31a27
    Binary files /dev/null and b/saf/lib/Ext/phpmailer/test_script/styles/page_white_copy.png differ
    diff --git a/saf/lib/Ext/phpmailer/test_script/styles/printer.png b/saf/lib/Ext/phpmailer/test_script/styles/printer.png
    new file mode 100644
    index 00000000..a350d187
    Binary files /dev/null and b/saf/lib/Ext/phpmailer/test_script/styles/printer.png differ
    diff --git a/saf/lib/Ext/phpmailer/test_script/styles/shCore.css b/saf/lib/Ext/phpmailer/test_script/styles/shCore.css
    new file mode 100644
    index 00000000..b720e73b
    --- /dev/null
    +++ b/saf/lib/Ext/phpmailer/test_script/styles/shCore.css
    @@ -0,0 +1,321 @@
    +/**
    + * SyntaxHighlighter
    + * http://alexgorbatchev.com/
    + *
    + * SyntaxHighlighter is donationware. If you are using it, please donate.
    + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
    + *
    + * @version
    + * 2.0.296 (March 01 2009)
    + * 
    + * @copyright
    + * Copyright (C) 2004-2009 Alex Gorbatchev.
    + *
    + * @license
    + * This file is part of SyntaxHighlighter.
    + * 
    + * SyntaxHighlighter 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 3 of the License, or
    + * (at your option) any later version.
    + * 
    + * SyntaxHighlighter is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU General Public License for more details.
    + * 
    + * You should have received a copy of the GNU General Public License
    + * along with SyntaxHighlighter.  If not, see .
    + */
    +.syntaxhighlighter,
    +.syntaxhighlighter div,
    +.syntaxhighlighter code,
    +.syntaxhighlighter span
    +{
    +	margin: 0 !important;
    +	padding: 0 !important;
    +	border: 0 !important;
    +	outline: 0 !important;
    +	background: none !important;
    +	text-align: left !important;
    +	float: none !important;
    +	vertical-align: baseline !important;
    +	position: static !important;
    +	left: auto !important;
    +	top: auto !important;
    +	right: auto !important;
    +	bottom: auto !important;
    +	height: auto !important;
    +	width: auto !important;
    +	line-height: 1.1em !important;
    +	font-family: "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important;
    +	font-weight: normal !important;
    +	font-style: normal !important;
    +	font-size: 1em !important;
    +}
    +
    +.syntaxhighlighter
    +{
    +	width: 100% !important;
    +	margin: 1em 0 1em 0 !important;
    +	padding: 1px !important; /* adds a little border on top and bottom */
    +	position: relative !important;
    +}
    +
    +.syntaxhighlighter .bold {
    +	font-weight: bold !important;
    +}
    +
    +.syntaxhighlighter .italic {
    +	font-style: italic !important;
    +}
    +
    +.syntaxhighlighter .line .number
    +{
    +	float: left !important; 
    +	width: 3em !important; 
    +	padding-right: .3em !important;
    +	text-align: right !important;
    +	display: block !important;
    +}
    +
    +/* Disable numbers when no gutter option is set */
    +.syntaxhighlighter.nogutter .line .number
    +{
    +	display: none !important;
    +}
    +
    +.syntaxhighlighter .line .content
    +{
    +	margin-left: 3.3em !important; 
    +	padding-left: .5em !important;
    +	display: block !important;
    +}
    +
    +.syntaxhighlighter .line .content .block
    +{
    +	display: block !important;
    +	padding-left: 1.5em !important;
    +	text-indent: -1.5em !important;
    +}
    +
    +.syntaxhighlighter .line .content .spaces
    +{
    +	display: none !important;
    +}
    +
    +/* Disable border and margin on the lines when no gutter option is set */
    +.syntaxhighlighter.nogutter .line .content
    +{
    +	margin-left: 0 !important; 
    +	border-left: none !important;
    +}
    +
    +.syntaxhighlighter .bar
    +{
    +}
    +
    +.syntaxhighlighter.collapsed .bar
    +{
    +
    +}
    +
    +.syntaxhighlighter.nogutter .ruler
    +{
    +	margin-left: 0 !important;
    +	padding-left: 0 !important;
    +}
    +
    +.syntaxhighlighter .ruler
    +{
    +	padding: 0 0 .5em .5em !important;
    +	margin-left: 3.3em !important;
    +	overflow: hidden !important;
    +}
    +
    +/* Adjust some properties when collapsed */
    +
    +.syntaxhighlighter.collapsed .lines,
    +.syntaxhighlighter.collapsed .ruler
    +{
    +	display: none !important;
    +}
    +
    +/* Styles for the toolbar */
    +
    +.syntaxhighlighter .toolbar
    +{
    +	position: absolute !important;
    +	right: 0px !important;
    +	top: 0px !important;
    +	font-size: 1px !important;
    +	padding: 8px 8px 8px 0 !important; /* in px because images don't scale with ems */
    +}
    +
    +.syntaxhighlighter.collapsed .toolbar
    +{
    +	font-size: 80% !important;
    +	padding: .2em 0 .5em .5em !important;
    +	position: static !important;
    +}
    +
    +.syntaxhighlighter .toolbar a.item,
    +.syntaxhighlighter .toolbar .item
    +{
    +	display: block !important;
    +	float: left !important;
    +	margin-left: 8px !important;
    +	background-repeat: no-repeat !important;
    +	overflow: hidden !important;
    +	text-indent: -5000px !important;
    +}
    +
    +.syntaxhighlighter.collapsed .toolbar .item
    +{
    +	display: none !important;
    +}
    +
    +.syntaxhighlighter.collapsed .toolbar .item.expandSource
    +{
    +	background-image: url(magnifier.png) !important;
    +	display: inline !important;
    +	text-indent: 0 !important;
    +	width: auto !important;
    +	float: none !important;
    +	height: 16px !important;
    +	padding-left: 20px !important;
    +}
    +
    +.syntaxhighlighter .toolbar .item.viewSource
    +{
    +	background-image: url(page_white_code.png) !important;
    +}
    +
    +.syntaxhighlighter .toolbar .item.printSource
    +{
    +	background-image: url(printer.png) !important;
    +}
    +
    +.syntaxhighlighter .toolbar .item.copyToClipboard
    +{
    +	text-indent: 0 !important;
    +	background: none !important;
    +	overflow: visible !important;
    +}
    +
    +.syntaxhighlighter .toolbar .item.about
    +{
    +	background-image: url(help.png) !important;
    +}
    +
    +/** 
    + * Print view.
    + * Colors are based on the default theme without background.
    + */
    +
    +.syntaxhighlighter.printing,
    +.syntaxhighlighter.printing .line.alt1 .content,
    +.syntaxhighlighter.printing .line.alt2 .content,
    +.syntaxhighlighter.printing .line.highlighted .number,
    +.syntaxhighlighter.printing .line.highlighted.alt1 .content,
    +.syntaxhighlighter.printing .line.highlighted.alt2 .content,
    +.syntaxhighlighter.printing .line .content .block
    +{
    +	background: none !important;
    +}
    +
    +/* Gutter line numbers */
    +.syntaxhighlighter.printing .line .number
    +{
    +	color: #bbb !important;
    +}
    +
    +/* Add border to the lines */
    +.syntaxhighlighter.printing .line .content
    +{
    +	color: #000 !important;
    +}
    +
    +/* Toolbar when visible */
    +.syntaxhighlighter.printing .toolbar,
    +.syntaxhighlighter.printing .ruler
    +{
    +	display: none !important;
    +}
    +
    +.syntaxhighlighter.printing a
    +{
    +	text-decoration: none !important;
    +}
    +
    +.syntaxhighlighter.printing .plain,
    +.syntaxhighlighter.printing .plain a
    +{ 
    +	color: #000 !important;
    +}
    +
    +.syntaxhighlighter.printing .comments,
    +.syntaxhighlighter.printing .comments a
    +{ 
    +	color: #008200 !important;
    +}
    +
    +.syntaxhighlighter.printing .string,
    +.syntaxhighlighter.printing .string a
    +{
    +	color: blue !important; 
    +}
    +
    +.syntaxhighlighter.printing .keyword
    +{ 
    +	color: #069 !important; 
    +	font-weight: bold !important; 
    +}
    +
    +.syntaxhighlighter.printing .preprocessor 
    +{ 
    +	color: gray !important; 
    +}
    +
    +.syntaxhighlighter.printing .variable 
    +{ 
    +	color: #a70 !important; 
    +}
    +
    +.syntaxhighlighter.printing .value
    +{ 
    +	color: #090 !important; 
    +}
    +
    +.syntaxhighlighter.printing .functions
    +{ 
    +	color: #ff1493 !important; 
    +}
    +
    +.syntaxhighlighter.printing .constants
    +{ 
    +	color: #0066CC !important; 
    +}
    +
    +.syntaxhighlighter.printing .script
    +{
    +	font-weight: bold !important;
    +}
    +
    +.syntaxhighlighter.printing .color1,
    +.syntaxhighlighter.printing .color1 a
    +{ 
    +	color: #808080 !important; 
    +}
    +
    +.syntaxhighlighter.printing .color2,
    +.syntaxhighlighter.printing .color2 a
    +{ 
    +	color: #ff1493 !important; 
    +}
    +
    +.syntaxhighlighter.printing .color3,
    +.syntaxhighlighter.printing .color3 a
    +{ 
    +	color: red !important; 
    +}
    diff --git a/saf/lib/Ext/phpmailer/test_script/styles/shThemeDefault.css b/saf/lib/Ext/phpmailer/test_script/styles/shThemeDefault.css
    new file mode 100644
    index 00000000..e466c97d
    --- /dev/null
    +++ b/saf/lib/Ext/phpmailer/test_script/styles/shThemeDefault.css
    @@ -0,0 +1,191 @@
    +/**
    + * SyntaxHighlighter
    + * http://alexgorbatchev.com/
    + *
    + * SyntaxHighlighter is donationware. If you are using it, please donate.
    + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
    + *
    + * @version
    + * 2.0.296 (March 01 2009)
    + * 
    + * @copyright
    + * Copyright (C) 2004-2009 Alex Gorbatchev.
    + *
    + * @license
    + * This file is part of SyntaxHighlighter.
    + * 
    + * SyntaxHighlighter 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 3 of the License, or
    + * (at your option) any later version.
    + * 
    + * SyntaxHighlighter is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU General Public License for more details.
    + * 
    + * You should have received a copy of the GNU General Public License
    + * along with SyntaxHighlighter.  If not, see .
    + */
    +/************************************
    + * Default Syntax Highlighter theme.
    + * 
    + * Interface elements.
    + ************************************/
    +
    +.syntaxhighlighter
    +{
    +	background-color: #E7E5DC !important;
    +}
    +
    +/* Highlighed line number */
    +.syntaxhighlighter .line.highlighted .number
    +{
    +	background-color: #6CE26C !important;
    +	color: black !important;
    +}
    +
    +/* Highlighed line */
    +.syntaxhighlighter .line.highlighted.alt1 .content,
    +.syntaxhighlighter .line.highlighted.alt2 .content
    +{
    +	background-color: #6CE26C !important;
    +}
    +
    +/* Gutter line numbers */
    +.syntaxhighlighter .line .number
    +{
    +	color: #5C5C5C !important;
    +}
    +
    +/* Add border to the lines */
    +.syntaxhighlighter .line .content
    +{
    +	border-left: 3px solid #6CE26C !important;
    +	color: #000 !important;
    +}
    +
    +.syntaxhighlighter.printing .line .content 
    +{
    +	border: 0 !important;
    +}
    +
    +/* First line */
    +.syntaxhighlighter .line.alt1 .content
    +{
    +	background-color: #fff !important;
    +}
    +
    +/* Second line */
    +.syntaxhighlighter .line.alt2 .content
    +{
    +	background-color: #F8F8F8 !important;
    +}
    +
    +.syntaxhighlighter .line .content .block
    +{
    +	background: url(wrapping.png) 0 1.1em no-repeat !important;
    +}
    +
    +.syntaxhighlighter .ruler
    +{
    +	color: silver !important;
    +	background-color: #F8F8F8 !important;
    +	border-left: 3px solid #6CE26C !important;
    +}
    +
    +.syntaxhighlighter.nogutter .ruler
    +{
    +	border: 0 !important;
    +}
    +
    +.syntaxhighlighter .toolbar
    +{
    +	background-color: #F8F8F8 !important;
    +	border: #E7E5DC solid 1px !important;
    +}
    +
    +.syntaxhighlighter .toolbar a
    +{
    +	color: #a0a0a0 !important;
    +}
    +
    +.syntaxhighlighter .toolbar a:hover
    +{
    +	color: red !important;
    +}
    +
    +/************************************
    + * Actual syntax highlighter colors.
    + ************************************/
    +.syntaxhighlighter .plain,
    +.syntaxhighlighter .plain a
    +{ 
    +	color: #000 !important;
    +}
    +
    +.syntaxhighlighter .comments,
    +.syntaxhighlighter .comments a
    +{ 
    +	color: #008200 !important;
    +}
    +
    +.syntaxhighlighter .string,
    +.syntaxhighlighter .string a
    +{
    +	color: blue !important; 
    +}
    +
    +.syntaxhighlighter .keyword
    +{ 
    +	color: #069 !important; 
    +	font-weight: bold !important; 
    +}
    +
    +.syntaxhighlighter .preprocessor 
    +{ 
    +	color: gray !important; 
    +}
    +
    +.syntaxhighlighter .variable 
    +{ 
    +	color: #a70 !important; 
    +}
    +
    +.syntaxhighlighter .value
    +{ 
    +	color: #090 !important; 
    +}
    +
    +.syntaxhighlighter .functions
    +{ 
    +	color: #ff1493 !important; 
    +}
    +
    +.syntaxhighlighter .constants
    +{ 
    +	color: #0066CC !important; 
    +}
    +
    +.syntaxhighlighter .script
    +{ 
    +	background-color: yellow !important;
    +}
    +
    +.syntaxhighlighter .color1,
    +.syntaxhighlighter .color1 a
    +{ 
    +	color: #808080 !important; 
    +}
    +
    +.syntaxhighlighter .color2,
    +.syntaxhighlighter .color2 a
    +{ 
    +	color: #ff1493 !important; 
    +}
    +
    +.syntaxhighlighter .color3,
    +.syntaxhighlighter .color3 a
    +{ 
    +	color: red !important; 
    +}
    diff --git a/saf/lib/Ext/phpmailer/test_script/styles/shThemeDjango.css b/saf/lib/Ext/phpmailer/test_script/styles/shThemeDjango.css
    new file mode 100644
    index 00000000..65a7f067
    --- /dev/null
    +++ b/saf/lib/Ext/phpmailer/test_script/styles/shThemeDjango.css
    @@ -0,0 +1,193 @@
    +/**
    + * SyntaxHighlighter
    + * http://alexgorbatchev.com/
    + *
    + * SyntaxHighlighter is donationware. If you are using it, please donate.
    + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
    + *
    + * @version
    + * 2.0.296 (March 01 2009)
    + * 
    + * @copyright
    + * Copyright (C) 2004-2009 Alex Gorbatchev.
    + *
    + * @license
    + * This file is part of SyntaxHighlighter.
    + * 
    + * SyntaxHighlighter 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 3 of the License, or
    + * (at your option) any later version.
    + * 
    + * SyntaxHighlighter is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU General Public License for more details.
    + * 
    + * You should have received a copy of the GNU General Public License
    + * along with SyntaxHighlighter.  If not, see .
    + */
    +/**
    + * Django SyntaxHighlighter theme
    + */
    +
    +/************************************
    + * Interface elements.
    + ************************************/
    +
    +.syntaxhighlighter
    +{
    +	background-color: #0B2F20 !important;
    +}
    +
    +/* Gutter line numbers */
    +.syntaxhighlighter .line .number
    +{
    +	color: #497958 !important;
    +}
    +
    +/* Add border to the lines */
    +.syntaxhighlighter .line .content
    +{
    +	border-left: 3px solid #41A83E !important;
    +	color: #B9BDB6 !important;
    +}
    +
    +.syntaxhighlighter.printing .line .content 
    +{
    +	border: 0 !important;
    +}
    +
    +/* First line */
    +.syntaxhighlighter .line.alt1 .content
    +{
    +}
    +
    +/* Second line */
    +.syntaxhighlighter .line.alt2 .content
    +{
    +	background-color: #0a2b1d !important;
    +}
    +
    +.syntaxhighlighter .line .content .block
    +{
    +	background: url(wrapping.png) 0 1.1em no-repeat !important;
    +}
    +
    +/* Highlighed line number */
    +.syntaxhighlighter .line.highlighted .number
    +{
    +	background-color: #336442 !important;
    +	color: #fff !important;
    +}
    +
    +/* Highlighed line */
    +.syntaxhighlighter .line.highlighted.alt1 .content,
    +.syntaxhighlighter .line.highlighted.alt2 .content
    +{
    +	background-color: #336442 !important;
    +}
    +
    +.syntaxhighlighter .ruler
    +{
    +	color: #C4B14A !important;
    +	background-color: #245032 !important;
    +	border-left: 3px solid #41A83E !important;
    +}
    +
    +.syntaxhighlighter.nogutter .ruler
    +{
    +	border: 0 !important;
    +}
    +
    +.syntaxhighlighter .toolbar
    +{
    +	background-color: #245032 !important;
    +	border: #0B2F20 solid 1px !important;
    +}
    +
    +.syntaxhighlighter .toolbar a
    +{
    +	color: #C4B14A !important;
    +}
    +
    +.syntaxhighlighter .toolbar a:hover
    +{
    +	color: #FFE862 !important;
    +}
    +
    +/************************************
    + * Actual syntax highlighter colors.
    + ************************************/
    +.syntaxhighlighter .plain,
    +.syntaxhighlighter .plain a
    +{
    +	color: #F8F8F8 !important;
    +}
    +
    +.syntaxhighlighter .comments,
    +.syntaxhighlighter .comments a
    +{ 
    +	color: #336442 !important;
    +	font-style: italic !important;
    +}
    +
    +.syntaxhighlighter .string,
    +.syntaxhighlighter .string a
    +{
    +	color: #9DF39F !important; 
    +}
    +
    +.syntaxhighlighter .keyword
    +{ 
    +	color: #96DD3B !important; 
    +	font-weight: bold !important;
    +}
    +
    +.syntaxhighlighter .preprocessor 
    +{ 
    +	color: #91BB9E !important; 
    +}
    +
    +.syntaxhighlighter .variable 
    +{ 
    +	color: #FFAA3E !important; 
    +}
    +
    +.syntaxhighlighter .value
    +{ 
    +	color: #F7E741 !important; 
    +}
    +
    +.syntaxhighlighter .functions
    +{ 
    +	color: #FFAA3E !important; 
    +}
    +
    +.syntaxhighlighter .constants
    +{ 
    +	color: #E0E8FF !important; 
    +}
    +
    +.syntaxhighlighter .script
    +{ 
    +	background-color: #497958 !important;
    +}
    +
    +.syntaxhighlighter .color1,
    +.syntaxhighlighter .color1 a
    +{ 
    +	color: #EB939A !important; 
    +}
    +
    +.syntaxhighlighter .color2,
    +.syntaxhighlighter .color2 a
    +{ 
    +	color: #91BB9E !important; 
    +}
    +
    +.syntaxhighlighter .color3,
    +.syntaxhighlighter .color3 a
    +{ 
    +	color: #EDEF7D !important; 
    +}
    diff --git a/saf/lib/Ext/phpmailer/test_script/styles/shThemeEmacs.css b/saf/lib/Ext/phpmailer/test_script/styles/shThemeEmacs.css
    new file mode 100644
    index 00000000..e4eed165
    --- /dev/null
    +++ b/saf/lib/Ext/phpmailer/test_script/styles/shThemeEmacs.css
    @@ -0,0 +1,192 @@
    +/**
    + * SyntaxHighlighter
    + * http://alexgorbatchev.com/
    + *
    + * SyntaxHighlighter is donationware. If you are using it, please donate.
    + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
    + *
    + * @version
    + * 2.0.296 (March 01 2009)
    + * 
    + * @copyright
    + * Copyright (C) 2004-2009 Alex Gorbatchev.
    + *
    + * @license
    + * This file is part of SyntaxHighlighter.
    + * 
    + * SyntaxHighlighter 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 3 of the License, or
    + * (at your option) any later version.
    + * 
    + * SyntaxHighlighter is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU General Public License for more details.
    + * 
    + * You should have received a copy of the GNU General Public License
    + * along with SyntaxHighlighter.  If not, see .
    + */
    +/**
    + * Emacs SyntaxHighlighter theme based on theme by Joshua Emmons
    + * http://www.skia.net/
    + */
    +
    +/************************************
    + * Interface elements.
    + ************************************/
    +
    +.syntaxhighlighter
    +{
    +	background-color: #000000 !important;
    +}
    +
    +/* Gutter line numbers */
    +.syntaxhighlighter .line .number
    +{
    +	color: #D3D3D3 !important;
    +}
    +
    +/* Add border to the lines */
    +.syntaxhighlighter .line .content
    +{
    +	border-left: 3px solid #990000 !important;
    +	color: #B9BDB6 !important;
    +}
    +
    +.syntaxhighlighter.printing .line .content 
    +{
    +	border: 0 !important;
    +}
    +
    +/* First line */
    +.syntaxhighlighter .line.alt1 .content
    +{
    +}
    +
    +/* Second line */
    +.syntaxhighlighter .line.alt2 .content
    +{
    +	background-color: #0f0f0f !important;
    +}
    +
    +.syntaxhighlighter .line .content .block
    +{
    +	background: url(wrapping.png) 0 1.1em no-repeat !important;
    +}
    +
    +/* Highlighed line number */
    +.syntaxhighlighter .line.highlighted .number
    +{
    +	background-color: #435A5F !important;
    +	color: #fff !important;
    +}
    +
    +/* Highlighed line */
    +.syntaxhighlighter .line.highlighted.alt1 .content,
    +.syntaxhighlighter .line.highlighted.alt2 .content
    +{
    +	background-color: #435A5F !important;
    +}
    +
    +.syntaxhighlighter .ruler
    +{
    +	color: silver !important;
    +	background-color: #000000 !important;
    +	border-left: 3px solid #990000 !important;
    +}
    +
    +.syntaxhighlighter.nogutter .ruler
    +{
    +	border: 0 !important;
    +}
    +
    +.syntaxhighlighter .toolbar
    +{
    +	background-color: #000000 !important;
    +	border: #000000 solid 1px !important;
    +}
    +
    +.syntaxhighlighter .toolbar a
    +{
    +	color: #646763 !important;
    +}
    +
    +.syntaxhighlighter .toolbar a:hover
    +{
    +	color: #9CCFF4 !important;
    +}
    +
    +/************************************
    + * Actual syntax highlighter colors.
    + ************************************/
    +.syntaxhighlighter .plain,
    +.syntaxhighlighter .plain a
    +{ 
    +	color: #D3D3D3 !important;
    +}
    +
    +.syntaxhighlighter .comments,
    +.syntaxhighlighter .comments a
    +{ 
    +	color: #FF7D27 !important;
    +}
    +
    +.syntaxhighlighter .string,
    +.syntaxhighlighter .string a
    +{
    +	color: #FF9E7B !important; 
    +}
    +
    +.syntaxhighlighter .keyword
    +{ 
    +	color: #00FFFF !important; 
    +}
    +
    +.syntaxhighlighter .preprocessor 
    +{ 
    +	color: #AEC4DE !important; 
    +}
    +
    +.syntaxhighlighter .variable 
    +{ 
    +	color: #FFAA3E !important; 
    +}
    +
    +.syntaxhighlighter .value
    +{ 
    +	color: #090 !important; 
    +}
    +
    +.syntaxhighlighter .functions
    +{ 
    +	color: #81CEF9 !important; 
    +}
    +
    +.syntaxhighlighter .constants
    +{ 
    +	color: #FF9E7B !important; 
    +}
    +
    +.syntaxhighlighter .script
    +{ 
    +	background-color: #990000 !important;
    +}
    +
    +.syntaxhighlighter .color1,
    +.syntaxhighlighter .color1 a
    +{ 
    +	color: #EBDB8D !important; 
    +}
    +
    +.syntaxhighlighter .color2,
    +.syntaxhighlighter .color2 a
    +{ 
    +	color: #FF7D27 !important; 
    +}
    +
    +.syntaxhighlighter .color3,
    +.syntaxhighlighter .color3 a
    +{ 
    +	color: #AEC4DE !important; 
    +}
    diff --git a/saf/lib/Ext/phpmailer/test_script/styles/shThemeFadeToGrey.css b/saf/lib/Ext/phpmailer/test_script/styles/shThemeFadeToGrey.css
    new file mode 100644
    index 00000000..b19c3be3
    --- /dev/null
    +++ b/saf/lib/Ext/phpmailer/test_script/styles/shThemeFadeToGrey.css
    @@ -0,0 +1,193 @@
    +/**
    + * SyntaxHighlighter
    + * http://alexgorbatchev.com/
    + *
    + * SyntaxHighlighter is donationware. If you are using it, please donate.
    + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
    + *
    + * @version
    + * 2.0.296 (March 01 2009)
    + * 
    + * @copyright
    + * Copyright (C) 2004-2009 Alex Gorbatchev.
    + *
    + * @license
    + * This file is part of SyntaxHighlighter.
    + * 
    + * SyntaxHighlighter 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 3 of the License, or
    + * (at your option) any later version.
    + * 
    + * SyntaxHighlighter is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU General Public License for more details.
    + * 
    + * You should have received a copy of the GNU General Public License
    + * along with SyntaxHighlighter.  If not, see .
    + */
    +/**
    + * Fade to Grey SyntaxHighlighter theme based on theme by Brasten Sager
    + * http://www.ibrasten.com/
    + */
    +
    +/************************************
    + * Interface elements.
    + ************************************/
    +
    +.syntaxhighlighter
    +{
    +	background-color: #121212 !important;
    +}
    +
    +/* Gutter line numbers */
    +.syntaxhighlighter .line .number
    +{
    +	color: #C3C3C3 !important;
    +}
    +
    +/* Add border to the lines */
    +.syntaxhighlighter .line .content
    +{
    +	border-left: 3px solid #3185B9 !important;
    +	color: #B9BDB6 !important;
    +}
    +
    +.syntaxhighlighter.printing .line .content 
    +{
    +	border: 0 !important;
    +}
    +
    +/* First line */
    +.syntaxhighlighter .line.alt1 .content
    +{
    +}
    +
    +/* Second line */
    +.syntaxhighlighter .line.alt2 .content
    +{
    +	background-color: #000000 !important;
    +}
    +
    +.syntaxhighlighter .line .content .block
    +{
    +	background: url(wrapping.png) 0 1.1em no-repeat !important;
    +}
    +
    +/* Highlighed line number */
    +.syntaxhighlighter .line.highlighted .number
    +{
    +	background-color: #3A3A00 !important;
    +	color: #fff !important;
    +}
    +
    +/* Highlighed line */
    +.syntaxhighlighter .line.highlighted.alt1 .content,
    +.syntaxhighlighter .line.highlighted.alt2 .content
    +{
    +	background-color: #3A3A00 !important;
    +}
    +
    +.syntaxhighlighter .ruler
    +{
    +	color: silver !important;
    +	border-left: 3px solid #3185B9 !important;
    +}
    +
    +.syntaxhighlighter.nogutter .ruler
    +{
    +	border: 0 !important;
    +}
    +
    +.syntaxhighlighter .toolbar
    +{
    +	background-color: #000000 !important;
    +	border: #000000 solid 1px !important;
    +}
    +
    +.syntaxhighlighter .toolbar a
    +{
    +	color: #808080 !important;
    +}
    +
    +.syntaxhighlighter .toolbar a:hover
    +{
    +	color: #96DAFF !important;
    +}
    +
    +/************************************
    + * Actual syntax highlighter colors.
    + ************************************/
    +.syntaxhighlighter .plain,
    +.syntaxhighlighter .plain a
    +{ 
    +	color: #FFFFFF !important;
    +}
    +
    +.syntaxhighlighter .comments,
    +.syntaxhighlighter .comments a
    +{ 
    +	color: #696854 !important;
    +}
    +
    +.syntaxhighlighter .string,
    +.syntaxhighlighter .string a
    +{
    +	color: #E3E658 !important; 
    +}
    +
    +.syntaxhighlighter .keyword
    +{ 
    +	color: #D01D33 !important; 
    +}
    +
    +.syntaxhighlighter .preprocessor 
    +{ 
    +	color: #435A5F !important; 
    +}
    +
    +.syntaxhighlighter .variable 
    +{ 
    +	color: #898989 !important; 
    +}
    +
    +.syntaxhighlighter .value
    +{ 
    +	color: #090 !important; 
    +}
    +
    +.syntaxhighlighter .functions
    +{ 
    +	color: #AAAAAA !important;
    +	font-weight: bold !important;
    +}
    +
    +.syntaxhighlighter .constants
    +{ 
    +	color: #96DAFF !important; 
    +}
    +
    +.syntaxhighlighter .script
    +{ 
    +	background-color: #C3C3C3 !important;
    +	color: #000 !important;
    +}
    +
    +.syntaxhighlighter .color1,
    +.syntaxhighlighter .color1 a
    +{ 
    +	color: #FFC074 !important; 
    +}
    +
    +.syntaxhighlighter .color2,
    +.syntaxhighlighter .color2 a
    +{ 
    +	color: #4A8CDB !important; 
    +}
    +
    +.syntaxhighlighter .color3,
    +.syntaxhighlighter .color3 a
    +{ 
    +	color: #96DAFF !important; 
    +}
    diff --git a/saf/lib/Ext/phpmailer/test_script/styles/shThemeMidnight.css b/saf/lib/Ext/phpmailer/test_script/styles/shThemeMidnight.css
    new file mode 100644
    index 00000000..0f39d0c8
    --- /dev/null
    +++ b/saf/lib/Ext/phpmailer/test_script/styles/shThemeMidnight.css
    @@ -0,0 +1,192 @@
    +/**
    + * SyntaxHighlighter
    + * http://alexgorbatchev.com/
    + *
    + * SyntaxHighlighter is donationware. If you are using it, please donate.
    + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
    + *
    + * @version
    + * 2.0.296 (March 01 2009)
    + * 
    + * @copyright
    + * Copyright (C) 2004-2009 Alex Gorbatchev.
    + *
    + * @license
    + * This file is part of SyntaxHighlighter.
    + * 
    + * SyntaxHighlighter 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 3 of the License, or
    + * (at your option) any later version.
    + * 
    + * SyntaxHighlighter is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU General Public License for more details.
    + * 
    + * You should have received a copy of the GNU General Public License
    + * along with SyntaxHighlighter.  If not, see .
    + */
    +/**
    + * Midnight SyntaxHighlighter theme based on theme by J.D. Myers
    + * http://webdesign.lsnjd.com/
    + */
    +
    +/************************************
    + * Interface elements.
    + ************************************/
    +
    +.syntaxhighlighter
    +{
    +	background-color: #0F192A !important;
    +}
    +
    +/* Gutter line numbers */
    +.syntaxhighlighter .line .number
    +{
    +	color: #38566F !important;
    +}
    +
    +/* Add border to the lines */
    +.syntaxhighlighter .line .content
    +{
    +	border-left: 3px solid #435A5F !important;
    +	color: #B9BDB6 !important;
    +}
    +
    +.syntaxhighlighter.printing .line .content 
    +{
    +	border: 0 !important;
    +}
    +
    +/* First line */
    +.syntaxhighlighter .line.alt1 .content
    +{
    +	background-color: #0F192A !important;
    +}
    +
    +/* Second line */
    +.syntaxhighlighter .line.alt2 .content
    +{
    +	background-color: #0F192A !important;
    +}
    +
    +.syntaxhighlighter .line .content .block
    +{
    +	background: url(wrapping.png) 0 1.1em no-repeat !important;
    +}
    +
    +/* Highlighed line number */
    +.syntaxhighlighter .line.highlighted .number
    +{
    +	background-color: #253E5A !important;
    +	color: #fff !important;
    +}
    +
    +/* Highlighed line */
    +.syntaxhighlighter .line.highlighted.alt1 .content,
    +.syntaxhighlighter .line.highlighted.alt2 .content
    +{
    +	background-color: #253E5A !important;
    +}
    +
    +.syntaxhighlighter .ruler
    +{
    +	color: #38566F !important;
    +	background-color: #0F192A !important;
    +	border-left: 3px solid #435A5F !important;
    +}
    +
    +.syntaxhighlighter.nogutter .ruler
    +{
    +	border: 0 !important;
    +}
    +
    +.syntaxhighlighter .toolbar
    +{
    +	background-color: #0F192A !important;
    +}
    +
    +.syntaxhighlighter .toolbar a
    +{
    +	color: #38566F !important;
    +}
    +
    +.syntaxhighlighter .toolbar a:hover
    +{
    +	color: #8AA6C1 !important;
    +}
    +
    +/************************************
    + * Actual syntax highlighter colors.
    + ************************************/
    +.syntaxhighlighter .plain,
    +.syntaxhighlighter .plain a
    +{ 
    +	color: #D1EDFF !important;
    +}
    +
    +.syntaxhighlighter .comments,
    +.syntaxhighlighter .comments a
    +{ 
    +	color: #428BDD !important;
    +}
    +
    +.syntaxhighlighter .string,
    +.syntaxhighlighter .string a
    +{
    +	color: #1DC116 !important; 
    +}
    +
    +.syntaxhighlighter .keyword
    +{ 
    +	color: #B43D3D !important; 
    +}
    +
    +.syntaxhighlighter .preprocessor 
    +{ 
    +	color: #8AA6C1 !important; 
    +}
    +
    +.syntaxhighlighter .variable 
    +{ 
    +	color: #FFAA3E !important; 
    +}
    +
    +.syntaxhighlighter .value
    +{ 
    +	color: #F7E741 !important; 
    +}
    +
    +.syntaxhighlighter .functions
    +{ 
    +	color: #FFAA3E !important; 
    +}
    +
    +.syntaxhighlighter .constants
    +{ 
    +	color: #E0E8FF !important; 
    +}
    +
    +.syntaxhighlighter .script
    +{ 
    +	background-color: #404040 !important;
    +}
    +
    +.syntaxhighlighter .color1,
    +.syntaxhighlighter .color1 a
    +{ 
    +	color: #F8BB00 !important; 
    +}
    +
    +.syntaxhighlighter .color2,
    +.syntaxhighlighter .color2 a
    +{ 
    +	color: #FFFFFF !important; 
    +}
    +
    +.syntaxhighlighter .color3,
    +.syntaxhighlighter .color3 a
    +{ 
    +	color: #FFAA3E !important; 
    +}
    diff --git a/saf/lib/Ext/phpmailer/test_script/styles/shThemeRDark.css b/saf/lib/Ext/phpmailer/test_script/styles/shThemeRDark.css
    new file mode 100644
    index 00000000..308db598
    --- /dev/null
    +++ b/saf/lib/Ext/phpmailer/test_script/styles/shThemeRDark.css
    @@ -0,0 +1,192 @@
    +/**
    + * SyntaxHighlighter
    + * http://alexgorbatchev.com/
    + *
    + * SyntaxHighlighter is donationware. If you are using it, please donate.
    + * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
    + *
    + * @version
    + * 2.0.296 (March 01 2009)
    + * 
    + * @copyright
    + * Copyright (C) 2004-2009 Alex Gorbatchev.
    + *
    + * @license
    + * This file is part of SyntaxHighlighter.
    + * 
    + * SyntaxHighlighter 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 3 of the License, or
    + * (at your option) any later version.
    + * 
    + * SyntaxHighlighter is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU General Public License for more details.
    + * 
    + * You should have received a copy of the GNU General Public License
    + * along with SyntaxHighlighter.  If not, see .
    + */
    +/**
    + * RDark SyntaxHighlighter theme based on theme by Radu Dineiu
    + * http://www.vim.org/scripts/script.php?script_id=1732
    + */
    +
    +/************************************
    + * Interface elements.
    + ************************************/
    +
    +.syntaxhighlighter
    +{
    +	background-color: #1B2426 !important;
    +}
    +
    +/* Gutter line numbers */
    +.syntaxhighlighter .line .number
    +{
    +	color: #B9BDB6 !important;
    +}
    +
    +/* Add border to the lines */
    +.syntaxhighlighter .line .content
    +{
    +	border-left: 3px solid #435A5F !important;
    +	color: #B9BDB6 !important;
    +}
    +
    +.syntaxhighlighter.printing .line .content 
    +{
    +	border: 0 !important;
    +}
    +
    +/* First line */
    +.syntaxhighlighter .line.alt1 .content
    +{
    +	background-color: #1B2426 !important;
    +}
    +
    +/* Second line */
    +.syntaxhighlighter .line.alt2 .content
    +{
    +	background-color: #1B2426 !important;
    +}
    +
    +.syntaxhighlighter .line .content .block
    +{
    +	background: url(wrapping.png) 0 1.1em no-repeat !important;
    +}
    +
    +/* Highlighed line number */
    +.syntaxhighlighter .line.highlighted .number
    +{
    +	background-color: #435A5F !important;
    +	color: #fff !important;
    +}
    +
    +/* Highlighed line */
    +.syntaxhighlighter .line.highlighted.alt1 .content,
    +.syntaxhighlighter .line.highlighted.alt2 .content
    +{
    +	background-color: #435A5F !important;
    +}
    +
    +.syntaxhighlighter .ruler
    +{
    +	color: silver !important;
    +	background-color: #1B2426 !important;
    +	border-left: 3px solid #435A5F !important;
    +}
    +
    +.syntaxhighlighter.nogutter .ruler
    +{
    +	border: 0 !important;
    +}
    +
    +.syntaxhighlighter .toolbar
    +{
    +	background-color: #1B2426 !important;
    +}
    +
    +.syntaxhighlighter .toolbar a
    +{
    +	color: #646763 !important;
    +}
    +
    +.syntaxhighlighter .toolbar a:hover
    +{
    +	color: #E0E8FF !important;
    +}
    +
    +/************************************
    + * Actual syntax highlighter colors.
    + ************************************/
    +.syntaxhighlighter .plain,
    +.syntaxhighlighter .plain a
    +{ 
    +	color: #B9BDB6 !important;
    +}
    +
    +.syntaxhighlighter .comments,
    +.syntaxhighlighter .comments a
    +{ 
    +	color: #878A85 !important;
    +}
    +
    +.syntaxhighlighter .string,
    +.syntaxhighlighter .string a
    +{
    +	color: #5CE638 !important; 
    +}
    +
    +.syntaxhighlighter .keyword
    +{ 
    +	color: #5BA1CF !important; 
    +}
    +
    +.syntaxhighlighter .preprocessor 
    +{ 
    +	color: #435A5F !important; 
    +}
    +
    +.syntaxhighlighter .variable 
    +{ 
    +	color: #FFAA3E !important; 
    +}
    +
    +.syntaxhighlighter .value
    +{ 
    +	color: #090 !important; 
    +}
    +
    +.syntaxhighlighter .functions
    +{ 
    +	color: #FFAA3E !important; 
    +}
    +
    +.syntaxhighlighter .constants
    +{ 
    +	color: #E0E8FF !important; 
    +}
    +
    +.syntaxhighlighter .script
    +{ 
    +	background-color: #435A5F !important;
    +}
    +
    +.syntaxhighlighter .color1,
    +.syntaxhighlighter .color1 a
    +{ 
    +	color: #E0E8FF !important; 
    +}
    +
    +.syntaxhighlighter .color2,
    +.syntaxhighlighter .color2 a
    +{ 
    +	color: #FFFFFF !important; 
    +}
    +
    +.syntaxhighlighter .color3,
    +.syntaxhighlighter .color3 a
    +{ 
    +	color: #FFAA3E !important; 
    +}
    diff --git a/saf/lib/Ext/phpmailer/test_script/styles/wrapping.png b/saf/lib/Ext/phpmailer/test_script/styles/wrapping.png
    new file mode 100644
    index 00000000..6972c5e5
    Binary files /dev/null and b/saf/lib/Ext/phpmailer/test_script/styles/wrapping.png differ
    diff --git a/saf/lib/Ext/phpmailer/test_script/test.html b/saf/lib/Ext/phpmailer/test_script/test.html
    new file mode 100644
    index 00000000..97caee08
    --- /dev/null
    +++ b/saf/lib/Ext/phpmailer/test_script/test.html
    @@ -0,0 +1,46 @@
    +
    +
    +
    +  
    +  SyntaxHighlighter Build Test Page
    +  
    +  
    +  
    +  
    +  
    +  
    +  
    +
    +
    +
    +

    SyntaxHihglighter Test

    +

    This is a test file to insure that everything is working well.

    + +
    +function test() : String
    +{
    +  return 10;
    +}
    +
    +