function handleOption($option, $currentValue) { switch ($option) { case 'Theme_colors': $theme = basename(dirname(__FILE__)); $themeroot = SERVERPATH . "/themes/{$theme}/styles"; echo '<select id="themeselect" name="' . $option . '"' . ">\n"; generateListFromFiles($currentValue, $themeroot, '.css'); echo "</select>\n"; break; case 'Graphic_logo': $gallery = new Gallery(); $theme = $gallery->getCurrentTheme(); $themeroot = SERVERPATH . "/themes/{$theme}/images"; echo '<select id="themeselect" name="' . $option . '"' . ">\n"; echo '<option></option>'; generateListFromFiles($currentValue, $themeroot, '.png'); echo "</select>\n"; break; } }
<li><?php printf(gettext('Zenphoto version <strong>%1$s [%2$s] (%3$s)</strong>'), ZENPHOTO_VERSION, ZENPHOTO_RELEASE, $official); ?> </li> <li><?php if (ZENPHOTO_LOCALE) { printf(gettext('Current locale setting: <strong>%1$s</strong>'), ZENPHOTO_LOCALE); } else { echo gettext('<strong>Locale setting has failed</strong>'); } ?> </li> <li> <?php $themes = $gallery->getThemes(); $currenttheme = $gallery->getCurrentTheme(); if (array_key_exists($currenttheme, $themes) && isset($themes[$currenttheme]['name'])) { $currenttheme = $themes[$currenttheme]['name']; } printf(gettext('Current gallery theme: <strong>%1$s</strong>'), $currenttheme); ?> </li> <li><?php printf(gettext('PHP version: <strong>%1$s</strong>'), phpversion()); ?> </li> <?php if (!defined('RELEASE')) { ?> <li> <?php
$official = gettext('Official Build'); } else { $official = gettext('SVN'); } ?> <li><?php printf(gettext('Zenphoto version <strong>%1$s [%2$s] (%3$s)</strong>'), ZENPHOTO_VERSION, ZENPHOTO_RELEASE, $official); ?> </li> <?php if (isset($zenpage_version)) { printf(gettext('zenpage version <strong>%1$s [%2$s]</strong>'), $zenpage_version, ZENPAGE_RELEASE); } ?> <li><?php printf(gettext('Current gallery theme: <strong>%1$s</strong>'), $gallery->getCurrentTheme()); ?> </li> <li><?php printf(gettext('PHP version: <strong>%1$s</strong>'), phpversion()); ?> </li> <li><?php printf(gettext('PHP memory limit: <strong>%1$s</strong> (Note: Your server might allocate less!)'), INI_GET('memory_limit')); ?> </li> <li><?php printf(gettext('MySQL version: <strong>%1$s</strong>'), mysql_get_client_info()); ?> </li> <li><?php
/** * Prints the selector for custom pages * * @return string */ function printCustomPageSelector($current) { $gallery = new Gallery(); ?> <select id="custompageselector" name="custompageselect"> <?php $curdir = getcwd(); $themename = $gallery->getCurrentTheme(); $root = SERVERPATH . '/' . THEMEFOLDER . '/' . $themename . '/'; chdir($root); $filelist = safe_glob('*.php'); $list = array(); foreach ($filelist as $file) { $list[] = str_replace('.php', '', filesystemToInternal($file)); } generateListFromArray(array($current), $list, false, false); chdir($curdir); ?> </select> <?php }
} $themelist[$key] = urlencode($alb); } } } if (!empty($_REQUEST['themealbum'])) { $alb = urldecode(sanitize_path($_REQUEST['themealbum'])); $album = new Album($gallery, $alb); $albumtitle = $album->getTitle(); $themename = $album->getAlbumTheme(); } else { foreach ($themelist as $albumtitle => $alb) { break; } if (empty($alb)) { $themename = $gallery->getCurrentTheme(); $album = NULL; } else { $alb = sanitize_path($alb); $album = new Album($gallery, $alb); $albumtitle = $album->getTitle(); $themename = $album->getAlbumTheme(); } } ?> <form action="?action=saveoptions" method="post" AUTOCOMPLETE=OFF> <input type="hidden" name="savethemeoptions" value="yes" /> <table class='bordered'> <?php if (count($themelist) == 0) { ?>
/** * Worker function for creating layout selectors. Returns the HTML * * @param object $obj * @param string $type * @param string $text * @param string$secondary */ function getLayoutSelector($obj, $type, $text, $prefix = '', $secondary = false) { global $_zp_gallery; if (is_null($_zp_gallery)) { $_zp_gallery = new Gallery(); } $selectdefault = ''; $selected = ''; $files = array(); $list = array(); $getlayout = ''; $table = $obj->table; $path = SERVERPATH . '/' . THEMEFOLDER . '/' . $_zp_gallery->getCurrentTheme() . '/'; $defaultlayout = ''; $defaulttext = gettext('default'); switch ($table) { case 'albums': if ($secondary) { // the selector for the image default of the album $filesmask = 'image'; } else { $filesmask = 'album'; } $child = $obj->getParentID(); $defaulttext = gettext('inherited'); break; case 'images': $filesmask = 'image'; $album = $obj->album; $child = $album->getParentID(); $defaulttext = gettext('album default'); break; case 'pages': $filesmask = 'pages'; $child = $obj->getParentID(); $defaulttext = gettext('inherited'); break; case 'news': $child = false; $categories = $obj->getCategories(); if ($categories) { foreach ($categories as $cat) { $cat = new ZenpageCategory($cat['titlelink']); $getlayout = getSelectedLayout($cat, 'multiple_layouts_news_categories'); if ($getlayout && $getlayout['data']) { // in at least one news category with an alternate page $defaulttext = gettext('inherited'); $defaultlayout = gettext('from category'); break; } } } $filesmask = 'news'; break; case 'news_categories': $child = $obj->getParentID(); $defaulttext = gettext('inherited'); $filesmask = 'news'; break; } $curdir = getcwd(); chdir($path); $files = safe_glob($filesmask . '*.php'); chdir($curdir); if ($child) { $defaultlayout = checkParentLayouts($obj, $type); $defaultlayout = $defaultlayout['data']; } if ($defaultlayout) { $defaultlayout = stripSuffix($defaultlayout); } else { $defaultlayout = $filesmask; } if ($obj->transient) { $getlayout = false; } else { $getlayout = query_single_row("SELECT * FROM " . prefix('plugin_storage') . ' WHERE `aux` = ' . $obj->getID() . ' AND `type` = "' . $type . '"'); } if (!$child && ($key = array_search($filesmask . '.php', $files)) !== false) { unset($files[$key]); } foreach ($files as $file) { $file = filesystemToInternal($file); $list[stripSuffix($file)] = $file; } ksort($list); $html = $text; if (count($files) != 0) { $html .= '<select id="' . $type . $prefix . '" name="' . $prefix . $type . '">' . "\n"; if (is_array($getlayout)) { $selectedlayout = $getlayout['data']; } else { $selectedlayout = ''; } $html .= '<option value=""' . ($selectedlayout == '' ? ' selected="selected"' : '') . ' style="background-color:LightGray" >*' . $defaulttext . '* (' . $defaultlayout . ')</option>' . "\n"; foreach ($list as $display => $file) { $html .= '<option value="' . html_encode($file) . '"' . ($selectedlayout == $file ? ' selected="selected"' : '') . '>' . $display . '</option>' . "\n"; } $html .= '</select>' . "\n"; } else { $html = '<p>' . sprintf(gettext('No extra <em>%s</em> theme pages available'), $filesmask) . '</p>' . "\n"; } return $html; }
return false; } } return false; } // ]]> --> </script> <?php echo "\n</head>"; echo "\n<body>"; printLogoAndLinks(); echo "\n" . '<div id="main">'; printTabs(); echo "\n" . '<div id="content">'; $galleryTheme = $_zp_gallery->getCurrentTheme(); $themelist = array(); if (zp_loggedin(ADMIN_RIGHTS)) { $gallery_title = $_zp_gallery->getTitle(); if ($gallery_title != gettext("Gallery")) { $gallery_title .= ' (' . gettext("Gallery") . ')'; } $themelist[$gallery_title] = ''; } $albums = $_zp_gallery->getAlbums(0); foreach ($albums as $alb) { $album = newAlbum($alb); if ($album->isMyItem(THEMES_RIGHTS)) { $key = $album->getTitle(); if ($key != $alb) { $key .= " ({$alb})";
/** * Returns the value of a theme option * * @param string $option option key * @param object $album * @param string $theme default theme name * @return mixed */ function getThemeOption($option, $album = NULL, $theme = NULL) { global $_set_theme_album; if (is_null($album)) { $album = $_set_theme_album; } if (is_null($album)) { $id = 0; } else { $id = $album->id; $theme = $album->getAlbumTheme(); } if (empty($theme)) { $gallery = new Gallery(); $theme = $gallery->getCurrentTheme(); } // album-theme $sql = "SELECT `value` FROM " . prefix('options') . " WHERE `name`=" . db_quote($option) . " AND `ownerid`=" . $id . " AND `theme`=" . db_quote($theme); $db = query_single_row($sql); if (!$db) { // raw theme option $sql = "SELECT `value` FROM " . prefix('options') . " WHERE `name`=" . db_quote($option) . " AND `ownerid`=0 AND `theme`=" . db_quote($theme); $db = query_single_row($sql); if (!$db) { // raw album option $sql = "SELECT `value` FROM " . prefix('options') . " WHERE `name`=" . db_quote($option) . " AND `ownerid`=" . $id . " AND `theme`=NULL"; $db = query_single_row($sql); if (!$db) { return getOption($option); } } } return $db['value']; }
if (isset($_POST['custom_index_page'])) { setThemeOption('custom_index_page', sanitize($_POST['custom_index_page'], 3), $table, $themename); } $otg = getThemeOption('thumb_gray', $table, $themename); setThemeOption('thumb_gray', (int) isset($_POST['thumb_gray']), $table, $themename); if ($otg = getThemeOption('thumb_gray', $table, $themename)) { $wmo = 99; } // force cache clear $oig = getThemeOption('image_gray', $table, $themename); setThemeOption('image_gray', (int) isset($_POST['image_gray']), $table, $themename); if ($oig = getThemeOption('image_gray', $table, $themename)) { $wmo = 99; } // force cache clear if (is_null($table) && $themename == $gallery->getCurrentTheme()) { // record as global options as well. if (isset($_POST['image_size'])) { setOption('image_size', sanitize_numeric($_POST['image_size']), $table, $themename); } if (isset($_POST['image_use_side'])) { setOption('image_use_side', sanitize($_POST['image_use_side']), $table, $themename); } if (isset($_POST['thumb_size'])) { setOption('thumb_size', $ts, $table, $themename); } if (isset($_POST['thumb_crop'])) { setOption('thumb_crop', (int) isset($_POST['thumb_crop']), $table, $themename); } if (isset($_POST['thumb_crop_width'])) { setOption('thumb_crop_width', $ncw, $table, $themename);