function sitemap_printAvailableSitemaps()
{
    $cachefolder = SERVERPATH . '/cache_html/sitemap/';
    $dirs = array_diff(scandir($cachefolder), array('.', '..', '.DS_Store', 'Thumbs.db', '.htaccess', '.svn'));
    echo '<h2>' . gettext('Available sitemap files:') . '</h2>';
    if (!$dirs) {
        echo '<p>' . gettext('No sitemap files available.') . '</p>';
    } else {
        echo '<ol>';
        foreach ($dirs as $dir) {
            $filemtime = filemtime($cachefolder . $dir);
            $lastchange = zpFormattedDate(DATE_FORMAT, $filemtime);
            echo '<li>' . $dir . ' (<small>' . $lastchange . ')</small>';
            //<a class="colorbox" href="'.FULLWEBPATH.'/cache_html/sitemap/'.$dir.'">Preview</a></li>';
        }
        echo '</ol>';
    }
}
Esempio n. 2
0
			<div class="news-preview">
				<div class="news-preview-title">
					<span><?php 
    printNewsTitle();
    ?>
</span>
				</div>
				<div class="news-preview-content">
					<?php 
    echo ThemeUtil::clean(getNewsContent(), FALSE, 120, FALSE);
    ?>
				</div>
			</div>
		</div>
	<?php 
    ThemeUtil::$script .= 'news.push({' . '	"titleLink": \'' . $_zp_current_zenpage_news->getTitleLink() . '\',' . '	"title": \'' . ThemeUtil::clean(getNewsTitle(), FALSE) . '\',' . '	"content": \'' . ThemeUtil::clean(getNewsContent()) . '\',' . '	"date": ' . zpFormattedDate("{day: %d, month:  '%b', year: %Y}", strtotime($_zp_current_zenpage_news->getDateTime())) . ', ' . '	"categories": \'' . ThemeUtil::clean(NewsUtil::printNewsCategories(',', false, false), FALSE) . '\', ' . '    "commentson": ' . (NewsUtil::commentsAllowed() ? "true" : "false") . "," . '	"commentCount": ' . $_zp_current_zenpage_news->getCommentCount() . '}); ';
    $u++;
}
ThemeUtil::$script .= $sel;
?>
	</div>

	<?php 
echo isset($prevNext['next']) ? $prevNext['next'] : "<div id='news-nav-next' class='proxy'></div>";
?>
	
	<div id="page-filler" class="opa20">&nbsp;</div>

</div>

<div id="workaround-non-xml-comment-crap" style="display: none;"></div>
Esempio n. 3
0
            ?>
									<?php 
            if (function_exists('getCommentCount')) {
                if ($obj->getCommentsAllowed() && $obj->getCommentCount() > 0) {
                    ?>
										<div class="album-com-count"><i class="fa fa-comments"></i><span> <?php 
                    echo $obj->getCommentCount();
                    ?>
</span></div>
										<?php 
                }
            }
            ?>
								</div>
								<div class="album-date"><?php 
            echo zpFormattedDate(DATE_FORMAT, strtotime($obj->getDateTime()));
            ?>
</div>
								<h3 class="album-title"><?php 
            echo html_encode($obj->getTitle());
            ?>
</h3>
							</div>
						</a>
					<?php 
            $count++;
        }
        ?>
				</div>
			</div>
		</div>
