function editInPlace_handle_request($context = '', $field = '', $value = '', $orig_value = '')
{
    // Cannot edit when context not set in current page (should happen only when editing in place from index.php page)
    if (!in_context(ZP_IMAGE) && !in_context(ZP_ALBUM) && !in_context(ZP_ZENPAGE_PAGE) && !in_context(ZP_ZENPAGE_NEWS_ARTICLE)) {
        die($orig_value . '<script type="text/javascript">alert("' . gettext('Oops.. Cannot edit from this page') . '");</script>');
    }
    // Make a copy of context object
    switch ($context) {
        case 'image':
            global $_zp_current_image;
            $object = $_zp_current_image;
            break;
        case 'album':
            global $_zp_current_album;
            $object = $_zp_current_album;
            break;
        case 'zenpage_page':
            global $_zp_current_zenpage_page;
            $object = $_zp_current_zenpage_page;
            break;
        case 'zenpage_news':
            global $_zp_current_zenpage_news;
            $object = $_zp_current_zenpage_news;
            break;
        default:
            die(gettext('Error: malformed Ajax POST'));
    }
    // Dates need to be handled before stored
    if ($field == 'date') {
        $value = date('Y-m-d H:i:s', strtotime($value));
    }
    // Sanitize new value
    switch ($field) {
        case 'desc':
            $level = 1;
            break;
        case 'title':
            $level = 2;
            break;
        default:
            $level = 3;
    }
    $value = str_replace("\n", '<br />', sanitize($value, $level));
    // note: not using nl2br() here because it adds an extra "\n"
    // Write new value
    if ($field == '_update_tags') {
        $value = trim($value, ', ');
        $object->setTags($value);
    } else {
        $object->set($field, $value);
    }
    $result = $object->save();
    if ($result !== false) {
        echo $value;
    } else {
        echo '<script type="text/javascript">alert("' . gettext('Could not save!') . '");</script>' . $orig_value;
    }
    zp_error(gettext('Front_end_edit could not save changes!'));
}
Example #2
0
/**
 * Returns true if the object is a zenphoto 'album'
 *
 * @param object $album
 * @return bool
 */
function isAlbumClass($album = NULL)
{
    global $_zp_current_album;
    if (is_null($album)) {
        if (!in_context(ZP_ALBUM)) {
            return false;
        }
        $album = $_zp_current_album;
    }
    return is_object($album) && $album->table == 'albums';
}
Example #3
0
/**
 * @deprecated
 * @since 1.4.6
 */
function getCommentsAllowed()
{
    global $_zp_current_image, $_zp_current_album;
    deprecated_functions::notify(gettext("use the object’s getCommentsAllowed() method"));
    if (in_context(ZP_IMAGE)) {
        if (is_null($_zp_current_image)) {
            return false;
        }
        return $_zp_current_image->getCommentsAllowed();
    } else {
        return $_zp_current_album->getCommentsAllowed();
    }
}
function getCustomAlbumDesc()
{
    if (!in_context(ZP_ALBUM)) {
        return false;
    }
    global $_zp_current_album;
    $desc = $_zp_current_album->getDesc();
    if (strlen($desc) == 0) {
        $desc = $_zp_current_album->getTitle();
    } else {
        $desc = $_zp_current_album->getTitle() . "\n" . $desc;
    }
    return $desc;
}
Example #5
0
<?php

global $_zp_themeroot, $_zp_current_search, $_highlight_image, $_zp_current_image;
$imageCount = isset($_zp_current_search) ? count($_zp_current_search->getImages()) : 0;
AlbumUtil::setAlbumPage(false);
ThemeUtil::$script .= "isAlbumPage = false;\n";
ThemeUtil::$script .= "var images = [], initialImageThumbSelection = 0;\n";
$cls = $isAlbumPage ? 'album-page' : 'left image-page';
?>

<div id="album-nav" class="left opa60">
	<div class="nav-cell filler"><span>&nbsp;</span></div>
	<?php 
$prevText = "<div id='image-nav-prev' class='image-nav-scroll opa60'><img src='{$_zp_themeroot}/resources/images/arrow_up.png' width='16' height='16'/></div>";
$nextText = "<div id='image-nav-next' class='image-nav-scroll opa60 {$cls}'><img src='{$_zp_themeroot}/resources/images/arrow_down.png' width='16' height='16'/></div>";
if (!in_context(ZP_SEARCH)) {
    $_zp_current_search = new SearchEngine();
    set_context(ZP_SEARCH);
}
$prevNext = AlbumUtil::printNavigation($prevText, $nextText, false, 7, true);
?>
	<div class="nav-cell filler end"><span>&nbsp;</span></div>
</div>

<div style="padding-left: 1px;">
	<div id="album-menu" class="opa60">
		<div id="album-thumb">
			<img src="<?php 
echo getRandomImages()->getCustomImage(NULL, 192, 48, 192, 48, NULL, null, false);
?>
" width="195" height="48"/>
Example #6
0
    ?>
				<?php 
}
?>
	
			</ul>
			<?php 
if (getOption('RSS_items_albums') || getOption('RSS_zenpage_items')) {
    ?>
			<div id="rsslinks">
				<span><?php 
    echo gettext('Subscribe: ');
    ?>
</span>
				<?php 
    if (in_context(ZP_ALBUM) && getOption('RSS_album_image')) {
        printRSSLink("Collection", "", gettext('This Album'), "  |  ", false, "rsslink");
    }
    if (getOption('RSS_items_albums')) {
        printRSSLink("Gallery", "", gettext('Gallery Images'), "", false, "rsslink");
    }
    if (function_exists('getBarePageTitle') && getOption('RSS_zenpage_items')) {
        printRSSLink("News", ' | ', gettext('News'), '', false);
    }
    ?>
			</div>
			<br />
			<?php 
}
?>
			<?php 
Example #7
0
function zp_side_bar()
{
    ?>
	<div id="sidebar">
		<?php 
    //-------------If you are in the Image Page
    if (in_context(ZP_IMAGE)) {
        ?>
				<div class="imgnav">
					<?php 
        if (hasPrevImage()) {
            ?>
					<div class="imgprevious"><a href="<?php 
            echo getPrevImageURL();
            ?>
" title="Previous Image"><img src="<?php 
            echo getPrevImageThumb();
            ?>
" /><br /><small>&laquo; prev  |</small></a></div>
					<?php 
        }
        if (hasNextImage()) {
            ?>
					<div class="imgnext"><a href="<?php 
            echo getNextImageURL();
            ?>
" title="Next Image"><img src="<?php 
            echo getNextImageThumb();
            ?>
" /><br /><small>| next &raquo;</small></a></div>
					<?php 
        }
        ?>
				</div> 
		<div id="sbinfo">
			<b>Album Name:</b> <?php 
        printAlbumTitle(true);
        ?>
<br />
			<b>Number of Photos:</b> <?php 
        echo getNumImages();
        ?>
<br />
			<b>Album Date:</b> <?php 
        printAlbumDate($before = "Date: ", $format = "%F");
        ?>
<br />
			<b>Album Description:</b> <?php 
        printAlbumDesc(true);
        ?>
<br />
			<b>Image Name:</b> <?php 
        echo getImageTitle();
        ?>
<br />
			<b>Image Description:</b> <?php 
        printImageDesc(true);
        ?>
<br />
		</div>
			<?php 
        //--------------- If you are in the Album Page
    } else {
        if (in_context(ZP_ALBUM)) {
            ?>
		<b>Album Name:</b> <?php 
            printAlbumTitle(true);
            ?>
<br />
		<b>Number of Pictures:</b> <?php 
            echo getNumImages();
            ?>
<br />
		<b>Album Date:</b> <?php 
            printAlbumDate($before = "Date: ", $format = "%F");
            ?>
<br /> 
		<b>Album Description:</b> <?php 
            printAlbumDesc(true);
            ?>
<br />		
<?php 
            //--------------- If you are in the Index Page
        } else {
            if (in_context(ZP_INDEX)) {
            }
        }
    }
    ?>

</div>
<?php 
}
Example #8
0
<div class="left">

	<?php 
if ($zpfocus_showrandom != 'none') {
    if ($zpfocus_showrandom == 'single') {
        $sscount = 1;
    } else {
        $sscount = 5;
    }
    if (in_context(ZP_ALBUM) || in_context(ZP_IMAGE)) {
        $sstype = 'album';
        $ssalbum = $_zp_current_album;
        $sstitle = gettext('Random Album Image');
    } else {
        $sstype = 'all';
        $ssalbum = null;
        $sstitle = gettext('Random Gallery Image');
    }
    ?>
		<div id="random-wrap">
			<?php 
    printRandomImages($sscount, '', $sstype, $ssalbum, 300, 300, true);
    ?>
			<div id="random-title">
				<?php 
    echo $sstitle;
    ?>
			</div>
		</div>
	<?php 
}
Example #9
0
/**
 * "invents" a menu item for the current page (for when one does not exist)
 * Adds the item to the current menuset and modifies its "parent" as needed
 *
 * returns a contrived sort_order for the item.
 *
 * @param string $menuset
 * @param string $visibility
 * return string
 */
