$authType = 'zp_gallery_auth'; $hint = $_zp_gallery->getPasswordHint(); $show = $_zp_gallery->getUser(); } if (empty($hash) || !empty($hash) && zp_getCookie($authType) != $hash) { require_once SERVERPATH . "/" . ZENFOLDER . '/rewrite.php'; require_once dirname(__FILE__) . "/template-functions.php"; require_once SERVERPATH . "/" . ZENFOLDER . '/functions-controller.php'; zp_load_gallery(); foreach (getEnabledPlugins() as $extension => $plugin) { if ($plugin['priority'] & THEME_PLUGIN) { require_once $plugin['path']; $_zp_loaded_plugins[$extension] = $extension; } } $theme = setupTheme($albumobj); $custom = $_zp_themeroot . '/functions.php'; if (file_exists($custom)) { require_once $custom; } $_zp_gallery_page = 'password.php'; $_zp_script = $_zp_themeroot . '/password.php'; if (!file_exists(internalToFilesystem($_zp_script))) { $_zp_script = SERVERPATH . '/' . ZENFOLDER . '/password.php'; } header('Content-Type: text/html; charset=' . LOCAL_CHARSET); header("HTTP/1.0 302 Found"); header("Status: 302 Found"); header('Last-Modified: ' . ZP_LAST_MODIFIED); include internalToFilesystem($_zp_script); exposeZenPhotoInformations($_zp_script, array(), $theme);
} else { handleSearchParms('album', $_zp_current_album); $theme = setupTheme(); $_zp_gallery_page = basename($obj = THEMEFOLDER . "/{$theme}/album.php"); } // update hit counter if (!isMyALbum($_zp_current_album->name, ALL_RIGHTS) && getCurrentPage() == 1) { $hc = $_zp_current_album->get('hitcounter') + 1; $_zp_current_album->set('hitcounter', $hc); $_zp_current_album->save(); } // Display the Index page. } else { if (in_context(ZP_INDEX)) { handleSearchParms('index'); $theme = setupTheme(); $_zp_gallery_page = basename($obj = THEMEFOLDER . "/{$theme}/index.php"); } } } } // Load plugins, then load the requested $obj (page, image, album, or index; defined above). $_zp_loaded_plugins = array(); if (file_exists(SERVERPATH . "/" . UTF8ToFilesystem($obj)) && $zp_request) { foreach (getEnabledPlugins() as $extension) { $_zp_loaded_plugins[] = $extension; require_once SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER . $extension; } // Zenpage automatic hitcounter update support if (function_exists("is_NewsArticle") and !$_zp_loggedin) { if (is_NewsArticle()) {
if (isset($_GET['p'])) { $_index_theme = prepareCustomPage(); // Display an Image page. } else { if (in_context(ZP_IMAGE)) { $_index_theme = prepareImagePage(); // Display an Album page. } else { if (in_context(ZP_ALBUM)) { $_index_theme = prepareAlbumPage(); // Display the Index page. } else { if (in_context(ZP_INDEX)) { $_index_theme = prepareIndexPage(); } else { $_index_theme = setupTheme(); } } } } //$_zp_script_timer['theme setup'] = microtime(); $_zp_script = zp_apply_filter('load_theme_script', $_zp_script, $zp_request); $custom = SERVERPATH . '/' . THEMEFOLDER . '/' . internalToFilesystem($_index_theme) . '/functions.php'; if (file_exists($custom)) { require_once $custom; } else { $custom = false; } // Load the THEME plugins if (!preg_match('~' . ZENFOLDER . '~', $_zp_script)) { if (DEBUG_PLUGINS) {
define('THEME_ROOT', get_template_directory_uri()); // function that sets up basic settings/variables of theme function setupTheme() { // show wordpress adminbar when admin if (!current_user_can('edit_posts')) { show_admin_bar(false); } else { show_admin_bar(true); } //add theme support for menus add_theme_support('menus'); register_nav_menus(array('main_menu' => 'Main Menu')); } // run setup function setupTheme(); // function that enqueues all JS scripts our theme uses function enqueueJavaScripts() { $jsFiles = array('bootstrapjs' => array('src' => '/js/libs/bootstrap.min.js', 'deps' => array('jquery-core')), 'mainjs' => array('src' => '/js/main.js', 'deps' => array('jquery-core'))); /** * Register the required JS scripts for this theme. * */ foreach ($jsFiles as $key => $file) { /* example: wp_enqueue_script('bootstrapjs', 'js/libs/bootstrap.js', array('jquery-core')); */ wp_enqueue_script($key, THEME_ROOT . $file['src'], $file['deps']); } }
/** * * sets up for loading p=page pages * @return string */ function prepareCustomPage() { global $_zp_current_album, $_zp_current_image, $_zp_gallery_page, $_zp_script, $_zp_current_search; $searchalbums = handleSearchParms('page', $_zp_current_album, $_zp_current_image); $album = NULL; $page = str_replace(array('/', '\\', '.'), '', sanitize($_GET['p'])); if (isset($_GET['z'])) { // system page if ($subfolder = sanitize($_GET['z'])) { $subfolder .= '/'; } $_zp_gallery_page = $page . '.php'; $_zp_script = ZENFOLDER . '/' . $subfolder . $page . '.php'; } else { $_zp_gallery_page = $page . '.php'; switch ($_zp_gallery_page) { case 'search.php': if (!empty($searchalbums)) { // we are within a search of a specific album(s) $albums = array(); foreach ($searchalbums as $analbum) { $parent = getUrAlbum(newAlbum($analbum)); $albums[$parent->getID()] = $parent; } if (count($albums) == 1) { // there is only one parent album for the search $album = array_shift($albums); } } break; } } $theme = setupTheme($album); if (empty($_zp_script)) { $_zp_script = THEMEFOLDER . "/{$theme}/{$page}.php"; } return $theme; }