本文整理汇总了PHP中Album::isMyItem方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::isMyItem方法的具体用法?PHP Album::isMyItem怎么用?PHP Album::isMyItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::isMyItem方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toolbox_crop_image
function toolbox_crop_image($albumname, $imagename)
{
$album = new Album(new Gallery(), $albumname);
if ($album->isMyItem(ALBUM_RIGHTS)) {
$image = newimage($album, $imagename);
if (isImagePhoto($image)) {
?>
<li>
<a href="<?php
echo WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER;
?>
/crop_image.php?a=<?php
echo pathurlencode($albumname);
?>
&i=<?php
echo urlencode($imagename);
?>
&performcrop=frontend "><?php
echo gettext("Crop image");
?>
</a>
</li>
<?php
}
}
}
示例2: printFullAlbumsList
/**
* Prints all albums of the Zenphoto gallery as a partial drop down menu (<option></option> parts).
*
* @return string
*/
function printFullAlbumsList()
{
global $_zp_gallery;
if (is_null($_zp_gallery)) {
$_zp_gallery = new Gallery();
}
$albumlist = $_zp_gallery->getAlbums();
foreach ($albumlist as $album) {
$albumobj = new Album($_zp_gallery, $album);
if ($albumobj->isMyItem(LIST_RIGHTS)) {
echo "<option value='" . pathurlencode($albumobj->name) . "'>" . html_encode($albumobj->getTitle()) . unpublishedZenphotoItemCheck($albumobj) . " (" . $albumobj->getNumImages() . ")</option>";
if (!$albumobj->isDynamic()) {
printSubLevelAlbums($albumobj);
}
}
}
}
示例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);
}
示例4: substr
if (substr($folder, 0, 1) == '/') {
$folder = substr($folder, 1);
}
if (substr($folder, -1) == '/') {
$folder = substr($folder, 0, -1);
}
$folder = zp_apply_filter('admin_upload_process', $folder);
$targetPath = ALBUM_FOLDER_SERVERPATH . internalToFilesystem($folder);
$new = !is_dir($targetPath);
if (!empty($folder)) {
if ($new) {
$rightsalbum = new Album($gallery, dirname($folder));
} else {
$rightsalbum = new Album($gallery, $folder);
}
if (!$rightsalbum->isMyItem(UPLOAD_RIGHTS)) {
if (!zp_apply_filter('admin_managed_albums_access', false, $return)) {
header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin.php');
exit;
}
}
if ($new) {
mkdir_recursive($targetPath, CHMOD_VALUE);
$album = new Album($gallery, $folder);
$album->setShow($_POST['http_publishalbum']);
$album->setTitle(sanitize($_POST['http_albumtitle']));
$album->setOwner($_zp_current_admin_obj->getUser());
$album->save();
}
@chmod($targetPath, CHMOD_VALUE);
$error = zp_apply_filter('check_upload_quota', UPLOAD_ERR_OK, $tempFile);
示例5: getSearchImages
/**
* Returns an array of image names found in the search
*
* @param string $sorttype what to sort on
* @param string $sortdirection what direction
* @param bool $mine set true/false to overried ownership
* @return array
*/
function getSearchImages($sorttype, $sortdirection, $mine = NULL)
{
if (getOption('search_no_images') || $this->search_no_images) {
return array();
}
$hint = '';
$images = array();
$searchstring = $this->getSearchString();
$searchdate = $this->dates;
if (empty($searchstring) && empty($searchdate)) {
return $images;
}
// nothing to find
if (empty($searchdate)) {
$search_results = $this->searchFieldsAndTags($searchstring, 'images', $sorttype, $sortdirection);
} else {
$search_results = $this->SearchDate($searchstring, $searchdate, 'images', $sorttype, $sortdirection);
}
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(ALBUM_FOLDER_SERVERPATH . internalToFilesystem($albumname) . '/' . internalToFilesystem($row['filename']))) {
$album = new Album(new gallery(), $albumname);
if ($mine || is_null($mine) && ($album->isMyItem(LIST_RIGHTS) || checkAlbumPassword($albumname) && $row2['show'])) {
if (empty($this->album_list) || in_array($albumname, $this->album_list)) {
$images[] = array('filename' => $row['filename'], 'folder' => $albumname);
}
}
}
}
}
if (empty($searchdate)) {
zp_apply_filter('search_statistics', $searchstring, 'images', !empty($images), $this->dynalbumname, $this->iteration++);
}
return $images;
}
示例6: isMyAlbum
/**
* @deprecated
*/
function isMyAlbum($albumname, $action)
{
deprecated_function_notify(gettext('Use instead the Album class method isMyItem().'), E_USER_NOTICE);
$album = new Album(new Gallery(), $albumname);
return $album->isMyItem($action);
}
示例7: Gallery
$gallery = new Gallery();
if (isset($_GET['album'])) {
$alb = sanitize($_GET['album']);
} else {
if (isset($_POST['album'])) {
$alb = sanitize(urldecode($_POST['album']));
} else {
$alb = '';
}
}
if ($alb) {
$folder = sanitize_path($alb);
$object = $folder;
$tab = 'edit';
$album = new Album($gallery, $folder);
if (!$album->isMyItem(ALBUM_RIGHTS)) {
if (!zp_apply_filter('admin_managed_albums_access', false, $return)) {
header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin.php');
exit;
}
}
} else {
$object = '<em>' . gettext('Gallery') . '</em>';
$tab = gettext('utilities');
}
printAdminHeader($tab, gettext('pre-cache'));
echo "\n</head>";
echo "\n<body>";
printLogoAndLinks();
echo "\n" . '<div id="main">';
printTabs();
示例8: getAlbumThumbImage
/**
* Gets the album's set thumbnail image from the database if one exists,
* otherwise, finds the first image in the album or sub-album and returns it
* as an Image object.
*
* @return Image
*/
function getAlbumThumbImage()
{
if (!is_null($this->albumthumbnail)) {
return $this->albumthumbnail;
}
$albumdir = $this->localpath;
$thumb = $this->get('thumb');
$i = strpos($thumb, '/');
if ($root = $i === 0) {
$thumb = substr($thumb, 1);
// strip off the slash
$albumdir = ALBUM_FOLDER_SERVERPATH;
}
$shuffle = empty($thumb);
$field = getOption('AlbumThumbSelectField');
$direction = getOption('AlbumThumbSelectDirection');
if (!empty($thumb) && !is_numeric($thumb) && file_exists($albumdir . internalToFilesystem($thumb))) {
if ($i === false) {
return newImage($this, $thumb);
} else {
$pieces = explode('/', $thumb);
$i = count($pieces);
$thumb = $pieces[$i - 1];
unset($pieces[$i - 1]);
$albumdir = implode('/', $pieces);
if (!$root) {
$albumdir = $this->name . "/" . $albumdir;
} else {
$albumdir = $albumdir . "/";
}
$this->albumthumbnail = newImage(new Album($this->gallery, $albumdir), $thumb);
return $this->albumthumbnail;
}
} else {
$this->getImages(0, 0, $field, $direction);
$thumbs = $this->images;
if (!is_null($thumbs)) {
if ($shuffle) {
shuffle($thumbs);
}
$mine = $this->isMyItem(LIST_RIGHTS);
$other = NULL;
while (count($thumbs) > 0) {
// first check for images
$thumb = array_shift($thumbs);
$thumb = newImage($this, $thumb);
if ($mine || $thumb->getShow()) {
if (isImagePhoto($thumb)) {
// legitimate image
$this->albumthumbnail = $thumb;
return $this->albumthumbnail;
} else {
if (!is_null($thumb->objectsThumb)) {
// "other" image with a thumb sidecar
$this->albumthumbnail = $thumb;
return $this->albumthumbnail;
} else {
if (is_null($other)) {
$other = $thumb;
}
}
}
}
}
if (!is_null($other)) {
// "other" image, default thumb
$this->albumthumbnail = $other;
return $this->albumthumbnail;
}
}
}
// Otherwise, look in sub-albums.
$subalbums = $this->getAlbums();
if (!is_null($subalbums)) {
if ($shuffle) {
shuffle($subalbums);
}
while (count($subalbums) > 0) {
$folder = array_pop($subalbums);
$subalbum = new Album($this->gallery, $folder);
$pwd = $subalbum->getPassword();
if ($subalbum->getShow() && empty($pwd) || $subalbum->isMyItem(LIST_RIGHTS)) {
$thumb = $subalbum->getAlbumThumbImage();
if (strtolower(get_class($thumb)) !== 'transientimage' && $thumb->exists) {
$this->albumthumbnail = $thumb;
return $thumb;
}
}
}
}
$nullimage = SERVERPATH . '/' . ZENFOLDER . '/images/imageDefault.png';
if (OFFSET_PATH == 0) {
// check for theme imageDefault.png if we are in the gallery
//.........这里部分代码省略.........
示例9: getNestedAlbumList
/**
* generates a nested list of albums for the album tab sorting
* Returns an array of "albums" each element contains:
* 'name' which is the folder name
* 'album' which is an album object for the album
* 'sort_order' which is an array of the sort order set
*
* @param $subalbum root level album (NULL is the gallery)
* @param $levels how far to nest
* @param $level internal for keeping the sort order elements
* @return array
*/
function getNestedAlbumList($subalbum, $levels, $level = array())
{
global $gallery;
$cur = count($level);
$levels--;
// make it 0 relative to sync with $cur
if (is_null($subalbum)) {
$albums = $gallery->getAlbums();
} else {
$albums = $subalbum->getAlbums();
}
$list = array();
foreach ($albums as $analbum) {
$albumobj = new Album($gallery, $analbum);
if (!is_null($subalbum) || $albumobj->isMyItem(ALBUM_RIGHTS)) {
$level[$cur] = sprintf('%03u', $albumobj->getSortOrder());
$list[] = array('name' => $analbum, 'sort_order' => $level);
if ($cur < $levels && $albumobj->getNumAlbums() > 0 && !$albumobj->isDynamic()) {
$list = array_merge($list, getNestedAlbumList($albumobj, $levels + 1, $level));
}
}
}
return $list;
}
示例10: array
echo "\n" . '<div id="main">';
printTabs();
echo "\n" . '<div id="content">';
$galleryTheme = $gallery->getCurrentTheme();
$themelist = array();
if (zp_loggedin(ADMIN_RIGHTS)) {
$gallery_title = $gallery->getTitle();
if ($gallery_title != gettext("Gallery")) {
$gallery_title .= ' (' . gettext("Gallery") . ')';
}
$themelist[$gallery_title] = '';
}
$albums = $gallery->getAlbums(0);
foreach ($albums as $alb) {
$album = new Album($gallery, $alb);
if ($album->isMyItem(THEMES_RIGHTS)) {
$key = $album->getTitle();
if ($key != $alb) {
$key .= " ({$alb})";
}
$themelist[$key] = $alb;
}
}
if (!empty($_REQUEST['themealbum'])) {
$alb = sanitize_path($_REQUEST['themealbum']);
$album = new Album($gallery, $alb);
$albumtitle = $album->getTitle();
$themename = $album->getAlbumTheme();
$current_theme = $themename;
} else {
$current_theme = $galleryTheme;
示例11: getRandomImagesAlbum
/**
* Returns a randomly selected image from the album or its subalbums. (May be NULL if none exists)
*
* @param mixed $rootAlbum optional album object/folder from which to get the image.
* @param bool $daily set to true to change picture only once a day.
* @param bool $showunpublished set true to consider all images
*
* @return object
*/
function getRandomImagesAlbum($rootAlbum = NULL, $daily = false, $showunpublished = false)
{
global $_zp_current_album, $_zp_gallery, $_zp_current_search;
if (empty($rootAlbum)) {
$album = $_zp_current_album;
} else {
if (is_object($rootAlbum)) {
$album = $rootAlbum;
} else {
$album = new Album($_zp_gallery, $rootAlbum);
}
}
if ($daily && ($potd = getOption('picture_of_the_day:' . $album->name))) {
$potd = unserialize($potd);
if (date('Y-m-d', $potd['day']) == date('Y-m-d')) {
$rndalbum = new Album($_zp_gallery, $potd['folder']);
$image = newImage($rndalbum, $potd['filename']);
if ($image->exists) {
return $image;
}
}
}
$image = NULL;
if ($album->isDynamic()) {
$images = $album->getImages(0);
shuffle($images);
while (count($images) > 0) {
$result = array_pop($images);
if (is_valid_image($result['filename'])) {
$image = newImage(new Album(new Gallery(), $result['folder']), $result['filename']);
}
}
} else {
$albumfolder = $album->getFolder();
if ($album->isMyItem(LIST_RIGHTS) || $showunpublished) {
$imageWhere = '';
$albumNotWhere = '';
$albumInWhere = '';
} else {
$imageWhere = " AND " . prefix('images') . ".show=1";
$albumNotWhere = getProtectedAlbumsWhere();
$albumInWhere = prefix('albums') . ".show=1";
}
$query = "SELECT id FROM " . prefix('albums') . " WHERE ";
if ($albumInWhere) {
$query .= $albumInWhere . ' AND ';
}
$query .= "folder LIKE " . db_quote($albumfolder . '%');
$result = query_full_array($query);
if (is_array($result) && count($result) > 0) {
$albumInWhere = prefix('albums') . ".id in (";
foreach ($result as $row) {
$albumInWhere = $albumInWhere . $row['id'] . ", ";
}
$albumInWhere = ' AND ' . substr($albumInWhere, 0, -2) . ')';
$c = 0;
while (is_null($image) && $c < 10) {
$result = query_single_row('SELECT COUNT(*) AS row_count ' . ' FROM ' . prefix('images') . ', ' . prefix('albums') . ' WHERE ' . prefix('albums') . '.folder!="" AND ' . prefix('images') . '.albumid = ' . prefix('albums') . '.id ' . $albumInWhere . $albumNotWhere . $imageWhere);
$rand_row = rand(0, $result['row_count'] - 1);
$result = query_single_row('SELECT ' . prefix('images') . '.filename, ' . prefix('albums') . '.folder ' . ' FROM ' . prefix('images') . ', ' . prefix('albums') . ' WHERE ' . prefix('images') . '.albumid = ' . prefix('albums') . '.id ' . $albumInWhere . $albumNotWhere . $imageWhere . ' LIMIT ' . $rand_row . ', 1');
$imageName = $result['filename'];
if (is_valid_image($imageName)) {
$image = newImage(new Album(new Gallery(), $result['folder']), $imageName);
}
$c++;
}
}
}
if ($daily && is_object($image)) {
$potd = array('day' => time(), 'folder' => $result['folder'], 'filename' => $result['filename']);
setThemeOption('picture_of_the_day:' . $album->name, serialize($potd));
}
return $image;
}
示例12: sortAlbumArray
/**
* Sort the album array based on either according to the sort key.
* Default is to sort on the `sort_order` field.
*
* Returns an array with the albums in the desired sort order
*
* @param array $albums array of album names
* @param string $sortkey the sorting scheme
* @param string $sortdirection
* @param bool $mine set true/false to override ownership
* @return array
*
* @author Todd Papaioannou (lucky@luckyspin.org)
* @since 1.0.0
*/
function sortAlbumArray($parentalbum, $albums, $sortkey = '`sort_order`', $sortdirection = NULL, $mine = NULL)
{
if (is_null($parentalbum)) {
$albumid = ' IS NULL';
$obj = $this;
} else {
$albumid = '=' . $parentalbum->id;
$obj = $parentalbum;
}
if ($sortkey == '`sort_order`' || $sortkey == 'RAND()') {
// manual sort is always ascending
$order = false;
} else {
if (!is_null($sortdirection)) {
$order = strtoupper($sortdirection) == 'DESC';
} else {
$order = $obj->getSortDirection('album');
}
}
if (count($albums) == 0) {
return array();
}
$sql = 'SELECT * FROM ' . prefix("albums") . ' WHERE `parentid`' . $albumid;
$result = query($sql);
$results = array();
while ($row = db_fetch_assoc($result)) {
$results[$row['folder']] = $row;
}
// check database aganist file system
foreach ($results as $dbrow => $row) {
$folder = $row['folder'];
if (($key = array_search($folder, $albums)) !== false) {
// album exists in filesystem
unset($albums[$key]);
} else {
// album no longer exists
$id = $row['id'];
query("DELETE FROM " . prefix('albums') . " WHERE `id`={$id}");
// delete the record
query("DELETE FROM " . prefix('comments') . " WHERE `type` ='images' AND `ownerid`= '{$id}'");
// remove image comments
query("DELETE FROM " . prefix('obj_to_tag') . "WHERE `type`='albums' AND `objectid`=" . $id);
query("DELETE FROM " . prefix('albums') . " WHERE `id` = " . $id);
unset($results[$dbrow]);
}
}
foreach ($albums as $folder) {
// these albums are not in the database
$albumobj = new Album($this, $folder);
if ($albumobj->exists) {
// fail to instantiate?
$results[$folder] = $albumobj->data;
}
}
// now put the results in the right order
$results = sortByKey($results, $sortkey, $order);
// albums are now in the correct order
$albums_ordered = array();
foreach ($results as $row) {
// check for visible
$folder = $row['folder'];
$album = new Album($this, $folder);
if ($row['show'] || $mine || is_null($mine) && $album->isMyItem(LIST_RIGHTS)) {
$albums_ordered[] = $folder;
}
}
return $albums_ordered;
}
示例13: getNotViewableAlbums
/**
* Returns a list of album IDs that the current viewer is allowed to see
*
* @return array
*/
function getNotViewableAlbums()
{
global $_zp_not_viewable_album_list;
if (zp_loggedin(ADMIN_RIGHTS | MANAGE_ALL_ALBUM_RIGHTS)) {
return array();
}
//admins can see all
$hint = '';
$gallery = new Gallery();
if (is_null($_zp_not_viewable_album_list)) {
$sql = 'SELECT `folder`, `id`, `password`, `show` FROM ' . prefix('albums') . ' WHERE `show`=0 OR `password`!=""';
$result = query_full_array($sql);
if (is_array($result)) {
$_zp_not_viewable_album_list = array();
foreach ($result as $row) {
if (checkAlbumPassword($row['folder'])) {
$album = new Album($gallery, $row['folder']);
if (!($row['show'] || $album->isMyItem(LIST_RIGHTS))) {
$_zp_not_viewable_album_list[] = $row['id'];
}
} else {
$_zp_not_viewable_album_list[] = $row['id'];
}
}
}
}
return $_zp_not_viewable_album_list;
}
示例14: printSlideShow
//.........这里部分代码省略.........
$height = getOption("slideshow_height");
}
if ($numberofimages == 0) {
return NULL;
}
$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 = sanitize($_POST['preserve_search_params']);
$search->setSearchParams($params);
$images = $search->getImages(0);
$searchwords = $search->words;
$searchdate = $search->dates;
$searchfields = $search->getSearchFields(true);
$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 (!$album->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumq['folder'])) {
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(sanitize($_POST['imagefile'])) . getOption('mod_rewrite_image_suffix'), '/index.php?album=' . urlencode($album->name) . '&image=' . urlencode($_POST['imagefile']));
}
}
if ($shuffle) {
shuffle($images);
}
$showdesc = getOption("slideshow_showdesc");
// slideshow display section
switch ($option) {
case "jQuery":
$validtypes = array('jpg', 'jpeg', 'gif', 'png', 'mov', '3gp');
?>
<script type="text/javascript">
// <!-- <![CDATA[
$(document).ready(function(){
$(function() {
var ThisGallery = '<?php
echo html_encode($albumtitle);
?>
';
var ImageList = new Array();
var TitleList = new Array();
var DescList = new Array();