function metaWeblog_editPost() { $params = func_get_args(); $result = api_login($params[1], $params[2]); if ($result) { return $result; } $post = api_make_post($params[3], $params[4], $params[0]); $post->created = null; if (!$post) { return new XMLRPCFault(1, "Textcube editing error"); } $ret = $post->update(); // 기존 글의 파일들 지우기 (잘 찾아서) // 새로 업로드 된 파일들 옮기기 api_update_attaches_with_replace($post->id); fireEvent('UpdatePostByBlogAPI', $id, $post); RSS::refresh(); $post->close(); if ($ret != false) { Setting::setBlogSettingGlobal('LatestEditedEntry', $post->id); } return $ret ? true : false; }
function update() { // attachment & category is own your risk! if (!isset($this->id) || !Validator::number($this->id, 1)) { return $this->_error('id'); } if (!($query = $this->_buildQuery())) { return false; } if (!($old = $query->getRow('category, visibility'))) { return $this->_error('id'); } $bChangedCategory = $old['category'] != $this->category; if ($old['visibility'] == 3) { requireComponent('Eolin.API.Syndication'); Syndication::leave($this->getLink()); } if (!isset($this->modified)) { $query->setAttribute('modified', 'UNIX_TIMESTAMP()'); } if (!$query->update()) { return $this->_error('update'); } // if ($bChangedCategory) { // // TODO : Recalculate Category // } if (isset($this->slogan)) { $this->saveSlogan(); } $this->updateTags(); if ($this->visibility == 'syndicated') { requireComponent('Eolin.API.Syndication'); if (!Syndication::join($this->getLink())) { $query->resetAttributes(); $query->setAttribute('visibility', 2); $this->visibility = 'public'; $query->update(); } } requireComponent('Textcube.Control.RSS'); RSS::refresh(); return true; }