public function transfer() { if (empty($this->flashatt)) { return false; } $deltmp = array(); $attach = $this->_getService()->getTmpAttachByUserid($this->user->uid); foreach ($attach as $rt) { $aid = $rt['aid']; if (!isset($this->flashatt[$aid])) { Pw::deleteAttach($rt['path'], $rt['ifthumb']); $deltmp[] = $aid; continue; } $value = $this->flashatt[$aid]; $dm = new PwThreadAttachDm($aid); $dm->setDescrip($value['desc']); if ($value['cost'] > 0 && $this->forum->forumset['allowsell'] && $this->user->getPermission('allow_thread_extend.sell')) { if (($max = $this->user->getPermission('sell_credit_range.maxprice')) > 0 && $value['cost'] > $max) { $value['cost'] = $max; } if (!in_array($value['ctype'], $this->user->getPermission('sell_credits', false, array()))) { Wind::import('SRV:credit.bo.PwCreditBo'); $value['ctype'] = key(PwCreditBo::getInstance()->cType); } $dm->setSpecial(2)->setCost($value['cost'])->setCtype($value['ctype']); } $this->_getService()->updateAttach($dm); $this->attachs[$aid] = array('aid' => $aid, 'name' => $rt['name'], 'type' => $rt['type'], 'path' => $rt['fileuploadurl'], 'size' => $rt['size'], 'descrip' => $value['desc'], 'ifthumb' => $rt['ifthumb']); } if ($deltmp) { $this->_getService()->batchDeleteAttach($deltmp); } return true; }