/** * primitive theme setup for image handling scripts * * we need to conserve memory so loading the classes is out of the question. * * @param string $album * @return string */ function themeSetup($album) { // we need to conserve memory in i.php so loading the classes is out of the question. $id = NULL; $theme = getAlbumInherited(filesystemToInternal($album), 'album_theme', $id); if (empty($theme)) { $galleryoptions = getSerializedArray(getOption('gallery_data')); $theme = @$galleryoptions['current_theme']; } loadLocalOptions($id, $theme); return $theme; }
$zenphoto_tabs['options'] = array('text' => gettext("options"), 'link' => WEBPATH . "/" . ZENFOLDER . '/admin-options.php?page=options' . $optiondefault, 'subtabs' => $subtabs, 'default' => 'gallery'); } if ($_zp_loggedin & THEMES_RIGHTS) { $zenphoto_tabs['themes'] = array('text' => gettext("themes"), 'link' => WEBPATH . "/" . ZENFOLDER . '/admin-themes.php', 'subtabs' => NULL); } if ($_zp_loggedin & ADMIN_RIGHTS) { list($subtabs, $default) = getPluginTabs(); $zenphoto_tabs['plugins'] = array('text' => gettext("plugins"), 'link' => WEBPATH . "/" . ZENFOLDER . '/admin-plugins.php', 'subtabs' => $subtabs, 'default' => $default); } if ($_zp_loggedin & ADMIN_RIGHTS) { list($subtabs, $default, $new) = getLogTabs(); $zenphoto_tabs['logs'] = array('text' => gettext("logs"), 'link' => WEBPATH . "/" . ZENFOLDER . '/admin-logs.php?page=logs', 'subtabs' => $subtabs, 'alert' => $new, 'default' => $default); } if (!$_zp_current_admin_obj->getID()) { $filelist = safe_glob(SERVERPATH . "/" . BACKUPFOLDER . '/*.zdb'); if (count($filelist) > 0) { $zenphoto_tabs['restore'] = array('text' => gettext("Restore"), 'link' => WEBPATH . "/" . ZENFOLDER . '/utilities/backup_restore.php?page=backup', 'subtabs' => NULL); } } $zenphoto_tabs = zp_apply_filter('admin_tabs', $zenphoto_tabs); foreach ($zenphoto_tabs as $tab => $value) { if (is_null($value)) { unset($zenphoto_tabs[$tab]); } } // so as to make it generally available as we make much use of it if (OFFSET_PATH != 2) { require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/colorbox_js.php'; } loadLocalOptions(false, $_zp_gallery->getCurrentTheme()); }
/** * Returns the theme folder * If there is an album theme, loads the theme options. * * @param object $album album object if override desired * * @return string */ function setupTheme($album = NULL) { global $_zp_gallery, $_zp_current_album, $_zp_current_search, $_zp_themeroot; $albumtheme = ''; if (is_null($album)) { if (in_context(ZP_SEARCH_LINKED)) { if (!($album = $_zp_current_search->getDynamicAlbum())) { $album = $_zp_current_album; } } else { $album = $_zp_current_album; } } $theme = $_zp_gallery->getCurrentTheme(); $id = 0; if (!is_null($album)) { $parent = getUrAlbum($album); $albumtheme = $parent->getAlbumTheme(); if (!empty($albumtheme)) { $theme = $albumtheme; $id = $parent->getID(); } } $theme = zp_apply_filter('setupTheme', $theme); $_zp_gallery->setCurrentTheme($theme); $themeindex = getPlugin('index.php', $theme); if (empty($theme) || empty($themeindex)) { header('Last-Modified: ' . ZP_LAST_MODIFIED); header('Content-Type: text/html; charset=' . LOCAL_CHARSET); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body> <strong><?php printf(gettext('Zenphoto found no theme scripts. Please check the <em>%s</em> folder of your installation.'), THEMEFOLDER); ?> </strong> </body> </html> <?php exitZP(); } else { loadLocalOptions($id, $theme); $_zp_themeroot = WEBPATH . "/" . THEMEFOLDER . "/{$theme}"; } return $theme; }
function loadAlbum($album) { global $gallery, $_zp_current_album, $_zp_current_image; $subalbums = $album->getAlbums(); $started = false; $tcount = $count = 0; foreach ($subalbums as $folder) { $subalbum = new Album($gallery, $folder); if (!$subalbum->isDynamic()) { $tcount = $tcount + loadAlbum($subalbum); } } $theme = $gallery->getCurrentTheme(); $id = 0; $parent = getUrAlbum($album); $albumtheme = $parent->getAlbumTheme(); if (!empty($albumtheme)) { $theme = $albumtheme; $id = $parent->id; } loadLocalOptions($id, $theme); $_zp_current_album = $album; if ($album->getNumImages() > 0) { echo "<br />" . $album->name . ' '; while (next_image(true)) { $thumb = getImageThumb(); if (strpos($thumb, 'i.php?') === false) { $thumb = NULL; } if (isImagePhoto($_zp_current_image)) { $image = getDefaultSizedImage(); if (strpos($image, 'i.php?') === false) { $image = NULL; } } else { $image = NULL; if ($_zp_current_image->objectsThumb == NULL) { $thumb = NULL; } } if (!empty($thumb) || !empty($image)) { if (!$count) { $started = true; echo "{ "; } else { echo ' | '; } } if (!empty($thumb)) { echo '<img src="' . $thumb . '" height="8" width="8" /> '; } if (!empty($image)) { echo ' <img src="' . $image . '" height="20" width="20" />'; } if (!empty($thumb) || !empty($image)) { echo "\n"; } $count++; } if ($started) { echo ' } '; } printf(ngettext('[%u image]', '[%u images]', $count), $count); echo "<br />\n"; } return $count + $tcount; }
/** * 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(); }
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); ?> &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); ?> &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; }
/** * Returns the theme folder * If there is an album theme, loads the theme options. * * @return string */ function setupTheme() { global $_zp_gallery, $_zp_current_album, $_zp_current_search, $_zp_themeroot, $_zp_last_modified; if (!is_object($_zp_gallery)) { $_zp_gallery = new Gallery(); } $albumtheme = ''; if (in_context(ZP_SEARCH_LINKED)) { $name = $_zp_current_search->dynalbumname; if (!empty($name)) { $album = new Album($_zp_gallery, $name); } else { $album = NULL; } } else { $album = $_zp_current_album; } $theme = $_zp_gallery->getCurrentTheme(); $id = 0; if (!is_null($album)) { $parent = getUrAlbum($album); $albumtheme = $parent->getAlbumTheme(); if (!empty($albumtheme)) { $theme = $albumtheme; $id = $parent->id; } } $theme = zp_apply_filter('setupTheme', $theme); $themeindex = getPlugin('index.php', $theme); if (empty($theme) || empty($themeindex)) { header('Last-Modified: ' . $_zp_last_modified); header('Content-Type: text/html; charset=' . LOCAL_CHARSET); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body> <strong><?php printf(gettext('Zenphoto found no theme scripts. Please check the <em>%s</em> folder of your installation.'), THEMEFOLDER); ?> </strong> </body> </html> <?php exit; } else { loadLocalOptions($id, $theme); $_zp_themeroot = WEBPATH . "/" . THEMEFOLDER . "/{$theme}"; } return $theme; }