function inventMenuItem($menuset, $visibility)
{
    global $_zp_gallery_page, $_zp_current_album, $_zp_current_image, $_zp_current_search, $_menu_manager_items, $_zp_current_article, $_zp_current_page;
    $currentkey = $insertpoint = NULL;
    $newitems = array();
    switch ($_zp_gallery_page) {
        case 'image.php':
            $name = '';
            if (in_context(ZP_SEARCH_LINKED) && !in_context(ZP_ALBUM_LINKED)) {
                $dynamic = $_zp_current_search->getDynamicAlbum();
                if (empty($dynamic)) {
                    //	smple search
                    foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                        if ($item['type'] == 'custompage' && $item['link'] == 'search') {
                            $insertpoint = $item['sort_order'];
                            $currentkey = $insertpoint . '-9999';
                            break;
                        }
                    }
                }
            } else {
                $name = $_zp_current_album->name;
            }
            if (!empty($name)) {
                foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                    if ($item['type'] == 'album' && $item['title'] == $name) {
                        $insertpoint = $item['sort_order'];
                        $currentkey = $insertpoint . '-9999';
                        break;
                    }
                }
            }
            if (!empty($currentkey)) {
                $item = array('id' => 9999, 'sort_order' => $currentkey, 'parentid' => $item['id'], 'type' => 'image', 'include_li' => true, 'title' => $_zp_current_image->getTitle(), 'show' => 1, 'link' => '', 'menuset' => $menuset);
            }
            break;
        case 'news.php':
            if (in_context(ZP_SEARCH_LINKED)) {
                foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                    if ($item['type'] == 'custompage' && $item['link'] == 'search') {
                        $insertpoint = $item['sort_order'];
                        $currentkey = $insertpoint . '-9999';
                        break;
                    }
                }
            } else {
                foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                    if ($item['type'] == 'newsindex') {
                        $insertpoint = $item['sort_order'];
                        $currentkey = $insertpoint . '-9999';
                        break;
                    }
                }
            }
            if (!empty($currentkey)) {
                if (is_NewsArticle()) {
                    $item = array('id' => 9999, 'sort_order' => $currentkey, 'parentid' => $item['id'], 'type' => 'article', 'include_li' => true, 'title' => $_zp_current_article->getTitle(), 'show' => 1, 'link' => '', 'menuset' => $menuset);
                } else {
                    $currentkey = false;
                    // not a news page, must be the index?
                }
            }
            break;
        case 'pages.php':
            if (in_context(ZP_SEARCH_LINKED)) {
                foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                    if ($item['type'] == 'custompage' && $item['link'] == 'search') {
                        $insertpoint = $item['sort_order'];
                        $currentkey = $insertpoint . '-9999';
                        $item = array('id' => 9999, 'sort_order' => $currentkey, 'parentid' => $item['id'], 'type' => 'page', 'include_li' => true, 'title' => $_zp_current_page->getTitle(), 'show' => 1, 'link' => '', 'menuset' => $menuset);
                        break;
                    }
                }
            }
            break;
    }
    if (!empty($currentkey)) {
        foreach ($_menu_manager_items[$menuset][$visibility] as $key => $olditem) {
            $newitems[$key] = $olditem;
            if ($olditem['sort_order'] == $insertpoint) {
                $newitems[$currentkey] = $item;
            }
        }
        $_menu_manager_items[$menuset][$visibility] = $newitems;
    }
    return $currentkey;
}
Example #10
0
/**
 * Handles an album for printAlbumMenuList
 *
 * @param array $albums albums array
 * @param string $folder
 * @param string $option see printAlbumMenuList
 * @param string $showcount see printAlbumMenuList
 * @param int $showsubs see printAlbumMenuList
 * @param string $css_class see printAlbumMenuList
 * @param string $css_class_topactive see printAlbumMenuList
 * @param string $css_class_active see printAlbumMenuList
 * @param bool $firstimagelink If set to TRUE and if the album has images the link will point to page of the first image instead the album thumbnail page
 * @param bool $keeptopactive If set to TRUE the toplevel album entry will stay marked as active if within its subalbums ("list" only)
 * @param int $limit truncation of display text
 */
function printAlbumMenuListAlbum($albums, $folder, $option, $showcount, $showsubs, $css_class, $css_class_topactive, $css_class_active, $firstimagelink, $keeptopactive, $limit = NULL)
{
    global $_zp_gallery, $_zp_current_album, $_zp_current_search, $_recursion_limiter;
    if (is_null($limit)) {
        $limit = MENU_TRUNCATE_STRING;
    }
    if (is_null($showcount)) {
        $showcount = ALBUM_MENU_COUNT;
    }
    if (is_null($showsubs)) {
        $showsubs = ALBUM_MENU_SHOWSUBS;
    }
    if ($showsubs && !is_numeric($showsubs)) {
        $showsubs = 9999999999.0;
    }
    $pagelevel = count(explode('/', $folder));
    $currenturalbumname = "";
    foreach ($albums as $album) {
        $level = count(explode('/', $album));
        $process = $level < $showsubs && $option == "list" || $option != 'list-top' && strpos($folder, $album) === 0 && $level <= $pagelevel;
        if ($process && hasDynamicAlbumSuffix($album) && !is_dir(ALBUM_FOLDER_SERVERPATH . $album)) {
            if (in_array($album, $_recursion_limiter)) {
                $process = false;
            }
            // skip already seen dynamic albums
        }
        $topalbum = newAlbum($album, true);
        if ($level > 1 || $option != 'omit-top') {
            // listing current level album
            if ($level == 1) {
                $css_class_t = $css_class_topactive;
            } else {
                $css_class_t = $css_class_active;
            }
            if ($keeptopactive) {
                if (isset($_zp_current_album) && is_object($_zp_current_album)) {
                    $currenturalbum = getUrAlbum($_zp_current_album);
                    $currenturalbumname = $currenturalbum->name;
                }
            }
            $count = "";
            if ($showcount) {
                $toplevelsubalbums = $topalbum->getAlbums();
                $toplevelsubalbums = count($toplevelsubalbums);
                $topalbumnumimages = $topalbum->getNumImages();
                if ($topalbumnumimages + $toplevelsubalbums > 0) {
                    $count = ' <span style="white-space:nowrap;"><small>(';
                    if ($toplevelsubalbums > 0) {
                        $count .= sprintf(ngettext('%u album', '%u albums', $toplevelsubalbums), $toplevelsubalbums);
                    }
                    if ($topalbumnumimages > 0) {
                        if ($toplevelsubalbums) {
                            $count .= ' ';
                        }
                        $count .= sprintf(ngettext('%u image', '%u images', $topalbumnumimages), $topalbumnumimages);
                    }
                    $count .= ')</small></span>';
                }
            }
            if (in_context(ZP_ALBUM) && !in_context(ZP_SEARCH_LINKED) && (@$_zp_current_album->getID() == $topalbum->getID() || $topalbum->name == $currenturalbumname) || in_context(ZP_SEARCH_LINKED) && ($a = $_zp_current_search->getDynamicAlbum()) && $a->name == $topalbum->name) {
                $current = $css_class_t . ' ';
            } else {
                $current = "";
            }
            $title = $topalbum->getTitle();
            if ($limit) {
                $display = shortenContent($title, $limit, MENU_TRUNCATE_INDICATOR);
            } else {
                $display = $title;
            }
            if ($firstimagelink && $topalbum->getNumImages() != 0) {
                $link = "<li><a " . $current . "href='" . html_encode($topalbum->getImage(0)->getLink()) . "' title='" . html_encode($title) . "'>" . html_encode($display) . "</a>" . $count;
            } else {
                $link = "<li><a " . $current . "href='" . html_encode($topalbum->getLink(1)) . "' title='" . html_encode($title) . "'>" . html_encode($display) . "</a>" . $count;
            }
            echo $link;
        }
        if ($process) {
            // listing subalbums
            $subalbums = $topalbum->getAlbums();
            if (!empty($subalbums)) {
                echo "\n<ul" . $css_class . ">\n";
                array_push($_recursion_limiter, $album);
                printAlbumMenuListAlbum($subalbums, $folder, $option, $showcount, $showsubs, $css_class, $css_class_topactive, $css_class_active, $firstimagelink, false, $limit);
                array_pop($_recursion_limiter);
                echo "\n</ul>\n";
            }
        }
        if ($option == 'list' || $option == 'list-top' || $level > 1) {
            // close the LI
            echo "\n</li>\n";
        }
    }
}
Example #11
0
    /**
     * Prints a playlist using jPlayer. Several playlists per page supported.
     *
     * 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, although Flowplayer 3 also supports images
     * Replace the entire 'next_image()' loop on album.php with this:
     * <?php printjPlayerPlaylist("playlist"); ?> or <?php printjPlayerPlaylist("playlist-audio"); ?>
     *
     * @param string $option "playlist" use for pure video and mixed video/audio playlists or if you want to show the poster/videothumb with audio only playlists,
     * 											 "playlist-audio" use for pure audio playlists (m4a,mp3,fla supported only) if you don't need the poster/videothumb to be shown only.
     * @param string $albumfolder album name to get a playlist from directly
     */
    function printjPlayerPlaylist($option = "playlist", $albumfolder = "")
    {
        global $_zp_current_album, $_zp_current_search;
        if (empty($albumfolder)) {
            if (in_context(ZP_SEARCH)) {
                $albumobj = $_zp_current_search;
            } else {
                $albumobj = $_zp_current_album;
            }
        } else {
            $albumobj = newAlbum($albumfolder);
        }
        $entries = $albumobj->getImages(0);
        if (($numimages = count($entries)) != 0) {
            switch ($option) {
                case 'playlist':
                    $suffixes = array('m4a', 'm4v', 'mp3', 'mp4', 'flv', 'fla');
                    break;
                case 'playlist-audio':
                    $suffixes = array('m4a', 'mp3', 'fla');
                    break;
                default:
                    //	an invalid option parameter!
                    return;
            }
            $id = $albumobj->getID();
            ?>
			<script type="text/javascript">
								//<![CDATA[
								$(document).ready(function(){
				new jPlayerPlaylist({
				jPlayer: "#jquery_jplayer_<?php 
            echo $id;
            ?>
",
								cssSelectorAncestor: "#jp_container_<?php 
            echo $id;
            ?>
"
				}, [
			<?php 
            $count = '';
            $number = '';
            foreach ($entries as $entry) {
                $count++;
                if (is_array($entry)) {
                    $ext = getSuffix($entry['filename']);
                } else {
                    $ext = getSuffix($entry);
                }
                $numbering = '';
                if (in_array($ext, $suffixes)) {
                    $number++;
                    if (getOption('jplayer_playlist_numbered')) {
                        $numbering = '<span>' . $number . '</span>';
                    }
                    $video = newImage($albumobj, $entry);
                    $videoThumb = '';
                    $this->setModeAndSuppliedFormat($ext);
                    if ($option == 'playlist' && getOption('jplayer_poster')) {
                        $videoThumb = ',poster:"' . $video->getCustomImage(null, $this->width, $this->height, $this->width, $this->height, null, null, true) . '"';
                    }
                    $playtime = '';
                    if (getOption('jplayer_playlist_playtime')) {
                        $playtime = ' (' . $video->get('VideoPlaytime') . ')';
                    }
                    ?>
						{
						title:"<?php 
                    echo $numbering . html_encode($video->getTitle()) . $playtime;
                    ?>
",
					<?php 
                    if (getOption('jplayer_download')) {
                        ?>
							free:true,
					<?php 
                    }
                    ?>
					<?php 
                    echo $this->supplied;
                    ?>
:"<?php 
                    echo html_encode(pathurlencode($url = $video->getFullImageURL(FULLWEBPATH)));
                    ?>
"
					<?php 
                    echo $this->getCounterpartFiles($url, $ext);
                    ?>
					<?php 
                    echo $videoThumb;
                    ?>
						}
					<?php 
                    if ($numimages != $count) {
                        echo ',';
                    }
                }
                // if video
            }
            // foreach
            // for some reason the playlist must run with supplied: "flash,html" because otherwise neither videothumbs(poster) nor flv/flv work on Safari 4.1.
            // Seems the flash fallback fails here
            ?>
				], {
				swfPath: "<?php 
            echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
            ?>
/jplayer/js",
								solution: "flash,html",
			<?php 
            if ($option == 'playlist') {
                ?>
					supplied: "m4v, mp4, m4a, mp3, fla, flv<?php 
                echo $this->supplied_counterparts;
                ?>
"
			<?php 
            } else {
                ?>
					supplied: "m4a, mp3, fla<?php 
                echo $this->supplied_counterparts;
                ?>
"
				<?php 
            }
            if ($option != 'playlist-audio') {
                ?>
					, size: {
					width: "<?php 
                echo $this->width;
                ?>
px",
									height: "<?php 
                echo $this->height;
                ?>
px",
									cssClass: "<?php 
                echo $this->playersize;
                ?>
"
					}
			<?php 
            }
            ?>
				useStateClassSkin: true,
								autoBlur: false,
								smoothPlayBar: true,
								keyEnabled: true,
								remainingDuration: true,
								toggleDuration: true
				});
				});
								//]]>
			</script>
			<?php 
            if ($option == 'playlist') {
                ?>
				<div id="jp_container_<?php 
                echo $id;
                ?>
" class="jp-video <?php 
                echo $this->playersize;
                ?>
" role="application" aria-label="media player">
					<div class="jp-type-playlist">
						<div id="jquery_jplayer_<?php 
                echo $id;
                ?>
" class="jp-jplayer"></div>
						<div class="jp-gui">
							<div class="jp-video-play">
								<button class="jp-video-play-icon" role="button" tabindex="0"><?php 
                echo gettext('play');
                ?>
</button>
							</div>
							<div class="jp-interface">
								<div class="jp-progress">
									<div class="jp-seek-bar">
										<div class="jp-play-bar"></div>
									</div>
								</div>
								<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
								<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
								<div class="jp-controls-holder">
									<?php 
                echo $this->getPlayerHTMLparts('video', 'controls-playlist');
                ?>
									<div class="jp-volume-controls">
										<button class="jp-mute" role="button" tabindex="0"><?php 
                echo gettext('mute');
                ?>
</button>
										<button class="jp-volume-max" role="button" tabindex="0"><?php 
                echo gettext('max volume');
                ?>
</button>
										<div class="jp-volume-bar">
											<div class="jp-volume-bar-value"></div>
										</div>
									</div>
									<?php 
                echo $this->getPlayerHTMLparts('video', 'toggles-playlist');
                ?>
								</div>
								<div class="jp-details">
									<div class="jp-title" aria-label="title">&nbsp;</div>
								</div>
							</div>
						</div>
						<div class="jp-playlist">
							<ul>
								<!-- The method Playlist.displayPlaylist() uses this unordered list -->
								<li>&nbsp;</li>
							</ul>
						</div>
						<?php 
                echo $this->getPlayerHTMLparts('video', 'no-solution');
                ?>
					</div>
				</div>
				<?php 
            } else {
                // playlist-audio
                ?>
				<div id="jquery_jplayer_<?php 
                echo $id;
                ?>
" class="jp-jplayer"></div>
				<div id="jp_container_<?php 
                echo $id;
                ?>
" class="jp-audio" role="application" aria-label="media player">
					<div class="jp-type-playlist">
						<div class="jp-gui jp-interface">
							<?php 
                echo $this->getPlayerHTMLparts('audio', 'controls-playlist');
                ?>
							<div class="jp-progress">
								<div class="jp-seek-bar">
									<div class="jp-play-bar"></div>
								</div>
							</div>
							<div class="jp-volume-controls">
								<button class="jp-mute" role="button" tabindex="0"><?php 
                echo gettext('mute');
                ?>
</button>
								<button class="jp-volume-max" role="button" tabindex="0"><?php 
                echo gettext('max volume');
                ?>
</button>
								<div class="jp-volume-bar">
									<div class="jp-volume-bar-value"></div>
								</div>
							</div>
							<div class="jp-time-holder">
								<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
								<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
							</div>
							<?php 
                echo $this->getPlayerHTMLparts('audio', 'toggles-playlist');
                ?>
						</div>
						<div class="jp-playlist">
							<ul>
								<li>&nbsp;</li>
							</ul>
						</div>
						<?php 
                echo $this->getPlayerHTMLparts('audio', 'no-solution');
                ?>
					</div>
				</div>

				<?php 
            }
            // if else playlist
        }
        // if no images at all end
    }
