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


PHP PMF_User_CurrentUser::getUserById方法代码示例

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


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

示例1: sprintf

         } else {
             $message .= sprintf('<p class="alert alert-success">%s <strong>%s</strong> %s</p>', $PMF_LANG['ad_msg_savedsuc_1'], $user->getLogin(), $PMF_LANG['ad_msg_savedsuc_2']);
             $message .= '<script type="text/javascript">updateUser(' . $userId . ');</script>';
         }
     }
 }
 // delete user confirmation
 if ($userAction == 'delete_confirm' && $user->perm->checkRight($user->getUserId(), 'deluser')) {
     $message = '';
     $user = new PMF_User_CurrentUser($faqConfig);
     $userId = PMF_Filter::filterInput(INPUT_POST, 'user_list_select', FILTER_VALIDATE_INT, 0);
     if ($userId == 0) {
         $message .= sprintf('<p class="alert alert-error">%s</p>', $PMF_LANG['ad_user_error_noId']);
         $userAction = $defaultUserAction;
     } else {
         $user->getUserById($userId);
         // account is protected
         if ($user->getStatus() == 'protected' || $userId == 1) {
             $message .= sprintf('<p class="alert alert-error">%s</p>', $PMF_LANG['ad_user_error_protectedAccount']);
             $userAction = $defaultUserAction;
         } else {
             $twig->loadTemplate('user/delete_confirm.twig')->display(array('PMF_LANG' => $PMF_LANG, 'csrfToken' => $user->getCsrfTokenFromSession(), 'userId' => $userId, 'userLogin' => $user->getLogin()));
         }
     }
 }
 // delete user
 if ($userAction == 'delete' && $user->perm->checkRight($user->getUserId(), 'deluser')) {
     $message = '';
     $user = new PMF_User($faqConfig);
     $userId = PMF_Filter::filterInput(INPUT_POST, 'user_id', FILTER_VALIDATE_INT, 0);
     $csrfOkay = true;
开发者ID:maggiofrancesco,项目名称:phpMyFAQ,代码行数:31,代码来源:user.php

示例2: getFromSession

 /**
  * This static method returns a valid CurrentUser object if there is one
  * in the session that is not timed out. The session-ID is updated if
  * necessary. The CurrentUser will be removed from the session, if it is
  * timed out. If there is no valid CurrentUser in the session or the
  * session is timed out, null will be returned. If the session data is
  * correct, but there is no user found in the user table, false will be
  * returned. On success, a valid CurrentUser object is returned.
  *
  * @static
  *
  * @param  PMF_Configuration $config
  *
  * @return null|PMF_User_CurrentUser
  */
 public static function getFromSession(PMF_Configuration $config)
 {
     // there is no valid user object in session
     if (!isset($_SESSION[PMF_SESSION_CURRENT_USER]) || !isset($_SESSION[PMF_SESSION_ID_TIMESTAMP])) {
         return null;
     }
     // create a new CurrentUser object
     $user = new PMF_User_CurrentUser($config);
     $user->getUserById($_SESSION[PMF_SESSION_CURRENT_USER]);
     // user object is timed out
     if ($user->sessionIsTimedOut()) {
         $user->deleteFromSession();
         $user->errors[] = 'Session timed out.';
         return null;
     }
     // session-id not found in user table
     $session_info = $user->getSessionInfo();
     $session_id = isset($session_info['session_id']) ? $session_info['session_id'] : '';
     if ($session_id == '' || $session_id != session_id()) {
         return false;
     }
     // check ip
     if ($config->get('security.ipCheck') && $session_info['ip'] != $_SERVER['REMOTE_ADDR']) {
         return false;
     }
     // session-id needs to be updated
     if ($user->sessionIdIsTimedOut()) {
         $user->updateSessionId();
     }
     // user is now logged in
     $user->_loggedIn = true;
     // save current user to session and return the instance
     $user->saveToSession();
     return $user;
 }
开发者ID:kapljr,项目名称:Jay-Kaplan-Farmingdale-BCS-Projects,代码行数:50,代码来源:CurrentUser.php

示例3: sprintf

            } else {
                $message .= sprintf('<p class="alert alert-success">%s <strong>%s</strong> %s</p>', $PMF_LANG['ad_msg_savedsuc_1'], $user->getLogin(), $PMF_LANG['ad_msg_savedsuc_2']);
                $message .= '<script type="text/javascript">updateUser(' . $userId . ');</script>';
            }
        }
    }
    // delete user confirmation
    if ($userAction == 'delete_confirm' && $permission['deluser']) {
        $message = '';
        $user = new PMF_User_CurrentUser($faqConfig);
        $userId = PMF_Filter::filterInput(INPUT_POST, 'user_list_select', FILTER_VALIDATE_INT, 0);
        if ($userId == 0) {
            $message .= sprintf('<p class="alert alert-error">%s</p>', $PMF_LANG['ad_user_error_noId']);
            $userAction = $defaultUserAction;
        } else {
            $user->getUserById($userId, true);
            // account is protected
            if ($user->getStatus() == 'protected' || $userId == 1) {
                $message .= sprintf('<p class="alert alert-error">%s</p>', $PMF_LANG['ad_user_error_protectedAccount']);
                $userAction = $defaultUserAction;
            } else {
                ?>
        <header>
            <h2>
                <i class="icon-user"></i> <?php 
                echo $PMF_LANG['ad_user_deleteUser'];
                ?>
 <?php 
                echo $user->getLogin();
                ?>
            </h2>
开发者ID:kapljr,项目名称:Jay-Kaplan-Farmingdale-BCS-Projects,代码行数:31,代码来源:user.php


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