/** * Checks to see if a password is needed * * Returns true if access is allowed * * The password protection is hereditary. This normally only impacts direct url access to an object since if * you are going down the tree you will be stopped at the first place a password is required. * * * @param string $hint the password hint * @param bool $show whether there is a user associated with the password. * @return bool * @since 1.1.3 */ function checkAccess(&$hint = NULL, &$show = NULL) { global $_zp_current_album, $_zp_current_search, $_zp_gallery, $_zp_gallery_page, $_zp_current_zenpage_page, $_zp_current_zenpage_news; if (GALLERY_SECURITY != 'public') { // only registered users allowed $show = true; } // therefore they will need to supply their user id is something fails below if ($_zp_gallery->isUnprotectedPage(stripSuffix($_zp_gallery_page))) { return true; } if (zp_loggedin()) { $fail = zp_apply_filter('isMyItemToView', NULL); if (!is_null($fail)) { // filter had something to say about access, honor it return $fail; } switch ($_zp_gallery_page) { case 'album.php': case 'image.php': if ($_zp_current_album->isMyItem(LIST_RIGHTS)) { return true; } break; case 'search.php': if (zp_loggedin(VIEW_SEARCH_RIGHTS)) { return true; } break; default: if (zp_loggedin(VIEW_GALLERY_RIGHTS)) { return true; } break; } } if (GALLERY_SECURITY == 'public' && ($access = checkForGuest($hint, $show))) { return $access; // public page or a guest is logged in } return false; }
/** * Checks to see if a password is needed * * Returns true if access is allowed * * The password protection is hereditary. This normally only impacts direct url access to an object since if * you are going down the tree you will be stopped at the first place a password is required. * * * @param string $hint the password hint * @param bool $show whether there is a user associated with the password. * @return bool * @since 1.1.3 */ function checkAccess(&$hint, &$show) { global $_zp_current_album, $_zp_current_search, $_zp_gallery, $_zp_gallery_page, $_zp_current_zenpage_page, $_zp_current_zenpage_news; if ($_zp_gallery->isUnprotectedPage(stripSuffix($_zp_gallery_page))) { return true; } if (zp_loggedin()) { $fail = zp_apply_filter('isMyItemToView', NULL); if (!is_null($fail)) { // filter had something to say about access, honor it return $fail; } switch ($_zp_gallery_page) { case 'album.php': case 'image.php': if ($_zp_current_album->isMyItem(LIST_RIGHTS)) { return true; } break; case 'search.php': return zp_loggedin(VIEW_SEARCH_RIGHTS); break; default: return zp_loggedin(VIEW_GALLERY_RIGHTS); break; } } if (GALLERY_SECURITY == 'private') { // only registered users allowed return false; } if (checkForGuest($hint, $show)) { return true; // a guest is logged in } return false; }