/** * @see PwUploadAction.update */ public function update($uploaddb) { $srv = Wekit::load('attach.PwThreadAttach'); foreach ($uploaddb as $key => $value) { Pw::deleteAttach($this->attach['path'], $this->attach['ifthumb']); $att = new PwThreadAttachDm($this->aid); $att->setName($value['name']); $att->setType($value['type']); $att->setSize($value['size']); $att->setPath($value['fileuploadurl']); $att->setIfthumb($value['ifthumb']); $att->setCreatedUser($this->user->uid); $att->setCreatedTime(Pw::getTime()); $att->setApp('thread'); $srv->updateAttach($att); if ($this->attach['tid'] && $this->attach['pid'] == 0 && $this->attach['type'] != $value['type']) { Wind::import('SRV:forum.dm.PwTopicDm'); $dm = new PwTopicDm($this->attach['tid']); $dm->setHasAttach($value['type'], true); if (!Wekit::load('attach.PwThreadAttach')->countType($this->attach['tid'], 0, $this->attach['type'])) { $dm->setHasAttach($this->attach['type'], false); } Wekit::load('forum.PwThread')->updateThread($dm); } $this->attachs[$this->aid] = array('aid' => $this->aid, 'name' => $value['name'], 'type' => $value['type'], 'path' => $value['fileuploadurl'], 'size' => $value['size'], 'descrip' => $value['descrip'], 'ifthumb' => $value['ifthumb']); break; } return true; }
/** * @see PwUploadAction.update */ public function update($uploaddb) { $srv = Wekit::load('attach.PwThreadAttach'); foreach ($uploaddb as $key => $value) { $value['name'] = WindConvert::convert($value['name'], Wind::getApp()->getResponse()->getCharset(), 'utf-8'); $att = new PwThreadAttachDm(); $att->setName($value['name']); $att->setType($value['type']); $att->setSize($value['size']); $att->setPath($value['fileuploadurl']); $att->setIfthumb($value['ifthumb']); $att->setCreatedUser($this->user->uid); $att->setCreatedTime(Pw::getTime()); if ($value['thumb'] && $value['thumb'][0]) { $att->setWidth($value['thumb'][0][2]); $att->setHeight($value['thumb'][0][3]); } $att->setApp('thread'); $aid = $srv->addAttach($att); $this->attachs[$aid] = array('aid' => $aid, 'name' => $value['name'], 'type' => $value['type'], 'path' => $value['fileuploadurl'], 'size' => $value['size'], 'descrip' => $value['descrip'], 'ifthumb' => $value['ifthumb']); } return true; }
/** * @see PwUploadAction.update */ public function update($uploaddb) { $this->transfer(); $srv = $this->_getService(); foreach ($uploaddb as $key => $value) { $att = new PwThreadAttachDm(); $att->setName($value['name']); $att->setType($value['type']); $att->setSize($value['size']); $att->setPath($value['fileuploadurl']); $att->setIfthumb($value['ifthumb']); $att->setCreatedUser($this->user->uid); $att->setCreatedTime(Pw::getTime()); $att->setApp('thread'); $aid = $srv->addAttach($att); $this->attachs[$aid] = array('aid' => $aid, 'name' => $value['name'], 'type' => $value['type'], 'path' => $value['fileuploadurl'], 'size' => $value['size'], 'descrip' => $value['descrip'], 'ifthumb' => $value['ifthumb']); } return true; }