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


PHP checkAlbumPassword函数代码示例

本文整理汇总了PHP中checkAlbumPassword函数的典型用法代码示例。如果您正苦于以下问题:PHP checkAlbumPassword函数的具体用法?PHP checkAlbumPassword怎么用?PHP checkAlbumPassword使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: no_show_hideAlbum

function no_show_hideAlbum($albumObj)
{
    $check = checkAlbumPassword($albumObj);
    if ($check == 'zp_public_access') {
        $albumObj->exists = $albumObj->getShow();
    }
    return $albumObj;
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:8,代码来源:no_show.php

示例2: createAlbumZip

/**
 * Creates a zip file of the album
 *
 * @param string $album album folder
 */
function createAlbumZip($album)
{
    global $_zp_zip_list;
    if (!checkAlbumPassword($album, $hint)) {
        pageError();
        exit;
    }
    $album = UTF8ToFilesystem($album);
    $rp = realpath(getAlbumFolder() . $album) . '/';
    $p = $album . '/';
    include_once 'archive.php';
    $dest = realpath(getAlbumFolder()) . '/' . urlencode($album) . ".zip";
    $persist = getOption('persistent_archive');
    if (!$persist || !file_exists($dest)) {
        if (file_exists($dest)) {
            unlink($dest);
        }
        $z = new zip_file($dest);
        $z->set_options(array('basedir' => $rp, 'inmemory' => 0, 'recurse' => 0, 'storepaths' => 1));
        if ($dh = opendir($rp)) {
            $_zp_zip_list[] = '*.*';
            while (($file = readdir($dh)) !== false) {
                if ($file != '.' && $file != '..') {
                    if (is_dir($rp . $file)) {
                        $base_a = explode("/", $album);
                        unset($base_a[count($base_a) - 1]);
                        $base = implode('/', $base_a);
                        zipAddSubalbum($rp, $base, $file, $z);
                    }
                }
            }
            closedir($dh);
        }
        $z->add_files($_zp_zip_list);
        $z->create_archive();
    }
    header('Content-Type: application/zip');
    header('Content-Disposition: attachment; filename="' . urlencode($album) . '.zip"');
    header("Content-Length: " . filesize($dest));
    printLargeFileContents($dest);
    if (!$persist) {
        unlink($dest);
    }
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:49,代码来源:album-zip.php

示例3: createAlbumZip

/**
 * Creates a zip file of the album
 *
 * @param string $albumname album folder
 */
function createAlbumZip($albumname)
{
    global $_zp_zip_list, $zip_gallery;
    $zip_gallery = new Gallery();
    $album = new Album($zip_gallery, $albumname);
    if (!$album->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumname)) {
        pageError(403, gettext("Forbidden"));
        exit;
    }
    if (!$album->exists) {
        pageError(404, gettext('Album not found'));
        exit;
    }
    $persist = $zip_gallery->getPersistentArchive();
    $dest = $album->localpath . '.zip';
    if (!$persist || !file_exists($dest)) {
        include_once 'archive.php';
        $curdir = getcwd();
        chdir($album->localpath);
        $_zp_zip_list = array();
        $z = new zip_file($dest);
        $z->set_options(array('basedir' => realpath($album->localpath . '/'), 'inmemory' => 0, 'recurse' => 0, 'storepaths' => 1));
        zipAddAlbum($album, strlen($albumname), $z);
        $z->add_files($_zp_zip_list);
        $z->create_archive();
        unset($_zp_zip_list);
        chdir($curdir);
    }
    header('Content-Type: application/zip');
    header('Content-Disposition: attachment; filename="' . pathurlencode($albumname) . '.zip"');
    header("Content-Length: " . filesize($dest));
    printLargeFileContents($dest);
    if (!$persist) {
        unlink($dest);
    }
    unset($zip_gallery);
    unset($album);
    unset($persist);
    unset($dest);
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:45,代码来源:album-zip.php

示例4: printGslideshow

/**
 * Prints the Galleria slideshow for albums or search results.
 *
 * Two ways to use (see readme/documentation):
 * a) Used on the included theme slideshow.php page and called via printSlideShowLink() from the core slideshow plugin:
 * b) Calling directly via printGslideshow() function in a template file or codeblock.
 *
 * @param obj $albumobj The object of the album to show the slideshow of. Not needed if calling slideshow from album, image, or search.
 * @param obj $imageobj The object of the image to start the slideshow with. If not set the slideshow starts with the first image of the album, or current image if called from image.php. Not needed if calling slideshow from album, image, or search.
 * @param bool $linkslides Set to true if you want the slides to be linked to their image pages
 * @param mixed $autoplay true to autoplay slideshow with interval set in options, false to start with slideshow stopped.  Set integer in milliseconds to autoplay at that interval (Ex. 4000), overriding plugin option set.
 * @param bool $shuffle Set to true if you want random (shuffled) order of the slides
 *
 * */
function printGslideshow($albumobj = null, $imageobj = null, $linkslides = true, $autoplay = true, $forceheight = false, $shuffle = false)
{
    $data = 'data';
    // no POST data from slidehow link and $albumobj provided is not valid, exit
    if (!isset($_POST['albumid']) and !is_object($albumobj)) {
        echo "<div class=\"errorbox\" id=\"message\"><h2>" . gettext("Invalid linking to the slideshow page.") . "</h2></div>";
        echo "</div></body></html>";
        exitZP();
    }
    global $_zp_current_image, $_zp_current_album, $_zp_gallery, $_myFavorites, $_zp_conf_vars;
    $imagenumber = 0;
    //getting the image to start with
    if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
        $imagenumber = sanitize_numeric($_POST['imagenumber']) - 1;
        // slideshows starts with 0, but zp with 1.
    } elseif (is_object($imageobj)) {
        makeImageCurrent($imageobj);
        $imagenumber = imageNumber() - 1;
    }
    // set pagenumber to 0 if not called via POST link
    if (isset($_POST['pagenr'])) {
        $pagenumber = sanitize_numeric($_POST['pagenr']);
    } else {
        $pagenumber = 1;
    }
    // getting the number of images
    if (!empty($_POST['numberofimages'])) {
        $numberofimages = sanitize_numeric($_POST['numberofimages']);
    } elseif (is_object($albumobj)) {
        $numberofimages = $albumobj->getNumImages();
    } else {
        $numberofimages = 0;
    }
    if ($imagenumber < 2 || $imagenumber > $numberofimages) {
        $imagenumber = 0;
    }
    //getting the album to show
    if (!empty($_POST['albumid']) && !is_object($albumobj)) {
        $albumid = sanitize_numeric($_POST['albumid']);
        $embedded = false;
    } elseif (is_object($albumobj)) {
        $albumid = $albumobj->getID();
        $embedded = true;
    } else {
        $albumid = 0;
        $embedded = false;
    }
    if ($numberofimages == 0) {
        return NULL;
    }
    // get slideshow data
    if (isset($_POST['preserve_search_params'])) {
        // search page
        $search = new SearchEngine();
        $params = sanitize($_POST['preserve_search_params']);
        $search->setSearchParams($params);
        $images = $search->getImages(0);
        $searchwords = $search->getSearchWords();
        $searchdate = $search->getSearchDate();
        $searchfields = $search->getSearchFields(true);
        $page = $search->page;
        $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
        $albumtitle = gettext('Search');
    } else {
        if (isset($_POST['favorites_page'])) {
            $album = $_myFavorites;
            $albumtitle = gettext('My Favorites');
            $images = $album->getImages(0);
            $returnpath = rewrite_path(favorites::getFavorites_link() . '/' . $pagenumber, FULLWEBPATH . '/index.php?p=favorites' . '&page=' . $pagenumber);
        } else {
            $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
            $album = newAlbum($albumq['folder']);
            $albumtitle = $album->getTitle();
            if (!$album->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumq['folder'])) {
                echo gettext("This album is password protected!");
                exitZP();
            }
            $dynamic = $album->isDynamic();
            $images = $album->getImages(0);
            // return path to get back to the page we called the slideshow from
            if (empty($_POST['imagenumber'])) {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/page/' . $pagenumber, '/index.php?album=' . urlencode($album->name) . '&page=' . $pagenumber);
            } else {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/' . rawurlencode(sanitize($_POST['imagefile'])) . getOption('mod_rewrite_image_suffix'), '/index.php?album=' . urlencode($album->name) . '&image=' . urlencode($_POST['imagefile']));
            }
        }
//.........这里部分代码省略.........
开发者ID:kokyandrei,项目名称:Unsupported,代码行数:101,代码来源:gslideshow.php

示例5: getCombiNews

/**
 * Gets news articles and images of a gallery to show them together on the news section
 *
 * NOTE: This function does not exclude articles that are password protected via a category
 *
 * @param int $articles_per_page The number of articles to get
 * @param string $mode 	"latestimages-thumbnail"
 *											"latestimages-thumbnail-customcrop"
 *											"latestimages-sizedimage"
 *											"latestalbums-thumbnail"
 *		 									"latestalbums-thumbnail-customcrop"
 *		 									"latestalbums-sizedimage"
 *		 									"latestimagesbyalbum-thumbnail"
 *		 									"latestimagesbyalbum-thumbnail-customcrop"
 *		 									"latestimagesbyalbum-sizedimage"
 *		 									"latestupdatedalbums-thumbnail" (for RSS and getLatestNews() used only)
 *		 									"latestupdatedalbums-thumbnail-customcrop" (for RSS and getLatestNews() used only)
 *		 									"latestupdatedalbums-sizedimage" (for RSS and getLatestNews() used only)
 *	NOTE: The "latestupdatedalbums" variants do NOT support pagination as required on the news loop!
 *
 * @param string $published "published" for published articles,
 * 													"unpublished" for un-published articles,
 * 													"all" for all articles
 * @param string $sortorder 	id, date or mtime, only for latestimages-... modes
 * @param bool $sticky set to true to place "sticky" articles at the front of the list.
 * @return array
 */
function getCombiNews($articles_per_page = '', $mode = '', $published = NULL, $sortorder = '', $sticky = true)
{
    deprecated_function_notify(gettext('Use the Zenpage class method instead.'));
    global $_zp_gallery, $_zp_flash_player;
    processExpired('news');
    if (is_null($published)) {
        if (zp_loggedin(ZENPAGE_NEWS_RIGHTS)) {
            $published = "all";
        } else {
            $published = "published";
        }
    }
    if (empty($mode)) {
        $mode = getOption("zenpage_combinews_mode");
    }
    if ($published == "published") {
        $show = " WHERE `show` = 1 AND date <= '" . date('Y-m-d H:i:s') . "'";
        $imagesshow = " AND images.show = 1 ";
    } else {
        $show = "";
        $imagesshow = "";
    }
    $passwordcheck = "";
    if (zp_loggedin(ZENPAGE_NEWS_RIGHTS)) {
        $albumWhere = "";
        $passwordcheck = "";
    } else {
        $albumscheck = query_full_array("SELECT * FROM " . prefix('albums') . " ORDER BY title");
        foreach ($albumscheck as $albumcheck) {
            if (!checkAlbumPassword($albumcheck['folder'])) {
                $albumpasswordcheck = " AND albums.id != " . $albumcheck['id'];
                $passwordcheck = $passwordcheck . $albumpasswordcheck;
            }
        }
        $albumWhere = "AND albums.show=1" . $passwordcheck;
    }
    $limit = getLimitAndOffset($articles_per_page);
    if (empty($sortorder)) {
        $combinews_sortorder = getOption("zenpage_combinews_sortorder");
    } else {
        $combinews_sortorder = $sortorder;
    }
    $stickyorder = '';
    if ($sticky) {
        $stickyorder = 'sticky DESC,';
    }
    $type3 = query("SET @type3:='0'");
    switch ($mode) {
        case "latestimages-thumbnail":
        case "latestimages-thumbnail-customcrop":
        case "latestimages-sizedimage":
            $sortorder = "images." . $combinews_sortorder;
            $type1 = query("SET @type1:='news'");
            $type2 = query("SET @type2:='images'");
            switch ($combinews_sortorder) {
                case 'id':
                case 'date':
                    $imagequery = "(SELECT albums.folder, images.filename, images.date, @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
                    break;
                case 'mtime':
                    $imagequery = "(SELECT albums.folder, images.filename, FROM_UNIXTIME(images.mtime), @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
                    break;
            }
            $result = query_full_array("(SELECT title as albumname, titlelink, date, @type1 as type, sticky FROM " . prefix('news') . " " . $show . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $imagequery . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY {$stickyorder} date DESC {$limit}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
            break;
        case "latestalbums-thumbnail":
        case "latestalbums-thumbnail-customcrop":
        case "latestalbums-sizedimage":
            $sortorder = $combinews_sortorder;
            $type1 = query("SET @type1:='news'");
            $type2 = query("SET @type2:='albums'");
            switch ($combinews_sortorder) {
                case 'id':
//.........这里部分代码省略.........
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:101,代码来源:deprecated-functions.php

示例6: create

 /**
  * Creates a zip file of the album
  *
  * @param string $albumname album folder
  * @param bool fromcache if true, images will be the "sized" image in the cache file
  */
 static function create($albumname, $fromcache)
 {
     global $_zp_zip_list, $_zp_gallery, $defaultSize;
     $album = newAlbum($albumname);
     if (!$album->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumname)) {
         self::pageError(403, gettext("Forbidden"));
     }
     if (!$album->exists) {
         self::pageError(404, gettext('Album not found'));
     }
     $_zp_zip_list = array();
     if ($fromcache) {
         $opt = array('large_file_size' => 5 * 1024 * 1024, 'comment' => sprintf(gettext('Created from cached images of %1$s on %2$s.'), $album->name, zpFormattedDate(DATE_FORMAT, time())));
         loadLocalOptions(false, $_zp_gallery->getCurrentTheme());
         $defaultSize = getOption('image_size');
         self::AddAlbumCache($album, strlen($albumname), SERVERPATH . '/' . CACHEFOLDER . '/' . $albumname);
     } else {
         $opt = array('large_file_size' => 5 * 1024 * 1024, 'comment' => sprintf(gettext('Created from images in %1$s on %2$s.'), $album->name, zpFormattedDate(DATE_FORMAT, time())));
         self::AddAlbum($album, strlen($albumname), SERVERPATH . '/' . ALBUMFOLDER . '/' . $albumname);
     }
     $zip = new ZipStream($albumname . '.zip', $opt);
     foreach ($_zp_zip_list as $path => $file) {
         @set_time_limit(6000);
         $zip->add_file_from_path(internalToFilesystem($file), internalToFilesystem($path));
     }
     $zip->finish();
 }
开发者ID:rb26,项目名称:zenphoto,代码行数:33,代码来源:downloadList.php

示例7: checkforPassword

/**
 * Checks to see if a password is needed
 * displays a password form if log-on is required
 *
 * Returns true if a login form has been displayed
 *
 * The password protection is hereditary. This normally only impacts direct url access to an album or image since if
 * you are going down the tree you will be stopped at the first place a password is required.
 *
 * If the gallery is password protected then every album & image will require that password.
 *
 * If an album is password protected then all subalbums and images treed below that album will require
 * the password. If there are multiple passwords in the tree and you direct link, the password that is
 * required will be that of the nearest parent that has a password. (The gallery is the ur-parrent to all
 * albums.)
 *
 * @param bool $silent set to true to inhibit the logon form
 * @return bool
 * @since 1.1.3
 */
function checkforPassword($silent = false)
{
    global $_zp_current_album, $_zp_current_search, $_zp_gallery, $_zp_loggedin;
    if (zp_loggedin(MAIN_RIGHTS | VIEWALL_RIGHTS | ALL_ALBUMS_RIGHTS)) {
        return false;
    }
    // you're the admin, you don't need the passwords.
    if (in_context(ZP_SEARCH)) {
        // search page
        $hash = getOption('search_password');
        $show = getOption('search_user') != '';
        $hint = get_language_string(getOption('search_hint'));
        $authType = 'zp_search_auth';
        if (empty($hash)) {
            $hash = getOption('gallery_password');
            $show = getOption('gallery_user') != '';
            $hint = get_language_string(getOption('gallery_hint'));
            $authType = 'zp_gallery_auth';
        }
        if (!empty($hash)) {
            if (zp_getCookie($authType) != $hash) {
                if (!$silent) {
                    printPasswordForm($hint, true, getOption('login_user_field') || $show);
                }
                return true;
            }
        }
    } else {
        if (isset($_GET['album'])) {
            // album page
            list($album, $image) = rewrite_get_album_image('album', 'image');
            if (checkAlbumPassword($album, $hint)) {
                return false;
            } else {
                if (!$silent) {
                    $alb = new Album($_zp_gallery, $album);
                    printPasswordForm($hint, true, getOption('login_user_field') || $alb->getUser() != '');
                }
                return true;
            }
        } else {
            // index page
            if ($_zp_loggedin) {
                return false;
            }
            $hash = getOption('gallery_password');
            $hint = get_language_string(getOption('gallery_hint'));
            if (!empty($hash)) {
                if (zp_getCookie('zp_gallery_auth') != $hash) {
                    if (!$silent) {
                        printPasswordForm($hint, true, getOption('login_user_field') || getOption('gallery_user') != '');
                    }
                    return true;
                }
            }
        }
    }
    return false;
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:79,代码来源:template-functions.php

示例8: printRating

/**
 * Prints the rating star form and the current rating
 * Insert this function call in the page script where you
 * want the star ratings to appear.
 *
 * NOTE:
 * If $vote is false or the rating_recast option is false then
 * the stars shown will be the rating. Otherwise the stars will
 * show the value of the viewer's last vote.
 *
 * @param bool $vote set to false to disable voting
 * @param object $object optional object for the ratings target. If not set, the current page object is used
 * @param bool $text if false, no annotation text is displayed
 */
function printRating($vote = 3, $object = NULL, $text = true)
{
    global $_zp_gallery_page;
    if (is_null($object)) {
        $object = jquery_rating::getCurrentPageObject();
    }
    if (!is_object($object)) {
        return;
    }
    $table = $object->table;
    $vote = min($vote, getOption('rating_status'), $object->get('rating_status'));
    switch ($vote) {
        case 1:
            // members only
            if (!zp_loggedin()) {
                $vote = 0;
            }
            break;
        case 2:
            // members & guests
            switch ($_zp_gallery_page) {
                case 'album.php':
                    $album = $object;
                    $hint = '';
                    if (!(zp_loggedin() || checkAlbumPassword($album->name))) {
                        $vote = 0;
                    }
                    break;
                case 'pages.php':
                case 'news.php':
                    if (!zp_loggedin()) {
                        // no guest password
                        $vote = 0;
                    }
                    break;
                default:
                    $album = $object->getAlbum();
                    $hint = '';
                    if (!(zp_loggedin() || checkAlbumPassword($album->name))) {
                        $vote = 0;
                    }
                    break;
            }
    }
    $stars = ceil(getOption('rating_stars_count'));
    $recast = getOption('rating_recast');
    $split_stars = max(1, getOption('rating_split_stars'));
    $rating = $object->get('rating');
    $votes = $object->get('total_votes');
    $id = $object->getID();
    $unique = '_' . $table . '_' . $id;
    $ip = jquery_rating::id();
    $oldrating = jquery_rating::getRatingByIP($ip, $object->get('used_ips'), $object->get('rating'));
    if ($vote && $recast == 2 && $oldrating) {
        $starselector = round($oldrating * $split_stars);
    } else {
        $starselector = round($rating * $split_stars);
    }
    $disable = !$vote || $oldrating && !$recast;
    if ($rating > 0) {
        $msg = sprintf(ngettext('Rating %2$.1f (%1$u vote)', 'Rating %2$.1f (%1$u votes)', $votes), $votes, $rating);
    } else {
        $msg = gettext('Not yet rated');
    }
    if ($split_stars > 1) {
        $step = $split_stars;
        $split = " {split:{$step}}";
        $step = 1 / $step;
    } else {
        $split = '';
        $step = 1;
    }
    ?>
	<form name="star_rating<?php 
    echo $unique;
    ?>
" id="star_rating<?php 
    echo $unique;
    ?>
" action="submit">
		<?php 
    $j = 0;
    for ($i = $step; $i <= $stars; $i = $i + $step) {
        $v = ceil($i);
        $j++;
        ?>
//.........这里部分代码省略.........
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:rating.php

示例9: printSlideShow

    static function printSlideShow($heading = true, $speedctl = false, $albumobj = "", $imageobj = "", $width = "", $height = "")
    {
        if (!isset($_POST['albumid']) and !is_object($albumobj)) {
            echo "<div class=\"errorbox\" id=\"message\"><h2>" . gettext("Invalid linking to the slideshow page.") . "</h2></div>";
            echo "</div></body></html>";
            exit;
        }
        global $_zp_flash_player, $_zp_current_image, $_zp_current_album, $_zp_gallery;
        //getting the image to start with
        if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
            $imagenumber = $_POST['imagenumber'] - 1;
            // slideshows starts with 0, but zp with 1.
        } elseif (is_object($imageobj)) {
            makeImageCurrent($imageobj);
            $imagenumber = imageNumber() - 1;
        } else {
            $imagenumber = 0;
        }
        // set pagenumber to 0 if not called via POST link
        if (isset($_POST['pagenr'])) {
            $pagenumber = sanitize_numeric($_POST['pagenr']);
        } else {
            $pagenumber = 0;
        }
        // getting the number of images
        if (!empty($_POST['numberofimages'])) {
            $numberofimages = sanitize_numeric($_POST['numberofimages']);
        } elseif (is_object($albumobj)) {
            $numberofimages = $albumobj->getNumImages();
        }
        //getting the album to show
        if (!empty($_POST['albumid']) and !is_object($albumobj)) {
            $albumid = sanitize_numeric($_POST['albumid']);
        } elseif (is_object($albumobj)) {
            $albumid = $albumobj->id;
        } else {
            $albumid = -1;
        }
        // setting the image size
        if (!empty($width) and !empty($height)) {
            $width = sanitize_numeric($width);
            $height = sanitize_numeric($height);
        } else {
            $width = getOption("slideshow_width");
            $height = getOption("slideshow_height");
        }
        $option = getOption("slideshow_mode");
        // jQuery Cycle slideshow config
        // get slideshow data
        $gallery = new Gallery();
        if ($albumid <= 0) {
            // search page
            $dynamic = 2;
            $search = new SearchEngine();
            $params = $_POST['preserve_search_params'];
            $search->setSearchParams($params);
            $images = $search->getImages(0);
            $searchwords = $search->words;
            $searchdate = $search->dates;
            $searchfields = $search->fields;
            $page = $search->page;
            if (empty($_POST['imagenumber'])) {
                $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . abs($albumid));
                $album = new Album($gallery, $albumq['folder']);
                $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
                //$returnpath = rewrite_path('/'.pathurlencode($album->name).'/page/'.$pagenumber,'/index.php?album='.urlencode($album->name).'&page='.$pagenumber);
            } else {
                $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
            }
            $albumtitle = gettext('Search');
        } else {
            $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
            $album = new Album($gallery, $albumq['folder']);
            $albumtitle = $album->getTitle();
            if (!checkAlbumPassword($albumq['folder'], $hint)) {
                echo gettext("This album is password protected!");
                exit;
            }
            $dynamic = $album->isDynamic();
            $images = $album->getImages(0);
            // return path to get back to the page we called the slideshow from
            if (empty($_POST['imagenumber'])) {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/page/' . $pagenumber, '/index.php?album=' . urlencode($album->name) . '&page=' . $pagenumber);
            } else {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/' . rawurlencode($_POST['imagefile']) . getOption('mod_rewrite_image_suffix'), '/index.php?album=' . urlencode($album->name) . '&image=' . urlencode($_POST['imagefile']));
            }
        }
        // slideshow display section
        switch ($option) {
            case "jQuery":
                $validtypes = array('jpg', 'jpeg', 'gif', 'png', 'mov', '3gp');
                ?>
					<script type="text/javascript">
						$(document).ready(function(){
							$(function() {
								var ThisGallery = '<?php 
                echo html_encode($albumtitle);
                ?>
';
								var ImageList = new Array();
//.........这里部分代码省略.........
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:101,代码来源:Overrides.php

示例10: checkForGuest

/**
 * returns the auth type of a guest login
 *
 * @param string $hint
 * @param string $show
 * @return string
 */
function checkForGuest(&$hint = NULL, &$show = NULL)
{
    global $_zp_gallery, $_zp_gallery_page, $_zp_current_zenpage_page, $_zp_current_category, $_zp_current_zenpage_news;
    $authType = zp_apply_filter('checkForGuest', NULL);
    if (!is_null($authType)) {
        return $authType;
    }
    if (in_context(ZP_SEARCH)) {
        // search page
        $hash = getOption('search_password');
        if (getOption('search_user') != '') {
            $show = true;
        }
        $hint = get_language_string(getOption('search_hint'));
        $authType = 'zp_search_auth';
        if (empty($hash)) {
            $hash = $_zp_gallery->getPassword();
            if ($_zp_gallery->getUser() != '') {
                $show = true;
            }
            $hint = $_zp_gallery->getPasswordHint();
            $authType = 'zp_gallery_auth';
        }
        if (!empty($hash) && zp_getCookie($authType) == $hash) {
            return $authType;
        }
    } else {
        if (!is_null($_zp_current_zenpage_news)) {
            $authType = $_zp_current_zenpage_news->checkAccess($hint, $show);
            return $authType;
        } else {
            if (isset($_GET['album'])) {
                // album page
                list($album, $image) = rewrite_get_album_image('album', 'image');
                if ($authType = checkAlbumPassword($album, $hint)) {
                    return $authType;
                } else {
                    $alb = newAlbum($album);
                    if ($alb->getUser() != '') {
                        $show = true;
                    }
                    return false;
                }
            } else {
                // other page
                $hash = $_zp_gallery->getPassword();
                if ($_zp_gallery->getUser() != '') {
                    $show = true;
                }
                $hint = $_zp_gallery->getPasswordHint();
                if (!empty($hash) && zp_getCookie('zp_gallery_auth') == $hash) {
                    return 'zp_gallery_auth';
                }
            }
        }
    }
    if (empty($hash)) {
        return 'zp_public_access';
    }
    return false;
}
开发者ID:IliyanGochev,项目名称:zenphoto,代码行数:68,代码来源:template-functions.php

示例11: flvPlaylist

/**
 * To show the content of an media album with .flv/.mp4/.mp3 movie/audio files only as a playlist or as separate players with flv player
 * NOTE: The flv player plugin needs to be installed (This plugin currently internally uses FLV player 3 because of FLV player 4 Api changes!)
 *
 * The playlist is meant to replace the 'next_image()' loop on a theme's album.php.
 * It can be used with a special 'album theme' that can be assigned to media albums with with .flv/.mp4/.mp3s
 * movie/audio files only. See the examples below
 * You can either show a 'one player window' playlist or show all items as separate players paginated
 * (set in the settings for thumbs per page) on one page (like on a audio or podcast blog).
 *
 * If there is no preview image for a mp3 file existing only the player control bar is shown.
 *
 * The two modes:
 * a) 'playlist'
 * Replace the entire 'next_image()' loop on album.php with this:
 * <?php flvPlaylist("playlist"); ?>
 *
 * It uses a xspf file found in 'zp-core/flvplayer/flvplayer/playlist.php' for the playlist that you also can modify. You can also use other XML formats for a playlist See http://developer.longtailvideo.com/trac/wiki/FlashFormats
 *
 * b) 'players'
 * Modify the 'next_image()' loop on album.php like this:
 * <?php
 * while (next_image():
 * printImageTitle();
 * flvPlaylist("players");
 * endwhile;
 * ?>
 * Of course you can add further functions to b) like title, description, date etc., too.
 *
 * @param string $option the mode to use "playlist" or "players"
 */
function flvPlaylist($option = '')
{
    global $_zp_current_album, $_zp_current_image, $_flv_player, $_zp_flash_player;
    if (checkAlbumPassword($_zp_current_album->getFolder(), $hint)) {
        if ($option === "players") {
            $moviepath = getUnprotectedImageURL();
            $ext = strtolower(strrchr(getUnprotectedImageURL(), "."));
        }
        $imagetitle = getImageTitle();
    }
    $albumid = getAlbumID();
    switch ($option) {
        case "playlist":
            if (getNumImages() != 0) {
                ?>
	<div id="flvplaylist"><?php 
                echo gettext("The flv player is not installed. Please install or activate the flv player plugin.");
                ?>
</div>
	<script type="text/javascript">

		var so = new SWFObject('<?php 
                echo WEBPATH . '/' . USER_PLUGIN_FOLDER;
                ?>
/flvplayer/<?php 
                echo $_flv_player;
                ?>
','flvplaylist','<?php 
                echo getOption('flvplaylist_width');
                ?>
','<?php 
                echo getOption('flvplaylist_height');
                ?>
','8');
		so.addParam('allowfullscreen','true');
		so.addVariable('stretching','<?php 
                echo getOption('flv_player_stretching');
                ?>
');
		so.addVariable('playlist', '<?php 
                echo getOption('flvplaylist_position');
                ?>
');
		so.addVariable('playlistsize','<?php 
                echo getOption('flvplaylist_size');
                ?>
');
		so.addVariable('repeat','<?php 
                echo getOption('flvplaylist_repeat');
                ?>
');
		so.addVariable('backcolor','<?php 
                echo getOptionColor('flv_player_backcolor');
                ?>
');
		so.addVariable('frontcolor','<?php 
                echo getOptionColor('flv_player_frontcolor');
                ?>
');
		so.addVariable('lightcolor','<?php 
                echo getOptionColor('flv_player_lightcolor');
                ?>
');
		so.addVariable('screencolor','<?php 
                echo getOptionColor('flv_player_screencolor');
                ?>
');
		so.addVariable('file','<?php 
                echo WEBPATH . "/" . USER_PLUGIN_FOLDER;
//.........这里部分代码省略.........
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:101,代码来源:flvplayer.php

示例12: printRating

/**
 * Prints the rating star form and the current rating
 * Insert this function call in the page script where you
 * want the star ratings to appear.
 *
 * NOTE:
 * If $vote is false or the rating_recast option is false then
 * the stars shown will be the rating. Otherwise the stars will
 * show the value of the viewer's last vote.
 *
 * @param bool $vote set to false to disable voting
 * @param object $object optional object for the ratings target. If not set, the current page object is used
 * @param bool $text if false, no annotation text is displayed
 */
function printRating($vote = 3, $object = NULL, $text = true)
{
    global $_zp_gallery_page;
    if (is_null($object)) {
        $object = getCurrentPageObject();
    }
    if (!is_object($object)) {
        return;
    }
    $table = $object->table;
    $vote = min($vote, getOption('rating_status'), $object->get('rating_status'));
    switch ($vote) {
        case 1:
            // members only
            if (!zp_loggedin()) {
                $vote = 0;
            }
            break;
        case 2:
            // members & guests
            switch ($_zp_gallery_page) {
                case 'album.php':
                    $album = $object;
                    $hint = '';
                    if (!(zp_loggedin() || checkAlbumPassword($album->name))) {
                        $vote = 0;
                    }
                    break;
                case 'pages.php':
                case 'news.php':
                    if (!zp_loggedin()) {
                        // no guest password
                        $vote = 0;
                    }
                    break;
                default:
                    $album = $object->getAlbum();
                    $hint = '';
                    if (!(zp_loggedin() || checkAlbumPassword($album->name))) {
                        $vote = 0;
                    }
                    break;
            }
    }
    $rating = $object->get('rating');
    $votes = $object->get('total_votes');
    $id = $object->get('id');
    $unique = '_' . $table . '_' . $id;
    if (getOption('rating_hash_ip')) {
        $ip = sha1(getUserIP());
    } else {
        $ip = getUserIP();
    }
    $recast = getOption('rating_recast');
    $split_stars = getOption('rating_split_stars') + 1;
    $oldrating = getRatingByIP($ip, $object->get('used_ips'), $object->get('rating'));
    if ($vote && $recast == 2 && $oldrating) {
        $starselector = round($oldrating * $split_stars);
    } else {
        $starselector = round($rating * $split_stars);
    }
    $disable = !$vote || $oldrating && !$recast;
    if ($rating > 0) {
        $msg = sprintf(ngettext('Rating %2$.1f (%1$u vote)', 'Rating %2$.1f (%1$u votes)', $votes), $votes, $rating);
    } else {
        $msg = gettext('Not yet rated');
    }
    if ($split_stars > 1) {
        $split = ' {split:2}';
    } else {
        $split = '';
    }
    ?>
		<form name="star_rating<?php 
    echo $unique;
    ?>
" id="star_rating<?php 
    echo $unique;
    ?>
" action="submit">
			<input type="radio" class="star<?php 
    echo $split;
    ?>
" name="star_rating-value<?php 
    echo $unique;
    ?>
//.........这里部分代码省略.........
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:101,代码来源:rating.php

示例13: getImageStatistic

/**
 * Returns a list of image statistic according to $option
 *
 * @param string $number the number of images to get
 * @param string $option "popular" for the most popular images,
 *                       "latest" for the latest uploaded,
 *                       "latest-date" for the latest uploaded, but fetched by date,
 * 											 "latest-mtime" for the latest uploaded, but fetched by mtime,
 *                       "mostrated" for the most voted,
 *                       "toprated" for the best voted
 * @param string $albumfolder foldername of an specific album
 * @param bool $collection only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums
 * @return string
 */
function getImageStatistic($number, $option, $albumfolder = '', $collection = false)
{
    global $_zp_gallery;
    if (zp_loggedin()) {
        $albumWhere = " AND albums.folder != ''";
        $imageWhere = "";
        $passwordcheck = "";
    } else {
        $passwordcheck = '';
        $albumscheck = query_full_array("SELECT * FROM " . prefix('albums') . " ORDER BY title");
        foreach ($albumscheck as $albumcheck) {
            if (!checkAlbumPassword($albumcheck['folder'], $hint)) {
                $albumpasswordcheck = " AND albums.id != " . $albumcheck['id'];
                $passwordcheck = $passwordcheck . $albumpasswordcheck;
            }
        }
        $albumWhere = " AND albums.folder != '' AND albums.show=1" . $passwordcheck;
        $imageWhere = " AND images.show=1";
    }
    if (!empty($albumfolder)) {
        if ($collection) {
            $specificalbum = " albums.folder LIKE '" . $albumfolder . "/%' AND ";
        } else {
            $specificalbum = " albums.folder = '" . $albumfolder . "' AND ";
        }
    } else {
        $specificalbum = "";
    }
    switch ($option) {
        case "popular":
            $sortorder = "images.hitcounter";
            break;
        case "latest-date":
            $sortorder = "images.date";
            break;
        case "latest-mtime":
            $sortorder = "images.mtime";
            break;
        case "latest":
            $sortorder = "images.id";
            break;
        case "mostrated":
            $sortorder = "images.total_votes";
            break;
        case "toprated":
            $sortorder = "(images.total_value/images.total_votes)";
            break;
    }
    $imageArray = array();
    $images = query_full_array("SELECT images.albumid, images.filename AS filename, images.mtime as mtime, images.title AS title, " . "albums.folder AS folder, images.show, albums.show, albums.password FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums " . " WHERE " . $specificalbum . "images.albumid = albums.id " . $imageWhere . $albumWhere . " AND albums.folder != ''" . " ORDER BY " . $sortorder . " DESC LIMIT {$number}");
    foreach ($images as $imagerow) {
        $filename = $imagerow['filename'];
        $albumfolder2 = $imagerow['folder'];
        $desc = $imagerow['title'];
        // Album is set as a reference, so we can't re-assign to the same variable!
        $image = newImage(new Album($_zp_gallery, $albumfolder2), $filename);
        $imageArray[] = $image;
    }
    return $imageArray;
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:74,代码来源:image_album_statistics.php

示例14: getSearchImages

 /**
  * Returns an array of image names found in the search
  *
  * @return array
  */
 function getSearchImages()
 {
     $images = array();
     $searchstring = $this->getSearchString();
     $searchdate = $this->dates;
     if (empty($searchstring) && empty($searchdate)) {
         return $images;
     }
     // nothing to find
     $albumfolder = getAlbumFolder();
     $fields = $this->fields;
     $tagsSearch = $fields & SEARCH_TAGS;
     $fields = $fields & ~SEARCH_TAGS;
     $sql = $this->getSearchSQL($searchstring, $searchdate, 'images', $fields);
     if (!empty($sql)) {
         // valid fields exist
         $search_results = query_full_array($sql, true);
     }
     if ($tagsSearch && count($searchstring) > 0) {
         $idlist = array();
         if (isset($search_results) && is_array($search_results)) {
             foreach ($search_results as $row) {
                 $idlist[] = $row['id'];
             }
         }
         $search_results = $this->searchTags($searchstring, 'images', $idlist);
     }
     if (isset($search_results) && is_array($search_results)) {
         foreach ($search_results as $row) {
             $albumid = $row['albumid'];
             $query = "SELECT id, title, folder,`show` FROM " . prefix('albums') . " WHERE id = {$albumid}";
             $row2 = query_single_row($query);
             // id is unique
             $albumname = $row2['folder'];
             if (file_exists($albumfolder . UTF8ToFilesystem($albumname) . '/' . UTF8ToFilesystem($row['filename']))) {
                 if (checkAlbumPassword($albumname, $hint)) {
                     $images[] = array('filename' => $row['filename'], 'folder' => $albumname);
                 }
             }
         }
     }
     return $images;
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:48,代码来源:class-search.php

示例15: getShow

 static function getShow($heading, $speedctl, $albumobj, $imageobj, $width, $height, $crop, $shuffle, $linkslides, $controls, $returnpath, $imagenumber)
 {
     global $_zp_gallery, $_zp_gallery_page;
     setOption('cycle-slideshow_' . $_zp_gallery->getCurrentTheme() . '_' . stripSuffix($_zp_gallery_page), 1);
     if (!$albumobj->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumobj)) {
         return '<div class="errorbox" id="message"><h2>' . gettext('This album is password protected!') . '</h2></div>';
     }
     // setting the image size
     if (empty($width) || empty($height)) {
         $width = getOption('cycle-slideshow_width');
         $height = getOption('cycle-slideshow_height');
     }
     if ($crop) {
         $cropw = $width;
         $croph = $height;
     } else {
         $cropw = NULL;
         $croph = NULL;
     }
     //echo $imagenumber;
     $slides = $albumobj->getImages(0);
     $numslides = $albumobj->getNumImages();
     if ($shuffle) {
         // means random order, not the effect!
         shuffle($slides);
     }
     //echo "<pre>";
     // print_r($slides);
     //echo "</pre>";
     //cycle2 in progressive loading mode cannot start with specific slides as it does not "know" them.
     //The start slide needs to be set manually so I remove and append those before the desired start slide at the end
     if ($imagenumber != 0) {
         // if start slide not the first
         $count = -1;
         //cycle2 starts with 0
         $extractslides = array();
         foreach ($slides as $slide) {
             $count++;
             if ($count < $imagenumber) {
                 $extractslides[] = $slide;
                 unset($slides[$count]);
             }
         }
         $slides = array_merge($slides, $extractslides);
     }
     //echo "<pre>";
     // print_r($slides);
     //echo "</pre>";
     //$albumid = $albumobj->getID();
     if (getOption('cycle-slideshow_swipe')) {
         $option_swipe = 'true';
     } else {
         $option_swipe = 'false';
     }
     if (getOption('cycle-slideshow_pausehover')) {
         $option_pausehover = 'true';
     } else {
         $option_pausehover = 'false';
     }
     $option_fx = getOption('cycle-slideshow_effect');
     $option_tilevertical = '';
     if ($option_fx == 'tileSlide' || $option_fx == 'tileBlind') {
         $option_tileextra = getOption('cycle-slideshow_tileeffect');
         switch ($option_tileextra) {
             case 'tileVert':
                 $option_tilevertical = 'data-cycle-tile-vertical=true';
                 break;
             case 'tileHorz':
                 $option_tilevertical = 'data-cycle-tile-vertical=false';
                 break;
             default:
                 $option_tilevertical = '';
                 break;
         }
     }
     if ($numslides == 0) {
         return '<div class="errorbox" id="message"><h2>' . gettext('No images for the slideshow!') . '</h2></div>';
     }
     $slideshow = '<section class="slideshow"><!-- extra class with album id so we can address slides! -->' . "\n";
     if ($controls) {
         $slideshow .= '<ul class="slideshow_controls">' . "\n";
         $slideshow .= '<li><a href="#" data-cycle-cmd="prev" class="cycle-slideshow-prev icon-backward" title="' . gettext('prev') . '"></a></li>' . "\n";
         $slideshow .= '<li><a href="' . $returnpath . '" class="cycle-slideshow-stop icon-stop" title="' . gettext('stop') . '"></a></li>' . "\n";
         $slideshow .= '<li><a href="#" data-cycle-cmd="pause" class="cycle-slideshow-pause icon-pause" title="' . gettext('pause') . '"></a></li>' . "\n";
         $slideshow .= '<li><a href="#" data-cycle-cmd="resume" class="cycle-slideshow-resume icon-play" title="' . gettext('play') . '"></a></li>' . "\n";
         $slideshow .= '<li><a href="#" data-cycle-cmd="next" class="cycle-slideshow-next icon-forward" title="' . gettext('next') . '"></a></li>' . "\n";
         $slideshow .= '</ul>' . "\n";
     }
     //class cylce-slideshow is mandatory!
     $slideshow .= '<div class="cycle-slideshow"' . "\n";
     $slideshow .= 'data-cycle-pause-on-hover=' . $option_pausehover . "\n";
     $slideshow .= 'data-cycle-fx="' . $option_fx . '"' . "\n";
     $slideshow .= $option_tilevertical . "\n";
     $slideshow .= 'data-cycle-speed=' . getOption('cycle-slideshow_speed') . "\n";
     $slideshow .= 'data-cycle-timeout=' . getOption('cycle-slideshow_timeout') . "\n";
     $slideshow .= 'data-cycle-slides=".slide"' . "\n";
     $slideshow .= 'data-cycle-auto-height=true' . "\n";
     $slideshow .= 'data-cycle-center-horz=true' . "\n";
     $slideshow .= 'data-cycle-center-vert=true' . "\n";
     $slideshow .= 'data-cycle-swipe=' . $option_swipe . "\n";
//.........这里部分代码省略.........
开发者ID:rb26,项目名称:zenphoto,代码行数:101,代码来源:slideshow2.php


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