if (($_FILES[$dataFileElement]['type'] == "text/csv" || $_FILES[$dataFileElement]['type'] == "text/txt" || $_FILES[$dataFileElement]['type'] == "text/plain" || $_FILES[$dataFileElement]['type'] == "application/octet-stream") && $_FILES[$dataFileElement]['size'] < 1000000) {
        if ($_FILES[$dataFileElement]['error'] > 0) {
            throw new Exception("Error: {$_FILES[$dataFileElement]['error']}");
        } else {
            $fileContent = file_get_contents($_FILES[$dataFileElement]['tmp_name']);
            return $fileContent;
        }
    } else {
        throw new Exception("Invalid File: Type={$_FILES[$dataFileElement]['type']}; Size={$_FILES[$dataFileElement]['size']}");
    }
}
if ($_POST['input_type'] == "file_upload") {
    try {
        $content = get_upload('data_file');
        try {
            $content2 = get_upload('data_file2');
        } catch (Exception $e) {
            // ignore
        }
        if (!empty($content2)) {
            $content .= "\n\n" . $content2;
        }
    } catch (Exception $e) {
        echo $e;
    }
} else {
    if ($_POST['input_type'] == "text_area") {
        $content = $_POST['text_area'];
    }
}
if (!isset($content) || empty($content)) {
Beispiel #2
0
function PUT($api_noun)
{
    global $id, $storage;
    if ($id === NULL) {
        throw new Exception("PUT - must specify `id`", 404);
    }
    $edit = GET($api_noun);
    $no_content = TRUE;
    $api = $GLOBALS['api']->{$api_noun};
    $put_vars = get_upload($api);
    foreach ($api as $key => $data_type) {
        if (isset($put_vars[$key]) and $key != 'id') {
            $edit->{$key} = filter_var(trim($put_vars[$key]), constant($data_type));
            $no_content = FALSE;
        }
    }
    // No updates where provided
    if ($no_content) {
        http_response_code(204);
        // No Content
        return $edit;
    }
    // Save update to datafile
    $data = get_api_data($api_noun);
    $index = get_index($data, $id);
    $data[$index] = $edit;
    save_file($data);
    return $edit;
}
<?php

include_once 'functions.php';
$route = "";
if (isset($_GET['route'])) {
    $route = $_GET['route'];
}
switch ($route) {
    case 'HOME':
        get_home();
        break;
    case 'UPLOAD':
        get_upload();
        break;
    case 'PRODUCT':
        get_product();
        break;
    default:
        get_home();
}
Beispiel #4
0
    } else {
        $smarty->assign("is_check", 0);
    }
    $smarty->assign('apply_rs', $rs);
    $smarty->display('member_company/company_checking.htm');
} elseif ($act == 'my_checked_resume') {
    require_once QISHI_ROOT_PATH . 'include/page.class.php';
    $wheresql .= "where uid=" . $_SESSION['uid'];
    $perpage = 10;
    $total_sql = "SELECT COUNT(*) AS num FROM " . table('resume_upload') . "  {$wheresql} ";
    $total = $db->get_total($total_sql);
    $page = new page(array('total' => $total, 'perpage' => $perpage));
    $offset = ($page->nowindex - 1) * $perpage;
    $smarty->assign('act', $act);
    $smarty->assign('title', '批量上传简历 - 企业会员中心 - ' . $_CFG['site_name']);
    $smarty->assign('uploads', get_upload($offset, $perpage, $wheresql));
    if ($total > $perpage) {
        $smarty->assign('page', $page->show(3));
    }
    $smarty->display('member_company/company_upload.htm');
} elseif ($act == 'apply_check') {
    if (!$cominfo_flge) {
        $link[0]['text'] = "完善企业资料";
        $link[0]['href'] = 'company_info.php?act=company_profile';
        showmsg("为了达到更好的招聘效果,请先完善您的企业资料!", 1, $link);
    }
    $data = array();
    $data["uid"] = $_SESSION["uid"];
    $data["addtime"] = time();
    $rs = $db->getfirst("select * from " . table("resume_check_apply") . " where uid=" . $data["uid"]);
    if ($rs) {