- Code cleanup
- Comments
This commit is contained in:
parent
52bef7234d
commit
071f3f3831
|
@ -21,20 +21,23 @@
|
|||
class user_chroot_Core {
|
||||
private static $_album = null;
|
||||
|
||||
/**
|
||||
* Return the root album of the current user, or false if the user is not
|
||||
* chrooted.
|
||||
*/
|
||||
public static function album() {
|
||||
if( is_null(self::$_album) ) {
|
||||
self::$_album = false;
|
||||
|
||||
$user = identity::active_user();
|
||||
$item = ORM::factory('item')
|
||||
->join('user_chroots', 'items.id', 'user_chroots.album_id')
|
||||
->where('user_chroots.id', '=', identity::active_user()->id)
|
||||
->find();
|
||||
|
||||
$user_chroot = ORM::factory("user_chroot", $user->id);
|
||||
if( $user_chroot->loaded() && $user_chroot->album_id != 0 ) {
|
||||
$item = ORM::factory("item", $user_chroot->album_id);
|
||||
if( $item->loaded() ) {
|
||||
self::$_album = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return self::$_album;
|
||||
}
|
||||
|
|
Reference in New Issue
Block a user