/** * Determines if the sender is a valid user. * @return integer|NULL */ function ValidatePoster(&$mimeDecodedEmail, $config) { global $wpdb; $poster = NULL; $from = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["from"])); $resentFrom = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["resent-from"])); /* if ( empty($from) ) { echo 'Invalid Sender - Emtpy! '; return; } */ //See if the email address is one of the special authorized ones print "Confirming Access For {$from} \n"; $sql = 'SELECT id FROM ' . $wpdb->users . ' WHERE user_email=\'' . addslashes($from) . "' LIMIT 1;"; $user_ID = $wpdb->get_var($sql); $user = new WP_User($user_ID); if ($config["TURN_AUTHORIZATION_OFF"] || CheckEmailAddress($from, $config['AUTHORIZED_ADDRESSES']) || CheckEmailAddress($resentFrom, $config['AUTHORIZED_ADDRESSES'])) { if (empty($user_ID)) { print "{$from} is authorized to post as the administrator\n"; $from = get_option("admin_email"); $adminUser = $config['ADMIN_USERNAME']; echo "adminUser='******'"; $poster = $wpdb->get_var("SELECT ID FROM {$wpdb->users} WHERE\n user_login = '******'"); } else { $poster = $user_ID; } } else { if ($user->has_cap("post_via_postie")) { $poster = $user_ID; } } $validSMTP = checkSMTP($mimeDecodedEmail, $config['SMTP']); if (!$poster || !$validSMTP) { echo 'Invalid sender: ' . htmlentities($from) . "! Not adding email!\n"; if ($config["FORWARD_REJECTED_MAIL"]) { if (MailToRecipients($mimeDecodedEmail, $config['TEST_EMAIL'], array(), $config['RETURN_TO_SENDER'])) { echo "A copy of the message has been forwarded to the administrator.\n"; } else { echo "The message was unable to be forwarded to the adminstrator.\n"; } } return; } return $poster; }
$welcome_mail_subject = $_POST['welcome_mail_subject']; $welcome_mail = $_POST['welcome_mail']; $validation_mail_subject = $_POST['validation_mail_subject']; $validation_mail = $_POST['validation_mail']; $reset_mail_subject = $_POST['reset_mail_subject']; $reset_mail = $_POST['reset_mail']; // If mail type is SMTP, check if everything required is filled in if ($mailtype == "smtp" && empty($smtp_hostname)) { echo "<div class='alert alert-danger' role='alert'><a href='#' class='close' data-dismiss='alert'>×</a>" . $m['fill_in_smtp_hostname'] . "</div>"; } elseif ($mailtype == "smtp" && empty($smtp_username)) { echo "<div class='alert alert-danger' role='alert'><a href='#' class='close' data-dismiss='alert'>×</a>" . $m['fill_in_smtp_username'] . "</div>"; } elseif ($mailtype == "smtp" && empty($smtp_password)) { echo "<div class='alert alert-danger' role='alert'><a href='#' class='close' data-dismiss='alert'>×</a>" . $m['fill_in_smtp_password'] . "</div>"; } elseif ($mailtype == "smtp" && empty($smtp_port)) { echo "<div class='alert alert-danger' role='alert'><a href='#' class='close' data-dismiss='alert'>×</a>" . $m['fill_in_smtp_port'] . "</div>"; } elseif ($mailtype == "smtp" && !checkSMTP($smtp_hostname, $smtp_username, $smtp_password, $smtp_port, $smtp_ssl)) { echo "<div class='alert alert-danger' role='alert'><a href='#' class='close' data-dismiss='alert'>×</a>" . $m['smtp_connect_failed'] . "</div>"; } else { $settings = array("mailtype" => $mailtype, "smtp_hostname" => $smtp_hostname, "smtp_username" => $smtp_username, "smtp_password" => $smtp_password, "smtp_port" => $smtp_port, "smtp_ssl" => $smtp_ssl, "welcome_mail_subject" => $welcome_mail_subject, "welcome_mail" => $welcome_mail, "validation_mail_subject" => $validation_mail_subject, "validation_mail" => $validation_mail, "reset_mail_subject" => $reset_mail_subject, "reset_mail" => $reset_mail); // Update settings foreach ($settings as $setting => $value) { setting($setting, $value); } echo "<div class='alert alert-success' role='alert'><a href='#' class='close' data-dismiss='alert'>×</a>" . $m['settings_saved'] . "</div>"; } } // Save main settings if (!empty($_POST['main_settings']) && is_logged_in() && is_admin()) { $page_disabled_message = $_POST['page_disabled_message']; $default_permission = $_POST['default_permission']; $login_with = $_POST['login_with'];
/** * Determines if the sender is a valid user. * @return integer|NULL */ function ValidatePoster(&$mimeDecodedEmail, $config) { extract($config); global $wpdb; $poster = NULL; $from = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["from"])); $resentFrom = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["resent-from"])); /* if ( empty($from) ) { echo 'Invalid Sender - Emtpy! '; return; } */ //See if the email address is one of the special authorized ones print "Confirming Access For {$from} \n"; $sql = 'SELECT id FROM ' . $wpdb->users . ' WHERE user_email=\'' . addslashes($from) . "' LIMIT 1;"; $user_ID = $wpdb->get_var($sql); if (!empty($user_ID)) { $user = new WP_User($user_ID); if ($user->has_cap("post_via_postie")) { $poster = $user_ID; echo "posting as user {$poster}"; } else { $poster = $wpdb->get_var("SELECT ID FROM {$wpdb->users} WHERE\n user_login = '******'"); } } elseif ($turn_authorization_off || CheckEmailAddress($from, $authorized_addresses) || CheckEmailAddress($resentFrom, $authorized_addresses)) { $poster = $wpdb->get_var("SELECT ID FROM {$wpdb->users} WHERE\n user_login = '******'"); } $validSMTP = checkSMTP($mimeDecodedEmail, $smtp); if (!$poster || !$validSMTP) { echo 'Invalid sender: ' . htmlentities($from) . "! Not adding email!\n"; if ($forward_rejected_mail) { $admin_email = get_option("admin_email"); if (MailToRecipients($mimeDecodedEmail, $test_email, array($admin_email), $return_to_sender)) { echo "A copy of the message has been forwarded to the administrator.\n"; } else { echo "The message was unable to be forwarded to the adminstrator.\n"; } } return; } return $poster; }
function drawServerStatus() { global $errTxt; if (checkPOP3()) { $pop3_status = '<font color="#00FF00">' . _("Running ok") . '</font>'; } else { $pop3_status = '<font color="#FF0000">' . _("ERROR!") . $errTxt . '</font>'; } if (checkSMTP()) { $smtp_status = '<font color="#00FF00">' . _("Running ok") . '</font>'; } else { $smtp_status = '<font color="#FF0000">' . _("ERROR!") . $errTxt . '</font>'; } if (checkDNS()) { $dns_status = '<font color="#00FF00">' . _("Running ok") . '</font>'; } else { $dns_status = '<font color="#FF0000">' . _("ERROR!") . $errTxt . '</font>'; } if (checkFTP()) { $ftp_status = '<font color="#00FF00">' . _("Running ok") . '</font>'; } else { $ftp_status = '<font color="#FF0000">' . _("ERROR!") . $errTxt . '</font>'; } $out = "<br><table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" height=\"1\">\n<tr>\n\t<td width=\"25%\" align=\"center\"><font color=\"#FFFFFF\">SMTP</font></td>\n\t<td width=\"25%\" align=\"center\"><font color=\"#FFFFFF\">POP3</font></td>\n\t<td width=\"25%\" align=\"center\"><font color=\"#FFFFFF\">DNS</font></td>\n\t<td width=\"25%\" align=\"center\"><font color=\"#FFFFFF\">FTP</font></td>\n</tr><tr>\n\t<td align=\"center\">{$smtp_status}</td>\n\t<td align=\"center\">{$pop3_status}</td>\n\t<td align=\"center\">{$dns_status}</td>\n\t<td align=\"center\">{$ftp_status}</td>\n</tr></table>"; return $out; }