if (is_null($result[$i]['added_by']) || empty($result[$i]['added_by'])) { $result[$i]['added_by'] = '-1'; } if (is_null($result[$i]['zip']) || empty($result[$i]['zip'])) { $result[$i]['zip'] = '0'; } if (is_null($result[$i]['prime_industry']) || empty($result[$i]['prime_industry'])) { $result[$i]['prime_industry'] = 'N/A'; } if (is_null($result[$i]['second_industry']) || empty($result[$i]['second_industry'])) { $result[$i]['second_industry'] = 'N/A'; } } $response = array('results' => array('result' => $result)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'preview_resume') { $keywords = trim($_POST['keywords']); $keywords = remove_stop_words($keywords); $use_and_op = $_POST['use_and'] == '1' ? true : false; $mysqli = Database::connect(); $query = "SELECT resume_index.cover_note, resume_index.qualification, resume_index.work_summary, \n resume_index.skill, resume_index.technical_skill, resume_index.file_text, \n members.email_addr, \n CONCAT(members.lastname, ', ', members.firstname) AS member \n FROM resume_index \n INNER JOIN resumes ON resumes.id = resume_index.resume \n INNER JOIN members ON members.email_addr = resumes.member \n WHERE resume_index.resume = " . $_POST['resume_id'] . " LIMIT 1"; $result = $mysqli->query($query); if (is_null($result) || empty($result)) { echo 'ko'; exit; } $preview_text = ''; $preview_text .= !empty($result[0]['cover_note']) && !is_null($result[0]['cover_note']) ? $result[0]['cover_note'] . "\n\n" : '';
if (!isset($_POST['id'])) { echo "ko"; exit; //redirect_to('login.php'); } $xml_dom = new XMLDOM(); $filter_by = '0'; if (isset($_POST['filter_by'])) { $filter_by = $_POST['filter_by']; } if ($_POST['action'] == 'get_networks') { $member = new Member($_POST['member'], $_SESSION['yel']['member']['sid']); $networks = $member->get_networks(); $response = array('networks' => array('network' => $networks)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'get_candidates') { $member = new Member($_POST['id'], $_SESSION['yel']['member']['sid']); $result = $member->get_referees("member_referees.referred_on DESC", $filter_by); foreach ($result as $key => $row) { $result[$key]['networks'] = ''; } $networks = $member->get_networks(); $mysqli = Database::connect(); foreach ($networks as $network) { $query = "SELECT referee FROM member_networks_referees WHERE network = " . $network['id']; $referees = $mysqli->query($query); foreach ($referees as $referee) { foreach ($result as $key => $row) {
$limit = "0, " . $page_limit; if (!empty($_POST['page']) || $_POST['page'] > 0) { $offset = $_POST['page'] + $page_limit - 1; $limit = $offset . ", " . $page_limit; } $total_pages = ceil(count($result) / $page_limit); $criteria['limit'] = $limit; $result = $referral->find($criteria); foreach ($result as $i => $row) { foreach ($row as $col => $value) { $result[$i][$col] = htmlspecialchars_decode(stripslashes($value)); } } header('Content-type: text/xml'); $response = array('found_employers' => array('found_employer' => $found_employers), 'pagination' => array('total_pages' => $total_pages, 'current_page' => $_POST['page']), 'application' => $result); echo $xml_dom->get_xml_from_array(array('applications' => $response)); exit; } if ($_POST['action'] == 'get_testimony') { $criteria = array('columns' => "testimony", 'match' => "id = " . $_POST['id'], 'limit' => "1"); $referral = new Referral(); $result = $referral->find($criteria); $testimony = htmlspecialchars_decode(str_replace("\n", '<br/>', $result[0]['testimony'])); echo $testimony; exit; } if ($_POST['action'] == 'get_job_desc') { $criteria = array('columns' => "description", 'match' => "id = " . $_POST['id'], 'limit' => "1"); $job = new Job(); $result = $job->find($criteria); $job_desc = htmlspecialchars_decode(str_replace("\n", '<br/>', $result[0]['description']));
} if (!$rewards) { echo 'ko'; exit; } foreach ($rewards as $i => $row) { $rewards[$i]['member'] = htmlspecialchars_decode(stripslashes($row['member'])); $rewards[$i]['employer'] = htmlspecialchars_decode(stripslashes($row['employer'])); $rewards[$i]['title'] = htmlspecialchars_decode(stripslashes($row['title'])); $rewards[$i]['padded_invoice'] = pad($row['invoice'], 11, '0'); $rewards[$i]['total_reward'] = number_format($row['total_reward'], 2, '.', ', '); $rewards[$i]['paid_reward'] = number_format($row['paid_reward'], 2, '.', ', '); } $response = array('rewards' => array('reward' => $rewards)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'get_paid_rewards') { $order_by = 'invoices.paid_on DESC'; if (isset($_POST['order_by'])) { $order_by = $_POST['order_by']; } $rewards = get_rewards(true, $order_by); if (count($rewards) <= 0 || is_null($rewards)) { echo '0'; exit; } if (!$rewards) { echo 'ko'; exit;
$i = 0; foreach ($educations as $education) { $resume_data['resume']['educations']['education'][$i]['qualification'] = $education['qualification']; $resume_data['resume']['educations']['education'][$i]['completion_year'] = $education['completed_on']; $resume_data['resume']['educations']['education'][$i]['institution'] = $education['institution']; $resume_data['resume']['educations']['education'][$i]['country'] = Country::getCountryFrom($education['country']); $i++; } } $resume_data['resume']['skills'] = ''; if (!is_null($skills[0]['skill']) && !empty($skills[0]['skill'])) { $resume_data['resume']['skills'] = $skills[0]['skill']; } $resume_data['resume']['technical_skills'] = array(); if (count($technical_skills) > 0) { $i = 0; $levels = array('A' => 'Beginner', 'B' => 'Intermediate', 'C' => 'Advanced'); foreach ($technical_skills as $technical_skill) { $resume_data['resume']['technical_skills']['technical_skill'][$i]['tech_skill'] = $technical_skill['technical_skill']; $resume_data['resume']['technical_skills']['technical_skill'][$i]['level'] = $levels[$technical_skill['level']]; $i++; } } $resume_data['resume']['cover_note'] = ''; if (!is_null($cover[0]['cover_note']) && !empty($cover[0]['cover_note'])) { $resume_data['resume']['cover_note'] = $cover[0]['cover_note']; } header('Content-type: text/xml'); header('Content-Disposition: attachment; filename="resume.xml"'); echo $xml_dom->get_xml_from_array($resume_data);
} $new_result = array(); foreach ($result as $i => $row) { $result[$i]['member_name'] = htmlspecialchars_decode(html_entity_decode(stripslashes(desanitize($row['member_name'])))); if (stripos($result[$i]['member_name'], 'yellow') === false && stripos($result[$i]['member_name'], 'elevator') === false) { $new_result[] = $result[$i]; } } $result = $new_result; if (count($result) <= 0 || is_null($result) || empty($result)) { echo '0'; exit; } $response = array('members' => array('member' => $result)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'get_profile') { $query = "SELECT members.email_addr AS email_addr, members.phone_num AS phone_num, members.remarks, \n members.firstname, members.lastname, \n DATE_FORMAT(members.joined_on, '%e %b, %Y') AS formatted_joined_on, \n primary_industries.industry AS first_industry, \n secondary_industries.industry AS second_industry, \n tertiary_industries.industry AS tertiary_industry, \n countries.country, members.zip \n FROM members \n LEFT JOIN countries ON countries.country_code = members.country \n LEFT JOIN industries AS primary_industries ON primary_industries.id = members.primary_industry \n LEFT JOIN industries AS secondary_industries ON secondary_industries.id = members.secondary_industry \n LEFT JOIN industries AS tertiary_industries ON tertiary_industries.id = members.tertiary_industry \n WHERE members.email_addr = '" . $_POST['id'] . "'"; $mysqli = Database::connect(); $result = $mysqli->query($query); $profile = array(); foreach ($result[0] as $key => $value) { $profile[$key] = $value; if (stripos($key, 'firstname') !== false || stripos($key, 'lastname') !== false) { $profile[$key] = htmlspecialchars_decode(html_entity_decode(stripslashes(desanitize($value)))); } } $response = array('profile' => $profile); header('Content-type: text/xml');
$paid = ReferralReward::get_sum_paid_of_referral($row['referral']); if ($paid[0]['amount'] <= 0 || is_null($paid)) { //$row['member'] = htmlspecialchars_decode($row['member']); $row['padded_invoice'] = pad($row['invoice'], 11, '0'); $row['total_token_reward'] = number_format($row['total_token_reward'], 2, '.', ', '); $rewards[$i] = $row; $i++; } } if (count($rewards) <= 0 || is_null($rewards)) { echo '0'; exit; } $response = array('rewards' => array('reward' => $rewards)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'get_fully_paid') { $order_by = 'fully_paid_on DESC'; if (isset($_POST['order_by'])) { $order_by = $_POST['order_by']; } $query = "SELECT referrals.id AS referral, currencies.symbol AS currency, referrals.total_token_reward, \n jobs.title, employers.name AS employer, referral_token_rewards.paid_through, \n referral_token_rewards.cheque, referral_token_rewards.receipt, \n member_banks.bank, member_banks.account, \n referrals.referee AS candidate_id, referrals.employed_on, \n referral_token_rewards.paid_on AS fully_paid_on, \n CONCAT(members.lastname, ', ', members.firstname) AS candidate, \n DATE_FORMAT(referrals.referee_confirmed_hired_on, '%e %b, %Y') AS formatted_referee_confirmed_on, \n DATE_FORMAT(referrals.employed_on, '%e %b, %Y') AS formatted_employed_on, \n DATE_FORMAT(referral_token_rewards.paid_on, '%e %b, %Y') AS formatted_fully_paid_on \n FROM referrals \n LEFT JOIN referral_token_rewards ON referral_token_rewards.referral = referrals.id \n LEFT JOIN jobs ON jobs.id = referrals.job \n LEFT JOIN members ON members.email_addr = referrals.member \n LEFT JOIN employers ON employers.id = jobs.employer \n LEFT JOIN currencies ON currencies.country_code = employers.country \n LEFT JOIN employees ON employers.registered_by = employees.id \n LEFT JOIN member_banks ON member_banks.id = referral_token_rewards.bank \n WHERE (referrals.employed_on IS NOT NULL AND referrals.employed_on <> '0000-00-00 00:00:00') AND \n (referrals.member_confirmed_on IS NOT NULL AND referrals.member_confirmed_on <> '0000-00-00 00:00:00') AND \n (referral_token_rewards.paid_on IS NOT NULL AND referral_token_rewards.paid_on <> '0000-00-00 00:00:00') AND \n (referrals.total_token_reward IS NOT NULL AND referrals.total_token_reward > 0) AND \n (referrals.employer_removed_on IS NULL OR referrals.employer_removed_on = '0000-00-00 00:00:00') AND \n (referrals.referee_rejected_on IS NULL OR referrals.referee_rejected_on = '0000-00-00 00:00:00') AND \n (referrals.replacement_authorized_on IS NULL OR referrals.replacement_authorized_on = '0000-00-00 00:00:00') AND \n (referrals.guarantee_expire_on <= CURDATE() OR referrals.guarantee_expire_on IS NULL) AND \n employees.branch = " . $_SESSION['yel']['employee']['branch']['id'] . " \n GROUP BY referrals.id \n ORDER BY " . $order_by; $mysqli = Database::connect(); $result = $mysqli->query($query); if (count($result) <= 0 || is_null($result)) { echo '0'; exit; } if (!$result) {
/** * Returns the MySQL error stored in the $mysql_error array in XML string. * @return String Returns mysql_error in XML format. * FORMAT: * <errors><errno>mysql_error['errno']</errno><error>mysql_error['error']</error></errors> */ public function error_in_xml() { $data = array('errors' => array('errno' => $this->mysql_error['errno'], 'error' => $this->mysql_error['error'])); $xml_dom = new XMLDOM(); return $xml_dom->get_xml_from_array($data); }
$order_by = 'referred_on desc'; if (isset($_POST['order_by'])) { $order_by = $_POST['order_by']; } $query = "SELECT referrals.id, resumes.file_hash, resumes.name AS resume_name, referrals.resume AS resume_id, \n members.email_addr AS candidate_email_addr, \n members.phone_num AS candidate_phone_num, \n CONCAT(members.lastname, ', ', members.firstname) AS candidate_name, \n referrers.email_addr AS referrer_email_addr, \n referrers.phone_num AS referrer_phone_num, \n CONCAT(referrers.lastname, ', ', referrers.firstname) AS referrer_name, \n DATE_FORMAT(referrals.referred_on, '%e %b, %Y') AS formatted_referred_on, \n DATE_FORMAT(referrals.member_confirmed_on, '%e %b, %Y') AS formatted_confirmed_on, \n DATE_FORMAT(referrals.employer_agreed_terms_on, '%e %b, %Y') AS formatted_employer_viewed_on \n FROM referrals \n LEFT JOIN resumes ON resumes.id = referrals.resume \n LEFT JOIN members ON members.email_addr = referrals.referee \n LEFT JOIN members AS referrers ON referrers.email_addr = referrals.member \n WHERE referrals.job = " . $_POST['id'] . " AND \n (referrals.employed_on IS NULL OR referrals.employed_on = '0000-00-00 00:00:00') AND \n (referrals.referee_acknowledged_on IS NOT NULL AND referrals.referee_acknowledged_on <> '0000-00-00 00:00:00') \n ORDER BY " . $order_by; $mysqli = Database::connect(); $result = $mysqli->query($query); $response = array('referrals' => array('referral' => $result)); $xml_dom = new XMLDOM(); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'get_employer_name') { $query = "SELECT name FROM employers WHERE id = '" . $_POST['id'] . "' LIMIT 1"; $mysqli = Database::connect(); $result = $mysqli->query($query); $xml_dom = new XMLDOM(); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array(array('employer' => array('name' => $result[0]['name']))); exit; } if ($_POST['action'] == 'get_job_title') { $query = "SELECT title FROM jobs WHERE id = " . $_POST['id'] . " LIMIT 1"; $mysqli = Database::connect(); $result = $mysqli->query($query); $xml_dom = new XMLDOM(); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array(array('job' => array('title' => $result[0]['title']))); exit; }
$mysqli = Database::connect(); $result = $mysqli->query($query); if (count($result) <= 0 || is_null($result)) { echo '0'; exit; } if (!$result) { echo 'ko'; exit; } foreach ($result as $i => $row) { $result[$i]['candidate'] = htmlspecialchars_decode($row['candidate']); } $response = array('referrals' => array('referral' => $result)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'get_in_process') { $order_by = 'referrals.referred_on desc'; if (isset($_POST['order_by'])) { $order_by = $_POST['order_by']; } $employee = new Employee($_POST['id']); $branch = $employee->get_branch(); $member = 'team.' . strtolower($branch[0]['country_code']) . '@yellowelevator.com'; $query = "SELECT referrals.id, employers.name AS employer, jobs.id AS job_id, jobs.title AS title, \n CONCAT(members.lastname, ', ', members.firstname) AS candidate, industries.industry, \n members.email_addr AS candidate_email, members.phone_num, \n resumes.name AS resume, referrals.resume AS resume_id, \n DATE_FORMAT(referrals.referred_on, '%e %b, %Y') AS formatted_referred_on, \n DATE_FORMAT(referrals.employer_agreed_terms_on, '%e %b, %Y') AS formatted_agreed_terms_on \n FROM referrals \n LEFT JOIN jobs ON jobs.id = referrals.job \n LEFT JOIN industries ON industries.id = jobs.industry \n LEFT JOIN employers ON employers.id = jobs.employer \n LEFT JOIN members ON members.email_addr = referrals.referee \n LEFT JOIN resumes ON resumes.id = referrals.resume \n WHERE ((referrals.referee_confirmed_hired_on IS NULL OR referrals.referee_confirmed_hired_on = '0000-00-00 00:00:00') OR \n (referrals.employed_on IS NOT NULL AND referrals.employed_on <> '0000-00-00 00:00:00')) AND\n (referrals.employer_removed_on IS NULL OR referrals.employer_removed_on = '0000-00-00 00:00:00') AND \n (referrals.replacement_authorized_on IS NULL OR referrals.replacement_authorized_on = '0000-00-00 00:00:00') AND \n referrals.member = '" . $member . "' \n ORDER BY " . $_POST['order_by']; $mysqli = Database::connect(); $result = $mysqli->query($query); if (count($result) <= 0 || is_null($result)) { echo '0';
$result = $mysqli->query($query); if (count($result) <= 0 || is_null($result)) { echo '0'; exit; } if (!$result) { echo 'ko'; exit; } foreach ($result as $i => $row) { $result[$i]['recommender_name'] = htmlspecialchars_decode(html_entity_decode(stripslashes(desanitize($row['recommender_name'])))); $result[$i]['remarks'] = htmlspecialchars_decode(html_entity_decode(stripslashes(desanitize($row['remarks'])))); } $response = array('recommenders' => array('recommender' => $result)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'get_profile') { $query = "SELECT email_addr, firstname, lastname, phone_num, remarks, region, \n DATE_FORMAT(added_on, '%e %b, %Y') AS formatted_added_on \n FROM recommenders \n WHERE email_addr = '" . $_POST['id'] . "'"; $mysqli = Database::connect(); $result = $mysqli->query($query); $profile = array(); foreach ($result[0] as $key => $value) { $profile[$key] = $value; if (stripos($key, 'firstname') !== false || stripos($key, 'lastname') !== false) { $profile[$key] = htmlspecialchars_decode(html_entity_decode(stripslashes(desanitize($value)))); } } $industries = array(); $query = "SELECT industry FROM recommender_industries \n WHERE recommender = '" . $_POST['id'] . "'";
} if (is_null($result) || empty($result)) { echo '0'; exit; } $jobs = array(); foreach ($result as $i => $row) { if ($row['deleted'] == '1' && $row['buf_count'] + $row['app_count'] <= 0) { continue; } $row['job_title'] = htmlspecialchars_decode(stripslashes($row['job_title'])); $jobs[] = $row; } $response = array('jobs' => array('job' => $jobs)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'get_new_applicants') { $order_by = "referral_buffers.requested_on desc"; $show_only = "referral_buffers.referrer_email LIKE '%'"; $filter_by = ""; $page = 1; if (isset($_POST['order_by'])) { $order_by = $_POST['order_by']; } if (isset($_POST['show_only'])) { if ($_POST['show_only'] == 'self_applied') { $show_only = "referral_buffers.referrer_email LIKE '*****@*****.**'"; } else { if ($_POST['show_only'] == 'referred') {
if (isset($_POST['order_by'])) { $order_by = $_POST['order_by']; } $query = "SELECT * FROM member_banks \n WHERE member = '" . $_POST['id'] . "' AND \n in_used = 'Y' \n ORDER BY " . $order_by; $mysqli = Database::connect(); $result = $mysqli->query($query); if (count($result) <= 0 || is_null($result)) { echo '0'; exit; } if (!$result) { echo 'ko'; exit; } header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array(array('bank_accounts' => array('bank_account' => $result))); exit; } if ($_POST['action'] == 'save_bank') { $member = new Member($_POST['member']); if ($_POST['id'] == '0') { if (!$member->create_bank($_POST['bank'], $_POST['account'])) { echo 'ko'; exit; } } else { if (!$member->update_bank($_POST['id'], $_POST['bank'], $_POST['account'])) { echo 'ko'; exit; } }
if ($_POST['action'] == 'get_jobs') { $employer = new Employer($_POST['id']); $result = $employer->getJobs($_POST['order']); if (is_null($result) || empty($result)) { echo '0'; exit; } if ($result === false) { echo 'ko'; exit; } foreach ($result as $i => $row) { $result[$i]['title'] = htmlspecialchars_decode(stripslashes($row['title'])); } header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array(array('jobs' => array('job' => $result))); exit; } if ($_POST['action'] == 'get_job') { $job = new Job($_POST['id']); $result = $job->get(); $result[0]['title'] = htmlspecialchars_decode(stripslashes($result[0]['title'])); $result[0]['description'] = htmlspecialchars_decode(stripslashes($result[0]['description'])); $result[0]['description'] = str_replace('<br/>', "\n", $result[0]['description']); $criteria = array('columns' => "job_index.state", 'joins' => "job_index ON job_index.job = jobs.id", 'match' => "jobs.id = " . $_POST['id'], 'limit' => "1"); $tmp = $job->find($criteria); $result[0]['state'] = $tmp[0]['state']; header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array(array('job' => $result)); exit; }
} $query = "SELECT jobs.id, COUNT(referrals.id) AS num_new_referrals \n FROM referrals \n LEFT JOIN jobs ON jobs.id = referrals.job \n LEFT JOIN resumes ON resumes.id = referrals.resume \n WHERE jobs.employer = '" . $_POST['id'] . "' AND \n (resumes.deleted = 'N' AND resumes.private = 'N') AND \n (referrals.employer_agreed_terms_on IS NULL OR referrals.employer_agreed_terms_on = '0000-00-00 00:00:00') AND \n (referrals.referee_acknowledged_on IS NOT NULL AND referrals.referee_acknowledged_on <> '0000-00-00 00:00:00') AND \n (referrals.member_confirmed_on IS NOT NULL AND referrals.member_confirmed_on <> '0000-00-00 00:00:00') AND \n -- (referrals.employed_on IS NULL OR referrals.employed_on = '0000-00-00 00:00:00') AND \n referrals.employer_removed_on IS NULL AND \n (referrals.replacement_authorized_on IS NULL OR referrals.replacement_authorized_on = '0000-00-00 00:00:00')\n GROUP BY referrals.job"; $new_referrals = $mysqli->query($query); if (count($new_referrals) > 0 && !is_null($new_referrals)) { foreach ($new_referrals as $new_referral) { foreach ($result as $i => $row) { if ($row['id'] == $new_referral['id']) { $result[$i]['new_referrals_count'] = $new_referral['num_new_referrals']; break; } } } } $response = array('referrals' => array('referral' => $result)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'get_description') { $job = new Job($_POST['id']); $result = $job->get(); $response = array('job' => array('title' => $result[0]['title'], 'description' => htmlspecialchars_decode($result[0]['description']))); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'get_salary') { $query = "SELECT salary FROM jobs WHERE id = " . $_POST['id']; $mysqli = Database::connect(); $result = $mysqli->query($query); header('Content-type: text/xml');
require_once dirname(__FILE__) . "/../private/lib/utilities.php"; // if ($GLOBALS['protocol'] == 'https') { // if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') { // redirect_to('https://'. $GLOBALS['root']. '/resumes/get.php'); // exit(); // } // } $xml_dom = new XMLDOM(); $mysqli = Database::connect(); // 1. get all the resume IDs which are needs re-indexing $query = "SELECT id, file_hash FROM resumes \n WHERE needs_indexing = TRUE AND \n file_type = 'application/msword' AND \n deleted = 'N'"; $result = $mysqli->query($query); if ($result === false) { echo 'ko'; exit; } if (count($result) <= 0 || is_null($result)) { echo '0'; exit; } // 2. put them into array for XML parsing $response = array(); foreach ($result as $i => $row) { $resume = array('id' => $row['id'], 'hash' => $row['file_hash']); $response['resume'][] = $resume; } // 3. return header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array(array('resumes' => $response));
if ($_POST['action'] == 'get_jobs') { $employer = new Employer($_POST['id']); $result = $employer->getJobs($_POST['order']); if (is_null($result) || empty($result)) { echo '0'; exit; } if ($result === false) { echo 'ko'; exit; } foreach ($result as $i => $row) { $result[$i]['title'] = htmlspecialchars_decode(stripslashes($row['title'])); } header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array(array('jobs' => array('job' => $result))); exit; } if ($_POST['action'] == 'save_notes') { $member = new Member($_POST['id']); $notes = $_POST['notes']; if (!empty($notes)) { $notes .= "\n\n--- " . date('Y-m-d H:i') . " ---\n\n"; } if ($member->saveNotes($notes) === false) { echo 'ko'; exit; } echo 'ok'; exit; }
<?php require_once dirname(__FILE__) . "/../../private/lib/utilities.php"; session_start(); $xml_dom = new XMLDOM(); $counts = array(); $query = "SELECT COUNT(referrals.id) AS num_responses \n FROM referrals \n LEFT JOIN jobs ON jobs.id = referrals.job \n LEFT JOIN member_referees ON member_referees.member = referrals.member AND \n member_referees.referee = referrals.referee \n WHERE referrals.member = '" . $_SESSION['yel']['member']['id'] . "' AND \n member_referees.member = '" . $_SESSION['yel']['member']['id'] . "' AND \n referrals.response_counted = false AND \n (referrals.employed_on IS NULL OR referrals.employed_on = '0000-00-00 00:00:00') AND \n (referrals.work_commence_on IS NULL OR referrals.work_commence_on = '0000-00-00 00:00:00') AND \n (referrals.referee_acknowledged_on IS NOT NULL AND referrals.referee_acknowledged_on <> '0000-00-00 00:00:00') AND \n (referrals.referee_rejected_on IS NULL OR referrals.referee_rejected_on = '0000-00-00 00:00:00') AND \n (referrals.member_rejected_on IS NULL OR referrals.member_rejected_on = '0000-00-00 00:00:00') AND \n (referrals.replacement_authorized_on IS NULL OR referrals.replacement_authorized_on = '0000-00-00 00:00:00') AND \n (referrals.employer_agreed_terms_on IS NULL OR referrals.employer_agreed_terms_on = '0000-00-00 00:00:00') \n AND jobs.closed = 'N' AND jobs.expire_on >= NOW()"; $mysqli = Database::connect(); $result = $mysqli->query($query); if (!count($result) <= 0 && !is_null($result)) { $counts['num_responses'] = $result[0]['num_responses']; } else { $counts['num_responses'] = '0'; } $query = "SELECT COUNT(referrals.id) AS num_views \n FROM referrals \n LEFT JOIN jobs ON jobs.id = referrals.job \n LEFT JOIN member_referees ON member_referees.member = referrals.member AND \n member_referees.referee = referrals.referee \n WHERE referrals.member = '" . $_SESSION['yel']['member']['id'] . "' AND \n member_referees.member = '" . $_SESSION['yel']['member']['id'] . "' AND \n referrals.view_counted = false AND \n (referrals.employed_on IS NULL OR referrals.employed_on = '0000-00-00 00:00:00') AND \n (referrals.work_commence_on IS NULL OR referrals.work_commence_on = '0000-00-00 00:00:00') AND \n (referrals.referee_acknowledged_on IS NOT NULL AND referrals.referee_acknowledged_on <> '0000-00-00 00:00:00') AND \n (referrals.referee_rejected_on IS NULL OR referrals.referee_rejected_on = '0000-00-00 00:00:00') AND \n (referrals.member_rejected_on IS NULL OR referrals.member_rejected_on = '0000-00-00 00:00:00') AND \n (referrals.employer_rejected_on IS NULL OR referrals.employer_rejected_on = '0000-00-00 00:00:00') AND \n (referrals.employer_removed_on IS NULL OR referrals.employer_removed_on = '0000-00-00 00:00:00') AND \n (referrals.replacement_authorized_on IS NULL OR referrals.replacement_authorized_on = '0000-00-00 00:00:00') AND \n (referrals.employer_agreed_terms_on IS NOT NULL AND referrals.employer_agreed_terms_on <> '0000-00-00 00:00:00') \n AND jobs.closed = 'N' AND jobs.expire_on >= NOW()"; $result = $mysqli->query($query); if (!count($result) <= 0 && !is_null($result)) { $counts['num_views'] = $result[0]['num_views']; } else { $counts['num_views'] = '0'; } $query = "SELECT COUNT(referrals.id) AS num_rewards \n FROM referrals \n LEFT JOIN jobs ON jobs.id = referrals.job \n LEFT JOIN member_referees ON member_referees.member = referrals.member AND \n member_referees.referee = referrals.referee \n WHERE referrals.member = '" . $_SESSION['yel']['member']['id'] . "' AND \n member_referees.member = '" . $_SESSION['yel']['member']['id'] . "' AND\n referrals.reward_counted = false AND \n (referrals.employer_removed_on IS NULL OR referrals.employer_removed_on = '0000-00-00 00:00:00') AND \n (referrals.employed_on IS NOT NULL AND referrals.employed_on <> '0000-00-00 00:00:00') AND \n (referrals.work_commence_on IS NOT NULL AND referrals.work_commence_on <> '0000-00-00 00:00:00') AND \n (referrals.replacement_authorized_on IS NULL OR referrals.replacement_authorized_on = '0000-00-00 00:00:00') \n AND jobs.closed = 'N' AND jobs.expire_on >= NOW()"; $result = $mysqli->query($query); if (!count($result) <= 0 && !is_null($result)) { $counts['num_rewards'] = $result[0]['num_rewards']; } else { $counts['num_rewards'] = '0'; } header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array(array('counts' => $counts)); exit;
<?php require_once dirname(__FILE__) . "/../../private/lib/utilities.php"; header('Content-type: text/xml'); $xml_dom = new XMLDOM(); $response = array(); $result = array(); $result = Job::find(array('columns' => 'employers.id, employers.name', 'joins' => 'employers ON employers.id = jobs.employer', 'match' => 'employers.active = \'Y\' AND jobs.closed = \'N\' AND jobs.expire_on >= NOW()', 'group' => 'employers.id', 'order' => 'employers.name')); $i = 0; foreach ($result as $row) { $response[$i]['id'] = $row['id']; $response[$i]['name'] = $row['name']; $i++; } $xml_array = array('employers' => array('employer' => $response)); echo $xml_dom->get_xml_from_array($xml_array);
$mysqli = Database::connect(); $result = $mysqli->query($query); if (count($result) <= 0 || is_null($result)) { echo '0'; exit; } if (!$result) { echo 'ko'; exit; } foreach ($result as $i => $row) { $result[$i]['employer'] = htmlspecialchars_decode($row['employer']); } $response = array('purchases' => array('purchase' => $result)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'confirm_payment') { $employer = new Employer($_POST['id']); $mysqli = Database::connect(); $query = "SELECT number_of_slot FROM employer_slots_purchases \n WHERE employer = '" . $employer->id() . "' AND transaction_id = '" . $_POST['txn_id'] . "' LIMIT 1"; $result = $mysqli->query($query); $employer->add_slots($result[0]['number_of_slot']); $query = "UPDATE employer_slots_purchases SET \n transaction_id = '" . $_POST['payment_id'] . "', \n purchased_on = NOW(), \n on_hold = 0 \n WHERE employer = '" . $employer->id() . "' AND transaction_id = '" . $_POST['txn_id'] . "'"; if ($mysqli->execute($query) === false) { echo 'ko'; exit; } echo 'ok'; exit;
<?php require_once dirname(__FILE__) . "/../private/lib/utilities.php"; session_start(); if (!isset($_POST['id'])) { echo "ko"; exit; //redirect_to('login.php'); } $xml_dom = new XMLDOM(); if (!isset($_POST['action'])) { $member = new Member($_POST['referee']); $response = array('resume' => $member->get()); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'delete') { if (!isset($_POST['payload'])) { echo "ko"; exit; } $member = new Member($_POST['member'], $_SESSION['yel']['member']['sid']); $xml_dom->load_from_xml($_POST['payload']); $referees = $xml_dom->get('id'); foreach ($referees as $id) { if (!$member->delete_referee($id->nodeValue)) { echo "ko"; exit; } }