+ }
+
+ // TODO - create notification entry in DB
+
+
+
+ // send email notification if notification preferences permit
+
+ require_once('bbcode.php');
+ if(intval($params['notify_flags']) & intval($params['type'])) {
+
+ logger('notification: sending notification email');
+
+ push_lang($params['language']);
+
+ $textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r", "\\n"), "\n",
+ $body))),ENT_QUOTES,'UTF-8'));
+ $htmlversion = html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r","\\n\\n" ,"\\n"),
+ "<br />\n",$body))));
+
+ // load the template for private message notifications
+ $tpl = get_markup_template('email_notify_html.tpl');
+ $email_html_body = replace_macros($tpl,array(
+ '$banner' => $banner,
+ '$product' => $product,
+ '$preamble' => $preamble,
+ '$sitename' => $sitename,
+ '$siteurl' => $siteurl,
+ '$source_name' => $parama['source_name'],
+ '$source_link' => $params['source_link'],
+ '$source_photo' => $params['source_photo'],
+ '$username' => $params['to_name'],
+ '$hsitelink' => $hsitelink,
+ '$itemlink' => '<a href="' . $itemlink . '">' . $itemlink . '</a>',
+ '$thanks' => $thanks,
+ '$site_admin' => $site_admin,
+ '$title' => stripslashes($title),
+ '$htmlversion' => $htmlversion,
+ ));
+
+ // load the template for private message notifications
+ $tpl = get_markup_template('email_notify_text.tpl');
+ $email_text_body = replace_macros($tpl,array(
+ '$banner' => $banner,
+ '$product' => $product,
+ '$preamble' => $preamble,
+ '$sitename' => $sitename,
+ '$siteurl' => $siteurl,
+ '$source_name' => $parama['source_name'],
+ '$source_link' => $params['source_link'],
+ '$source_photo' => $params['source_photo'],
+ '$username' => $params['to_name'],
+ '$tsitelink' => $tsitelink,
+ '$itemlink' => $itemlink,
+ '$thanks' => $thanks,
+ '$site_admin' => $site_admin,
+ '$title' => stripslashes($title),
+ '$textversion' => $textversion,
+ ));
+
+// logger('text: ' . $email_text_body);
+
+ // use the EmailNotification library to send the message
+
+ enotify::send(array(
+ 'fromName' => $sender_name,
+ 'fromEmail' => $sender_email,
+ 'replyTo' => $sender_email,
+ 'toEmail' => $params['to_email'],
+ 'messageSubject' => $subject,
+ 'htmlVersion' => $email_html_body,
+ 'textVersion' => $email_text_body
+ ));
+ pop_lang();
+ }
+}