Ejemplo n.º 1
0
/**
 * Handles verifing that a list of functions exists
 * @return boolean
 * @param array
 */
function HasFunctions($function_list, $display = true)
{
    foreach ($function_list as $function) {
        if (!function_exists($function)) {
            if ($display) {
                EchoInfo("Missing {$function}");
            }
            return false;
        }
    }
    return true;
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
            break;
        case "cronless":
            check_postie();
            $message = 1;
            break;
        case "test":
            include 'postie_test.php';
            exit;
            break;
        case "runpostie":
            EchoInfo("Checking for mail manually");
            include 'get_mail.php';
            exit;
            break;
        case "runpostie-debug":
            EchoInfo("Checking for mail manually with debug output");
            if (!defined('POSTIE_DEBUG')) {
                define('POSTIE_DEBUG', true);
            }
            include 'get_mail.php';
            exit;
            break;
        default:
            $message = 2;
            break;
    }
}
global $wpdb, $wp_roles;
$title = __('Postie Options', 'postie');
$parent_file = 'options-general.php';
$config = config_Read();
Ejemplo n.º 4
0
    default:
        require_once ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php';
        $pop3 = new POP3();
        if (defined('POSTIE_DEBUG')) {
            $pop3->DEBUG = POSTIE_DEBUG;
        }
        if (!$pop3->connect($config["mail_server"], $config["mail_server_port"])) {
            EchoInfo("Unable to connect. The server said:" . $pop3->ERROR);
        } else {
            EchoInfo("Sucessful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
            $msgs = $pop3->login($config["mail_userid"], $config["mail_password"]);
            if ($msgs === false) {
                //workaround for bug reported here Apr 12, 2013
                //https://sourceforge.net/tracker/?func=detail&atid=100311&aid=3610701&group_id=311
                //originally repoted here:
                //https://core.trac.wordpress.org/ticket/10587
                if (empty($pop3->ERROR)) {
                    EchoInfo("No waiting messages");
                } else {
                    EchoInfo("Unable to login. The server said:" . $pop3->ERROR);
                }
            } else {
                EchoInfo("# of waiting messages: {$msgs}");
            }
            $pop3->quit();
        }
        break;
}
?>
</div>
Ejemplo n.º 5
0
//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());
}
Ejemplo n.º 6
0
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());
    }
}
Ejemplo n.º 7
0
$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 e-mail processing:" . memory_get_usage());
}
Ejemplo n.º 8
0
global $wpdb, $wp_roles;
$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)) {
    EchoInfo(__("New setting: maxemails", "postie"));
    $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