<?php

// Variable intake and sanitization
$incomingurl = $_POST['url'];
$url = filter_var($incomingurl, FILTER_SANITIZE_URL);
$incomingctx = $_POST['ctx'];
$ctx = filter_var($incomingctx, FILTER_SANITIZE_STRING);
$incomingkeywords = $_POST['keywords'];
$keywords = filter_var($incomingkeywords, FILTER_SANITIZE_STRING);
$language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
$incomingtitle = $_POST['title'];
$title = filter_var($incomingtitle, FILTER_SANITIZE_STRING);
$incomingsubject= $_POST['subject'];
$subject = filter_var($incomingsubject, FILTER_SANITIZE_STRING);
$incomingauthor = $_POST['author'];
$author = filter_var($incomingauthor, FILTER_SANITIZE_STRING);

// Global variables used for URL construction
$searchprefix = "/search/searchresults.aspx?ctx=";
$searchmiddle = "&type=Boolean&term=";
$searchsuffix = "&sort=RELEVANCE&limit=&query=&page=0";
$searchjoiner = "%20and%20";

// Begin building the URL

// Langauge selection starts the URL
$la = 'la='.$language;

if (!empty($keywords)) {
    $kw = $searchjoiner.'kw='.$keywords;
}

if (!empty($subject)) {
    $su = $searchjoiner.'su='.$subject;
}

if (!empty($author)) {
    $au = $searchjoiner.'au='.$author;
}

// Title status determines end of URL
if (!empty($title)) {
    $urlend = $searchjoiner.'ti='.$title.$searchsuffix; 
} else {
    $urlend = $searchsuffix;
}

$SearchURL = implode("", array_filter(array($url, $searchprefix, $ctx, $searchmiddle, $la, $au, $kw, $su, $urlend)));

?>

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
	<link rel="canonical" href="http://tanglewoodhill.ddns.net:2600/results.php">
	<meta name="robots" content="index, follow">
    <link rel="shortcut icon" type="image/png" href="favicon.png">
	<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
	<link rel="manifest" href="/site.webmanifest">
	<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
	<meta name="msapplication-TileColor" content="#da532c">
	<meta name="theme-color" content="#ffffff">
    
	<link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css?7923">
	<link rel="stylesheet" type="text/css" href="style.css?9626">
	<link rel="stylesheet" type="text/css" href="./css/all.min.css">

    <meta property="og:title" content="Fathom - Deep Links for PowerPAC" />
	<meta property="og:description" content="Create persistent links to materials and results lists in Polaris PowerPAC." />
	<meta property="og:url" content="http://tanglewoodhill.ddns.net:2600/fathom/index.php" />
	<meta property="og:image" content="http://tanglewoodhill.ddns.net:2600/fathom/img/og-image.jpg" />

	<meta name="twitter:title" content="Fathom - Deep Links for PowerPAC">
	<meta name="twitter:description" content="Create persistent links to materials and results lists in Polaris PowerPAC.">
	<meta name="twitter:image" content="http://tanglewoodhill.ddns.net:2600/fathom/img/og-image.jpg">
	<meta name="twitter:card" content="summary_large_image">
	
    <title>Results</title>


    
<!-- Analytics -->
 
<!-- Analytics END -->
    
</head>
<body>

<!-- Preloader -->
<div id="page-loading-blocs-notifaction" class="page-preloader"></div>
<!-- Preloader END -->


<!-- Main container -->
<div class="page-container">
    
<!-- bloc-0 -->
<div class="bloc" id="bloc-0">
	<div class="container bloc-lg bloc-sm-lg">
		<div class="row">
			<div class="col-12">
				<img src="img/library-4785580_1920.jpg" class="img-fluid mx-auto d-block" alt="library 4785580_1920" />
			</div>
			<div class="col-12">
				<h1 class="mg-md text-lg-center text-md-center text-sm-center text-center tc-black">
                <a href="index.php"><strong>Fathom - Deep Links for PowerPAC</strong></a>
				</h1>
				<p class="text-lg-center text-md-center text-sm-center text-center">
					Create a persistent link to materials and results list in your Polaris PowerPAC.
				</p>
			</div>
		</div>
	</div>
