function board_comments_moderation($pModerationInfo) { if ($pModerationInfo['type'] == 'comment_post') { $storeComment = new LibertyComment(NULL, $pModerationInfo['content_id']); $storeComment->load(); $comments_return_url = ''; $root_id = $storeComment->mInfo['root_id']; global $gContent; $board = new BitBoard(NULL, $root_id); $board->load(); $boardSync = $board->getPreference('board_sync_list_address'); $code = $storeComment->getPreference('board_confirm_code'); $approved = $board->getPreference('boards_mailing_list_password'); // Possible race. Did we beat the cron? if (empty($code)) { require_once BOARDS_PKG_PATH . 'admin/boardsync_inc.php'; // Try to pick up the message! board_sync_run(TRUE); } if (!empty($code) && !empty($boardSync) && !empty($approved)) { $boardSync = str_replace('@', '-request@', $boardSync); $code = 'confirm ' . $code; require_once KERNEL_PKG_PATH . 'BitMailer.php'; $mailer = new BitMailer(); if ($pModerationInfo['last_status'] == MODERATION_DELETE) { // Send a reject message $mailer->sendEmail($code, '', $boardSync, array('sender' => BitBoard::getBoardSyncInbox())); } else { // Send an accept message $mailer->sendEmail($code, '', $boardSync, array('sender' => BitBoard::getBoardSyncInbox(), 'x_headers' => array('Approved' => $approved))); } } } }
function send_board_email($storeComment) { global $gBitSystem, $gContent, $gBitUser; /* If sync goes both ways we always send and let moderation of the list or the board do its thing. If not we send if the content status says we can. */ $boardSync = $gContent->getPreference('board_sync_list_address'); if (!empty($boardSync) || $storeComment->getContentStatus() > 0) { require_once KERNEL_PKG_PATH . 'BitMailer.php'; $bitMailer = new BitMailer(); $email = $gContent->getPreference('boards_mailing_list') . '@' . $gBitSystem->getConfig('boards_email_host', $gBitSystem->getConfig('kernel_server_name')); if ($storeComment->getField('user_id') == ANONYMOUS_USER_ID) { $headerHash['from_name'] = $storeComment->getField('anon_name'); $headerHash['from'] = 'anonymous@' . $gBitSystem->getConfig('boards_sync_mail_server'); } else { $userInfo = $gBitUser->getUserInfo(array('user_id' => $storeComment->getField('user_id', $gBitUser->mUserId))); $headerHash['from_name'] = !empty($userInfo['real_name']) ? $userInfo['real_name'] : $userInfo['login']; $headerHash['from'] = $userInfo['email']; $headerHash['sender'] = $userInfo['email']; } $headerHash['x_headers']['X-BitBoards-Comment'] = $storeComment->mCommentId; $messageId = $bitMailer->sendEmail($storeComment->getTitle(), $storeComment->parseData(), $email, $headerHash); $storeComment->storeMessageId($messageId); } }