Example #1
0
function cmtx_prepare_comment_for_email($comment, $slashes = true)
{
    //prepares comment for email
    if ($slashes) {
        $comment = cmtx_strip_slashes($comment);
    }
    $comment = str_ireplace("<br />", "\r\n", $comment);
    $comment = str_ireplace("<br/>", "\r\n", $comment);
    $comment = str_ireplace("<br>", "\r\n", $comment);
    $comment = str_ireplace("<p></p>", "\r\n\r\n", $comment);
    $comment = str_ireplace("<p />", "\r\n\r\n", $comment);
    $comment = str_ireplace("<p/>", "\r\n\r\n", $comment);
    $comment = str_ireplace("<li>", "- ", $comment);
    $comment = str_ireplace("</li>", "\r\n", $comment);
    $comment = str_ireplace("\r\n</ul>", "", $comment);
    $comment = str_ireplace("\r\n</ol>", "", $comment);
    $comment = strip_tags($comment);
    $comment = cmtx_decode($comment);
    $comment = preg_replace("/(\r\n){3,}/", "\r\n\r\n", $comment);
    $comment = trim($comment);
    return $comment;
}
Example #2
0
     } else {
         if (!cmtx_setting('approve_notifications')) {
             cmtx_notify_subscribers($cmtx_name, $cmtx_comment, $cmtx_page_id, $cmtx_comment_id, $cmtx_reply_to, $cmtx_is_admin);
         }
     }
 }
 cmtx_notify_admin_new_comment_okay($cmtx_name, $cmtx_comment, $cmtx_comment_id);
 //notify admin of new comment
 if (isset($_POST['cmtx_remember']) || !cmtx_setting('enabled_remember') && cmtx_setting('form_cookie')) {
     cmtx_set_form_cookie($cmtx_name, $cmtx_email, $cmtx_website, $cmtx_town, $cmtx_country);
     //save form inputs
     $cmtx_default_name = cmtx_strip_slashes(cmtx_decode($cmtx_name));
     $cmtx_default_email = cmtx_strip_slashes(cmtx_decode($cmtx_email));
     $cmtx_default_website = cmtx_strip_slashes(cmtx_decode($cmtx_website));
     $cmtx_default_town = cmtx_strip_slashes(cmtx_decode($cmtx_town));
     $cmtx_default_country = cmtx_strip_slashes(cmtx_decode($cmtx_country));
 }
 if (cmtx_session_set()) {
     //if there's a session
     $_SESSION['cmtx_resubmit_key'] = $_POST['cmtx_resubmit_key'];
     //add resubmit key to session
 }
 $cmtx_reply_id = 0;
 //reset the reply id
 if (cmtx_session_set()) {
     //if there's a session
     $_SESSION['cmtx_question'] = '';
     //reset session
     $_SESSION['cmtx_captcha'] = '';
     //reset session
 }
Example #3
0
function cmtx_akismet($name, $email, $website, $comment)
{
    //check Akismet test for spam
    global $cmtx_path;
    //globalise variables
    $name = cmtx_strip_slashes(cmtx_decode($name));
    $email = cmtx_strip_slashes(cmtx_decode($email));
    $website = cmtx_strip_slashes(cmtx_decode($website));
    if ($website == 'http://') {
        $website = '';
    }
    $comment = cmtx_strip_slashes(cmtx_decode($comment));
    if (!class_exists('Akismet')) {
        require_once $cmtx_path . 'includes/external/akismet/akismet.php';
        //load Akismet script
    }
    $WordPressAPIKey = cmtx_setting('akismet_key');
    //set API key
    $MyBlogURL = cmtx_setting('site_url');
    $akismet = new Akismet($MyBlogURL, $WordPressAPIKey);
    $akismet->setCommentAuthor($name);
    $akismet->setCommentAuthorEmail($email);
    $akismet->setCommentAuthorURL($website);
    $akismet->setCommentContent($comment);
    $akismet->setCommentType('comment');
    $akismet->setPermalink(cmtx_current_page());
    if ($akismet->isCommentSpam()) {
        return true;
    } else {
        return false;
    }
}