Esempio n. 1
0
 public function __construct($mysqliconnection, $customparams)
 {
     self::$c = $mysqliconnection;
     self::$cust_userid = $customparams['userid'];
     self::$cust_password = $customparams['password'];
     self::$cust_profile = $customparams['profile'];
 }
Esempio n. 2
0
         mysqli_query($c, $sql);
     }
 }
 $errorlog .= '<p>TestSessionStore - ';
 $_SESSION['vtest'] = 'Testing';
 if (isset($_SESSION['vtest']) && $_SESSION['vtest'] == 'Testing') {
     $errorlog .= 'Passed</p>';
 } else {
     $errorlog .= 'Failed</p>';
     $errors++;
 }
 $errorlog .= '<p>TestAPIConnection - ';
 $url = '';
 $_SESSION['sessionToken']['sessionToken'] = '';
 try {
     $api = new EBSCOAPI($c, $customparams);
     $theinfo = $api->getInfo();
     if (isset($theinfo['sort'])) {
         $errorlog .= 'Passed</p>';
     } else {
         $errorlog .= 'Failed: ' . var_export($theinfo, TRUE) . '</p>';
         $errors++;
     }
 } catch (Exception $e) {
     $errorlog .= 'Failed</p>';
     $errors++;
 }
 if ($errors > 0) {
     echo $errorlog;
 } else {
     echo 'OK';
Esempio n. 3
0
<?php

include 'app/app.php';
$customparams = loadCustomParams($c, decryptCookie($_COOKIE['oauth_consumer_key']));
include 'rest/EBSCOAPI.php';
$api = new EBSCOAPI($c, $customparams);
$clean = strip_tags_deep($_REQUEST);
$getclean = strip_tags_deep($_GET);
// Build  the arguments for the Search API method
$searchTerm = $clean['query'];
$fieldCode = $clean['fieldcode'] ? $clean['fieldcode'] : '';
$start = isset($clean['pagenumber']) ? $clean['pagenumber'] : 1;
if (!is_numeric($start)) {
    $start = 1;
}
$limit = isset($clean['resultsperpage']) ? $clean['resultsperpage'] : 20;
if (!is_numeric($limit)) {
    $limit = 20;
}
$sortBy = isset($clean['sort']) ? $clean['sort'] : 'relevance';
$amount = isset($clean['view']) ? $clean['view'] : 'detailed';
$mode = 'all';
$expander = isset($clean['expander']) ? $clean['expander'] : '';
$limiter = isset($clean['limiter']) ? $clean['limiter'] : '';
$debug = isset($clean['debug']) ? $clean['debug'] : '';
$Info = $api->getInfo();
// If user come back from the detailed record
// The same search will not call API again
if (isset($clean['back']) && isset($_SESSION['results'])) {
    $results = $_SESSION['results'];
    if (isset($results['queryString'])) {
Esempio n. 4
0
<?php

// session_save_path("session");
session_start();
include "app/app.php";
$customparams = loadCustomParams($c, decryptCookie($_COOKIE['oauth_consumer_key']));
include "rest/EBSCOAPI.php";
$clean = strip_tags_deep($_REQUEST);
$api = new EBSCOAPI($c, $customparams);
$Info = $api->getInfo();
if (isset($_SESSION['results'])) {
    $results = $_SESSION['results'];
    if (isset($results['queryString'])) {
        $queryStringUrl = $results['queryString'];
    }
} else {
    $queryStringUrl = urldecode(urldecode($clean['backpath']));
    $results = $api->apiSearch($queryStringUrl);
    $_SESSION['results'] = $results;
    if (isset($results['queryString'])) {
        $backpath = $results['queryString'];
    }
}
$addExpanderActions = array();
$removeExpanderAction = array();
/*
 * Check which expander check boxes are checked, which are not checked
 * if is checked add the action to addExpanderActions
 * if is not checked, add remove action to removeExpanderActions when the expander is found in applied expanders
 * or do nothing when not found in applied expanders.
 */
<?php

session_start();
include 'app/app.php';
include 'rest/EBSCOAPI.php';
$customparams = loadCustomParams($c, decryptCookie($_COOKIE['oauth_consumer_key']));
$clean = strip_tags_deep($_REQUEST);
if (isset($_SESSION['results'])) {
    $results = $_SESSION['results'];
    if (isset($results['queryString'])) {
        $queryStringUrl = $results['queryString'];
    }
} else {
    $queryStringUrl = urldecode($clean['backpath']);
}
$api = new EBSCOAPI($c, $customparams);
$resultId = $clean['resultId'];
$query = $clean['query'];
$fieldCode = $clean['fieldcode'];
$start = isset($clean['pagenumber']) ? $clean['pagenumber'] : 1;
$limit = isset($clean['resultsperpage']) ? $clean['resultsperpage'] : 20;
if ($resultId > $start * $limit) {
    $start = $start + 1;
    $url = $queryStringUrl . "&action=GoToPage({$start})";
    $results = $api->apiSearch($url);
    $_SESSION['results'] = $results;
    if (isset($results['queryString'])) {
        $backpath = $results['queryString'];
    }
} else {
    if ($resultId < ($start - 1) * $limit + 1) {
<?php

include_once 'app/app.php';
$customparams = loadCustomParams($c, decryptCookie($_COOKIE['oauth_consumer_key']));
include 'rest/EBSCOAPI.php';
if ($customparams['studentdata'] == "y" && !isInstructor()) {
    $email = isset($_COOKIE['lis_person_contact_email_primary']) ? decryptCookie($_COOKIE['lis_person_contact_email_primary']) : '';
    recordStudentAccess($c, decryptCookie($_COOKIE['lis_person_name_full']), $email, decryptCookie($_COOKIE['currentListId']));
}
$readingList = getReadingList($c);
$useCache = false;
if (sizeof($readingList) >= 75) {
    $results = array();
    $useCache = true;
} else {
    $api = new EBSCOAPI($c, $customparams);
    $listOfANs = array();
    foreach ($readingList as $reading) {
        $listOfANs[] = "AN " . $reading['an'];
    }
    if (sizeof($listOfANs) > 0) {
        $query['query'] = implode(" OR ", $listOfANs);
        $searchTerm = $query;
        $fieldCode = '';
        $start = 1;
        $limit = 100;
        $sortBy = 'relevance';
        $amount = 'detailed';
        $mode = 'all';
        $expander = '';
        $limiter = '';
<?php

$api = new EBSCOAPI($c, $customparams);
$Info = $api->getInfo();
?>
<div id="toptabcontent"> 
<div class="searchHomeContent">
<div class="searchHomeForm">
    <div class="searchform">
<h1>Basic Search</h1>
<form action="results.php">
    <p>
        <input type="text" name="query" style="width: 350px;" id="lookfor" />
        <input type="hidden" name="expander" value="<?php 
$expanderarray = array();
foreach ($Info['expanders'] as $expanderoption) {
    if (isset($expanderoption['DefaultOn']) && $expanderoption['DefaultOn'] == "y") {
        $expanderarray[] = $expanderoption['Id'];
    }
}
echo implode(',', $expanderarray);
?>
" />
        <?php 
foreach ($Info['limiters'] as $limiteroption) {
    if (isset($limiteroption['DefaultOn']) && $limiteroption['DefaultOn'] == "y") {
        echo '<input type="hidden" name="limiter[]" value="' . $limiteroption['Id'] . ':y" />';
    }
}
?>
        <input type="submit" value="Search" />
Esempio n. 8
0
        die("It looks like browser security settings may have blocked this content.  Please try a different browser, or lower your security settings.");
    }
}
$cookieDCd = decryptCookie($_COOKIE['oauth_consumer_key']);
$_SESSION['debug'] .= "<p>Cookie dump: ";
$accepted = array('oauth_consumer_key', 'roles', 'context_label', 'user_id', 'context_title', 'lis_person_name_full', 'lis_person_contact_email_primary', 'resource_link_title', 'resource_link_id', 'tool_consumer_instance_guid', 'launch_presentation_return_url');
foreach ($_COOKIE as $index => $thecookie) {
    if (in_array($index, $accepted)) {
        $_SESSION['debug'] .= "<br />" . $index . ": " . decryptCookie($thecookie);
    }
}
$_SESSION['debug'] .= "</p>";
$customparams = loadCustomParams($c, $cookieDCd);
$profile = $customparams['profile'];
try {
    $api = new EBSCOAPI($c, $customparams);
} catch (Exception $e) {
    die("It looks like your user id and password for your EDS API profile are incorrect.  Please check your settings in the <a href='http://curriculumbuilder.ebscohost.com/admin.php' target='_top'>admin panel</a>.<p style='display:none;'>" . var_export($customparams, TRUE) . "</p>");
}
try {
    $_SESSION['debug'] .= "<p>Using AuthToken " . $api->getAuthToken() . "</p>";
    $newSessionToken = $api->apiSessionToken($api->getAuthToken(), $profile, 'n');
} catch (Exception $e) {
    echo "<div style='display:none;'>" . $_SESSION['debug'] . "</div>";
    die("It looks like your profile id for your EDS API profile is incorrect.  Please check your settings in the <a href='http://curriculumbuilder.ebscohost.com/admin.php' target='_top'>admin panel</a>.<p style='display:none;'>" . var_export($customparams, TRUE) . "</p><p style='display:none;'>" . $e->getMessage() . "</p>");
}
setcookie('sessionToken', encryptCookie($newSessionToken), $time, "/", $_SERVER['SERVER_NAME'], FALSE, TRUE);
setcookie('login', encryptCookie($profile), 0, "/", $_SERVER['SERVER_NAME'], FALSE, TRUE);
if (isset($_COOKIE['Guest'])) {
    setcookie('Guest', '', time() - 3600);
}
<?php

include 'app/app.php';
if (!isset($_COOKIE['currentListId'])) {
    echo "<div class='readingListLink'>Please open a reading list via your course website before using this feature.</div>";
    die;
}
$customparams = loadCustomParams($c, decryptCookie($_COOKIE['oauth_consumer_key']));
include 'rest/EBSCOAPI.php';
$api = new EBSCOAPI($c, $customparams);
$clean = strip_tags_deep($_REQUEST);
if (!isset($clean['db']) || !isset($clean['db'])) {
    echo "<div class='readingListLink'>Error: couldn't add this to the reading list.</div>";
    die;
} else {
    $db = $clean['db'];
    $an = $clean['an'];
}
$highlight = "";
$result = $api->apiRetrieve($an, $db, $highlight);
if (isset($result['error'])) {
    $error = $result['error'];
    echo "<div class='readingListLink'>Error: " . $result['error'] . "</div>";
    die;
} else {
    $error = null;
}
$variables = array('result' => $result, 'error' => $error, 'id' => 'record', 'c' => $c, 'customparams' => $customparams, 'an' => $an, 'db' => $db, 'currentListId' => decryptCookie($_COOKIE['currentListId']));
ebsco_render('add_to_list.html', 'layout.html', $variables);
Esempio n. 10
0
<?php

include 'app/app.php';
$customparams = loadCustomParams($c, decryptCookie($_COOKIE['oauth_consumer_key']));
require_once 'rest/EBSCOAPI.php';
$clean = strip_tags_deep($_REQUEST);
$an = $clean['an'];
$db = $clean['db'];
$api = new EBSCOAPI($c, $customparams);
$record = $api->apiRetrieve($an, $db);
//Call Retrieve Method to get the PDF Link from the record
if (empty($record['pdflink'])) {
    echo "<p>Oops!  There has been an error.  Please click back in your browser and try the link again.  If you continue to see this error, please contact your library.  Error: PDF-1.</p>";
} else {
    header("location: {$record['pdflink']}");
}
Esempio n. 11
0
<?php

include 'app/app.php';
$customparams = loadCustomParams($c, decryptCookie($_COOKIE['oauth_consumer_key']));
include 'rest/EBSCOAPI.php';
$api = new EBSCOAPI($c, $customparams);
$clean = strip_tags_deep($_REQUEST);
$db = $clean['db'];
$an = $clean['an'];
//echo $db . " - " . $an;
if (!isset($_COOKIE['login'])) {
    $end = lastIndexOf($_SERVER['PHP_SELF'], "/");
    $loginURL = $proxyprefix . $baseURLfull . $authURL . "&path=fulltext&an=" . $an . "&db=" . $db;
    //echo $loginURL;
    header("Location: " . $loginURL);
} else {
    $result = $api->apiRetrieve($an, $db);
    // Set error
    if (isset($result['error'])) {
        $error = $result['error'];
    } else {
        $error = null;
    }
    // Link priority:
    // 1. PDF and HTML full-text native to EDS
    // 2. eBook full-text links
    // 3. Custom links
    // get PDF or HTML redirect links
    if (!empty($result['pdflink'])) {
        $redirectURL = $result['pdflink'];
    } else {