PluginProbe
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent / 3.5.4
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent v3.5.4
3.5.4 3.5.3 3.5.2 3.5.1 3.4.9 3.5.0 3.4.8 3.4.7 trunk 2.3.1 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6
← All changes | includes/class-wpsc-email-notifications.php +25 -9 3.4.9 → 3.5.4 View file →
@@ -63,8 +63,15 @@
63 63 */
64 64 public $body;
65 65
66 66 /**
67 + * Ticket object this notification is for
68 + *
69 + * @var WPSC_Ticket
70 + */
71 + public $ticket;
72 +
73 + /**
67 74 * Email notification template
68 75 *
69 76 * @var Array
70 77 */
@@ -182,10 +189,15 @@
182 189 public function send() {
183 190
184 191 $en = get_option( 'wpsc-en-general' );
185 192 // headers.
186 - $headers = "From: {$this->from_name} <{$this->from_email}>\r\n";
187 - $headers .= "Reply-To: {$this->reply_to}\r\n";
193 + $headers = '';
194 + if ( $this->from_name && $this->from_email ) {
195 + $headers = "From: {$this->from_name} <{$this->from_email}>\r\n";
196 + }
197 + if ( $this->reply_to ) {
198 + $headers .= "Reply-To: {$this->reply_to}\r\n";
199 + }
188 200 foreach ( $this->cc as $email ) {
189 201 $headers .= "CC: {$email}\r\n";
190 202 }
191 203 foreach ( $this->bcc as $email ) {
@@ -205,10 +217,17 @@
205 217 if ( ! file_exists( $filepath ) ) {
206 218 mkdir( $filepath, 0777, true );
207 219 }
208 220 $filepath .= '/' . $attachment->name;
209 - copy( $upload_dir['basedir'] . $attachment->file_path, $filepath );
210 - $attachments[] = $filepath;
221 +
222 + $source = wp_normalize_path( $attachment->file_path );
223 + if ( ! is_file( $source ) ) {
224 + $source = trailingslashit( wp_normalize_path( $upload_dir['basedir'] ) ) . ltrim( $source, '/\\' );
225 + }
226 +
227 + if ( is_file( $source ) && copy( $source, $filepath ) ) {
228 + $attachments[] = $filepath;
229 + }
211 230 endforeach;
212 231 }
213 232
214 233 if ( is_rtl() ) {
@@ -256,14 +275,11 @@
256 275 }
257 276
258 277 // from name & email.
259 278 $en_general = get_option( 'wpsc-en-general' );
260 - if ( ! $en_general['from-name'] || ! $en_general['from-email'] ) {
261 - return false;
262 - }
263 279
264 - $this->from_name = $en_general['from-name'];
265 - $this->from_email = $en_general['from-email'];
280 + $this->from_name = $en_general['from-name'] ? $en_general['from-name'] : '';
281 + $this->from_email = $en_general['from-email'] ? $en_general['from-email'] : '';
266 282 $this->reply_to = $en_general['reply-to'] ? $en_general['reply-to'] : $this->from_email;
267 283
268 284 // subject.
269 285 $this->set_subject();