Пример #1
0
function JB_generate_candidate_q_string()
{
    if ($_REQUEST['action'] == 'search') {
        $q_aday = JB_html_ent_to_utf8($_REQUEST['q_aday']);
        $q_amon = JB_html_ent_to_utf8($_REQUEST['q_amon']);
        $q_ayear = JB_html_ent_to_utf8($_REQUEST['q_ayear']);
        $q_name = JB_html_ent_to_utf8($_REQUEST['q_name']);
        $q_username = JB_html_ent_to_utf8($_REQUEST['q_username']);
        $q_resumes = JB_html_ent_to_utf8($_REQUEST['q_resumes']);
        $q_news = JB_html_ent_to_utf8($_REQUEST['q_news']);
        $q_email = JB_html_ent_to_utf8($_REQUEST['q_email']);
        if (isset($_REQUEST['show'])) {
            $show = '&show=' . $_REQUEST['show'];
        }
        $q_string = htmlentities("&action=search&q_name=" . urlencode($q_name) . "&q_username="******"&q_news=" . urlencode($q_news) . "&q_resumes=" . urlencode($q_resumes) . "&q_email=" . urlencode($q_email) . "&q_aday=" . urlencode($q_aday) . "&q_amon=" . urlencode($q_amon) . "&q_ayear=" . urlencode($q_ayear) . $show);
    }
    JBPLUG_do_callback('generate_can_q_string', $q_string);
    return $q_string;
}
Пример #2
0
function JB_generate_emp_q_string()
{
    if ($_REQUEST['action'] == 'search') {
        $q_aday = urlencode(JB_html_ent_to_utf8($_REQUEST['q_aday']));
        $q_amon = urlencode(JB_html_ent_to_utf8($_REQUEST['q_amon']));
        $q_ayear = urlencode(JB_html_ent_to_utf8($_REQUEST['q_ayear']));
        $q_name = urlencode(JB_html_ent_to_utf8($_REQUEST['q_name']));
        $q_username = urlencode(JB_html_ent_to_utf8($_REQUEST['q_username']));
        $q_resumes = urlencode(JB_html_ent_to_utf8($_REQUEST['q_resumes']));
        $q_news = urlencode(JB_html_ent_to_utf8($_REQUEST['q_news']));
        $q_email = urlencode(JB_html_ent_to_utf8($_REQUEST['q_email']));
        $q_company = urlencode(JB_html_ent_to_utf8($_REQUEST['q_company']));
        if (isset($_REQUEST['show'])) {
            $show = '&show=' . urlencode($_REQUEST['show']);
        }
        $q_string = htmlentities('&action=search&q_name=' . $q_name . '&q_username='******'&q_news=' . $q_news . '&q_resumes=' . $q_resumes . '&q_email=' . $q_email . '&q_aday=' . $q_aday . '&q_amon=' . $q_amon . '&q_ayear=' . $q_ayear . '&q_company=' . $q_company . $show);
    }
    JBPLUG_do_callback('generate_emp_q_string', $q_string);
    return $q_string;
}
Пример #3
0
 function generate_q_string()
 {
     if ($_REQUEST['action'] == false) {
         // no search executed
         return false;
     }
     $this->q_string = "&action=search";
     foreach ($this->tag_to_search as $key => $val) {
         $field_id = $val['field_id'];
         if (is_array($_REQUEST[$field_id])) {
             // multiple selected fields, checkboxes
             $arr_str = '';
             foreach ($_REQUEST[$field_id] as $elem) {
                 $arr_str .= '&' . $field_id . urlencode('[]') . '=' . urlencode($elem);
             }
             $this->q_string .= $arr_str;
         } elseif ($val['field_type'] == 'DATE') {
             if ($_REQUEST[$field_id . 'd'] != '') {
                 $this->q_string .= '&' . $field_id . 'd=' . urlencode($_REQUEST[$field_id] . 'd');
             }
             if ($_REQUEST[$field_id . 'm'] != '') {
                 $this->q_string .= '&' . $field_id . 'm=' . urlencode($_REQUEST[$field_id] . 'm');
             }
             if ($_REQUEST[$field_id . 'y'] != '') {
                 $this->q_string .= '&' . $field_id . 'y=' . urlencode($_REQUEST[$field_id] . 'y');
             }
         } elseif ($_REQUEST[$field_id] != '') {
             // fields such as text fields
             $this->q_string .= "&" . $field_id . "=" . urlencode(JB_html_ent_to_utf8($_REQUEST[$field_id]));
         }
     }
     JBPLUG_do_callback('generate_q_string', $this->q_string, $this->form_id);
     $this->q_string = htmlentities($this->q_string);
     return $this->q_string;
 }