Example #12
0
function getTitleBreadcrumb($before = ' ( ', $between = ' | ', $after = ' ) ')
{
    global $_zp_gallery, $_zp_current_search, $_zp_current_album, $_zp_last_album;
    $titlebreadcrumb = '';
    if (in_context(ZP_SEARCH_LINKED)) {
        $dynamic_album = $_zp_current_search->getDynamicAlbum();
        if (empty($dynamic_album)) {
            $titlebreadcrumb .= $before . gettext("Search Result") . $after;
            if (is_null($_zp_current_album)) {
                return;
            } else {
                $parents = getParentAlbums();
            }
        } else {
            $album = new Album($_zp_gallery, $dynamic_album);
            $parents = getParentAlbums($album);
            if (in_context(ZP_ALBUM_LINKED)) {
                array_push($parents, $album);
            }
        }
    } else {
        $parents = getParentAlbums();
    }
    $n = count($parents);
    if ($n > 0) {
        $titlebreadcrumb .= $before;
        $i = 0;
        foreach ($parents as $parent) {
            if ($i > 0) {
                $titlebreadcrumb .= $between;
            }
            $titlebreadcrumb .= $parent->getTitle();
            $i++;
        }
        $titlebreadcrumb .= $after;
    }
    return $titlebreadcrumb;
}
/**
 * Counts news articles, either all or by category or archive date, published or un-published
 *
 * @param string $category The categorylink of the category to count
 * @param string $published "published" for an published articles,
 * 													"unpublished" for an unpublised articles,
 * 													"all" for all articles
 * @return array
 */
function countArticles($category = '', $published = 'published', $count_subcat_articles = true)
{
    deprecated_function_notify(gettext('Count the articles instead.'));
    global $_zp_post_date;
    if (zp_loggedin(ZENPAGE_NEWS_RIGHTS)) {
        $published = "all";
    } else {
        $published = "published";
    }
    $show = "";
    if (empty($category)) {
        switch ($published) {
            case "published":
                $show = " WHERE `show` = 1 AND date <= '" . date('Y-m-d H:i:s') . "'";
                break;
            case "unpublished":
                $show = " WHERE `show` = 0 AND date <= '" . date('Y-m-d H:i:s') . "'";
                break;
            case "all":
                $show = "";
                break;
        }
        // date archive query addition
        if (in_context(ZP_ZENPAGE_NEWS_DATE)) {
            $postdate = $_zp_post_date;
            if (empty($show)) {
                $and = " WHERE ";
            } else {
                $and = " AND ";
            }
            $datesearch = $and . "date LIKE '{$postdate}%'";
        } else {
            $datesearch = "";
        }
        $result = query("SELECT COUNT(*) FROM " . prefix('news') . $show . $datesearch);
        $row = db_fetch_row($result);
        $count = $row[0];
        return $count;
    } else {
        $catobj = new ZenpageCategory($category);
        switch ($published) {
            case "published":
                $show = " AND news.show = 1 AND news.date <= '" . date('Y-m-d H:i:s') . "'";
                break;
            case "unpublished":
                $show = " AND news.show = 0 AND news.date <= '" . date('Y-m-d H:i:s') . "'";
                break;
            case "all":
                $show = "";
                break;
        }
        if ($count_subcat_articles) {
            $subcats = $catobj->getSubCategories();
        }
        if ($subcats && $count_subcat_articles) {
            $cat = " (cat.cat_id = '" . $catobj->getID() . "'";
            foreach ($subcats as $subcat) {
                $subcatobj = new ZenpageCategory($subcat);
                $cat .= "OR cat.cat_id = '" . $subcatobj->getID() . "' ";
            }
            $cat .= ") AND cat.news_id = news.id ";
        } else {
            $cat = " cat.cat_id = '" . $catobj->getID() . "' AND cat.news_id = news.id ";
        }
        $result = query_full_array("SELECT DISTINCT news.titlelink FROM " . prefix('news2cat') . " as cat, " . prefix('news') . " as news WHERE " . $cat . $show);
        $count = count($result);
        return $count;
    }
}
Example #14
0
 protected function areaMatch()
 {
     return in_context(ZP_ZENPAGE_PAGE) && getPageTitleLink() == $this->pageName;
 }
