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


PHP UserAccount::validateAccount方法代码示例

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


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

示例1: addTitlesToList

 /**
  * Add titles to a user list.
  *
  * Parameters:
  * <ul>
  * <li>username - The barcode of the user.  Can be truncated to the last 7 or 9 digits.</li>
  * <li>password - The pin number for the user. </li>
  * <li>listId   - The id of the list to add items to.</li>
  * <li>recordIds - The id of the record(s) to add to the list.</li>
  * <li>tags   - A comma separated string of tags to apply to the titles within the list. (optional)</li>
  * <li>notes  - descriptive text to apply to the titles.  Can be viewed while on the list.  (optional)</li>
  * </ul>
  *
  * Note: You may also provide the parameters to addTitlesToList and titles will be added to the list
  * after the list is created.
  *
  * Returns:
  * <ul>
  * <li>success - true if the account is valid and the titles could be added to the list, false if the username or password were incorrect or the list could not be created.</li>
  * <li>listId - the id of the list that titles were added to.</li>
  * <li>numAdded - the number of titles that were added to the list.</li>
  * </ul>
  *
  * Sample Call:
  * <code>
  * http://catalog.douglascountylibraries.org/API/ListAPI?method=createList&username=23025003575917&password=1234&title=Test+List&description=Test&public=0
  * </code>
  *
  * Sample Response:
  * <code>
  * {"result":{"success":true,"listId":"1688"}}
  * </code>
  */
 function addTitlesToList()
 {
     $username = $_REQUEST['username'];
     $password = $_REQUEST['password'];
     if (!isset($_REQUEST['listId'])) {
         return array('success' => false, 'message' => 'You must provide the listId to add titles to.');
     }
     $recordIds = array();
     if (!isset($_REQUEST['recordIds'])) {
         return array('success' => false, 'message' => 'You must provide one or more records to add tot he list.');
     } else {
         if (!is_array($_REQUEST['recordIds'])) {
             $recordIds[] = $_REQUEST['recordIds'];
         } else {
             $recordIds = $_REQUEST['recordIds'];
         }
     }
     global $user;
     $user = UserAccount::validateAccount($username, $password);
     if ($user && !PEAR_Singleton::isError($user)) {
         $list = new UserList();
         $list->id = $_REQUEST['listId'];
         $list->user_id = $user->id;
         if (!$list->find(true)) {
             return array('success' => false, 'message' => 'Unable to find the list to add titles to.');
         } else {
             $numAdded = 0;
             foreach ($recordIds as $id) {
                 $userListEntry = new UserListEntry();
                 $userListEntry->listId = $list->id;
                 $userListEntry->groupedWorkPermanentId = $id;
                 $existingEntry = false;
                 if ($userListEntry->find(true)) {
                     $existingEntry = true;
                 }
                 if (isset($_REQUEST['notes'])) {
                     $notes = $_REQUEST['notes'];
                 } else {
                     $notes = '';
                 }
                 $userListEntry->notes = $notes;
                 $userListEntry->dateAdded = time();
                 if ($existingEntry) {
                     $userListEntry->update();
                 } else {
                     $userListEntry->insert();
                 }
                 $numAdded++;
             }
             return array('success' => true, 'listId' => $list->id, 'numAdded' => $numAdded);
         }
     } else {
         return array('success' => false, 'message' => 'Login unsuccessful');
     }
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:88,代码来源:ListAPI.php

示例2: addTitlesToList

 /**
  * Add titles to a user list.
  *
  * Parameters:
  * <ul>
  * <li>username - The barcode of the user.  Can be truncated to the last 7 or 9 digits.</li>
  * <li>password - The pin number for the user. </li>
  * <li>listId   - The id of the list to add items to.</li>
  * <li>recordIds - The id of the record(s) to add to the list.</li>
  * <li>tags   - A comma separated string of tags to apply to the titles within the list. (optional)</li>
  * <li>notes  - descriptive text to apply to the titles.  Can be viewed while on the list.  (optional)</li>
  * </ul>
  *
  * Note: You may also provide the parameters to addTitlesToList and titles will be added to the list
  * after the list is created.
  *
  * Returns:
  * <ul>
  * <li>success - true if the account is valid and the titles could be added to the list, false if the username or password were incorrect or the list could not be created.</li>
  * <li>listId - the id of the list that titles were added to.</li>
  * <li>numAdded - the number of titles that were added to the list.</li>
  * </ul>
  *
  * Sample Call:
  * <code>
  * http://catalog.douglascountylibraries.org/API/ListAPI?method=createList&username=23025003575917&password=1234&title=Test+List&description=Test&public=0
  * </code>
  *
  * Sample Response:
  * <code>
  * {"result":{"success":true,"listId":"1688"}}
  * </code>
  */
 function addTitlesToList()
 {
     $username = $_REQUEST['username'];
     $password = $_REQUEST['password'];
     if (!isset($_REQUEST['listId'])) {
         return array('success' => false, 'message' => 'You must provide the listId to add titles to.');
     }
     $recordIds = array();
     if (!isset($_REQUEST['recordIds'])) {
         return array('success' => false, 'message' => 'You must provide one or more records to add tot he list.');
     } else {
         if (!is_array($_REQUEST['recordIds'])) {
             $recordIds[] = $_REQUEST['recordIds'];
         } else {
             $recordIds = $_REQUEST['recordIds'];
         }
     }
     global $user;
     $user = UserAccount::validateAccount($username, $password);
     if ($user && !PEAR_Singleton::isError($user)) {
         $list = new User_list();
         $list->id = $_REQUEST['listId'];
         $list->user_id = $user->id;
         if (!$list->find(true)) {
             return array('success' => false, 'message' => 'Unable to find the list to add titles to.');
         } else {
             $recordIds = $_REQUEST['recordIds'];
             $numAdded = 0;
             foreach ($recordIds as $id) {
                 $source = 'VuFind';
                 if (preg_match('/econtentRecord\\d+/i', $id)) {
                     $id = substr($id, 14);
                     $source = 'eContent';
                 }
                 $resource = new Resource();
                 $resource->record_id = $id;
                 $resource->source = $source;
                 if (!$resource->find(true)) {
                     $resource->insert();
                 }
                 if (isset($_REQUEST['tags'])) {
                     preg_match_all('/"[^"]*"|[^,]+/', $_REQUEST['tags'], $tagArray);
                     $tags = $tagArray[0];
                 } else {
                     $tags = array();
                 }
                 if (isset($_REQUEST['notes'])) {
                     $notes = $_REQUEST['notes'];
                 } else {
                     $notes = '';
                 }
                 if ($user->addResource($resource, $list, $tags, $notes)) {
                     $numAdded++;
                 }
             }
             return array('success' => true, 'listId' => $list->id, 'numAdded' => $numAdded);
         }
     } else {
         return array('success' => false, 'message' => 'Login unsuccessful');
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:94,代码来源:ListAPI.php

示例3: getListWidget

 function getListWidget()
 {
     global $interface;
     global $user;
     if (isset($_REQUEST['username']) && isset($_REQUEST['password'])) {
         $username = $_REQUEST['username'];
         $password = $_REQUEST['password'];
         $user = UserAccount::validateAccount($username, $password);
         $interface->assign('user', $user);
     }
     //Load the widget configuration
     require_once ROOT_DIR . '/sys/ListWidget.php';
     require_once ROOT_DIR . '/sys/ListWidgetList.php';
     require_once ROOT_DIR . '/sys/ListWidgetListsLinks.php';
     $widget = new ListWidget();
     $id = $_REQUEST['id'];
     $widget->id = $id;
     if ($widget->find(true)) {
         $interface->assign('widget', $widget);
         //return the widget
         return $interface->fetch('ListWidget/listWidget.tpl');
     }
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:23,代码来源:SearchAPI.php

示例4: deleteSelectedFromReadingHistory

 /**
  * Removes one or more titles from the user's reading history.
  *
  * Parameters:
  * <ul>
  * <li>username - The barcode of the user.  Can be truncated to the last 7 or 9 digits.</li>
  * <li>password - The pin number for the user. </li>
  * <li>selected - A list of record ids to be deleted from the reading history.</li>
  * </ul>
  *
  * Returns:
  * <ul>
  * <li>success � true if the account is valid and the items could be removed from the reading history, false if the username or password were incorrect or the items could not be removed from the reading history.</li>
  * </ul>
  *
  * Sample Call:
  * <code>
  * http://catalog.douglascountylibraries.org/API/UserAPI?method=deleteSelectedFromReadingHistory&username=23025003575917&password=1234&selected[]=25855
  * </code>
  *
  * Sample Response:
  * <code>
  * {"result":{"success":true}}
  * </code>
  *
  * @author Mark Noble <mnoble@turningleaftech.com>
  */
 function deleteSelectedFromReadingHistory()
 {
     $username = $_REQUEST['username'];
     $password = $_REQUEST['password'];
     $selectedTitles = $_REQUEST['selected'];
     global $user;
     $user = UserAccount::validateAccount($username, $password);
     if ($user && !PEAR_Singleton::isError($user)) {
         $this->catalog->doReadingHistoryAction('deleteMarked', $selectedTitles);
         return array('success' => true);
     } else {
         return array('success' => false, 'message' => 'Login unsuccessful');
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:41,代码来源:UserAPI.php


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