Пример #4
0
function JB_send_email($mail_row)
{
    $to_name = JB_html_ent_to_utf8($mail_row['to_name']);
    $to_address = $mail_row['to_address'];
    $from_name = JB_html_ent_to_utf8($mail_row['from_name']);
    $from_address = $mail_row['from_address'];
    $subject = JB_html_ent_to_utf8($mail_row['subject']);
    $message = JB_html_ent_to_utf8($mail_row['message']);
    $html_message = JB_html_ent_to_utf8($mail_row['html_message']);
    if (JB_USE_MAIL_FUNCTION == 'YES') {
        $email_message = new email_message_class();
        if (JB_EMAIL_DEBUG_SWITCH == 'YES') {
            echo 'Email Debug: Using the mail() function...<br>';
        }
    } else {
        // use SMTP
        $dir = JB_basedirpath();
        if (!class_exists("sasl_client_class")) {
            require_once $dir . "include/lib/mail/sasl/sasl.php";
        }
        $email_message = new smtp_message_class();
        $email_message->localhost = JB_EMAIL_HOSTNAME;
        $email_message->smtp_host = JB_EMAIL_SMTP_SERVER;
        $email_message->smtp_direct_delivery = 0;
        $email_message->smtp_exclude_address = "";
        $email_message->smtp_user = JB_EMAIL_SMTP_USER;
        $email_message->smtp_realm = "";
        $email_message->smtp_password = JB_EMAIL_SMTP_PASS;
        if (defined('JB_EMAIL_SMTP_PORT')) {
            if (!is_numeric(JB_EMAIL_SMTP_PORT)) {
                $email_message->smtp_port = 25;
            } else {
                $email_message->smtp_port = JB_EMAIL_SMTP_PORT;
            }
        }
        $email_message->authentication_mechanism = 'USER';
        // SASL authentication
        if (JB_EMAIL_SMTP_SSL == 'YES') {
            $email_message->smtp_ssl = 1;
        } else {
            $email_message->smtp_ssl = 0;
        }
        if (JB_EMAIL_POP_BEFORE_SMTP == 'YES') {
            $email_message->smtp_pop3_auth_host = JB_EMAIL_SMTP_AUTH_HOST;
        } else {
            $email_message->smtp_pop3_auth_host = "";
        }
        if (JB_EMAIL_DEBUG_SWITCH == 'YES') {
            $email_message->smtp_debug = 1;
        } else {
            $email_message->smtp_debug = 0;
        }
        $email_message->smtp_html_debug = 0;
        if (JB_EMAIL_DEBUG_SWITCH == 'YES') {
            echo 'Email Debug: using SMTP server...<br>';
        }
    }
    $reply_address = $mail_row['from_address'];
    $error_delivery_name = JB_SITE_NAME;
    $error_delivery_address = JB_SITE_CONTACT_EMAIL;
    JBPLUG_do_callback('set_error_delivery_name', $error_delivery_name);
    // added in 3.6
    JBPLUG_do_callback('set_error_delivery_address', $error_delivery_address);
    // added in 3.6
    $email_message->default_charset = 'UTF-8';
    $email_message->SetEncodedEmailHeader("To", $to_address, $to_name);
    $email_message->SetEncodedEmailHeader("From", $from_address, $from_name);
    $email_message->SetEncodedEmailHeader("Reply-To", $reply_address, $reply_name);
    /*
    	Set the Return-Path header to define the envelope sender address to which bounced messages are delivered.
    	If you are using Windows, you need to use the smtp_message_class to set the return-path address.
    */
    // Cannot set in safe-mode or under Windows...
    if (function_exists("ini_get") && !ini_get("safe_mode") && strpos(strtoupper(PHP_OS), 'WIN') === false) {
        $email_message->SetHeader("Return-Path", $error_delivery_address);
    }
    if (strpos(strtoupper(PHP_OS), 'WIN') !== false) {
        // windows
        ini_set('sendmail_from', JB_SITE_CONTACT_EMAIL);
    }
    //}
    if ($mail_row['template_id'] == 5 || $mail_row['template_id'] == 6 || $mail_row['template_id'] == 7 || $mail_row['template_id'] == 8 || $mail_row['template_id'] == 30) {
        // job alerts, resume alerts, newsletter are bulk mails
        $email_message->SetHeader("Precedence", 'bulk');
    }
    $email_message->SetEncodedEmailHeader("Errors-To", $error_delivery_address, $error_delivery_name);
    $email_message->SetEncodedHeader("Subject", $subject);
    if ($html_message == '') {
        // ONLY TEXT
        $email_message->AddQuotedPrintableTextPart($email_message->WrapText($message));
    } else {
        $email_message->CreateQuotedPrintableHTMLPart($html_message, "", $html_part);
        //$text_message="This is an HTML message. Please use an HTML capable mail program to read this message.";
        $email_message->CreateQuotedPrintableTextPart($email_message->WrapText($message), "", $text_part);
        $alternative_parts = array($text_part, $html_part);
        $email_message->AddAlternativeMultipart($alternative_parts);
    }
    if ($mail_row['attachments'] == 'Y') {
        JB_add_mail_attachments($email_message, $mail_row);
    }
    JBPLUG_do_callback('set_mail_message', $email_message);
    // plugins can do additional operations on the $email_message, added in 3.6
    $error = $email_message->Send();
    if (strcmp($error, "")) {
        $now = gmdate("Y-m-d H:i:s");
        $sql = "UPDATE mail_queue SET status='error', retry_count=retry_count+1,  error_msg='" . jb_escape_sql(addslashes($error)) . "', `date_stamp`='{$now}' WHERE mail_id=" . jb_escape_sql($mail_row['mail_id']);
        JB_mysql_query($sql) or JB_q_mail_error(mysql_error() . $sql);
    } else {
        // note: on some servers (ie GoDaddy, connection to server can be
        // lost, so re-connect by pinging
        jb_mysql_ping();
        $now = gmdate("Y-m-d H:i:s");
        $sql = "UPDATE mail_queue SET status='sent', `date_stamp`='{$now}' WHERE mail_id='" . jb_escape_sql($mail_row['mail_id']) . "'";
        JB_mysql_query($sql, $jb_mysql_link) or JB_q_mail_error(mysql_error() . $sql);
    }
}