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' . $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() . "'; + + 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 . '
+ 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 @@ + + + + + +
-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.
-
-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.
-
-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 ("/").
-
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 = "+class phpmailerAppException extends Exception { + public function errorMessage() { + $errorMsg = '' . $this->getMessage() . "+ + + + + + + \ 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
"; + 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; + } +} +
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 = ''
+ ;
+ }
+ 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('
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 = '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 + ''
+ + ''
+ + '.*?)" +
+ "(?" + 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;
+}
+
+