public function put($id, $update, $before = null, $after = null, $put_style = 'default') { $loginApi = new KUser_loginApi(); $loginuid = $loginApi->iGetLoginUid(); if ($loginuid) { $contentApi = new KContent_Api(); switch ($put_style) { case 'default': $contentApi->bSet(KContent_Api::DRAFT_CONTENT, $loginuid, $update['content']); $contentApi->bSet(KContent_Api::DRAFT_TITLE, $loginuid, $update['title']); break; case 'title': $contentApi->bSet(KContent_Api::DRAFT_TITLE, $loginuid, $update['title']); break; } } }
public function post($update, $after = null, $post_style = 'default') { $loginApi = new KUser_loginApi(); $loginuid = $loginApi->iGetLoginUid(); if (0 == strlen($update['title'])) { throw new Exception('请输入博客标题', 1); } $blogApi = new KBlog_Api(); $blogid = $blogApi->iInsert($loginuid, $update['title'], $update['content'], $update['tags']); if (!$blogid) { throw new Exception('添加博客失败', 2); } $contentApi = new KContent_Api(); $contentApi->bSet(KContent_Api::DRAFT_CONTENT, $loginuid, ''); $contentApi->bSet(KContent_Api::DRAFT_TITLE, $loginuid, ''); $this->_sendSysmsg($loginuid, $blogid); return array('key' => array('uid' => $loginuid, 'blogid' => $blogid)); }
public function bUpdateOauth2info($uid, $userinfo) { if ($uid) { $data = array('uid' => $uid); if (strlen($userinfo['logo'])) { $api = new KStorage_Api(); if ($api->bWebUrl2Storage($userinfo['logo'], $logo)) { $data['logo'] = $logo; } } $this->aInsert($data, $data); $contentApi = new KContent_Api(); $contentApi->bSet(KContent_Api::USER_NICKNAME, $uid, $userinfo['nickname']); } return true; }
private function _addAlbum($uid, $title) { $time = time(); $data = array('uid' => $uid, 'sort' => $time, 'ctime' => date('Y-m-d H:i:s', $time), 'mtime' => date('Y-m-d H:i:s', $time)); $albumid = $this->albumDao->iInsert($data); if ($albumid) { $contentApi = new KContent_Api(); $contentApi->bSet(KContent_Api::PHOTO_ALBUM_TITLE, $albumid, $title); } return $albumid; }
public function iDelete($uid, $blogid) { $blogkey = compact('uid', 'blogid'); $info = $this->blogDao->aGet($blogkey); if (empty($info)) { return 0; } if ('回收站' === $info['tags']) { $this->_vSubTags($uid, $blogid, array('回收站')); $contentApi = new KContent_Api(); $contentApi->bSet(KContent_Api::BLOG_TITLE, $blogid, ''); $contentApi->bSet(KContent_Api::BLOG_CONTENT, $blogid, ''); return $this->blogDao->iDelete($blogkey); } else { $subtags = $this->_aGetTags($info['tags']); $this->_vSubTags($uid, $blogid, $subtags); $this->_vAddTags($uid, $blogid, array('回收站')); $update = array('mtime' => date('Y-m-d H:i:s'), 'tags' => '回收站'); return $this->blogDao->iUpdate($blogkey, $update); } }