Example #15
0
function commonNewsLoop($paged)
{
    $newstypes = array('album' => gettext('album'), 'image' => gettext('image'), 'video' => gettext('video'), 'news' => gettext('news'));
    while (next_news()) {
        $newstypedisplay = gettext('news');
        if (stickyNews()) {
            $newstypedisplay .= ' <small><em>' . gettext('sticky') . '</em></small>';
        }
        ?>
		<div class="newsarticle<?php 
        if (stickyNews()) {
            echo ' sticky';
        }
        ?>
">
			<h3><?php 
        printNewsURL();
        echo " <span class='newstype'>[" . $newstypedisplay . "]</span>";
        ?>
</h3>
			<div class="newsarticlecredit">
				<span class="newsarticlecredit-left">
					<?php 
        $count = @call_user_func('getCommentCount');
        $cat = getNewsCategories();
        printNewsDate();
        if ($count > 0) {
            echo ' | ';
            printf(gettext("Comments: %d"), $count);
        }
        ?>
				</span>
				<?php 
        if (!empty($cat) && !in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
            echo ' | ';
            printNewsCategories(", ", gettext("Categories: "), "newscategories");
        }
        ?>
			</div> <!-- newsarticlecredit -->
			<br class="clearall" />
			<?php 
        printCodeblock(1);
        ?>
			<?php 
        printNewsContent();
        ?>
			<?php 
        printCodeblock(2);
        ?>
			<br class="clearall" />
		</div>
		<?php 
    }
    if ($paged) {
        printNewsPageListWithNav(gettext('next »'), gettext('« prev'), true, 'pagelist', true);
    }
}
Example #16
0
function commonNewsLoop($paged)
{
    $newstypes = array('album' => gettext('album'), 'image' => gettext('image'), 'video' => gettext('video'), 'news' => gettext('news'));
    while (next_news()) {
        $newstype = getNewsType();
        $newstypedisplay = $newstypes[$newstype];
        if (stickyNews()) {
            $newstypedisplay .= ' <small><em>' . gettext('sticky') . '</em></small>';
        }
        ?>
		<div class="newsarticle<?php 
        if (stickyNews()) {
            echo ' sticky';
        }
        ?>
">
			<h3><?php 
        printNewsTitleLink();
        echo " <span class='newstype'>[" . $newstypedisplay . "]</span>";
        ?>
</h3>
			<div class="newsarticlecredit">
				<span class="newsarticlecredit-left">
					<?php 
        $count = getCommentCount();
        $cat = getNewsCategories();
        printNewsDate();
        if ($count > 0) {
            echo ' | ';
            printf(gettext("Comments: %d"), $count);
        }
        ?>
				</span>
				<?php 
        if (is_GalleryNewsType()) {
            echo ' | ' . gettext("Album:") . " <a href='" . getNewsAlbumURL() . "' title='" . getBareNewsAlbumTitle() . "'>" . getNewsAlbumTitle() . "</a>";
        } else {
            if (!empty($cat) && !in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
                echo ' | ';
                printNewsCategories(", ", gettext("Categories: "), "newscategories");
            }
        }
        ?>
			</div> <!-- newsarticlecredit -->
			<br clear="all" />
			<?php 
        printCodeblock(1);
        ?>
			<?php 
        printNewsContent();
        ?>
			<?php 
        printCodeblock(2);
        ?>
			<br clear="all" />
			</div>
	<?php 
    }
    if ($paged) {
        printNewsPageListWithNav(gettext('next &raquo;'), gettext('&laquo; prev'), true, 'pagelist', true);
    }
}
Example #17
0
    /** Prints the jQuery jCarousel HTML setup to be replaced by JS
     *
     * @param int $minitems The minimum number of thumbs to be visible always if resized regarding responsiveness.
     * @param int $maxitems not supported
     * @param int $width Width Set to NULL if you want to use the backend plugin options.
     * @param int $height Height Set to NULL if you want to use the backend plugin options.
     * @param int $cropw Crop width Set to NULL if you want to use the backend plugin options.
     * @param int $croph Crop heigth Set to NULL if you want to use the backend plugin options.
     * @param bool $crop TRUE for cropped thumbs, FALSE for un-cropped thumbs. $width and $height then will be used as maxspace. Set to NULL if you want to use the backend plugin options.
     * @param bool $fullimagelink Set to TRUE if you want the thumb link to link to the full image instead of the image page. Set to NULL if you want to use the backend plugin options.
     * @param string $vertical 'horizontal','vertical', 'fade'
     * @param int $speed not supported
     */
    function printThumbNav($minitems = NULL, $maxitems = NULL, $width = NULL, $height = NULL, $cropw = NULL, $croph = NULL, $fullimagelink = NULL, $vertical = NULL, $speed = NULL, $thumbscroll = NULL)
    {
        global $_zp_gallery, $_zp_current_album, $_zp_current_image, $_zp_current_search, $_zp_gallery_page;
        //	Just incase the theme has not set the option, at least second try will work!
        setOptionDefault('slideshow_' . $_zp_gallery->getCurrentTheme() . '_' . stripSuffix($_zp_gallery_page), 1);
        $items = "";
        if (is_object($_zp_current_album) && $_zp_current_album->getNumImages() >= 2) {
            if (is_null($thumbscroll)) {
                $thumbscroll = getOption('jcarousel_scroll');
            } else {
                $thumbscroll = sanitize_numeric($thumbscroll);
            }
            if (is_null($width)) {
                $width = getOption('jcarousel_width');
            } else {
                $width = sanitize_numeric($width);
            }
            if (is_null($height)) {
                $height = getOption('jcarousel_height');
            } else {
                $height = sanitize_numeric($height);
            }
            if (is_null($cropw)) {
                $cropw = getOption('jcarousel_cropw');
            } else {
                $cropw = sanitize_numeric($cropw);
            }
            if (is_null($croph)) {
                $croph = getOption('jcarousel_croph');
            } else {
                $croph = sanitize_numeric($croph);
            }
            if (is_null($fullimagelink)) {
                $fullimagelink = getOption('jcarousel_fullimagelink');
            } else {
                $fullimagelink = sanitize($fullimagelink);
            }
            if (is_null($vertical)) {
                $vertical = getOption('jcarousel_vertical');
            } else {
                $vertical = sanitize($vertical);
            }
            if ($vertical) {
                $vertical = 'true';
            } else {
                $vertical = 'false';
            }
            if (in_context(ZP_SEARCH_LINKED)) {
                if ($_zp_current_search->getNumImages() === 0) {
                    $searchimages = false;
                } else {
                    $searchimages = true;
                }
            } else {
                $searchimages = false;
            }
            if (in_context(ZP_SEARCH_LINKED) && $searchimages) {
                $jcarousel_items = $_zp_current_search->getImages();
            } else {
                $jcarousel_items = $_zp_current_album->getImages();
            }
            if (count($jcarousel_items) >= 2) {
                foreach ($jcarousel_items as $item) {
                    if (is_array($item)) {
                        $imgobj = newImage($_zp_current_album, $item['filename']);
                    } else {
                        $imgobj = newImage($_zp_current_album, $item);
                    }
                    if ($fullimagelink) {
                        $link = $imgobj->getFullImageURL();
                    } else {
                        $link = $imgobj->getLink();
                    }
                    if (!is_null($_zp_current_image)) {
                        if ($_zp_current_album->isDynamic()) {
                            if ($_zp_current_image->filename == $imgobj->filename && $_zp_current_image->getAlbum()->name == $imgobj->getAlbum()->name) {
                                $active = 'active';
                            } else {
                                $active = '';
                            }
                        } else {
                            if ($_zp_current_image->filename == $imgobj->filename) {
                                $active = 'active';
                            } else {
                                $active = '';
                            }
                        }
                    } else {
                        $active = '';
                    }
                    $imageurl = $imgobj->getCustomImage(NULL, $width, $height, $cropw, $croph, NULL, NULL, true);
                    $items .= ' {url: "' . html_encode($imageurl) . '", title: "' . html_encode($imgobj->getTitle()) . '", link: "' . html_encode($link) . '", active: "' . $active . '"},';
                    $items .= "\n";
                }
            }
            $items = substr($items, 0, -2);
            $numimages = getNumImages();
            if (!is_null($_zp_current_image)) {
                $imgnumber = imageNumber();
            } else {
                $imgnumber = 1;
            }
            ?>
			<script type="text/javascript">
				// <!-- <![CDATA[
				var mycarousel_itemList = [
			<?php 
            echo $items;
            ?>
				];

				function mycarousel_itemLoadCallback(carousel, state) {
					for (var i = carousel.first; i <= carousel.last; i++) {
						if (carousel.has(i)) {
							continue;
						}
						if (i > mycarousel_itemList.length) {
							break;
						}
						carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[i - 1]));
					}
				}

				function mycarousel_getItemHTML(item) {
					if (item.active === "") {
						html = '<a href="' + item.link + '" title="' + item.title + '"><img src="' + item.url + '" width="<?php 
            echo $width;
            ?>
" height="<?php 
            echo $height;
            ?>
" alt="' + item.url + '" /></a>';
					} else {
						html = '<a href="' + item.link + '" title="' + item.title + '"><img class="activecarouselimage" src="' + item.url + '" width="<?php 
            echo $width;
            ?>
" height="<?php 
            echo $height;
            ?>
" alt="' + item.url + '" /></a>';
					}
					return html;
				}

				jQuery(document).ready(function() {
					jQuery("#mycarousel").jcarousel({
						vertical: <?php 
            echo $vertical;
            ?>
,
						size: mycarousel_itemList.length,
						start: <?php 
            echo $imgnumber;
            ?>
,
						scroll: <?php 
            echo $thumbscroll;
            ?>
,
						itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback}
					});
				});
				// ]]> -->
			</script>
			<ul id="mycarousel">
				<!-- The content will be dynamically loaded in here -->
			</ul>
			<?php 
        }
    }