Esempio n. 4
0
 /**
  * Gets the feed item data in a gallery feed
  *
  * @param object $item Object of an image or album
  * @return array
  */
 protected function getItemGallery($item)
 {
     if ($this->mode == "albums") {
         $albumobj = newAlbum($item['folder']);
         $totalimages = $albumobj->getNumImages();
         $itemlink = $this->host . $albumobj->getLink();
         $thumb = $albumobj->getAlbumThumbImage();
         $thumburl = '<img border="0" src="' . PROTOCOL . '://' . $this->host . html_encode(pathurlencode($thumb->getCustomImage($this->imagesize, NULL, NULL, NULL, NULL, NULL, NULL, TRUE))) . '" alt="' . html_encode($albumobj->getTitle($this->locale)) . '" />';
         $title = $albumobj->getTitle($this->locale);
         if (true || $this->sortorder == "latestupdated") {
             $filechangedate = filectime(ALBUM_FOLDER_SERVERPATH . internalToFilesystem($albumobj->name));
             $latestimage = query_single_row("SELECT mtime FROM " . prefix('images') . " WHERE albumid = " . $albumobj->getID() . " AND `show` = 1 ORDER BY id DESC");
             if ($latestimage && $this->sortorder == 'latestupdated') {
                 $count = db_count('images', "WHERE albumid = " . $albumobj->getID() . " AND mtime = " . $latestimage['mtime']);
             } else {
                 $count = $totalimages;
             }
             if ($count != 0) {
                 $imagenumber = sprintf(ngettext('%s (%u image)', '%s (%u images)', $count), $title, $count);
             } else {
                 $imagenumber = $title;
             }
             $feeditem['desc'] = '<a title="' . $title . '" href="' . PROTOCOL . '://' . $itemlink . '">' . $thumburl . '</a>' . '<p>' . html_encode($imagenumber) . '</p>' . $albumobj->getDesc($this->locale) . '<br />' . sprintf(gettext("Last update: %s"), zpFormattedDate(DATE_FORMAT, $filechangedate));
         } else {
             if ($totalimages != 0) {
                 $imagenumber = sprintf(ngettext('%s (%u image)', '%s (%u images)', $totalimages), $title, $totalimages);
             }
             $feeditem['desc'] = '<a title="' . html_encode($title) . '" href="' . PROTOCOL . '://' . $itemlink . '">' . $thumburl . '</a>' . $item->getDesc($this->locale) . '<br />' . sprintf(gettext("Date: %s"), zpFormattedDate(DATE_FORMAT, $item->get('mtime')));
         }
         $ext = getSuffix($thumb->localpath);
     } else {
         $ext = getSuffix($item->localpath);
         $albumobj = $item->getAlbum();
         $itemlink = $this->host . $item->getLink();
         $fullimagelink = $this->host . html_encode(pathurlencode($item->getFullImageURL()));
         $thumburl = '<img border="0" src="' . PROTOCOL . '://' . $this->host . html_encode(pathurlencode($item->getCustomImage($this->imagesize, NULL, NULL, NULL, NULL, NULL, NULL, TRUE))) . '" alt="' . $item->getTitle($this->locale) . '" /><br />';
         $title = $item->getTitle($this->locale);
         $albumtitle = $albumobj->getTitle($this->locale);
         $datecontent = '<br />Date: ' . zpFormattedDate(DATE_FORMAT, $item->get('mtime'));
         if ($ext == "flv" || $ext == "mp3" || $ext == "mp4" || $ext == "3gp" || $ext == "mov" and $this->mode != "album") {
             $feeditem['desc'] = '<a title="' . html_encode($title) . ' in ' . html_encode($albumobj->getTitle($this->locale)) . '" href="' . PROTOCOL . '://' . $itemlink . '">' . $thumburl . '</a>' . $item->getDesc($this->locale) . $datecontent;
         } else {
             $feeditem['desc'] = '<a title="' . html_encode($title) . ' in ' . html_encode($albumobj->getTitle($this->locale)) . '" href="' . PROTOCOL . '://' . $itemlink . '"><img src="' . PROTOCOL . '://' . $this->host . html_encode(pathurlencode($item->getCustomImage($this->imagesize, NULL, NULL, NULL, NULL, NULL, NULL, TRUE))) . '" alt="' . html_encode($title) . '" /></a>' . $item->getDesc($this->locale) . $datecontent;
         }
     }
     // title
     if ($this->mode != "albums") {
         $feeditem['title'] = sprintf('%1$s (%2$s)', $item->getTitle($this->locale), $albumobj->getTitle($this->locale));
     } else {
         $feeditem['title'] = $imagenumber;
     }
     //link
     $feeditem['link'] = PROTOCOL . '://' . $itemlink;
     // enclosure
     $feeditem['enclosure'] = '';
     if (getOption("RSS_enclosure") and $this->mode != "albums") {
         $feeditem['enclosure'] = '<enclosure url="' . PROTOCOL . '://' . $fullimagelink . '" type="' . getMimeString($ext) . '" length="' . filesize($item->localpath) . '" />';
     }
     //category
     if ($this->mode != "albums") {
         $feeditem['category'] = html_encode($albumobj->getTitle($this->locale));
     } else {
         $feeditem['category'] = html_encode($albumobj->getTitle($this->locale));
     }
     //media content
     $feeditem['media_content'] = '';
     $feeditem['media_thumbnail'] = '';
     if (getOption("RSS_mediarss") and $this->mode != "albums") {
         $feeditem['media_content'] = '<media:content url="' . PROTOCOL . '://' . $fullimagelink . '" type="image/jpeg" />';
         $feeditem['media_thumbnail'] = '<media:thumbnail url="' . PROTOCOL . '://' . $fullimagelink . '" width="' . $this->imagesize . '"	height="' . $this->imagesize . '" />';
     }
     //date
     if ($this->mode != "albums") {
         $feeditem['pubdate'] = date("r", strtotime($item->getDateTime()));
     } else {
         $feeditem['pubdate'] = date("r", strtotime($albumobj->getDateTime()));
     }
     return $feeditem;
 }
Esempio n. 5
0
    ?>
" 
			 commentCount="<?php 
    echo $_zp_current_zenpage_news->getCommentCount();
    ?>
">
			<div class='date' day="<?php 
    echo zpFormattedDate('%e', $dt);
    ?>
"
				  month="<?php 
    echo zpFormattedDate('%b', $dt);
    ?>
"
			      year="<?php 
    echo zpFormattedDate('%Y', $dt);
    ?>
"/>
			<div class='content'><?php 
    echo getNewsContent();
    ?>
</div>
			<div class='categories'><?php 
    echo ThemeUtil::clean(NewsUtil::printNewsCategories(',', false, false), FALSE);
    ?>
</div>
			<div class='preview'><?php 
    echo ThemeUtil::clean(getNewsContent(), FALSE, 120, FALSE);
    ?>
</div>
		</div>
/**
 * Copy a theme directory to create a new custom theme
 *
 * @param $source source directory
 * @param $target target directory
 * @return bool|string either true or an error message
 * @author Ozh
 * @since 1.3
 */
