function saveurlarr($msgarr, $varname) { global $_SGLOBAL; global $thevalue, $_SCONFIG; include_once S_ROOT . './function/upload.func.php'; $isimage = 0; if ($varname == 'picarr') { $isimage = 1; } if (!empty($msgarr[$varname]) && is_array($msgarr[$varname])) { foreach ($msgarr[$varname] as $ukey => $url) { if ($isimage) { $patharr = saveremotefile($url, $_SCONFIG['thumbarray']['news']); } else { $patharr = saveremotefile($url, array(), 0); } $subject = strtolower(trim(substr($patharr['name'], 0, strrpos($patharr['name'], '.')))); $msgarr['patharr'][] = array('uid' => $_SGLOBAL['supe_uid'], 'dateline' => $_SGLOBAL['timestamp'], 'catid' => $msgarr['importcatid'], 'itemid' => 0, 'filename' => saddslashes($patharr['name']), 'subject' => trim(shtmlspecialchars($subject)), 'attachtype' => $patharr['type'], 'type' => 'news', 'isimage' => in_array($patharr['type'], array('jpg', 'jpeg', 'gif', 'png')) ? 1 : 0, 'size' => $patharr['size'], 'filepath' => $patharr['file'], 'thumbpath' => $patharr['thumb'], 'isavailable' => 1, 'hash' => ''); if (!empty($patharr['file'])) { $msgarr['message'] = str_replace($url, A_URL . '/' . $patharr['file'], $msgarr['message']); $msgarr[$varname][$ukey] = str_replace($url, A_DIR . '/' . $patharr['file'], $msgarr[$varname][$ukey]); } } } return $msgarr; }
if (!empty($allowtypearr)) { if (empty($allowtypearr[$fileext])) { continue; } } //缩略图 if (!empty($_POST['uploadthumb1']) && !empty($_SGLOBAL['thumbarray'][$_POST['uploadthumb1']])) { $thumbarr = $_SGLOBAL['thumbarray'][$_POST['uploadthumb1']]; } else { $thumbarr = array($_POST['thumbwidth'], $_POST['thumbheight']); } //远程上传 if (!empty($allowtypearr[$fileext]['maxsize'])) { $filearr = saveremotefile($imageurl, $thumbarr, 1, $allowtypearr[$fileext]['maxsize']); } else { $filearr = saveremotefile($imageurl, $thumbarr, 1, 0); } //检查大小 if (empty($filearr['file'])) { continue; } if (!empty($allowtypearr)) { if ($filearr['size'] > $allowtypearr[$fileext]['maxsize']) { @unlink(A_DIR . '/' . $filearr['file']); if (!empty($filearr['thumb'])) { @unlink(A_DIR . '/' . $filearr['thumb']); } continue; } } //数据库