예제 #1
0
파일: 404.php 프로젝트: rb26/zenphoto
<?php

// force UTF-8// Ø
list($album, $image) = rewrite_get_album_image('album', 'image');
$folders = explode('/', $album);
if (array_key_exists(0, $folders) && $folders[0] == CACHEFOLDER) {
    // a failed reference to a cached image?
    require_once SERVERPATH . '/' . ZENFOLDER . '/admin-functions.php';
    require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/cacheManager/functions.php';
    unset($folders[0]);
    list($image, $args) = getImageProcessorURIFromCacheName(implode('/', $folders) . '/' . $image, getWatermarks());
    if (file_exists(getAlbumFolder() . $image)) {
        $uri = getImageURI($args, dirname($image), basename($image), NULL);
        header("HTTP/1.0 302 Found");
        header("Status: 302 Found");
        header('Location: ' . $uri);
        exitZP();
    }
}
if (isset($_GET['fromlogout'])) {
    header("HTTP/1.0 302 Found");
    header("Status: 302 Found");
    header('Location: ' . WEBPATH . '/index.php');
    exitZP();
}
$obj = @$_zp_gallery_page;
$_zp_gallery_page = '404.php';
if (isset($_index_theme)) {
    $_zp_script = SERVERPATH . "/" . THEMEFOLDER . '/' . internalToFilesystem($_index_theme) . '/404.php';
} else {
    $_zp_script = NULL;
예제 #2
0
 /**
  *  Get a custom sized version of this image based on the parameters.
  *
  * @param string $alt Alt text for the url
  * @param int $size size
  * @param int $width width
  * @param int $height height
  * @param int $cropw crop width
  * @param int $croph crop height
  * @param int $cropx crop x axis
  * @param int $cropy crop y axis
  * @param string $class Optional style class
  * @param string $id Optional style id
  * @param bool $thumbStandin set to true to treat as thumbnail
  * @param bool $effects ignored
  * @return string
  */
 function getCustomImage($size, $width, $height, $cropw, $croph, $cropx, $cropy, $thumbStandin = false, $effects = NULL)
 {
     if ($thumbStandin) {
         $wmt = getOption('Video_watermark');
         if (empty($wmt)) {
             $wmt = getWatermarkParam($this, WATERMARK_THUMB);
         }
     } else {
         $wmt = NULL;
     }
     if ($thumbStandin & 1) {
         $args = array($size, $width, $height, $cropw, $croph, $cropx, $cropy, NULL, $thumbStandin, NULL, $thumbStandin, NULL, NULL, NULL);
         if ($this->objectsThumb == NULL) {
             $filename = makeSpecialImageName($this->getThumbImageFile());
             if (!getOption('video_watermark_default_images')) {
                 $args[11] = '!';
             }
             $mtime = NULL;
         } else {
             $filename = filesystemToInternal($this->objectsThumb);
             $mtime = filemtime(ALBUM_FOLDER_SERVERPATH . '/' . internalToFilesystem($this->imagefolder) . '/' . $this->objectsThumb);
         }
         return getImageURI($args, $this->album->name, $filename, $this->filemtime);
     } else {
         $args = getImageParameters(array($size, $width, $height, $cropw, $croph, $cropx, $cropy, NULL, $thumbStandin, NULL, $thumbStandin, $wmt, NULL, $effects), $this->album->name);
         $filename = $this->filename;
         return getImageURI($args, $this->album->name, $filename, $this->filemtime);
     }
 }
예제 #3
0
 /**
  * Searches out i.php image links and replaces them with cache links if image is cached
  * @param string $text
  * @return string
  */
 static function updateImageProcessorLink($text)
 {
     if (is_string($text) && preg_match('/^a:[0-9]+:{/', $text)) {
         //	serialized array
         $text = getSerializedArray($text);
         $serial = true;
     } else {
         $serial = false;
     }
     if (is_array($text)) {
         foreach ($text as $key => $textelement) {
             $text[$key] = self::updateImageProcessorLink($textelement);
         }
         if ($serial) {
             $text = serialize($text);
         }
     } else {
         preg_match_all('|<\\s*img.*?\\ssrc\\s*=\\s*"([^"]*)?|', $text, $matches);
         foreach ($matches[1] as $key => $match) {
             preg_match('|.*i\\.php\\?(.*)|', $match, $imgproc);
             if ($imgproc) {
                 $match = preg_split('~\\&[amp;]*~', $imgproc[1]);
                 $set = array();
                 foreach ($match as $v) {
                     $s = explode('=', $v);
                     $set[$s[0]] = $s[1];
                 }
                 $args = getImageArgs($set);
                 $imageuri = getImageURI($args, urldecode($set['a']), urldecode($set['i']), NULL);
                 if (strpos($imageuri, 'i.php') === false) {
                     $text = str_replace($matches[1][$key], $imageuri, $text);
                 }
             }
         }
     }
     return $text;
 }
예제 #4
0
/**
 * Returns an url to the password protected/watermarked current image
 *
 * @param object $image optional image object overrides the current image
 * @param string $disposal set to override the 'protect_full_image' option
 * @return string
 * */
function getProtectedImageURL($image = NULL, $disposal = NULL)
{
    global $_zp_current_image;
    if (is_null($disposal)) {
        $disposal = getOption('protect_full_image');
    }
    if ($disposal == 'No access') {
        return NULL;
    }
    if (is_null($image)) {
        if (!in_context(ZP_IMAGE)) {
            return false;
        }
        if (is_null($_zp_current_image)) {
            return false;
        }
        $image = $_zp_current_image;
    }
    $album = $image->getAlbum();
    $watermark_use_image = getWatermarkParam($image, WATERMARK_FULL);
    if (!empty($watermark_use_image)) {
        $wmt = $watermark_use_image;
    } else {
        $wmt = false;
    }
    $args = array('FULL', NULL, NULL, NULL, NULL, NULL, NULL, (int) getOption('full_image_quality'), NULL, NULL, NULL, $wmt, false, NULL, NULL);
    $cache_file = getImageCacheFilename($album->name, $image->filename, $args);
    $cache_path = SERVERCACHE . $cache_file;
    if ($disposal != 'Download' && OPEN_IMAGE_CACHE && file_exists($cache_path)) {
        return WEBPATH . '/' . CACHEFOLDER . pathurlencode(imgSrcURI($cache_file));
    } else {
        if ($disposal == 'Unprotected') {
            return getImageURI($args, $album->name, $image->filename, $image->filemtime);
        } else {
            $params = '&q=' . getOption('full_image_quality');
            if (!empty($watermark_use_image)) {
                $params .= '&wmk=' . $watermark_use_image;
            }
            if ($disposal) {
                $params .= '&dsp=' . $disposal;
            }
            $params .= '&check=' . sha1(HASH_SEED . serialize($args));
            if (is_array($image->filename)) {
                $album = dirname($image->filename['source']);
                $image = basename($image->filename['source']);
            } else {
                $album = $album->name;
                $image = $image->filename;
            }
            return WEBPATH . '/' . ZENFOLDER . '/full-image.php?a=' . $album . '&i=' . $image . $params;
        }
    }
}
예제 #5
0
function loadAlbum($album)
{
    global $_zp_current_album, $_zp_current_image, $_zp_gallery, $custom, $enabled;
    $subalbums = $album->getAlbums();
    $started = false;
    $tcount = $count = 0;
    foreach ($subalbums as $folder) {
        $subalbum = newAlbum($folder);
        if (!$subalbum->isDynamic()) {
            $tcount = $tcount + loadAlbum($subalbum);
        }
    }
    $theme = $_zp_gallery->getCurrentTheme();
    $id = 0;
    $parent = getUrAlbum($album);
    $albumtheme = $parent->getAlbumTheme();
    if (!empty($albumtheme)) {
        $theme = $albumtheme;
        $id = $parent->getID();
    }
    loadLocalOptions($id, $theme);
    $_zp_current_album = $album;
    if ($album->getNumImages() > 0) {
        echo "<br />" . $album->name . ' ';
        while (next_image(true)) {
            if (isImagePhoto($_zp_current_image)) {
                $countit = 0;
                if (in_array('*', $enabled)) {
                    $uri = getFullImageURL(NULL, 'Protected view');
                    if (strpos($uri, 'full-image.php?') !== false) {
                        if (!($count + $countit)) {
                            echo "{ ";
                        } else {
                            echo ' | ';
                        }
                        $countit = 1;
                        ?>
						<a href="<?php 
                        echo html_encode($uri);
                        ?>
&amp;debug">
							<?php 
                        echo '<img src="' . html_encode(pathurlencode($uri)) . '" height="30" width="30" alt="X" />' . "\n";
                        ?>
						</a>
						<?php 
                    }
                }
                foreach ($custom as $key => $cacheimage) {
                    if (in_array($key, $enabled)) {
                        $size = isset($cacheimage['image_size']) ? $cacheimage['image_size'] : NULL;
                        $width = isset($cacheimage['image_width']) ? $cacheimage['image_width'] : NULL;
                        $height = isset($cacheimage['image_height']) ? $cacheimage['image_height'] : NULL;
                        $thumbstandin = isset($cacheimage['thumb']) ? $cacheimage['thumb'] : NULL;
                        if ($special = $thumbstandin === true) {
                            list($special, $cw, $ch, $cx, $cy) = $_zp_current_image->getThumbCropping($size, $width, $height);
                        }
                        if (!$special) {
                            $cw = isset($cacheimage['crop_width']) ? $cacheimage['crop_width'] : NULL;
                            $ch = isset($cacheimage['crop_height']) ? $cacheimage['crop_height'] : NULL;
                            $cx = isset($cacheimage['crop_x']) ? $cacheimage['crop_x'] : NULL;
                            $cy = isset($cacheimage['crop_y']) ? $cacheimage['crop_y'] : NULL;
                        }
                        $effects = isset($cacheimage['gray']) ? $cacheimage['gray'] : NULL;
                        if (isset($cacheimage['wmk'])) {
                            $passedWM = $cacheimage['wmk'];
                        } else {
                            if ($thumbstandin) {
                                $passedWM = getWatermarkParam($_zp_current_image, WATERMARK_THUMB);
                            } else {
                                $passedWM = getWatermarkParam($_zp_current_image, WATERMARK_IMAGE);
                            }
                        }
                        if (isset($cacheimage['maxspace'])) {
                            getMaxSpaceContainer($width, $height, $_zp_current_image, $thumbstandin);
                        }
                        $args = array($size, $width, $height, $cw, $ch, $cx, $cy, NULL, $thumbstandin, NULL, $thumbstandin, $passedWM, NULL, $effects);
                        $args = getImageParameters($args, $album->name);
                        $uri = getImageURI($args, $album->name, $_zp_current_image->filename, $_zp_current_image->filemtime);
                        if (strpos($uri, 'i.php?') !== false) {
                            if (!($count + $countit)) {
                                echo "{ ";
                            } else {
                                echo ' | ';
                            }
                            $countit = 1;
                            ?>
							<a href="<?php 
                            echo html_encode($uri);
                            ?>
&amp;debug">
								<?php 
                            if ($thumbstandin) {
                                echo '<img src="' . html_encode(pathurlencode($uri)) . '" height="15" width="15" alt="x" />' . "\n";
                            } else {
                                echo '<img src="' . html_encode(pathurlencode($uri)) . '" height="20" width="20" alt="X" />' . "\n";
                            }
                            ?>
							</a>
							<?php 
                        }
                    }
                }
                $count = $count + $countit;
            }
        }
        if ($count) {
            echo '
						} ';
        }
        printf(ngettext('[%u image]', '[%u images]', $count), $count);
        echo "<br />\n";
    }
    return $count + $tcount;
}
예제 #6
0
 /**
  * Get a default-sized thumbnail of this image.
  *
  * @return string
  */
 function getThumb($type = 'image', $wmt = NULL)
 {
     $ts = getOption('thumb_size');
     if (getOption('thumb_crop')) {
         $sw = getOption('thumb_crop_width');
         $sh = getOption('thumb_crop_height');
         list($custom, $cw, $ch, $cx, $cy) = $this->getThumbCropping($ts, $sw, $sh);
         if ($custom) {
             return $this->getCustomImage(NULL, $sw, $sh, $cw, $ch, $cx, $cy, true);
         }
     } else {
         $sw = $sh = NULL;
     }
     if (empty($wmt)) {
         $wmt = getWatermarkParam($this, WATERMARK_THUMB);
     }
     $args = getImageParameters(array($ts, NULL, NULL, $sw, $sh, NULL, NULL, NULL, true, NULL, true, $wmt, NULL, NULL), $this->album->name);
     return getImageURI($args, $this->album->name, $this->filename, $this->filemtime);
 }