예제 #1
0
    $file_url = '';
    $file_src = $session_files['fileupload'][$filename]['src'];
    if ($download_config['pdf_handler'] == 'filetmp') {
        $file_src_new = NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . NV_TEMPNAM_PREFIX . md5($file_src) . '.' . nv_getextension($file_src);
        if (file_exists($file_src_new) or nv_copyfile($file_src, $file_src_new)) {
            $file_url = NV_MY_DOMAIN . NV_BASE_SITEURL . substr($file_src_new, strlen(NV_ROOTDIR . '/'));
        }
    } elseif ($download_config['pdf_handler'] == 'base64') {
        $file_url = 'data:application/pdf;base64,' . base64_encode(file_get_contents($file_src));
    } else {
        $file_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=down&filepdf=2&filename=' . $filename;
    }
    if (empty($file_url)) {
        nv_info_die($lang_global['error_404_title'], $lang_global['error_404_title'], $lang_global['error_404_content'], 404);
    }
    $html = theme_viewpdf($file_url);
    die($html);
} elseif (empty($filepdf)) {
    $sql = 'UPDATE ' . NV_MOD_TABLE . ' SET download_hits=download_hits+1 WHERE id=' . intval($session_files['fileupload'][$filename]['id']);
    $db->query($sql);
}
$sql = "SELECT config_name, config_value FROM " . NV_MOD_TABLE . "_config WHERE config_name='upload_dir' OR config_name='is_zip' OR config_name='is_resume' OR config_name='max_speed'";
$result = $db->query($sql);
while ($row = $result->fetch()) {
    if ($row['config_name'] == 'is_zip') {
        $is_zip = $filepdf == 2 ? false : (bool) $row['config_value'];
    } elseif ($row['config_name'] == 'is_resume') {
        $is_resume = (bool) $row['config_value'];
    } elseif ($row['config_name'] == 'max_speed') {
        $max_speed = (int) $row['config_value'];
    }
예제 #2
0
if (empty($filename) or !isset($session_files['fileupload'][$filename])) {
    die('Wrong URL');
}
if (!file_exists($session_files['fileupload'][$filename]['src'])) {
    die('Wrong URL');
}
if (!isset($session_files['fileupload'][$filename]['id'])) {
    die('Wrong URL');
}
$upload_dir = 'files';
$is_zip = false;
$is_resume = false;
$max_speed = 0;
$filepdf = $nv_Request->get_int('filepdf', 'get', 0);
if ($filepdf == 1) {
    $html = theme_viewpdf($filename);
    die($html);
} elseif (empty($filepdf)) {
    $sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . ' SET download_hits=download_hits+1 WHERE id=' . intval($session_files['fileupload'][$filename]['id']);
    $db->query($sql);
}
$sql = "SELECT config_name, config_value FROM " . NV_PREFIXLANG . "_" . $module_data . "_config WHERE config_name='upload_dir' OR config_name='is_zip' OR config_name='is_resume' OR config_name='max_speed'";
$result = $db->query($sql);
while ($row = $result->fetch()) {
    if ($row['config_name'] == 'is_zip') {
        $is_zip = $filepdf == 2 ? false : (bool) $row['config_value'];
    } elseif ($row['config_name'] == 'is_resume') {
        $is_resume = (bool) $row['config_value'];
    } elseif ($row['config_name'] == 'max_speed') {
        $max_speed = (int) $row['config_value'];
    }