当前位置: 首页>>代码示例>>PHP>>正文


PHP Album::checkAccess方法代码示例

本文整理汇总了PHP中Album::checkAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::checkAccess方法的具体用法?PHP Album::checkAccess怎么用?PHP Album::checkAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Album的用法示例。


在下文中一共展示了Album::checkAccess方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getImageAlbumAlbumList

/**
 *
 * used to get a list of albums to be further processed
 * @param object $obj from whence to get the albums
 * @param array $albumlist collects the list
 */
function getImageAlbumAlbumList($obj, &$albumlist)
{
    global $_zp_gallery;
    $hint = $show = false;
    $locallist = $obj->getAlbums();
    foreach ($locallist as $folder) {
        $album = new Album($_zp_gallery, $folder);
        if (!$album->isDynamic() && $album->checkAccess($hint, $show)) {
            $albumlist[] = $album->getID();
            getImageAlbumAlbumList($album, $albumlist);
        }
    }
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:19,代码来源:image_album_statistics.php

示例2: getNewsContent

/**
 * Gets the content of a news article
 *
 * If using the CombiNews feature this returns the description for gallery items (see printNewsContent for more)
 *
 * @param int $shorten The optional length of the content for the news list for example, will override the plugin option setting if set, "" (empty) for full content (not used for image descriptions!)
 * @param string $shortenindicator The placeholder to mark the shortening (e.g."(...)"). If empty the Zenpage option for this is used.
 * @param string $readmore The text for the "read more" link. If empty the term set in Zenpage option is used.
 *
 * @return string
 */
function getNewsContent($shorten = false, $shortenindicator = NULL, $readmore = NULL)
{
    global $_zp_flash_player, $_zp_current_image, $_zp_gallery, $_zp_current_zenpage_news, $_zp_page;
    $newstype = getNewsType();
    switch ($newstype) {
        case 'news':
            if (!$_zp_current_zenpage_news->checkAccess()) {
                return '<p>' . gettext('<em>This article belongs to a protected category.</em>') . '</p>';
            }
            break;
        case 'image':
            $album = getNewsAlbumName();
            $albumobj = new Album($_zp_gallery, $album);
            if (!$albumobj->checkAccess()) {
                return '<p>' . gettext('<em>This entry belongs to a protected album.</em>') . '</p>';
            }
            break;
        case 'album':
            if (!$_zp_current_zenpage_news->checkAccess()) {
                return '<p>' . gettext('<em>This entry belongs to a protected album.</em>') . '</p>';
            }
            break;
    }
    $excerptbreak = false;
    if (!$shorten && !is_NewsArticle()) {
        $shorten = ZP_SHORTEN_LENGTH;
    }
    $articlecontent = "";
    $size = ZP_CN_IMAGESIZE;
    $width = ZP_CN_THUMBWIDTH;
    $height = ZP_CN_THUMBHEIGHT;
    $cropwidth = ZP_CN_CROPWIDTH;
    $cropheight = ZP_CN_CROPHEIGHT;
    $cropx = ZP_CN_CROPX;
    $cropy = ZP_CN_CROPY;
    $mode = ZP_CN_MODE;
    switch ($newstype) {
        case 'news':
            $articlecontent = $_zp_current_zenpage_news->getContent();
            if (!is_NewsArticle()) {
                $articlecontent = getContentShorten($articlecontent, $shorten, $shortenindicator, $readmore, getNewsURL($_zp_current_zenpage_news->getTitlelink()));
            }
            break;
        case 'image':
            switch ($mode) {
                case 'latestimages-sizedimage':
                    if (isImagePhoto($_zp_current_zenpage_news)) {
                        $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getImageLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '">';
                        $articlecontent .= '<img src="' . html_encode($_zp_current_zenpage_news->getSizedImage($size)) . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" />';
                        $articlecontent .= '</a>';
                    } else {
                        if (isImageVideo($_zp_current_zenpage_news)) {
                            $articlecontent .= $_zp_current_zenpage_news->getSizedImage($size);
                        } else {
                            $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getImageLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '">';
                            $articlecontent .= '<img src="' . html_encode($_zp_current_zenpage_news->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, true)) . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" />';
                            $articlecontent .= '</a>';
                        }
                    }
                    break;
                case 'latestimages-thumbnail':
                    $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getImageLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '"><img src="' . html_encode($_zp_current_zenpage_news->getThumb()) . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" /></a>';
                    break;
                case 'latestimages-thumbnail-customcrop':
                    if (isImagePhoto($_zp_current_zenpage_news)) {
                        $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getImageLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '"><img src="' . html_encode($_zp_current_zenpage_news->getCustomImage(NULL, $width, $height, $cropwidth, $cropheight, $cropx, $cropy)) . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" /></a>';
                    } else {
                        $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getImageLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '"><img src="' . html_encode($_zp_current_zenpage_news->getCustomImage(NULL, $width, $height, $cropwidth, $cropheight, $cropx, $cropy, true)) . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" /></a>';
                    }
                    break;
            }
            $articlecontent .= getContentShorten($_zp_current_zenpage_news->getDesc(), $shorten, $shortenindicator, $readmore, $_zp_current_zenpage_news->getImageLink());
            break;
        case 'video':
            $articlecontent = getNewsVideoContent($_zp_current_zenpage_news, $shorten);
            break;
        case 'album':
            $_zp_page = 1;
            $albumdesc = getContentShorten($_zp_current_zenpage_news->getDesc(), $shorten, $shortenindicator, $readmore, $_zp_current_zenpage_news->getAlbumLink());
            $albumthumbobj = $_zp_current_zenpage_news->getAlbumThumbImage();
            switch ($mode) {
                case 'latestalbums-sizedimage':
                    if (isImagePhoto($albumthumbobj)) {
                        $imgurl = html_encode($albumthumbobj->getSizedImage($size));
                    } else {
                        $imgurl = html_encode($albumthumbobj->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, true));
                    }
                    $articlecontent = '<a href="' . html_encode($_zp_current_zenpage_news->getAlbumLink()) . '" title="' . html_encode($_zp_current_zenpage_news->getTitle()) . '"><img src="' . $imgurl . '" alt="' . html_encode($_zp_current_zenpage_news->getTitle()) . '" /></a>' . $albumdesc;
                    break;
//.........这里部分代码省略.........
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:101,代码来源:zenpage-template-functions.php

示例3: strpos

/* Prevent hotlinking to the full image from other servers. */
$server = $_SERVER['SERVER_NAME'];
if (isset($_SERVER['HTTP_REFERER'])) {
    $test = strpos($_SERVER['HTTP_REFERER'], $server);
} else {
    $test = true;
}
if ($test == FALSE && getOption('hotlink_protection')) {
    /* It seems they are directly requesting the full image. */
    $i = 'index.php?album=' . $album8 . '&image=' . $image8;
    header("Location: {$i}");
    exit;
}
$_zp_gallery = new Gallery();
$albumobj = new Album($_zp_gallery, $album8);
if (!$albumobj->checkAccess() && !zp_loggedin(VIEW_FULLIMAGE_RIGHTS)) {
    //	handle password form if posted
    zp_handle_password('zp_image_auth', getOption('protected_image_password'), getOption('protected_image_user'));
    //check for passwords
    $hash = getOption('protected_image_password');
    $authType = 'zp_image_auth';
    $hint = get_language_string(getOption('protected_image_hint'));
    $show = getOption('protected_image_user');
    if (empty($hash)) {
        // check for album password
        $hash = $albumobj->getPassword();
        $authType = "zp_album_auth_" . $albumobj->get('id');
        $hint = $albumobj->getPasswordHint();
        $show = $albumobj->getUser();
        if (empty($hash)) {
            $albumobj = $albumobj->getParent();
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:31,代码来源:full-image.php


注:本文中的Album::checkAccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。