function load_template() { global $THEME_DIR, $CONFIG, $template_header, $template_footer; $tmpl_loc = array(); $tmpl_loc = unserialize(base64_decode(LOC)); if (file_exists(TEMPLATE_FILE)) { $template_file = TEMPLATE_FILE; } elseif (file_exists($THEME_DIR . TEMPLATE_FILE)) { $template_file = $THEME_DIR . TEMPLATE_FILE; } else { die("<b>Coppermine critical error</b>:<br />Unable to load template file " . TEMPLATE_FILE . "!</b>"); } $template = fread(fopen($template_file, 'r'), filesize($template_file)); $gallery_pos = strpos($template, '{LANGUAGE_SELECT_FLAGS}'); $template = str_replace('{LANGUAGE_SELECT_FLAGS}', languageSelect('flags'), $template); $gallery_pos = strpos($template, '{LANGUAGE_SELECT_LIST}'); $template = str_replace('{LANGUAGE_SELECT_LIST}', languageSelect('list'), $template); $gallery_pos = strpos($template, '{THEME_DIR}'); $template = str_replace('{THEME_DIR}', $THEME_DIR, $template); $gallery_pos = strpos($template, '{THEME_SELECT_LIST}'); $template = str_replace('{THEME_SELECT_LIST}', themeSelect('list'), $template); $gallery_pos = strpos($template, $tmpl_loc['l']); $template = str_replace($tmpl_loc['l'], $tmpl_loc['s'], $template); $template_header = substr($template, 0, $gallery_pos); $template_footer = substr($template, $gallery_pos); $add_version_info = '<!--Coppermine Photo Gallery ' . COPPERMINE_VERSION . '--></body>'; $template_footer = ereg_replace("</body[^>]*>", $add_version_info, $template_footer); }
/** * load_template() * * Load and parse the template.html file * * @return **/ function load_template() { global $THEME_DIR, $CONFIG, $template_header, $template_footer; if (file_exists(TEMPLATE_FILE)) { $template_file = TEMPLATE_FILE; } elseif (file_exists($THEME_DIR . TEMPLATE_FILE)) { $template_file = $THEME_DIR . TEMPLATE_FILE; } else { die("<b>Coppermine critical error</b>:<br />Unable to load template file " . TEMPLATE_FILE . "!</b>"); } $template = fread(fopen($template_file, 'r'), filesize($template_file)); $template = CPGPluginAPI::filter('template_html', $template); $gallery_pos = strpos($template, '{LANGUAGE_SELECT_FLAGS}'); $template = str_replace('{LANGUAGE_SELECT_FLAGS}', languageSelect('flags'), $template); $gallery_pos = strpos($template, '{LANGUAGE_SELECT_LIST}'); $template = str_replace('{LANGUAGE_SELECT_LIST}', languageSelect('list'), $template); $gallery_pos = strpos($template, '{THEME_DIR}'); $template = str_replace('{THEME_DIR}', $THEME_DIR, $template); $gallery_pos = strpos($template, '{THEME_SELECT_LIST}'); $template = str_replace('{THEME_SELECT_LIST}', themeSelect('list'), $template); $gallery_pos = strpos($template, '{GALLERY}'); if (!strstr($template, '{CREDITS}')) { $template = str_replace('{GALLERY}', '{CREDITS}', $template); } else { $template = str_replace('{GALLERY}', '', $template); } $template_header = substr($template, 0, $gallery_pos); $template_header = str_replace('{META}', '{META}' . "<script src='include/tag/lib/httpreq.js' type='text/javascript'></script><script src='include/tag/lib/photonotes.js' type='text/javascript'></script><link rel='stylesheet' href='include/tag/lib/photonotes.css' type='text/css' />", $template_header); $template_header = str_replace('{META}', '{META}' . CPGPluginAPI::filter('page_meta', ''), $template_header); // Filter gallery header and footer $template_header .= CPGPluginAPI::filter('gallery_header', ''); $template_footer = CPGPluginAPI::filter('gallery_footer', '') . substr($template, $gallery_pos); $add_version_info = "<!--Coppermine Photo Gallery " . COPPERMINE_VERSION . " (" . COPPERMINE_VERSION_STATUS . ")-->\n</body>"; $template_footer = ereg_replace("</body[^>]*>", $add_version_info, $template_footer); }
/** * load_template() * * Load and parse the template.html file * * @return **/ function load_template() { global $THEME_DIR, $CONFIG, $template_header, $template_footer; if (file_exists($THEME_DIR . TEMPLATE_FILE)) { $template_file = $THEME_DIR . TEMPLATE_FILE; } else { die("Coppermine critical error:<br />Unable to load template file " . TEMPLATE_FILE . "!"); } $template = fread(fopen($template_file, 'r'), filesize($template_file)); $template = CPGPluginAPI::filter('template_html', $template); $gallery_pos = strpos($template, '{LANGUAGE_SELECT_FLAGS}'); $template = str_replace('{LANGUAGE_SELECT_FLAGS}', languageSelect('flags'), $template); $gallery_pos = strpos($template, '{LANGUAGE_SELECT_LIST}'); $template = str_replace('{LANGUAGE_SELECT_LIST}', languageSelect('list'), $template); $gallery_pos = strpos($template, '{THEME_DIR}'); $template = str_replace('{THEME_DIR}', $THEME_DIR, $template); $gallery_pos = strpos($template, '{THEME_SELECT_LIST}'); $template = str_replace('{THEME_SELECT_LIST}', themeSelect('list'), $template); $gallery_pos = strpos($template, '{SOCIAL_BOOKMARKS}'); $template = str_replace('{SOCIAL_BOOKMARKS}', cpgSocialBookmark(), $template); $gallery_pos = strpos($template, '{GALLERY}'); if (!strstr($template, '{CREDITS}')) { $template = str_replace('{GALLERY}', '{CREDITS}', $template); } else { $template = str_replace('{GALLERY}', '', $template); } $template_header = substr($template, 0, $gallery_pos); $template_header = str_replace('{META}', '{META}' . CPGPluginAPI::filter('page_meta', ''), $template_header); // Filter gallery header and footer $template_header .= CPGPluginAPI::filter('gallery_header', ''); $template_footer = CPGPluginAPI::filter('gallery_footer', '') . substr($template, $gallery_pos); $add_version_info = "<!--Coppermine Photo Gallery " . COPPERMINE_VERSION . " (" . COPPERMINE_VERSION_STATUS . ")-->\n</body>"; $template_footer = ereg_replace("</body[^>]*>", $add_version_info, $template_footer); }
/** * load_template() * * Load and parse the template.html file * * @return **/ function load_template() { global $THEME_DIR, $template_header, $template_footer, $LINEBREAK; $template = file_get_contents($THEME_DIR . TEMPLATE_FILE); if ($template === FALSE) { die("Coppermine critical error:<br />Unable to load template file " . $THEME_DIR . TEMPLATE_FILE . "!"); } $template = CPGPluginAPI::filter('template_html', $template); $gallery_pos = strpos($template, '{LANGUAGE_SELECT_FLAGS}'); if ($gallery_pos) { $template = str_replace('{LANGUAGE_SELECT_FLAGS}', languageSelect('flags'), $template); } $gallery_pos = strpos($template, '{LANGUAGE_SELECT_LIST}'); if ($gallery_pos) { $template = str_replace('{LANGUAGE_SELECT_LIST}', languageSelect('list'), $template); } $gallery_pos = strpos($template, '{THEME_DIR}'); $template = str_replace('{THEME_DIR}', $THEME_DIR, $template); $gallery_pos = strpos($template, '{THEME_SELECT_LIST}'); if ($gallery_pos) { $template = str_replace('{THEME_SELECT_LIST}', themeSelect('list'), $template); } // Failsafe-option if JAVASCRIPT-token is missing from custom theme if (strpos($template, '{JAVASCRIPT}') === FALSE) { if (stripos($template, '</head>') !== FALSE) { $template = str_ireplace('</head>', '{JAVASCRIPT}' . $LINEBREAK . '</head>', $template); } elseif (stripos($template, '<head>') !== FALSE) { $template = str_ireplace('<head>', '<head>' . $LINEBREAK . '{JAVASCRIPT}', $template); } elseif (stripos($template, '</title>') !== FALSE) { $template = str_ireplace('</title>', '</title>' . $LINEBREAK . '{JAVASCRIPT}', $template); } } $gallery_pos = strpos($template, '{GALLERY}'); if (!strstr($template, '{CREDITS}')) { $template = str_replace('{GALLERY}', '{CREDITS}', $template); } else { $template = str_replace('{GALLERY}', '', $template); } $template_header = substr($template, 0, $gallery_pos); $template_header = str_replace('{META}', '{META}' . CPGPluginAPI::filter('page_meta', ''), $template_header); $template_footer = substr($template, $gallery_pos); // Filter gallery header and footer $template_header = CPGPluginAPI::filter('gallery_header', $template_header); $template_footer = CPGPluginAPI::filter('gallery_footer', $template_footer); $add_version_info = '<!--Coppermine Photo Gallery ' . COPPERMINE_VERSION . ' (' . COPPERMINE_VERSION_STATUS . ')-->' . $LINEBREAK . '</body>'; $template_footer = preg_replace("#</body[^>]*>#", $add_version_info, $template_footer); }
/** * load_template() * * Load and parse the template.html file * * @return **/ function load_template() { global $THEME_DIR, $CONFIG, $template_header, $template_footer; $tmpl_loc = array(); $tmpl_loc = unserialize(base64_decode(LOC)); if (file_exists(TEMPLATE_FILE)) { $template_file = TEMPLATE_FILE; } elseif (file_exists($THEME_DIR . TEMPLATE_FILE)) { $template_file = $THEME_DIR . TEMPLATE_FILE; } else { die("<b>Coppermine critical error</b>:<br />Unable to load template file " . TEMPLATE_FILE . "!</b>"); } $template = fread(fopen($template_file, 'r'), filesize($template_file)); $template = CPGPluginAPI::filter('template_html', $template); $gallery_pos = strpos($template, '{LANGUAGE_SELECT_FLAGS}'); $template = str_replace('{LANGUAGE_SELECT_FLAGS}', languageSelect('flags'), $template); $gallery_pos = strpos($template, '{LANGUAGE_SELECT_LIST}'); $template = str_replace('{LANGUAGE_SELECT_LIST}', languageSelect('list'), $template); $gallery_pos = strpos($template, '{THEME_DIR}'); $template = str_replace('{THEME_DIR}', $THEME_DIR, $template); $gallery_pos = strpos($template, '{THEME_SELECT_LIST}'); $template = str_replace('{THEME_SELECT_LIST}', themeSelect('list'), $template); $gallery_pos = strpos($template, $tmpl_loc['l']); $template = str_replace($tmpl_loc['l'], $tmpl_loc['s'], $template); $template_header = substr($template, 0, $gallery_pos); $template_header = str_replace('{META}', '{META}' . CPGPluginAPI::filter('page_meta', ''), $template_header); // Filter gallery header and footer $template_header .= CPGPluginAPI::filter('gallery_header', ''); $template_footer = CPGPluginAPI::filter('gallery_footer', '') . substr($template, $gallery_pos); $add_version_info = "<!--Coppermine Photo Gallery " . COPPERMINE_VERSION . " (" . COPPERMINE_VERSION_STATUS . ")-->\n</body>"; $template_footer = ereg_replace("</body[^>]*>", $add_version_info, $template_footer); }