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;
            }
        }
    }
}
Exemple #2
0
    if (isset($_COOKIE['piv_reguser'])) {
        list($reg_name, $reg_hash) = explode("|", $Pivot_Cookies['piv_reguser']);
        if (check_user_hash($reg_name, $reg_hash)) {
            $reg_user = load_user($reg_name);
            if ($reg_user['show_address'] == 1) {
                $_COOKIE['piv_email'] = $reg_user['email'];
            } else {
                $_COOKIE['piv_email'] = "";
            }
            $_COOKIE['piv_name'] = $reg_user['name'];
            $_COOKIE['piv_url'] = $reg_user['url'];
        }
    }
    if (count($_COOKIE) > 0) {
        $cookie = @fill_comment_form($_COOKIE['piv_name'], $_COOKIE['piv_email'], $_COOKIE['piv_url'], $_COOKIE['piv_rememberinfo'], $_COOKIE['piv_comment']);
        $cookie = i18n_str_to_utf8($cookie);
        $output = str_replace("</body>", $cookie . "</body>", $output);
    }
    add_hook("display_entry", "post");
    execute_hook("display_entry", "post", $db->entry, $output, $dummy_variable);
    echo $output;
} else {
    if (isset($Pivot_Vars['f_title'])) {
        // This shows the entry in preview mode.
        define('PREVIEW', TRUE);
        $db = new db();
        $entry = get_entry_from_post();
        $entry['status'] = 'publish';
        $entry = $db->set_entry($entry);
        execute_hook("display_entry", "pre");
        $output = parse_entry($entry['code'], "");
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;
            }
        }
    }
}