where("item_id", "=", $item->id)->order_by("cache_id")->find_all(); if (count($item_protected) > 0) { $existing_password = ORM::factory("items_albumpassword")->where("id", "=", $item_protected[0]->password_id)->find(); if ($existing_password->loaded()) { if ((cookie::get("g3_albumpassword") != $existing_password->password) && (identity::active_user()->id != $item->owner_id) && (!identity::active_user()->admin)) { throw new Kohana_404_Exception(); } } } } } }