/** * This is the main handler for all of the processing */ function PostEmail($poster, $mimeDecodedEmail, $config) { postie_disable_revisions(); extract($config); /* in order to do attachments correctly, we need to associate the attachments with a post. So we add the post here, then update it */ $tmpPost = array('post_title' => 'tmptitle', 'post_content' => 'tmpPost'); $post_id = wp_insert_post($tmpPost); DebugEcho("new post id is {$post_id}"); $is_reply = false; $postmodifiers = new PostiePostModifiers(); $details = CreatePost($poster, $mimeDecodedEmail, $post_id, $is_reply, $config, $postmodifiers); $details = apply_filters('postie_post', $details); $details = apply_filters('postie_post_before', $details); DebugEcho("Post postie_post filter"); DebugDump($details); DebugEcho("Post modifiers"); DebugDump($postmodifiers); if (empty($details)) { // It is possible that the filter has removed the post, in which case, it should not be posted. // And if we created a placeholder post (because this was not a reply to an existing post), // then it should be removed if (!$is_reply) { wp_delete_post($post_id); EchoInfo("postie_post filter cleared the post, not saving."); } } else { DisplayEmailPost($details); PostToDB($details, $is_reply, $custom_image_field, $postmodifiers); if ($confirmation_email != '') { if ($confirmation_email == 'sender') { $recipients = array($details['email_author']); } elseif ($confirmation_email == 'admin') { $recipients = array(get_option("admin_email")); } elseif ($confirmation_email == 'both') { $recipients = array($details['email_author'], get_option("admin_email")); } MailToRecipients($mimeDecodedEmail, false, $recipients, false, false); } } postie_disable_revisions(true); DebugEcho("Done"); }
function process_file($test_file, $config) { $message = file_get_contents($test_file); $email = unserialize($message); $isreply = false; $mimeDecodedEmail = DecodeMIMEMail($email); $pm = new PostiePostModifiers(); $post = CreatePost('wayne', $mimeDecodedEmail, 1, $isreply, $config, $pm); return $post; }
<?php include 'models/database.php'; include 'models/posts.php'; include 'models/datetime.php'; if (isset($_POST['post'])) { $text = $_POST['post']; $now = datetime(); $userid = $_COOKIE['userid']; $topicid = $_GET['topicid']; $success = CreatePost($userid, $topicid, $text, $now); if ($success) { header('Location: posts.php?topicid=' . $topicid); } else { echo "error"; } }
echo "{$GID}&f=rep_group"; ?> " class="btn btn-danger btn-xs"><span class="glyphicon glyphicon-thumbs-down"></span> report</a></h1> <?php require_once "../../includes/breadcrumb.php"; ?> <div class="row row-offcanvas row-offcanvas-right"> <div class="col-xs-12 col-sm-9 col-md-10 col-lg-10"> <nav class="navbar navbar-default visible-xs"> <div class="container"> <button type="button" class="btn navbar-btn btn-primary"><span class="glyphicon glyphicon-chevron-left"></span> Go Back</button> <button type="button" class="btn navbar-btn btn-primary pull-right" data-toggle="offcanvas"><span class="glyphicon glyphicon-chevron-right"></span></button> </div> </nav> <?php CreatePost($GID, $USERID); add_group_user($GID); if (isset($_GET["f"]) && $_GET["f"] == "rep_group") { $query = "INSERT INTO report_group VALUES (NULL,{$GID},{$USERID})"; query($query); ?> <div class="alert alert-warning alert-dismissible fade in"> <button type="button" class="close" data-dismiss="alert">×</button> <span class="glyphicon glyphicon-exclamation-sign glyphicon-pad"></span> Group successfully reported! </div> <?php } ?> <div class="col-lg-12"><!--content--> <!--group pills--> <ul class="nav nav-pills">
?> <div class="container"> <h1 class="page-header"><span class="glyphicon glyphicon-home glyphicon-pad"></span> Home</h1> <?php require_once "../includes/breadcrumb.php"; ?> <div class="row row-offcanvas row-offcanvas-right"> <div class="col-xs-12 col-sm-9 col-md-10 col-lg-10"> <nav class="navbar navbar-default visible-xs"> <div class="container"> <button type="button" class="btn navbar-btn btn-primary"><span class="glyphicon glyphicon-chevron-left"></span> Go Back</button> <button type="button" class="btn navbar-btn btn-primary pull-right" data-toggle="offcanvas"><span class="glyphicon glyphicon-chevron-right"></span></button> </div> </nav> <?php CreatePost(0, $USERID); CreateGroup($USERID); ?> <div class="col-lg-12"><!--content--> <!--#posts starts--> <h2 class="xs-margin-bottom"><span class="glyphicon glyphicon-paperclip glyphicon-pad"></span> Posts</h2> <!--post pills--> <ul class="nav nav-pills"> <li class="active"><a href="#posts_recent" data-toggle="tab"><span class="glyphicon glyphicon-play visible-xs-inline-block"></span><span class="hidden-xs">Recent</span></a></li> <li><a href="#posts_trending" data-toggle="tab"><span class="glyphicon glyphicon-fire visible-xs-inline-block"></span><span class="hidden-xs">Trending</span></a></li> <li><a href="#posts_quirks" data-toggle="tab"><span class="glyphicon glyphicon-apple visible-xs-inline-block"></span><span class="hidden-xs">Quirks</span></a></li> <li><a href="#posts_ask" data-toggle="tab"><span class="glyphicon glyphicon-question-sign visible-xs-inline-block"></span><span class="hidden-xs">Ask</span></a></li> <li><a href="#posts_search" data-toggle="tab"><span class="glyphicon glyphicon-search visible-xs-inline-block"></span><span class="hidden-xs">Search</span></a></li> </ul><!--/.nav-tabs--> <!--pills data-->