public function actionSignup() { if (isset($_POST['register'])) { if (trim($_POST['compName']) == "") { $_SESSION['compName'] = $_POST['compName']; $_SESSION['error'] = "Please provide your company or individual name"; header("location: {$_SERVER['HTTP_REFERER']}"); exit; } if (trim($_POST['password']) == "") { $_SESSION['error'] = "Password field cannot be blank!"; header("location: {$_SERVER['HTTP_REFERER']}"); exit; } if ($_POST['location'] == "") { $_SESSION['error'] = "Specify your location"; header("location: {$_SERVER['HTTP_REFERER']}"); exit; } if (trim($_POST['email']) == "" || filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) == false) { $_SESSION['email'] = $_POST['email']; $_SESSION['error'] = "The email you provided was invalid"; header("location: {$_SERVER['HTTP_REFERER']}"); exit; } if (!ctype_alnum($_POST['location'])) { $_SESSION['error'] = "Location is NOT sensible!"; header("location: {$_SERVER['HTTP_REFERER']}"); exit; } if (User::checker($_POST['email']) != 0) { $_SESSION['error'] = "Sorry, a user already exists with the email you provided. Forgot your password? <a href='#'>Get a new one</a>"; header("location: {$_SERVER['HTTP_REFERER']}"); exit; } if (trim($_POST['tel']) != "") { if (!isPhoneNumber($_POST['tel'])) { $_SESSION['tel'] = $_POST['tel']; $_SESSION['error'] = "Invalid phone number"; header("location: {$_SERVER['HTTP_REFERER']}"); exit; } } $x = new Employer($_POST); $x->utype = $this->user_type; if (!$x->create()) { //Log the next line and simply show an error message $_SESSION['error'] = "Oops! Something went wrong!"; } else { UserController::redirectToLogin("Account has been created. Please login to continue"); exit; } } $type = $this->user_type; //passed to the view for toggling include __VIEWPATH__ . "employer/signup.php"; }
/** * Add a job posting to the database. * @param string job title * @param string description * @param Array categories id * @param int 1 if public; 0 otherwise. * @param string Closing date for this job post, mysql TIMESTAMP format * @precondition ATutor Mailer class imported. */ function addJob($title, $description, $categories, $is_public, $closing_date) { require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php'; global $addslashes, $db, $msg, $_config, $_base_href; if ($_SESSION['jb_employer_id'] < 1) { $msg->addError(); //authentication error exit; } else { include AT_JB_INCLUDE . 'Employer.class.php'; $employer = new Employer($_SESSION['jb_employer_id']); $employer_id = $employer->getId(); } $title = $addslashes($title); $description = $addslashes($description); $is_public = isset($is_public) ? 1 : 0; $closing_date = $addslashes($closing_date); $approval_state = $_config['jb_posting_approval'] == 1 ? AT_JB_POSTING_STATUS_UNCONFIRMED : AT_JB_POSTING_STATUS_CONFIRMED; $sql = 'INSERT INTO ' . TABLE_PREFIX . "jb_postings (employer_id, title, description, is_public, closing_date, created_date, revised_date, approval_state) VALUES ({$employer_id}, '{$title}', '{$description}', {$is_public}, '{$closing_date}', NOW(), NOW(), {$approval_state})"; $result = mysql_query($sql, $db); $posting_id = mysql_insert_id(); //add to posting category table if (!empty($categories)) { foreach ($categories as $id => $category) { $category = intval($category); $sql = 'INSERT INTO ' . TABLE_PREFIX . "jb_posting_categories (posting_id, category_id) VALUES ({$posting_id}, {$category})"; mysql_query($sql, $db); //send out notification if the person is subscribed to the category. $sql = 'SELECT m.member_id, m.email FROM ' . TABLE_PREFIX . 'jb_category_subscribes cs LEFT JOIN ' . TABLE_PREFIX . "members m ON cs.member_id=m.member_id WHERE category_id={$category}"; $result = mysql_query($sql, $db); $post_link = $_base_href . AT_JB_BASENAME . 'view_post.php?jid=' . $posting_id; if ($result) { while ($row = mysql_fetch_assoc($result)) { $mail = new ATutorMailer(); $mail->AddAddress($row['email'], get_display_name($row['member_id'])); $body = _AT('jb_subscription_msg', $title, $this->getCategoryNameById($category), $post_link); $body .= "\n\n"; $body .= _AT('jb_posted_by') . ": " . htmlentities_utf8($employer->getCompany()) . "\n"; $mail->FromName = $_config['site_name']; $mail->From = $_config['contact_email']; $mail->Subject = _AT('jb_subscription_mail_subject'); $mail->Body = $body; if (!$mail->Send()) { $msg->addError('SENDING_ERROR'); } unset($mail); } } } } if (!$result) { //TODO: db error message $msg->addError(); } }
/** * Consolidates the "from" and "to" fields by filling in data model objects from database. * In student mode, "from" will be the student model and "to" will be the employer model. * In employer mode, it will be wise versa. * @return boolean - true if the models are set successfully * @throws CException -if from and to fields are not valid or type is not a valid type */ private function _setFromAndTo() { if (!$this->hasErrors($this->from) && !$this->hasErrors($this->to)) { $criteria = new CDbCriteria(); $criteria->with = array('user' => array('select' => 'email, first_name, last_name', 'joinType' => 'INNER JOIN')); $criteria->together = true; switch ($this->type) { case self::TYPE_STU: $this->fromObj = Student::model()->findByPk($this->from, $criteria); $this->toObj = Employer::model()->findByPk($this->to, $criteria); $this->interviewObj = InterviewStudentJobTitle::model()->findByAttributes(array('stu_job_id' => $this->stu_job_id, 'employer_id' => $this->to, 'active' => 1)); break; case self::TYPE_EMP: $this->fromObj = Employer::model()->findByPk($this->from, $criteria); $this->toObj = Student::model()->findByPk($this->to, $criteria); //stu_job_id //$this->interviewObj=InterviewStudentJobTitle::model()->findByAttributes(array('stu_job_id'=>$this->stu_job_id,'employer_id'=>$this->from,'active'=>1)); $this->interviewObj = InterviewStudentJobTitle::model()->findByAttributes(array('employer_id' => $this->employer_id, 'stu_job_id' => $this->to)); break; default: throw new CException('Invalid type.'); break; } if ($this->fromObj != null && $this->toObj != null && $this->interviewObj != null) { return true; } else { return false; } } else { throw new CException('Cannot set From and To fields.'); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new CertificationForm(); $model->certification->provider_id = Yii::app()->user->id; $model->certification->provider = Employer::model()->findByPk(Yii::app()->user->id, array('select' => 'company_name'))->company_name; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Certification']) && isset($_POST['PostItem'])) { $model->postItem->attributes = $_POST['PostItem']; $model->certification->attributes = $_POST['Certification']; $fileUpload = CUploadedFile::getInstance($model->certification, 'cert_image'); if ($fileUpload !== null) { //$model->certification->removeCertImage(); $model->certification->cert_image = $fileUpload; } if ($model->validate() && $model->save()) { if ($fileUpload !== null) { $model->certification->cert_image->saveAs($model->certification->getCertImagePath()); } Yii::app()->user->setFlash('success', Yii::t('app', 'msg.success.create_certificate')); $this->redirect(array('view', 'id' => $model->postItem->post_item_id)); } /* if($model->validate()&&$model->save()) $this->redirect(array('view','id'=>$model->postItem->post_item_id)); */ } $this->render('create', array('model' => $model)); }
public function getUserProfileMenu($controller) { if ($this->isGuest) { return false; } else { $userGroup = intval($this->getState('user_group_id', 0)); if ($userGroup === Student::USER_GROUP_ID) { return Student::getProfileNavItems($controller); } elseif ($userGroup === Employer::USER_GROUP_ID) { return Employer::getProfileNavItems($controller); } else { return array(); } } }
public function doActivate(Request $request) { $messages = ['username.exists' => 'Username Does not exists in our System']; $validator = Validator::make($data = $request->all(), ['username' => 'exists:employers,username'], $messages); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $employer = Employer::where('username', $request->username)->first(); if ($employer->confirmation_code == $employer->confirmation_code) { $employer->status = 1; $employer->confirmation_code = ''; $employer->save(); return Redirect::route('employer.login')->with('message', 'Youre account is activated <br>Now Login with your username and password'); } else { return Redirect::back()->withInput()->with('message', 'The OTP Doesnot match!.'); } }
private function _verifyUser() { if (Yii::app()->user->getState('is_verified') != '1') { $isVerified = "Check your e-mail for a verification message"; if (Yii::app()->user->isEmployer()) { $isVerified = Employer::notVerifiedText(); } else { if (Yii::app()->user->isStudent()) { $isVerified = Student::notVerifiedText(); } } Yii::app()->user->logout(); // $model=new LoginForm; echo $this->render('application.modules.account.views.common.login', array('model' => $model, 'isVerified' => $isVerified), true); Yii::app()->end(); } }
/** @var $user User * @return bool */ public static function emailEmployerVerified($user) { $employer = Employer::model()->findByPk($user->user_id); $mail = new YiiMailer('employerVerified', array('employer' => $employer, 'user' => $user)); $mail->render(); $mail->From = Yii::app()->params['nonReplyEmail']; $mail->FromName = Yii::app()->name; $mail->Subject = Yii::app()->name . ' - Employer account verified'; $mail->AddAddress(YII_DEBUG ? Yii::app()->params['adminEmail'] : $user->email); if ($mail->Send()) { $mail->ClearAddresses(); Yii::log("Mail sent via " . Yii::app()->params['nonReplyEmail'], 'log'); Yii::log("Mail sent successfully to " . (YII_DEBUG ? Yii::app()->params['adminEmail'] : $user->email), 'log'); return true; } else { Yii::log("Email error: " . $mail->getError(), 'log'); return false; } }
/** * Authenticates a user with either a username or email. * @return int error code. * */ public function authenticate() { //query the db with the input username by checking the username and email $user = User::model()->with('userGroup')->together()->find('is_active="1" AND (username=:username OR email=:username)', array(':username' => $this->username)); if ($user === null) { $this->errorCode = self::ERROR_UNKNOWN_IDENTITY; } else { //validate the password if (crypt($this->password, $user->password) !== $user->password) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->errorCode = self::ERROR_NONE; $this->username = $user->username; $this->_id = $user->user_id; $this->_email = $user->email; $this->_user = $user; //persists the user info to the session $user->setState($this); if (Yii::app()->endName == 'front') { //saves the profile sidebar nav items according to user group if ($user->user_group_id == Student::USER_GROUP_ID) { $this->setState('mainNavItems', Student::getMainNavItems()); $this->setState('returnUrl', Yii::app()->createAbsoluteUrl('account/profile/index')); } else { if ($user->user_group_id == Employer::USER_GROUP_ID) { $this->setState('mainNavItems', Employer::getMainNavItems()); $this->setState('returnUrl', Yii::app()->createAbsoluteUrl('resume/employer/index')); } else { $this->errorCode = self::ERROR_INVALID_USER_GROUP; } } } else { if (!UserGroup::allowBackendAccess($user->user_group_id)) { $this->errorCode = self::ERROR_INVALID_USER_GROUP; } else { $this->_checkBackendAccessGroup(); } } } } return $this->errorCode; }
public function save() { if (Yii::app()->user->isEmployer()) { $this->workshop->company = Employer::model()->findByPk(Yii::app()->user->id)->company_name; } //start a transaction $transaction = Yii::app()->db->beginTransaction(); try { if ($this->postItem->save()) { if ($this->workshop->save(false, null, $this->postItem)) { $transaction->commit(); return true; } } $transaction->rollback(); return false; } catch (Exception $e) { $transaction->rollback(); return false; } }
public function authenticate() { $username = strtolower($this->username); if ($this->userType == 'Employer') { $user = Employer::model()->find('LOWER(username)=?', array($username)); } else { $user = User::model()->find('LOWER(username)=?', array($username)); } if ($user === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } else { if (!$user->hashPassword($this->password)) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_id = $user->id; $this->setState('userType', $this->userType); $this->username = $user->username; $this->errorCode = self::ERROR_NONE; } } return $this->errorCode == self::ERROR_NONE; }
<?php require_once "../initialise_files.php"; include_once "sessioninc.php"; $employer = new Employer(); $smarty->assign('employer_id', $_POST['employer_id']); ###################### DELETE #################################### if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "delete") { $employer->id = (int) $_GET['id']; $employer->delete(); } if (isset($_POST['delete_all']) && $_POST['employer_id'] != "" && sizeof($_POST['employer_id']) != 0) { foreach ($_POST['employer_id'] as $key => $value) { if ($value != "") { $employer->id = (int) $value; if ($employer->delete()) { $success = true; } } } if ($success) { $session->message("<div class='success'>Employee(s) has been deleted </div>"); redirect_to($_SERVER['PHP_SELF']); die; } } ###################### deactivate #################################### if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "deactivate") { $employer->id = $_GET['id']; $employer->deactive_user(); }
$message = str_replace('%temporary_password%', $new_password, $message); $message = str_replace('%protocol%', $GLOBALS['protocol'], $message); $message = str_replace('%root%', $GLOBALS['root'], $message); $subject = "Welcome To Yellow Elevator!"; $headers = 'From: YellowElevator.com <*****@*****.**>' . "\n"; mail($_POST['email_addr'], $subject, $message, $headers); // $handle = fopen('/tmp/email_to_'. $_POST['email_addr']. '.txt', 'w'); // fwrite($handle, 'Subject: '. $subject. "\n\n"); // fwrite($handle, $message); // fclose($handle); } echo 'ok'; 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;
echo 'ko'; exit; } foreach ($result as $i => $row) { $result[$i]['employer'] = htmlspecialchars_decode($row['employer']); } $response = array('employers' => array('employer' => $result)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'reset_password') { $new_password = generate_random_string_of(6); $data = array(); $data['password'] = md5($new_password); $employer = new Employer($_POST['id']); if (!$employer->update($data, true)) { echo "ko"; exit; } $query = "SELECT email_addr FROM employers WHERE id = '" . $_POST['id'] . "' LIMIT 1"; $mysqli = Database::connect(); $result = $mysqli->query($query); $lines = file(dirname(__FILE__) . '/../private/mail/employer_password_reset_admin.txt'); $message = ''; foreach ($lines as $line) { $message .= $line; } $message = str_replace('%user_id%', $_POST['id'], $message); $message = str_replace('%temporary_password%', $new_password, $message); $subject = "Employer Password Reset";
public function actionProfile() { $id = Yii::app()->user->id; if (Yii::app()->user->userType == 'User') { $model = User::model()->findByPk($id); $table = 'User'; $img = 'photo'; $renderPath = 'registration'; } else { if (Yii::app()->user->userType == 'Employer') { $model = Employer::model()->findByPk($id); $table = 'Employer'; $img = 'logo'; $renderPath = 'employerRegistration'; } } if (isset($_POST[$table])) { $_POST[$table][$img] = $model[$img]; $model->attributes = $_POST[$table]; $uploadedFile = CUploadedFile::getInstance($model, $img); if ($model->save()) { if (!empty($uploadedFile)) { $uploadedFile->saveAs(Yii::app()->basePath . Yii::app()->params['uploadPath'] . strtolower(Yii::app()->user->userType) . '/' . $uploadedFile->getName()); $model[$img] = $uploadedFile->getName(); $model->save(false); } Yii::app()->user->setFlash('success', "Profile Updated !"); $this->render($renderPath, array('model' => $model)); Yii::app()->end(); } } $this->render($renderPath, array('model' => $model)); }
$_SESSION['error'] = "Unable to complete request"; } header("location: " . $_SERVER['REQUEST_URI']); exit; } ?> <div> <?php if (isset($_SESSION['error'])) { echo "<div class='feedback error'>{$_SESSION['error']}</div>"; unset($_SESSION['error']); } if (!empty($total > 0)) { foreach ($apps['result'] as $app) { $job = Job::getById($app['jobID']); $employer = Employer::getUser($job->postedBy); $jobExpiry = dateToYMD($job->expiryDate, "Y-m-d"); $jobUrl = "project/" . $job->jobId . "/" . cleanUrl($job->title); ?> <form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?> " method="post"> <div class="feed-element row rug-p"> <h3><a href="<?php echo $jobUrl; ?> "><?php echo $job->title; ?> </a></h3>
$smarty->assign('career', $career_name); //experience $experiences = Experience::find_by_id($jobs->fk_experience_id); $smarty->assign('experiences', $experiences); $experience_name = !empty($experiences) ? $experiences->experience_name : format_lang('not_provided'); $smarty->assign('experience_var_name', $experiences->var_name); $smarty->assign('experience', $experience_name); $smarty->assign('spotlight', $jobs->spotlight); if (!empty($jobs->job_salary) && !empty($jobs->salaryfreq)) { $job_salary = $jobs->job_salary . format_lang('per') . $jobs->salaryfreq; } else { $job_salary = format_lang('not_provided'); } $smarty->assign('job_salary', $job_salary); //$smarty->assign('salaryfreq', $jobs->salaryfreq ); $employer = Employer::find_by_id($jobs->fk_employer_id); $company_name = $employer->company_name; $employer_var_name = $employer->var_name; $smarty->assign('employer_var_name', $employer_var_name); $smarty->assign('company_name', $company_name); $smarty->assign('company_logo', $employer->company_logo); $smarty->assign('contact_name', $jobs->contact_name); $telephone = !empty($jobs->contact_telephone) ? $jobs->contact_telephone : format_lang('not_provided'); $smarty->assign('contact_telephone', $telephone); $link = !empty($jobs->site_link) ? $jobs->site_link : format_lang('not_provided'); $smarty->assign('site_link', $link); //$smarty->assign('poster_email', $jobs->poster_email ); $smarty->assign('views_count', $jobs->views_count); $smarty->assign('apply_count', $jobs->apply_count); $start_date = !empty($jobs->start_date) ? $jobs->start_date : format_lang('not_provided'); $smarty->assign('start_date', $start_date);
public function actionVerifyEmployers() { $model = new Employer('search'); $model->unsetAttributes(); if (isset($_GET['Employer'])) { $model->attributes = $_GET['Employer']; } $dataProvider = $model->searchInactive(); $this->render('verifyEmployers', array('model' => $model, 'dataProvider' => $dataProvider)); }
} $i++; } $query .= ")"; $mysqli = Database::connect(); if (!$mysqli->execute($query)) { echo "ko"; exit; } echo "ok"; exit; } if ($_POST['action'] == 'extend') { $mysqli = Database::connect(); // check whether subscription has expired $employer = new Employer($_POST['employer']); if ($employer->has_free_job_postings() === false) { // check whether employer has paid job postings? if ($employer->has_paid_job_postings() === false) { // check whether subscription has expired $result = $employer->get_subscriptions_details(); if ($result[0]['expired'] < 0 || $result[0]['subscription_suspended'] != '0') { echo '-2'; exit; } } else { $employer->used_paid_job_posting(); } } else { $employer->used_free_job_posting(); }
">View Profile</a></span> </p> </div> <?php } echo "<p class='pager'></p>"; echo $pageCtrls; echo "</p>"; } else { echo "<div class='blank'>No match found</div>"; } } else { if ($numResults > 0) { foreach ($matches['result'] as $match) { $url = "project/" . $match->jobId . "/" . cleanUrl($match->title); $employer = Employer::getUser($match->getEmployer()); ?> <div class="feed-element"> <h4><a href="<?php echo $url; ?> "> <?php echo truncate($match->title, 20, "...", " "); ?> </a> </h4> <p style="font-size: .8em; color: #c8c8c8;"><b><?php echo $employer->fullName; ?>
$company[$i]['name'] = $names; $company[$i]['employer_id'] = $employer_id; $company[$i]['var_name'] = $employer->var_name; } $i++; } $smarty->assign('company', $company); } $html_title = SITE_NAME . " - " . format_lang('page_title', 'BrowseBYCompany'); //$meta_description = ""; $smarty->assign('message', $message); $smarty->assign('rendered_page', $smarty->fetch('company.tpl')); break; case "job_by_company": $company_id = $company_name = $company_url[1]; $company = Employer::find_by_var_name($company_name); $id = $company->id; $num_rows = sizeof(Job::job_by_employer($id)); $page_no = !empty($company_url[2]) ? (int) $company_url[2] : 1; $per_page = JOBS_PER_SEARCH <= $num_rows ? JOBS_PER_SEARCH : $num_rows; $per_page = $per_page == 0 ? 1 : $per_page; $total_count = $num_rows; $smarty->assign('total_count', $total_count); $smarty->assign('page', $page_no); $pagination = new Pagination($page_no, $per_page, $total_count); $smarty->assign('previous_page', $pagination->previous_page()); $smarty->assign('has_previous_page', $pagination->has_previous_page()); $smarty->assign('total_pages', $pagination->total_pages()); $smarty->assign('has_next_page', $pagination->has_next_page()); $smarty->assign('next_page', $pagination->next_page()); $offset = $pagination->offset();
default: $handle = fopen($error_log_file, 'a'); fwrite($handle, date('Y-m-d H:i:s') . ' Invalid pass-thru variable found.' . "\n"); fclose($handle); echo 'ko - Invalid pass-thru variable found.'; exit; } } } else { $handle = fopen($error_log_file, 'a'); fwrite($handle, date('Y-m-d H:i:s') . ' Invalid _POST[custom] count.' . "\n"); fclose($handle); echo 'ko - Invalid _POST[custom] count.'; exit; } $employer = new Employer($employer_id); $mysqli = Database::connect(); // get the billing email $query = "SELECT branches.country \n FROM branches \n INNER JOIN employees ON branches.id = employees.branch \n INNER JOIN employers ON employees.id = employers.registered_by \n WHERE employers.id = '" . $employer_id . "' LIMIT 1"; $result = $mysqli->query($query); $billing_email = '*****@*****.**'; if (!is_null($result[0]['country']) && !empty($result[0]['country'])) { $billing_email = 'billing.' . strtolower($result[0]['country']) . '@yellowelevator.com'; } // 1. Notify ourselves about Paypal Transaction $lines = file('../private/mail/paypal_payment_notification.txt'); $message = ''; foreach ($lines as $line) { $message .= $line; } $message = str_replace('%txn_id%', $txn_id, $message);
<?php echo $form->redactorRow($model->postItem, 'description', array('height' => '250px', 'options' => array('source' => false, 'paragraph' => true, 'buttons' => array('formatting', '|', 'bold', 'italic', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'image', 'link', '|', 'alignment', '|', 'horizontalrule')))); ?> <?php echo $form->hiddenField($model->postItem, 'excerpt'); ?> <?php if (!$isEmp) { ?> <?php echo $form->typeAheadRow($model->workshop, 'company', array('source' => Employer::getAllCompanies(), 'items' => 4), array('class' => 'span5')); ?> <?php } ?> <?php echo $form->textFieldRow($model->workshop, 'website', array('class' => 'span5', 'maxlength' => 100)); ?> <?php echo $form->fileFieldRow($model, 'workshopFile'); ?>
if ($_POST['action'] == 'get_employer_info') { $criteria = array('columns' => "employers.id, employers.name, employers.contact_person, employers.email_addr", 'joins' => "employers ON employers.id = invoices.employer", 'match' => "invoices.id = " . $_POST['id'], 'limit' => "1"); $result = Invoice::find($criteria); if ($result === false || is_null($result) || count($result) <= 0) { echo '0'; exit; } $response = array('employer' => $result); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'resend') { $invoice = Invoice::get($_POST['id']); $invoice[0]['items'] = Invoice::getItems($_POST['id']); $employer = new Employer($invoice[0]['employer']); $recipients = $employer->getEmailAddress(); if (isset($_POST['recipients'])) { if (!empty($_POST['recipients'])) { $recipients = str_replace(';', ',', $_POST['recipients']); } } $branch = $employer->getAssociatedBranch(); $sales = 'sales.' . strtolower($branch[0]['country']) . '@yellowelevator.com'; $branch[0]['address'] = str_replace(array("\r\n", "\r"), "\n", $branch[0]['address']); $branch['address_lines'] = explode("\n", $branch[0]['address']); $currency = Currency::getSymbolFromCountryCode($branch[0]['country']); $amount_payable = 0.0; foreach ($invoice[0]['items'] as $i => $item) { $amount_payable += $item['amount']; $items[$i]['amount'] = number_format($item['amount'], 2, '.', ', ');
$success = $invoice->package_status == "Completed" ? true : false; $smarty->assign('success', $success); $payment_status = $invoice->package_status; $smarty->assign('payment_status', $payment_status); $payment_method = empty($invoice->payment_method) ? "None" : $invoice->payment_method; $smarty->assign('payment_method', $payment_method); $payment_date = "on " . $invoice->payment_method; $smarty->assign('payment_date', $payment_date); $invoice_no = $invoice->id; $smarty->assign('invoice_no', $invoice_no); $invoice_date = strftime(DATE_FORMAT, strtotime($invoice->invoice_date)); $smarty->assign('invoice_date', $invoice_date); $payment_date = $invoice->processed_date == 'null' || $invoice->processed_date == "0000-00-00 00:00:00" ? "" : strftime(DATE_FORMAT, strtotime($invoice->processed_date)); $smarty->assign('payment_date', $payment_date); ///$invoice_to $emp = Employer::find_by_username($username); $invoice_to = $emp->address(); $invoice_to = str_replace(":", "<br />", $invoice_to); $name = $emp->full_name(); $invoice_to = $name . "<br />" . $invoice_to; $smarty->assign('invoice_to', $invoice_to); $payment_to = "Jobberland<br />Address1 <br />Address1<br />Code"; $smarty->assign('payment_to', $payment_to); //item $package = Package::find_by_id($invoice->fk_package_id); $description = $package->package_desc; $smarty->assign('description', $description); $package_name = $package->package_name; $smarty->assign('package_name', $package_name); $qty = $package->package_job_qty; $smarty->assign('qty', $qty);
<?php require_once dirname(__FILE__) . "/../private/lib/utilities.php"; /* Return OK if the id and password provided match. Return 401 if the id and password provided do not match. Return 401 & insecure if this page is being called from non-SSL. */ if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { if (isset($_SERVER['PHP_AUTH_USER'])) { $id = $_SERVER['PHP_AUTH_USER']; $password = md5($_SERVER['PHP_AUTH_PW']); $mysqli = Database::connect(); if (Employer::simple_authenticate($mysqli, $id, $password)) { header('HTTP/1.0 200 OK'); exit; } } header('WWW-Authenticate: Basic realm="Yellow Elevator"'); header('HTTP/1.0 401 Unauthorized'); exit; } else { header('HTTP/1.0 401 Unauthorized'); echo 'insecure'; exit; }
$smarty->assign('has_previous_page', $pagination->has_previous_page()); $smarty->assign('total_pages', $pagination->total_pages()); $smarty->assign('has_next_page', $pagination->has_next_page()); $smarty->assign('next_page', $pagination->next_page()); $offset = $pagination->offset(); $sql = " SELECT * FROM " . TBL_JOB; $sql .= " LIMIT {$per_page} "; $sql .= " OFFSET {$offset} "; $lists = Job::find_by_sql($sql); $manage_lists = array(); if ($lists && is_array($lists)) { $i = 1; foreach ($lists as $list) { unset($employer); if (!empty($list->fk_employer_id) && $list->fk_employer_id != 0) { $employer = Employer::find_by_id($list->fk_employer_id); } $manage_lists[$i]['id'] = $list->id; $manage_lists[$i]['job_title'] = $list->job_title; $manage_lists[$i]['spotlight'] = $list->spotlight == "Y" ? "Spotlight Job" : "Standard Job"; $manage_lists[$i]['created_at'] = strftime(DATE_FORMAT, strtotime($list->created_at)); $manage_lists[$i]['employer_name'] = empty($employer) ? 'Employer not found' : $employer->full_name(); $manage_lists[$i]['employer_id'] = $employer->id; $manage_lists[$i]['employer_username'] = $employer->username; $manage_lists[$i]['views_count'] = $list->views_count; $manage_lists[$i]['apply_count'] = $list->apply_count; $manage_lists[$i]['is_active'] = $list->is_active == "Y" ? "Active" : "Not Active"; $manage_lists[$i]['job_status'] = $list->job_status; $i++; } $smarty->assign('manage_lists', $manage_lists);
if ($job->active_job_by_user()) { $session->message("<div class='success'>" . format_lang('success', 'activated_job') . "</div>"); } else { $session->message("<div class='error'>" . format_lang('error', 'activated_job') . "</div>"); } } else { if ($_GET['action'] == "delete" && isset($_GET['id'])) { if ($job->delete_by_user()) { $session->message("<div class='success'>" . format_lang('success', 'delete_job') . "</div>"); } else { $session->message("<div class='error'>" . format_lang('error', 'delete_job') . "</div>"); } } else { if ($_GET['action'] == "clone" && isset($_GET['id'])) { //$user_id = $session->get_user_id(); $employer = Employer::find_by_id($user_id); $total_post = $employer->total_job_post(); $total_spotlight_post = $employer->total_spotlight_job_post(); $job = new Job(); $job->fk_employer_id = (int) $user_id; $job->id = $id; $job = $job->clone_job($job_id, $user_id); $job->views_count = 0; $job->apply_count = 0; $job->created_at = strftime(" %Y-%m-%d %H:%M:%S ", time()); $job->modified = strftime(" %Y-%m-%d %H:%M:%S ", time()); unset($job->id); if (FREE_SITE == "N" || FREE_SITE == "0" || FREE_SITE == false) { //this is spotlight if ($job->spotlight == "Y") { if ($total_spotlight_post <= 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]['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; }
$smarty->assign('is_validated', $validated); if (isset($_POST['bt_email'])) { $error = array(); $email_address = $_POST['txt_email_address']; $con_email = $_POST['txt_confirm_email_address']; if (!check_email($email_address)) { $error[] = format_lang('error', 'incorrect_format_email'); } $email_found = Employer::check_email($email_address); if ($email_found) { $error[] = format_lang('error', 'email_already_existed'); } if (sizeof($error) == 0) { $user = Employer::change_email_address($username, $email_address); if ($user) { $change_key = Employer::change_key($username); if ($change_key) { $mess = "<p>To confirm your profile addition, please click the link below. Or, \r\n\t\t\t\t\t\t\t\tif the link is not clickable, copy and paste it into address bar of your \r\n\t\t\t\t\t\t\t\tweb browser, to directly access it.</p><p> </p>"; $mess .= "<p>#Link#/confirm_reg/{$reg_key}/</p><p> </p>"; $mess .= "<p>If you still have the final step of the registration wizard open, \r\n\t\t\t\t\tyou can input your confirmation code on that screen.</P><p> </p>"; $mess .= "<p>Your confirmation code is: {$reg_key}</p><p> </p>"; } $message = "<div class='success'>" . format_lang('success', 'update_email') . "</div>"; } else { $message = "<div class='error'>" . format_lang('errormsg', 61) . "</div>"; } } else { $message = "<div class='error'> \r\n\t\t\t\t\t" . format_lang('following_errors') . "\r\n\t\t\t\t<ul> <li />"; $message .= join(" <li /> ", $error); $message .= " </ul> \r\n\t\t\t\t\t </div>"; }