Example #18
0
/**
 * returns the hitcounter for the current page or for the object passed
 *
 * @param object $obj the album or page object for which the hitcount is desired
 * @return string
 */
function getHitcounter($obj = NULL)
{
    global $_zp_current_album, $_zp_current_image, $_zp_gallery_page, $_zp_current_article, $_zp_current_page, $_zp_current_category;
    if (is_null($obj)) {
        switch ($_zp_gallery_page) {
            case 'album.php':
                $obj = $_zp_current_album;
                break;
            case 'image.php':
                $obj = $_zp_current_image;
                break;
            case 'pages.php':
                $obj = $_zp_current_page;
                break;
            case 'news.php':
                if (in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
                    $obj = $_zp_current_category;
                } else {
                    $obj = $_zp_current_article;
                    if (is_null($obj)) {
                        return 0;
                    }
                }
                break;
            case 'search.php':
                return NULL;
            default:
                $page = stripSuffix($_zp_gallery_page);
                return getOption('Page-Hitcounter-' . $page);
        }
    }
    return $obj->getHitcounter();
}
Example #19
0
/**
 * Gets the select layout page and returns it to the load_theme_script filter
 *
 * @param string $path Path of the layout file
 * @return string
 * @return string
 */
function getLayout($path)
{
    global $_zp_gallery, $_zp_gallery_page, $_zp_current_image, $_zp_current_album, $_zp_current_zenpage_page, $_zp_current_zenpage_news, $_zp_current_category, $_zp_current_search;
    if ($path) {
        $themepath = THEMEFOLDER . '/' . $_zp_gallery->getCurrentTheme() . '/';
        $getlayout = false;
        switch ($_zp_gallery_page) {
            case 'album.php':
                if (getOption('multiple_layouts_albums')) {
                    $getlayout = getSelectedLayout($_zp_current_album, 'multiple_layouts_albums');
                }
                break;
            case 'image.php':
                if (getOption('multiple_layouts_images')) {
                    $currentalbumname = $_zp_current_album->name;
                    if (in_context(ZP_SEARCH_LINKED) && !in_context(ZP_ALBUM_LINKED)) {
                        if (!($album = $_zp_current_search->getDynamicAlbum())) {
                            $album = $_zp_current_album;
                        }
                    } else {
                        $getlayout = getSelectedLayout($_zp_current_image, 'multiple_layouts_images');
                        $album = $_zp_current_album;
                    }
                    if ($album && !$getlayout) {
                        $getlayout = checkLayoutUseForImages($album);
                    }
                }
                break;
            case 'pages.php':
                if (getOption('multiple_layouts_pages')) {
                    $getlayout = getSelectedLayout($_zp_current_zenpage_page, 'multiple_layouts_pages');
                }
                break;
            case 'news.php':
                if (getOption('multiple_layouts_news_categories') && in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
                    $getlayout = getSelectedLayout($_zp_current_category, 'multiple_layouts_news_categories');
                } elseif (getOption('multiple_layouts_news') && in_context(ZP_ZENPAGE_SINGLE)) {
                    $getlayout = getSelectedLayout($_zp_current_zenpage_news, 'multiple_layouts_news');
                }
                break;
        }
        if ($getlayout && $getlayout['data'] && file_exists(internalToFilesystem(SERVERPATH . '/' . $themepath . $getlayout['data']))) {
            return $themepath . $getlayout['data'];
        }
    }
    return $path;
}
Example #20
0
					<?php 
    }
    ?>
				</div>
				<div id="object-info">
					<?php 
    // The following checks and modifications of breadcrumb link backs are necessary when using an album layout without pagination, since default behaviour is to provide a link back to the album page the image is on.
    $linkbackpaged = true;
    if (function_exists('getSelectedLayout')) {
        $albumlayout = getSelectedLayout($_zp_current_album, 'multiple_layouts_albums');
    } else {
        $albumlayout = array('data' => '');
    }
    if ($albumlayout['data'] == 'album-masonry.php' || $albumlayout['data'] == 'album-galleria.php' || getOption('zpbase_defaultalbum') == 'album-galleria' || getOption('zpbase_defaultalbum') == 'album-masonry') {
        $linkbackpaged = false;
        if (in_context(ZP_SEARCH_LINKED)) {
            $_zp_current_search->page = '1';
        }
    }
    ?>
					<div id="object-title">
						<div id="breadcrumb">
							<?php 
    printParentBreadcrumb('', ' / ', ' / ');
    if ($linkbackpaged) {
        printAlbumBreadcrumb(' ', ' / ');
    } else {
        $link = rewrite_path("/" . pathurlencode($_zp_current_album->name) . "/", "/index.php?album=" . pathurlencode($_zp_current_album->name));
        ?>
							<a href="<?php 
        echo $link;
Example #21
0
    /**
     * Prints a link to call the slideshow (not shown if there are no images in the album)
     * To be used on album.php and image.php
     * A CSS id names 'slideshowlink' is attached to the link so it can be directly styled.
     *
     * If the mode is set to "jQuery Colorbox" and the Colorbox plugin is enabled this link starts a Colorbox slideshow
     * from a hidden HTML list of all images in the album. On album.php it starts with the first always, on image.php with the current image.
     *
     * @param string $linktext Text for the link
     * @param string $linkstyle Style of Text for the link
     */
    function printSlideShowLink($linktext = NULL, $linkstyle = Null)
    {
        global $_zp_gallery, $_zp_current_image, $_zp_current_album, $_zp_current_search, $slideshow_instance, $_zp_gallery_page;
        if (is_null($linktext)) {
            $linktext = gettext('View Slideshow');
        }
        if (empty($_GET['page'])) {
            $pagenr = 1;
        } else {
            $pagenr = sanitize_numeric($_GET['page']);
        }
        $slideshowhidden = '';
        $numberofimages = 0;
        if (in_context(ZP_SEARCH)) {
            $imagenumber = '';
            $imagefile = '';
            $albumnr = 0;
            $slideshowlink = rewrite_path(_PAGE_ . '/slideshow', "index.php?p=slideshow");
            $slideshowhidden = '<input type="hidden" name="preserve_search_params" value="' . html_encode($_zp_current_search->getSearchParams()) . '" />';
        } else {
            if (in_context(ZP_IMAGE)) {
                $imagenumber = imageNumber();
                $imagefile = $_zp_current_image->filename;
            } else {
                $imagenumber = '';
                $imagefile = '';
            }
            if (in_context(ZP_SEARCH_LINKED)) {
                $albumnr = -$_zp_current_album->getID();
                $slideshowhidden = '<input type="hidden" name="preserve_search_params" value="' . html_encode($_zp_current_search->getSearchParams()) . '" />';
            } else {
                $albumnr = $_zp_current_album->getID();
            }
            if ($albumnr) {
                $slideshowlink = rewrite_path(pathurlencode($_zp_current_album->getFileName()) . '/' . _PAGE_ . '/slideshow', "index.php?p=slideshow&amp;album=" . urlencode($_zp_current_album->getFileName()));
            } else {
                $slideshowlink = rewrite_path(_PAGE_ . '/slideshow', "index.php?p=slideshow");
                $slideshowhidden = '<input type="hidden" name="favorites_page" value="1" />' . "\n" . '<input type="hidden" name="title" value="' . $_myFavorites->instance . '" />';
            }
        }
        $numberofimages = getNumImages();
        $option = getOption('slideshow_mode');
        switch ($option) {
            case 'jQuery':
                if ($numberofimages > 1) {
                    ?>
					<form name="slideshow_<?php 
                    echo $slideshow_instance;
                    ?>
" method="post"	action="<?php 
                    echo zp_apply_filter('getLink', $slideshowlink, 'slideshow.php', NULL);
                    ?>
">
						<?php 
                    echo $slideshowhidden;
                    ?>
						<input type="hidden" name="pagenr" value="<?php 
                    echo html_encode($pagenr);
                    ?>
" />
						<input type="hidden" name="albumid" value="<?php 
                    echo $albumnr;
                    ?>
" />
						<input type="hidden" name="numberofimages" value="<?php 
                    echo $numberofimages;
                    ?>
" />
						<input type="hidden" name="imagenumber" value="<?php 
                    echo $imagenumber;
                    ?>
" />
						<input type="hidden" name="imagefile" value="<?php 
                    echo html_encode($imagefile);
                    ?>
" />
						<?php 
                    if (!empty($linkstyle)) {
                        echo '<p style="' . $linkstyle . '">';
                    }
                    ?>
						<a class="slideshowlink" id="slideshowlink_<?php 
                    echo $slideshow_instance;
                    ?>
" 	href="javascript:document.slideshow_<?php 
                    echo $slideshow_instance;
                    ?>
.submit()"><?php 
                    echo $linktext;
                    ?>
</a>
						<?php 
                    if (!empty($linkstyle)) {
                        echo '</p>';
                    }
                    ?>
					</form>
					<?php 
                }
                $slideshow_instance++;
                break;
            case 'colorbox':
                $theme = $_zp_gallery->getCurrentTheme();
                $script = stripSuffix($_zp_gallery_page);
                if (!getOption('colorbox_' . $theme . '_' . $script)) {
                    setOptionDefault('colorbox_' . $theme . '_' . $script, 1);
                    $themes = $_zp_gallery->getThemes();
                    ?>
					<div class="errorbox"><?php 
                    printf(gettext('Slideshow not available because colorbox is not enabled on %1$s <em>%2$s</em> pages.'), $themes[$theme]['name'], $script);
                    ?>
</div>
					<?php 
                    break;
                }
                if ($numberofimages > 1) {
                    if (in_context(ZP_SEARCH_LINKED) && !in_context(ZP_ALBUM_LINKED) || in_context(ZP_SEARCH) && is_null($_zp_current_album)) {
                        $images = $_zp_current_search->getImages(0);
                    } else {
                        $images = $_zp_current_album->getImages(0);
                    }
                    $count = '';
                    ?>
					<script type="text/javascript">
						$(document).ready(function() {
							$("a[rel='slideshow']").colorbox({
								slideshow: true,
								loop: true,
								transition: '<?php 
                    echo getOption('slideshow_colorbox_transition');
                    ?>
',
								slideshowSpeed: <?php 
                    echo getOption('slideshow_speed');
                    ?>
,
								slideshowStart: '<?php 
                    echo gettext("start slideshow");
                    ?>
',
								slideshowStop: '<?php 
                    echo gettext("stop slideshow");
                    ?>
',
								previous: '<?php 
                    echo gettext("prev");
                    ?>
',
								next: '<?php 
                    echo gettext("next");
                    ?>
',
								close: '<?php 
                    echo gettext("close");
                    ?>
',
								current: '<?php 
                    printf(gettext('image %1$s of %2$s'), '{current}', '{total}');
                    ?>
',
								maxWidth: '98%',
								maxHeight: '98%',
								photo: true
							});
						});
					</script>
					<?php 
                    foreach ($images as $image) {
                        if (is_array($image)) {
                            $suffix = getSuffix($image['filename']);
                        } else {
                            $suffix = getSuffix($image);
                        }
                        $suffixes = array('jpg', 'jpeg', 'gif', 'png');
                        if (in_array($suffix, $suffixes)) {
                            $count++;
                            if (is_array($image)) {
                                $albobj = newAlbum($image['folder']);
                                $imgobj = newImage($albobj, $image['filename']);
                            } else {
                                $imgobj = newImage($_zp_current_album, $image);
                            }
                            if (in_context(ZP_SEARCH_LINKED) || $_zp_gallery_page != 'image.php') {
                                if ($count == 1) {
                                    $style = '';
                                } else {
                                    $style = ' style="display:none"';
                                }
                            } else {
                                if ($_zp_current_image->filename == $image) {
                                    $style = '';
                                } else {
                                    $style = ' style="display:none"';
                                }
                            }
                            switch (getOption('slideshow_colorbox_imagetype')) {
                                case 'fullimage':
                                    $imagelink = getFullImageURL($imgobj);
                                    break;
                                case 'sizedimage':
                                    $imagelink = $imgobj->getCustomImage(getOption("slideshow_width"), NULL, NULL, NULL, NULL, NULL, NULL, false, NULL);
                                    break;
                            }
                            $imagetitle = '';
                            if (getOption('slideshow_colorbox_imagetitle')) {
                                $imagetitle = html_encode(getBare($imgobj->getTitle()));
                            }
                            ?>
							<a href="<?php 
                            echo html_encode(pathurlencode($imagelink));
                            ?>
" rel="slideshow"<?php 
                            echo $style;
                            ?>
 title="<?php 
                            echo $imagetitle;
                            ?>
"><?php 
                            echo $linktext;
                            ?>
</a>
							<?php 
                        }
                    }
                }
                break;
        }
    }
    /** Prints the jQuery bxslider HTML setup to be replaced by JS
     *
     * @param int $minitems The minimum number of thumbs to be visible always if resized regarding responsiveness.
     * @param int $maxitems The maximum number of thumbs to be visible always if resized regarding responsiveness.
     * @param int $width Width Set to NULL if you want to use the backend plugin options.
     * @param int $height Height Set to NULL if you want to use the backend plugin options.
     * @param int $cropw Crop width Set to NULL if you want to use the backend plugin options.
     * @param int $croph Crop heigth Set to NULL if you want to use the backend plugin options.
     * @param bool $crop TRUE for cropped thumbs, FALSE for un-cropped thumbs. $width and $height then will be used as maxspace. Set to NULL if you want to use the backend plugin options.
     * @param bool $fullimagelink Set to TRUE if you want the thumb link to link to the full image instead of the image page. Set to NULL if you want to use the backend plugin options.
     * @param string $mode 'horizontal','vertical', 'fade'
     * @param int $speed The speed in miliseconds the slides advance when clicked
     */
    function printThumbNav($minitems = NULL, $maxitems = NULL, $width = NULL, $height = NULL, $cropw = NULL, $croph = NULL, $fullimagelink = NULL, $mode = NULL, $speed = NULL)
    {
        global $_zp_gallery, $_zp_current_album, $_zp_current_image, $_zp_current_search, $_zp_gallery_page;
        //	Just incase the theme has not set the option, at least second try will work!
        setOptionDefault('bxslider_' . $_zp_gallery->getCurrentTheme() . '_' . stripSuffix($_zp_gallery_page), 1);
        $items = "";
        if (is_object($_zp_current_album) && $_zp_current_album->getNumImages() >= 2) {
            if (is_null($minitems)) {
                $minitems = getOption('bxslider_minitems');
            } else {
                $minitems = sanitize_numeric($minitems);
            }
            $minitems = max(1, (int) $minitems);
            if (is_null($maxitems)) {
                $maxitems = getOption('bxslider_maxitems');
            } else {
                $maxitems = sanitize_numeric($maxitems);
            }
            $maxitems = max(1, (int) $maxitems);
            if (is_null($width)) {
                $width = getOption('bxslider_width');
            } else {
                $width = sanitize_numeric($width);
            }
            if (is_null($height)) {
                $height = getOption('bxslider_height');
            } else {
                $height = sanitize_numeric($height);
            }
            if (is_null($cropw)) {
                $cropw = getOption('bxslider_cropw');
            } else {
                $cropw = sanitize_numeric($cropw);
            }
            if (is_null($croph)) {
                $croph = getOption('bxslider_croph');
            } else {
                $croph = sanitize_numeric($croph);
            }
            if (is_null($fullimagelink)) {
                $fullimagelink = getOption('bxslider_fullimagelink');
            } else {
                $fullimagelink = sanitize($fullimagelink);
            }
            if (is_null($mode)) {
                $mode = getOption('bxslider_mode');
            } else {
                $mode = sanitize($mode);
            }
            if (is_null($speed)) {
                $speed = getOption('bxslider_speed');
            } else {
                $speed = sanitize_numeric($speed);
            }
            if (in_context(ZP_SEARCH_LINKED)) {
                if ($_zp_current_search->getNumImages() === 0) {
                    $searchimages = false;
                } else {
                    $searchimages = true;
                }
            } else {
                $searchimages = false;
            }
            if (in_context(ZP_SEARCH_LINKED) && $searchimages) {
                $bxslider_items = $_zp_current_search->getImages();
            } else {
                $bxslider_items = $_zp_current_album->getImages();
            }
            if (count($bxslider_items) >= 2) {
                foreach ($bxslider_items as $item) {
                    if (is_array($item)) {
                        $imgobj = newImage(newAlbum($item['folder']), $item['filename']);
                    } else {
                        $imgobj = newImage($_zp_current_album, $item);
                    }
                    if ($fullimagelink) {
                        $link = $imgobj->getFullImageURL();
                    } else {
                        $link = $imgobj->getLink();
                    }
                    if (!is_null($_zp_current_image)) {
                        if ($_zp_current_album->isDynamic()) {
                            if ($_zp_current_image->filename == $imgobj->filename && $_zp_current_image->getAlbum()->name == $imgobj->getAlbum()->name) {
                                $active = ' class="activeimg" ';
                            } else {
                                $active = '';
                            }
                        } else {
                            if ($_zp_current_image->filename == $imgobj->filename) {
                                $active = ' class="activeimg" ';
                            } else {
                                $active = '';
                            }
                        }
                    } else {
                        $active = '';
                    }
                    $imageurl = $imgobj->getCustomImage(NULL, $width, $height, $cropw, $croph, NULL, NULL, true);
                    $items[] = '<li' . $active . '><a href="' . $link . '"><img src="' . html_encode($imageurl) . '" alt="' . html_encode($imgobj->getTitle()) . '"></a></li>';
                }
            }
            $albumid = $_zp_current_album->get('id');
            //$items = substr($items, 0, -2);
            $numimages = getNumImages();
            if (!is_null($_zp_current_image)) {
                $imgnumber = imageNumber() - 1;
            } else {
                $imgnumber = 0;
            }
            ?>
			<ul class="bxslider<?php 
            echo $albumid;
            ?>
">
				<?php 
            $count = '';
            foreach ($items as $item) {
                echo $item;
            }
            ?>
			</ul>
			<script type="text/javascript">
				$(document).ready(function() {
					var index = $('.bxslider<?php 
            echo $albumid;
            ?>
 li.activeimg').index();
					index = ++index;
					currentPager = parseInt(index / <?php 
            echo $maxitems;
            ?>
)
					$('.bxslider<?php 
            echo $albumid;
            ?>
').bxSlider({
						mode: '<?php 
            echo $mode;
            ?>
',
						minSlides: <?php 
            echo $minitems;
            ?>
,
						maxSlides: <?php 
            echo $maxitems;
            ?>
,
						speed: <?php 
            echo $speed;
            ?>
,
						slideWidth: <?php 
            echo $width;
            ?>
,
						slideMargin: 5,
						moveSlides: <?php 
            echo $maxitems;
            ?>
 - 1,
						pager: false,
						adaptiveHeight: true,
						useCSS: false,
						startSlide: currentPager
					});
				});
			</script>
			<?php 
        }
    }
Example #23
0
        exitZP();
    }
}
$plugin_is_filter = 5 | ADMIN_PLUGIN | THEME_PLUGIN;
$plugin_description = gettext("Adds several theme functions to enable images, album, news, or pages to be rated by users. ");
$plugin_author = "Stephen Billard (sbillard) and Malte Müller (acrylian)";
$option_interface = 'jquery_rating';
zp_register_filter('edit_album_utilities', 'jquery_rating::optionVoteStatus');
zp_register_filter('save_album_utilities_data', 'jquery_rating::optionVoteStatusSave');
zp_register_filter('admin_utilities_buttons', 'jquery_rating::rating_purgebutton');
if (getOption('rating_image_individual_control')) {
    zp_register_filter('edit_image_utilities', 'jquery_rating::optionVoteStatus');
    zp_register_filter('save_image_utilities_data', 'jquery_rating::optionVoteStatusSave');
}
// register the scripts needed
if (in_context(ZP_INDEX)) {
    zp_register_filter('theme_head', 'jquery_rating::ratingJS');
}
/**
 * Option handler class
 *
 */