function copyThemeDirectory($source, $target, $newname)
{
    global $_zp_current_admin_obj;
    $message = true;
    $source = SERVERPATH . '/themes/' . internalToFilesystem($source);
    $target = SERVERPATH . '/themes/' . internalToFilesystem($target);
    // If the target theme already exists, nothing to do.
    if (is_dir($target)) {
        return gettext('Cannot create new theme.') . ' ' . sprintf(gettext('Directory "%s" already exists!'), basename($target));
    }
    // If source dir is missing, exit too
    if (!is_dir($source)) {
        return gettext('Cannot create new theme.') . ' ' . sprintf(gettext('Cannot find theme directory "%s" to copy!'), basename($source));
    }
    // We must be able to write to the themes dir.
    if (!is_writable(dirname($target))) {
        return gettext('Cannot create new theme.') . ' ' . gettext('The <tt>/themes</tt> directory is not writable!');
    }
    // We must be able to create the directory
    if (!mkdir($target, CHMOD_VALUE)) {
        return gettext('Cannot create new theme.') . ' ' . gettext('Could not create directory for the new theme');
    }
    chmod($target, CHMOD_VALUE);
    // Get a list of files to copy: get all files from the directory, remove those containing '/.svn/'
    $source_files = array_filter(listDirectoryFiles($source), create_function('$str', 'return strpos($str, "/.svn/") === false;'));
    // Determine nested (sub)directories structure to create: go through each file, explode path on "/"
    // and collect every unique directory
    $dirs_to_create = array();
    foreach ($source_files as $path) {
        $path = dirname(str_replace($source . '/', '', $path));
        $path = explode('/', $path);
        $dirs = '';
        foreach ($path as $subdir) {
            if ($subdir == '.svn' or $subdir == '.') {
                continue 2;
            }
            $dirs = "{$dirs}/{$subdir}";
            $dirs_to_create[$dirs] = $dirs;
        }
    }
    /*
    Example result for theme 'effervescence_plus': $dirs_to_create = array (
    	'/styles' => '/styles',
    	'/scripts' => '/scripts',
    	'/images' => '/images',
    	'/images/smooth' => '/images/smooth',
    	'/images/slimbox' => '/images/slimbox',
    );
    */
    // Create new directory structure
    foreach ($dirs_to_create as $dir) {
        mkdir("{$target}/{$dir}", CHMOD_VALUE);
        chmod("{$target}/{$dir}", CHMOD_VALUE);
        // Using chmod as PHP doc suggested: "Avoid using umask() in multithreaded webservers. It is better to change the file permissions with chmod() after creating the file."
    }
    // Now copy every file
    foreach ($source_files as $file) {
        $newfile = str_replace($source, $target, $file);
        if (!copy("{$file}", "{$newfile}")) {
            return sprintf(gettext("An error occurred while copying files. Please delete manually the new theme directory '%s' and retry or copy files manually."), basename($target));
        }
        chmod("{$newfile}", CHMOD_VALUE);
    }
    // Rewrite the theme header.
    if (file_exists($target . '/theme_description.php')) {
        $theme_description = array();
        require $target . '/theme_description.php';
        $theme_description['desc'] = sprintf(gettext('Your theme, based on theme %s'), $theme_description['name']);
    } else {
        $theme_description['desc'] = gettext('Your theme');
    }
    $theme_description['name'] = $newname;
    $theme_description['author'] = $_zp_current_admin_obj->getUser();
    $theme_description['version'] = '1.0';
    $theme_description['date'] = zpFormattedDate(DATE_FORMAT, time());
    $description = sprintf('<' . '?php
				// Zenphoto theme definition file
				$theme_description["name"] = "%s";
				$theme_description["author"] = "%s";
				$theme_description["version"] = "%s";
				$theme_description["date"] = "%s";
				$theme_description["desc"] = "%s";
				?' . '>', html_encode($theme_description['name']), html_encode($theme_description['author']), html_encode($theme_description['version']), html_encode($theme_description['date']), html_encode($theme_description['desc']));
    $f = fopen($target . '/theme_description.php', 'w');
    if ($f !== FALSE) {
        @fwrite($f, $description);
        fclose($f);
        $message = gettext('New custom theme created successfully!');
    } else {
        $message = gettext('New custom theme created, but its description could not be updated');
    }
    // Make a slightly custom theme image
    if (file_exists("{$target}/theme.png")) {
        $themeimage = "{$target}/theme.png";
    } else {
        if (file_exists("{$target}/theme.gif")) {
            $themeimage = "{$target}/theme.gif";
        } else {
            if (file_exists("{$target}/theme.jpg")) {
                $themeimage = "{$target}/theme.jpg";
            } else {
                $themeimage = false;
            }
        }
    }
    if ($themeimage) {
        require_once dirname(__FILE__) . '/functions-image.php';
        if ($im = zp_imageGet($themeimage)) {
            $x = zp_imageWidth($im) / 2 - 45;
            $y = zp_imageHeight($im) / 2 - 10;
            $text = "CUSTOM COPY";
            $font = zp_imageLoadFont();
            $ink = zp_colorAllocate($im, 0xff, 0xff, 0xff);
            // create a blueish overlay
            $overlay = zp_createImage(zp_imageWidth($im), zp_imageHeight($im));
            $back = zp_colorAllocate($overlay, 0x60, 0x60, 0x90);
            zp_imageFill($overlay, 0, 0, $back);
            // Merge theme image and overlay
            zp_imageMerge($im, $overlay, 0, 0, 0, 0, zp_imageWidth($im), zp_imageHeight($im), 45);
            // Add text
            zp_writeString($im, $font, $x - 1, $y - 1, $text, $ink);
            zp_writeString($im, $font, $x + 1, $y + 1, $text, $ink);
            zp_writeString($im, $font, $x, $y, $text, $ink);
            // Save new theme image
            zp_imageOutput($im, 'png', $themeimage);
        }
    }
    return $message;
}
Esempio n. 7
0
function RSS_Display($url, $size = 15, $site = 0)
{
    $opened = false;
    $page = "";
    $site = intval($site) == 0 ? 1 : 0;
    if ($size <= 0) {
        return '';
    }
    $recents = array_slice(RSS_Retrieve($url), $site, $size + 1 - $site);
    foreach ($recents as $article) {
        $type = $article["type"];
        if ($type == 0) {
            if ($opened) {
                $page .= "</ul>\n";
                $opened = false;
            }
            $page .= "<b />";
        } else {
            if (!$opened) {
                $page .= "<ul>\n";
                $opened = true;
            }
        }
        $title = $article["title"];
        $format = DATE_FORMAT;
        $date = zpFormattedDate($format, strtotime($article["pubDate"]));
        $link = $article["link"];
        $description = $article["description"];
        $page .= "<li><a href=\"{$link}\"><strong>{$title}</strong> ({$date})</a>";
        if ($description != false) {
            $page .= "<br />{$description}";
        }
        $page .= "</li>\n";
        if ($type == 0) {
            $page .= "<br />";
        }
    }
    if ($opened) {
        $page .= "</ul>\n";
    }
    return $page . "\n";
}
/**
 * Returns the date of the search
 *
 * @param string $format formatting of the date, default 'F Y'
 * @return string
 * @since 1.1
 */
function getSearchDate($format = '%B %Y')
{
    if (in_context(ZP_SEARCH)) {
        global $_zp_current_search;
        $date = $_zp_current_search->getSearchDate();
        if (empty($date)) {
            return "";
        }
        if ($date == '0000-00') {
            return gettext("no date");
        }
        $dt = strtotime($date . "-01");
        return zpFormattedDate($format, $dt);
    }
    return false;
}
Esempio n. 9
0
					<?php 
if ($zpmin_albumorimage == 'image') {
    printImageStatistic(1, $zpmin_functionoption, '', true, true, false, 40, '', 535, 535, false);
} else {
    if ($zpmin_albumorimage == 'album') {
        printAlbumStatistic(1, $zpmin_functionoption, true, true, false, 40, '', 535, 535, false);
    } else {
        $randomImage = getRandomImages($zpmin_functionoption);
        if (is_object($randomImage) && $randomImage->exists) {
            $randomImageURL = html_encode($randomImage->getLink());
            echo '<a href="' . $randomImageURL . '" title="' . sprintf(gettext('View image: %s'), html_encode($randomImage->getTitle())) . '">';
            $html = "<img src=\"" . html_encode($randomImage->getCustomImage(535, NULL, NULL, NULL, NULL, NULL, NULL, TRUE)) . "\" alt=\"" . html_encode($randomImage->getTitle()) . "\" />\n";
            echo zp_apply_filter('custom_image_html', $html, false);
            echo "</a>";
            echo '<h3><a href="' . $randomImageURL . '" title="' . sprintf(gettext('View image: %s'), html_encode($randomImage->getTitle())) . '">' . html_encode($randomImage->getTitle()) . '</a></h3>';
            echo "<p>" . zpFormattedDate(getOption('date_format'), strtotime($randomImage->getDateTime())) . "</p>";
        } else {
            echo gettext('No Images Exist...');
        }
    }
}
?>
					<div id="enter">
						<a href="<?php 
echo getCustomPageURL('gallery');
?>
" title="<?php 
echo gettext('Gallery Index');
?>
"><?php 
echo gettext('Enter Gallery &rarr;');
/**
 * Prints image statistic according to $option as an unordered HTML list
 * A css id is attached by default named accordingly'$option'
 *
 * @param string $number the number of albums to get
 * @param string $option "popular" for the most popular images,
 *                       "latest" for the latest uploaded,
 *                       "latest-date" for the latest uploaded, but fetched by date,
 * 											 "latest-mtime" for the latest uploaded, but fetched by mtime,
 *                       "mostrated" for the most voted,
 *                       "toprated" for the best voted
 * @param string $albumfolder foldername of an specific album
 * @param bool $showtitle if the image title should be shown
 * @param bool $showdate if the image date should be shown
 * @param bool $showdesc if the image description should be shown
 * @param integer $desclength the length of the description to be shown
 * @param string $showstatistic "hitcounter" for showing the hitcounter (views),
 * 															"rating" for rating,
 * 															"rating+hitcounter" for both.
 * @param integer $width the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px)
 * @param integer $height the height/cropheight of the thumb if crop=true else not used.  (Default 85px)
 * @param bool $crop 'true' (default) if the thumb should be cropped, 'false' if not
 * @param bool $collection only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums
 *
 * @return string
 */
function printImageStatistic($number, $option, $albumfolder = '', $showtitle = false, $showdate = false, $showdesc = false, $desclength = 40, $showstatistic = '', $width = 85, $height = 85, $crop = true, $collection = false)
{
    $images = getImageStatistic($number, $option, $albumfolder, $collection);
    echo "\n<div id=\"{$option}\">\n";
    echo "<ul>";
    foreach ($images as $image) {
        echo "<li><a href=\"" . html_encode($image->getImageLink()) . "\" title=\"" . html_encode($image->getTitle()) . "\">\n";
        if ($crop) {
            echo "<img src=\"" . html_encode($image->getCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, TRUE)) . "\" alt=\"" . html_encode($image->getTitle()) . "\" /></a>\n";
        } else {
            echo "<img src=\"" . html_encode($image->getCustomImage($width, NULL, NULL, NULL, NULL, NULL, NULL, TRUE)) . "\" alt=\"" . html_encode($image->getTitle()) . "\" /></a>\n";
        }
        if ($showtitle) {
            echo "<h3><a href=\"" . html_encode($image->getImageLink()) . "\" title=\"" . html_encode($image->getTitle()) . "\">\n";
            echo $image->getTitle() . "</a></h3>\n";
        }
        if ($showdate) {
            echo "<p>" . zpFormattedDate(DATE_FORMAT, strtotime($image->getDateTime())) . "</p>";
        }
        if ($showstatistic === "rating" or $showstatistic === "rating+hitcounter") {
            $votes = $image->get("total_votes");
            $value = $image->get("total_value");
            if ($votes != 0) {
                $rating = round($value / $votes, 1);
            }
            echo "<p>" . sprintf(gettext('Rating: %1$u (Votes: %2$u)'), $rating, $votes) . "</p>";
        }
        if ($showstatistic === "hitcounter" or $showstatistic === "rating+hitcounter") {
            $hitcounter = $image->get("hitcounter");
            if (empty($hitcounter)) {
                $hitcounter = "0";
            }
            echo "<p>" . sprintf(gettext("Views: %u"), $hitcounter) . "</p>";
        }
        if ($showdesc) {
            echo shortenContent($image->getDesc(), $desclength, ' (...)');
        }
        echo "</li>";
    }
    echo "</ul></div>\n";
}
Esempio n. 11
0
function printLatestNewsCustom($number = 5, $category = '', $showdate = true, $showcontent = true, $contentlength = 70, $showcat = true)
{
    global $_zp_gallery, $_zp_current_article;
    $latest = getLatestNews($number, $category);
    echo "\n<div id=\"latestnews-spotlight\">\n";
    $count = "";
    foreach ($latest as $item) {
        $count++;
        $category = "";
        $categories = "";
        $obj = newArticle($item['titlelink']);
        $title = htmlspecialchars($obj->getTitle());
        $link = getNewsURL($item['titlelink']);
        $count2 = 0;
        $category = $obj->getCategories();
        foreach ($category as $cat) {
            $catobj = new Category($cat['titlelink']);
            $count2++;
            if ($count2 != 1) {
                $categories = $categories . "; ";
            }
            $categories = $categories . $catobj->getTitle();
        }
        $content = strip_tags($obj->getContent());
        $date = zpFormattedDate(getOption('date_format'), strtotime($item['date']));
        $type = 'news';
        echo "<div>";
        echo "<h3><a href=\"" . $link . "\" title=\"" . strip_tags(htmlspecialchars($title, ENT_QUOTES)) . "\">" . htmlspecialchars($title) . "</a></h3>\n";
        echo "<div class=\"newsarticlecredit\">\n";
        echo "<span class=\"latestnews-date\">" . $date . "</span>\n";
        echo "<span class=\"latestnews-cats\">| Posted in " . $categories . "</span>\n";
        echo "</div>\n";
        echo "<p class=\"latestnews-desc\">" . html_encode(getContentShorten($content, $contentlength, '(...)', null, null)) . "</p>\n";
        echo "</div>\n";
        if ($count == $number) {
            break;
        }
    }
    echo "</div>\n";
}
Esempio n. 12
0
            if ($count == 1) {
                $imagenumber = sprintf(gettext('%s (1 new image)'), $title);
            } else {
                $imagenumber = sprintf(gettext('%1$s (%2$s new images)'), $title, $count);
            }
            $itemcontent = '<![CDATA[<a title="' . $title . '" href="' . $protocol . '://' . $itemlink . '">' . $thumburl . '</a>' . '<p>' . html_encode($imagenumber) . '</p>' . html_encode(get_language_string($albumitem->get("desc"), $locale)) . ']]>';
            $videocontent = '';
            $datecontent = '<![CDATA[' . sprintf(gettext("Last update: %s"), zpFormattedDate(DATE_FORMAT, $filechangedate)) . ']]>';
        } else {
            if ($totalimages == 1) {
                $imagenumber = sprintf(gettext('%s (1 image)'), $title);
            } else {
                $imagenumber = sprintf(gettext('%1$s (%2$s images)'), $title, $totalimages);
            }
            $itemcontent = '<![CDATA[<a title="' . html_encode($title) . '" href="' . $protocol . '://' . $itemlink . '">' . $thumburl . '</a>' . html_encode(get_language_string($albumitem->get("desc"), $locale)) . ']]>';
            $datecontent = '<![CDATA[' . sprintf(gettext("Date: %s"), zpFormattedDate(DATE_FORMAT, $albumitem->get('mtime'))) . ']]>';
        }
        $ext = strtolower(strrchr($thumb->filename, "."));
    }
    $mimetype = getMimeType($ext);
    ?>
