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


PHP Album::isDynamic方法代码示例

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


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

示例3: loadAlbum

function loadAlbum($album)
{
    global $gallery, $_zp_current_album, $_zp_current_image;
    $subalbums = $album->getAlbums();
    $started = false;
    $tcount = $count = 0;
    foreach ($subalbums as $folder) {
        $subalbum = new Album($gallery, $folder);
        if (!$subalbum->isDynamic()) {
            $tcount = $tcount + loadAlbum($subalbum);
        }
    }
    $theme = $gallery->getCurrentTheme();
    $id = 0;
    $parent = getUrAlbum($album);
    $albumtheme = $parent->getAlbumTheme();
    if (!empty($albumtheme)) {
        $theme = $albumtheme;
        $id = $parent->id;
    }
    loadLocalOptions($id, $theme);
    $_zp_current_album = $album;
    if ($album->getNumImages() > 0) {
        echo "<br />" . $album->name . ' ';
        while (next_image(true)) {
            $thumb = getImageThumb();
            if (strpos($thumb, 'i.php?') === false) {
                $thumb = NULL;
            }
            if (isImagePhoto($_zp_current_image)) {
                $image = getDefaultSizedImage();
                if (strpos($image, 'i.php?') === false) {
                    $image = NULL;
                }
            } else {
                $image = NULL;
                if ($_zp_current_image->objectsThumb == NULL) {
                    $thumb = NULL;
                }
            }
            if (!empty($thumb) || !empty($image)) {
                if (!$count) {
                    $started = true;
                    echo "{ ";
                } else {
                    echo ' | ';
                }
            }
            if (!empty($thumb)) {
                echo '<img src="' . $thumb . '" height="8" width="8" /> ';
            }
            if (!empty($image)) {
                echo ' <img src="' . $image . '" height="20" width="20" />';
            }
            if (!empty($thumb) || !empty($image)) {
                echo "\n";
            }
            $count++;
        }
        if ($started) {
            echo ' } ';
        }
        printf(ngettext('[%u image]', '[%u images]', $count), $count);
        echo "<br />\n";
    }
    return $count + $tcount;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:67,代码来源:cache_images.php

示例4: garbageCollect


//.........这里部分代码省略.........
                             $fields = '&searchfields=4';
                         }
                     }
                     $sql = "UPDATE " . prefix('albums') . "SET `search_params`=\"{$words}.{$fields}\", `thumb`=\"{$thumb}\", `mtime`=\"{$mtime}\" WHERE `id`=\"" . $album['id'] . "\"";
                     query($sql);
                 }
             }
             /* Delete all image entries that don't belong to an album at all. */
             $albumids = query_full_array("SELECT `id` FROM " . prefix('albums'));
             /* all the album IDs */
             $idsofalbums = array();
             foreach ($albumids as $row) {
                 $idsofalbums[] = $row['id'];
             }
             $imageAlbums = query_full_array("SELECT DISTINCT `albumid` FROM " . prefix('images'));
             /* albumids of all the images */
             $albumidsofimages = array();
             foreach ($imageAlbums as $row) {
                 $albumidsofimages[] = $row['albumid'];
             }
             $orphans = array_diff($albumidsofimages, $idsofalbums);
             /* albumids of images with no album */
             if (count($orphans) > 0) {
                 /* delete dead images from the DB */
                 $firstrow = array_pop($orphans);
                 $sql = "DELETE FROM " . prefix('images') . " WHERE `albumid`='" . $firstrow . "'";
                 foreach ($orphans as $id) {
                     $sql .= " OR `albumid`='" . $id . "'";
                 }
                 query($sql);
                 // Then go into existing albums recursively to clean them... very invasive.
                 foreach ($this->getAlbums(0) as $folder) {
                     $album = new Album($this, $folder);
                     if (!$album->isDynamic()) {
                         if (is_null($album->getDateTime())) {
                             // see if we can get one from an image
                             $image = $album->getImage(0);
                             if (is_object($image)) {
                                 $album->setDateTime($image->getDateTime());
                             }
                         }
                         $album->garbageCollect(true);
                         $album->preLoad();
                     }
                 }
             }
         }
         /* Look for image records where the file no longer exists. While at it, check for images with IPTC data to update the DB */
         $start = array_sum(explode(" ", microtime()));
         // protect against too much processing.
         if (!empty($restart)) {
             $restartwhere = ' WHERE `id`>' . $restart;
         } else {
             $restartwhere = '';
         }
         $sql = 'SELECT `id`, `albumid`, `filename`, `desc`, `title`, `date`, `mtime` FROM ' . prefix('images') . $restartwhere . ' ORDER BY `id`';
         $images = query_full_array($sql);
         foreach ($images as $image) {
             $sql = 'SELECT `folder` FROM ' . prefix('albums') . ' WHERE `id`="' . $image['albumid'] . '";';
             $row = query_single_row($sql);
             $imageName = UTF8ToFilesystem(getAlbumFolder() . $row['folder'] . '/' . $image['filename']);
             if (file_exists($imageName)) {
                 if ($image['mtime'] != filemtime($imageName)) {
                     // file has changed since we last saw it
                     /* check metadata */
                     $metadata = getImageMetadata($imageName);
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:67,代码来源:class-gallery.php

示例5: addSubalbumMenus

/**
 * adds (sub)albums to menu base with their gallery sorting order intact
 *
 * @param string $menuset chosen menu set
 * @param object $gallery a gallery object
 * @param int $id table id of the parent.
 * @param string $link folder name of the album
 * @param string $sort xxx-xxx-xxx style sort order for album
 */
function addSubalbumMenus($menuset, $gallery, $id, $link, $sort)
{
    $album = new Album($gallery, $link);
    $show = $album->get('show');
    $title = $album->getTitle();
    $sql = "INSERT INTO " . prefix('menu') . " (`link`,`type`,`title`,`show`,`menuset`,`sort_order`, `parentid`) " . 'VALUES (' . db_quote($link) . ', "album",' . db_quote($album->name) . ', ' . $show . ',' . db_quote($menuset) . ',' . db_quote($sort) . ',' . $id . ')';
    $result = query($sql, false);
    if ($result) {
        $id = db_insert_id();
    } else {
        $result = query_single_row('SELECT `id` FROM' . prefix('menu') . ' WHERE `type`="album" AND `link`=' . db_quote($link));
        $id = $result['id'];
    }
    if (!$album->isDynamic()) {
        $albums = $album->getAlbums();
        foreach ($albums as $key => $link) {
            addSubalbumMenus($menuset, $gallery, $id, $link, $sort . '-' . sprintf('%03u', $key));
        }
    }
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:29,代码来源:menu_manager-admin-functions.php

示例6: checkAlbumParentid

/**
 *
 * Checks for bad parentIDs from old move/copy bug
 * @param unknown_type $albumname
 * @param unknown_type $id
 */
function checkAlbumParentid($albumname, $id)
{
    global $_zp_gallery;
    $album = new Album($_zp_gallery, $albumname);
    $oldid = $album->get('parentid');
    if ($oldid !== $id) {
        $album->set('parentid', $id);
        $album->save();
        if (is_null($oldid)) {
            $oldid = '<em>NULL</em>';
        }
        if (is_null($id)) {
            $id = '<em>NULL</em>';
        }
        printf('Fixed album <strong>%1$s</strong>: parentid was %2$s should have been %3$s<br />', $albumname, $oldid, $id);
    }
    $id = $album->id;
    if (!$album->isDynamic()) {
        $albums = $album->getAlbums();
        foreach ($albums as $albumname) {
            checkAlbumParentid($albumname, $id);
        }
    }
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:30,代码来源:setup-functions.php

示例7: define

?>
<div id="content">
<?php 
/** EDIT ****************************************************************************/
/************************************************************************************/
if (isset($_GET['album']) && !isset($_GET['massedit'])) {
    /** SINGLE ALBUM ********************************************************************/
    define('IMAGES_PER_PAGE', 10);
    // one time generation of this list.
    $mcr_albumlist = array();
    genAlbumUploadList($mcr_albumlist);
    $oldalbumimagesort = getOption('albumimagesort');
    $direction = getOption('albumimagedirection');
    $folder = sanitize_path($_GET['album']);
    $album = new Album($gallery, $folder);
    if ($album->isDynamic()) {
        $subalbums = array();
        $allimages = array();
    } else {
        $subalbums = $album->getSubAlbums();
        $allimages = $album->getImages(0, 0, $oldalbumimagesort, $direction);
    }
    $allimagecount = count($allimages);
    if (isset($_GET['tab']) && $_GET['tab'] == 'imageinfo' && isset($_GET['image'])) {
        // directed to an image
        $target_image = urldecode($_GET['image']);
        $imageno = array_search($target_image, $allimages);
        if ($imageno !== false) {
            $pagenum = ceil(($imageno + 1) / IMAGES_PER_PAGE);
        }
    } else {
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:31,代码来源:admin-edit.php

示例8: zp_load_album

/**
 * zp_load_album - loads the album given by the folder name $folder into the
 * global context, and sets the context appropriately.
 * @param $folder the folder name of the album to load. Ex: 'testalbum', 'test/subalbum', etc.
 * @param $force_cache whether to force the use of the global object cache.
 * @return the loaded album object on success, or (===false) on failure.
 */
function zp_load_album($folder, $force_nocache = false)
{
    global $_zp_current_album, $_zp_gallery, $_zp_dynamic_album;
    $_zp_current_album = new Album($_zp_gallery, $folder, !$force_nocache);
    if (!$_zp_current_album->exists) {
        return false;
    }
    if ($_zp_current_album->isDynamic()) {
        $_zp_dynamic_album = $_zp_current_album;
    } else {
        $_zp_dynamic_album = null;
    }
    set_context(ZP_ALBUM | ZP_INDEX);
    return $_zp_current_album;
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:22,代码来源:functions-controller.php

示例9: printNestedAlbumsList

/**
 * Prints the sortable nested albums list
 * returns true if nesting levels exceede the database container
 *
 * @param array $pages The array containing all pages
 * @param bool $show_thumb set false to use thumb standin image.
 *
 * @return bool
 */
function printNestedAlbumsList($albums, $show_thumb)
{
    global $gallery;
    $indent = 1;
    $open = array(1 => 0);
    $rslt = false;
    foreach ($albums as $album) {
        $order = $album['sort_order'];
        $level = max(1, count($order));
        if ($toodeep = $level > 1 && $order[$level - 1] === '') {
            $rslt = true;
        }
        if ($level > $indent) {
            echo "\n" . str_pad("\t", $indent, "\t") . "<ul class=\"page-list\">\n";
            $indent++;
            $open[$indent] = 0;
        } else {
            if ($level < $indent) {
                while ($indent > $level) {
                    $open[$indent]--;
                    $indent--;
                    echo "</li>\n" . str_pad("\t", $indent, "\t") . "</ul>\n";
                }
            } else {
                // indent == level
                if ($open[$indent]) {
                    echo str_pad("\t", $indent, "\t") . "</li>\n";
                    $open[$indent]--;
                } else {
                    echo "\n";
                }
            }
        }
        if ($open[$indent]) {
            echo str_pad("\t", $indent, "\t") . "</li>\n";
            $open[$indent]--;
        }
        $albumobj = new Album($gallery, $album['name']);
        if ($albumobj->isDynamic()) {
            $nonest = ' class="no-nest"';
        } else {
            $nonest = '';
        }
        echo str_pad("\t", $indent - 1, "\t") . "<li id=\"id_" . $albumobj->get('id') . "\"{$nonest} >";
        printAlbumEditRow($albumobj, $show_thumb);
        $open[$indent]++;
    }
    while ($indent > 1) {
        echo "</li>\n";
        $open[$indent]--;
        $indent--;
        echo str_pad("\t", $indent, "\t") . "</ul>";
    }
    if ($open[$indent]) {
        echo "</li>\n";
    } else {
        echo "\n";
    }
    return $rslt;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:69,代码来源:admin-functions.php

示例10: 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;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:83,代码来源:template-functions.php

示例11: garbageCollect


//.........这里部分代码省略.........
             $sql2 = "DELETE FROM " . prefix('images') . " WHERE `albumid`='{$first}'";
             $sql3 = "DELETE FROM " . prefix('comments') . " WHERE `type`='albums' AND `ownerid`='{$first}'";
             $sql4 = "DELETE FROM " . prefix('obj_to_tag') . " WHERE `type`='albums' AND `objectid`='{$first}'";
             foreach ($dead as $albumid) {
                 $sql1 .= " OR `id` = '{$albumid}'";
                 $sql2 .= " OR `albumid` = '{$albumid}'";
                 $sql3 .= " OR `ownerid` = '{$albumid}'";
                 $sql4 .= " OR `objectid` = '{$albumid}'";
             }
             $n = query($sql1);
             if (!$complete && $n && $cascade) {
                 query($sql2);
                 query($sql3);
                 query($sql4);
             }
         }
         if (count($deadalbumthemes) > 0) {
             // delete the album theme options tables for dead albums
             foreach ($deadalbumthemes as $id => $deadtable) {
                 $sql = 'DELETE FROM ' . prefix('options') . ' WHERE `ownerid`=' . $id;
                 query($sql, false);
             }
         }
     }
     if ($complete) {
         if (empty($restart)) {
             /* refresh 'metadata' albums */
             $albumids = query_full_array("SELECT `id`, `mtime`, `folder`, `dynamic` FROM " . prefix('albums'));
             foreach ($albumids as $analbum) {
                 if (($mtime = filemtime(ALBUM_FOLDER_SERVERPATH . internalToFilesystem($analbum['folder']))) > $analbum['mtime']) {
                     // refresh
                     $album = new Album($this, $analbum['folder']);
                     $album->set('mtime', $mtime);
                     if ($album->isDynamic()) {
                         $data = file_get_contents($album->localpath);
                         while (!empty($data)) {
                             $data1 = trim(substr($data, 0, $i = strpos($data, "\n")));
                             if ($i === false) {
                                 $data1 = $data;
                                 $data = '';
                             } else {
                                 $data = substr($data, $i + 1);
                             }
                             if (strpos($data1, 'WORDS=') !== false) {
                                 $words = "words=" . urlencode(substr($data1, 6));
                             }
                             if (strpos($data1, 'THUMB=') !== false) {
                                 $thumb = trim(substr($data1, 6));
                             }
                             if (strpos($data1, 'FIELDS=') !== false) {
                                 $fields = "&searchfields=" . trim(substr($data1, 7));
                             }
                         }
                         if (!empty($words)) {
                             if (empty($fields)) {
                                 $fields = '&searchfields=tags';
                             }
                         }
                         $album->set('search_params', $words . $fields);
                         $album->set('thumb', $thumb);
                     }
                     $album->save();
                     zp_apply_filter('album_refresh', $album);
                 }
             }
             /* Delete all image entries that don't belong to an album at all. */
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:67,代码来源:class-gallery.php

示例12: getRandomImagesAlbum

/**
 * Returns  a randomly selected image from the album or its subalbums. (May be NULL if none exists)
 *
 * @param string $rootAlbum optional album folder from which to get the image.
 *
 * @return object
 */
function getRandomImagesAlbum($rootAlbum = null)
{
    global $_zp_current_album, $_zp_gallery, $_zp_current_search;
    if (empty($rootAlbum)) {
        $album = $_zp_current_album;
    } else {
        $album = new Album($_zp_gallery, $rootAlbum);
    }
    if ($album->isDynamic()) {
        $search = $album->getSearchEngine();
        $images = $search->getImages(0);
        $image = NULL;
        shuffle($images);
        while (count($images) > 0) {
            $randomImage = array_pop($images);
            if (is_valid_image($randomImage['filename'])) {
                $image = newImage(new Album(new Gallery(), $randomImage['folder']), $randomImage['filename']);
                return $image;
            }
        }
    } else {
        if (zp_loggedin()) {
            $imageWhere = '';
            $albumNotWhere = '';
        } else {
            $imageWhere = " AND " . prefix('images') . ".show=1";
            $albumNotWhere = getProtectedAlbumsWhere();
        }
        $albumInWhere = '';
        $albumfolder = $album->getFolder();
        $query = "SELECT id FROM " . prefix('albums') . " WHERE " . prefix('albums') . ".show = 1 AND folder LIKE '" . mysql_real_escape_string($albumfolder) . "%'";
        $result = query_full_array($query);
        $albumInWhere = prefix('albums') . ".id in (";
        foreach ($result as $row) {
            $albumInWhere = $albumInWhere . $row['id'] . ", ";
        }
        $albumInWhere = ' AND ' . substr($albumInWhere, 0, -2) . ')';
        $c = 0;
        while ($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(1, $result['row_count']);
            $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);
                return $image;
            }
            $c++;
        }
    }
    return null;
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:59,代码来源:template-functions.php

示例13: printAlbumEditForm

/**
 * emits the html for editing album information
 * called in edit album and mass edit
 *@param string param1 the index of the entry in mass edit or '0' if single album
 *@param object param2 the album object
 *@since 1.1.3
 */
function printAlbumEditForm($index, $album)
{
    // Note: This is some pretty confusing spaghetti code with all the echo statements.
    // Please refactor it so the HTML is readable and easily editable.
    // FYI: It's perfectly acceptable to drop out of php-parsing mode in a function.
    // See the move/copy/rename block for an example.
    global $sortby, $gallery, $_zp_loggedin, $mcr_albumlist, $albumdbfields, $imagedbfields;
    $tagsort = getTagOrder();
    if ($index == 0) {
        if (isset($saved)) {
            $album->setSubalbumSortType('manual');
        }
        $suffix = $prefix = '';
    } else {
        $prefix = "{$index}-";
        $suffix = "_{$index}";
        echo "<p><em><strong>" . $album->name . "</strong></em></p>";
    }
    echo "\n<input type=\"hidden\" name=\"" . $prefix . "folder\" value=\"" . $album->name . "\" />";
    echo "\n" . '<input type="hidden" name="tagsort" value=' . $tagsort . ' />';
    echo "\n<table>";
    echo "\n<td width = \"60%\">\n<table>\n<tr>";
    echo "\n<tr>";
    echo "<td align=\"right\" valign=\"top\" width=\"150\">" . gettext("Album Title") . ": </td>";
    echo '<td>';
    print_language_string_list($album->get('title'), $prefix . "albumtitle", false);
    echo "</td></tr>\n";
    echo '<tr><td></td>';
    $hc = $album->get('hitcounter');
    if (empty($hc)) {
        $hc = '0';
    }
    echo "<td>";
    echo sprintf(gettext("Hit counter: %u"), $hc) . " <input type=\"checkbox\" name=\"reset_hitcounter\"> Reset";
    $tv = $album->get('total_value');
    $tc = $album->get('total_votes');
    echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
    if ($tc > 0) {
        $hc = $tv / $tc;
        printf(gettext('Rating: <strong>%u</strong>'), $hc);
        echo "<label for=\"" . $prefix . "reset_rating\"><input type=\"checkbox\" id=\"" . $prefix . "reset_rating\" name=\"" . $prefix . "reset_rating\" value=1> " . gettext("Reset") . "</label> ";
    } else {
        echo gettext("Rating: Unrated");
    }
    echo "</td>";
    echo '</tr>';
    echo "\n<tr><td align=\"right\" valign=\"top\">" . gettext("Album Description:") . " </td> <td>";
    print_language_string_list($album->get('desc'), $prefix . "albumdesc", true, NULL, 'texteditor');
    echo "</td></tr>";
    echo "\n<tr><td align=\"right\" value=\"top\">" . gettext("Album guest user:") . '</td>';
    echo "\n<td><input type='text' size='48' name='" . $prefix . "albumuser' value='" . $album->getUser() . "' /></td></tr>";
    echo "\n<tr>";
    echo "\n<td align=\"right\">" . gettext("Album password:") . " <br/>" . gettext("repeat:") . " </td>";
    echo "\n<td>";
    $x = $album->getPassword();
    if (!empty($x)) {
        $x = '			 ';
    }
    echo "\n<input type=\"password\" size=\"48\" name=\"" . $prefix . "albumpass\"";
    echo "\nvalue=\"" . $x . '" /><br/>';
    echo "\n<input type=\"password\" size=\"48\" name=\"" . $prefix . "albumpass_2\"";
    echo "\nvalue=\"" . $x . '" />';
    echo "\n</td>";
    echo "\n</tr>";
    echo "\n<tr><td align=\"right\" valign=\"top\">" . gettext("Password hint:") . " </td> <td>";
    print_language_string_list($album->get('password_hint'), $prefix . "albumpass_hint", false);
    echo "</td></tr>";
    $d = $album->getDateTime();
    if ($d == "0000-00-00 00:00:00") {
        $d = "";
    }
    echo "\n<tr><td align=\"right\" valign=\"top\">" . gettext("Date:") . " </td> <td width = \"400\"><input type=\"text\" size='48' name=\"" . $prefix . "albumdate\" value=\"" . $d . '" /></td></tr>';
    echo "\n<tr><td align=\"right\" valign=\"top\">" . gettext("Location:") . " </td> <td>";
    print_language_string_list($album->get('place'), $prefix . "albumplace", false);
    echo "</td></tr>";
    echo "\n<tr><td align=\"right\" valign=\"top\">" . gettext("Custom data:") . "</td><td>";
    print_language_string_list($album->get('custom_data'), $prefix . "album_custom_data", true);
    echo "</td></tr>";
    $sort = $sortby;
    if (!$album->isDynamic()) {
        $sort[gettext('Manual')] = 'manual';
    }
    $sort[gettext('Custom')] = 'custom';
    echo "\n<tr>";
    echo "\n<td align=\"right\" valign=\"top\">" . gettext("Sort subalbums by:") . " </td>";
    echo "\n<td>";
    // script to test for what is selected
    $javaprefix = 'js_' . preg_replace("/[^a-z0-9_]/", "", strtolower($prefix));
    ?>
	<table>
		<tr>
			<td>
			<select id="sortselect" name="<?php 
//.........这里部分代码省略.........
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:101,代码来源:admin-functions.php


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