示例#1
0
 /**
  * Remove the chroot part of the URI.
  */
 static function site($uri = '', $protocol = FALSE)
 {
     if (user_chroot::album()) {
         $uri = preg_replace('#^' . user_chroot::album()->relative_url() . '#', '', $uri);
     }
     return parent::site($uri, $protocol);
 }
示例#2
0
 /**
  * Return all the parents of this node, in order from root to this node's immediate parent.
  *
  * @return array ORM
  */
 function parents()
 {
     $select = $this->where('left_ptr', '<=', $this->left_ptr)->where('right_ptr', '>=', $this->right_ptr)->where('id', '<>', $this->id)->order_by('left_ptr', 'ASC');
     if (user_chroot::album()) {
         $select->where('left_ptr', '>=', user_chroot::album()->left_ptr);
         $select->where('right_ptr', '<=', user_chroot::album()->right_ptr);
     }
     return $select->find_all();
 }
示例#3
0
 /**
  * If the user is chrooted, deny access outside of the chroot.
  */
 static function user_can($user, $perm_name, $item)
 {
     if ($user->id == identity::active_user()->id && user_chroot::album()) {
         if ($item->left_ptr < user_chroot::album()->left_ptr || user_chroot::album()->right_ptr < $item->right_ptr) {
             return false;
         }
     }
     return parent::user_can($user, $perm_name, $item);
 }
示例#4
0
 static function root()
 {
     return user_chroot::album() ? user_chroot::album() : parent::root();
 }