<item>
<title><?php 
    if ($rssmode != "albums") {
        html_encode(printf('%1$s (%2$s)', get_language_string($item->get("title"), $locale), get_language_string($albumobj->get("title"), $locale)));
    } else {
        echo html_encode($imagenumber);
    }
    ?>
</title>
<link>
Esempio n. 13
0
</managingEditor>
<webMaster><?php 
echo "{$adminemail} ({$adminname})";
?>
</webMaster>
<?php 
$result = getImageStatistic($items, getOption("feed_sortorder"), $albumfolder, $collection);
foreach ($result as $image) {
    $ext = strtolower(strrchr($image->filename, "."));
    $albumobj = $image->getAlbum();
    $imagelink = $host . WEBPATH . $albumpath . $albumobj->name . $imagepath . $image->filename . $modrewritesuffix;
    $fullimagelink = $host . WEBPATH . "/albums/" . $albumobj->name . "/" . $image->filename;
    $thumburl = '<img border="0" src="' . $image->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, TRUE) . '" alt="' . $image->getTitle() . '" />';
    $imagecontent = '<![CDATA[<a title="' . $image->getTitle() . ' in ' . $albumobj->getTitle() . '" href="http://' . $imagelink . '">' . $thumburl . '</a><p>' . $image->getDesc() . '</p>]]>';
    $videocontent = '<![CDATA[<a title="' . $image->getTitle() . ' in ' . $albumobj->getTitle() . '" href="http://' . $imagelink . '">' . $image->filename . '</a><p>' . $image->getDesc() . '</p>]]>';
    $datecontent = '<![CDATA[Date: ' . zpFormattedDate(getOption('date_format'), $image->get('mtime')) . ']]>';
    switch ($ext) {
        case ".flv":
            $mimetype = "video/x-flv";
            break;
        case ".mp3":
            $mimetype = "audio/mpeg";
            break;
        case ".mp4":
            $mimetype = "video/mpeg";
            break;
        case ".3gp":
            $mimetype = "video/3gpp";
            break;
        case ".mov":
            $mimetype = "video/quicktime";
Esempio n. 14
0
 /**
  * Creates a zip file of the album
  *
  * @param string $albumname album folder
  * @param bool fromcache if true, images will be the "sized" image in the cache file
  */
 static function create($albumname, $fromcache)
 {
     global $_zp_zip_list, $_zp_gallery, $defaultSize;
     $album = newAlbum($albumname);
     if (!$album->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumname)) {
         self::pageError(403, gettext("Forbidden"));
     }
     if (!$album->exists) {
         self::pageError(404, gettext('Album not found'));
     }
     $_zp_zip_list = array();
     if ($fromcache) {
         $opt = array('large_file_size' => 5 * 1024 * 1024, 'comment' => sprintf(gettext('Created from cached images of %1$s on %2$s.'), $album->name, zpFormattedDate(DATE_FORMAT, time())));
         loadLocalOptions(false, $_zp_gallery->getCurrentTheme());
         $defaultSize = getOption('image_size');
         self::AddAlbumCache($album, strlen($albumname), SERVERPATH . '/' . CACHEFOLDER . '/' . $albumname);
     } else {
         $opt = array('large_file_size' => 5 * 1024 * 1024, 'comment' => sprintf(gettext('Created from images in %1$s on %2$s.'), $album->name, zpFormattedDate(DATE_FORMAT, time())));
         self::AddAlbum($album, strlen($albumname), SERVERPATH . '/' . ALBUMFOLDER . '/' . $albumname);
     }
     $zip = new ZipStream($albumname . '.zip', $opt);
     foreach ($_zp_zip_list as $path => $file) {
         @set_time_limit(6000);
         $zip->add_file_from_path(internalToFilesystem($file), internalToFilesystem($path));
     }
     $zip->finish();
 }
