/** * Handles disconnecting from the server */ function disconnect() { DebugEcho($this->_protocol . ": closing connection"); imap_close($this->_connection); $this->_connection = false; }
/** * Special Vodafone handler - their messages are mostly vendor trash - this strips them down. */ function filter_VodafoneHandler(&$content, &$attachments, $config) { if (preg_match('/You have been sent a message from Vodafone mobile/', $content)) { DebugEcho("Vodafone message"); $index = strpos($content, "TEXT:"); if (strpos !== false) { $alt_content = substr($content, $index, strlen($content)); if (preg_match("/<font face=\"verdana,helvetica,arial\" class=\"standard\" color=\"#999999\"><b>(.*)<\\/b>/", $alt_content, $matches)) { //The content is now just the text of the message $content = $matches[1]; //Now to clean up the attachments $vodafone_images = array("live.gif", "smiley.gif", "border_left_txt.gif", "border_top.gif", "border_bot.gif", "border_right.gif", "banner1.gif", "i_text.gif", "i_picture.gif"); while (list($key, $value) = each($attachments['cids'])) { if (!in_array($key, $vodafone_images)) { $content .= "<br/>" . $attachments['html'][$attachments['cids'][$key][1]]; } } } } } }
function tax_tag($post) { global $project; global $auteur; DebugEcho("step-02"); DebugEcho("project " . $project); DebugEcho("auteur " . $auteur); /* $projectField = array( 'projets' => array( $project ) ); $post['tax_input'] = $projectField; */ if (strlen($project) > 0) { $project = str_replace("-", " ", $project); EchoInfo("Ajout au post " . $post['ID']); EchoInfo("Du projet " . $project); EchoInfo("##" . $project . "##"); error_log("le terme existe t'il ? " . term_exists($project, 'projets')); $term = term_exists($project, 'projets'); if ($term === 0 || $term === null) { addTermAndCreateDescription($project, $auteur, true); } wp_set_object_terms($post['ID'], array($project), 'projets'); DebugEcho("Vérification du post ---"); DebugEcho($post); } if (strlen($auteur) > 0) { EchoInfo("Ajout au post " . $post['ID']); EchoInfo("De l'auteur " . $auteur); EchoInfo("--" . $auteur . "--"); wp_set_object_terms($post['ID'], array($auteur), 'auteur'); DebugEcho("Vérification du post ---"); DebugEcho($post); } return $post; }
$parent_file = 'options-general.php'; $config = config_Read(); if (empty($config)) { $config = config_ResetToDefault(); } $arrays = config_ArrayedSettings(); // some fields are stored as arrays, because that makes back-end processing much easier // and we need to convert those fields to strings here, for the options form foreach ($arrays as $sep => $fields) { foreach ($fields as $field) { $config[$field] = implode($sep, $config[$field]); } } extract($config); if (!isset($maxemails)) { DebugEcho("New setting: maxemails"); $maxemails = 0; } if (!isset($category_match)) { $category_match = true; } if ($interval == 'manual') { wp_clear_scheduled_hook('check_postie_hook'); } $messages[1] = __("Configuration successfully updated!", 'postie'); $messages[2] = __("Error - unable to save configuration", 'postie'); ?> <?php if (isset($_GET['message'])) { ?> <div class="updated"><p><?php
<h2>Clock Tests</h2> <p>This shows what time it would be if you posted right now</p> <?php $content = ""; $data = filter_Delay($content); EchoInfo("GMT: {$data['1']}"); EchoInfo("Current: {$data['0']}"); ?> <h2>Connect to Mail Host</h2> <?php if (!$mail_server || !$mail_server_port || !$mail_userid) { EchoInfo("NO - check server settings"); } else { DebugEcho("checking"); } switch (strtolower($config["input_protocol"])) { case 'imap': case 'imap-ssl': case 'pop3-ssl': if (!HasIMAPSupport()) { EchoInfo("Sorry - you do not have IMAP php module installed - it is required for this mail setting."); } else { require_once "postieIMAP.php"; $mail_server =& PostieIMAP::Factory($config["input_protocol"]); if ($email_tls) { $mail_server->TLSOn(); } if (!$mail_server->connect($config["mail_server"], $config["mail_server_port"], $config["mail_userid"], $config["mail_password"])) { EchoInfo("Unable to connect. The server said:");
//loop through messages $message_number = 0; foreach ($emails as $email) { $message_number++; DebugEcho("{$message_number}: ------------------------------------"); //sanity check to see if there is any info in the message if ($email == NULL) { $message = __('Dang, message is empty!', 'postie'); EchoInfo("{$message_number}: {$message}"); continue; } else { if ($email == 'already read') { $message = __("Message is already marked 'read'.", 'postie'); EchoInfo("{$message_number}: {$message}"); continue; } } $mimeDecodedEmail = DecodeMIMEMail($email, true); DebugEmailOutput($email, $mimeDecodedEmail); //Check poster to see if a valid person $poster = ValidatePoster($mimeDecodedEmail, $config); if (!empty($poster)) { PostEmail($poster, $mimeDecodedEmail, $config); } else { EchoInfo("Ignoring email - not authorized."); } flush(); } if (function_exists('memory_get_usage')) { DebugEcho("memory at end of e-mail processing:" . memory_get_usage()); }
function HandleError($errno, $errstr, $errfile, $errline, $errcontext) { global $err; DebugEcho("*** Error: " . $errstr); $err = TRUE; return FALSE; }
function postie_get_mail() { require_once plugin_dir_path(__FILE__) . 'mimedecode.php'; if (!function_exists('file_get_html')) { require_once plugin_dir_path(__FILE__) . 'simple_html_dom.php'; } EchoInfo("Starting mail fetch"); postie_environment(); $wp_content_path = dirname(dirname(dirname(__FILE__))); DebugEcho("wp_content_path: {$wp_content_path}"); if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php")) { DebugEcho("found filterPostie.php in {$wp_content_path}"); include_once $wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php"; } if (has_filter('postie_post')) { echo "Postie: filter 'postie_post' is depricated in favor of 'postie_post_before'"; } $test_email = null; $config = config_Read(); //extract($config); if (!array_key_exists('maxemails', $config)) { $config['maxemails'] = 0; } $emails = FetchMail($config['mail_server'], $config['mail_server_port'], $config['mail_userid'], $config['mail_password'], $config['input_protocol'], $config['time_offset'], $test_email, $config['delete_mail_after_processing'], $config['maxemails'], $config['email_tls']); $message = 'Done.'; EchoInfo(sprintf(__("There are %d messages to process", "postie"), count($emails))); if (function_exists('memory_get_usage')) { DebugEcho(__("memory at start of email processing:") . memory_get_usage()); } DebugDump($config); //loop through messages $message_number = 0; foreach ($emails as $email) { $message_number++; DebugEcho("{$message_number}: ------------------------------------"); //sanity check to see if there is any info in the message if ($email == NULL) { $message = __('Dang, message is empty!', 'postie'); EchoInfo("{$message_number}: {$message}"); continue; } else { if ($email == 'already read') { $message = __("Message is already marked 'read'.", 'postie'); EchoInfo("{$message_number}: {$message}"); continue; } } $mimeDecodedEmail = DecodeMIMEMail($email); DebugEmailOutput($email, $mimeDecodedEmail); //Check poster to see if a valid person $poster = ValidatePoster($mimeDecodedEmail, $config); if (!empty($poster)) { PostEmail($poster, $mimeDecodedEmail, $config); } else { EchoInfo("Ignoring email - not authorized."); } flush(); } EchoInfo("Mail fetch complete, {$message_number} emails"); if (function_exists('memory_get_usage')) { DebugEcho("memory at end of email processing:" . memory_get_usage()); } }
/** * Handles disconnecting from the server */ function disconnect() { DebugEcho("IMAP: closing connection"); imap_close($this->_connection); $this->_connection = false; }