Ejemplo n.º 1
0
function printHeadingImage($randomImage)
{
    global $_zp_themeroot;
    $id = getAlbumId();
    echo '<div id="randomhead">';
    if (is_null($randomImage) || checkforPassword(true)) {
        echo '<img src="' . $_zp_themeroot . '/images/zen-logo.jpg" alt="' . gettext('There were no images from which to select the random heading.') . '" />';
    } else {
        $randomAlbum = $randomImage->getAlbum();
        $randomAlt1 = $randomAlbum->getTitle();
        if ($randomAlbum->getAlbumId() != $id) {
            $randomAlbum = $randomAlbum->getParent();
            while (!is_null($randomAlbum) && $randomAlbum->getAlbumId() != $id) {
                $randomAlt1 = $randomAlbum->getTitle() . ":\n" . $randomAlt1;
                $randomAlbum = $randomAlbum->getParent();
            }
        }
        $randomImageURL = htmlspecialchars(getURL($randomImage));
        if (getOption('allow_upscale')) {
            $wide = 620;
            $high = 180;
        } else {
            $wide = min(620, $randomImage->getWidth());
            $high = min(180, $randomImage->getHeight());
        }
        echo "<a href='" . $randomImageURL . "' title='" . gettext('Random picture...') . "'><img src='" . htmlspecialchars($randomImage->getCustomImage(NULL, $wide, $high, $wide, $high, NULL, NULL, !getOption('Watermark_head_image'))) . "' width={$wide} height={$high} alt=" . '"' . htmlspecialchars($randomAlt1, ENT_QUOTES) . ":\n" . htmlspecialchars($randomImage->getTitle(), ENT_QUOTES) . '" /></a>';
    }
    echo '</div>';
}
Ejemplo n.º 2
0
/**
 * Prints the logout link if the user is logged in.
 * This is for album passwords only, not admin users;
 *
 * @param string $before before text
 * @param string $after after text
 * @param bool $showLoginForm set to true to display a login form if no one is logged in
 */
