is_album()) { $album_item = $item; } else { $album_item = $item->parent(); } } else { $album_item = $album_item->parent(); } $existing_password = ORM::factory("items_albumpassword")->where("album_id", "=", $album_item->id)->find(); if ($existing_password->loaded()) { if ((cookie::get("g3_albumpassword") != $existing_password->password) && (identity::active_user()->id != $album_item->owner_id)) { throw new Kohana_404_Exception(); } } } while ($album_item->parent_id > 0); } } }