function format_lang($mkey = null, $skey = null) { global $lang; if (empty($skey)) { $lang_v = get_lang($mkey); } else { $lang_v = get_lang($mkey, $skey); } $lang_v = str_replace("#MAX_CV#", MAX_CV, $lang_v); $lang_v = str_replace("#SITE_NAME#", SITE_NAME, $lang_v); $lang_v = str_replace("#MAX_CV_SIZE#", size_as_text(MAX_CV_SIZE), $lang_v); $lang_v = str_replace("#skin_images_path#", skin_images_path, $lang_v); $lang_v = str_replace("#BASE_URL#", BASE_URL, $lang_v); $lang_v = str_replace("#CURRENCY_NAME#", CURRENCY_NAME, $lang_v); $lang_v = str_replace("#MAX_COVER_LETTER#", MAX_COVER_LETTER, $lang_v); $lang_v = str_replace("#JOBLASTFOR#", JOBLASTFOR, $lang_v); $lang_v = str_replace("#SITE_NAME#", SITE_NAME, $lang_v); $lang_v = str_replace("#SITE_NAME#", SITE_NAME, $lang_v); $lang_v = str_replace("#MINPASS#", 6, $lang_v); $lang_v = str_replace("#MAXPASS#", 20, $lang_v); $lang_v = str_replace("#CITIZEN#", 'UK/EU', $lang_v); $lang_v = str_replace("#COUNTRY#", DEFAULT_COUNTRY, $lang_v); //ADD NEW JOB $lang_v = str_replace("#TOTAL_POST#", TEMP_TOTAL_POST, $lang_v); $lang_v = str_replace("#TOTAL_SPOTLIGHT_POST#", TEMP_TOTAL_SPOTLIGHT_POST, $lang_v); $lang_v = str_replace("#TOTAL_CV#", TEMP_TOTAL_CV, $lang_v); return $lang_v; }
$user_id = $session->get_user_id(); $employee = Employee::find_by_id($user_id); $cv_setting = new CVSetting(); $cv_setting->fk_employee_id = $user_id; $total_max_cv = CVSetting::count_all_by_employee($user_id); $smarty->assign('total_max_cv', $total_max_cv); function check_total() { global $total_max_cv, $session; if ($total_max_cv >= MAX_CV) { $session->message("<div class='error'>" . format_lang('errormsg', 52) . "</div>"); redirect_to(BASE_URL . "curriculum_vitae/"); die; } } $lang["max_file_size"] = size_as_text(MAX_CV_SIZE); //Are you sure you want to do this? You will lose this CV. switch ($action) { case "add": check_total(); if (isset($_POST['bt_cv_add'])) { $_SESSION['addcv']['name'] = $cv_setting->cv_title = $_POST['txt_title']; $_SESSION['addcv']['desc'] = $cv_setting->cv_description = $_POST['txt_desc']; $cv_setting->fk_employee_id = $user_id; $cv_setting->attach_file($_FILES['txt_file_cv']); $cv = array(); $cv = $_FILES['txt_file_cv']; if ($cv_setting && $cv_setting->save()) { destroy_my_session(); $session->message("<div class='success'>" . format_lang('success', 'cv_save_success') . "</div>"); $email_template = get_lang('email_template', 'save_cv');
public function attach_file($file) { $allowed_files = split(",", ALLOWED_FILE_TYPES_IMG); // Perform error checking on the form parameters if (!$file || empty($file) || !is_array($file)) { // error: nothing uploaded or wrong argument usage $this->errors[] = "No file was uploaded."; //return false; } elseif ($file['error'] != 0) { // error: report what PHP says went wrong $this->errors[] = $this->upload_errors[$file['error']]; //return false; } else { $ext = end(explode(".", basename($file['name']))); $ext = strtolower($ext); if (!in_array($ext, $allowed_files)) { $this->errors[] = " File " . basename($file['name']) . " is not allowed"; } // Set object attributes to the form parameters. $this->temp_path = $file['tmp_name']; $this->filename = basename($file['name']); //$this->company_logo= basename($file['name']); $this->exe = $ext; $this->type = $file['type']; $this->size = $file['size']; if ($file['size'] > MAX_CV_SIZE) { $this->errors[] = "File size must not be bigger than " . size_as_text(MAX_CV_SIZE); } return true; } }
$i++; } $smarty->assign('my_cv', $cv_t); } //get all coving letter $my_letters = CovingLetter::employee_find_all($user_id); if (is_array($my_letters) and !empty($my_letters)) { $cl_t = array(); $i = 1; foreach ($my_letters as $my_letter) { if ($my_letter->is_defult == 'Y') { $_SESSION['apply']['cover_letter'] = empty($_SESSION['apply']['cover_letter']) ? $my_letter->cl_text : safe_output($_SESSION['apply']['cover_letter']); } $cl_t[$i]["id"] = $my_letter->id; $cl_t[$i]["cl_title"] = $my_letter->cl_title; $cl_t[$i]["cl_text"] = $my_letter->cl_text; $cl_t[$i]["is_defult"] = empty($_SESSION['apply']['which_letter']) ? 'N' : $my_letter->is_defult; $i++; } $smarty->assign('my_letters', $cl_t); } } //end of logged in user } else { //$message = "<div class='error'>Invalid URL Request</div>"; } ///end $smarty->assign('cv_max_size', size_as_text(MAX_CV_SIZE)); $smarty->assign('lang', $lang); $smarty->assign('message', $message); $smarty->assign('rendered_page', $smarty->fetch('apply.tpl'));
<?php require_once "../initialise_files.php"; include_once "sessioninc.php"; //unset($_SESSION['loc']); $smarty->assign('max_cv', size_as_text(MAX_CV_SIZE)); //$smarty->assign( 'files_allowed', $country_t ); //when button is press if (isset($_POST['bt_register'])) { $_SESSION['Employer_Text'] = array(); $employer = new Employer(); $employer->company_name = $_SESSION['Employer_Text']['company_name'] = ucfirst($_POST['txt_company_name']); $employer->var_name = $employer->mod_write_check($_POST['txt_company_name']); $employer->contact_name = $_SESSION['Employer_Text']['conatc_name'] = ucfirst($_POST['txt_contact_name']); $employer->site_link = $_SESSION['Employer_Text']['site'] = $_POST['txt_site']; $employer->company_desc = $_SESSION['Employer_Text']['desc'] = allowedTags($_POST['txt_company_desc']); $employer->email_address = $_SESSION['Employer_Text']['email'] = $_POST['txt_email']; $employer->username = $_SESSION['Employer_Text']['username'] = $_POST['txt_username']; $employer->passwd = $_SESSION['Employer_Text']['pass'] = $reg_pass = $_POST['txt_pass']; $employer->confirm_password = $_SESSION['Employer_Text']['confirm_pass'] = $_POST['txt_confirm_pass']; $employer->address = $_SESSION['Employer_Text']['address'] = $_POST['txt_address']; $employer->address2 = $_SESSION['Employer_Text']['address2'] = $_POST['txt_address2']; $employer->city = $_SESSION['loc']['citycode'] = $_POST['txtcity']; $employer->county = $_SESSION['loc']['countycode'] = $_POST['txtcounty']; $employer->state_province = $_SESSION['loc']['stateprovince'] = $_POST['txtstateprovince']; $employer->country = $_SESSION['loc']['country'] = $_POST['txt_country']; $employer->post_code = $_SESSION['Employer_Text']['pcode'] = $_POST['txt_pcode']; $employer->phone_number = $_SESSION['Employer_Text']['tel_no'] = $_POST['txt_tele']; $employer->terms = true; if ($_FILES['txt_logo']['error'] == 0) { $employer->attach_file($_FILES['txt_logo']);