コード例 #1
0
ファイル: FileBrowser.php プロジェクト: bombayworks/currycms
 /**
  * Get list of roots accessible for the logged in user.
  *
  * @return array
  */
 public static function getRoots()
 {
     $user = User::getUser();
     $role = $user->getUserRole();
     $fbas = FilebrowserAccessQuery::create()->condition('user_null', 'FilebrowserAccess.UserId IS NULL')->condition('role_null', 'FilebrowserAccess.UserRoleId IS NULL')->filterByUser($user)->_or()->filterByUserRole($role)->_or()->where(array('user_null', 'role_null'), Criteria::LOGICAL_AND)->find();
     $roots = array();
     foreach ($fbas as $fba) {
         $path = $fba->getPath();
         $realpath = realpath(\Curry\App::getInstance()['wwwPath'] . DIRECTORY_SEPARATOR . $fba->getPath());
         if ($realpath) {
             $roots[$fba->getName()] = array('path' => $path, 'realpath' => $realpath, 'writable' => $fba->getWrite() && self::isWritable($realpath));
         }
     }
     return $roots;
 }
コード例 #2
0
ファイル: Users.php プロジェクト: varvanin/currycms
 protected static function getUserHome(User $user, $create = false)
 {
     if ($user->isNew()) {
         return null;
     }
     $folder = 'user-content/' . $user->getUserId() . '/';
     $q = FilebrowserAccessQuery::create()->filterByUser($user)->filterByName('Home')->filterByPath($folder);
     return $create ? $q->findOneOrCreate() : $q->findOne();
 }