Esempio n. 15
0
/**
 * Prints the x related articles based on a tag search
 *
 * @param int $number Number of items to get
 * @param string $type 'albums', 'images','news','pages', "all" for all combined.
 * @param string $specific If $type = 'albums' or 'images' name of album
 * @param bool $excerpt If a text excerpt (gallery items: description; Zenpage items: content) should be shown. NULL for none or number of length
 * @param bool $thumb For $type = 'albums' or 'images' if a thumb should be shown (default size as set on the options)
 */
function printRelatedItems($number = 5, $type = 'news', $specific = NULL, $excerpt = NULL, $thumb = false, $date = false)
{
    global $_zp_gallery, $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_page, $_zp_current_zenpage_news;
    $label = array('albums' => gettext('Albums'), 'images' => gettext('Images'), 'news' => gettext('News'), 'pages' => gettext('Pages'));
    $result = getRelatedItems($type, $specific);
    $resultcount = count($result);
    if ($resultcount != 0) {
        ?>
		<h3 class="relateditems">
			<?php 
        printf(gettext('Related %s'), $type);
        ?>
		</h3>
		<ul id="relateditems">
			<?php 
        $count = 0;
        foreach ($result as $item) {
            $count++;
            ?>
				<li class="<?php 
            echo $item['type'];
            ?>
">
					<?php 
            $category = '';
            switch ($item['type']) {
                case 'albums':
                    $obj = newAlbum($item['name']);
                    $url = $obj->getLink();
                    $text = $obj->getDesc();
                    $category = gettext('Album');
                    break;
                case 'images':
                    $alb = newAlbum($item['album']);
                    $obj = newImage($alb, $item['name']);
                    $url = $obj->getLink();
                    $text = $obj->getDesc();
                    $category = gettext('Image');
                    break;
                case 'news':
                    $obj = new ZenpageNews($item['name']);
                    $url = $obj->getLink();
                    $text = $obj->getContent();
                    $category = gettext('News');
                    break;
                case 'pages':
                    $obj = new ZenpagePage($item['name']);
                    $url = $obj->getLink();
                    $text = $obj->getContent();
                    $category = gettext('Page');
                    break;
            }
            ?>
					<?php 
            if ($thumb) {
                $thumburl = false;
                switch ($item['type']) {
                    case 'albums':
                        $thumburl = $obj->getThumb();
                        break;
                    case 'images':
                        $thumburl = $obj->getThumb();
                        break;
                }
                if ($thumburl) {
                    ?>
							<a href="<?php 
                    echo html_encode(pathurlencode($url));
                    ?>
" title="<?php 
                    echo html_encode($obj->getTitle());
                    ?>
" class="relateditems_thumb">
								<img src="<?php 
                    echo html_encode(pathurlencode($thumburl));
                    ?>
" alt="<?php 
                    echo html_encode($obj->getTitle());
                    ?>
" />
							</a>
							<?php 
                }
            }
            ?>
					<h4><a href="<?php 
            echo html_encode(pathurlencode($url));
            ?>
" title="<?php 
            echo html_encode($obj->getTitle());
            ?>
"><?php 
            echo html_encode($obj->getTitle());
            ?>
</a>
						<?php 
            if ($date) {
                switch ($item['type']) {
                    case 'albums':
                    case 'images':
                        $d = $obj->getDateTime();
                        break;
                    case 'news':
                    case 'pages':
                        $d = $obj->getDateTime();
                        break;
                }
                ?>
							<span class="relateditems_date">
								<?php 
                echo zpFormattedDate(DATE_FORMAT, strtotime($d));
                ?>
							</span>
							<?php 
            }
            ?>
						<?php 
            if ($type == 'all') {
                ?>
 (<small><?php 
                echo $category;
                ?>
</small>)<?php 
            }
            ?>

					</h4>
					<?php 
            if ($excerpt) {
                echo shortenContent($text, $excerpt, '...', true);
            }
            ?>
				</li>
				<?php 
            if ($count == $number) {
                break;
            }
        }
        // foreach
        if ($count) {
            ?>
			</ul>
			<?php 
        }
    }
}
Esempio n. 16
0
function zpArdoise_printImageStatistic($number, $option, $albumfolder = '', $showtitle = false, $showdate = false, $showdesc = false, $desclength = 40, $showstatistic = '', $width = NULL, $height = NULL, $crop = NULL, $collection = false, $fullimagelink = false, $threshold = 0, $a_class = NULL)
{
    $images = getImageStatistic($number, $option, $albumfolder, $collection, $threshold);
    if (is_null($crop) && is_null($width) && is_null($height)) {
        $crop = 2;
    } else {
        if (is_null($width)) {
            $width = 85;
        }
        if (is_null($height)) {
            $height = 85;
        }
        if (is_null($crop)) {
            $crop = 1;
        } else {
            $crop = (int) $crop && true;
        }
    }
    echo "\n<div id=\"{$option}\">\n";
    echo "<ul>";
    foreach ($images as $image) {
        if ($fullimagelink) {
            $aa_class = ' class="' . $a_class . '"';
            $imagelink = $image->getFullImageURL();
        } else {
            $aa_class = NULL;
            $imagelink = $image->getLink();
        }
        echo "<li><a href=\"" . html_encode(pathurlencode($imagelink)) . "\"" . $aa_class . " title=\"" . html_encode($image->getTitle()) . "\">\n";
        switch ($crop) {
            case 0:
                echo "<img src=\"" . html_encode(pathurlencode($image->getCustomImage($width, NULL, NULL, NULL, NULL, NULL, NULL, TRUE))) . "\" alt=\"" . html_encode($image->getTitle()) . "\" /></a>\n";
                break;
            case 1:
                echo "<img src=\"" . html_encode(pathurlencode($image->getCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, TRUE))) . "\" alt=\"" . html_encode($image->getTitle()) . "\" width=\"" . $width . "\" height=\"" . $height . "\" /></a>\n";
                break;
            case 2:
                echo "<img src=\"" . html_encode(pathurlencode($image->getThumb())) . "\" alt=\"" . html_encode($image->getTitle()) . "\" /></a>\n<br />";
                break;
        }
        if ($showtitle) {
            echo "<h3><a href=\"" . html_encode(pathurlencode($image->getLink())) . "\" title=\"" . html_encode($image->getTitle()) . "\">\n";
            echo $image->getTitle() . "</a></h3>\n";
        }
        if ($showdate) {
            echo "<p>" . zpFormattedDate(DATE_FORMAT, strtotime($image->getDateTime())) . "</p>";
        }
        if ($showstatistic === "rating" or $showstatistic === "rating+hitcounter") {
            $votes = $image->get("total_votes");
            $value = $image->get("total_value");
            if ($votes != 0) {
                $rating = round($value / $votes, 1);
            }
            echo "<p>" . sprintf(gettext('Rating: %1$u (Votes: %2$u)'), $rating, $votes) . "</p>";
        }
        if ($showstatistic === "hitcounter" or $showstatistic === "rating+hitcounter") {
            $hitcounter = $image->get("hitcounter");
            if (empty($hitcounter)) {
                $hitcounter = "0";
            }
            echo "<p>" . sprintf(gettext("Views: %u"), $hitcounter) . "</p>";
        }
        if ($showdesc) {
            echo html_encodeTagged(shortenContent($image->getDesc(), $desclength, ' (...)'));
        }
        echo "</li>";
    }
    echo "</ul></div>\n";
}
Esempio n. 17
0
function printNews()
{
    ?>
	<div class="box overview-utility">
		<h2 class="h2_bordered"><?php 
    echo gettext("News from Zenphoto.org");
    ?>
</h2>
		<?php 
    if (is_connected()) {
        require_once dirname(__FILE__) . '/zenphoto_news/rsslib.php';
        require_once SERVERPATH . '/' . ZENFOLDER . '/template-functions.php';
        $recents = RSS_Retrieve("http://www.zenphoto.org/index.php?rss=news&withimages");
        if ($recents) {
            $opened = false;
            $recents = array_slice($recents, 1, 5);
            $shorten = getOption('zenphoto_news_length');
            foreach ($recents as $article) {
                $type = $article["type"];
                if ($type == 0) {
                    if ($opened) {
                        ?>
						</ul>
						<?php 
                        $opened = false;
                    }
                    ?>
					<b />
					<?php 
                } else {
                    if (!$opened) {
                        ?>
						<ul>
							<?php 
                        $opened = true;
                    }
                }
                $title = $article["title"];
                $date = zpFormattedDate(DATE_FORMAT, strtotime($article["pubDate"]));
                $link = $article["link"];
                if ($shorten) {
                    $description = shortenContent($article["description"], $shorten, '...');
                } else {
                    $description = false;
                }
                ?>
					<li><a href="<?php 
                echo $link;
                ?>
"><strong><?php 
                echo $title;
                ?>
</strong> (<?php 
                echo $date;
                ?>
)</a>
						<?php 
                if ($description != false) {
                    ?>
							<br />
							<?php 
                    echo $description;
                }
                ?>
					</li>
					<?php 
                if ($type == 0) {
                    ?>
						<br />
						<?php 
                }
            }
            if ($opened) {
                ?>
				</ul>
				<?php 
            }
        } else {
            ?>
			<ul>
				<li><?php 
            printf(gettext('Failed to retrieve link <em>%s</em>'), 'http://www.zenphoto.org/index.php?rss=news&withimages');
            ?>
</li>
			</ul>
			<?php 
        }
    } else {
        ?>
		<ul>
			<li><?php 
        echo gettext('A connection to <em>Zenphoto.org</em> could not be established.');
        ?>
			</li>
		</ul>
		<?php 
    }
    ?>
	</div>
	<?php 
}
Esempio n. 18
0
/**
 * Simple SQL timestamp formatting function.
 *
 * @param string $format formatting template
 * @param int $mytimestamp timestamp
 * @return string
 */
