static function load_request($allow) { $uri = getRequestURI(); $parts = explode('?', $uri); $uri = $parts[0]; $path = ltrim(substr($uri, strlen(WEBPATH) + 1), '/'); if (empty($path)) { return $allow; } else { $rest = strpos($path, '/'); if ($rest === false) { if (strpos($path, '?') === 0) { // only a parameter string return $allow; } $l = $path; } else { $l = substr($path, 0, $rest); } } $locale = validateLocale($l, 'seo_locale'); if ($locale) { // set the language cookie and redirect to the "base" url zp_setCookie('dynamic_locale', $locale); $uri = pathurlencode(preg_replace('|/' . $l . '[/$]|', '/', $uri)); if (isset($parts[1])) { $uri .= '?' . $parts[1]; } header("HTTP/1.0 302 Found"); header("Status: 302 Found"); header('Location: ' . $uri); exitZP(); } return $allow; }
function ratingJS() { $ME = substr(basename(__FILE__), 0, -4); ?> <script type="text/javascript" src="<?php echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/' . $ME; ?> /jquery.MetaData.js"></script> <script type="text/javascript" src="<?php echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/' . $ME; ?> /jquery.rating.js"></script> <?php $css = getPlugin('rating/jquery.rating.css', true, true); ?> <link rel="stylesheet" href="<?php echo pathurlencode($css); ?> " type="text/css" /> <script type="text/javascript"> // <!-- <![CDATA[ $.fn.rating.options = { cancel: '<?php echo gettext('retract'); ?> ' }; // ]]> --> </script> <?php }
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; }
function edit_crop_image($output, $image, $prefix, $subpage, $tagsort) { $album = $image->getAlbum(); $albumname = $album->name; $imagename = $image->filename; if (isImagePhoto($image)) { $output .= '<p class="buttons" >' . "\n" . '<a href="' . WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . '/crop_image.php?a=' . pathurlencode($albumname) . "\n" . '&i=' . urlencode($imagename) . '&performcrop=backend&subpage=' . $subpage . '&tagsort=' . $tagsort . '">' . "\n" . '<img src="images/shape_handles.png" alt="" />' . gettext("Crop image") . '</a>' . "\n" . '</p>' . "\n" . '<span style="line-height: 0em;"><br clear="all" /></span>' . "\n"; } return $output; }
/** * Returns the URL of any main page (image/album/page#/etc.) in any form * desired (rewrite or query-string). * @param $with_rewrite boolean or null, whether the returned path should be in rewrite form. * Defaults to null, meaning use the mod_rewrite configuration to decide. * @param $album : the Album object to use in the path. Defaults to the current album (if null). * @param $image : the Image object to use in the path. Defaults to the current image (if null). * @param $page : the page number to use in the path. Defaults to the current page (if null). */ function zpurl($with_rewrite = NULL, $album = NULL, $image = NULL, $page = NULL, $special = '') { global $_zp_current_album, $_zp_current_image, $_zp_page; // Set defaults if ($with_rewrite === NULL) { $with_rewrite = MOD_REWRITE; } if (!$album) { $album = $_zp_current_album; } if (!$image) { $image = $_zp_current_image; } if (!$page) { $page = $_zp_page; } $url = ''; if ($with_rewrite) { if (in_context(ZP_IMAGE)) { $encoded_suffix = implode('/', array_map('rawurlencode', explode('/', IM_SUFFIX))); $url = pathurlencode($album->name) . '/' . rawurlencode($image->filename) . $encoded_suffix; } else { if (in_context(ZP_ALBUM)) { $url = pathurlencode($album->name) . ($page > 1 ? '/page/' . $page : ''); } else { if (in_context(ZP_INDEX)) { $url = $page > 1 ? 'page/' . $page : ''; } } } } else { if (in_context(ZP_IMAGE)) { $url = 'index.php?album=' . pathurlencode($album->name) . '&image=' . rawurlencode($image->filename); } else { if (in_context(ZP_ALBUM)) { $url = 'index.php?album=' . pathurlencode($album->name) . ($page > 1 ? '&page=' . $page : ''); } else { if (in_context(ZP_INDEX)) { $url = 'index.php' . ($page > 1 ? '?page=' . $page : ''); } } } } if ($url == IM_SUFFIX || empty($url)) { $url = ''; } if (!empty($url) && !empty($special)) { if ($page > 1) { $url .= "&{$special}"; } else { $url .= "?{$special}"; } } return $url; }
function construct_path_links($path, $toplevelname) { $path = explode('/', rtrim('/' . $path, '/')); $apath = ''; $links = array(); foreach ($path as $n => $current) { $apath .= $current . ($n ? '/' : ''); $links[] = '<a href="./' . ($n ? '?dir=' . pathurlencode(rtrim($apath, '/')) : '') . '">' . htmlentities($n ? $current : $toplevelname) . '</a>/'; } return implode('', $links); }
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 JS() { // the scripts needed ?> <script type="text/javascript" src="<?php echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER; ?> /tag_suggest/encoder.js"></script> <script type="text/javascript" src="<?php echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER; ?> /tag_suggest/tag.js"></script> <?php $css = getPlugin('tag_suggest/tag.css', true, true); ?> <link type="text/css" rel="stylesheet" href="<?php echo pathurlencode($css); ?> " /> <?php $taglist = getAllTagsUnique(OFFSET_PATH ? false : NULL, OFFSET_PATH ? 0 : getOption('tag_suggest_threshold')); $tags = array(); foreach ($taglist as $tag) { $tags[] = addslashes($tag); } if (OFFSET_PATH || getOption('search_space_is') == 'OR') { $tagseparator = ' '; } else { $tagseparator = ','; } ?> <script type="text/javascript"> // <!-- <![CDATA[ var _tagList = ["<?php echo implode($tags, '","'); ?> "]; $(function () { $('#search_input, #edit-editable_4, .tagsuggest').tagSuggest({separator: '<?php echo $tagseparator; ?> ', tags: _tagList, quoteSpecial: <?php echo OFFSET_PATH ? 'false' : 'true'; ?> }) }); // ]]> --> </script> <?php }
static function edit($output, $image, $prefix, $subpage, $tagsort) { if (isImagePhoto($image)) { if (is_array($image->filename)) { $albumname = dirname($image->filename['source']); $imagename = basename($image->filename['source']); } else { $albumname = $image->albumlink; $imagename = $image->filename; } $output .= '<div class="button buttons tooltip" title="' . gettext('Permanently crop the actual image.') . '">' . "\n" . '<a href="' . WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . '/crop_image.php?a=' . pathurlencode($albumname) . "\n" . '&i=' . urlencode($imagename) . '&performcrop=backend&subpage=' . $subpage . '&tagsort=' . html_encode($tagsort) . '">' . "\n" . '<img src="images/shape_handles.png" alt="" />' . gettext("Crop image") . '</a>' . "\n" . '<br class="clearall" />' . '</div>' . "\n"; } return $output; }
function tagSuggestJS() { // the scripts needed ?> <script type="text/javascript" src="<?php echo WEBPATH . '/' . ZENFOLDER; ?> /js/encoder.js"></script> <script type="text/javascript" src="<?php echo WEBPATH . '/' . ZENFOLDER; ?> /js/tag.js"></script> <?php $css = getPlugin('tag_suggest/tag.css', true, true); ?> <link type="text/css" rel="stylesheet" href="<?php echo pathurlencode($css); ?> " /> <?php $taglist = getAllTagsUnique(); $c = 0; $list = ''; foreach ($taglist as $tag) { if ($c > 0) { $list .= ','; } $c++; $list .= '"' . addslashes(sanitize($tag, 3)) . '"'; } ?> <script type="text/javascript"> // <!-- <![CDATA[ var _tagList = [<?php echo $list; ?> ]; $(function () { $('#search_input, #edit-editable_4').tagSuggest({ separator:'<?php echo getOption('search_space_is') == 'OR' ? ' ' : ','; ?> ', tags: _tagList }) }); // ]]> --> </script> <?php }
function externalLinkBox($prior, $image, $prefix, $subpage, $tagsort) { if ($prior) { $prior .= '<br /><hr>'; } if (isset($_SESSION['externalLinksize_' . $prefix])) { $size = sanitize_numeric($_SESSION['externalLinksize_' . $prefix]); unset($_SESSION['externalLinksize_' . $prefix]); } else { $size = false; } $output = $img = ''; if ($size) { $link = $image->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); $img = ' <img src="' . html_encode(pathurlencode($link)) . '" height="15" width="15" />'; $output .= '<input type="text" style="width:100%" value="' . html_encode($link) . '" />'; } $output .= gettext('link for image of size:') . ' <input type="text" name="externalLinksize_' . $prefix . '" size="3" value="' . $size . '" />' . $img; return $prior . $output; }
/** * Creates a zip file of the album * * @param string $albumname album folder */ function createAlbumZip($albumname) { global $_zp_zip_list, $zip_gallery; $zip_gallery = new Gallery(); $album = new Album($zip_gallery, $albumname); if (!$album->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumname)) { pageError(403, gettext("Forbidden")); exit; } if (!$album->exists) { pageError(404, gettext('Album not found')); exit; } $persist = $zip_gallery->getPersistentArchive(); $dest = $album->localpath . '.zip'; if (!$persist || !file_exists($dest)) { include_once 'archive.php'; $curdir = getcwd(); chdir($album->localpath); $_zp_zip_list = array(); $z = new zip_file($dest); $z->set_options(array('basedir' => realpath($album->localpath . '/'), 'inmemory' => 0, 'recurse' => 0, 'storepaths' => 1)); zipAddAlbum($album, strlen($albumname), $z); $z->add_files($_zp_zip_list); $z->create_archive(); unset($_zp_zip_list); chdir($curdir); } header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="' . pathurlencode($albumname) . '.zip"'); header("Content-Length: " . filesize($dest)); printLargeFileContents($dest); if (!$persist) { unlink($dest); } unset($zip_gallery); unset($album); unset($persist); unset($dest); }
/** * Returns the content of the text file * * @param int $w optional width * @param int $h optional height * @return string */ function getContent($w = NULL, $h = NULL) { $this->updateDimensions(); if (is_null($w)) { $w = $this->getWidth(); } if (is_null($h)) { $h = $this->getHeight(); } $providers = array('' => '<img src="' . html_encode(pathurlencode($this->getThumb())) . '">', 'google' => '<iframe src="http://docs.google.com/viewer?url=%s&embedded=true" width="' . $w . 'px" height="' . $h . 'px" frameborder="0" border="none" scrolling="auto"></iframe>', 'zoho' => '<iframe src="http://viewer.zoho.com/api/urlview.do?url=%s&embed=true" width="' . $w . 'px" height="' . $h . 'px" frameborder="0" border="none" scrolling="auto"></iframe>', 'local' => '<iframe src="%s" width="' . $w . 'px" height="' . $h . 'px" frameborder="0" border="none" scrolling="auto"></iframe>'); switch ($suffix = getSuffix($this->filename)) { case 'ppt': $suffix = 'pps'; case 'tiff': $suffix = substr($suffix, 0, 3); case 'tif': case 'pps': case 'pdf': $provider = 'WEBdocs_' . $suffix . '_provider'; return sprintf($providers[getOption($provider)], html_encode($this->getFullImageURL(FULLWEBPATH))); default: // just in case we extend and are lazy... return '<img src="' . html_encode(pathurlencode($this->getThumb())) . '">'; } }
/** * 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 . pathurlencode($albumobj->getLink()); $thumb = $albumobj->getAlbumThumbImage(); $title = $albumobj->getTitle($this->locale); $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'] = $albumobj->getDesc($this->locale); $feeditem['title'] = $imagenumber; $feeditem['pubdate'] = date("r", strtotime($albumobj->getDateTime())); } else { if (isAlbumClass($item)) { $albumobj = $item; $thumb = $albumobj->getAlbumThumbImage(); } else { $albumobj = $item->getAlbum(); $thumb = $item; } $itemlink = $this->host . $item->getLink(); $title = $item->getTitle($this->locale); $feeditem['desc'] = $item->getDesc($this->locale); $feeditem['title'] = sprintf('%1$s (%2$s)', $item->getTitle($this->locale), $albumobj->getTitle($this->locale)); $feeditem['pubdate'] = date("r", strtotime($item->getDateTime())); } //link $feeditem['link'] = $itemlink; //category $feeditem['category'] = html_encode($albumobj->getTitle($this->locale)); //media content $feeditem['media_content'] = '<image url="' . PROTOCOL . '://' . html_encode($thumb->getCustomImage($this->imagesize, NULL, NULL, NULL, NULL, NULL, NULL, TRUE)) . '" />'; $feeditem['media_thumbnail'] = '<thumbnail url="' . PROTOCOL . '://' . html_encode($thumb->getThumb()) . '" />'; return $feeditem; }
/** * 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 true to inhibit watermarking * @return string */ function getCustomImage($size, $width, $height, $cropw, $croph, $cropx, $cropy, $thumbStandin = false) { if ($thumbStandin & 1) { if ($this->objectsThumb == NULL) { $filename = makeSpecialImageName($this->getThumbImageFile()); $path = ZENFOLDER . '/i.php?a=' . urlencode($this->album->name) . '&i=' . urlencode($filename); return WEBPATH . "/" . $path . ($size ? "&s={$size}" : "") . ($width ? "&w={$width}" : "") . ($height ? "&h={$height}" : "") . ($cropw ? "&cw={$cropw}" : "") . ($croph ? "&ch={$croph}" : "") . ($cropx ? "&cx={$cropx}" : "") . ($cropy ? "&cy={$cropy}" : "") . "&t=true"; } else { $filename = $this->objectsThumb; $wmt = getOption(get_class($this) . '_watermark'); if ($wmt) { $wmt = '&wmt=' . $wmt; } $cachefilename = getImageCacheFilename($alb = $this->album->name, $filename, getImageParameters(array($size, $width, $height, $cropw, $croph, $cropx, $cropy, NULL, NULL, NULL, $thumbStandin, NULL, NULL))); if (file_exists(SERVERCACHE . $cachefilename) && filemtime(SERVERCACHE . $cachefilename) > $this->filemtime) { return WEBPATH . substr(CACHEFOLDER, 0, -1) . pathurlencode(imgSrcURI($cachefilename)); } else { $path = ZENFOLDER . '/i.php?a=' . urlencode($alb) . '&i=' . urlencode($filename); if (substr($path, 0, 1) == "/") { $path = substr($path, 1); } return WEBPATH . "/" . $path . ($size ? "&s={$size}" : "") . ($width ? "&w={$width}" : "") . ($height ? "&h={$height}" : "") . ($cropw ? "&cw={$cropw}" : "") . ($croph ? "&ch={$croph}" : "") . ($cropx ? "&cx={$cropx}" : "") . ($cropy ? "&cy={$cropy}" : "") . "&t=true" . $wmt; } } } else { $filename = $this->filename; $cachefilename = getImageCacheFilename($this->album->name, $filename, getImageParameters(array($size, $width, $height, $cropw, $croph, $cropx, $cropy, NULL, NULL, NULL, $thumbStandin, NULL, NULL))); if (file_exists(SERVERCACHE . $cachefilename) && filemtime(SERVERCACHE . $cachefilename) > $this->filemtime) { return WEBPATH . substr(CACHEFOLDER, 0, -1) . pathurlencode(imgSrcURI($cachefilename)); } else { return WEBPATH . '/' . ZENFOLDER . '/i.php?a=' . urlencode($this->album->name) . '&i=' . urlencode($filename) . ($size ? "&s={$size}" : "") . ($width ? "&w={$width}" : "") . ($height ? "&h={$height}" : "") . ($cropw ? "&cw={$cropw}" : "") . ($croph ? "&ch={$croph}" : "") . ($cropx ? "&cx={$cropx}" : "") . ($cropy ? "&cy={$cropy}" : ""); } } }
/** * returns the content of the vido * * @param $w * @param $h * @return string */ function getContent($w = NULL, $h = NULL) { global $_zp_multimedia_extension; if (is_null($w)) { $w = $this->getWidth(); } if (is_null($h)) { $h = $this->getHeight(); } $ext = getSuffix($this->getFullImage()); switch ($ext) { default: return $_zp_multimedia_extension->getPlayerConfig($this, NULL, NULL, $w, $h); break; case '3gp': case 'mov': return '</a> <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="' . $w . '" height="' . $h . '" codebase="http://www.apple.com/qtactivex/qtplugin.cab"> <param name="src" value="' . pathurlencode($this->getFullImage()) . '"/> <param name="autoplay" value="false" /> <param name="type" value="video/quicktime" /> <param name="controller" value="true" /> <embed src="' . pathurlencode($this->getFullImage()) . '" width="' . $w . '" height="' . $h . '" scale="aspect" autoplay="false" controller"true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/" cache="true"></embed> </object><a>'; break; } }
/** * Prints a playlist using jPlayer. Several playlists per page supported. * * The playlist is meant to replace the 'next_image()' loop on a theme's album.php. * It can be used with a special 'album theme' that can be assigned to media albums with with .flv/.mp4/.mp3s, although Flowplayer 3 also supports images * Replace the entire 'next_image()' loop on album.php with this: * <?php printjPlayerPlaylist("playlist"); ?> or <?php printjPlayerPlaylist("playlist-audio"); ?> * * @param string $option "playlist" use for pure video and mixed video/audio playlists or if you want to show the poster/videothumb with audio only playlists, * "playlist-audio" use for pure audio playlists (m4a,mp3,fla supported only) if you don't need the poster/videothumb to be shown only. * @param string $albumfolder album name to get a playlist from directly */ function printjPlayerPlaylist($option = "playlist", $albumfolder = "") { global $_zp_current_album, $_zp_current_search; if (empty($albumfolder)) { if (in_context(ZP_SEARCH)) { $albumobj = $_zp_current_search; } else { $albumobj = $_zp_current_album; } } else { $albumobj = newAlbum($albumfolder); } $entries = $albumobj->getImages(0); if (($numimages = count($entries)) != 0) { switch ($option) { case 'playlist': $suffixes = array('m4a', 'm4v', 'mp3', 'mp4', 'flv', 'fla'); break; case 'playlist-audio': $suffixes = array('m4a', 'mp3', 'fla'); break; default: // an invalid option parameter! return; } $id = $albumobj->getID(); ?> <script type="text/javascript"> //<![CDATA[ $(document).ready(function(){ new jPlayerPlaylist({ jPlayer: "#jquery_jplayer_<?php echo $id; ?> ", cssSelectorAncestor: "#jp_container_<?php echo $id; ?> " }, [ <?php $count = ''; $number = ''; foreach ($entries as $entry) { $count++; if (is_array($entry)) { $ext = getSuffix($entry['filename']); } else { $ext = getSuffix($entry); } $numbering = ''; if (in_array($ext, $suffixes)) { $number++; if (getOption('jplayer_playlist_numbered')) { $numbering = '<span>' . $number . '</span>'; } $video = newImage($albumobj, $entry); $videoThumb = ''; $this->setModeAndSuppliedFormat($ext); if ($option == 'playlist' && getOption('jplayer_poster')) { $videoThumb = ',poster:"' . $video->getCustomImage(null, $this->width, $this->height, $this->width, $this->height, null, null, true) . '"'; } $playtime = ''; if (getOption('jplayer_playlist_playtime')) { $playtime = ' (' . $video->get('VideoPlaytime') . ')'; } ?> { title:"<?php echo $numbering . html_encode($video->getTitle()) . $playtime; ?> ", <?php if (getOption('jplayer_download')) { ?> free:true, <?php } ?> <?php echo $this->supplied; ?> :"<?php echo html_encode(pathurlencode($url = $video->getFullImageURL(FULLWEBPATH))); ?> " <?php echo $this->getCounterpartFiles($url, $ext); ?> <?php echo $videoThumb; ?> } <?php if ($numimages != $count) { echo ','; } } // if video } // foreach // for some reason the playlist must run with supplied: "flash,html" because otherwise neither videothumbs(poster) nor flv/flv work on Safari 4.1. // Seems the flash fallback fails here ?> ], { swfPath: "<?php echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER; ?> /jplayer/js", solution: "flash,html", <?php if ($option == 'playlist') { ?> supplied: "m4v, mp4, m4a, mp3, fla, flv<?php echo $this->supplied_counterparts; ?> " <?php } else { ?> supplied: "m4a, mp3, fla<?php echo $this->supplied_counterparts; ?> " <?php } if ($option != 'playlist-audio') { ?> , size: { width: "<?php echo $this->width; ?> px", height: "<?php echo $this->height; ?> px", cssClass: "<?php echo $this->playersize; ?> " } <?php } ?> useStateClassSkin: true, autoBlur: false, smoothPlayBar: true, keyEnabled: true, remainingDuration: true, toggleDuration: true }); }); //]]> </script> <?php if ($option == 'playlist') { ?> <div id="jp_container_<?php echo $id; ?> " class="jp-video <?php echo $this->playersize; ?> " role="application" aria-label="media player"> <div class="jp-type-playlist"> <div id="jquery_jplayer_<?php echo $id; ?> " class="jp-jplayer"></div> <div class="jp-gui"> <div class="jp-video-play"> <button class="jp-video-play-icon" role="button" tabindex="0"><?php echo gettext('play'); ?> </button> </div> <div class="jp-interface"> <div class="jp-progress"> <div class="jp-seek-bar"> <div class="jp-play-bar"></div> </div> </div> <div class="jp-current-time" role="timer" aria-label="time"> </div> <div class="jp-duration" role="timer" aria-label="duration"> </div> <div class="jp-controls-holder"> <?php echo $this->getPlayerHTMLparts('video', 'controls-playlist'); ?> <div class="jp-volume-controls"> <button class="jp-mute" role="button" tabindex="0"><?php echo gettext('mute'); ?> </button> <button class="jp-volume-max" role="button" tabindex="0"><?php echo gettext('max volume'); ?> </button> <div class="jp-volume-bar"> <div class="jp-volume-bar-value"></div> </div> </div> <?php echo $this->getPlayerHTMLparts('video', 'toggles-playlist'); ?> </div> <div class="jp-details"> <div class="jp-title" aria-label="title"> </div> </div> </div> </div> <div class="jp-playlist"> <ul> <!-- The method Playlist.displayPlaylist() uses this unordered list --> <li> </li> </ul> </div> <?php echo $this->getPlayerHTMLparts('video', 'no-solution'); ?> </div> </div> <?php } else { // playlist-audio ?> <div id="jquery_jplayer_<?php echo $id; ?> " class="jp-jplayer"></div> <div id="jp_container_<?php echo $id; ?> " class="jp-audio" role="application" aria-label="media player"> <div class="jp-type-playlist"> <div class="jp-gui jp-interface"> <?php echo $this->getPlayerHTMLparts('audio', 'controls-playlist'); ?> <div class="jp-progress"> <div class="jp-seek-bar"> <div class="jp-play-bar"></div> </div> </div> <div class="jp-volume-controls"> <button class="jp-mute" role="button" tabindex="0"><?php echo gettext('mute'); ?> </button> <button class="jp-volume-max" role="button" tabindex="0"><?php echo gettext('max volume'); ?> </button> <div class="jp-volume-bar"> <div class="jp-volume-bar-value"></div> </div> </div> <div class="jp-time-holder"> <div class="jp-current-time" role="timer" aria-label="time"> </div> <div class="jp-duration" role="timer" aria-label="duration"> </div> </div> <?php echo $this->getPlayerHTMLparts('audio', 'toggles-playlist'); ?> </div> <div class="jp-playlist"> <ul> <li> </li> </ul> </div> <?php echo $this->getPlayerHTMLparts('audio', 'no-solution'); ?> </div> </div> <?php } // if else playlist } // if no images at all end }
$dest_x = max(0, floor(($imw - $nw) * $offset_w)); $dest_y = max(0, floor(($imh - $nh) * $offset_h)); zp_copyCanvas($newim, $watermark, $dest_x, $dest_y, 0, 0, $nw, $nh); zp_imageKill($watermark); } $iMutex->unlock(); if (!zp_imageOutput($newim, $suffix, $cache_path, $quality) && DEBUG_IMAGE) { debugLog('full-image failed to create:' . $image); } } } if (!is_null($cache_path)) { if ($disposal == 'Download' || !OPEN_IMAGE_CACHE) { require_once dirname(__FILE__) . '/lib-MimeTypes.php'; $mimetype = getMimeString($suffix); $fp = fopen($cache_path, 'rb'); // send the right headers header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header("Content-Type: {$mimetype}"); header("Content-Length: " . filesize($image_path)); // dump the picture and stop the script fpassthru($fp); fclose($fp); } else { header('Location: ' . FULLWEBPATH . '/' . CACHEFOLDER . pathurlencode(imgSrcURI($cache_file)), true, 301); } exitZP(); } ?>
/** * Prints html meta data to be used in the <head> section of a page * */ static function getHTMLMetaData() { global $_zp_gallery, $_zp_galley_page, $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_gallery_page, $_zp_current_category, $_zp_authority, $_zp_conf_vars, $_myFavorites, $htmlmetatags_need_cache, $_zp_page; zp_register_filter('image_processor_uri', 'htmlmetatags::ipURI'); $host = sanitize("http://" . $_SERVER['HTTP_HOST']); $url = $host . getRequestURI(); // Convert locale shorttag to allowed html meta format $locale = str_replace("_", "-", getUserLocale()); $canonicalurl = ''; // generate page title, get date $pagetitle = ""; // for gallery index setup below switch $date = strftime(DATE_FORMAT); // if we don't have a item date use current date $desc = getBareGalleryDesc(); $thumb = ''; if (getOption('htmlmeta_sitelogo')) { $thumb = getOption('htmlmeta_sitelogo'); } if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) { $ogimage_width = getOption('htmlmeta_ogimage_width'); $ogimage_height = getOption('htmlmeta_ogimage_height'); if (empty($ogimage_width)) { $ogimage_width = 1280; } if (empty($ogimage_height)) { $ogimage_height = 900; } } $type = 'article'; switch ($_zp_gallery_page) { case 'index.php': $desc = getBareGalleryDesc(); //$canonicalurl = $host . getGalleryIndexURL(); $canonicalurl = $host . getPageNumURL($_zp_page); $type = 'website'; break; case 'album.php': $pagetitle = getBareAlbumTitle() . " - "; $date = getAlbumDate(); $desc = getBareAlbumDesc(); $canonicalurl = $host . getPageNumURL($_zp_page); if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) { $thumbimg = $_zp_current_album->getAlbumThumbImage(); getMaxSpaceContainer($ogimage_width, $ogimage_height, $thumbimg, false); $thumb = $host . html_encode(pathurlencode($thumbimg->getCustomImage(NULL, $ogimage_width, $ogimage_height, NULL, NULL, NULL, NULL, false, NULL))); } break; case 'image.php': $pagetitle = getBareImageTitle() . " (" . getBareAlbumTitle() . ") - "; $date = getImageDate(); $desc = getBareImageDesc(); $canonicalurl = $host . getImageURL(); if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) { $thumb = $host . html_encode(pathurlencode(getCustomSizedImageMaxSpace($ogimage_width, $ogimage_height))); } break; case 'news.php': if (function_exists("is_NewsArticle")) { if (is_NewsArticle()) { $pagetitle = getBareNewsTitle() . " - "; $date = getNewsDate(); $desc = trim(getBare(getNewsContent())); $canonicalurl = $host . $_zp_current_zenpage_news->getLink(); } else { if (is_NewsCategory()) { $pagetitle = $_zp_current_category->getTitlelink() . " - "; $date = strftime(DATE_FORMAT); $desc = trim(getBare($_zp_current_category->getDesc())); $canonicalurl = $host . $_zp_current_category->getLink(); $type = 'category'; } else { $pagetitle = gettext('News') . " - "; $desc = ''; $canonicalurl = $host . getNewsIndexURL(); $type = 'website'; } } if ($_zp_page != 1) { $canonicalurl .= '/' . $_zp_page; } } break; case 'pages.php': $pagetitle = getBarePageTitle() . " - "; $date = getPageDate(); $desc = trim(getBare(getPageContent())); $canonicalurl = $host . $_zp_current_zenpage_page->getLink(); break; default: // for all other possible static custom pages $custompage = stripSuffix($_zp_gallery_page); $standard = array('contact' => gettext('Contact'), 'register' => gettext('Register'), 'search' => gettext('Search'), 'archive' => gettext('Archive view'), 'password' => gettext('Password required')); if (is_object($_myFavorites)) { $standard['favorites'] = gettext('My favorites'); } if (array_key_exists($custompage, $standard)) { $pagetitle = $standard[$custompage] . " - "; } else { $pagetitle = $custompage . " - "; } $desc = ''; $canonicalurl = $host . getCustomPageURL($custompage); if ($_zp_page != 1) { $canonicalurl .= '/' . $_zp_page; } break; } // shorten desc to the allowed 200 characters if necesssary. $desc = html_encode(trim(substr(getBare($desc), 0, 160))); $pagetitle = $pagetitle . getBareGalleryTitle(); // get master admin $admin = $_zp_authority->getMasterUser(); $author = $admin->getName(); $meta = ''; if (getOption('htmlmeta_http-equiv-cache-control')) { $meta .= '<meta http-equiv="Cache-control" content="' . getOption("htmlmeta_cache_control") . '">' . "\n"; } if (getOption('htmlmeta_http-equiv-pragma')) { $meta .= '<meta http-equiv="pragma" content="' . getOption("htmlmeta_pragma") . '">' . "\n"; } if (getOption('htmlmeta_name-keywords')) { $meta .= '<meta name="keywords" content="' . htmlmetatags::getMetaKeywords() . '">' . "\n"; } if (getOption('htmlmeta_name-description')) { $meta .= '<meta name="description" content="' . $desc . '">' . "\n"; } if (getOption('htmlmeta_name-page-topic')) { $meta .= '<meta name="page-topic" content="' . $desc . '">' . "\n"; } if (getOption('htmlmeta_name-robots')) { $meta .= '<meta name="robots" content="' . getOption("htmlmeta_robots") . '">' . "\n"; } if (getOption('htmlmeta_name-publisher')) { $meta .= '<meta name="publisher" content="' . FULLWEBPATH . '">' . "\n"; } if (getOption('htmlmeta_name-creator')) { $meta .= '<meta name="creator" content="' . FULLWEBPATH . '">' . "\n"; } if (getOption('htmlmeta_name-author')) { $meta .= '<meta name="author" content="' . $author . '">' . "\n"; } if (getOption('htmlmeta_name-copyright')) { $meta .= '<meta name="copyright" content=" (c) ' . FULLWEBPATH . ' - ' . $author . '">' . "\n"; } if (getOption('htmlmeta_name-rights')) { $meta .= '<meta name="rights" content="' . $author . '">' . "\n"; } if (getOption('htmlmeta_name-generator')) { $meta .= '<meta name="generator" content="Zenphoto ' . ZENPHOTO_VERSION . '">' . "\n"; } if (getOption('htmlmeta_name-revisit-after')) { $meta .= '<meta name="revisit-after" content="' . getOption("htmlmeta_revisit_after") . '">' . "\n"; } if (getOption('htmlmeta_name-expires')) { $expires = getOption("htmlmeta_expires"); if ($expires == (int) $expires) { $expires = preg_replace('|\\s\\-\\d+|', '', date('r', time() + $expires)) . ' GMT'; } $meta .= '<meta name="expires" content="' . $expires . '">' . "\n"; } // OpenGraph meta if (getOption('htmlmeta_og-title')) { $meta .= '<meta property="og:title" content="' . $pagetitle . '">' . "\n"; } if (getOption('htmlmeta_og-image') && !empty($thumb)) { $meta .= '<meta property="og:image" content="' . $thumb . '">' . "\n"; } if (getOption('htmlmeta_og-description')) { $meta .= '<meta property="og:description" content="' . $desc . '">' . "\n"; } if (getOption('htmlmeta_og-url')) { $meta .= '<meta property="og:url" content="' . html_encode($url) . '">' . "\n"; } if (getOption('htmlmeta_og-type')) { $meta .= '<meta property="og:type" content="' . $type . '">' . "\n"; } // Social network extras if (getOption('htmlmeta_name-pinterest')) { $meta .= '<meta name="pinterest" content="nopin">' . "\n"; } // dissalow users to pin images on Pinterest // Twitter card $twittername = getOption('htmlmeta_twittername'); if (getOption('htmlmeta_twittercard') || !empty($twittername)) { $meta .= '<meta property="twitter:creator" content="' . $twittername . '">' . "\n"; $meta .= '<meta property="twitter:site" content="' . $twittername . '">' . "\n"; $meta .= '<meta property="twitter:card" content="summary">' . "\n"; $meta .= '<meta property="twitter:title" content="' . $pagetitle . '">' . "\n"; $meta .= '<meta property="twitter:description" content="' . $desc . '">' . "\n"; if (!empty($thumb)) { $meta .= '<meta property="twitter:image" content="' . $thumb . '">' . "\n"; } } // Canonical url if (getOption('htmlmeta_canonical-url')) { $meta .= '<link rel="canonical" href="' . $canonicalurl . '">' . "\n"; if (METATAG_LOCALE_TYPE) { $langs = generateLanguageList(); if (count($langs) != 1) { foreach ($langs as $text => $lang) { $langcheck = zpFunctions::getLanguageText($lang, '-'); // for hreflang we need en-US if ($langcheck != $locale) { switch (METATAG_LOCALE_TYPE) { case 1: $altlink = seo_locale::localePath(true, $lang); break; case 2: $altlink = dynamic_locale::fullHostPath($lang); break; } switch ($_zp_gallery_page) { case 'index.php': $altlink .= '/'; break; case 'gallery.php': $altlink .= '/' . _PAGE_ . '/gallery'; break; case 'album.php': $altlink .= '/' . html_encode($_zp_current_album->name) . '/'; break; case 'image.php': $altlink .= '/' . html_encode($_zp_current_album->name) . '/' . html_encode($_zp_current_image->filename) . IM_SUFFIX; break; case 'news.php': if (function_exists("is_NewsArticle")) { if (is_NewsArticle()) { $altlink .= '/' . _NEWS_ . '/' . html_encode($_zp_current_zenpage_news->getTitlelink()); } else { if (is_NewsCategory()) { $altlink .= '/' . _NEWS_ . '/' . html_encode($_zp_current_category->getTitlelink()); } else { $altlink .= '/' . _NEWS_; } } } break; case 'pages.php': $altlink .= '/' . _PAGES_ . '/' . html_encode($_zp_current_zenpage_page->getTitlelink()); break; case 'archive.php': $altlink .= '/' . _ARCHIVE_; break; case 'search.php': $altlink .= '/' . _SEARCH_ . '/'; break; case 'contact.php': $altlink .= '/' . _CONTACT_ . '/'; break; default: // for all other possible none standard custom pages $altlink .= '/' . _PAGE_ . '/' . html_encode($pagetitle); break; } // switch //append page number if needed switch ($_zp_gallery_page) { case 'index.php': case 'album.php': if ($_zp_page != 1) { $altlink .= _PAGE_ . '/' . $_zp_page . '/'; } break; case 'gallery.php': case 'news.php': if ($_zp_page != 1) { $altlink .= '/' . $_zp_page; } break; } $meta .= '<link rel="alternate" hreflang="' . $langcheck . '" href="' . $altlink . '">' . "\n"; } // if lang } // foreach } // if count } // if option } // if canonical if (!empty($htmlmetatags_need_cache)) { $meta .= '<script type="text/javascript">' . "\n"; $meta .= 'var caches = ["' . implode('","', $htmlmetatags_need_cache) . '"];' . "\n"; $meta .= ' window.onload = function() { var index,value; for (index in caches) { value = caches[index]; $.ajax({ cache: false, type: "GET", url: value }); } } '; $meta .= '</script>' . "\n"; } zp_remove_filter('image_processor_uri', 'htmlmetatags::ipURI'); echo $meta; }
if (isset($_REQUEST['album'])) { if (isset($_POST['album'])) { $folder = sanitize_path(urldecode($_POST['album'])); } else { $folder = sanitize_path($_GET['album']); } if (!empty($folder)) { $album = newAlbum($folder); if (!$album->isMyItem(ALBUM_RIGHTS)) { if (!zp_apply_filter('admin_managed_albums_access', false, $return)) { header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin.php'); exitZP(); } } } $albumparm = '&album=' . pathurlencode($folder); } if (isset($_GET['refresh'])) { if (empty($imageid)) { $metaURL = $backurl; } else { if (!empty($ret)) { $ret = '&return=' . $ret; } $metaURL = $redirecturl = '?' . $type . 'refresh=continue&id=' . $imageid . $albumparm . $ret . '&XSRFToken=' . getXSRFToken('refresh'); } } else { if ($type !== 'prune&') { if (!empty($folder)) { $album = newAlbum($folder); if (!$album->isMyItem(ALBUM_RIGHTS)) {
/** * * places a link on the theme page to switch to or from the mobile theme * @param string $text link text */ static function controlLink($text = NULL, $before = NULL, $after = Null) { $detect = new mobile(); if ($detect->isMobile()) { if (zp_getCookie('mobileTheme_disable')) { if (is_null($text)) { $text = gettext('View the mobile gallery'); } $enable = 'on'; } else { if (is_null($text)) { $text = gettext('View the normal gallery'); } $enable = 'off'; } if ($before) { echo '<span class="beforetext">' . html_encode($before) . '</span>'; } if (MOD_REWRITE) { $link = '?mobileTheme=' . $enable; } else { global $_zp_gallery_page, $_zp_current_images, $_zp_current_album, $_zp_current_zenpage_news, $_zp_current_category, $_zp_current_zenpage_page; switch ($_zp_gallery_page) { case 'index.php': $link = 'index.php?mobileTheme=' . $enable; break; case 'gallery.php': $link = 'index.php?p=gallery&mobileTheme=' . $enable; break; case 'album.php': $link = pathurlencode($_zp_current_album->getLink(null)) . '&mobileTheme=' . $enable; break; case 'image.php': $link = pathurlencode($_zp_current_image->getLink(null)) . '&mobileTheme=' . $enable; break; case 'news.php': if (is_NewsArticle()) { $link = html_encode($_zp_current_zenpage_news->getLink(null)) . '&mobileTheme=' . $enable; } else { if (is_NewsCategory()) { $link = html_encode($_zp_current_category->getLink(null)) . '&mobileTheme=' . $enable; } else { $link = html_encode(getNewsIndexURL()) . '&mobileTheme=' . $enable; } } break; case 'pages.php': $link = html_encode($_zp_current_zenpage_page->getLink()) . '&mobileTheme=' . $enable; break; default: $link = html_encode($_zp_gallery_page) . '?mobileTheme=' . $enable; break; } } ?> <span class="mobileThemeControlLink"> <a href="<?php echo $link; ?> " rel="external"> <?php echo html_encode($text); ?> </a> </span> <?php if ($after) { echo '<span class="aftertext">' . html_encode($after) . '</span>'; } } }
<?php zp_apply_filter('theme_head'); ?> <title><?php echo getBareGalleryTitle(); ?> | <?php echo gettext('News'); ?> </title> <meta http-equiv="content-type" content="text/html; charset=<?php echo LOCAL_CHARSET; ?> " /> <link rel="stylesheet" href="<?php echo pathurlencode($zenCSS); ?> " type="text/css" /> <link rel="stylesheet" href="<?php echo WEBPATH . '/' . THEMEFOLDER; ?> /effervescence_plus/common.css" type="text/css" /> <script type="text/javascript" src="<?php echo $_zp_themeroot; ?> /scripts/bluranchors.js"></script> <?php printZenpageRSSHeaderLink("News", "", "Zenpage news", ""); ?> </head>
printf(gettext('Options for <em>%s</em>'), $theme['name']); } ?> </h2> </th> <th colspan='1' style='text-align: right'> <?php if (count($themelist) > 1) { echo gettext("Show theme for:"); echo '<select id="themealbum" name="themealbum" onchange="this.form.submit()">'; generateListFromArray(array(pathurlencode($alb)), $themelist, false, true); echo '</select>'; } else { ?> <input type="hidden" name="themealbum" value="<?php echo pathurlencode($alb); ?> " /> <?php echo ' '; } echo "</th></tr>\n"; ?> <tr> <td colspan="3"> <p class="buttons"> <button type="submit" value="<?php echo gettext('Apply'); ?> "><img src="images/pass.png" alt="" /><strong><?php echo gettext("Apply");
function printLogo() { global $_zp_themeroot; if ($img = getOption('Graphic_logo')) { $fullimg = '/' . UPLOAD_FOLDER . '/images/' . $img . '.png'; if (file_exists(SERVERPATH . $fullimg)) { echo '<img src="' . html_encode(pathurlencode(WEBPATH . $fullimg)) . '" alt="Logo"/>'; } else { echo '<img src="' . $_zp_themeroot . '/images/effervescence.png" alt="Logo"/>'; } } else { $name = get_language_string(getOption('Theme_logo')); if (empty($name)) { $name = sanitize($_SERVER['HTTP_HOST']); } echo "<h1><a>{$name}</a></h1>"; } }
static function getShow($heading, $speedctl, $albumobj, $imageobj, $width, $height, $crop, $shuffle, $linkslides, $controls, $returnpath, $imagenumber) { global $_zp_gallery, $_zp_gallery_page; setOption('slideshow_' . $_zp_gallery->getCurrentTheme() . '_' . stripSuffix($_zp_gallery_page), 1); 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(); // setting the image size if ($width) { $wrapperwidth = $width; } else { $width = $wrapperwidth = getOption("slideshow_width"); } if ($height) { $wrapperheight = $height; } else { $height = $wrapperheight = getOption("slideshow_height"); } if ($numberofimages == 0) { return '<div class="errorbox" id="message"><h2>' . gettext('No images for the slideshow!') . '</h2></div>'; } $option = getOption("slideshow_mode"); // jQuery Cycle slideshow config // get slideshow data $showdesc = getOption("slideshow_showdesc"); // slideshow display section $validtypes = array('jpg', 'jpeg', 'gif', 'png', 'mov', '3gp'); $slideshow .= ' <script type="text/javascript"> // <!-- <![CDATA[ $(document).ready(function(){ $(function() { var ThisGallery = "' . html_encode($albumobj->getTitle()) . '"; var ImageList = new Array(); var TitleList = new Array(); var DescList = new Array(); var ImageNameList = new Array(); var DynTime=(' . (int) getOption("slideshow_timeout") . '); '; $images = $albumobj->getImages(0); if ($shuffle) { shuffle($images); } for ($imgnr = 0, $cntr = 0, $idx = $imagenumber; $imgnr < $numberofimages; $imgnr++, $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); } $ext = slideshow::is_valid($filename, $validtypes); if ($ext) { if ($crop) { $img = $image->getCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, NULL, NULL); } else { $maxwidth = $width; $maxheight = $height; getMaxSpaceContainer($maxwidth, $maxheight, $image); $img = $image->getCustomImage(NULL, $maxwidth, $maxheight, NULL, NULL, NULL, NULL, NULL, NULL); } $slideshow .= 'ImageList[' . $cntr . '] = "' . $img . '";' . "\n"; $slideshow .= 'TitleList[' . $cntr . '] = "' . js_encode($image->getTitle()) . '";' . "\n"; if ($showdesc) { $desc = $image->getDesc(); $desc = str_replace("\r\n", '<br />', $desc); $desc = str_replace("\r", '<br />', $desc); $slideshow .= 'DescList[' . $cntr . '] = "' . js_encode($desc) . '";' . "\n"; } else { $slideshow .= 'DescList[' . $cntr . '] = "";' . "\n"; } if ($idx == $numberofimages - 1) { $idx = -1; } $slideshow .= 'ImageNameList[' . $cntr . '] = "' . urlencode($filename) . '";' . "\n"; $cntr++; } } $slideshow .= "\n"; $numberofimages = $cntr; $slideshow .= ' var countOffset = ' . $imagenumber . '; var totalSlideCount = ' . $numberofimages . '; var currentslide = 2; function onBefore(curr, next, opts) { 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>"; '; if ($linkslides) { if (MOD_REWRITE) { $slideshow .= 'htmlblock += "<a href=\\"' . pathurlencode($albumobj->name) . '/"+ImageNameList[currentImageNum]+"' . getOption('mod_rewrite_image_suffix') . '\\">";'; } else { $slideshow .= 'htmlblock += "<a href=\\"index.php?album=' . pathurlencode($albumobj->name) . '&image="+ImageNameList[currentImageNum]+"\\">";'; } } $slideshow .= ' htmlblock += "<img src=\\"" + ImageList[currentImageNum] + "\\"/>";'; if ($linkslides) { $slideshow .= ' htmlblock += "</a>";'; } $slideshow .= 'htmlblock += "<p class=\\"imgdesc\\">" + DescList[currentImageNum] + "</p></span>";'; $slideshow .= 'opts.addSlide(htmlblock);'; $slideshow .= '}'; $slideshow .= ' function onAfter(curr, next, opts){ '; if (!$albumobj->isMyItem(LIST_RIGHTS)) { $slideshow .= ' //Only register at hit count the first time the image is viewed. if ($(next).attr("viewed") != 1) { $.get("' . FULLWEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/slideshow/slideshow-counter.php?album=' . pathurlencode($albumobj->name) . '&img="+ImageNameList[opts.currSlide]); $(next).attr("viewed", 1 ); } '; } $slideshow .= '}'; $slideshow .= ' $("#slides").cycle({ fx: "' . getOption("slideshow_effect") . '", speed: "' . 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" style="height:' . ($wrapperheight + 40) . 'px; width:' . $wrapperwidth . 'px;"> '; // 7/21/08dp if ($speedctl) { $slideshow .= '<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 = (int) getOption("slideshow_timeout"); /* don't let min timeout = speed */ $thistimeout = $minto == getOption("slideshow_speed") ? $minto + 250 : $minto; $slideshow .= 'Select Speed: <select id="speed" name="speed">'; while ($thistimeout <= 60000) { // "around" 1 minute :) $slideshow .= "<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); } $slideshow .= '</select> </div>'; } if ($controls) { $slideshow .= ' <div id="controls"> <div> <a href="#" id="prev" title="' . gettext("Previous") . '"></a> <a href="' . html_encode($returnpath) . '" id="stop" title="' . gettext("Stop and return to album or image page") . '"></a> <a href="#" id="pause" title="' . gettext("Pause (to stop the slideshow without returning)") . '"></a> <a href="#" id="play" title="' . gettext("Play") . '"></a> <a href="#" id="next" title="' . gettext("Next") . '"></a> </div> </div> '; } $slideshow .= ' <div id="slides" class="pics"> '; if ($cntr > 1) { $cntr = 1; } for ($imgnr = 0, $idx = $imagenumber; $imgnr <= $cntr; $idx++) { if ($idx >= $numberofimages) { $idx = 0; } if (is_array($images[$idx])) { $folder = $images[$idx]['folder']; $dalbum = newAlbum($folder); $filename = $images[$idx]['filename']; $image = newImage($dalbum, $filename); $imagepath = FULLWEBPATH . ALBUM_FOLDER_EMPTY . $folder . "/" . $filename; } else { $folder = $albumobj->name; $filename = $images[$idx]; //$filename = $animage; $image = newImage($albumobj, $filename); $imagepath = FULLWEBPATH . ALBUM_FOLDER_EMPTY . $folder . "/" . $filename; } $ext = slideshow::is_valid($filename, $validtypes); if ($ext) { $imgnr++; $slideshow .= '<span class="slideimage"><h4><strong>' . $albumobj->getTitle() . gettext(":") . '</strong> ' . $image->getTitle() . ' (' . ($idx + 1) . '/' . $numberofimages . ')</h4>'; if ($ext == "3gp") { $slideshow .= '</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="' . pathurlencode(internalToFilesystem($imagepath)) . '"/> <param name="autoplay" value="false" /> <param name="type" value="video/quicktime" /> <param name="controller" value="true" /> <embed src="' . pathurlencode(internalToFilesystem($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") { $slideshow .= '</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="' . pathurlencode(internalToFilesystem($imagepath)) . '"/> <param name="autoplay" value="false" /> <param name="type" value="video/quicktime" /> <param name="controller" value="true" /> <embed src="' . pathurlencode(internalToFilesystem($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 { if ($linkslides) { $slideshow .= '<a href="' . html_encode($image->getLink()) . '">'; } if ($crop) { $img = $image->getCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, NULL, NULL); } else { $maxwidth = $width; $maxheight = $height; getMaxSpaceContainer($maxwidth, $maxheight, $image); $img = $image->getCustomImage(NULL, $maxwidth, $maxheight, NULL, NULL, NULL, NULL, NULL, NULL); } $slideshow .= '<img src="' . html_encode(pathurlencode($img)) . '" alt="" />'; if ($linkslides) { $slideshow .= '</a>'; } } if ($showdesc) { $desc = $image->getDesc(); $desc = str_replace("\r\n", '<br />', $desc); $desc = str_replace("\r", '<br />', $desc); $slideshow .= '<p class="imgdesc">' . $desc . '</p>'; } $slideshow .= '</span>'; } } $slideshow .= ' </div> </div> '; return $slideshow; }
?> " onclick="confirmdel(this, 'label_del_<?php echo $item; ?> ', true)" /> <?php echo gettext('Delete'); ?> </label> </td> <td> <?php $image = newImage($album, $display); ?> <img src="<?php echo html_encode(pathurlencode(getAdminThumb($image, 'large'))); ?> " alt="<?php echo $image->filename; ?> "/> </td> <td> <?php printf(gettext('%s'), $display); ?> <a href="<?php echo html_encode($image->getLink()); ?> " title="<?php echo html_encode($image->getTitle());
<?php zp_apply_filter('theme_head'); ?> <?php printHeadTitle(); ?> <meta charset="<?php echo LOCAL_CHARSET; ?> "> <link rel="stylesheet" href="<?php echo pathurlencode($zenCSS); ?> " type="text/css" /> <link rel="stylesheet" href="<?php echo pathurlencode(dirname(dirname($zenCSS))); ?> /common.css" type="text/css" /> </head> <body> <?php zp_apply_filter('theme_body_open'); ?> <div id="main"> <div id="gallerytitle"> <h2> <?php printHomeLink('', ' | '); ?> <a href="<?php echo html_encode(getGalleryIndexURL());
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 }
/** * Delete the entire album PERMANENTLY. Be careful! This is unrecoverable. * Returns true if successful * * @return bool */ function remove() { $rslt = false; if (PersistentObject::remove()) { foreach ($this->getImages() as $filename) { $image = newImage($this, $filename); $image->remove(); } foreach ($this->getAlbums() as $folder) { $subalbum = newAlbum($folder); $subalbum->remove(); } $curdir = getcwd(); chdir($this->localpath); $filelist = safe_glob('*'); foreach ($filelist as $file) { if ($file != '.' && $file != '..') { @chmod($file, 0777); unlink($this->localpath . $file); // clean out any other files in the folder } } chdir($curdir); clearstatcache(); query("DELETE FROM " . prefix('options') . "WHERE `ownerid`=" . $this->id); query("DELETE FROM " . prefix('comments') . "WHERE `type`='albums' AND `ownerid`=" . $this->id); query("DELETE FROM " . prefix('obj_to_tag') . "WHERE `type`='albums' AND `objectid`=" . $this->id); $success = true; $filestoremove = safe_glob(substr($this->localpath, 0, strrpos($this->localpath, '.')) . '.*'); foreach ($filestoremove as $file) { if (in_array(strtolower(getSuffix($file)), $this->sidecars)) { @chmod($file, 0777); $success = $success && unlink($file); } } @chmod($this->localpath, 0777); $rslt = @rmdir($this->localpath) && $success; $cachepath = SERVERCACHE . '/' . pathurlencode($this->name) . '/'; @chmod($cachepath, 0777); @rmdir($cachepath); } clearstatcache(); return $rslt; }
$tsize = getOption('thumb_size'); $max = max($thumbcropwidth, $thumbcropheight); $thumbcropwidth = $thumbcropwidth * ($tsize / $max); $thumbcropheight = $thumbcropheight * ($tsize / $max); } $size = min(400, $width, $height); if ($width >= $height) { $sr = $size / $width; $sizedwidth = $size; $sizedheight = round($height / $width * $size); } else { $sr = $size / $height; $sizedwidth = Round($width / $height * $size); $sizedheight = $size; } $imageurl = "i.php?a=" . pathurlencode($albumname) . "&i=" . urlencode($imagepart) . "&s=" . $size . '&admin'; $iY = round($imageobj->get('thumbY') * $sr); if ($iY) { $iX = round($imageobj->get('thumbX') * $sr); $iW = round($imageobj->get('thumbW') * $sr); $iH = round($imageobj->get('thumbH') * $sr); } else { $cr = max($cropwidth, $cropheight) / getOption('thumb_size'); $si = min($sizedwidth, $sizedheight); $iW = round($si * $cr); $iH = round($si * $cr); $iX = round(($sizedwidth - $iW) / 2); $iY = round(($sizedheight - $iH) / 2); } if (isset($_REQUEST['crop'])) { $cw = $_REQUEST['w'];