示例#1
0
文件: Api.php 项目: firaga/operation
 public function getIndexList($boundary, $num, &$next, &$next_boundary)
 {
     $msglist = $this->aGetListSeq(0, 'index', $boundary, $num, $next, $next_boundary);
     $userlist = $albumlist = $photolist = $bloglist = array();
     foreach ($msglist as $v) {
         if (self::PHOTO == $v['msgtype']) {
             $userlist[$v['content']['uid']] = $v['content']['uid'];
             $albumlist[] = array('uid' => $v['content']['uid'], 'albumid' => $v['content']['albumid']);
             $photolist = array_merge($photolist, $v['content']['photolist']);
         } else {
             if (self::BLOG == $v['msgtype']) {
                 $userlist[$v['content']['uid']] = $v['content']['uid'];
                 $bloglist[] = array('uid' => $v['content']['uid'], 'blogid' => $v['content']['blogid']);
             }
         }
     }
     $userlist = Ko_Tool_Adapter::VConv($userlist, array('list', array('user_baseinfo', array('logo80'))));
     $storageApi = new KStorage_Api();
     $photoApi = new KPhoto_Api();
     $blogApi = new KBlog_Api();
     $photoinfos = $photoApi->getPhotoInfos($photolist);
     $albuminfos = $photoApi->getAlbumInfos($albumlist);
     $bloginfos = $blogApi->aGetBlogInfos($bloglist);
     foreach ($msglist as $k => &$v) {
         if (self::PHOTO == $v['msgtype']) {
             $v['content']['userinfo'] = $userlist[$v['content']['uid']];
             $v['content']['albuminfo'] = $albuminfos[$v['content']['albumid']];
             if (empty($v['content']['albuminfo'])) {
                 $this->vDelete(0, $v['msgid']);
                 unset($msglist[$k]);
             } else {
                 $photolist = array();
                 foreach ($v['content']['photolist'] as $photo) {
                     if (!empty($photoinfos[$photo['photoid']]) && $photoinfos[$photo['photoid']]['albumid'] == $photo['albumid']) {
                         $photo['image'] = $storageApi->sGetUrl($photoinfos[$photo['photoid']]['image'], 'imageView2/2/w/480/h/240');
                         $photolist[] = $photo;
                     }
                 }
                 $v['content']['photolist'] = $photolist;
                 if (empty($photolist)) {
                     $this->vDelete(0, $v['msgid']);
                     unset($msglist[$k]);
                 }
             }
         } else {
             if (self::BLOG == $v['msgtype']) {
                 $v['content']['userinfo'] = $userlist[$v['content']['uid']];
                 $v['content']['bloginfo'] = $bloginfos[$v['content']['blogid']];
                 if (empty($v['content']['bloginfo'])) {
                     $this->vDelete(0, $v['msgid']);
                     unset($msglist[$k]);
                 }
             }
         }
     }
     unset($v);
     return $msglist;
 }
示例#2
0
文件: item.php 项目: firaga/operation
 public function delete($id, $before = null)
 {
     $loginApi = new KUser_loginApi();
     $loginuid = $loginApi->iGetLoginUid();
     if ($loginuid != $id['uid']) {
         throw new Exception('删除博客失败', 1);
     }
     $blogApi = new KBlog_Api();
     $blogApi->iDelete($loginuid, $id['blogid']);
     return array('key' => $id);
 }
示例#3
0
文件: blog.php 项目: firaga/operation
        $htmlrender->oSetData(KContent_Api::BLOG_TITLE, $blogid);
        $htmlrender->oSetData(KContent_Api::BLOG_CONTENT, $blogid);
    } else {
        $bloginfo = array();
        $htmlrender->oSetData(KContent_Api::DRAFT_CONTENT, $uid);
        $htmlrender->oSetData(KContent_Api::DRAFT_TITLE, $uid);
    }
    $render = new KRender_www();
    $render->oSetTemplate('www/blog/post.html')->oSetData('userinfo', $userinfo)->oSetData('bloginfo', $bloginfo)->oSetData('blogcontent', $htmlrender)->oSetData('taginfos', $taginfos)->oSend();
});
Ko_Web_Route::VGet('item', function () {
    $uid = Ko_Web_Request::IGet('uid');
    $blogid = Ko_Web_Request::IGet('blogid');
    $tag = Ko_Web_Request::SGet('tag');
    $userinfo = Ko_Tool_Adapter::VConv($uid, array('user_baseinfo', array('logo80')));
    $blogApi = new KBlog_Api();
    $taginfos = $blogApi->aGetAllTaginfo($uid);
    $bloginfo = $blogApi->aGet($uid, $blogid);
    if (empty($bloginfo) || in_array('回收站', $bloginfo['tags'])) {
        Ko_Web_Response::VSetRedirect('user?uid=' . $uid);
        Ko_Web_Response::VSend();
        exit;
    }
    if (0 == strlen($tag)) {
        $tag = $blogApi->sGetPriorTag($bloginfo['tags']);
    }
    $prevnextInfo = $blogApi->aGetPrevNextTitle($uid, $blogid, $tag);
    $contentApi = new KContent_Api();
    $htmlrender = new Ko_View_Render_HTML($contentApi);
    $htmlrender->oSetData(KContent_Api::BLOG_TITLE, $blogid);
    $htmlrender->oSetData(KContent_Api::BLOG_CONTENT, $blogid);