class jquery_rating
{
    var $ratingstate;
    /**
     * class instantiation function
     *
     * @return jquery_rating
     */
    function __construct()
Example #24
0
 /**
  * Gets all news articles titlelink.
  *
  * NOTE: Since this function only returns titlelinks for use with the object model it does not exclude articles that are password protected via a category
  *
  *
  * @param int $articles_per_page The number of articles to get
  * @param string $published "published" for an published articles,
  * 													"unpublished" for an unpublised articles,
  * 													"published-unpublished" for published articles only from an unpublished category,
  * 													"sticky" for sticky articles (published or not!) for admin page use only,
  * 													"all" for all articles
  * @param boolean $ignorepagination Since also used for the news loop this function automatically paginates the results if the "page" GET variable is set. To avoid this behaviour if using it directly to get articles set this TRUE (default FALSE)
  * @param string $sortorder "date" (default), "title", "id, "popular", "mostrated", "toprated", "random"
  * 													This parameter is not used for date archives
  * @param bool $sortdirection TRUE for descending, FALSE for ascending. Note: This parameter is not used for date archives
  * @param bool $sticky set to true to place "sticky" articles at the front of the list.
  * @return array
  */
 function getArticles($articles_per_page = 0, $published = NULL, $ignorepagination = false, $sortorder = NULL, $sortdirection = NULL, $sticky = NULL, $category = NULL)
 {
     global $_zp_current_category, $_zp_post_date, $_zp_newsCache;
     if (empty($published)) {
         if (zp_loggedin() || $category && $category->isMyItem(ZENPAGE_NEWS_RIGHTS)) {
             $published = "all";
         } else {
             $published = "published";
         }
     }
     if ($category) {
         $sortObj = $category;
     } else {
         $sortObj = $this;
     }
     if (is_null($sticky)) {
         $sticky = $sortObj->getSortSticky();
     }
     if (is_null($sortdirection)) {
         $sortdirection = $sortObj->getSortDirection('news');
     }
     if (is_null($sortorder)) {
         $sortorder = $sortObj->getSortType('news');
     }
     $newsCacheIndex = "{$sortorder}-{$sortdirection}-{$published}-" . (bool) $sticky;
     if ($category) {
         $newsCacheIndex .= '-' . $category->getTitlelink();
     }
     if (isset($_zp_newsCache[$newsCacheIndex])) {
         $result = $_zp_newsCache[$newsCacheIndex];
     } else {
         $show = $currentcategory = false;
         if ($category) {
             if (is_object($_zp_current_category)) {
                 $currentcategory = $_zp_current_category->getTitlelink();
             }
             $showConjunction = ' AND ';
             // new code to get nested cats
             $catid = $category->getID();
             $subcats = $category->getSubCategories();
             if ($subcats) {
                 $cat = " (cat.cat_id = '" . $catid . "'";
                 foreach ($subcats as $subcat) {
                     $subcatobj = new ZenpageCategory($subcat);
                     $cat .= "OR cat.cat_id = '" . $subcatobj->getID() . "' ";
                 }
                 $cat .= ") AND cat.news_id = news.id ";
             } else {
                 $cat = " cat.cat_id = '" . $catid . "' AND cat.news_id = news.id ";
             }
         } else {
             $showConjunction = ' WHERE ';
         }
         if ($sticky) {
             $sticky = 'sticky DESC,';
         }
         if ($sortdirection) {
             $dir = " DESC";
         } else {
             $dir = " ASC";
         }
         // sortorder and sortdirection (only used for all news articles and categories naturally)
         switch ($sortorder) {
             case "date":
             default:
                 $sort1 = "date" . $dir;
                 break;
             case 'lastchange':
                 $sort1 = 'lastchange' . $dir;
                 break;
             case "id":
                 $sort1 = "id" . $dir;
                 break;
             case "title":
                 $sort1 = "title" . $dir;
                 break;
             case "popular":
                 $sort1 = 'hitcounter' . $dir;
                 break;
             case "mostrated":
                 $sort1 = 'total_votes' . $dir;
                 break;
             case "toprated":
                 $sort1 = '(total_value/total_votes) DESC, total_value';
                 break;
             case "random":
                 $sort1 = 'RAND()';
                 break;
         }
         /** get all articles * */
         switch ($published) {
             case "published":
                 $show = "{$showConjunction} `show` = 1 AND date <= '" . date('Y-m-d H:i:s') . "'";
                 $getUnpublished = false;
                 break;
             case "published-unpublished":
                 $show = "{$showConjunction} `show` = 1 AND date <= '" . date('Y-m-d H:i:s') . "'";
                 $getUnpublished = true;
                 break;
             case "unpublished":
                 $show = "{$showConjunction} `show` = 0 AND date <= '" . date('Y-m-d H:i:s') . "'";
                 $getUnpublished = true;
                 break;
             case 'sticky':
                 $show = "{$showConjunction} `sticky` <> 0";
                 $getUnpublished = true;
                 break;
             case "all":
                 $getUnpublished = true;
                 $show = false;
                 break;
         }
         $order = " ORDER BY {$sticky}";
         if (in_context(ZP_ZENPAGE_NEWS_DATE)) {
             $datesearch = '';
             switch ($published) {
                 case "published":
                     $datesearch = "date LIKE '{$_zp_post_date}%' ";
                     break;
                 case "unpublished":
                     $datesearch = "date LIKE '{$_zp_post_date}%' ";
                     break;
                 case "all":
                     $datesearch = "date LIKE '{$_zp_post_date}%' ";
                     break;
             }
             if ($datesearch) {
                 if ($show) {
                     $datesearch = ' AND ' . $datesearch;
                 } else {
                     $datesearch = ' WHERE ' . $datesearch;
                 }
             }
             $order .= " date DESC";
         } else {
             $datesearch = "";
             if ($category) {
                 $order .= ' news.';
             } else {
                 $order .= ' ';
             }
             $order .= $sort1;
         }
         if ($category) {
             $sql = "SELECT DISTINCT news.date, news.title, news.titlelink, news.sticky FROM " . prefix('news') . " as news, " . prefix('news2cat') . " as cat WHERE" . $cat . $show . $order;
         } else {
             $sql = "SELECT date, title, titlelink, sticky FROM " . prefix('news') . $show . $datesearch . " " . $order;
         }
         $resource = query($sql);
         $result = array();
         if ($resource) {
             while ($item = db_fetch_assoc($resource)) {
                 $article = new ZenpageNews($item['titlelink']);
                 if ($getUnpublished || $article->isMyItem(ZENPAGE_NEWS_RIGHTS) || $currentcategory && $article->inNewsCategory($currentcategory) || $article->categoryIsVisible()) {
                     $result[] = $item;
                 }
             }
             db_free_result($resource);
             if ($sortorder == 'title') {
                 // multi-lingual field!
                 $result = sortByMultilingual($result, 'title', $sortdirection);
                 if ($sticky) {
                     $stickyItems = array();
                     foreach ($result as $key => $element) {
                         if ($element['sticky']) {
                             array_unshift($stickyItems, $element);
                             unset($result[$key]);
                         }
                     }
                     $stickyItems = sortMultiArray($stickyItems, 'sticky', true);
                     $result = array_merge($stickyItems, $result);
                 }
             }
         }
         $_zp_newsCache[$newsCacheIndex] = $result;
     }
     if ($articles_per_page) {
         if ($ignorepagination) {
             $offset = 0;
         } else {
             $offset = self::getOffset($articles_per_page);
         }
         $result = array_slice($result, $offset, $articles_per_page);
     }
     return $result;
 }
/**
 * If the titlelink is valid this will setup for the page
 * Returns true if page is setup and valid, otherwise returns false
 *
 * @param string $titlelink The page to setup
 *
 * @return bool
 */
function checkForPage($titlelink)
{
    if (!empty($titlelink)) {
        load_zenpage_pages($titlelink);
        return in_context(ZP_ZENPAGE_PAGE);
    }
    return false;
}
Example #26
0
}
?>
			<?php 
