function getAlbumLink($album = NULL, $page = 1)
 {
     if (!isset($album)) {
         $album = $this->album;
     }
     $link = rewrite_path("/" . pathurlencode($this->album->name) . "/page/" . $page, "/index.php?album=" . urlencode($this->album->name) . "&page=" . $page);
     return $link;
 }
Beispiel #2
0
function m9PrintBreadcrumb()
{
    global $_zp_current_album, $_zp_last_album;
    $parents = getParentAlbums();
    $n = count($parents);
    if ($n > 0) {
        foreach ($parents as $parent) {
            $url = rewrite_path("/" . pathurlencode($parent->name) . "/", "/index.php?album=" . urlencode($parent->name));
            echo '<li><a href="' . htmlspecialchars($url) . '">' . html_encode($parent->getTitle()) . '</a></li>';
        }
    }
}
    static function printAlbumMenuJump($option = "", $indexname = "Gallery Index")
    {
        if ($indexname == "Gallery Index") {
            $indexname = gettext($indexname);
        }
        global $_zp_gallery, $_zp_current_album, $_zp_gallery_page;
        $albumpath = rewrite_path("/", "/index.php?album=");
        if (!empty($_zp_current_album) || $_zp_gallery_page != 'album.php') {
            $currentfolder = $_zp_current_album->name;
        }
        ?>
			<script type="text/javaScript">
				function gotoLink(form) {
				 	var OptionIndex=form.ListBoxURL.selectedIndex;
					parent.location = form.ListBoxURL.options[OptionIndex].value;
				}
			</script>
			<form name="AutoListBox" action="#">
				<p>
					<select name="ListBoxURL" size="1" onchange="gotoLink(this.form);">
					<?php 
        if (!empty($indexname)) {
            $selected = self::checkSelectedAlbum("", "index");
            ?>
					<option <?php 
            echo $selected;
            ?>
 value="<?php 
            echo htmlspecialchars(getGalleryIndexURL());
            ?>
"><?php 
            echo $indexname;
            ?>
</option>
					<?php 
        }
        $albums = $_zp_gallery->getAlbums();
        self::printAlbumMenuJumpAlbum($albums, $option, $albumpath);
        ?>
					</select>
				</p>
			</form>
			<?php 
    }
Beispiel #4
0
 /**
  * Returns partial path of news article title
  *
  * @return string
  * @deprecated since version 1.4.6
  */
 function getNewsTitlePath($title)
 {
     Zenpage_internal_deprecations::getNewsTitlePath();
     return rewrite_path(_NEWS_ . "/{$title}", "/index.php?p=news&title={$title}");
     //deprecated
 }
/**
 * Prints a nested html list of all albums context sensitive.
 *
 * Usage: add the following to the php page where you wish to use these menus:
 * enable this extension on the zenphoto admin plugins tab;
 * Call the function printAlbumMenuList() at the point where you want the menu to appear.
 *
 * @param string $option
 * 									"list" for html list,
 * 									"list-top" for only the top level albums,
 * 									"omit-top" same as list, but the first level of albums is omitted
 * 									"list-sub" lists the offspring level of subalbums for the current album
 * @param bool $showcount true for a image counter in brackets behind the album name, false for no image numbers or leave empty
 * @param string $css_id insert css id for the main album list, leave empty if you don't use (only list mode)
 * @param string $css_id_active insert css class for the active link in the main album list (only list mode)
 * @param string $css_class insert css class for the sub album lists (only list mode)
 * @param string $css_class_active insert css class for the active link in the sub album lists (only list mode)
 * @param string $indexname insert the name (default "Gallery Index") how you want to call the link to the gallery index, insert "" if you don't use it, it is not printed then.
 * @param int $showsubs Set to depth of sublevels that should be shown always. 0 by default. To show all, set to a true! Only valid if option=="list".
 * @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 bool $startlist set to true to output the UL tab (false automatically if you use 'omit-top' or 'list-sub')
 * @param int $limit truncation of display text
 * @return html list of the albums
 */
function printAlbumMenuList($option, $showcount = NULL, $css_id = '', $css_class_topactive = '', $css_class = '', $css_class_active = '', $indexname = "Gallery Index", $showsubs = NULL, $firstimagelink = false, $keeptopactive = false, $startlist = true, $limit = NULL)
{
    global $_zp_gallery, $_zp_current_album, $_zp_gallery_page;
    // if in search mode don't use the foldout contextsensitiveness and show only toplevel albums
    if (in_context(ZP_SEARCH_LINKED)) {
        $option = "list-top";
    }
    $albumpath = rewrite_path("/", "/index.php?album=");
    if (empty($_zp_current_album) || $_zp_gallery_page != 'album.php' && $_zp_gallery_page != 'image.php') {
        $currentfolder = "";
    } else {
        $currentfolder = $_zp_current_album->name;
    }
    // check if css parameters are used
    if ($css_id != "") {
        $css_id = " id='" . $css_id . "'";
    }
    if ($css_class_topactive != "") {
        $css_class_topactive = " class='" . $css_class_topactive . "'";
    }
    if ($css_class != "") {
        $css_class = " class='" . $css_class . "'";
    }
    if ($css_class_active != "") {
        $css_class_active = " class='" . $css_class_active . "'";
    }
    $startlist = $startlist && !($option == 'omit-top' || $option == 'list-sub');
    if ($startlist) {
        echo "<ul" . $css_id . ">\n";
    }
    // top level list
    /*		 * ** Top level start with Index link  *** */
    if ($option === "list" or $option === "list-top") {
        if (!empty($indexname)) {
            echo "<li><a href='" . html_encode(getGalleryIndexURL()) . "' title='" . html_encode($indexname) . "'>" . $indexname . "</a></li>";
        }
    }
    if ($option == 'list-sub' && in_context(ZP_ALBUM)) {
        $albums = $_zp_current_album->getAlbums();
    } else {
        $albums = $_zp_gallery->getAlbums();
    }
    printAlbumMenuListAlbum($albums, $currentfolder, $option, $showcount, $showsubs, $css_class, $css_class_topactive, $css_class_active, $firstimagelink, $keeptopactive, $limit);
    if ($startlist) {
        echo "</ul>\n";
    }
}
Beispiel #6
0
    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();
								var TitleList = new Array();
								var DescList = new Array();
								var ImageNameList = new Array();
								var DynTime=(<?php 
                echo getOption("slideshow_timeout");
                ?>
) * 1.0;	// force numeric
								<?php 
                for ($imgnr = 0, $cntr = 0, $idx = $imagenumber; $imgnr < $numberofimages; $imgnr++, $idx++) {
                    if ($dynamic) {
                        $filename = $images[$idx]['filename'];
                        $album = new Album($gallery, $images[$idx]['folder']);
                        $image = newImage($album, $filename);
                    } else {
                        $filename = $images[$idx];
                        $image = newImage($album, $filename);
                    }
                    $ext = is_valid($filename, $validtypes);
                    if ($ext) {
                        makeImageCurrent($image);
                        $img = getCustomSizedImageMaxSpace($width, $height);
                        //$img = WEBPATH . '/' . ZENFOLDER . '/i.php?a=' . pathurlencode($image->album->name) . '&i=' . urlencode($filename) . '&s=' . $imagesize;
                        echo 'ImageList[' . $cntr . '] = "' . $img . '";' . "\n";
                        echo 'TitleList[' . $cntr . '] = "' . js_encode($image->getTitle()) . '";' . "\n";
                        if (getOption("slideshow_showdesc")) {
                            $desc = $image->getDesc();
                            $desc = str_replace("\r\n", '<br />', $desc);
                            $desc = str_replace("\r", '<br />', $desc);
                            echo 'DescList[' . $cntr . '] = "' . js_encode($desc) . '";' . "\n";
                        } else {
                            echo 'DescList[' . $cntr . '] = "";' . "\n";
                        }
                        if ($idx == $numberofimages - 1) {
                            $idx = -1;
                        }
                        echo 'ImageNameList[' . $cntr . '] = "' . urlencode($filename) . '";' . "\n";
                        $cntr++;
                    }
                }
                echo "\n";
                $numberofimages = $cntr;
                ?>
								var countOffset = <?php 
                echo $imagenumber;
                ?>
