Exemplo n.º 1
0
 /**
  * Reverts headers to previous state after use of apply_once() & disable_once()
  */
 static function _reset()
 {
     if (!empty(self::$tmp)) {
         self::$args = self::$tmp;
         self::$tmp = array();
     } elseif (self::$tmp === false) {
         self::$args = array();
         self::$tmp = array();
         self::remove();
     } else {
         self::add();
     }
     remove_action('phpmailer_init', array(__CLASS__, '_reset'));
 }
Exemplo n.º 2
0
function cp_contact_ad_owner_email2($post_id, $files)
{
    $errors = new WP_Error();
    // check for required post data
    $expected = array('from_name', 'from_email', 'subject', 'message');
    foreach ($expected as $field_name) {
        if (empty($_POST[$field_name])) {
            $errors->add('empty_field', __('ERROR: All fields are required.', APP_TD));
            return $errors;
        }
    }
    // check for required anti-spam post data
    $expected_numbers = array('rand_total', 'rand_num', 'rand_num2');
    foreach ($expected_numbers as $field_name) {
        if (!isset($_POST[$field_name]) || !is_numeric($_POST[$field_name])) {
            $errors->add('invalid_captcha', __('ERROR: Incorrect captcha answer.', APP_TD));
            return $errors;
        }
    }
    // verify captcha answer
    $rand_post_total = (int) $_POST['rand_total'];
    $rand_total = (int) $_POST['rand_num'] + (int) $_POST['rand_num2'];
    if ($rand_total != $rand_post_total) {
        $errors->add('invalid_captcha', __('ERROR: Incorrect captcha answer.', APP_TD));
    }
    // verify email
    if (!is_email($_POST['from_email'])) {
        $errors->add('invalid_email', __('ERROR: Incorrect email address.', APP_TD));
    }
    // verify post
    $post = get_post($post_id);
    if (!$post) {
        $errors->add('invalid_post', __('ERROR: Ad does not exist.', APP_TD));
    }
    if ($errors->get_error_code()) {
        return $errors;
    }
    $mailto = get_the_author_meta('user_email', $post->post_author);
    $from_name = appthemes_filter(appthemes_clean($_POST['from_name']));
    $from_email = appthemes_clean($_POST['from_email']);
    $subject = appthemes_filter(appthemes_clean($_POST['subject']));
    $posted_message = appthemes_filter(appthemes_clean($_POST['message']));
    $sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
    $siteurl = home_url('/');
    $permalink = get_permalink($post_id);
    $message = sprintf(__('Someone is interested in your ad listing: %s', APP_TD), $permalink) . "\r\n\r\n";
    $message .= '"' . wordwrap($posted_message, 70) . '"' . "\r\n\r\n";
    $message .= sprintf(__('Name: %s', APP_TD), $from_name) . "\r\n";
    $message .= sprintf(__('E-mail: %s', APP_TD), $from_email) . "\r\n\r\n";
    $message .= '-----------------------------------------' . "\r\n";
    $message .= sprintf(__('This message was sent from %s', APP_TD), $sitename) . "\r\n";
    $message .= $siteurl . "\r\n\r\n";
    $message .= __('Sent from IP Address: ', APP_TD) . appthemes_get_ip() . "\r\n\r\n";
    $email = array('to' => $mailto, 'subject' => $subject, 'message' => $message, 'from' => $from_email, 'from_name' => $from_name);
    $email = apply_filters('cp_email_user_ad_contact', $email, $post_id);
    APP_Mail_From::apply_once(array('email' => $email['from'], 'name' => $email['from_name'], 'reply' => true));
    $resumes = explode(',', $files[0]);
    $attachments = array();
    foreach ($resumes as $resume) {
        array_push($attachments, WP_CONTENT_DIR . '/themes/classiclean/server/files/' . $resume);
    }
    wp_mail($email['to'], $email['subject'], $email['message'], null, $attachments);
    return $errors;
}
Exemplo n.º 3
0
function cp_new_user_notification($user_id, $plaintext_pass = '')
{
    global $cp_options;
    $user = new WP_User($user_id);
    $user_login = stripslashes($user->user_login);
    $user_email = stripslashes($user->user_email);
    // variables that can be used by admin to dynamically fill in email content
    $find = array('/%username%/i', '/%password%/i', '/%blogname%/i', '/%siteurl%/i', '/%loginurl%/i', '/%useremail%/i');
    $replace = array($user_login, $plaintext_pass, get_option('blogname'), home_url('/'), wp_login_url(), $user_email);
    // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    // we want to reverse this for the plain text arena of emails.
    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    // send the site admin an email everytime a new user registers
    if ($cp_options->nu_admin_email) {
        $subject = sprintf(__('[%s] New User Registration', APP_TD), $blogname);
        $message = sprintf(__('New user registration on your site %s:', APP_TD), $blogname) . "\r\n\r\n";
        $message .= sprintf(__('Username: %s', APP_TD), $user_login) . "\r\n\r\n";
        $message .= sprintf(__('E-mail: %s', APP_TD), $user_email) . "\r\n";
        $email = array('to' => get_option('admin_email'), 'subject' => $subject, 'message' => $message);
        $email = apply_filters('cp_email_admin_new_user', $email, $user_id, $plaintext_pass);
        wp_mail($email['to'], $email['subject'], $email['message']);
    }
    if (empty($plaintext_pass)) {
        return;
    }
    // check and see if the custom email option has been enabled
    // if so, send out the custom email instead of the default WP one
    if ($cp_options->nu_custom_email) {
        // email sent to new user starts here
        $from_name = strip_tags($cp_options->nu_from_name);
        $from_email = strip_tags($cp_options->nu_from_email);
        // search and replace any user added variable fields in the subject line
        $subject = stripslashes($cp_options->nu_email_subject);
        $subject = preg_replace($find, $replace, $subject);
        $subject = preg_replace("/%.*%/", "", $subject);
        // search and replace any user added variable fields in the body
        $message = stripslashes($cp_options->nu_email_body);
        $message = preg_replace($find, $replace, $message);
        $message = preg_replace("/%.*%/", "", $message);
        $email = array('to' => $user_email, 'subject' => $subject, 'message' => $message, 'from' => $from_email, 'from_name' => $from_name);
        $email = apply_filters('cp_email_user_new_user_custom', $email, $user_id, $plaintext_pass);
        APP_Mail_From::apply_once(array('email' => $email['from'], 'name' => $email['from_name']));
        if ($cp_options->nu_email_type == 'text/plain') {
            wp_mail($email['to'], $email['subject'], $email['message']);
        } else {
            appthemes_send_email($email['to'], $email['subject'], $email['message']);
        }
        // send the default email to debug
    } else {
        $subject = sprintf(__('[%s] Your username and password', APP_TD), $blogname);
        $message = sprintf(__('Username: %s', APP_TD), $user_login) . "\r\n";
        $message .= sprintf(__('Password: %s', APP_TD), $plaintext_pass) . "\r\n";
        $message .= wp_login_url() . "\r\n";
        $email = array('to' => $user_email, 'subject' => $subject, 'message' => $message);
        $email = apply_filters('cp_email_user_new_user', $email, $user_id, $plaintext_pass);
        wp_mail($email['to'], $email['subject'], $email['message']);
    }
}
Exemplo n.º 4
0
define('CP_PACKAGE_LISTING_PTYPE', 'package-listing');
define('CP_PACKAGE_MEMBERSHIP_PTYPE', 'package-membership');
define('APP_TD', 'classipress');
global $cp_options;
// Legacy variables - some plugins rely on them
$app_theme = 'ClassiPress';
$app_abbr = 'cp';
$app_version = CP_VERSION;
$app_db_version = 2221;
$app_edition = 'Ultimate Edition';
// Framework
require_once dirname(__FILE__) . '/framework/load.php';
require_once APP_FRAMEWORK_DIR . '/includes/stats.php';
require_once APP_FRAMEWORK_DIR . '/admin/class-meta-box.php';
require_once APP_FRAMEWORK_DIR . '/includes/tables.php';
APP_Mail_From::init();
// define the transients we use
$app_transients = array('cp_cat_menu');
// define the db tables we use
$app_db_tables = array('cp_ad_fields', 'cp_ad_forms', 'cp_ad_geocodes', 'cp_ad_meta', 'cp_ad_packs', 'cp_ad_pop_daily', 'cp_ad_pop_total', 'cp_coupons', 'cp_order_info');
// register the db tables
foreach ($app_db_tables as $app_db_table) {
    scb_register_table($app_db_table);
}
scb_register_table('app_pop_daily', 'cp_ad_pop_daily');
scb_register_table('app_pop_total', 'cp_ad_pop_total');
$load_files = array('checkout/load.php', 'payments/load.php', 'reports/load.php', 'widgets/load.php', 'admin/addons-mp/load.php', 'options.php', 'appthemes-functions.php', 'actions.php', 'categories.php', 'comments.php', 'core.php', 'cron.php', 'custom-forms.php', 'deprecated.php', 'enqueue.php', 'emails.php', 'functions.php', 'hooks.php', 'images.php', 'packages.php', 'payments.php', 'profile.php', 'search.php', 'security.php', 'stats.php', 'views.php', 'views-checkout.php', 'widgets.php', 'theme-support.php', 'customizer.php', 'utils.php', 'checkout/form-progress/load.php');
appthemes_load_files(dirname(__FILE__) . '/includes/', $load_files);
$load_classes = array('CP_Blog_Archive', 'CP_Posts_Tag_Archive', 'CP_Post_Single', 'CP_Author_Archive', 'CP_Ads_Tag_Archive', 'CP_Ads_Archive', 'CP_Ads_Home', 'CP_Ads_Categories', 'CP_Add_New', 'CP_Renew_Listing', 'CP_Ad_Single', 'CP_Edit_Item', 'CP_Membership', 'CP_User_Dashboard', 'CP_User_Dashboard_Orders', 'CP_User_Profile', 'CP_Order', 'CP_Membership_Form_Select', 'CP_Membership_Form_Preview', 'CP_Listing_Form_Select_Category', 'CP_Listing_Form_Edit', 'CP_Listing_Form_Details', 'CP_Listing_Form_Preview', 'CP_Listing_Form_Submit_Free', 'CP_Gateway_Select', 'CP_Gateway_Process', 'CP_Order_Summary', 'CP_Widget_125_Ads', 'CP_Widget_Ad_Categories', 'CP_Widget_Ad_Sub_Categories', 'CP_Widget_Ads_Tag_Cloud', 'CP_Widget_Blog_Posts', 'CP_Widget_Facebook', 'CP_Widget_Featured_Ads', 'CP_Widget_Search', 'CP_Widget_Sold_Ads', 'CP_Widget_Top_Ads_Today', 'CP_Widget_Top_Ads_Overall');
appthemes_add_instance($load_classes);
// Admin only
Exemplo n.º 5
0
 /**
  * Checks if args are valid and exists
  *
  * @return bool
  */
 static function _is_valid()
 {
     $args = array('name', 'email', 'reply');
     foreach ($args as $arg) {
         if (!isset(self::$args[$arg])) {
             return false;
         }
     }
     if (!is_email(self::$args['email'])) {
         return false;
     }
     // check if email provider is not blacklisted, if so, use default WP email address
     if (self::is_on_blacklist(self::$args['email'])) {
         self::$blacklisted_email = self::$args['email'];
         self::$args['email'] = self::get_default_email();
     }
     if (empty(self::$args['name'])) {
         return false;
     }
     return true;
 }