示例#1
0
文件: item.php 项目: firaga/operation
 public function put($id, $update, $before = null, $after = null, $put_style = 'default')
 {
     $loginApi = new KUser_loginApi();
     $uid = $loginApi->iGetLoginUid();
     if (!$uid || $uid != $id) {
         throw new Exception('修改密码失败', 1);
     }
     switch ($put_style) {
         case 'passwd':
             if (!preg_match('/^[_0-9a-z]{4,16}$/i', $update['newpasswd'])) {
                 throw new Exception('登录密码只能使用字母,数字和下划线,4-16个字符', 2);
             }
             if (false === $loginApi->bChangePassword($uid, $update['oldpasswd'], $update['newpasswd'], $errno)) {
                 throw new Exception('旧密码输入错误', 3);
             }
             break;
         case 'profile':
             if ('' == $update['nickname']) {
                 throw new Exception('请输入昵称', 4);
             }
             $baseinfoApi = new KUser_baseinfoApi();
             $baseinfoApi->bUpdateNickname($uid, $update['nickname']);
             break;
     }
     return array('key' => $id);
 }
示例#2
0
function oauth2login($src)
{
    $api = new KUser_loginApi();
    $uid = $api->iOauth2Login($src);
    $api->vSetLoginUid($uid, $src);
    Ko_Web_Response::VSetRedirect(KUser_loginrefApi::SGet());
    Ko_Web_Response::VSend();
}
示例#3
0
 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();
 }
示例#4
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);
 }
示例#5
0
文件: item.php 项目: firaga/operation
 public function delete($id, $before = null)
 {
     $loginApi = new KUser_loginApi();
     $uid = $loginApi->iGetLoginUid();
     if ($uid != $id['uid']) {
         throw new Exception('删除照片失败', 1);
     }
     $photoApi = new KPhoto_Api();
     if (!$photoApi->deletePhoto($uid, $id['photoid'])) {
         throw new Exception('删除照片失败', 2);
     }
     return array('key' => $id);
 }
示例#6
0
 public function checkLogin()
 {
     $userLoginApi = new KUser_loginApi();
     $tokenuid = $userLoginApi->ICheckSessionToken($_COOKIE['admintoken'], $sExinfo, $iErrno);
     if ($tokenuid) {
         if (!$this->doAfterLogin($tokenuid)) {
             //锁定
             return false;
         }
     } else {
         return false;
     }
     return true;
 }
示例#7
0
 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;
         }
     }
 }
示例#8
0
文件: logo.php 项目: firaga/operation
 public function post($update, $after = null)
 {
     $api = new KStorage_Api();
     $content = $api->sRead($update['fileid']);
     if ('' === $content) {
         throw new Exception('获取原文件失败', 1);
     }
     if (false === ($info = Ko_Tool_Image::VInfo($content, Ko_Tool_Image::FLAG_SRC_BLOB))) {
         throw new Exception('获取原文件信息失败', 2);
     }
     $zoom = $info['width'] / $update['width'];
     $aOption = array('srcx' => $zoom * $update['left'], 'srcy' => $zoom * $update['top'], 'srcw' => $zoom * $update['w'], 'srch' => $zoom * $update['h'], 'quality' => 98, 'strip' => true);
     if (false === ($dst = Ko_Tool_Image::VCrop($content, '1.' . $info['type'], $update['w'], $update['h'], Ko_Tool_Image::FLAG_SRC_BLOB | Ko_Tool_Image::FLAG_DST_BLOB, $aOption))) {
         throw new Exception('文件转换失败', 3);
     }
     if (!$api->bContent2Storage($dst, $logoid)) {
         throw new Exception('文件保存失败', 3);
     }
     $loginApi = new KUser_loginApi();
     $baseinfoApi = new KUser_baseinfoApi();
     $baseinfoApi->bUpdateLogo($loginApi->iGetLoginUid(), $logoid);
     return array('key' => $logoid);
 }
示例#9
0
    if (empty($albuminfo) || $albuminfo['isrecycle'] && $uid != $loginuid) {
        Ko_Web_Response::VSetRedirect('/');
        Ko_Web_Response::VSend();
        exit;
    }
    $userinfo = Ko_Tool_Adapter::VConv($uid, array('user_baseinfo', array('logo80')));
    $photolist = $photoApi->getPhotoListBySeq($uid, $albumid, '0_0_0', $num, $next, $next_boundary, 'imageView2/2/w/240');
    $render = new KRender_www();
    if ($loginuid == $uid) {
        $allalbumlist = $photoApi->getAllAlbumList($uid);
        $render->oSetData('allalbumlist', $allalbumlist);
    }
    $render->oSetTemplate('www/photo/album.html')->oSetData('userinfo', $userinfo)->oSetData('albuminfo', $albuminfo)->oSetData('photolist', $photolist)->oSetData('page', array('num' => $num, 'next' => $next, 'next_boundary' => $next_boundary))->oSend();
});
Ko_Web_Route::VGet('item', function () {
    $loginApi = new KUser_loginApi();
    $loginuid = $loginApi->iGetLoginUid();
    $uid = Ko_Web_Request::IGet('uid');
    $photoid = Ko_Web_Request::IGet('photoid');
    $storageApi = new KStorage_Api();
    $photoApi = new KPhoto_Api();
    $photoinfo = $photoApi->getPhotoInfo($uid, $photoid);
    if (empty($photoinfo)) {
        Ko_Web_Response::VSetRedirect('/');
        Ko_Web_Response::VSend();
        exit;
    }
    $photoinfo['image_src'] = $storageApi->sGetUrl($photoinfo['image'], '');
    $photoinfo['image_small'] = $storageApi->sGetUrl($photoinfo['image'], 'imageView2/1/w/60');
    $photoinfo['image_exif'] = $storageApi->aGetImageExif($photoinfo['image']);
    $agentinfo = KUser_agentApi::get();
示例#10
0
文件: user.php 项目: firaga/operation
    $uid = $api->iGetLoginUid();
    if ($uid) {
        $render = new KRender_passport();
        $render->oSetTemplate('passport/user/logo.html')->oSend();
    } else {
        Ko_Web_Response::VSetRedirect('login');
        Ko_Web_Response::VSend();
    }
});
Ko_Web_Route::VGet('passwd', function () {
    $api = new KUser_loginApi();
    $uid = $api->iGetLoginUid();
    if ($uid) {
        $render = new KRender_passport();
        $render->oSetTemplate('passport/user/passwd.html')->oSend();
    } else {
        Ko_Web_Response::VSetRedirect('login');
        Ko_Web_Response::VSend();
    }
});
Ko_Web_Route::VGet('profile', function () {
    $api = new KUser_loginApi();
    $uid = $api->iGetLoginUid();
    if ($uid) {
        $render = new KRender_passport();
        $render->oSetTemplate('passport/user/profile.html')->oSend();
    } else {
        Ko_Web_Response::VSetRedirect('login');
        Ko_Web_Response::VSend();
    }
});
示例#11
0
 public function delete($id, $before = null)
 {
     $api = new KUser_loginApi();
     $api->vSetLoginUid(0);
     return array('key' => $id);
 }