function printUserLogout($before = '', $after = '', $showLoginForm = false)
{
    global $cookies;
    if ($showLoginForm) {
        $showLoginForm = !checkforPassword(true);
    }
    if (empty($cookies)) {
        if ($showLoginForm) {
            printPasswordForm('', false);
        }
    } else {
        echo $before . '<a href="?userlog=0" title="' . gettext("logout") . '" >' . gettext("logout") . '</a>' . $after;
    }
}
Ejemplo n.º 3
0
                }
            }
            ?>
 					</div> <!-- images -->
 					</div> <!-- main -->
	 			<div class="clearage"></div>
 					<?php 
            if (isset($firstImage)) {
                printNofM('Photo', $firstImage, $lastImage, getNumImages());
            }
            ?>
		</div> <!-- content -->
			<?php 
        } else {
            /* flash */
            if (($imagePage = isImagePage()) && !checkforPassword()) {
                ?>
<!-- Simpleviewer section -->
			<div id="flash">
					<p align="center">
			<font color=#663300><?php 
                echo gettext('For the best viewing experience') . ' ';
                ?>
<a href="http://www.macromedia.com/go/getflashplayer/"><?php 
                echo gettext('Get Adobe Flash.');
                ?>
</a></font>
			</p>
						<p align="center">
 						<?php 
                if ($imagePage) {
Ejemplo n.º 4
0
 */
// force UTF-8 Ø
/* Prevent hotlinking to the full image from other servers. */
$server = $_SERVER['SERVER_NAME'];
if (isset($_SERVER['HTTP_REFERER'])) {
    $test = strpos($_SERVER['HTTP_REFERER'], $server);
} else {
    $test = true;
}
if ($test == FALSE && getOption('hotlink_protection')) {
    /* It seems they are directly requesting the full image. */
    $image = 'index.php?album=' . $_zp_current_album->name . '&image=' . $_zp_current_image->filename;
    header("Location: {$image}");
    exit;
}
if (checkforPassword(true)) {
    pageError(403, gettext("Forbidden"));
    exit;
}
require_once dirname(__FILE__) . '/functions-image.php';
$image_path = $_zp_current_image->localpath;
$suffix = strtolower(substr(strrchr($image_path, "."), 1));
$cache_file = $_zp_current_album->name . "/" . substr($_zp_current_image->filename, 0, -strlen($suffix) - 1) . '_FULL.' . $suffix;
switch ($suffix) {
    case 'bmp':
        $suffix = 'wbmp';
        break;
    case 'jpg':
        $suffix = 'jpeg';
        break;
    case 'png':
/**
 * Prints the search form
 *
 * Search works on a list of tokens entered into the search form.
 *
 * Tokens may be part of boolean expressions using &, |, !, and parens. (Comma is retained as a synonom of | for
 * backwords compatibility.) If tokens are separated by spaces, the OR function is presumed.
 *
 * Tokens may be enclosed in quotation marks to create exact pattern matches or to include the boolean operators and
 * parens as part of the tag..
 *
 * @param string $prevtext text to go before the search form
 * @param string $id css id for the search form, default is 'search'
 * @param string $buttonSource optional path to the image for the button
 * @param string $buttontext optional text for the button ("Search" will be the default text)
 * @param string $iconsource optional theme based icon for the search fields toggle
 * @since 1.1.3
 */
function printSearchForm($prevtext = NULL, $id = 'search', $buttonSource = NULL, $buttontext = '', $iconsource = NULL)
{
    global $_zp_adminJS_loaded;
    if (empty($buttontext)) {
        $buttontext = gettext("Search");
    } else {
        $buttontext = sanitize($buttontext);
    }
    if (checkforPassword(true)) {
        return;
    }
    $zf = WEBPATH . "/" . ZENFOLDER;
    $dataid = $id . '_data';
    $searchwords = isset($_POST['words']) ? html_encode(sanitize($_REQUEST['words'], 0), false) : '';
    $fields = getOption('search_fields');
    if (empty($buttonSource)) {
        $type = 'submit';
    } else {
        $buttonSource = 'src="' . $buttonSource . '" alt="' . $buttontext . '"';
        $type = 'image';
    }
    if (empty($iconsource)) {
        $iconsource = WEBPATH . '/' . ZENFOLDER . '/images/searchfields_icon.png';
    }
    if (getOption('mod_rewrite')) {
        $searchurl = '/page/search/';
    } else {
        $searchurl = "/index.php?p=search";
    }
    $engine = new SearchEngine();
    $fields = array_flip($engine->allowedSearchFields());
    if (!$_zp_adminJS_loaded) {
        $_zp_adminJS_loaded = true;
        ?>
		<script type="text/javascript" src="<?php 
        echo WEBPATH . '/' . ZENFOLDER;
        ?>
/js/admin.js"></script>
	<?php 
    }
    ?>
	<div id="search"><!-- search form -->

	<form method="post" action="<?php 
    echo WEBPATH . $searchurl;
    ?>
" id="search_form">
	<?php 
    echo $prevtext;
    ?>
	<input type="text" name="words" value="<?php 
    echo $searchwords;
    ?>
" id="search_input" size="10" />
	<?php 
    if (count($fields) > 1) {
        ?>
		<a href="javascript: toggle('searchextrashow');"><img src="<?php 
        echo $iconsource;
        ?>
" alt="<?php 
        echo gettext('select search fields');
        ?>
" id="searchfields_icon" /></a>
	<?php 
    }
    ?>
	<input type="<?php 
    echo $type;
    ?>
" value="<?php 
    echo $buttontext;
    ?>
" class="pushbutton" id="search_submit" <?php 
    echo $buttonSource;
    ?>
 />
	<br />
	<?php 
    if (count($fields) > 1) {
        natcasesort($fields);
        $fields = array_flip($fields);
        $query_fields = $engine->parseQueryFields();
        ?>
		<ul style="display:none;" id="searchextrashow">
		<?php 
        foreach ($fields as $key => $item) {
            echo '<li><label for="_SEARCH_' . $item . '"><input id="_SEARCH_' . $item . '" name="_SEARCH_' . $item . '" type="checkbox"';
            if ($item & $query_fields) {
                echo ' checked="checked" ';
            }
            echo ' value="' . $item . '"  /> ' . $key . "</label></li>" . "\n";
        }
        ?>
		</ul>
		<?php 
    }
    ?>
	</form>
	</div><!-- end of search form -->
	<?php 
}