Browse Source

add current user exist check

master
filesite 7 months ago
parent
commit
fbdaa4322a
  1. 7
      plugins/Common.php
  2. 5
      themes/tajian/controller/SiteController.php

7
plugins/Common.php

@ -109,6 +109,13 @@ Class Common { @@ -109,6 +109,13 @@ Class Common {
return is_dir($userDir) ? $userDir : false;
}
//判断当前用户数据目录是否存在
public static function existCurrentUser() {
$rootDir = __DIR__ . '/../www/' . FSC::$app['config']['content_directory'];
return is_dir($rootDir);
}
//检查朋友的邀请码是否存在
public static function existFriendsCode($code) {
if (self::isFriendsCode($code) == false) {return false;}

5
themes/tajian/controller/SiteController.php

@ -15,6 +15,11 @@ Class SiteController extends Controller { @@ -15,6 +15,11 @@ Class SiteController extends Controller {
//如果没有开启多用户支持,或者当前用户不为空
if (empty(FSC::$app['config']['multipleUserUriParse']) || !empty(FSC::$app['user_id'])) {
if (!empty(FSC::$app['user_id']) && Common::existCurrentUser() == false) {
$user_id = FSC::$app['user_id'];
throw new Exception("你要访问的用户 {$user_id} 收藏夹不存在!", 404);
}
return $this->renderFavVideos();
}else {
return $this->renderTajianIndex();

Loading…
Cancel
Save