function launch() { global $interface; global $configArray; global $library; global $locationSingleton; global $timer; global $user; if ($user) { $catalog = new CatalogConnection($configArray['Catalog']['driver']); $patron = $catalog->patronLogin($user->cat_username, $user->cat_password); $profile = $catalog->getMyProfile($patron); if (!PEAR_Singleton::isError($profile)) { $interface->assign('profile', $profile); } if (!isset($_REQUEST['overDriveId']) || !isset($_REQUEST['formatId'])) { header('Location: /'); exit; } else { $interface->assign('overDriveId', $_REQUEST['overDriveId']); $interface->assign('overDriveFormatId', $_REQUEST['formatId']); $interface->setPageTitle('OverDrive Loan Period'); $interface->setTemplate('od-loan-period.tpl'); } //Var for the IDCLREADER TEMPLATE $interface->assign('ButtonBack', false); $interface->assign('ButtonHome', true); $interface->assign('MobileTitle', 'OverDrive Loan Period'); } else { $interface->setTemplate('odCOlogin.tpl'); } $interface->display('layout.tpl'); }
function launch() { global $interface; global $configArray; global $library; global $locationSingleton; global $timer; global $user; // Include Search Engine Class require_once ROOT_DIR . '/sys/' . $configArray['Index']['engine'] . '.php'; $timer->logTime('Include search engine'); $interface->assign('showBreadcrumbs', 0); if ($user) { $catalog = new CatalogConnection($configArray['Catalog']['driver']); $patron = $catalog->patronLogin($user->cat_username, $user->cat_password); $profile = $catalog->getMyProfile($patron); if (!PEAR_Singleton::isError($profile)) { $interface->assign('profile', $profile); } } //Get the lists to show on the home page require_once ROOT_DIR . '/sys/ListWidget.php'; $widgetId = 1; $activeLocation = $locationSingleton->getActiveLocation(); if ($activeLocation != null && $activeLocation->homePageWidgetId > 0) { $widgetId = $activeLocation->homePageWidgetId; $widget = new ListWidget(); $widget->id = $widgetId; if ($widget->find(true)) { $interface->assign('widget', $widget); } } else { if (isset($library) && $library->homePageWidgetId > 0) { $widgetId = $library->homePageWidgetId; $widget = new ListWidget(); $widget->id = $widgetId; if ($widget->find(true)) { $interface->assign('widget', $widget); } } } // Cache homepage $interface->caching = 0; $cacheId = 'homepage|' . $interface->lang; //Disable Home page caching for now. if (!$interface->is_cached('layout.tpl', $cacheId)) { $interface->setPageTitle('Catalog Home'); $interface->setTemplate('home.tpl'); } $interface->display('layout.tpl', $cacheId); }
function launch() { global $interface; global $configArray; global $library; global $locationSingleton; global $timer; global $user; if ($user) { $catalog = new CatalogConnection($configArray['Catalog']['driver']); $patron = $catalog->patronLogin($user->cat_username, $user->cat_password); $profile = $catalog->getMyProfile($patron); if (!PEAR_Singleton::isError($profile)) { $interface->assign('profile', $profile); } if (!isset($_POST['overDriveId']) || !isset($_POST['overDriveFormatId']) || !isset($_POST['loanPeriod'])) { header('Location: /'); } else { require_once ROOT_DIR . '/services/EcontentRecord/AJAX.php'; $_REQUEST['overDriveId'] = $_POST['overDriveId']; $_REQUEST['formatId'] = $_POST['loanPeriod']; $_REQUEST['lendingPeriod'] = $_POST['overDriveFormatId']; $service = new AJAX(); $status = json_decode($service->CheckoutOverDriveItem()); if ($status->result) { $msg = 'Your titles were checked out successfully. You may now download the titles from your Account.'; } else { $msg = $status->message; } $interface->assign('message', $msg); $interface->assign('result', $msg); $interface->setPageTitle('OverDrive Loan Period'); $interface->setTemplate('od-checkedOut.tpl'); } //Var for the IDCLREADER TEMPLATE $interface->assign('ButtonBack', false); $interface->assign('ButtonHome', true); $interface->assign('MobileTitle', 'OverDrive Loan Period'); } else { header('Location: /'); exit; } $interface->display('layout.tpl'); }
/** * Log the current user into the catalog using stored credentials; if this * fails, clear the user's stored credentials so they can enter new, corrected * ones. * * @access protected * @return mixed $user array (on success) or false (on failure) */ protected function catalogLogin() { global $user; if ($this->catalog->status) { if ($user->cat_username) { $patron = $this->catalog->patronLogin($user->cat_username, $user->cat_password); if (empty($patron) || PEAR_Singleton::isError($patron)) { // Problem logging in -- clear user credentials so they can be // prompted again; perhaps their password has changed in the // system! unset($user->cat_username); unset($user->cat_password); } else { return $patron; } } } return false; }
function launch() { global $interface; global $configArray; global $library; global $locationSingleton; global $timer; global $user; if ($user) { if (isset($_GET['overDriveId']) && isset($_GET['formatId']) || isset($_POST['overDriveId']) && isset($_POST['formatId'])) { $catalog = new CatalogConnection($configArray['Catalog']['driver']); $patron = $catalog->patronLogin($user->cat_username, $user->cat_password); $profile = $catalog->getMyProfile($patron); if (!PEAR_Singleton::isError($profile)) { $interface->assign('profile', $profile); } $overDriveId = isset($_GET['overDriveId']) ? $_GET['overDriveId'] : $_POST['overDriveId']; $formatId = isset($_GET['formatId']) ? $_GET['formatId'] : $_POST['formatId']; require_once ROOT_DIR . '/Drivers/OverDriveDriverFactory.php'; $driver = OverDriveDriverFactory::getDriver(); $holdMessage = $driver->placeOverDriveHold($overDriveId, $formatId, $user); $interface->assign('message', $holdMessage['message']); $interface->assign('MobileTitle', 'OverDrive Place Hold'); $interface->assign('ButtonBack', false); $interface->assign('ButtonHome', true); $interface->setTemplate('od-placeHold.tpl'); } } else { if (isset($_GET['overDriveId']) && isset($_GET['formatId'])) { $interface->assign('overDriveId', $_GET['overDriveId']); $interface->assign('formatId', $_GET['formatId']); $interface->setTemplate('login.tpl'); } else { header('Location: /'); } } $interface->display('layout.tpl', $cacheId); }
public function authenticate() { global $configArray; $this->username = $_REQUEST['username']; $this->password = $_REQUEST['password']; if ($this->username == '' || $this->password == '') { $user = new PEAR_Error('authentication_error_blank'); } else { // Connect to Database $catalog = new CatalogConnection($configArray['Catalog']['driver']); if ($catalog->status) { $patron = $catalog->patronLogin($this->username, $this->password); if ($patron && !PEAR_Singleton::isError($patron)) { $user = $this->processILSUser($patron); } else { $user = new PEAR_Error('authentication_error_invalid'); } } else { $user = new PEAR_Error('authentication_error_technical'); } } return $user; }
function launch() { global $interface; global $configArray; global $library; global $locationSingleton; global $timer; global $user; // Include Search Engine Class require_once ROOT_DIR . '/sys/' . $configArray['Index']['engine'] . '.php'; $timer->logTime('Include search engine'); if ($user) { $catalog = new CatalogConnection($configArray['Catalog']['driver']); $patron = $catalog->patronLogin($user->cat_username, $user->cat_password); $profile = $catalog->getMyProfile($patron); if (!PEAR_Singleton::isError($profile)) { $interface->assign('profile', $profile); } } //Get AVG Rating eContent $listAPI = new ListAPI(); //New Ebooks $listTitlesNE = $listAPI->getListTitles('newebooks'); //Check if the list is empty or not //Assign lists to Smarty var $interface->assign('NE', !empty($listTitlesNE['titles']) ? $listTitlesNE['titles'] : ""); // Cache homepage $interface->caching = 0; $cacheId = 'homepage|' . $interface->lang; //Disable Home page caching for now. if (!$interface->is_cached('layout.tpl', $cacheId)) { $interface->setPageTitle('iDCLReader Catalog Home'); $interface->setTemplate('home.tpl'); } $interface->display('layout.tpl', $cacheId); }
/** * Get a list of preferred hold pickup branches for a user. * * @return string XML representing the pickup branches. */ function GetPreferredBranches() { require_once ROOT_DIR . '/Drivers/marmot_inc/Location.php'; global $configArray; global $user; try { $catalog = new CatalogConnection($configArray['Catalog']['driver']); } catch (PDOException $e) { // What should we do with this error? if ($configArray['System']['debug']) { echo '<pre>'; echo 'DEBUG: ' . $e->getMessage(); echo '</pre>'; } } $username = $_REQUEST['username']; $password = $_REQUEST['barcode']; //Get the list of pickup branch locations for display in the user interface. $patron = $catalog->patronLogin($username, $password); if ($patron == null) { $result = array('PickupLocations' => array(), 'loginFailed' => true); } else { $patronProfile = $catalog->getMyProfile($patron); $location = new Location(); $locationList = $location->getPickupBranches($patronProfile, $patronProfile['homeLocationId']); $pickupLocations = array(); foreach ($locationList as $curLocation) { $pickupLocations[] = array('id' => $curLocation->locationId, 'displayName' => $curLocation->displayName, 'selected' => $curLocation->selected); } require_once ROOT_DIR . '/Drivers/marmot_inc/PType.php'; $maxHolds = -1; //Determine if we should show a warning $ptype = new PType(); $ptype->pType = $patronProfile['ptype']; if ($ptype->find(true)) { $maxHolds = $ptype->maxHolds; } $currentHolds = $patronProfile['numHolds']; $holdCount = $_REQUEST['holdCount']; $showOverHoldLimit = false; if ($maxHolds != -1 && $currentHolds + $holdCount > $maxHolds) { $showOverHoldLimit = true; } //Also determine if the hold can be cancelled. global $librarySingleton; $patronHomeBranch = $librarySingleton->getPatronHomeLibrary(); $showHoldCancelDate = 0; if ($patronHomeBranch != null) { $showHoldCancelDate = $patronHomeBranch->showHoldCancelDate; } $result = array('PickupLocations' => $pickupLocations, 'loginFailed' => false, 'AllowHoldCancellation' => $showHoldCancelDate, 'showOverHoldLimit' => $showOverHoldLimit, 'maxHolds' => $maxHolds, 'currentHolds' => $currentHolds); } return json_encode($result); }
function launch() { global $configArray; global $interface; global $user; if (isset($_REQUEST['returnUrl'])) { $followupUrl = $_REQUEST['returnUrl']; header("Location: " . $followupUrl); exit; } // Delete Resource if (isset($_GET['delete'])) { $resource = Resource::staticGet('record_id', strip_tags($_GET['delete'])); $user->removeResource($resource); } // Narrow by Tag if (isset($_GET['tag'])) { $interface->assign('tags', strip_tags($_GET['tag'])); } //We are going to the "main page of My Research" //Be smart about this depending on the user's information. $hasHomeTemplate = $interface->template_exists('MyResearch/home.tpl'); if (!$user) { $action = 'Home'; } elseif ($hasHomeTemplate) { //Var for the IDCLREADER TEMPLATE $interface->assign('ButtonBack', false); $interface->assign('ButtonHome', true); $interface->assign('MobileTitle', ' '); $interface->setTemplate('home.tpl'); } else { if ($user && !$interface->isMobile()) { // Connect to Database $catalog = new CatalogConnection($configArray['Catalog']['driver']); $patron = $catalog->patronLogin($user->cat_username, $user->cat_password); $profile = $catalog->getMyProfile($patron); if ($profile['numCheckedOut'] > 0) { $action = 'CheckedOut'; } elseif ($profile['numHolds'] > 0) { $action = 'Holds'; } else { $action = 'Favorites'; } header("Location: /MyResearch/{$action}"); } else { //Go to the login page which is the home page $action = 'Home'; } // Build Favorites List $favorites = $user->getResources(isset($_GET['tag']) ? strip_tags($_GET['tag']) : null); $favList = new FavoriteHandler($favorites, $user); $favList->assign(); // Get My Lists $listList = $user->getLists(); $interface->assign('listList', $listList); // Get My Tags $tagList = $user->getTags(); $interface->assign('tagList', $tagList); $interface->setPageTitle('Favorites'); $interface->setTemplate('favorites.tpl'); } $interface->display('layout.tpl'); }