当前位置: 首页>>代码示例>>PHP>>正文


PHP UserAccount::isLoggedIn方法代码示例

本文整理汇总了PHP中UserAccount::isLoggedIn方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount::isLoggedIn方法的具体用法?PHP UserAccount::isLoggedIn怎么用?PHP UserAccount::isLoggedIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserAccount的用法示例。


在下文中一共展示了UserAccount::isLoggedIn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: launch

 function launch($msg = null)
 {
     global $interface;
     global $configArray;
     if (!($user = UserAccount::isLoggedIn())) {
         require_once 'Login.php';
         Login::launch();
         exit;
     }
     // Save Data
     if (isset($_POST['submit'])) {
         $this->saveChanges($user);
         // After changes are saved, send the user back to an appropriate page;
         // either the list they were viewing when they started editing, or the
         // overall favorites list.
         if (isset($_REQUEST['list_id'])) {
             $nextAction = 'MyList/' . $_REQUEST['list_id'];
         } elseif (isset($_REQUEST['lists'])) {
             if (is_array($_REQUEST['lists'])) {
                 $nextAction = 'MyList/' . $_REQUEST['lists'][0];
             } else {
                 $nextAction = 'MyList/' . $_REQUEST['lists'];
             }
         } else {
             $nextAction = 'Home';
         }
         header('Location: ' . $configArray['Site']['path'] . '/MyResearch/' . $nextAction);
         exit;
     }
     // Setup Search Engine Connection
     $class = $configArray['Index']['engine'];
     $db = new $class($configArray['Index']['url']);
     if ($configArray['System']['debugSolr']) {
         $db->debug = true;
     }
     // Get Record Information
     $resource = new Resource();
     $resource->record_id = $_GET['id'];
     $resource->source = $_GET['source'];
     if ($resource->find(true)) {
         $interface->assign('resource', $resource);
     }
     // Record ID
     $interface->assign('recordId', $_GET['id']);
     // Retrieve saved information about record
     $saved = $user->getSavedData($_GET['id'], $_GET['source']);
     // Add tag information
     $savedData = array();
     foreach ($saved as $current) {
         // If we're filtering to a specific list, skip any other lists:
         if (isset($_GET['list_id']) && $current->list_id != $_GET['list_id']) {
             continue;
         }
         $savedData[] = array('listId' => $current->list_id, 'listTitle' => $current->list_title, 'notes' => $current->notes, 'tags' => $this->getTags($user, $current->list_id));
     }
     $interface->assign('savedData', $savedData);
     $interface->assign('listFilter', $_GET['list_id']);
     $interface->setTemplate('edit.tpl');
     $interface->display('layout.tpl');
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:60,代码来源:Edit.php

示例2: changePickUpLocation

 /**
  * Change pick up location of a hold
  *
  * @return void
  * @access public
  */
 public function changePickUpLocation()
 {
     if (isset($_REQUEST['reservationId'])) {
         // check if user is logged in
         $user = UserAccount::isLoggedIn();
         if (!$user) {
             return $this->output(array('msg' => translate('You must be logged in first')), JSON::STATUS_NEED_AUTH);
         }
         $catalog = ConnectionManager::connectToCatalog();
         if ($catalog && $catalog->status) {
             if ($patron = UserAccount::catalogLogin()) {
                 if (!PEAR::isError($patron)) {
                     $result = $catalog->changePickupLocation($patron, array('pickup' => $_REQUEST['pickup'], 'reservationId' => $_REQUEST['reservationId'], 'created' => $_REQUEST['created'], 'expires' => $_REQUEST['expires']));
                     if (!$result['success']) {
                         return $this->output(array($result['sysMessage']), JSON::STATUS_ERROR);
                     }
                     return $this->output(array($result), JSON::STATUS_OK);
                 } else {
                     return $this->output($patron->getMessage(), JSON::STATUS_ERROR);
                 }
             }
         }
     }
     return $this->output(translate('An error has occurred'), JSON::STATUS_ERROR);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:31,代码来源:JSON_Hold.php

示例3: launch

 /**
  * Process incoming parameters and display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     global $interface;
     global $configArray;
     // Don't let bots crawl holdings
     $this->disallowBots();
     if (!$this->hasHoldings && !(isset($configArray['Site']['ajaxRecordTabs']) && $configArray['Site']['ajaxRecordTabs'])) {
         $url = $configArray['Site']['url'] . "/Record/" . $_REQUEST['id'] . "/Description";
         header('Location: ' . $url);
     }
     // Do not cache holdings page
     $interface->caching = 0;
     // See if patron is logged in to pass details onto get holdings for
     // holds / recalls
     $patron = UserAccount::isLoggedIn() ? UserAccount::catalogLogin() : false;
     if (PEAR::isError($patron)) {
         $patron = false;
     }
     $interface->setPageTitle($this->recordDriver->getBreadcrumb());
     // Only fetch holdings if we actually need them (not needed for the basic page part of holdings when using ajax record tabs)
     if (!isset($configArray['Site']['ajaxRecordTabs']) || !$configArray['Site']['ajaxRecordTabs'] || isset($_REQUEST['subPage'])) {
         $interface->assign('holdingsMetadata', $this->recordDriver->getHoldings($patron));
     }
     $interface->assign('subTemplate', 'view-holdings.tpl');
     $interface->setTemplate('view.tpl');
     // Set Messages
     $interface->assign('infoMsg', $this->infoMsg);
     $interface->assign('errorMsg', $this->errorMsg);
     // Display Page
     $interface->display('layout.tpl');
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:37,代码来源:Holdings.php

示例4: launch

 function launch($msg = null)
 {
     global $interface;
     global $configArray;
     global $user;
     if (!($user = UserAccount::isLoggedIn())) {
         require_once 'Login.php';
         Login::launch();
         exit;
     }
     // Save Data
     if (isset($_REQUEST['tagId'])) {
         //Remove the tag for the user.
         $resource = new Resource();
         if (isset($_REQUEST['resourceId'])) {
             $resource = $resource->staticGet('record_id', $_REQUEST['resourceId']);
             $resource->removeTag($_REQUEST['tagId'], $user, false);
             header('Location: ' . $configArray['Site']['path'] . '/Record/' . $_REQUEST['resourceId']);
             exit;
         } else {
             $resource->removeTag($_REQUEST['tagId'], $user, true);
             header('Location: ' . $configArray['Site']['path'] . '/MyResearch/Favorites');
             exit;
         }
     } else {
         //No id provided to delete raise an error?
         PEAR_Singleton::raiseError(new PEAR_Error('Tag Id Missing'));
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:29,代码来源:RemoveTag.php

示例5: getPickUpLocations

 /**
  * Get a list of pickup locations for the given library
  *
  * @return void
  * @access public
  */
 public function getPickUpLocations()
 {
     if (isset($_REQUEST['id']) && isset($_REQUEST['pickupLib'])) {
         // check if user is logged in
         $user = UserAccount::isLoggedIn();
         if (!$user) {
             return $this->output(array('msg' => translate('You must be logged in first')), JSON::STATUS_NEED_AUTH);
         }
         $catalog = ConnectionManager::connectToCatalog();
         if ($catalog && $catalog->status) {
             if ($patron = UserAccount::catalogLogin()) {
                 if (!PEAR::isError($patron)) {
                     $results = $catalog->getUBPickupLocations(array('id' => $_REQUEST['id'], 'patron' => $patron, 'pickupLibrary' => $_REQUEST['pickupLib']));
                     if (!PEAR::isError($results)) {
                         foreach ($results as &$result) {
                             $result['name'] = translate(array('prefix' => 'location_', 'text' => $result['name']));
                         }
                         return $this->output(array('locations' => $results), JSON::STATUS_OK);
                     }
                 }
             }
         }
     }
     return $this->output(translate('An error has occurred'), JSON::STATUS_ERROR);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:31,代码来源:JSON_UBRequest.php

示例6: __construct

 function __construct()
 {
     global $interface;
     global $configArray;
     global $user;
     if (!UserAccount::isLoggedIn()) {
         header("Location: " . $configArray['Site']['path'] . "/MyResearch/Home");
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:9,代码来源:Report.php

示例7: launch

 /**
  * Process parameters and display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     global $interface;
     global $configArray;
     // Cache homepage
     $interface->caching = 1;
     $cacheId = 'auth-homepage|' . $interface->lang . '|' . (UserAccount::isLoggedIn() ? '1' : '0');
     if (!$interface->is_cached('layout.tpl', $cacheId)) {
         $interface->setPageTitle('Search Home');
         $interface->setTemplate('home.tpl');
     }
     $interface->display('layout.tpl', $cacheId);
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:19,代码来源:Home.php

示例8: launch

 /**
  * Display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     global $interface;
     global $configArray;
     // Cache homepage
     $interface->caching = 0;
     $cacheId = 'pci-homepage|' . $interface->lang . '|' . (UserAccount::isLoggedIn() ? '1' : '0') . '|' . (isset($_SESSION['lastUserLimit']) ? $_SESSION['lastUserLimit'] : '') . '|' . (isset($_SESSION['lastUserSort']) ? $_SESSION['lastUserSort'] : '');
     if (!$interface->is_cached('layout.tpl', $cacheId)) {
         $interface->setPageTitle('PCI Search Home');
         $interface->setTemplate('home.tpl');
     }
     $interface->display('layout.tpl', $cacheId);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:19,代码来源:Home.php

示例9: __construct

 /**
  * Constructor
  *
  * @param bool $skipLogin Set to true to bypass the default login requirement.
  *
  * @access public
  */
 public function __construct($skipLogin = false)
 {
     global $interface;
     global $configArray;
     global $user;
     if (!$skipLogin && !UserAccount::isLoggedIn()) {
         include_once 'Login.php';
         Login::launch();
         exit;
     }
     // Setup Search Engine Connection
     $this->db = ConnectionManager::connectToIndex();
     // Connect to Database
     $this->catalog = ConnectionManager::connectToCatalog();
     // Is Placing Holds allowed?
     $this->checkHolds = $this->catalog->checkFunction("Holds", null);
     // Is Cancelling Holds allowed?
     $this->cancelHolds = $this->catalog->checkFunction("cancelHolds", null);
     // Is Renewing Items allowed?
     $this->checkRenew = $this->catalog->checkFunction("Renewals", null);
     // Register Library Catalog Account
     if (isset($_POST['submit']) && !empty($_POST['submit']) && $this->catalog && isset($_POST['cat_username']) && isset($_POST['cat_password'])) {
         $username = $_POST['cat_username'];
         $password = $_POST['cat_password'];
         $loginTarget = isset($_POST['login_target']) ? $_POST['login_target'] : false;
         if ($loginTarget) {
             $username = "{$loginTarget}.{$username}";
         }
         if (UserAccount::processCatalogLogin($username, $password)) {
             $interface->assign('user', $user);
         } else {
             $interface->assign('loginError', 'Invalid Patron Login');
         }
     }
     // Assign Exporter Options
     $exportOptions = array();
     if ($configArray['BulkExport']['enabled']) {
         $options = explode(':', $configArray['BulkExport']['options']);
         foreach ($options as $option) {
             if ($configArray['Export'][$option] == true) {
                 $exportOptions[] = $option;
             }
         }
         $interface->assign('exportOptions', $exportOptions);
     }
     // Get Messages
     $this->infoMsg = isset($_GET['infoMsg']) ? $_GET['infoMsg'] : false;
     $this->errorMsg = isset($_GET['errorMsg']) ? $_GET['errorMsg'] : false;
     $this->showExport = isset($_GET['showExport']) ? $_GET['showExport'] : false;
     $this->followupUrl = false;
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:58,代码来源:MyResearch.php

示例10: launch

 function launch($msg = null)
 {
     global $interface;
     global $configArray;
     if (!($user = UserAccount::isLoggedIn())) {
         require_once ROOT_DIR . '/services/MyAccount/Login.php';
         MyAccount_Login::launch();
         exit;
     }
     // Save Data
     if (isset($_POST['submit'])) {
         $this->saveChanges($user);
         // After changes are saved, send the user back to an appropriate page;
         // either the list they were viewing when they started editing, or the
         // overall favorites list.
         if (isset($_REQUEST['list_id'])) {
             $nextAction = 'MyList/' . $_REQUEST['list_id'];
         } else {
             $nextAction = 'Home';
         }
         header('Location: ' . $configArray['Site']['path'] . '/MyAccount/' . $nextAction);
         exit;
     }
     require_once ROOT_DIR . '/sys/LocalEnrichment/UserList.php';
     $userList = new UserList();
     $userList->id = $_REQUEST['list_id'];
     $userList->find(true);
     $interface->assign('list', $userList);
     require_once ROOT_DIR . '/RecordDrivers/GroupedWorkDriver.php';
     $id = $_GET['id'];
     $groupedWorkDriver = new GroupedWorkDriver($id);
     if ($groupedWorkDriver->isValid) {
         $interface->assign('recordDriver', $groupedWorkDriver);
     }
     // Record ID
     $interface->assign('recordId', $id);
     // Retrieve saved information about record
     require_once ROOT_DIR . '/sys/LocalEnrichment/UserListEntry.php';
     $userListEntry = new UserListEntry();
     $userListEntry->groupedWorkPermanentId = $id;
     $userListEntry->listId = $_REQUEST['list_id'];
     $userListEntry->find(true);
     $interface->assign('listEntry', $userListEntry);
     $interface->assign('listFilter', $_GET['list_id']);
     $interface->setTemplate('editListTitle.tpl');
     $interface->display('layout.tpl');
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:47,代码来源:Edit.php

示例11: loginUser

 function loginUser()
 {
     //Login the user.  Must be called via Post parameters.
     global $user;
     global $interface;
     $user = UserAccount::isLoggedIn();
     if (!$user || PEAR_Singleton::isError($user)) {
         $user = UserAccount::login();
         $interface->assign('user', $user);
         if (!$user || PEAR_Singleton::isError($user)) {
             return array('success' => false, 'message' => translate("Sorry that login information was not recognized, please try again."));
         }
     }
     $patronHomeBranch = Location::getUserHomeLocation();
     //Check to see if materials request should be activated
     require_once ROOT_DIR . '/sys/MaterialsRequest.php';
     return array('success' => true, 'name' => ucwords($user->firstname . ' ' . $user->lastname), 'phone' => $user->phone, 'email' => $user->email, 'homeLocation' => isset($patronHomeBranch) ? $patronHomeBranch->code : '', 'homeLocationId' => isset($patronHomeBranch) ? $patronHomeBranch->locationId : '', 'enableMaterialsRequest' => MaterialsRequest::enableMaterialsRequest(true));
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:18,代码来源:JSON.php

示例12: __construct

 /**
  * Constructor.
  *
  * @access public
  */
 public function __construct()
 {
     global $interface;
     global $configArray;
     global $user;
     parent::__construct();
     $this->user = UserAccount::isLoggedIn();
     // Setup Search Engine Connection
     $this->db = ConnectionManager::connectToIndex();
     // Connect to Database
     $this->catalog = ConnectionManager::connectToCatalog();
     // Assign Exporter Options
     $exportOptions = array();
     if ($configArray['BulkExport']['enabled']) {
         $options = explode(':', $configArray['BulkExport']['options']);
         foreach ($options as $option) {
             if ($configArray['Export'][$option] == true) {
                 $exportOptions[] = $option;
             }
         }
         $this->exportOptions = $exportOptions;
     }
     // Get Messages
     $this->infoMsg = isset($_GET['infoMsg']) ? $_GET['infoMsg'] : false;
     $this->errorMsg = isset($_GET['errorMsg']) ? $_GET['errorMsg'] : false;
     $this->showExport = isset($_GET['showExport']) ? $_GET['showExport'] : false;
     $this->origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : false;
     // Set FollowUp URL
     if (isset($_REQUEST['followup'])) {
         $this->followupUrl = $configArray['Site']['url'] . "/" . $_REQUEST['followupModule'];
         $this->followupUrl .= "/" . $_REQUEST['followupAction'];
     } else {
         if (isset($_REQUEST['listID']) && !empty($_REQUEST['listID'])) {
             $this->followupUrl = $configArray['Site']['url'] . "/MyResearch/MyList/" . urlencode($_REQUEST['listID']);
         } else {
             $this->followupUrl = $configArray['Site']['url'] . "/Cart/Home";
         }
     }
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:44,代码来源:Bulk.php

示例13: checkRequestIsValid

 /**
  * Check Request is Valid
  *
  * @return void
  * @access public
  */
 public function checkRequestIsValid()
 {
     if (isset($_REQUEST['id']) && isset($_REQUEST['data'])) {
         // check if user is logged in
         $user = UserAccount::isLoggedIn();
         if (!$user) {
             return $this->output(array('status' => false, 'msg' => translate('You must be logged in first')), JSON::STATUS_NEED_AUTH);
         }
         $catalog = ConnectionManager::connectToCatalog();
         if ($catalog && $catalog->status) {
             if ($patron = UserAccount::catalogLogin()) {
                 if (!PEAR::isError($patron)) {
                     $results = $catalog->checkCallSlipRequestIsValid($_REQUEST['id'], $_REQUEST['data'], $patron);
                     if (!PEAR::isError($results)) {
                         $msg = $results ? translate('call_slip_place_text') : translate('call_slip_error_blocked');
                         return $this->output(array('status' => $results, 'msg' => $msg), JSON::STATUS_OK);
                     }
                 }
             }
         }
     }
     return $this->output(translate('An error has occurred'), JSON::STATUS_ERROR);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:29,代码来源:JSON_CallSlip.php

示例14: launch

 /**
  * Process parameters and display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     global $interface;
     global $configArray;
     if (!($user = UserAccount::isLoggedIn())) {
         include_once 'Login.php';
         MyAccount_Login::launch();
         exit;
     }
     // Fetch List object
     $list = UserList::staticGet($_GET['id']);
     // Ensure user have privs to view the list
     if ($list->user_id != $user->id) {
         PEAR_Singleton::raiseError(new PEAR_Error(translate('list_access_denied')));
     }
     // Save Data
     if (isset($_POST['submit'])) {
         if (empty($_POST['title'])) {
             $interface->assign('errorMsg', 'list_edit_name_required');
         } else {
             if ($this->_saveChanges($user, $list)) {
                 // After changes are saved, send the user back to an appropriate page
                 $nextAction = 'MyList/' . $list->id;
                 header('Location: ' . $configArray['Site']['path'] . '/MyResearch/' . $nextAction);
                 exit;
             } else {
                 // List was not edited
                 $interface->assign('errorMsg', 'edit_list_fail');
             }
         }
     }
     // Send list to template so title/description can be displayed:
     $interface->assign('list', $list);
     $interface->setTemplate('editList.tpl');
     $interface->display('layout.tpl');
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:42,代码来源:EditList.php

示例15: GetSavedData

 function GetSavedData()
 {
     require_once ROOT_DIR . '/services/MyResearch/lib/User.php';
     require_once ROOT_DIR . '/services/MyResearch/lib/Resource.php';
     // check if user is logged in
     if (!($user = UserAccount::isLoggedIn())) {
         echo "<result>Unauthorized</result>";
         return;
     }
     echo "<result>\n";
     $saved = $user->getSavedData($_GET['id']);
     if ($saved->notes) {
         echo "\t<Notes>{$saved->notes}</Notes>\n";
     }
     $myTagList = $user->getTags($_GET['id']);
     if (count($myTagList)) {
         foreach ($myTagList as $tag) {
             echo "\t<Tag>" . $tag->tag . "</Tag>\n";
         }
     }
     echo '</result>';
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:22,代码来源:AJAX.php


注:本文中的UserAccount::isLoggedIn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。