function insert_employer() { if (!$this->validate_employer()) { return false; } $username = $this->get_data_value('Username', 4); $password = $this->get_data_value('Password', 4); $fname = $this->get_data_value('FirstName', 4); $lname = $this->get_data_value('LastName', 4); $email = $this->get_data_value('Email', 4); $compname = $this->get_data_value('CompName', 4); $REMOTE_ADDR = $_SERVER['REMOTE_ADDR']; if ($REMOTE_ADDR == '') { $REMOTE_ADDR = '127.0.0.1'; // localhost } $lang = JB_get_default_lang(); $pass_md5 = $this->FMD->getOption('pass_md5'); // md5 encrypted? 'Y' or 'N' if ($pass_md5 != 'Y') { $password = md5($password); } //$employer_id = JB_generate_employer_id (); $now = gmdate("Y-m-d H:i:s"); // get the fiels part of the INSERT query $sql_fields = $this->get_sql_insert_fields(4); if ($sql_fields === false) { return false; } // get the values part of the INSERT query $sql_values = $this->get_sql_insert_values(4); if ($sql_values === false) { return false; } $validated = 0; if (JB_EM_NEEDS_ACTIVATION == "AUTO" || JB_EM_NEEDS_ACTIVATION == "FIRST_POST") { $validated = 1; } $sql = "REPLACE INTO `employers` (`IP`, `SignupDate`, `FirstName`, `LastName`, `CompName`, `Username`, `Password`, `Email`, `Aboutme`, `alert_query`, `Newsletter`, `Notification1`, `Notification2`, `Validated`, `lang`, `posts_balance`, premium_posts_balance " . $sql_fields . ") VALUES ('" . jb_escape_sql($REMOTE_ADDR) . "', '" . $now . "', '" . jb_escape_sql($fname) . "', '" . jb_escape_sql($lname) . "', '" . jb_escape_sql($compname) . "', '" . jb_escape_sql($username) . "', '" . jb_escape_sql($password) . "', '" . jb_escape_sql($email) . "', '', '', '" . jb_escape_sql($_REQUEST['Newsletter']) . "', '" . jb_escape_sql($_REQUEST['Notification1']) . "', '" . jb_escape_sql($_REQUEST['Notification2']) . "', '" . $validated . "', '" . $lang . "', '" . JB_BEGIN_STANDARD_CREDITS . "', '" . JB_BEGIN_PREMIUM_CREDITS . "' " . $sql_values . ") "; $result = jb_mysql_query($sql); $employer_id = jb_mysql_insert_id(); $this->log_entry('Inserted Employer | ' . $employer_id . ' | ' . $username . ' | ' . $email . ' | ' . $fname . $lname); return $employer_id; }
$EmailMessage = str_replace("%FNAME%", $user_row['FirstName'], $EmailMessage); $EmailMessage = str_replace("%LNAME%", $user_row['LastName'], $EmailMessage); $EmailMessage = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $EmailMessage); $EmailMessage = str_replace("%SITE_NAME%", JB_SITE_NAME, $EmailMessage); $EmailMessage = str_replace("%SITE_LOGO_URL%", JB_SITE_LOGO_URL, $EmailMessage); $EmailMessage = str_replace("%RESUME_ALERT%", '', $EmailMessage); // for compatibility with older version $EmailMessage = str_replace("%RESUME_ALERTS%", $resume_alert_list_html, $EmailMessage); $EmailMessage = str_replace("%KEYWORDS_LINE%", '', $EmailMessage); // for compatibility with older version $EmailMessage = str_replace("%EMPLOYER_LINK%", '<a href="' . $_clink . '">' . $_clink . '</a>', $EmailMessage); $html_message = $EmailMessage; ################ $lang = $user_row['lang']; if ($lang == '') { $lang = JB_get_default_lang(); } $e_result = JB_get_email_template(5, $lang); $e_row = mysql_fetch_array($e_result); $EmailMessage = $e_row['EmailText']; $from = $e_row['EmailFromAddress']; $from_name = $e_row['EmailFromName']; $subject = $e_row['EmailSubject']; $resume_alert_line = $e_row['sub_template']; ################################################################################ # Build resume list for each user. # Text email # Use jb_get_raw_template_value() # and then call strip_tags() ### if ($resume_alert_line != '') {
function jb_match_text_to_category($text, $form_id, $lang = '') { $MAX_SEARCH = 5; $i = 0; if (!$lang) { $lang = JB_get_default_lang(); } if (strlen($text) == 0) { return false; } $words = preg_split("/\\s+/", $text); $result = array_count_values(array_map('strtolower', $words)); // Returns an associative array of values from input as keys and their count as value. Case insensitive arsort($result); while (($word = key($result)) && $i < $MAX_SEARCH) { $i++; // match to category // return $category_id if (strlen($word) < 3) { // ignore any words with 2 or less chars continue; } if ($cat_name = JB_match_category_id_from_name($word, $form_id, $lang = '')) { return $cat_name; } next($result); } return false; }
function JB_create_new_employer_account() { if ($_REQUEST['lang'] == '') { $_REQUEST['lang'] = JB_get_default_lang(); } global $label; global $jb_mysql_link; $validated = 0; if (JB_EM_NEEDS_ACTIVATION == "AUTO" || JB_EM_NEEDS_ACTIVATION == "FIRST_POST") { $validated = 1; } // when inserting, use $assign to overwrite // the values which we do not want to fetch from the $_REQUEST // (Assuming that values on $_REQUEST already went through validation) $assign = array('Validated' => $validated, 'SignupDate' => gmdate("Y-m-d H:i:s"), 'IP' => $_SERVER['REMOTE_ADDR'], 'Newsletter' => (int) $_REQUEST['Newsletter'], 'Notification1' => (int) $_REQUEST['Notification1'], 'Notification2' => (int) $_REQUEST['Notification2'], 'posts_balance' => JB_BEGIN_STANDARD_CREDITS, 'premium_posts_balance' => JB_BEGIN_PREMIUM_CREDITS, 'Password' => md5(stripslashes($_REQUEST['Password'])), 'expired' => 'N'); $sql = "REPLACE INTO `employers` (" . JB_get_sql_insert_fields(4, $assign) . ") VALUES (" . JB_get_sql_insert_values(4, "employers", "ID", $employer_id, '', $assign) . ") "; $result = JB_mysql_query($sql); $employer_id = JB_mysql_insert_id(); if ($employer_id > 0) { JBPLUG_do_callback('create_employer_account', $employer_id); } $result = JB_get_email_template(2, $_SESSION['LANG']); $e_row = mysql_fetch_array($result, MYSQL_ASSOC); $subject = str_replace("%MEMBERID%", stripslashes($_REQUEST['Username']), $e_row['EmailSubject']); $EmailMessage = str_replace("%FNAME%", stripslashes($_REQUEST['FirstName']), $e_row['EmailText']); $EmailMessage = str_replace("%LNAME%", stripslashes($_REQUEST['LastName']), $EmailMessage); $EmailMessage = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $EmailMessage); $EmailMessage = str_replace("%SITE_NAME%", JB_SITE_NAME, $EmailMessage); $EmailMessage = str_replace("%MEMBERID%", stripslashes($_REQUEST['Username']), $EmailMessage); $EmailMessage = str_replace("%PASSWORD%", stripslashes($_REQUEST['Password']), $EmailMessage); $EmailMessage = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $EmailMessage); JBPLUG_do_callback('employer_signup_email_msg', $EmailMessage, $employer_id); if (!defined('JB_EMAIL_EMP_SIGNUP')) { define('JB_EMAIL_EMP_SIGNUP', 'YES'); } if (JB_EMAIL_EMP_SIGNUP == 'YES') { $email_id = JB_queue_mail(stripslashes($_REQUEST['Email']), jb_get_formatted_name(stripslashes($_REQUEST['FirstName']), stripslashes($_REQUEST['LastName'])), $e_row['EmailFromAddress'], $e_row['EmailFromName'], $subject, $EmailMessage, '', 2); JB_process_mail_queue(1, $email_id); } $to = JB_SITE_CONTACT_EMAIL; if (JB_EMAIL_EMPLOYER_SIGNUP_SWITCH == 'YES') { $email_id = JB_queue_mail($to, "Admin", JB_SITE_CONTACT_EMAIL, JB_SITE_NAME, $subject, $EmailMessage, '', 2); JB_process_mail_queue(1, $email_id); } return $employer_id; }
function JB_getCodeFromDescription($field_id, $description, $lang = '') { if (!$lang) { $lang = JB_get_default_lang(); } $sql = "SELECT `code` FROM `codes_translations` WHERE field_id='" . jb_escape_sql($field_id) . "' AND `description` = '" . jb_escape_sql($description) . "' and lang='" . jb_escape_sql($lang) . "' "; $result = JB_mysql_query($sql) or die($sql . mysql_error()); if ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { return $row['code']; } else { return false; } }
function JB_create_new_candidate_account() { global $label; if ($_REQUEST['lang'] == '') { $_REQUEST['lang'] = JB_get_default_lang(); } $validated = 0; if (JB_CA_NEEDS_ACTIVATION == "AUTO") { $validated = 1; } // when inserting, use $assign to overwrite // the values which we do not want to fetch from the $_REQUEST // (Assuming that values on $_REQUEST already went through validation) $assign = array('Validated' => $validated, 'SignupDate' => gmdate("Y-m-d H:i:s"), 'IP' => $_SERVER['REMOTE_ADDR'], 'Newsletter' => (int) $_REQUEST['Newsletter'], 'Notification1' => (int) $_REQUEST['Notification1'], 'Notification2' => (int) $_REQUEST['Notification2'], 'Password' => md5(stripslashes($_REQUEST['Password'])), 'expired' => 'N'); $sql = "REPLACE INTO `users` ( " . JB_get_sql_insert_fields(5, $assign) . ") VALUES ( " . JB_get_sql_insert_values(5, "users", "ID", $user_id, '', $assign) . ") "; JB_mysql_query($sql); $user_id = JB_mysql_insert_id(); if ($user_id > 0) { JBPLUG_do_callback('create_candidate_account', $user_id); } // Here the emailmessage itself is defined, this will be send to your members. Don't forget to set the validation link here. $result = JB_get_email_template(1, $_SESSION['LANG']); $e_row = mysql_fetch_array($result, MYSQL_ASSOC); $EmailMessage = $e_row['EmailText']; $from = $e_row['EmailFromAddress']; $from_name = $e_row['EmailFromName']; $subject = $e_row['EmailSubject']; $subject = str_replace("%MEMBERID%", stripslashes($_REQUEST['Username']), $subject); $EmailMessage = str_replace("%FNAME%", stripslashes($_REQUEST['FirstName']), $EmailMessage); $EmailMessage = str_replace("%LNAME%", stripslashes($_REQUEST['LastName']), $EmailMessage); $EmailMessage = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $EmailMessage); $EmailMessage = str_replace("%SITE_NAME%", JB_SITE_NAME, $EmailMessage); $EmailMessage = str_replace("%MEMBERID%", stripslashes($_REQUEST['Username']), $EmailMessage); $EmailMessage = str_replace("%PASSWORD%", stripslashes($_REQUEST['Password']), $EmailMessage); $EmailMessage = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $EmailMessage); JBPLUG_do_callback('candidate_signup_email_msg', $EmailMessage, $user_id); $to = stripslashes($_REQUEST['Email']); if (!defined('JB_EMAIL_CAN_SIGNUP')) { define('JB_EMAIL_CAN_SIGNUP', 'YES'); } if (JB_EMAIL_CAN_SIGNUP == 'YES') { $email_id = JB_queue_mail($to, stripslashes(jb_get_formatted_name(stripslashes($_REQUEST['FirstName']), stripslashes($_REQUEST['LastName']))), $e_row['EmailFromAddress'], $e_row['EmailFromName'], $subject, $EmailMessage, '', 1); JB_process_mail_queue(1, $email_id); } $to = JB_SITE_CONTACT_EMAIL; if (JB_EMAIL_CANDIDATE_SIGNUP_SWITCH == 'YES') { $email_id = JB_queue_mail($to, "Admin", JB_SITE_CONTACT_EMAIL, JB_SITE_NAME, $subject, $EmailMessage, '', 2); JB_process_mail_queue(1, $email_id); } return $user_id; }
function JB_init_lang_cookie() { //global $jb_mysql_link; if (isset($_REQUEST['lang']) && $_REQUEST['lang'] != '') { $_REQUEST['lang'] = preg_replace('/[^a-z^-^_]+/i', '', $_REQUEST['lang']); // sanitize $sql = "SELECT * FROM lang WHERE `lang_code`='" . jb_escape_sql($_REQUEST['lang']) . "'"; $result = jb_mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($result) > 0) { $_SESSION["LANG"] = strtoupper($_REQUEST["lang"]); // save the requested language setcookie("JB_SAVED_LANG", strtoupper($_REQUEST["lang"]), 2147483647, '/'); } else { $sql = "SELECT * FROM lang WHERE `is_default`='Y'"; $result = jb_mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $_SESSION["LANG"] = strtoupper($row["lang_code"]); // save the requested language setcookie("JB_SAVED_LANG", strtoupper($row["lang_code"]), 2147483647, '/'); echo "Invalid language. Reverting to default language."; } } elseif (!isset($_SESSION["LANG"])) { // get the default language, or saved language if ($_COOKIE['JB_SAVED_LANG'] != '') { $lang = preg_replace('/[^a-z^-^_]+/i', '', $_COOKIE['JB_SAVED_LANG']); // sanitize $_SESSION["LANG"] = strtoupper($lang); } else { $jb_default_lang = JB_get_default_lang(); if ($jb_default_lang) { $_SESSION["LANG"] = strtoupper($jb_default_lang); } else { $_SESSION["LANG"] = 'EN'; } } } }