</div>
<!-- bloc-0 END -->

<!-- bloc-2 -->
<div class="bloc l-bloc " id="bloc-2">
	<div class="container bloc-lg bloc-md-lg">
		<div class="row">
			<div class="col text-md-left text-center">
				<h4 class="mg-md">
					<strong>Your deep link:</strong>
				</h4>
				<p><span style="color: blue">
                <?php echo '<a href="'.$SearchURL.'">'.$SearchURL.'</a><br /><br />'; ?>
                </span></p>
				<h4 class="mg-md">
					<strong>Your parameters:</strong>
				</h4>
				<p>
					<?php
                    echo '<strong>URL:</strong> '.$url.'<br />';
                    echo '<strong>CTX:</strong> '.$ctx.'<br />';
                    echo '<strong>Keyword(s):</strong> '.$keywords.'<br />';
                    echo '<strong>Title:</strong> '.$title.'<br />';
                    echo '<strong>Author:</strong> '.$author.'<br />';
                    echo '<strong>Subjects:</strong> '.$subject.'<br />';
                    echo '<strong>Langauge:</strong> '.$language.'<br />';
                    ?>
				</p>
			</div>
		</div>
	</div>
</div>
<!-- bloc-2 END -->

<!-- ScrollToTop Button -->
<a class="bloc-button btn btn-d scrollToTop" onclick="scrollToTarget('1',this)"><svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 32 32"><path class="scroll-to-top-btn-icon" d="M30,22.656l-14-13-14,13"/></svg></a>
<!-- ScrollToTop Button END-->


<!-- bloc-2 -->
<div class="bloc bgc-black d-bloc" id="bloc-2">
	<div class="container bloc-lg bloc-sm-lg">
		<div class="row">
			<div class="col-md-3 col-sm-6">
				<h4 class="mg-md text-sm-left text-center tc-white">
					About
				</h4><a href="https://cyberpunklibrarian.com/about/" class="a-btn a-block footer-link">Created by Daniel Messer</a><br />
				<a href="https://cyberpunklibrarian.nohost.me/gitlab/code/fathom" class="a-btn a-block">Fathom's Repo</a><br />
			</div>
			<div class="col-md-3 col-sm-6">
				<h4 class="mg-md text-sm-left text-center tc-white">
					Other Goodies
				</h4>
				<div class="row">
					<div class="col-6 col-sm-2 col offset-sm-0">
						<div class="text-center">
							<a href="https://cyberpunklibrarian.com/"><span class="icon-md fa fa-headphones-alt"></span></a>
						</div>
					</div>
					<div class="col-6 col-sm-2">
						<div class="text-center">
							<a href="https://hackers.town/@CyberpunkLibrarian"><span class="icon-md fab fa-mastodon"></span></a>
						</div>
					</div>
					<div class="col-6 col-sm-2">
						<div class="text-center">
							<a href="https://glammr.us/@cyberpunklibrarian"><span class="icon-md fab fa-mastodon"></span></a>
						</div>
					</div>
					<div class="col-6 col-sm-2">
						<div class="text-center">
							<a href="https://gitlab.com/cyberpunklibrarian"><span class="icon-md fab fa-gitlab"></span></a>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- bloc-2 END -->

</div>
<!-- Main container END -->
    


<!-- Additional JS -->
<script src="./js/jquery.min.js?3605"></script>
<script src="./js/bootstrap.bundle.min.js?5248"></script>
<script src="./js/blocs.min.js?5348"></script>
<script src="./js/lazysizes.min.js" defer></script><!-- Additional JS END -->


</body>
</html>