if (function_exists('printLanguageSelector')) {
    printLanguageSelector("langselector");
}
?>
		</div>
		<div id="foot-right">
			<div id="rsslinks">
				<span><?php 
echo gettext('Subscribe: ');
?>
</span>
				<?php 
if (in_context(ZP_ALBUM)) {
    printRSSLink("Collection", "", gettext('This Album'), "  |  ", false, "rsslink");
}
printRSSLink("Gallery", "", gettext('Gallery Images'), "", false, "rsslink");
if (extensionEnabled('zenpage')) {
    printRSSLink("News", '', '  |  ', gettext('News'), '', false);
}
?>
			</div>
		</div>
	</div>
</div>

<?php 
zp_apply_filter('theme_body_close');
?>
Example #27
0
/**
 * checks password posting
 *
 * @param string $authType override of athorization type
 */
function zp_handle_password($authType = NULL, $check_auth = NULL, $check_user = NULL)
{
    global $_zp_loggedin, $_zp_login_error, $_zp_current_album, $_zp_current_zenpage_page, $_zp_gallery;
    if (empty($authType)) {
        // not supplied by caller
        $check_auth = '';
        if (isset($_GET['z']) && @$_GET['p'] == 'full-image' || isset($_GET['p']) && $_GET['p'] == '*full-image') {
            $authType = 'zp_image_auth';
            $check_auth = getOption('protected_image_password');
            $check_user = getOption('protected_image_user');
        } else {
            if (in_context(ZP_SEARCH)) {
                // search page
                $authType = 'zp_search_auth';
                $check_auth = getOption('search_password');
                $check_user = getOption('search_user');
            } else {
                if (in_context(ZP_ALBUM)) {
                    // album page
                    $authType = "zp_album_auth_" . $_zp_current_album->getID();
                    $check_auth = $_zp_current_album->getPassword();
                    $check_user = $_zp_current_album->getUser();
                    if (empty($check_auth)) {
                        $parent = $_zp_current_album->getParent();
                        while (!is_null($parent)) {
                            $check_auth = $parent->getPassword();
                            $check_user = $parent->getUser();
                            $authType = "zp_album_auth_" . $parent->getID();
                            if (!empty($check_auth)) {
                                break;
                            }
                            $parent = $parent->getParent();
                        }
                    }
                } else {
                    if (in_context(ZP_ZENPAGE_PAGE)) {
                        $authType = "zp_page_auth_" . $_zp_current_zenpage_page->getID();
                        $check_auth = $_zp_current_zenpage_page->getPassword();
                        $check_user = $_zp_current_zenpage_page->getUser();
                        if (empty($check_auth)) {
                            $pageobj = $_zp_current_zenpage_page;
                            while (empty($check_auth)) {
                                $parentID = $pageobj->getParentID();
                                if ($parentID == 0) {
                                    break;
                                }
                                $sql = 'SELECT `titlelink` FROM ' . prefix('pages') . ' WHERE `id`=' . $parentID;
                                $result = query_single_row($sql);
                                $pageobj = new ZenpagePage($result['titlelink']);
                                $authType = "zp_page_auth_" . $pageobj->getID();
                                $check_auth = $pageobj->getPassword();
                                $check_user = $pageobj->getUser();
                            }
                        }
                    }
                }
            }
        }
        if (empty($check_auth)) {
            // anything else is controlled by the gallery credentials
            $authType = 'zp_gallery_auth';
            $check_auth = $_zp_gallery->getPassword();
            $check_user = $_zp_gallery->getUser();
        }
    }
    // Handle the login form.
    if (DEBUG_LOGIN) {
        debugLog("zp_handle_password: \$authType={$authType}; \$check_auth={$check_auth}; \$check_user={$check_user}; ");
    }
    if (isset($_POST['password']) && isset($_POST['pass'])) {
        // process login form
        if (isset($_POST['user'])) {
            $post_user = sanitize($_POST['user']);
        } else {
            $post_user = '';
        }
        $post_pass = $_POST['pass'];
        // We should not sanitize the password
        foreach (Zenphoto_Authority::$hashList as $hash => $hi) {
            $auth = Zenphoto_Authority::passwordHash($post_user, $post_pass, $hi);
            $success = $auth == $check_auth && $post_user == $check_user;
            if (DEBUG_LOGIN) {
                debugLog("zp_handle_password({$success}): \$post_user={$post_user}; \$post_pass={$post_pass}; \$check_auth={$check_auth}; \$auth={$auth}; \$hash={$hash};");
            }
            if ($success) {
                break;
            }
        }
        $success = zp_apply_filter('guest_login_attempt', $success, $post_user, $post_pass, $authType);
        if ($success) {
            // Correct auth info. Set the cookie.
            if (DEBUG_LOGIN) {
                debugLog("zp_handle_password: valid credentials");
            }
            zp_setCookie($authType, $auth);
            if (isset($_POST['redirect'])) {
                $redirect_to = sanitizeRedirect($_POST['redirect'], true);
                if (!empty($redirect_to)) {
                    header("Location: " . $redirect_to);
                    exitZP();
                }
            }
        } else {
            // Clear the cookie, just in case
            if (DEBUG_LOGIN) {
                debugLog("zp_handle_password: invalid credentials");
            }
            zp_clearCookie($authType);
            $_zp_login_error = true;
        }
        return;
    }
    if (empty($check_auth)) {
        //no password on record or admin logged in
        return;
    }
    if (($saved_auth = zp_getCookie($authType)) != '') {
        if ($saved_auth == $check_auth) {
            if (DEBUG_LOGIN) {
                debugLog("zp_handle_password: valid cookie");
            }
            return;
        } else {
            // Clear the cookie
            if (DEBUG_LOGIN) {
                debugLog("zp_handle_password: invalid cookie");
            }
            zp_clearCookie($authType);
        }
    }
}
Example #28
0
 /**
  * Checks if the current page should be excluded from caching.
  * Pages that can be excluded are custom pages included Zenpage pages (these optionally more specific by titlelink)
  * and the standard theme pages image.php (optionally by image file name), album.php (optionally by album folder name)
  * or index.php
  *
  * @return bool
  *
  */
 function checkIfAllowedPage()
 {
     global $_zp_gallery_page, $_zp_current_image, $_zp_current_album, $_zp_current_zenpage_page, $_zp_current_zenpage_news, $_zp_current_admin_obj, $_zp_current_category, $_zp_authority;
     if (zp_loggedin(ADMIN_RIGHTS)) {
         // don't cache for admin
         return false;
     }
     switch ($_zp_gallery_page) {
         case "image.php":
             // does it really makes sense to exclude images and albums?
             $obj = $_zp_current_album;
             $title = $_zp_current_image->filename;
             break;
         case "album.php":
             $obj = $_zp_current_album;
             $title = $_zp_current_album->name;
             break;
         case 'pages.php':
             $obj = $_zp_current_zenpage_page;
             $title = $_zp_current_zenpage_page->getTitlelink();
             break;
         case 'news.php':
             if (in_context(ZP_ZENPAGE_NEWS_ARTICLE)) {
                 $obj = $_zp_current_zenpage_news;
                 $title = $obj->getTitlelink();
             } else {
                 if (in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
                     $obj = $_zp_current_category;
                     $title = $obj->getTitlelink();
                 } else {
                     $obj = NULL;
                     $title = NULL;
                 }
             }
             break;
         default:
             $obj = NULL;
             if (isset($_GET['title'])) {
                 $title = sanitize($_GET['title']);
             } else {
                 $title = "";
             }
             break;
     }
     if ($obj && $obj->isMyItem($obj->manage_some_rights)) {
         // user is admin to this object--don't cache!
         return false;
     }
     $accessType = checkAccess();
     if ($accessType) {
         if (is_numeric($accessType)) {
             $accessType = 'zp_user_auth';
         } else {
             if ($accessType == 'zp_public_access' && count($_zp_authority->getAuthCookies()) > 0) {
                 $accessType .= '1';
                 // logged in some sense
             }
         }
     } else {
         return false;
         // visitor is going to get a password request--don't cache or that won't happen
     }
     $excludeList = array_merge(explode(",", getOption('static_cache_excludedpages')), array('404.php/', 'password.php/'));
     foreach ($excludeList as $item) {
         $page_to_exclude = explode("/", $item);
         if ($_zp_gallery_page == trim($page_to_exclude[0])) {
             $exclude = trim($page_to_exclude[1]);
             if (empty($exclude) || $title == $exclude) {
                 return false;
             }
         }
     }
     return $accessType;
 }
