$employee = new Employee($_POST['employee']); $employer = new Employer($_POST['employer']); $lines = file(dirname(__FILE__) . '/../private/mail/employee_job_assignment.txt'); $message = ''; foreach ($lines as $line) { $message .= $line; } $message = str_replace('%job_id%', $job->getId(), $message); $message = str_replace('%job%', $_POST['title'], $message); $message = str_replace('%employer%', $employer->getName(), $message); $message = str_replace('%country%', Country::getCountryFrom($_POST['country']), $message); $message = str_replace('%is_exec%', $_POST['is_executive'] == '1' ? 'Yes' : 'No', $message); $message = str_replace('%expiry%', $job->getExpiryDate(), $message); $subject = $_POST['title'] . ' position has been assigned to you'; $headers = 'From: YellowElevator.com <*****@*****.**>' . "\n"; mail($employee->getEmailAddress(), $subject, $body, $headers); // $handle = fopen('/tmp/email_to_'. $employee->getEmailAddress(). '.txt', 'w'); // fwrite($handle, 'Subject: '. $subject. "\n\n"); // fwrite($handle, $body); // fclose($handle); // Tweet about this job, if it is new if ($new_id > 0 && !$is_test_site) { $employer = htmlspecialchars_decode(stripslashes($employer->getName())); $url = $GLOBALS['protocol'] . '://' . $GLOBALS['root'] . '/job/' . $new_id; $status = $data['title'] . ' (' . $employer . ') - ' . $url; $twitter_username = '******'; $twitter_password = '******'; $tweetUrl = 'http://www.twitter.com/statuses/update.xml'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $tweetUrl); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
$result = $member_resume->find($criteria); $original_filename = explode('.', $result[0]['file_name']); $extension = $original_filename[1]; $resume_file_raw = $resume . '.' . $result[0]['file_hash']; $attached_filename = $resume . '.' . $extension; $filetype = $result[0]['file_type']; $attachment = chunk_split(base64_encode(file_get_contents($GLOBALS['resume_dir'] . '/' . $resume_file_raw))); // 3. make mail with attachment $subject = ''; if ($has_many_jobs) { $subject = 'Multiple Jobs Applications - Resume #' . $_POST['resume']; } else { $subject = trim(substr($job_list, 2)) . ' - Resume #' . $_POST['resume']; } //$headers = 'From: YellowElevator.com <*****@*****.**>' . "\n"; $headers = 'From: ' . $employee->getEmailAddress() . "\n"; $headers .= 'Cc: ' . $yel_email . "\n"; $headers .= 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-Type: multipart/mixed; boundary="yel_mail_sep_' . $attached_filename . '";' . "\n\n"; $body = '--yel_mail_sep_' . $attached_filename . "\n"; $body .= 'Content-Type: multipart/alternative; boundary="yel_mail_sep_alt_' . $attached_filename . '"' . "\n"; $body .= '--yel_mail_sep_alt_' . $attached_filename . "\n"; $body .= 'Content-Type: text/plain; charset="iso-8859-1"' . "\n"; $body .= 'Content-Transfer-Encoding: 7bit"' . "\n"; $body .= $message . "\n"; $body .= '--yel_mail_sep_alt_' . $attached_filename . "--\n\n"; $body .= '--yel_mail_sep_' . $attached_filename . "\n"; $body .= 'Content-Type: ' . $filetype . '; name="' . $attached_filename . '"' . "\n"; $body .= 'Content-Transfer-Encoding: base64' . "\n"; $body .= 'Content-Disposition: attachment' . "\n"; $body .= $attachment . "\n";
$result = $referral->find($criteria); $employer = new Employer($result[0]['employer']); $branch = $employer->getAssociatedBranch(); $response = array('title' => $result[0]['title'], 'employer' => $result[0]['employer'], 'referee' => $result[0]['referee'], 'currency' => Currency::getSymbolFromCountryCode($branch[0]['country'])); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array(array('referral' => $response)); exit; } if ($_POST['action'] == 'confirm_employed') { $work_commence_on = $_POST['work_commence_on']; $is_replacement = false; $is_free_replacement = false; $previous_referral = '0'; $previous_invoice = '0'; $employee = new Employee($_POST['employee_id']); $employee_email = $employee->getEmailAddress(); if (is_null($employee_email) || empty($employee_email) || $employee_email === false) { $employee_email = ''; } // 1. Update the referral to employed $referral = new Referral($_POST['id']); $criteria = array('columns' => "jobs.id AS job_id, jobs.title, jobs.employer, \n referrals.member, referrals.referee", 'joins' => "jobs ON jobs.id = referrals.job", 'match' => "referrals.id = " . $_POST['id'], 'limit' => "1"); $result = $referral->find($criteria); $employer = new Employer($result[0]['employer']); $candidate = new Member($result[0]['referee']); $member = new Member($result[0]['member']); $job = array('id' => $result[0]['job_id'], 'title' => htmlspecialchars_decode(stripslashes($result[0]['title']))); $salary = $_POST['salary']; $irc_id = $member->isIRC() ? $member->getId() : NULL; $total_reward = $referral->calculateRewardFrom($salary, $irc_id); $total_token_reward = $total_reward * 0.3;