コード例 #1
0
    }
}
$all_comments = file("{$blogpath}/data/comments.txt");
foreach ($all_comments as $null => $lcomment_line) {
    $lcomment_line_arr = explode("|>|", $lcomment_line);
    $newsid = $lcomment_line_arr[0];
    $lcomment_arr = explode("||", $lcomment_line_arr[1]);
    foreach ($lcomment_arr as $null => $lsingle_comment) {
        check_latest_comment($lsingle_comment, $newsid);
    }
}
echo "<!-- Latest {$lcomments_number} comments from any article displayed here -->\n";
$cc = 1;
foreach ($latest_comments as $null => $lcomment) {
    // linkelements
    $parententry = aj_PostInfo($lcomment["newsid"], "{$blogpath}/data/news.txt");
    $title = aj_prepareTitle($parententry["title"]);
    $urldate = date("Y/m/d/", $parententry["date"]);
    $flink = "{$urldate}{$title}";
    if ($lcomment['name'] == "") {
        continue;
    }
    $output = $lctemplate;
    $output = str_replace("{url}", $flink, $output);
    $output = str_replace("{name}", $lcomment['name'], $output);
    $output = str_replace("{mail}", $lcomment['mail'], $output);
    $output = str_replace("{ip}", $lcomment['ip'], $output);
    $lcomment['comment'] = stripslashes(strip_tags($lcomment['comment']));
    $lcomment['comment'] = preg_replace("'\\[(.*?)\\](.*?)\\[/(.*?)\\]'i", "\\2", $lcomment['comment']);
    $lcomment_length = strlen($lcomment['comment']);
    $maxlenminusnavn = $maxlen - strlen($lcomment['name']);
コード例 #2
0
function msp_send($hook)
{
    global $added_time, $member_db, $title, $short_story, $old_db_arr, $time, $name, $comments, $id, $cutepath;
    $msp = new PluginSettings('Mailing_System');
    $mails = $msp->settings['mails']['0'];
    $me = $msp->settings['me'];
    $subject = $msp->settings['mails']['subject'];
    if (empty($subject)) {
        $subject = "Site updated @ {maildate} by {mailuser}";
    }
    if (empty($me)) {
        $me = 'ajfork@' . $_SERVER['SERVER_NAME'];
    }
    // Common and required
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/plain; charset=utf-8\r\n";
    /* additional headers */
    // $headers .= "To: $member_db[4] <$member_db[5]>\r\n";
    $headers .= "From: AJ-Fork <{$me}>\r\n";
    // Var sanitizing for news
    $msp_send_short_story = str_replace("{nl}", "\r\n", $short_story);
    $msp_send_short_story = explode('<!--more-->', $msp_send_short_story);
    $msp_send_short = $msp_send_short_story[0];
    $more = $msp_send_short_story[1];
    $old = $old_db_arr[3];
    $oshort_story = str_replace("{nl}", "\r\n", $old);
    $oshort_story = explode('<!--more-->', $oshort_story);
    $oshort = $oshort_story[0];
    $omore = $oshort_story[1];
    if ($added_time != "") {
        $humandate = date("d/m/y", $added_time);
    } elseif ($old_db_arr[0] != "") {
        $humandate = date("d/m/y", $old_db_arr[0]);
    } elseif ($time != "") {
        $humandate = date("d/m/y", $time);
    }
    // Var senitizing for comments
    $comments = str_replace("{nl}", "\r\n", $comments);
    switch ($hook) {
        case 'new-save-entry':
            $to = $mails[AddedEmails];
            $action = "News Added";
            $message = "AJ-Fork Mailing System Plugin\r\n\r\n{$member_db['4']} ({$member_db['2']}) just added \"{$title}\" (added {$humandate}), containing the following:\r\n\r\nShort:\r\n\t{$msp_send_shortMore}:\r\n\t{$more}";
            $subject = str_replace("{mailuser}", $member_db[4], $subject);
            break;
        case 'edit-save-entry':
            $to = $mails[EditedEmails];
            if ($mails[AuthorEdited]) {
                $to .= ", {$member_db['5']}";
            }
            $action = "News Edited";
            $message = "AJ-Fork Mailing System Plugin\r\n\r\n{$member_db['4']} ({$member_db['2']}) edited article titled \"{$title}\" @ {$humandate}. Old and new short story follows:\r\n\r\nOld:\r\n\tShort:\r\n\t\t{$oshort}\r\n\r\n\tMore:\r\n\t\t{$omore}\r\n\r\nNew:\r\n\tShort:\r\n\t\t{$msp_send_short}\r\n\r\n\tMore:\r\n\t\t{$more}";
            $subject = str_replace("{mailuser}", $member_db[4], $subject);
            break;
        case 'comment-added':
            $to = $mails[CommentEmails];
            if ($mails[AuthorComments]) {
                $this_post_arr = aj_PostInfo($id, "{$cutepath}/data/news.txt");
                $owner_arr = aj_get_member($this_post_arr["author"]);
                $authoremail = $owner_arr[5];
                $title = $this_post_arr["title"];
                $to .= ", {$authoremail}";
            }
            $action = "Comment added";
            $message = "AJ-Fork Mailing System Plugin\r\n\r\n{$name} added a comment for article {$title} @ {$humandate}. Content follows:\r\n\r\n\t{$comments}";
            $subject = str_replace("{mailuser}", $name, $subject);
            break;
    }
    $subject = str_replace("{maildate}", $humandate, $subject);
    mail($to, "{$subject}", "{$message}", $headers);
}