/**
 * Checks for URL page out-of-bounds for "standard" themes
 * Note: This function assumes that an "index" page will display albums
 * and the pagination be determined by them. Any other "index" page strategy needs to be
 * handled by the theme itself.
 *
 * @param boolean $request
 * @param string $gallery_page
 * @param int $page
 * @return boolean will be true if all is well, false if a 404 error should occur
 */
function checkPageValidity($request, $gallery_page, $page)
{
    global $_zp_gallery, $_firstPageImages, $_oneImagePage, $_zp_zenpage, $_zp_current_category;
    $count = NULL;
    switch ($gallery_page) {
        case 'album.php':
        case 'search.php':
            $albums_per_page = max(1, getOption('albums_per_page'));
            $pageCount = (int) ceil(getNumAlbums() / $albums_per_page);
            $imageCount = getNumImages();
            if ($_oneImagePage) {
                if ($_oneImagePage === true) {
                    $imageCount = min(1, $imageCount);
                } else {
                    $imageCount = 0;
                }
            }
            $images_per_page = max(1, getOption('images_per_page'));
            $count = $pageCount + (int) ceil(($imageCount - $_firstPageImages) / $images_per_page);
            break;
        case 'index.php':
            if (galleryAlbumsPerPage() != 0) {
                $count = (int) ceil($_zp_gallery->getNumAlbums() / galleryAlbumsPerPage());
            }
            break;
        case 'news.php':
            if (in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
                $count = count($_zp_current_category->getArticles());
            } else {
                $count = count($_zp_zenpage->getArticles());
            }
            $count = (int) ceil($count / ZP_ARTICLES_PER_PAGE);
            break;
        default:
            $count = zp_apply_filter('checkPageValidity', NULL, $gallery_page, $page);
            break;
    }
    if ($page > $count) {
        $request = false;
        //	page is out of range
    }
    return $request;
}
Example #30
0
/**
 * Returns true if the image is a standard photo type
 *
 * @param object $image optional image object
 * @return bool
 */
function isImagePhoto($image = NULL)
{
    if (is_null($image)) {
        if (!in_context(ZP_IMAGE)) {
            return false;
        }
        global $_zp_current_image;
        $image = $_zp_current_image;
    }
    $class = strtolower(get_class($image));
    return $class == '_image' || $class == 'transientimage';
}