} } foreach ($diaryAttachs as $at) { if ($at['type'] == 'img') { $a_url = geturl($at['attachurl'], 'show'); $attach_ext = strtolower(substr(strrchr($a_url[0], '.'), 1)); $prename = substr(md5($timestamp . randstr(8)), 10, 15); $filename = $winduid . "_{$did}_{$prename}.{$attach_ext}"; $attachurl = "{$savedir}/{$filename}"; $fileuplodeurl = "{$attachdir}/diary/{$attachurl}"; $uploadSerivce->postupload($a_url[0], $fileuplodeurl); if ($db_ifathumb) { $thumbdir = "thumb/diary/{$attachurl}"; $thumburl = "{$attachdir}/{$thumbdir}"; $ifthumb = 1; $thumbsize = $uploadSerivce->MakeThumb($fileuplodeurl, $thumburl, $db_athumbsize, $ifthumb); } $data = array('did' => $did, 'uid' => $winduid, 'hits' => 0, 'name' => $at['name'], 'type' => $at['type'], 'size' => $at['size'], 'attachurl' => 'diary/' . $attachurl, 'needrvrc' => $at['needrvrc'], 'special' => $at['special'], 'ctype' => $at['ctype'], 'uploadtime' => $timestamp, 'descrip' => $at['descrip'], 'ifthumb' => 0); $db->update("INSERT INTO pw_attachs SET " . S::sqlSingle($data)); $aid = $db->insert_id(); $data['aid'] = $aid; $aids[] = $data['aid']; $diaryAid[$aid] = $data; } } //*=======拷贝图片===========*// $diaryAid = $diaryAid ? serialize($diaryAid) : ''; if ($aids) { preg_match_all('/attachment=(\\d+)/i', $diary['content'], $result); $diary['content'] = str_replace($result[1], $aids, $diary['content']); }