function myts_date($format, $mytimestamp)
{
    $timezoneadjust = getOption('time_offset');
    $month = substr($mytimestamp, 4, 2);
    $day = substr($mytimestamp, 6, 2);
    $year = substr($mytimestamp, 0, 4);
    $hour = substr($mytimestamp, 8, 2);
    $min = substr($mytimestamp, 10, 2);
    $sec = substr($mytimestamp, 12, 2);
    $epoch = mktime($hour + $timezoneadjust, $min, $sec, $month, $day, $year);
    $date = zpFormattedDate($format, $epoch);
    return $date;
}
Esempio n. 19
0
foreach ($news as $n) {
    $link = getNewsURL($n['titlelink']);
    ?>
			
	<div class="news">
		<div class="news-header"> 
			<div class="news-date-placeholder">
				<span class="left">Latest note: <a href="<?php 
    echo $link;
    ?>
"><?php 
    echo $n['title'];
    ?>
</a></span>
				<div class="opa40 right"><b>: </b><?php 
    echo zpFormattedDate('%Y %b, %e', strtotime($n['date']));
    ?>
</div>
			</div>
			<div class="clear"></div>
		</div>
		<div class="news-content-placeholder">
			<?php 
    echo $n['content'];
    ?>
		</div>
		<div class="clear"></div>	
	</div>
<?php 
}
?>
/**
 * Returns the last change date of a page if available
 *
 * @return string
 */
