function update_job()
 {
     /// get guid
     $element = $this->FMD->getOption('guid');
     // get key of guid element
     $guid = $this->clean_data($this->data[$element]['data']);
     if ($guid == false) {
         $this->set_import_error("Update Error: GUID field was blank!");
         return false;
     }
     $sql_update_values = $this->get_sql_update_values(1);
     if ($sql_update_values === false) {
         $this->set_import_error("SQL Update values are blank");
         return false;
     }
     // approval
     $element = $this->FMD->getOption('approved');
     $approved = $this->data[$element]['data'];
     if ($approved != 'N' && $approved != 'Y') {
         // get the setting from 'map fields'
         $approved = $this->FMD->getOption('default_approved');
         if ($approved != 'N' && $approved != 'Y') {
             // get the setting from Admin->Main Config
             if (JB_POSTS_NEED_APPROVAL == 'NO') {
                 $approved = 'Y';
             } else {
                 $approved = 'N';
             }
         }
     }
     // application type / get app_url
     $element = $this->FMD->getOption('app_url');
     // get key of guid element
     $app_url = $this->clean_data($this->data[$element]['data']);
     if ($app_url != false) {
         $app_type = "R";
         // redirect
     } elseif ($this->FMD->getOption('default_app_type')) {
         $app_type = $this->FMD->getOption('default_app_type');
     } else {
         $app_type = "N";
         // app_type can be: O=online R = Url, N = None,
     }
     $sql = "UPDATE `posts_table` SET   `approved`='" . jb_escape_sql($approved) . "', `app_type`='" . jb_escape_sql($app_type) . "', `app_url`='" . jb_escape_sql($app_url) . "' " . $sql_update_values . " WHERE `guid`='" . jb_escape_sql($guid) . "' LIMIT 1";
     $result = jb_mysql_query($sql);
     if (jb_mysql_affected_rows() != 1) {
         $this->set_import_error('Update Job Error: GUID does not exist [' . $guid . ']');
     }
     $this->log_entry('Updated Post | ' . $guid);
 }
