コード例 #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
ファイル: default.php プロジェクト: firaga/operation
 public function sRender()
 {
     $loginApi = new KUser_loginApi();
     $uid = $loginApi->iGetLoginUid();
     $logininfo = $uid ? Ko_Tool_Adapter::VConv($uid, array('user_baseinfo', array('logo32'))) : array();
     $head = new Ko_View_Render_Smarty();
     $head->oSetTemplate('default/common/header.html')->oSetData('IMG_DOMAIN', IMG_DOMAIN)->oSetData('WWW_DOMAIN', WWW_DOMAIN)->oSetData('PASSPORT_DOMAIN', PASSPORT_DOMAIN)->oSetData('logininfo', $logininfo);
     $tail = new Ko_View_Render_Smarty();
     $tail->oSetTemplate('default/common/footer.html');
     return $head->sRender() . parent::sRender() . $tail->sRender();
 }
コード例 #3
0
ファイル: Rest.php プロジェクト: firaga/operation
 private function _sGetDeleteFuncInfo($resConf, &$aInput, &$para)
 {
     if (!isset($resConf['unique'])) {
         throw new Exception('指定资源不能进行DELETE操作', self::ERROR_DELETE_INVALID);
     }
     if (!isset($aInput['list'])) {
         $this->_vNormalizeStyle($resConf, $aInput, 'before_style', true);
         $funcname = 'delete';
         $para = array(Ko_Tool_Adapter::VConv($this->_vKey, $resConf['unique']), $this->_aGetStylePara($aInput, 'before_style', 'before_decorate'));
     } else {
         $aInput['list'] = Ko_Tool_Adapter::VConv($aInput['list'], array('list', array('hash', array('key' => $resConf['unique']))));
         $funcname = 'deleteMulti';
         $para = array($aInput['list']);
     }
     return $funcname;
 }
コード例 #4
0
ファイル: photo.php プロジェクト: firaga/operation
 $photoinfo['image_exif'] = $storageApi->aGetImageExif($photoinfo['image']);
 $agentinfo = KUser_agentApi::get();
 if ($agentinfo['screen']['height'] < 1000) {
     $photoinfo['image'] = $storageApi->sGetUrl($photoinfo['image'], 'imageView2/2/w/600/h/600');
     $photoinfo['imagesize'] = 600;
 } else {
     $photoinfo['image'] = $storageApi->sGetUrl($photoinfo['image'], 'imageView2/2/w/800/h/800');
     $photoinfo['imagesize'] = 800;
 }
 $albuminfo = $photoApi->getAlbumInfo($uid, $photoinfo['albumid']);
 if ($albuminfo['isrecycle'] && $uid != $loginuid) {
     Ko_Web_Response::VSetRedirect('/');
     Ko_Web_Response::VSend();
     exit;
 }
 $userinfo = Ko_Tool_Adapter::VConv($uid, array('user_baseinfo', array('logo80')));
 $prevlist = $nextlist = array();
 $curinfo = $photoinfo;
 while (!empty($curinfo = $photoApi->getPrevPhotoInfo($curinfo))) {
     $curinfo['image'] = $storageApi->sGetUrl($curinfo['image'], 'imageView2/1/w/60');
     array_unshift($prevlist, $curinfo);
     if (count($prevlist) >= 4) {
         break;
     }
 }
 $curinfo = $photoinfo;
 while (!empty($curinfo = $photoApi->getNextPhotoInfo($curinfo))) {
     $curinfo['image'] = $storageApi->sGetUrl($curinfo['image'], 'imageView2/1/w/60');
     array_push($nextlist, $curinfo);
     if (count($nextlist) >= 15 - count($prevlist)) {
         break;
コード例 #5
0
ファイル: entry.php プロジェクト: firaga/operation
            $loginuid = $loginApi->iGetLoginUid();
            if (empty($loginuid)) {
                Ko_Web_Response::VSetRedirect('http://' . PASSPORT_DOMAIN . '/user/login');
                Ko_Web_Response::VSend();
                exit;
            }
        }
    }
    $hooks = COMMON_CLASS_PATH . 'hooks/' . $appname . '.php';
    if (is_file($hooks)) {
        require_once $hooks;
    }
});
Ko_Web_Event::On('ko.error', '500', function ($errno, $errstr, $errfile, $errline, $errcontext) {
    Ko_Web_Error::V500($errno, $errstr, $errfile, $errline, $errcontext);
    exit;
});
Ko_Web_Event::On('ko.dispatch', 'before', function () {
    Ko_Tool_Adapter::VOn('user_baseinfo', array('KUser_baseinfoApi', 'AAdapter'));
    Ko_Tool_Adapter::VOn('image_baseinfo', array('KStorage_Api', 'AAdapter'));
    $uri = Ko_Web_Request::SRequestUri();
    $appname = Ko_Web_Config::SGetAppName();
    if ('zc' === $appname) {
        $_GET['uid'] = 20;
    }
});
Ko_Web_Event::On('ko.dispatch', '404', function () {
    Ko_Web_Route::V404();
    exit;
});
require_once KO_DIR . 'web/Bootstrap.php';