function sendMailTrackback($my_trackback) { global $PIVOTX; $cat_weblogs = $PIVOTX['weblogs']->getWeblogsWithCat($PIVOTX['db']->entry['category']); $addr_arr = array(); // Using the same settings as for comments foreach ($cat_weblogs as $this_weblog) { if ($PIVOTX['weblogs']->get($this_weblog, 'comment_sendmail') == 1) { $addr_arr = array_merge($addr_arr, explode(",", $PIVOTX['weblogs']->get($this_weblog, 'comment_emailto'))); } } // make a nice title for the mail.. if (strlen($PIVOTX['db']->entry['title']) > 2) { $title = $PIVOTX['db']->entry['title']; $title = strip_tags($title); } else { $title = substr($PIVOTX['db']->entry['introduction'], 0, 300); $title = strip_tags($title); $title = str_replace("\n", "", $title); $title = str_replace("\r", "", $title); $title = substr($title, 0, 60); } $title = i18n_str_to_utf8($title); // maybe send some mail to authors.. if (count($addr_arr) > 0) { $adminurl = $PIVOTX['paths']['host'] . makeAdminPageLink(); $id = formatDate($my_trackback["date"], "%ye%%month%%day%%hour24%%minute%"); $editlink = $adminurl . "?page=trackbacks&uid=" . $PIVOTX['db']->entry['code']; /* $blocklink = $adminurl."menu=entries&func=edittracks&id=". $PIVOTX['db']->entry['code']. "&blocksingle=".$my_trackback['ip']; */ $body = sprintf(__('"%s" posted the following trackback') . ":", unentify($my_trackback['name'])); $body .= sprintf("\n\n-------------\n"); $body .= sprintf(__('Title') . ": %s\n", $my_trackback['title']); $body .= sprintf(__('URL') . ": %s\n", $my_trackback['url']); $body .= sprintf(__('Excerpt') . ":\n%s", unentify($my_trackback['excerpt'])); $body .= sprintf("\n-------------\n"); $body .= sprintf(__('IP-address') . ": %s\n", $my_trackback['ip']); $body .= sprintf(__('Date') . ": %s\n", $my_trackback['date']); $body .= sprintf("\n" . __('This is a trackback on entry "%s"') . "\n", $title); $body .= sprintf("-------------\n"); $body .= sprintf("%s:\n%s%s\n", __('View this entry'), $PIVOTX['paths']['host'], makeFileLink($PIVOTX['db']->entry, "", "")); $body .= sprintf("\n%s:\n%s\n", __('Edit this trackback'), $editlink); //$body.=sprintf("\n%s:\n%s\n", __('Block this IP'), $blocklink ); $body = i18n_str_to_utf8($body); // pivotxMail encodes the subject and adds the needed headers for UTF-8 $subject = sprintf(__('New trackback on entry "%s"'), $title); $addr_arr = array_unique($addr_arr); foreach ($addr_arr as $addr) { $addr = trim($addr); if (pivotxMail($addr, $subject, $body, $add_header)) { debug("Sent Mail to {$addr} for '" . $my_trackback['name'] . "'"); } else { debug("Failed sending mail to {$addr} for '" . $my_trackback['name'] . "'"); break; } } } }
/** * Composes an entry based on the email. * */ function compose_entry() { global $PIVOTX; $entry = $this->entry; if (strlen($entry['introduction']) > 2 || strlen($entry['body']) > 2) { // if so, save the new entry and generate files (if necessary) $entry['code'] = ">"; $entry['date'] = $entry['publish_date'] = date('Y-m-d-H-i', getCurrentDate()); if (!isset($entry['title']) || $entry['title'] == "") { $entry['title'] = $this->cfg['title']; } if (!isset($entry['subtitle'])) { $entry['subtitle'] = ''; } if (!isset($entry['status']) || $entry['status'] == "") { $entry['status'] = $this->cfg['status']; } $entry['allow_comments'] = $this->cfg['allow_comments']; $entry['convert_lb'] = 0; if (!isset($entry['user']) || $entry['user'] == "" || !$PIVOTX['users']->getUser($entry['user'])) { $entry['user'] = $this->cfg['author']; } //check for valid sender: $replyaddress must be in $this->cfg['allowed_senders'] $allowed = false; if (strlen($entry['replyaddress']) > 2) { $replyaddress = 'x' . strtolower($entry['replyaddress']); foreach ($this->cfg['allowed_senders'] as $sender) { if (strpos($replyaddress, strtolower($sender)) > 0) { $allowed = true; break; } } } if ($allowed) { $entry['category'] = array($this->cfg['category']); if (isset($entry['override_cat'])) { $entry['category'] = array($entry['override_cat']); } } else { $entry['category'] = array($this->cfg['spam_category']); $entry['status'] = 'hold'; } $entry = $PIVOTX['db']->set_entry($entry); $PIVOTX['db']->save_entry(true); $msg = __('Your entry has been posted!') . "\n\n" . sprintf("%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s", __('User'), $entry['user'], __('Category'), implode(',', $entry['category']), __('Title'), $entry['title'], __('Subtitle'), $entry['subtitle'], __('Introduction'), $entry['introduction']); $msg_title = __('Moblog entry posted'); } else { $msg = __("Not posted: Could not parse your entry.\n\nPlease report this in the PivotX forum"); $msg_title = __('Moblog entry not posted'); } $msg .= "\n\n" . sprintf(__("Processed: %s"), formatDate('', "%day%-%month%-'%ye% %hour24%:%minute%")) . "\n"; // to wrap it up, send a confirmation by mail.. if ($entry['replyaddress'] != "" && $this->cfg['send_confirmation']) { $add_header = sprintf("From: %s", $entry['replyaddress'] . "\n"); $add_header .= sprintf("X-loop: pivotx-moblog"); if (!pivotxMail($entry['replyaddress'], $msg_title, $msg, $add_header)) { debug("Failed to send moblog confirmation message"); } } return $msg; }
function sendMailComment($temp_comment, $notifications = '') { global $PIVOTX; $cat_weblogs = $PIVOTX['weblogs']->getWeblogsWithCat($PIVOTX['db']->entry['category']); $addr_arr = array(); foreach ($cat_weblogs as $this_weblog) { if ($PIVOTX['weblogs']->get($this_weblog, 'comment_sendmail') == 1) { $addr_arr = array_merge($addr_arr, explode(",", $PIVOTX['weblogs']->get($this_weblog, 'comment_emailto'))); } } // make a nice title for the mail.. if (strlen($PIVOTX['db']->entry['title']) > 2) { $title = $PIVOTX['db']->entry['title']; $title = strip_tags($title); } else { $title = substr($PIVOTX['db']->entry['introduction'], 0, 300); $title = strip_tags($title); $title = str_replace("\n", "", $title); $title = str_replace("\r", "", $title); $title = substr($title, 0, 60); } $title = i18n_str_to_utf8($title); // maybe send some mail to authors.. if (count($addr_arr) > 0) { $adminurl = $PIVOTX['paths']['host'] . makeAdminPageLink(); $id = safeString($temp_comment["name"], TRUE) . "-" . formatDate($temp_comment["date"], "%ye%%month%%day%%hour24%%minute%"); $editlink = $adminurl . "?page=comments&uid=" . $PIVOTX['db']->entry['code']; $approvelink = $adminurl . "?page=comments"; //$deletelink = $adminurl."menu=moderate_comments&".urlencode($id)."=2"; //$blocklink = $adminurl."menu=entries&func=editcomments&id=". $PIVOTX['db']->entry['code']."&blocksingle=".$temp_comment['ip']; $comment = $temp_comment['comment']; // $comment = unentify($comment); $body = sprintf(__('"%s" posted the following comment') . ":\n\n", unentify($temp_comment['name'])); $body .= sprintf("%s", $comment); $body .= sprintf("\n\n-------------\n\n"); $body .= sprintf(__('Name') . ": %s\n", unentify($temp_comment['name'])); $body .= sprintf(__('IP-address') . ": %s\n", $temp_comment['ip']); $body .= sprintf(__('Date') . ": %s\n", $temp_comment['date']); $body .= trim(sprintf(__('Email') . ": %s", $temp_comment['email'])) . "\n"; $body .= trim(sprintf(__('URL') . ": %s\n", $temp_comment['url'])) . "\n"; $body .= sprintf("\n" . __('This is a comment on entry "%s"') . "\n", $title); $body .= $notifications; $body .= sprintf("\n-------------\n\n"); if ($PIVOTX['config']->get('moderate_comments') == 1) { $body .= sprintf(__('Moderate this comment') . ":\n%s\n", $approvelink); // $body.=sprintf("\n".__('Delete this comment').":\n%s\n", $deletelink); } $body .= sprintf("\n%s:\n%s%s\n", __('View this entry'), $PIVOTX['paths']['host'], makeFileLink($PIVOTX['db']->entry, "", "")); $body .= sprintf("\n%s:\n%s%s\n", __('View this comment'), $PIVOTX['paths']['host'], makeFileLink($PIVOTX['db']->entry, "", $id)); $body .= sprintf("\n%s:\n%s\n", __('Edit this comment'), $editlink); //$body.=sprintf("\n%s:\n%s\n", __('Block this IP'), $blocklink ); $body = i18n_str_to_utf8($body); // pivotxMail encodes the subject and adds the needed headers for UTF-8 $subject = sprintf(__('New comment on entry "%s"'), $title); $addr_arr = array_unique($addr_arr); foreach ($addr_arr as $addr) { $addr = trim($addr); if (pivotxMail($addr, $subject, $body, $add_header)) { debug("Sent Mail to {$addr} for '" . $temp_comment['name'] . "'"); } else { debug("Failed sending mail to {$addr} for '" . $temp_comment['name'] . "'"); break; } } } }
function regUser($user) { global $PIVOTX; $name_md5 = strtolower(md5(strtolower($user['name']))); if (saveSerialize($PIVOTX['paths']['db_path'] . 'users/' . $name_md5 . '.php', $user)) { $text = sprintf("<h2>%s</h2>\n\n", __('User stored!')); } else { $text = sprintf("<h2>%s</h2>\n\n", __('Could not store new user!!')); } $mail1 = __("You have registered as a user on PivotX \"%s\" \n\n"); $mail2 = __("To verify your account, click the following link:\n%s\n\n"); $url = sprintf("%s&name=%s&code=%s", $PIVOTX['paths']['host'] . makeVisitorPageLink('verify'), urlencode($user['name']), md5($user['pass'] . "email")); $mail = sprintf($mail1 . $mail2, $PIVOTX['config']->get('sitename'), str_replace('&', '&', $url)); if (!pivotxMail($user['email'], __('Registration confirmation'), $mail)) { $mail2 = '<a href="%s">' . __('Verify your account') . '</a>'; $mail = sprintf($mail1 . $mail2, $PIVOTX['config']->get('sitename'), $url); $text = "\n<br />" . nl2br($mail) . "<br />\n"; } else { $text = sprintf(__('Mail verification sent to %s. ' . 'Please check your email in a minute to confirm your account.'), $user['email']); } $this->input['message'] = $text; sendMailNotification('visitor_registration', array('add', $user['name'])); }