}
if($params['type'] == NOTIFY_SYSTEM) {
- //I have yet to find what system notificatons are...
+ switch($params['event']) {
+ case "SYSTEM_REGISTER_REQUEST":
+ $subject = sprintf( t('[Friendica System:Notify] registration request'));
+ $preamble = sprintf( t('You\'ve received a registration request from \'%1$s\' at %2$s'), $params['source_name'], $sitename);
+ $epreamble = sprintf( t('You\'ve received a [url=%1$s]registration request[/url] from %2$s.'),
+ $itemlink,
+ '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
+ $body = sprintf( t('Full Name: %1$s\nSite Location: %2$s\nLogin Name: %3$s (%4$s)'),
+ $params['source_name'], $siteurl, $params['source_mail'], $params['source_nick']);
+
+ $sitelink = t('Please visit %s to approve or reject the request.');
+ $tsitelink = sprintf( $sitelink, $params['link'] );
+ $hsitelink = sprintf( $sitelink, '<a href="' . $params['link'] . '">' . $sitename . '</a><br><br>');
+ $itemlink = $params['link'];
+ break;
+ case "SYSTEM_DB_UPDATE_FAIL":
+ break;
+ }
}
if ($params['type'] == "SYSTEM_EMAIL"){
// add a notification to the user, with could be inexistent)
$subject = $params['subject'];
$preamble = $params['preamble'];
- if (x($params,'epreamble')){
- $epreamble = $params['epreamble'];
- } else {
- $epreamble = str_replace("\n","<br>\n",$preamble);
- }
$body = $params['body'];
$sitelink = "";
$tsitelink = "";
if ($show_in_notification_page) {
+ logger("adding notification entry", LOGGER_DEBUG);
do {
$dups = false;
$hash = random_string();
call_hooks('enotify_mail', $datarray);
// check whether sending post content in email notifications is allowed
- $content_allowed = !get_config('system','enotify_no_content');
+ // always true for "SYSTEM_EMAIL"
+ $content_allowed = ((!get_config('system','enotify_no_content')) || ($params['type'] == "SYSTEM_EMAIL"));
// load the template for private message notifications
$tpl = get_markup_template('email_notify_html.tpl');
$email_html_body = replace_macros($tpl,array(
'$banner' => $datarray['banner'],
'$product' => $datarray['product'],
- '$preamble' => $datarray['preamble'],
+ '$preamble' => str_replace("\n","<br>\n",$datarray['preamble']),
'$sitename' => $datarray['sitename'],
'$siteurl' => $datarray['siteurl'],
'$source_name' => $datarray['source_name'],
// use the Emailer class to send the message
- Emailer::send(array(
+ return Emailer::send(array(
'fromName' => $sender_name,
'fromEmail' => $sender_email,
'replyTo' => $sender_email,
'textVersion' => $email_text_body,
'additionalMailHeader' => $datarray['headers'],
));
- return True;
}
return False;