function JB_update_employer_account($user_id, $admin)
{
    // Notice that password is not updated here
    $assign = array('Newsletter' => (int) $_REQUEST['Newsletter'], 'Notification1' => (int) $_REQUEST['Notification1'], 'Notification2' => (int) $_REQUEST['Notification2'], 'FirstName' => $_REQUEST['FirstName'], 'LastName' => $_REQUEST['LastName'], 'CompName' => $_REQUEST['CompName'], 'Email' => $_REQUEST['Email'], 'lang' => $_REQUEST['lang']);
    if ($admin) {
        // append admin only values
        $assign['membership_active'] = $_REQUEST['membership_active'];
        $assign['posts_balance'] = $_REQUEST['posts_balance'];
        $assign['premium_posts_balance'] = $_REQUEST['premium_posts_balance'];
        $assign['subscription_can_view_resume'] = $_REQUEST['subscription_can_view_resume'];
        $assign['subscription_can_premium_post'] = $_REQUEST['subscription_can_premium_post'];
        $assign['subscription_can_post'] = $_REQUEST['subscription_can_post'];
        $assign['can_view_blocked'] = $_REQUEST['can_view_blocked'];
    }
    $sql = "UPDATE `employers` SET " . JB_get_sql_update_values(4, "employers", "ID", $user_id, $user_id, $assign) . " WHERE ID='" . jb_escape_sql($user_id) . "'";
    JB_mysql_query($sql) or die($sql . mysql_error());
    JBPLUG_do_callback('update_employer_account', $user_id, $admin);
    return jb_mysql_affected_rows();
}
function JB_update_candidate_account($user_id, $admin)
{
    if ($_REQUEST['lang'] == '') {
        $_REQUEST['lang'] = JB_get_default_lang();
    }
    // build a list of fields that we want updated
    $assign = array('Newsletter' => (int) $_REQUEST['Newsletter'], 'Notification1' => (int) $_REQUEST['Notification1'], 'Notification2' => (int) $_REQUEST['Notification2'], 'FirstName' => $_REQUEST['FirstName'], 'LastName' => $_REQUEST['LastName'], 'Email' => $_REQUEST['Email'], 'lang' => $_REQUEST['lang']);
    if ($admin) {
        // append admin only values
        $assign['membership_active'] = $_REQUEST['membership_active'];
    }
    $sql = "UPDATE `users` SET " . JB_get_sql_update_values(5, "users", "ID", $user_id, $user_id, $assign) . " WHERE ID='" . jb_escape_sql($user_id) . "'";
    JB_mysql_query($sql) or die($sql . mysql_error());
    JBPLUG_do_callback('update_candidate_account', $user_id, $admin);
    return jb_mysql_affected_rows();
}
Exemple #4
0
$employer_id = (int) $_REQUEST['show_emp'];
if ($post_id > 0) {
    // Load the data for displaying a job post
    $JBPage = new JBJobPage($post_id);
}
JB_template_candidates_header();
$post_id = (int) $_REQUEST['post_id'];
$action = jb_alpha($_REQUEST['action']);
$posts = jb_int_array($_REQUEST['posts']);
if ($_REQUEST['delete'] != "") {
    $user_id = $_SESSION['JB_ID'];
    for ($i = 0; $i < sizeof($posts); $i++) {
        $sql = "DELETE FROM `saved_jobs` WHERE `post_id`='" . jb_escape_sql($posts[$i]) . "' AND `user_id`='" . jb_escape_sql($user_id) . "'";
        $result = JB_mysql_query($sql) or die(mysql_error());
    }
    $label['save_job_deleted'] = str_replace('%COUNT%', jb_mysql_affected_rows(), $label['save_job_deleted']);
    $JBMarkup->ok_msg($label['save_job_deleted']);
}
JB_render_box_top(99, $label['c_save_my_jobs']);
if ($_SESSION['SAVE'] != '' || $action == 'save') {
    if ($_SESSION['SAVE'] != '') {
        $post_id = $_SESSION['SAVE'];
    }
    $now = gmdate("Y-m-d H:i:s");
    $sql = "REPLACE INTO `saved_jobs` (`user_id`, `post_id`, `save_date`) VALUES ('" . $_SESSION['JB_ID'] . "','" . jb_escape_sql($post_id) . "', '{$now}') ";
    JB_mysql_query($sql) or die(mysql_error());
    $_SESSION['SAVE'] = '';
    $label["c_save_postid"] = str_replace("%POST_ID%", $post_id, $label["c_save_postid"]);
    $JBMarkup->ok_msg($label["c_save_postid"]);
}
if ($employer_id) {
Exemple #5
0
function JB_grant_request($candidate_id, $employer_id)
{
    $now = gmdate("Y-m-d H:i:s");
    $sql = "UPDATE `requests` SET request_status='GRANTED', request_date='" . $now . "' WHERE candidate_id='" . jb_escape_sql($candidate_id) . "' AND employer_id='" . jb_escape_sql($employer_id) . "'  ";
    JB_mysql_query($sql) or die(mysql_error());
    if (jb_mysql_affected_rows() == 0) {
        $sql = "SELECT request_id FROM `requests` WHERE candidate_id='" . jb_escape_sql($candidate_id) . "' AND employer_id='" . jb_escape_sql($employer_id) . "'";
        jb_add_new_request($candidate_id, $employer_id, 'GRANTED');
    }
}
Exemple #6
0
    } else {
        $status = $_REQUEST['status'];
    }
    $sql = "UPDATE `resumes_table` SET `status`='" . jb_escape_sql($status) . "' WHERE user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' AND `resume_id`='" . jb_escape_sql($resume_id) . "' AND status != '" . jb_escape_sql($status) . "' ";
    JB_mysql_query($sql) or die(mysql_error());
    $resume_data['status'] = $status;
    if (JB_mysql_affected_rows() > 0) {
        //  Update maling list, newsletter status.
        // minus 2 if suspended, plus two if active.
        // This ensures that their email opt-in prefrences are saved
        // when they become suspended, and go back to their original setting
        // when they become active
        if ($status == 'SUS') {
            $sql = "UPDATE `users` SET Newsletter=Newsletter-2, `Notification1`=`Notification1`-2, `Notification2`=Notification2-2 WHERE ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
            JB_mysql_query($sql) or die(mysql_error());
            if (jb_mysql_affected_rows() > 0) {
                // delete the resume from saved resumes
                // (Assuming that $_REQUEST['resume_id'] was already validated to be
                // owned by the logged in user
                $sql = "DELETE FROM `saved_resumes` WHERE `resume_id`='" . jb_escape_sql($_REQUEST['resume_id']) . "' ";
                JB_mysql_query($sql) or die(mysql_error());
            }
        }
        if ($status == 'ACT') {
            $sql = "UPDATE `users` SET `Newsletter`=`Newsletter`+2, `Notification1`=`Notification1`+2, `Notification2`=Notification2+2 where ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
            JB_mysql_query($sql) or die(mysql_error());
        }
    }
}
if ($resume_id != '') {
    if (!$status) {