;
								var totalSlideCount = <?php 
                echo $numberofimages;
                ?>
;
								var currentslide = 2;
			
								function onBefore(curr, next, opts) {
									//$(next).parent().animate({opacity: 0});

									if (opts.timeout != DynTime) {
										opts.timeout = DynTime;
									}
									if (!opts.addSlide)
										return;
							
									var currentImageNum = currentslide;
									currentslide++;
									if (currentImageNum == totalSlideCount) {
										opts.addSlide = null;
										return;
									}
									var relativeSlot = (currentslide + countOffset) % totalSlideCount;
									if (relativeSlot == 0) {relativeSlot = totalSlideCount;}
									var htmlblock = "<span class='slideimage'><h4><strong>" + ThisGallery + ":</strong> ";
									htmlblock += TitleList[currentImageNum]  + " (" + relativeSlot + "/" + totalSlideCount + ")</h4>";
									htmlblock += "<img src='" + ImageList[currentImageNum] + "'/>";
									htmlblock += "<p class='imgdesc'>" + DescList[currentImageNum] + "</p></span>";
									opts.addSlide(htmlblock);

								}
			
								function onAfter(curr, next, opts){
									<?php 
                if (!isMyALbum($album->name, ALL_RIGHTS)) {
                    ?>
									//Only register at hit count the first time the image is viewed.
									if ($(next).attr( 'viewed') != 1) {
										$.get("<?php 
                    echo FULLWEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
                    ?>
/slideshow/slideshow-counter.php?album=<?php 
                    echo pathurlencode($album->name);
                    ?>
&img="+ImageNameList[opts.currSlide]);
										$(next).attr( 'viewed', 1 );
									}
									<?php 
                }
                ?>

									//THE MISSING LINE
									$(next).parent().height(
										$(next).find('img').height() + $(next).find('p').height() + $(next).find('h4').height() + 40
									); //.animate({opacity: 1}, 'normal', 'linear');
									//getOption('slideshow_onafter'); //make it generic
									//END MISSING LINE
								}
			
								$('#slides').cycle({
										fx:     '<?php 
                echo getOption("slideshow_effect");
                ?>
',
										speed:   <?php 
                echo getOption("slideshow_speed");
                ?>
,
										timeout: DynTime,
										next:   '#next',
										prev:   '#prev',
										cleartype: 1,
										before: onBefore,
										after: onAfter
								});
			
								$('#speed').change(function () {
									DynTime = this.value;
									return false;
								});
			
								$('#pause').click(function() { $('#slides').cycle('pause'); return false; });
								$('#play').click(function() { $('#slides').cycle('resume'); return false; });
							});
			
						});	// Documentready()
			
						</script>
						<div id="slideshow" align="center">
						<?php 
                // 7/21/08dp
                if ($speedctl) {
                    echo '<div id="speedcontrol">';
                    // just to keep it away from controls for sake of this demo
                    $minto = getOption("slideshow_speed");
                    while ($minto % 500 != 0) {
                        $minto += 100;
                        if ($minto > 10000) {
                            break;
                        }
                        // emergency bailout!
                    }
                    $dflttimeout = getOption("slideshow_timeout");
                    /* don't let min timeout = speed */
                    $thistimeout = $minto == getOption("slideshow_speed") ? $minto + 250 : $minto;
                    echo 'Select Speed: <select id="speed" name="speed">';
                    while ($thistimeout <= 60000) {
                        // "around" 1 minute :)
                        echo "<option value={$thistimeout} " . ($thistimeout == $dflttimeout ? " selected='selected'>" : ">") . round($thistimeout / 1000, 1) . " sec</option>";
                        /* put back timeout to even increments of .5 */
                        if ($thistimeout % 500 != 0) {
                            $thistimeout -= 250;
                        }
                        $thistimeout += $thistimeout < 1000 ? 500 : ($thistimeout < 10000 ? 1000 : 5000);
                    }
                    echo "</select> </div>";
                }
                if (!is_object($albumobj)) {
                    // disable controls if calling the slideshow directly on homepage for example
                    ?>
						<div id="controls">
						<div><span><a href="#" id="prev"
							title="<?php 
                    echo gettext("Previous");
                    ?>
"></a></span> <a
							href="<?php 
                    echo $returnpath;
                    ?>
" id="stop"
							title="<?php 
                    echo gettext("Stop and return to album or image page");
                    ?>
"></a>
						<a href="#" id="pause"
							title="<?php 
                    echo gettext("Pause (to stop the slideshow without returning)");
                    ?>
"></a>
						<a href="#" id="play" title="<?php 
                    echo gettext("Play");
                    ?>
"></a> <a
							href="#" id="next" title="<?php 
                    echo gettext("Next");
                    ?>
"></a>
						</div>
						</div>
						<?php 
                }
                ?>
						<div id="slides" class="pics">
						<?php 
                if ($cntr > 1) {
                    $cntr = 1;
                }
                for ($imgnr = 0, $idx = $imagenumber; $imgnr <= $cntr; $idx++) {
                    if ($idx >= $numberofimages) {
                        $idx = 0;
                    }
                    if ($dynamic) {
                        $folder = $images[$idx]['folder'];
                        $dalbum = new Album($gallery, $folder);
                        $filename = $images[$idx]['filename'];
                        $image = newImage($dalbum, $filename);
                        $imagepath = FULLWEBPATH . getAlbumFolder('') . pathurlencode($folder) . "/" . urlencode($filename);
                    } else {
                        $folder = $album->name;
                        $filename = $images[$idx];
                        //$filename = $animage;
                        $image = newImage($album, $filename);
                        $imagepath = FULLWEBPATH . getAlbumFolder('') . pathurlencode($folder) . "/" . urlencode($filename);
                    }
                    $ext = is_valid($filename, $validtypes);
                    if ($ext) {
                        $imgnr++;
                        echo "<span class='slideimage'><h4><strong>" . $albumtitle . gettext(":") . "</strong> " . $image->getTitle() . " (" . ($idx + 1) . "/" . $numberofimages . ")</h4>";
                        if ($ext == "3gp") {
                            echo '</a>
												<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="352" height="304" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
												<param name="src" value="' . $imagepath . '"/>
												<param name="autoplay" value="false" />
												<param name="type" value="video/quicktime" />
												<param name="controller" value="true" />
												<embed src="' . $imagepath . '" width="352" height="304" autoplay="false" controller"true" type="video/quicktime"
												pluginspage="http://www.apple.com/quicktime/download/" cache="true"></embed>
												</object>
												<a>';
                        } elseif ($ext == "mov") {
                            echo '</a>
									 			<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="640" height="496" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
										 		<param name="src" value="' . $imagepath . '"/>
										 		<param name="autoplay" value="false" />
										 		<param name="type" value="video/quicktime" />
										 		<param name="controller" value="true" />
										 		<embed src="' . $imagepath . '" width="640" height="496" autoplay="false" controller"true" type="video/quicktime"
										 		pluginspage="http://www.apple.com/quicktime/download/" cache="true"></embed>
												</object>
												<a>';
                        } else {
                            makeImageCurrent($image);
                            printCustomSizedImageMaxSpace($alt = '', $width, $height, NULL, NULL, false);
                            //echo "<img src='".WEBPATH."/".ZENFOLDER."/i.php?a=".urlencode($folder)."&i=".urlencode($filename)."&s=".$imagesize."' alt='".html_encode($image->getTitle())."' title='".html_encode($image->getTitle())."' />\n";
                        }
                        if (getOption("slideshow_showdesc")) {
                            $desc = $image->getDesc();
                            $desc = str_replace("\r\n", '<br />', $desc);
                            $desc = str_replace("\r", '<br />', $desc);
                            echo "<p class='imgdesc'>" . $desc . "</p>";
                        }
                        echo "</span>";
                    }
                }
                break;
            case "flash":
                if ($heading) {
                    echo "<span class='slideimage'><h4><strong>" . $albumtitle . "</strong> (" . $numberofimages . " images) | <a style='color: white' href='" . $returnpath . "' title='" . gettext("back") . "'>" . gettext("back") . "</a></h4>";
                }
                echo "<span id='slideshow'></span>";
                ?>
 
					<script type="text/javascript">
					$("#slideshow").flashembed({
						  src:'<?php 
                echo FULLWEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
                ?>
/flowplayer/FlowPlayerLight.swf',
						  width:<?php 
                echo getOption("slideshow_flow_player_width");
                ?>
,
						  height:<?php 
                echo getOption("slideshow_flow_player_height");
                ?>
						},
						{config: {
						  autoPlay: true,
						  useNativeFullScreen: true,
						  playList: [
													<?php 
                echo "\n";
                $count = 0;
                foreach ($images as $animage) {
                    if ($dynamic) {
                        $folder = $animage['folder'];
                        $filename = $animage['filename'];
                        $salbum = new Album($_zp_gallery, $folder);
                        $image = newImage($salbum, $filename);
                        $imagepath = FULLWEBPATH . getAlbumFolder('') . pathurlencode($salbum->name) . "/" . urlencode($filename);
                    } else {
                        $folder = $album->name;
                        $filename = $animage;
                        $image = newImage($album, $filename);
                        $imagepath = FULLWEBPATH . getAlbumFolder('') . pathurlencode($folder) . "/" . pathurlencode($filename);
                    }
                    $ext = is_valid($filename, array('jpg', 'jpeg', 'gif', 'png', 'flv', 'mp3', 'mp4'));
                    if ($ext) {
                        if ($ext == "flv" || $ext == "mp3" || $ext == "mp4") {
                            $duration = "";
                        } else {
                            $duration = ", duration: " . getOption("slideshow_speed") / 10;
                        }
                        if ($count > 0) {
                            echo ",\n";
                        }
                        echo "{ url: '" . FULLWEBPATH . getAlbumFolder('') . pathurlencode($folder) . "/" . urlencode($filename) . "'" . $duration . " }";
                        $count++;
                    }
                }
                echo "\n";
                ?>
												],
						  showPlayListButtons: true,
						  showStopButton: true,
						  controlBarBackgroundColor: 0,
						 	showPlayListButtons: true,
						 	controlsOverVideo: 'ease',
						 	controlBarBackgroundColor: '<?php 
                echo getOption('flow_player_controlbarbackgroundcolor');
                ?>
',
						  controlsAreaBorderColor: '<?php 
                echo getOption('flow_player_controlsareabordercolor');
                ?>
'
						}}
				  );
					</script> 
					<?php 
                echo "</span>";
                echo "<p>";
                printf(gettext("Click on %s on the right in the player control bar to view full size."), "<img style='position: relative; top: 4px; border: 1px solid gray' src='" . WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . "/slideshow/flowplayerfullsizeicon.png' />");
                echo "</p>";
                break;
        }
        ?>
			</div>
		</div>
			<?php 
    }
