/** * This is the main handler for all of the processing */ function PostEmail($poster, $mimeDecodedEmail) { $config = GetConfig(); $GLOBALS["POSTIE_IMAGE_ROTATION"] = 0; $attachments = array("html" => array(), "cids" => array(), "image_files" => array()); print "<p>Message Id is :" . $mimeDecodedEmail->headers["message-id"] . "</p><br/>\n"; print "<p>Email has following attachments:</p>"; foreach ($mimeDecodedEmail->parts as $parts) { print "<p>" . $parts->ctype_primary . " " . $parts->ctype_secondary . "</p><br />\n"; } FilterTextParts($mimeDecodedEmail); #print("<p>Email has following attachments after filtering:"); # foreach($mimeDecodedEmail->parts as $parts) { # print("<p>".$parts->ctype_primary ." ".$parts->ctype_secondary) ."<br />\n"; # } $content = GetContent($mimeDecodedEmail, $attachments); $subject = GetSubject($mimeDecodedEmail, $content); $rotation = GetRotation($mimeDecodedEmail, $content); if ($rotation != "0" && count($attachments["image_files"])) { RotateImages($rotation, $attachments["image_files"]); } SpecialMessageParsing($content, $attachments); $message_date = NULL; if (array_key_exists("date", $mimeDecodedEmail->headers) && !empty($mimeDecodedEmail->headers["date"])) { $message_date = HandleMessageEncoding($mimeDecodedEmail->headers["content-transfer-encoding"], $mimeDecodedEmail->ctype_parameters["charset"], $mimeDecodedEmail->headers["date"]); } list($post_date, $post_date_gmt) = DeterminePostDate($content, $message_date); ubb2HTML($content); $content = FilterNewLines($content); $post_categories = GetPostCategories($subject); $comment_status = AllowCommentsOnPost($content); $details = array('post_author' => $poster, 'post_date' => $post_date, 'post_date_gmt' => $post_date_gmt, 'post_content' => preg_replace("/'/", "\\'", $content), 'post_title' => preg_replace("/'/", "\\'", $subject), 'post_modified' => $post_date, 'post_modified_gmt' => $post_date_gmt, 'ping_status' => get_option('default_ping_status'), 'post_category' => $post_categories, 'comment_status' => $comment_status, 'post_name' => sanitize_title($subject), 'post_status' => 'publish'); DisplayEmailPost($details); PostToDB($details); }
/** * This is the main handler for all of the processing */ function PostEmail($poster, $mimeDecodedEmail) { $config = GetConfig(); $GLOBALS["POSTIE_IMAGE_ROTATION"] = 0; $attachments = array("html" => array(), "cids" => array(), "image_files" => array()); print "<p>Message Id is :" . $mimeDecodedEmail->headers["message-id"] . "</p><br/>\n"; print "<p>Email has following attachments:</p>"; foreach ($mimeDecodedEmail->parts as $parts) { print "<p>" . $parts->ctype_primary . " " . $parts->ctype_secondary . "</p><br />\n"; } FilterTextParts($mimeDecodedEmail); #print("<p>Email has following attachments after filtering:"); # foreach($mimeDecodedEmail->parts as $parts) { # print("<p>".$parts->ctype_primary ." ".$parts->ctype_secondary) ."<br />\n"; # } $content = GetContent($mimeDecodedEmail, $attachments); $subject = GetSubject($mimeDecodedEmail, $content); echo "the subject is {$subject}, right after calling GetSubject\n"; $rotation = GetRotation($mimeDecodedEmail, $content); if ($rotation != "0" && count($attachments["image_files"])) { RotateImages($rotation, $attachments["image_files"]); } SpecialMessageParsing($content, $attachments); $postAuthorDetails = getPostAuthorDetails($subject, $content, $mimeDecodedEmail); $message_date = NULL; if (array_key_exists("date", $mimeDecodedEmail->headers) && !empty($mimeDecodedEmail->headers["date"])) { HandleMessageEncoding($mimeDecodedEmail->headers["content-transfer-encoding"], $mimeDecodedEmail->ctype_parameters["charset"], $mimeDecodedEmail->headers["date"]); $message_date = $mimeDecodedEmail->headers['date']; } list($post_date, $post_date_gmt) = DeterminePostDate($content, $message_date); ubb2HTML($content); //$content = FilterNewLines($content); //$content = FixEmailQuotes($content); $id = checkReply($subject); $post_categories = GetPostCategories($subject); echo "the subject is {$subject}, right after calling GetPostCategories\n"; $comment_status = AllowCommentsOnPost($content); if ((empty($id) || is_null($id)) && $config['ADD_META'] == 'yes') { if ($config['WRAP_PRE'] == 'yes') { $content = $postAuthorDetails['content'] . "<pre>\n" . $content . "</pre>\n"; } else { $content = $postAuthorDetails['content'] . $content; } echo "id is empty\n"; } else { if ($config['WRAP_PRE'] == 'yes') { $content = "<pre>\n" . $content . "</pre>\n"; } } $details = array('post_author' => $poster, 'comment_author' => $postAuthorDetails['author'], 'email_author' => $postAuthorDetails['email'], 'post_date' => $post_date, 'post_date_gmt' => $post_date_gmt, 'post_content' => addslashes($content), 'post_title' => preg_replace("/'/", "\\'", $subject), 'post_modified' => $post_date, 'post_modified_gmt' => $post_date_gmt, 'ping_status' => get_option('default_ping_status'), 'post_category' => $post_categories, 'comment_status' => $comment_status, 'post_name' => sanitize_title($subject), 'ID' => $id, 'post_status' => 'publish'); DisplayEmailPost($details); PostToDB($details); }
function PostEmail($poster, $mimeDecodedEmail) { $config = GetConfig(); $GLOBALS["POSTIE_IMAGE_ROTATION"] = 0; $attachments = array("html" => array(), "cids" => array(), "image_files" => array()); print "<p>Message Id is :" . $mimeDecodedEmail->headers["message-id"] . "</p><br/>\n"; print "<p>Email has following attachments:</p>"; foreach ($mimeDecodedEmail->parts as $parts) { print "<p>" . $parts->ctype_primary . " " . $parts->ctype_secondary . "</p><br />\n"; } FilterTextParts($mimeDecodedEmail); #print("<p>Email has following attachments after filtering:"); # foreach($mimeDecodedEmail->parts as $parts) { # print("<p>".$parts->ctype_primary ." ".$parts->ctype_secondary) ."<br />\n"; # } $content = GetContent($mimeDecodedEmail, $attachments); //$content = $content; // replace emails and links that are identifiable BF-CHANGED $patterns[] = '/<a\\b[^>]*>.*?(ubscribe|eave|rofile|pdate|[Pp]references).*?<\\/a>/'; //remove unsubscribe stuff $patterns[] = '/<a\\b([^>]+)(ubscribe|eave|rofile|pdate|[Pp]references)([^>]+)>.*?<\\/a>/si'; //remove unsubscribe stuff $patterns[] = '/(http).*?(evite).*?(email)/'; //remove evite $patterns[] = '/(href=)?["\']?(http:\\S+www\\.evite\\.com)\\S+["\'\\b]/'; //evite $patterns[] = '/inviteId\\S+\\b/'; //evite $patterns[] = '/iid=\\S+\\b/'; //evite $patterns[] = '/No virus found in this outgoing message\\./'; //remove avg stuff $patterns[] = '/Checked by AVG\\./'; //remove avg stuff $patterns[] = '/Version.+?Virus.+?Release.+?AM/'; //remove avg stuff $patterns[] = '/No virus found in this incoming message\\./'; //remove avg stuff $patterns[] = '/<span\\b[^>]*>.*(_,_).*(_,_).*<\\/span>/si'; //remove yahoo stuff $content = preg_replace($patterns, '', $content); // end BF-CHANGED // $subject = GetSubject($mimeDecodedEmail, $content); $subject = $subject; //BF-CHANGED $rotation = GetRotation($mimeDecodedEmail, $content); if ($rotation != "0" && count($attachments["image_files"])) { RotateImages($rotation, $attachments["image_files"]); } SpecialMessageParsing($content, $attachments); $message_date = NULL; if (array_key_exists("date", $mimeDecodedEmail->headers) && !empty($mimeDecodedEmail->headers["date"])) { $message_date = HandleMessageEncoding($mimeDecodedEmail->headers["content-transfer-encoding"], $mimeDecodedEmail->ctype_parameters["charset"], $mimeDecodedEmail->headers["date"]); } list($post_date, $post_date_gmt) = DeterminePostDate($content, $message_date); ubb2HTML($content); $content = FilterNewLines($content); $post_categories = GetPostCategories($subject); $comment_status = AllowCommentsOnPost($content); if (PURIFIER == "on") { $purifier_ref =& $purifier; $content = addslashes(getpurified()->purify($content)); } else { $content = addslashes($content); } $details = array('post_author' => $poster, 'post_date' => $post_date, 'post_date_gmt' => $post_date_gmt, 'post_content' => $content, 'post_title' => addslashes($subject), 'post_modified' => $post_date, 'post_modified_gmt' => $post_date_gmt, 'ping_status' => get_option('default_ping_status'), 'post_category' => $post_categories, 'comment_status' => $comment_status, 'post_name' => sanitize_title($subject), 'post_status' => $config["POST_TYPE"], 'tags_input' => $config["DEFAULT_TAG"]); DisplayEmailPost($details, $config["AJAX_SELECT"]); if ($config["AJAX_SELECT"] == "0") { PostToDB($details); //print 'AJAX0'.$config["AJAX_SELECT"]; } }