function getPageLastChangeDate()
{
    global $_zp_current_zenpage_page;
    if (!is_null($_zp_current_zenpage_page)) {
        $d = $_zp_current_zenpage_page->getLastchange();
        return zpFormattedDate(DATE_FORMAT, strtotime($d));
    }
    return false;
}
Esempio n. 21
0
 /**
  * Creates a zip file of the album
  *
  * @param object $album album folder
  * @param string $zipname name of zip file
  * @param bool fromcache if true, images will be the "sized" image in the cache file
  */
 static function create($album, $zipname, $fromcache)
 {
     global $_zp_zip_list, $_zp_albums_visited_albumMenu, $_zp_gallery, $defaultSize;
     if (!$album->exists) {
         self::pageError(404, gettext('Album not found'));
     }
     if (!$album->checkAccess()) {
         self::pageError(403, gettext("Forbidden"));
     }
     $_zp_albums_visited_albumMenu = $_zp_zip_list = array();
     if ($fromcache) {
         $opt = array('large_file_size' => 5 * 1024 * 1024, 'comment' => sprintf(gettext('Created from cached images of %1$s on %2$s.'), $album->name, zpFormattedDate(DATE_FORMAT, time())));
         $defaultSize = getThemeOption('image_size', NULL, $_zp_gallery->getCurrentTheme());
     } else {
         $defaultSize = NULL;
         $opt = array('large_file_size' => 5 * 1024 * 1024, 'comment' => sprintf(gettext('Created from images in %1$s on %2$s.'), $album->name, zpFormattedDate(DATE_FORMAT, time())));
     }
     self::AddAlbum($album, $fromcache);
     if (class_exists('ZipArchive')) {
         $zipfileFS = tempnam('', 'zip');
         $zip = new ZipArchive();
         $zip->open($zipfileFS, ZipArchive::CREATE);
         foreach ($_zp_zip_list as $path => $file) {
             @set_time_limit(6000);
             $zip->addFile($path, internalToFilesystem(trim($file, '/')));
         }
         $zip->close();
         ob_get_clean();
         header("Pragma: public");
         header("Expires: 0");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Cache-Control: private", false);
         header("Content-Type: application/zip");
         header("Content-Disposition: attachment; filename=" . basename($zipname . '.zip') . ";");
         header("Content-Transfer-Encoding: binary");
         header("Content-Length: " . filesize($zipfileFS));
         readfile($zipfileFS);
         // remove zip file from temp path
         unlink($zipfileFS);
     } else {
         require_once SERVERPATH . '/' . ZENFOLDER . '/lib-zipStream.php';
         $zip = new ZipStream(internalToFilesystem($zipname) . '.zip', $opt);
         foreach ($_zp_zip_list as $path => $file) {
             @set_time_limit(6000);
             $zip->add_file_from_path(internalToFilesystem($file), $path);
         }
         $zip->finish();
     }
 }