$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']; } } $file_src = $session_files['fileupload'][$filename]['src']; $file_basename = $filename; $directory = NV_UPLOADS_REAL_DIR; if ($is_zip) { $upload_dir = NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $upload_dir; $subfile = nv_pathinfo_filename($filename); $tem_file = NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . NV_TEMPNAM_PREFIX . $subfile; $file_exists = file_exists($tem_file); if ($file_exists and filemtime($tem_file) > NV_CURRENTTIME - 600) { $file_src = $tem_file; $file_basename = $subfile . '.zip'; $directory = NV_ROOTDIR . '/' . NV_TEMP_DIR; } else { if ($file_exists) { @nv_deletefile($tem_file); } $zip = new PclZip($tem_file); $zip->add($file_src, PCLZIP_OPT_REMOVE_PATH, $upload_dir); if (isset($global_config['site_logo']) and !empty($global_config['site_logo']) and file_exists(NV_ROOTDIR . '/' . $global_config['site_logo'])) { $paths = explode('/', $global_config['site_logo']); array_pop($paths);
if (!$is_error) { if (empty($fileupload) and empty($array['linkdirect'])) { $is_error = true; $error = $lang_module['file_error_fileupload']; } else { $fileimage = ''; if (isset($_FILES['upload_fileimage']) and is_uploaded_file($_FILES['upload_fileimage']['tmp_name'])) { $upload = new upload(array('images'), $global_config['forbid_extensions'], $global_config['forbid_mimes'], NV_UPLOAD_MAX_FILESIZE, NV_MAX_WIDTH, NV_MAX_HEIGHT); $upload_info = $upload->save_file($_FILES['upload_fileimage'], NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/temp', false); @unlink($_FILES['upload_fileimage']['tmp_name']); if (empty($upload_info['error'])) { mt_srand((double) microtime() * 1000000); $maxran = 1000000; $random_num = mt_rand(0, $maxran); $random_num = md5($random_num); $nv_pathinfo_filename = nv_pathinfo_filename($upload_info['name']); $new_name = NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/temp/' . $nv_pathinfo_filename . '.' . $random_num . '.' . $upload_info['ext']; $rename = nv_renamefile($upload_info['name'], $new_name); if ($rename[0] == 1) { $fileimage = $new_name; } else { $fileimage = $upload_info['name']; } @chmod($fileimage, 0644); $fileimage = str_replace(NV_ROOTDIR . '/' . NV_UPLOADS_DIR, '', $fileimage); } } $array['description'] = nv_nl2br($array['description'], '<br />'); $array['introtext'] = nv_nl2br($array['introtext'], '<br />'); $array['linkdirect'] = nv_nl2br($array['linkdirect'], '<br />'); $sql = 'INSERT INTO ' . NV_PREFIXLANG . '_' . $module_data . '_tmp (catid, title, description, introtext, uploadtime, user_id, user_name, author_name, author_email, author_url, fileupload, linkdirect, version, filesize, fileimage, copyright) VALUES (