diff options
author | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2019-09-26 07:29:28 +0000 |
---|---|---|
committer | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2019-09-26 07:29:28 +0000 |
commit | 9b04db8503c2cf4501bf88d588e2b901916c7490 (patch) | |
tree | efbee82944e1a297a474edecb406e084e154cedd /Postman | |
parent | caa73945f9fe69875171ea2aade2c53e60b21bbe (diff) | |
download | Post-SMTP-9b04db8503c2cf4501bf88d588e2b901916c7490.zip |
2.0.5 released - Few notifications errors, export logs and minor improvements
Diffstat (limited to 'Postman')
12 files changed, 53 insertions, 68 deletions
diff --git a/Postman/Postman-Connectivity-Test/registered-domain-libs-master/.gitignore b/Postman/Postman-Connectivity-Test/registered-domain-libs-master/.gitignore deleted file mode 100644 index 7886a27..0000000 --- a/Postman/Postman-Connectivity-Test/registered-domain-libs-master/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -C/*.o -C/libregdom.so.1 -C/test-regdom diff --git a/Postman/Postman-Mail/google-api-client/vendor/google/apiclient-services/.gitignore b/Postman/Postman-Mail/google-api-client/vendor/google/apiclient-services/.gitignore deleted file mode 100644 index 01150f6..0000000 --- a/Postman/Postman-Mail/google-api-client/vendor/google/apiclient-services/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -vendor -composer.lock -src/Google/Service/Compute/HTTPHealthCheck.php -src/Google/Service/Compute/HTTPSHealthCheck.php diff --git a/Postman/Postman-Mail/google-api-client/vendor/google/auth/.gitignore b/Postman/Postman-Mail/google-api-client/vendor/google/auth/.gitignore deleted file mode 100644 index 1cb030a..0000000 --- a/Postman/Postman-Mail/google-api-client/vendor/google/auth/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*~ -vendor -composer.lock diff --git a/Postman/Postman-Mail/google-api-client/vendor/psr/log/.gitignore b/Postman/Postman-Mail/google-api-client/vendor/psr/log/.gitignore deleted file mode 100644 index 22d0d82..0000000 --- a/Postman/Postman-Mail/google-api-client/vendor/psr/log/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vendor diff --git a/Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/.gitignore b/Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/.gitignore deleted file mode 100644 index de4a392..0000000 --- a/Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/vendor -/composer.lock diff --git a/Postman/Postman-Mail/mailgun/vendor/symfony/options-resolver/.gitignore b/Postman/Postman-Mail/mailgun/vendor/symfony/options-resolver/.gitignore deleted file mode 100644 index c49a5d8..0000000 --- a/Postman/Postman-Mail/mailgun/vendor/symfony/options-resolver/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/Postman/Postman-Mail/mailgun/vendor/webmozart/assert/.gitignore b/Postman/Postman-Mail/mailgun/vendor/webmozart/assert/.gitignore deleted file mode 100644 index 3a9875b..0000000 --- a/Postman/Postman-Mail/mailgun/vendor/webmozart/assert/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/vendor/ -composer.lock diff --git a/Postman/Postman-Mail/sendgrid/.gitignore b/Postman/Postman-Mail/sendgrid/.gitignore deleted file mode 100644 index 6df0272..0000000 --- a/Postman/Postman-Mail/sendgrid/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -test/coverage/* -examples/* -dist/ -composer.lock -vendor -.env* -sendgrid-php.php diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore deleted file mode 100644 index b90ffc5..0000000 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -# Composer -vendor/ -*.phar -*.lock - -# Jetbrains Idea -*.old -.idea/ - -# Environment files -.env/*.*
\ No newline at end of file diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore deleted file mode 100644 index efe514c..0000000 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -test/coverage/* -dist/ -composer.lock -vendor -.env -sendgrid.env -composer.phar -.editorconfig -test.php -.idea/ -test/prism_linux_amd64 -test/prism/* -!test/prim -*.code-workspace -.vscode -prism* -temp.php -example*.php -TODO.txt diff --git a/Postman/PostmanLogFields.php b/Postman/PostmanLogFields.php index 6e04b8d..04d24a4 100644 --- a/Postman/PostmanLogFields.php +++ b/Postman/PostmanLogFields.php @@ -3,17 +3,17 @@ class PostmanLogFields { private $fields = array( 'success' => 'sanitize_text_field', - 'from_header' => '', - 'to_header' => '', - 'cc_header' => '', - 'bcc_header' => '', - 'reply_to_header' => '', + 'from_header' => [ 'PostmanLogFields', 'email_header_sanitize' ], + 'to_header' => [ 'PostmanLogFields', 'email_header_sanitize' ], + 'cc_header' => [ 'PostmanLogFields', 'email_header_sanitize' ], + 'bcc_header' => [ 'PostmanLogFields', 'email_header_sanitize' ], + 'reply_to_header' => [ 'PostmanLogFields', 'email_header_sanitize' ], 'transport_uri' => 'sanitize_text_field', 'original_to' => 'sanitize_text_field', 'original_subject' => 'sanitize_text_field', - 'original_message' => null, - 'original_headers' => 'sanitize_text_field', - 'session_transcript' => 'sanitize_textarea_field', + 'original_message' => '', // only sent to viewed + 'original_headers' => '', // only sent to viewed + 'session_transcript' => '', // escaped when viewed ); private static $instance = null; @@ -28,7 +28,7 @@ class PostmanLogFields { private function __construct() { - $this->fields['original_message'] = array( $this, 'sanitize_message' ); + } public function get( $post_id ) { @@ -73,13 +73,14 @@ class PostmanLogFields { } private function sanitize( $key, $value ) { + $callback = is_array( $value ) ? 'array_map' : 'call_user_func'; if ( ! empty( $this->fields[$key] ) ) { return $callback( $this->fields[$key], $value ); } - return filter_var( $value, FILTER_SANITIZE_STRING | FILTER_SANITIZE_SPECIAL_CHARS ); + return $value; } private function sanitize_message( $message ) { @@ -96,4 +97,43 @@ class PostmanLogFields { return $value; } -}
\ No newline at end of file + + public function get_string_between($string, $start, $end){ + $string = ' ' . $string; + $ini = strpos($string, $start); + + if ($ini == 0) { + return ''; + } + + $ini += strlen($start); + $len = strpos($string, $end, $ini) - $ini; + + return substr($string, $ini, $len); + } + + public function email_header_sanitize($value) { + + $parts = explode( ',', $value ); + + $sanitized = []; + foreach ( $parts as $part ) { + + if ( strpos( $part, '<' ) !== false ) { + $email = $this->get_string_between( $part, '<', '>' ); + $clean_email = $this->sanitize_email($email); + preg_match('/(.*)</', $part, $output_array); + $name = filter_var( trim( $output_array[1] ), FILTER_SANITIZE_STRING ); + + $sanitized[] = "{$name} <{$clean_email}>"; + } + } + + return ! empty( $sanitized ) ? implode( ',', $sanitized ) : implode( ',', array_map( [ $this, 'sanitize_email'], $parts ) ); + } + + public function sanitize_email( $email ) { + return filter_var( $email, FILTER_SANITIZE_EMAIL ); + } +} + diff --git a/Postman/PostmanViewController.php b/Postman/PostmanViewController.php index 050033f..dfd4207 100644 --- a/Postman/PostmanViewController.php +++ b/Postman/PostmanViewController.php @@ -319,11 +319,11 @@ if ( ! class_exists( 'PostmanViewController' ) ) { $show = get_option('postman_release_version' ); printf( '<h2>%s</h2>', sprintf( __( '%s Setup', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) ) ); - if ( ! $show ) { + if ( ! $show && POST_SMTP_SHOW_RELEASE_MESSAGE ) { echo ' <div class="updated settings-error notice is-dismissible"> <p> - <strong>Version ' . $version . ' Sendgrid code fix and default delivery changes:</strong> <a target="_blank" href="https://postmansmtp.com/post-smtp-2-0-2-sendgrid-code-revert/">Read Here</a> + <strong>Version ' . $version . ' ' . POST_SMTP_RELEASE_MESSAGE . ':</strong> <a target="_blank" href="' . POST_SMTP_RELEASE_URL . '">Read Here</a> </p> <button style="z-index: 100;" data-version="'. $version . '" data-security="' . wp_create_nonce('postsmtp') .'" type="button" class="notice-dismiss postman-release-message"> <span class="screen-reader-text">Dismiss this notice.</span> |