Beispiel #7
0
    }
    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;
        ?>
" title="<?php 
        echo $_zp_current_album->getTitle();
        ?>
"><?php 
        echo $_zp_current_album->getTitle();
        ?>
</a>&nbsp;/&nbsp;
							<?php 
    }
    ?>
							<span>(<em><?php 
Beispiel #8
0
/**
 * Prints an image or album statistic slideshow using the {@link http://galleria.io/  jQuery plugin Galleria}
 *
 * See readme/documentation for usage:
 * Call directly in a template file or codeblock.
 *
 * NOTE: movie and audio files not supported.
 *
 * @param string $type return statistics of either 'images' or 'albums'
 * @param integer $number the number of items to get (images or albums, depending on $type set)
 * @param string $option
 *  	"popular" for the most popular
 *		"latest" for the latest uploaded by id (Discovery)
 * 		"latest-date" for the latest by date
 * 		"latest-mtime" for the latest by mtime
 *   	"latest-publishdate" for the latest by publishdate
 *      "mostrated" for the most voted
 *		"toprated" for the best voted
 *		"latestupdated" for the latest updated
 *		"random" for random order (yes, strictly no statistical order...)
 * @param string $albumfolder foldername of a specific album to pull items from
 * @param bool $collection only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums
 * @param bool $linkslides true to link to image or album on slide, else click advances slideshow instead
 * @param mixed $autoplay true to autoplay slideshow with interval set in options, false to start with slideshow stopped.  Set integer in milliseconds to autoplay at that interval (Ex. 4000), overriding plugin option set.
 * @param integer $threshold the minimum number of ratings an image must have to be included in the list. (Default 0)
 *
 */
function printGslideshowStatistic($type, $number, $option, $albumfolder = '', $collection = false, $linkslides = true, $autoplay = true, $threshold = 0)
{
    save_context();
    $data = 'data';
    $embedded = true;
    $forceheight = true;
    $imagenumber = 0;
    $albumtitle = '';
    $returnpath = '';
    require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/image_album_statistics.php';
    if ($type == 'album' || $type == 'albums') {
        $albums = getAlbumStatistic($number, $option, $albumfolder);
    } else {
        $images = getImageStatistic($number, $option, $albumfolder, $collection, $threshold);
    }
    ?>

			<script>
				var data = [

	<?php 
    if ($type == 'album' || $type == 'albums') {
        $c = 1;
        foreach ($albums as $album) {
            $tempalbum = newAlbum($album['folder']);
            $albumpath = html_encode(rewrite_path("/" . pathurlencode($tempalbum->name), "index.php?album=" . pathurlencode($tempalbum->name)));
            $albumthumb = $tempalbum->getAlbumThumbImage();
            $image = newImage($tempalbum, $albumthumb->filename);
            $ext = isImagePhoto($image);
            if ($ext) {
                makeImageCurrent($image);
                echo '{' . "\n";
                echo 'thumb: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_thumbsize'), getOption('gslideshow_thumbsize')) . '\',' . "\n";
                echo 'image: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_mediumsize'), getOption('gslideshow_mediumsize')) . '\',' . "\n";
                echo 'big: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_bigsize'), getOption('gslideshow_bigsize')) . '\',' . "\n";
                echo 'title: \'' . html_encode($tempalbum->getTitle()) . '\',' . "\n";
                $desc = $tempalbum->getDesc();
                $desc = str_replace("\r\n", '<br />', $desc);
                $desc = str_replace("\r", '<br />', $desc);
                echo 'description: \'' . js_encode($desc) . '\',' . "\n";
                echo 'link: \'' . $albumpath . '\'' . "\n";
                if ($c == $number) {
                    echo '}' . "\n";
                } else {
                    echo '},' . "\n";
                }
            }
            $c++;
        }
        echo "\n";
    } else {
        $c = 1;
        foreach ($images as $image) {
            $ext = isImagePhoto($image);
            if ($ext) {
                makeImageCurrent($image);
                echo '{' . "\n";
                echo 'thumb: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_thumbsize'), getOption('gslideshow_thumbsize')) . '\',' . "\n";
                echo 'image: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_mediumsize'), getOption('gslideshow_mediumsize')) . '\',' . "\n";
                echo 'big: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_bigsize'), getOption('gslideshow_bigsize')) . '\',' . "\n";
                echo 'title: \'' . html_encode($image->getTitle()) . '\',' . "\n";
                $desc = $image->getDesc();
                $desc = str_replace("\r\n", '<br />', $desc);
                $desc = str_replace("\r", '<br />', $desc);
                echo 'description: \'' . js_encode($desc) . '\',' . "\n";
                echo 'link: \'' . html_encode($image->getLink()) . '\'' . "\n";
                if ($c == $number) {
                    echo '}' . "\n";
                } else {
                    echo '},' . "\n";
                }
            }
            $c++;
        }
        echo "\n";
    }
    ?>
				];
			</script>
			<?php 
    printGalleriaRun($data, $linkslides, $autoplay, $embedded, $forceheight, $imagenumber, $albumtitle, $returnpath);
    restore_context();
    // needed if the slideshow is for example called directly via album object before the next_album loop on index.php
}
Beispiel #9
0
function getPagesLink()
{
    return zp_apply_filter('getLink', rewrite_path(_PAGES_ . '/', "/index.php?p=pages"), 'pages.php', NULL);
}
			});
			break;
		case 'zenpagenewsindex':
			$('#albumselector,#pageselector,#categoryselector,#custompageselector,#link_row').hide();
			$('#selector').html('<?php 
echo js_encode(gettext("Zenpage news index"));
?>
');
			$('#description').html('<?php 
echo js_encode(gettext("Creates a link to the Zenpage News Index."));
?>
');
			$('#link').attr('disabled',true);
			$('#titleinput').show();
			$('#link').val('<?php 
echo rewrite_path('news', '?p=news');
?>
');
			break;
		case 'all_zenpagecategorys':
			$('#albumselector,#pageselector,#categoryselector,#custompageselector,#titleinput,#titlelabel,#link_row,#visible_row,#span_row').hide();
			$('#selector').html('<?php 
echo js_encode(gettext("All Zenpage categories"));
?>
');
			$('#description').html('<?php 
echo js_encode(gettext("This adds menu items for all Zenpage categories."));
?>
');
			break;
		case 'zenpagecategory':
/**
 * Returns path to the pages.php page
 *
 * @return string
 */
function getPageLinkPath()
{
    return rewrite_path("pages/", "/index.php?p=pages&title=");
}
/**
 * Prints a dropdown menu of all albums up to the 4 sublevel (not context sensitive)
 * Is used by the wrapper function printAlbumMenu() if the options "jump" is choosen. For standalone use, too.
 *
 * Usage: add the following to the php page where you wish to use these menus:
 * enable this extension on the zenphoto admin plugins tab;
 * Call the function printAlbumMenuJump() at the point where you want the menu to appear.
 *
 * @param string $option "count" for a image counter in brackets behind the album name, "" = for no image numbers
 * @param string $indexname insert the name (default "Gallery Index") how you want to call the link to the gallery index, insert "" if you don't use it, it is not printed then.
 */
function printAlbumMenuJump($option = "count", $indexname = "Gallery Index")
{
    global $_zp_gallery, $_zp_current_album;
    $albumpath = rewrite_path("/", "/index.php?album=");
    if (!empty($_zp_current_album)) {
        $currentfolder = $_zp_current_album->name;
    }
    ?>
<form name="AutoListBox" action="#">
<p><select name="ListBoxURL" size="1"
		onchange="gotoLink(this.form);">
		<?php 
    if (!empty($indexname)) {
        $selected = checkSelectedAlbum("", "index");
        ?>
		<option <?php 
        echo $selected;
        ?>
 value="<?php 
        echo htmlspecialchars(getGalleryIndexURL());
        ?>
"><?php 
        echo $indexname;
        ?>
</option>
		<?php 
    }
    /**** TOPALBUM LEVEL ****/
    $gallery = $_zp_gallery;
    $albums = $_zp_gallery->getAlbums();
    foreach ($albums as $toplevelalbum) {
        $topalbum = new Album($gallery, $toplevelalbum, true);
        createAlbumMenuLink($topalbum, $option, "", $albumpath, "jump", 0);
        /**** SUBALBUM LEVEL 1 ****/
        $subalbums1 = $topalbum->getSubAlbums();
        foreach ($subalbums1 as $sublevelalbum1) {
            $subalbum1 = new Album($gallery, $sublevelalbum1, true);
            createAlbumMenuLink($subalbum1, $option, "", $albumpath, "jump", 1);
            /**** SUBALBUM LEVEL 2 ****/
            $subalbums2 = $subalbum1->getSubAlbums();
            foreach ($subalbums2 as $sublevelalbum2) {
                $subalbum2 = new Album($gallery, $sublevelalbum2, true);
                createAlbumMenuLink($subalbum2, $option, "", $albumpath, "jump", 2);
                /**** SUBALBUM LEVEL 3 ****/
                $subalbums3 = $subalbum2->getSubAlbums();
                foreach ($subalbums3 as $sublevelalbum3) {
                    $subalbum3 = new Album($gallery, $sublevelalbum3, true);
                    createAlbumMenuLink($subalbum3, $option, "", $albumpath, "jump", 3);
                    /**** SUBALBUM LEVEL 4 ****/
                    $subalbums4 = $subalbum3->getSubAlbums();
                    foreach ($subalbums4 as $sublevelalbum4) {
                        $subalbum4 = new Album($gallery, $sublevelalbum4, true);
                        createAlbumMenuLink($subalbum4, $option, "", $albumpath, "jump", 4);
                    }
                }
            }
        }
    }
    ?>
</select></p>
<script type="text/javaScript">
<!--
function gotoLink(form) {
 	var OptionIndex=form.ListBoxURL.selectedIndex;
	parent.location = form.ListBoxURL.options[OptionIndex].value;}
//-->
</script></form>
<?php 
}
Beispiel #13
0
 function getLink($page = NULL, $instance = NULL)
 {
     $link = _FAVORITES_ . '/';
     $link_no = 'index.php?p=favorites';
     if (is_null($instance)) {
         $instance = $this->instance;
     }
     if ($instance) {
         $instance = rtrim($instance, '/');
         $link .= $instance . '/';
         $link_no .= '&instance=' . $instance;
     }
     if ($page > 1) {
         $link .= $page . '/';
         $link_no .= '&page=' . $page;
     }
     return zp_apply_filter('getLink', rewrite_path($link, $link_no), 'favorites.php', $page);
 }
Beispiel #14
0
/**
 * Returns the full path of the news archive page
 *
 * @param string $date the date of the archive page
 * @return string
 */
function getNewsArchiveURL($date)
{
    return zp_apply_filter('getLink', rewrite_path(_NEWS_ARCHIVE_ . '/' . $date . '/', "/index.php?p=news&date={$date}"), 'news.php', NULL);
}
Beispiel #15
0
 /**
  * Returns an URL to the album, including the current page number
  *
  * @return string
  */
 function getAlbumLink()
 {
     global $_zp_page;
     $rewrite = pathurlencode($this->name) . '/';
     $plain = '/index.php?album=' . pathurlencode($this->name) . '/';
     if ($_zp_page > 1) {
         $rewrite .= "page/{$_zp_page}";
         $plain .= "&page={$_zp_page}";
     }
     return rewrite_path($rewrite, $plain);
 }
Beispiel #16
0
 static function getNewsIndexUrl()
 {
     return rewrite_path(urlencode(ZENPAGE_NEWS), "/index.php?p=" . ZENPAGE_NEWS);
 }
Beispiel #17
0
                $imagedata = query_full_array("SELECT `title`, `filename`, `albumid` FROM " . prefix('images') . " WHERE `id`=" . $comment['ownerid']);
                if ($imagedata) {
                    $imgdata = $imagedata[0];
                    $image = $imgdata['filename'];
                    if ($imgdata['title'] == "") {
                        $title = $image;
                    } else {
                        $title = get_language_string($imgdata['title']);
                    }
                    $title = '/ ' . $title;
                    $albmdata = query_full_array("SELECT `folder`, `title` FROM " . prefix('albums') . " WHERE `id`=" . $imgdata['albumid']);
                    if ($albmdata) {
                        $albumdata = $albmdata[0];
                        $album = $albumdata['folder'];
                        $albumtitle = get_language_string($albumdata['title']);
                        $link = "<a href=\"" . rewrite_path("/{$album}/{$image}", "/index.php?album=" . urlencode($album) . "&amp;image=" . urlencode($image)) . "\">" . $albumtitle . $title . "</a>";
                        if (empty($albumtitle)) {
                            $albumtitle = $album;
                        }
                    }
                }
                break;
        }
        $comment = truncate_string($comment['comment'], 123);
        echo "<li><div class=\"commentmeta\">" . sprintf(gettext('<em>%1$s</em> commented on %2$s:'), $author, $link) . "</div><div class=\"commentbody\">{$comment}</div></li>";
    }
    ?>
</ul>
</div>

 /**
  * Returns the full path to a news category
  *
  * @param string $page The category page number
  *
  * @return string
  */
 function getLink($page = NULL)
 {
     global $_zp_zenpage;
     if ($page > 1) {
         $pager = $page . '/';
         $page = '&p=' . $page;
     } else {
         $pager = $page = '';
     }
     return zp_apply_filter('getLink', rewrite_path(_CATEGORY_ . '/' . $this->getTitlelink() . '/' . $pager, "/index.php?p=news&category=" . $this->getTitlelink() . $page), $this, NULL);
 }
/**
 * Gets links to Zenpage news categories incl. pagination
 *
 * @return string
 */
function getSitemapZenpageNewsCategories()
{
    global $_zp_zenpage, $sitemap_number;
    //TODO not splitted into several sitemaps yet
    if ($sitemap_number == 1) {
        $data = '';
        $sitemap_locales = generateLanguageList();
        $changefreq = getOption('sitemap_changefreq_newscats');
        $newscats = $_zp_zenpage->getAllCategories();
        if ($newscats) {
            $data .= sitemap_echonl('<?xml version="1.0" encoding="UTF-8"?>');
            $data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
            foreach ($newscats as $newscat) {
                $catobj = new ZenpageCategory($newscat['titlelink']);
                if (!$catobj->isProtected()) {
                    switch (SITEMAP_LOCALE_TYPE) {
                        case 1:
                            foreach ($sitemap_locales as $locale) {
                                $url = seo_locale::localePath(true, $locale) . '/' . _CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/1';
                                $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                            }
                            break;
                        case 2:
                            foreach ($sitemap_locales as $locale) {
                                $url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/1', '?p=news&amp;category=' . urlencode($catobj->getTitlelink()) . '&amp;page=1', dynamic_locale::fullHostPath($locale));
                                $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                            }
                            break;
                        default:
                            $url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/1', '?p=news&amp;category=' . urlencode($catobj->getTitlelink()) . '&amp;page=1', FULLWEBPATH);
                            $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                            break;
                    }
                    // getting pages for the categories
                    /*
                    					  if(!empty($articlesperpage)) {
                    					  $zenpage_articles_per_page = sanitize_numeric($articlesperpage);
                    					  } else {
                    					  $zenpage_articles_per_page = ZP_ARTICLES_PER_PAGE;
                    					  } */
                    $zenpage_articles_per_page = ZP_ARTICLES_PER_PAGE;
                    $articlecount = count($catobj->getArticles());
                    $catpages = ceil($articlecount / $zenpage_articles_per_page);
                    if ($catpages > 1) {
                        for ($x = 2; $x <= $catpages; $x++) {
                            switch (SITEMAP_LOCALE_TYPE) {
                                case 1:
                                    foreach ($sitemap_locales as $locale) {
                                        $url = seo_locale::localePath(true, $locale) . '/' . _CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/' . $x;
                                        $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                                    }
                                    break;
                                case 2:
                                    foreach ($sitemap_locales as $locale) {
                                        $url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/' . $x, '?p=news&amp;category=' . urlencode($catobj->getTitlelink()) . '&amp;page=' . $x, dynamic_locale::fullHostPath($locale));
                                        $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                                    }
                                    break;
                                default:
                                    $url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/' . $x, '?p=news&amp;category=' . urlencode($catobj->getTitlelink()) . '&amp;page=' . $x, FULLWEBPATH);
                                    $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                                    break;
                            }
                        }
                    }
                }
            }
            $data .= sitemap_echonl('</urlset>');
            // End off the <urlset> tag
        }
        return $data;
    }
}
 /**
  * Gets the permalink url of the item that should be trackbacked 
  * as we can't use template functions on trackback.php
  *
  * @param object $object Object of the item
  * @return string
  */
 function getPermalinkURL($object)
 {
     $host = "http://" . htmlentities($_SERVER["HTTP_HOST"], ENT_QUOTES, 'UTF-8');
     $class = get_class($object);
     // Workaround because the ZENPAGE_NEWS and ZENPAGE_PAGES constants are not setup (strangely only on my live server...)
     if (getOption('zp_plugin_zenpage')) {
         $zenpage_pages = getOption("zenpage_pages_page");
         $zenpage_news = getOption("zenpage_news_page");
     }
     switch ($class) {
         case "ZenpageNews":
             // the & is escaped by the rdf function later
             return $host . rewrite_path($zenpage_news . "/" . $object->getTitlelink(), $host . "/index.php?p=" . $zenpage_news . "&title=" . $object->getTitlelink());
             break;
         case "ZenpagePage":
             return $host . rewrite_path($zenpage_pages . "/" . $object->getTitlelink(), $host . "/index.php?p=" . $zenpage_pages . "&title=" . $object->getTitlelink());
             break;
         case "Album":
             return $host . getAlbumLinkURL($object);
             break;
         case "_Image":
             return $host . rewrite_path($object->getAlbumName() . "/" . $object->getFilename(), $host . "/index.php?album=" . urlencode($object->getAlbumName()) . "&image=" . $object->getFilename());
             break;
     }
 }
Beispiel #21
0
 static function getSlideshowPlayer($album, $controls = false, $width = NULL, $height = NULL)
 {
     $albumobj = NULL;
     if (!empty($album)) {
         $albumobj = newAlbum($album, NULL, true);
     }
     if (is_object($albumobj) && $albumobj->loaded) {
         $returnpath = rewrite_path(pathurlencode($albumobj->name) . '/', '/index.php?album=' . urlencode($albumobj->name));
         return cycle::getShow(false, false, $albumobj, NULL, $width, $height, false, false, false, $controls, $returnpath, 0);
     } else {
         return '<div class="errorbox" id="message"><h2>' . gettext('Invalid slideshow album name!') . '</h2></div>';
     }
 }
Beispiel #22
0
 /**
  * Returns full path to a specific page
  *
  * @return string
  */
 function getLink()
 {
     return zp_apply_filter('getLink', rewrite_path(_PAGES_ . '/' . $this->getTitlelink(), '/index.php?p=pages&title=' . $this->getTitlelink()), $this, NULL);
 }
/**
 * Produces the url to a custom page (e.g. one that is not album.php, image.php, or index.php)
 *
 * @param string $linktext Text for the URL
 * @param string $page page name to include in URL
 * @param string $q query string to add to url
 * @return string
 */
function getCustomPageURL($page, $q = '')
{
    global $_zp_current_album, $_zp_conf_vars;
    if (array_key_exists($page, $_zp_conf_vars['special_pages'])) {
        $result_r = preg_replace('~^_PAGE_/~', _PAGE_ . '/', $_zp_conf_vars['special_pages'][$page]['rewrite']);
    } else {
        $result_r = '/' . _PAGE_ . '/' . $page;
    }
    $result = "index.php?p={$page}";
    if (!empty($q)) {
        $result_r .= "?{$q}";
        $result .= "&{$q}";
    }
    return zp_apply_filter('getLink', rewrite_path($result_r, $result), $page . '.php', NULL);
}
Beispiel #24
0
					<?php 
    $album = getPrevAlbum();
    if (is_null($album)) {
        echo '<div class="albdisabledlink">&laquo;  ' . gettext('prev') . '</div>';
    } else {
        echo '<a href="' . rewrite_path("/" . pathurlencode($album->name), "/index.php?album=" . urlencode($album->name)) . '" title="' . html_encode($album->getTitle()) . '">&laquo; ' . gettext('prev') . '</a>';
    }
    ?>
					</div> <!-- albprevious -->
					<div class="albnext">
						<?php 
    $album = getNextAlbum();
    if (is_null($album)) {
        echo '<div class="albdisabledlink">' . gettext('next') . ' &raquo;</div>';
    } else {
        echo '<a href="' . rewrite_path("/" . pathurlencode($album->name), "/index.php?album=" . urlencode($album->name)) . '" title="' . html_encode($album->getTitle()) . '">' . gettext('next') . ' &raquo;</a>';
    }
    ?>
					</div><!-- albnext -->
				</div> <!-- header -->

			<!-- Logo -->
				<div id="logo">
				<?php 
    printLogo();
    ?>
				</div>
			</div> <!-- gallerytitle -->

		<!-- Crumb Trail Navigation -->
		<div id="wrapnav">
Beispiel #25
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;
        }
    }
Beispiel #26
0
function printBaseSlideShow()
{
    global $_zp_gallery, $_zp_gallery_page, $_myFavorites, $_zp_conf_vars, $_zp_themeroot, $isMobile, $isTablet;
    if (!isset($_POST['albumid'])) {
        return '<div class="errorbox" id="message"><h2>' . gettext('Invalid linking to the slideshow page.') . '</h2></div>';
    }
    //getting the image to start with
    if (!empty($_POST['imagenumber'])) {
        $imagenumber = sanitize_numeric($_POST['imagenumber']) - 1;
        // slideshows starts with 0, but zp with 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 = 1;
    }
    // getting the number of images
    if (!empty($_POST['numberofimages'])) {
        $numberofimages = sanitize_numeric($_POST['numberofimages']);
    } else {
        $numberofimages = 0;
    }
    //if ($imagenumber < 2 || $imagenumber > $numberofimages) {
    //	$imagenumber = 0;
    //}
    //getting the album to show
    if (!empty($_POST['albumid'])) {
        $albumid = sanitize_numeric($_POST['albumid']);
    } else {
        $albumid = 0;
    }
    if (isset($_POST['preserve_search_params'])) {
        // search page
        $search = new SearchEngine();
        $params = sanitize($_POST['preserve_search_params']);
        $search->setSearchParams($params);
        $searchwords = $search->getSearchWords();
        $searchdate = $search->getSearchDate();
        $searchfields = $search->getSearchFields(true);
        $page = $search->page;
        $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
        $albumobj = new AlbumBase(NULL, false);
        $albumobj->setTitle(gettext('Search'));
        $albumobj->images = $search->getImages(0);
        $albumtitle = gettext('Search');
    } else {
        if (isset($_POST['favorites_page'])) {
            $albumobj = $_myFavorites;
            $returnpath = rewrite_path($_myFavorites->getLink() . '/' . $pagenumber, FULLWEBPATH . '/index.php?p=favorites' . '&page=' . $pagenumber);
            $albumtitle = gettext('Favorites');
        } else {
            $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
            $albumobj = newAlbum($albumq['folder']);
            $albumtitle = $albumobj->getTitle();
            if (empty($_POST['imagenumber'])) {
                $returnpath = $albumobj->getLink($pagenumber);
            } else {
                $image = newImage($albumobj, sanitize($_POST['imagefile']));
                $returnpath = $image->getLink();
            }
        }
    }
    if (!$albumobj->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumobj)) {
        return '<div class="errorbox" id="message"><h2>' . gettext('This album is password protected!') . '</h2></div>';
    }
    $slideshow = '';
    $numberofimages = $albumobj->getNumImages();
    if ($numberofimages == 0) {
        return '<div class="errorbox" id="message"><h2>' . gettext('No images for the slideshow!') . '</h2></div>';
    }
    $images = $albumobj->getImages(0);
    // slideshow generate data for galleria
    ?>
		<script>
			var data = [
			<?php 
    for ($c = 0, $idx = 0; $c < $numberofimages; $c++, $idx++) {
        if (is_array($images[$idx])) {
            $filename = $images[$idx]['filename'];
            $album = newAlbum($images[$idx]['folder']);
            $image = newImage($album, $filename);
        } else {
            $filename = $images[$idx];
            $image = newImage($albumobj, $filename);
        }
        if (isImagePhoto($image)) {
            makeImageCurrent($image);
            echo '{' . "\n";
            echo 'thumb: \'' . getImageThumb() . '\',' . "\n";
            echo 'image: \'' . getDefaultSizedImage() . '\',' . "\n";
            echo 'big: \'' . getCustomImageURL(getOption('zpbase_galbigsize')) . '\',' . "\n";
            echo 'title: \'' . js_encode($image->getTitle()) . '\',' . "\n";
            $desc = $image->getDesc();
            $desc = str_replace("\r\n", '<br />', $desc);
            $desc = str_replace("\r", '<br />', $desc);
            echo 'description: \'' . js_encode($desc) . '\',' . "\n";
            if (!getOption('zpbase_nodetailpage')) {
                echo 'link: \'' . html_encode($image->getLink()) . '\'' . "\n";
            }
            if ($c == $numberofimages - 1) {
                echo '}' . "\n";
            } else {
                echo '},' . "\n";
            }
        } else {
            if ($imagenumber > 0 && $imagenumber > $c) {
                $imagenumber--;
            }
        }
    }
    echo "\n";
    ?>
			];
		</script>
		<?php 
    $sspage = true;
    require_once 'inc/galleria-jscall.php';
}
function getNewsPathNav($page)
{
    global $_zp_current_category, $_zp_post_date;
    if (in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
        return $_zp_current_category->getLink($page);
    }
    if (in_context(ZP_ZENPAGE_NEWS_DATE)) {
        return getNewsArchivePath($_zp_post_date, $page);
    }
    $rewrite = '/' . _NEWS_ . '/';
    $plain = 'index.php?p=news';
    if ($page > 1) {
        $rewrite .= $page;
        $plain .= '&page=' . $page;
    }
    return zp_apply_filter('getLink', rewrite_path($rewrite, $plain), 'news.php', $page);
}
/**
 * Adds an menu item set via POST
 *
 * @return array
 */
