Esempio n. 1
0
function JB_delete_employer($id)
{
    $sql = "SELECT * from `profiles_table` WHERE `user_id`='" . jb_escape_sql($id) . "'";
    $result = JB_mysql_query($sql) or die(mysql_error());
    $row = mysql_fetch_array($result, MYSQL_ASSOC);
    // delete profile, if exists
    if ($row['profile_id'] != '') {
        JB_delete_profile($row['profile_id']);
    }
    // get all the posts and delete them
    $sql = "SELECT * from `posts_table` WHERE `user_id`='" . jb_escape_sql($id) . "'";
    $result = JB_mysql_query($sql) or die(mysql_error());
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        JB_delete_post($row['post_id']);
        $sql = "DELETE FROM `saved_jobs` WHERE `post_id`='" . jb_escape_sql($row['post_id']) . "'";
        JB_mysql_query($sql) or die(mysql_error());
    }
    JB_finalize_post_updates();
    JB_delete_employer_files($id);
    // delete requests..
    $sql = "DELETE FROM `requests` WHERE `employer_id`='" . jb_escape_sql($id) . "'";
    JB_mysql_query($sql) or die(mysql_error());
    // delete invoices
    $sql = "DELETE FROM `package_invoices` WHERE `employer_id`='" . jb_escape_sql($id) . "'";
    JB_mysql_query($sql) or die(mysql_error());
    $sql = "DELETE FROM `subscription_invoices` WHERE `employer_id`='" . jb_escape_sql($id) . "'";
    JB_mysql_query($sql) or die(mysql_error());
    $sql = "DELETE FROM `membership_invoices` WHERE `user_id`='" . jb_escape_sql($id) . "'";
    JB_mysql_query($sql) or die(mysql_error());
    $sql = "DELETE FROM `applications` WHERE `employer_id`='" . jb_escape_sql($id) . "'";
    JB_mysql_query($sql) or die(mysql_error());
    // finally, delete the employer account.
    $sql = "DELETE FROM `employers` WHERE `ID`='" . jb_escape_sql($id) . "'";
    JB_mysql_query($sql) or die(mysql_error());
    $affected = jb_mysql_affected_rows();
    JBPLUG_do_callback('delete_employer_account', $id);
    return $affected;
}
Esempio n. 2
0
JB_template_employers_header();
echo JBEmployer::JB_get_special_offer_msg();
if ($_REQUEST['action'] == 'delete' || $_REQUEST['delete'] != '') {
    $_REQUEST['post_id'] = (int) $_REQUEST['post_id'];
    if ($_REQUEST['post_id']) {
        $_REQUEST['posts'][] = $_REQUEST['post_id'];
    }
    if (sizeof($_REQUEST['posts']) > 0) {
        $i = 0;
        foreach ($_REQUEST['posts'] as $post_id) {
            $sql = "SELECT user_id FROM posts_table where post_id='" . jb_escape_sql($post_id) . "' ";
            $result = JB_mysql_query($sql) or die(mysql_error());
            $row = mysql_fetch_array($result, MYSQL_ASSOC);
            if ($row['user_id'] == $_SESSION['JB_ID']) {
                $i++;
                JB_delete_post($post_id);
            }
        }
        JB_finalize_post_updates();
        $label["employer_manager_deleted_posts"] = str_replace('%COUNT%', $i, $label["employer_manager_deleted_posts"]);
        $JBMarkup->ok_msg($label["employer_manager_deleted_posts"]);
    } else {
        $JBMarkup->error_msg($label["employer_manager_not_selected_del"]);
    }
}
if ($_REQUEST['expire'] != '') {
    if (sizeof($_REQUEST['posts']) > 0) {
        $i = 0;
        foreach ($_REQUEST['posts'] as $post_id) {
            $post_id = (int) $post_id;
            $post_data = JB_load_post_data($post_id);
Esempio n. 3
0
    $result = JB_mysql_query($sql) or die(mysql_error());
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        JB_delete_post($row['post_id']);
    }
    JB_finalize_post_updates();
}
$user_id = $_REQUEST['user_id'];
if ($action == 'delete') {
    JB_delete_post($_REQUEST['post_id']);
    JB_finalize_post_updates();
    $JBMarkup->ok_msg("Job Post #{$post_id} deleted.");
}
if ($action == 'Bulk Delete') {
    $posts = $_REQUEST['posts'];
    for ($i = 0; $i < sizeof($posts); $i++) {
        JB_delete_post($posts[$i]);
        $JBMarkup->ok_msg("Job Post #" . $posts[$i] . " deleted.");
    }
    JB_finalize_post_updates();
}
if ($action == 'Approve') {
    $posts = $_REQUEST['posts'];
    $PForm =& JB_get_DynamicFormObject(1);
    for ($i = 0; $i < sizeof($posts); $i++) {
        $now = gmdate("Y-m-d H:i:s");
        $sql = "UPDATE `posts_table` SET `approved`='Y', `reason`='', post_date='" . $now . "' WHERE `post_id`='" . jb_escape_sql($posts[$i]) . "'";
        JB_mysql_query($sql) or die(mysql_error());
        $JBMarkup->ok_msg('Job Post #' . jb_escape_html($posts[$i]) . ' approved!');
        JBPLUG_do_callback('admin_approve_post', $posts[$i]);
        // send out the email to the employer
        $post_data = $PForm->load($posts[$i]);