public function dzz_imagetoattach($link, $gid) { global $_G; $md5 = md5_file($link); if ($md5 && ($attach = C::t('attachment')->fetch_by_md5($md5))) { //判断空间大小 if (!SpaceSize($attach['filesize'], $gid)) { return array('error' => lang('message', 'inadequate_capacity_space')); } return $attach; } else { if ($target = imagetolocal($link, 'dzz')) { //判断空间大小 $size = @filesize($_G['setting']['attachdir'] . $target); //判断空间大小 if (!SpaceSize($size, $gid)) { @unlink($_G['setting']['attachdir'] . $target); return array('error' => lang('message', 'inadequate_capacity_space')); } $object = str_replace('/', '-', $target); $remote = 0; $attach = array('filesize' => intval($size), 'attachment' => $target, 'filetype' => strtolower(substr(strrchr($link, '.'), 1, 10)), 'filename' => substr(strrchr($link, '/'), 1, 50), 'remote' => $remote, 'copys' => 1, 'md5' => $md5, 'dateline' => $_G['timestamp']); if ($attach['aid'] = DB::insert('attachment', $attach, 1)) { C::t('local_storage')->update_usesize_by_remoteid($attach['remote'], $attach['filesize']); dfsockopen($_G['siteurl'] . 'misc.php?mod=movetospace&aid=' . $attach['aid'] . '&remoteid=0', 0, '', '', FALSE, '', 1); return $attach; } } } return false; }
function getverifyicon($iconkey = 'iconnew', $target) { global $_G, $_GET, $_FILES; if ($_FILES[$iconkey]) { $iconnew = uploadtolocal($_FILES[$iconkey], 'common', $target); } elseif ($_GET['' . $iconkey]) { $icon_url = parse_url($_GET['' . $iconkey]); if ($icon_url['host']) { $iconnew = imagetolocal($_GET['' . $iconkey], 'common', $target); } else { $iconnew = $_GET['' . $iconkey]; } } else { $iconnew = ''; } return $iconnew; }
$target = ''; if ($appid) { $target = DB::result_first("select appico from " . DB::table('app_market') . " where appid='{$appid}'"); } if ($_FILES['iconnew']) { if ($_FILES['iconnew']['tmp_name']) { if ($appico = uploadtolocal($_FILES['iconnew'], 'appico', $target)) { $setarr['appico'] = $appico; } } } else { if (!$_GET['iconnew']) { $_GET['iconnew'] = 'dzz/images/default/icodefault.png'; } if ($_GET['iconnew'] && $_GET['iconnew'] != $_G['setting']['attachurl'] . $target) { if ($appico = imagetolocal($_GET['iconnew'], 'appico', $target)) { $setarr['appico'] = $appico; } } } $picids = $_GET['picids']; //删除已有图片 $delete_picids = $_GET['delete_pics']; if ($delete_picids) { app_pic_delete($delete_picids); } if ($appid) { C::t('app_market')->update($appid, $setarr); } else { $setarr['dateline'] = $_G['timestamp']; if (!$setarr['appico']) {