diff --git a/www/index.php b/www/index.php
index 93cfc8623a73f35a8657ba3dc48c134843080462..00872d765d895e46e9606e8439ce2b2a2882db26 100644
--- a/www/index.php
+++ b/www/index.php
@@ -28,15 +28,21 @@ function loadDefaultSections($page)
$isEmbed = isset($_GET['embed']) && $_GET['embed'];
+$localScriptUrl = './js/search.min.js';
+$pageTemplate = 'Fixed';
+
if (UNL_Search::$mode === 'debug') {
- $page = Templates::factory('Local', Templates::VERSION_4_1);
- $page->addScript('js/search.js');
-} else {
- $page = Templates::factory('Fixed', Templates::VERSION_4_1);
- $page->addScript('js/search.min.js');
+ $pageTemplate = 'Local';
+ $localScriptUrl = './js/search.js';
}
+$page = Templates::factory($pageTemplate, Templates::VERSION_4_1);
+
if (!$isEmbed) {
+ if (file_exists(__DIR__ . '/wdn/templates_4.1')) {
+ $page->setLocalIncludePath(__DIR__);
+ }
+
$page->doctitle = '<title>Search | University of Nebraska–Lincoln</title>';
$page->pagetitle = '';
$page->breadcrumbs = renderTemplate('templates/breadcrumbs.tpl.php');
@@ -62,20 +68,20 @@ $page->addScript(htmlspecialchars('//www.google.com/jsapi?' . http_build_query($
$page->addStyleSheet('css/search.css');
//u is referring site
-if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) {
+if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) {
// Add local site search results
// we're scrapping the navigation and other content from the originatting site.
if (!$isEmbed) {
- if (isset($scanned->titlegraphic)) {
+ if (isset($scanned->titlegraphic)) {
//require_once 'HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$config->set('Cache.SerializerPath', '/tmp');
$purifier = new HTMLPurifier($config);
-
+
$page->head .= '<link rel="home" href="'.htmlentities($_GET['u'], ENT_QUOTES).'" />';
$page->titlegraphic = $purifier->purify(str_replace(array('<h1>', '</h1>'), '', $scanned->titlegraphic));
$page->affiliation = '';
-
+
foreach (array('breadcrumbs', 'navlinks', 'leftcollinks', 'contactinfo', 'affiliation') as $region) {
if (isset($scanned->{$region}) && !empty($scanned->{$region})) {
$scannedContent = $scanned->{$region};
@@ -88,7 +94,7 @@ if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) {
$scannedContent = preg_replace('#<h3>.*</h3>#', '', $scannedContent);
break;
}
-
+
$page->{$region} = $purifier->purify($scannedContent);
}
}
@@ -136,14 +142,16 @@ $maincontent .= renderTemplate('templates/search-results.tpl.php', array(
if (!$isEmbed) {
$page->maincontentarea = $maincontent;
echo $page;
-} else {
- if (UNL_Search::$mode === 'debug') {
- $template = 'templates/embed-debug.tpl.php';
- } else {
- $template = 'templates/embed.tpl.php';
- }
- echo renderTemplate($template, array(
- 'head' => $page->head,
- 'maincontent' => $maincontent
- ));
+ exit;
+}
+
+$template = 'templates/embed.tpl.php';
+
+if (UNL_Search::$mode === 'debug') {
+ $template = 'templates/embed-debug.tpl.php';
}
+
+echo renderTemplate($template, array(
+ 'head' => $page->head,
+ 'maincontent' => $maincontent
+));