function addItem(&$reports)
{
    $menuset = checkChosenMenuset();
    $result['type'] = sanitize($_POST['type']);
    $result['show'] = getCheckboxState('show');
    $result['include_li'] = getCheckboxState('include_li');
    $result['id'] = 0;
    if (getCheckboxState('span')) {
        $result['span_id'] = sanitize($_POST['span_id']);
        $result['span_class'] = sanitize($_POST['span_class']);
    } else {
        $result['span_id'] = '';
        $result['span_class'] = '';
    }
    switch ($result['type']) {
        case 'all_items':
            query("INSERT INTO " . prefix('menu') . " (`title`,`link`,`type`,`show`,`menuset`,`sort_order`) " . "VALUES ('" . gettext('Home') . "', '" . WEBPATH . '/' . "','galleryindex','1'," . db_quote($menuset) . ",'000')", true);
            addAlbumsToDatabase($menuset);
            if (getOption('zp_plugin_zenpage')) {
                query("INSERT INTO " . prefix('menu') . " (`title`,`link`,`type`,`show`,`menuset`,`sort_order`) " . "VALUES ('" . gettext('News index') . "', '" . rewrite_path('news', '?p=news') . "','zenpagenewsindex','1'," . db_quote($menuset) . ",'001')", true);
                addPagesToDatabase($menuset);
                addCategoriesToDatabase($menuset);
            }
            $reports[] = "<p class='messagebox fade-message'>" . gettext("Menu items for all Zenphoto objects added.") . "</p>";
            return NULL;
        case 'all_albums':
            addAlbumsToDatabase($menuset);
            $reports[] = "<p class='messagebox fade-message'>" . gettext("Menu items for all albums added.") . "</p>";
            return NULL;
        case 'all_zenpagepages':
            addPagesToDatabase($menuset);
            $reports[] = "<p class='messagebox fade-message'>" . gettext("Menu items for all Zenpage pages added.") . "</p>";
            return NULL;
        case 'all_zenpagecategorys':
            addCategoriesToDatabase($menuset);
            $reports[] = "<p class='messagebox fade-message'>" . gettext("Menu items for all Zenpage categories added.") . "</p>";
            return NULL;
        case 'album':
            $result['title'] = $result['link'] = sanitize($_POST['albumselect']);
            if (empty($result['link'])) {
                $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to select an album.") . "</p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Album menu item <em>%s</em> added"), $result['link']);
            break;
        case 'galleryindex':
            $result['title'] = process_language_string_save("title", 2);
            $result['link'] = NULL;
            if (empty($result['title'])) {
                $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . "</p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Gallery index menu item <em>%s</em> added"), $result['link']);
            break;
        case 'zenpagepage':
            $result['title'] = NULL;
            $result['link'] = sanitize($_POST['pageselect']);
            if (empty($result['link'])) {
                $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>link</strong>!") . "</p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Zenpage page menu item <em>%s</em> added"), $result['link']);
            break;
        case 'zenpagenewsindex':
            $result['title'] = process_language_string_save("title", 2);
            $result['link'] = NULL;
            if (empty($result['title'])) {
                $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . "</p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Zenpage news index menu item <em>%s</em> added"), $result['link']);
            break;
        case 'zenpagecategory':
            $result['title'] = NULL;
            $result['link'] = sanitize($_POST['categoryselect']);
            if (empty($result['link'])) {
                $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>link</strong>!") . "</p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Zenpage news category menu item <em>%s</em> added"), $result['link']);
            break;
        case 'custompage':
            $result['title'] = process_language_string_save("title", 2);
            $result['link'] = sanitize($_POST['custompageselect']);
            if (empty($result['title'])) {
                $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . "</p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Custom page menu item <em>%s</em> added"), $result['link']);
            break;
        case 'customlink':
            $result['title'] = process_language_string_save("title", 2);
            if (empty($result['title'])) {
                $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . "</p>";
                return $result;
            }
            $result['link'] = sanitize($_POST['link']);
            if (empty($result['link'])) {
                $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to provide a <strong>function</strong>!") . "</p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Custom page menu item <em>%s</em> added"), $result['link']);
            break;
        case 'menulabel':
            $result['title'] = process_language_string_save("title", 2);
            $result['link'] = NULL;
            if (empty($result['title'])) {
                $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . "</p>";
                return $result;
            }
            $successmsg = gettext("Custom label added");
            break;
        case 'menufunction':
            $result['title'] = process_language_string_save("title", 2);
            if (empty($result['title'])) {
                $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . "</p>";
                return $result;
            }
            $result['link'] = sanitize($_POST['link'], 0);
            if (empty($result['link'])) {
                $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to provide a <strong>function</strong>!") . "</p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Function  menu item <em>%s</em> added"), $result['link']);
            break;
        case 'html':
            $result['title'] = process_language_string_save("title", 2);
            if (empty($result['title'])) {
                $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . "</p>";
                return $result;
            }
            $result['link'] = sanitize($_POST['link'], 0);
            if (empty($result['link'])) {
                $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to provide a <strong>function</strong>!") . "</p>";
                return $result;
            }
            $successmsg = gettext("Horizontal rule added");
            break;
        default:
            break;
    }
    $sql = "SELECT COUNT(id) FROM " . prefix('menu') . ' WHERE menuset=' . db_quote($menuset);
    $rslt = query($sql);
    $order = sprintf('%03u', db_result($rslt, 0));
    $sql = "INSERT INTO " . prefix('menu') . " (`title`,`link`,`type`,`show`,`menuset`,`sort_order`,`include_li`,`span_id`,`span_class`) " . "VALUES (" . db_quote($result['title']) . "," . db_quote($result['link']) . "," . db_quote($result['type']) . "," . $result['show'] . "," . db_quote($menuset) . "," . db_quote($order) . "," . $result['include_li'] . "," . db_quote($result['span_id']) . "," . db_quote($result['span_class']) . ")";
    if (query($sql, true)) {
        $reports[] = "<p class='messagebox fade-message'>" . $successmsg . "</p>";
        //echo "<pre>"; print_r($result); echo "</pre>";
        $result['id'] = db_insert_id();
        return $result;
    } else {
        if (empty($result['link'])) {
            $reports[] = "<p class='errorbox fade-message'>" . sprintf(gettext('A <em>%1$s</em> item already exists in <em>%2$s</em>!'), $result['type'], $menuset) . "</p>";
        } else {
            $reports[] = "<p class='errorbox fade-message'>" . sprintf(gettext('A <em>%1$s</em> item with the link <em>%2$s</em> already exists in <em>%3$s</em>!'), $result['type'], $result['link'], $menuset) . "</p>";
        }
        return NULL;
    }
}
Beispiel #29
0
 /**
  * Returns an URL to the album, including the current page number
  *
  * @param string $page if not null, apppend as page #
  * @return string
  */
 function getLink($page = NULL)
 {
     global $_zp_current_album;
     global $_zp_page;
     if (is_null($page) && $_zp_current_album && $_zp_current_album->name == $this->name) {
         $page = $_zp_page;
     }
     $rewrite = pathurlencode($this->linkname) . '/';
     $plain = '/index.php?album=' . pathurlencode($this->name);
     if ($page > 1) {
         $rewrite .= _PAGE_ . '/' . $page . '/';
         $plain .= "&page={$page}";
     }
     return zp_apply_filter('getLink', rewrite_path($rewrite, $plain), $this, $page);
 }
Beispiel #30
0
/**
 * Gets the title, url and name of a menu item
 *
 * @return array
 */
function getItemTitleAndURL($item)
{
    global $_zp_gallery;
    $themename = $_zp_gallery->getCurrentTheme();
    $array = array();
    $valid = true;
    $title = get_language_string($item['title']);
    switch ($item['type']) {
        case "galleryindex":
            $array = array("title" => get_language_string($item['title']), "url" => WEBPATH, "name" => WEBPATH, 'protected' => false, 'theme' => $themename);
            break;
        case "album":
            $folderFS = internalToFilesystem($item['link']);
            $localpath = ALBUM_FOLDER_SERVERPATH . $folderFS;
            $dynamic = hasDynamicAlbumSuffix($folderFS) && !is_dir($folderFS);
            $valid = file_exists($localpath) && ($dynamic || is_dir($localpath));
            if (!$valid || strpos($localpath, '..') !== false) {
                $valid = false;
                $url = '';
                $protected = 0;
            } else {
                $obj = newAlbum($item['link']);
                $url = $obj->getLink(0);
                $protected = $obj->isProtected();
                $title = $obj->getTitle();
            }
            $array = array("title" => $title, "url" => $url, "name" => $item['link'], 'protected' => $protected, 'theme' => $themename);
            break;
        case "page":
            $sql = 'SELECT * FROM ' . prefix('pages') . ' WHERE `titlelink`="' . $item['link'] . '"';
            $result = query_single_row($sql);
            if (is_array($result) && extensionEnabled('zenpage')) {
                $obj = newPage($item['link']);
                $url = $obj->getLink(0);
                $protected = $obj->isProtected();
                $title = $obj->getTitle();
            } else {
                $valid = false;
                $url = '';
                $protected = 0;
            }
            $array = array("title" => $title, "url" => $url, "name" => $item['link'], 'protected' => $protected);
            break;
        case "newsindex":
            if ($valid = extensionEnabled('zenpage')) {
                $url = getNewsIndexURL();
            } else {
                $url = '';
            }
            $array = array("title" => get_language_string($item['title']), "url" => $url, "name" => $url, 'protected' => false);
            break;
        case "category":
            $valid = extensionEnabled('zenpage');
            $sql = "SELECT title FROM " . prefix('news_categories') . " WHERE titlelink = '" . $item['link'] . "'";
            $obj = query_single_row($sql, false);
            if ($obj && $valid) {
                $obj = newCategory($item['link']);
                $title = $obj->getTitle();
                $protected = $obj->isProtected();
                $url = $obj->getLink(0);
            } else {
                $valid = false;
                $url = '';
                $protected = 0;
            }
            $array = array("title" => $title, "url" => $url, "name" => $item['link'], 'protected' => $protected);
            break;
        case "custompage":
            $root = SERVERPATH . '/' . THEMEFOLDER . '/' . $themename . '/';
            if (file_exists($root . $item['link'] . '.php')) {
                $url = zp_apply_filter('getLink', rewrite_path(_PAGE_ . '/' . $item['link'], "/index.php?p=" . $item['link']), $item['link'] . '.php', NULL);
            } else {
                $valid = false;
                $url = '';
            }
            $array = array("title" => $title, "url" => $url, "name" => $item['link'], 'protected' => false, 'theme' => $themename);
            break;
        case "customlink":
            $array = array("title" => get_language_string($item['title']), "url" => $item['link'], "name" => $item['link'], 'protected' => false, 'theme' => $themename);
            break;
        case 'menulabel':
            $array = array("title" => get_language_string($item['title']), "url" => NULL, 'name' => $item['title'], 'protected' => false, 'theme' => $themename);
            break;
        default:
            $array = array("title" => get_language_string($item['title']), "url" => $item['link'], "name" => $item['link'], 'protected' => false, 'theme' => $themename);
            break;
    }
    $limit = MENU_TRUNCATE_STRING;
    $array['valid'] = $valid;
    if ($limit) {
        $array['title'] = shortenContent($array['title'], $limit, MENU_TRUNCATE_INDICATOR);
    }
    return $array;
}