Find users as "$id" => "$displayName" pairs

@param   null|string|array   $state
@param   null|bool           $confirmed
@return  array
550064
public function findOptions( $state     = Structure::STATE_ACTIVE,
                                 $confirmed = true )
    {
        $where = array();

        if ( ! empty( $state ) )
        {
            $where['state'] = $state;
        }

        if ( null !== $confirmed )
        {
            $where['confirmed'] = (bool) $confirmed;
        }

        return $this->getMapper()
                    ->findOptions(
                        array(
                            'value'         => 'id',
                            'label'         => 'displayName',
                            'data-email'    => 'email',
                            'data-avatar'   => 'avatar',
                        ),
                        $where,
                        array(
                            'displayName'   => 'ASC',
                            'id'            => 'ASC',
                        )
                    );
    }
111234
public function getAuthorizeUserInfo($state = 'authorize', $scope = 'snsapi_base')
    {
        $request = Yii::$app->request;
        if (($code = $request->get('code')) && $request->get('state') == $state) {
            return $this->getOauth2AccessToken($code);
        } else {
            Yii::$app->getResponse()->redirect($this->getOauth2AuthorizeUrl($request->getAbsoluteUrl(), $state, $scope));
            Yii::$app->end();
        }
    }
778066
public static function findByUsername($username, $checkStatus = true)
    {
        return static::findOne(
            $checkStatus ?
                ['username' => $username, 'status' => self::STATUS_ACTIVE] :
                ['username' => $username]
        );
    }
175644
private function loadStateIdentifiers(): array
    {
        if ($this->stateIdentifiers === null) {
            $this->stateIdentifiers = $this->repository->sudo(
                static function (Repository $repository): array {
                    $stateIdentifiers = [];

                    $stateGroups = $repository->getObjectStateService()->loadObjectStateGroups();
                    foreach ($stateGroups as $stateGroup) {
                        $stateIdentifiers[$stateGroup->identifier] = [];

                        $states = $repository->getObjectStateService()->loadObjectStates($stateGroup);
                        foreach ($states as $state) {
                            $stateIdentifiers[$stateGroup->identifier][] = $state->identifier;
                        }
                    }

                    return $stateIdentifiers;
                }
            );
        }

        return $this->stateIdentifiers;
    }
1362051
private function extractAvailableStateMethodNames(StateInterface $state)
    {
        $methodNames = array();
        $reflection = new \ReflectionClass(get_class($state));

        $publicMethods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC);

        foreach ($publicMethods as $method) {
            if ($this->isTransitionMethod($method->getName())
                && $method->getDeclaringClass()->getName() === $reflection->getName()) {
                $methodNames[] = $method->getName();
            }
        }

        return $methodNames;
    }
945521
public function existsButNotConfirmed($input)
    {
        $given_identity = $input[$this->identity()];

        $account = $this->findByIdentity([$this->identity() => $given_identity]);

        if($account){

            $correctPassword = $this->checkPassword($account, $input);

            return (!$account->confirmed && $correctPassword);
        }
    }
1001451
public function getTranslatedList($user_id, $status = true)
    {
        $conditions = array(
            'status' => $status,
            'user_id' => $user_id
        );

        $addresses = array();
        foreach ((array) $this->getList($conditions) as $address_id => $address) {
            $addresses[$address_id] = $this->getTranslated($address, true);
        }

        return $addresses;
    }
95027
protected function getBatchActionConfirmationResponse($actionId, array $selectedIds)
    {
        $response = null;

        if (empty($selectedIds)) {
            // No IDs, so redirect to the index page.
            $response = $this->getIndexRedirectionResponse();
        } else {
            // There are IDs, so display the confirmation page.
            $response = $this->getHtmlResponse();
            $collectionName = $this->getCollectionName();
            $response->setTemplateId(sprintf('%s/%s',
                $collectionName,
                $actionId
            ));
            $response->setData($collectionName, $selectedIds);
        }

        return $response;
    }
217046
public function checkState($storeState, $state = null)
	{
		if(null === $state)
		{
			if(null === $this->state)
			{
				if(isset($_GET['state']))
				{
					$state = $_GET['state'];
				}
				else
				{
					$state = '';
				}
			}
			else
			{
				$state = $this->state;
			}
		}
		return $storeState === $state;
	}
155182
public function getCodeFields($state = null)
    {
        $fields = [
            'client_id' => $this->clientId,
            'redirect_uri' => $this->redirectUrl,
            'view' => $this->view,
            'response_type' => 'code',
        ];

        if ($this->usesState()) {
            $fields['state'] = $state;
        }

        return $fields;
    }
230309
public static function confirm_link_login($userid, $username, $issuerid, $token) {
        if (empty($token) || empty($userid) || empty($issuerid) || empty($username)) {
            return false;
        }
        $params = [
            'userid' => $userid,
            'username' => $username,
            'issuerid' => $issuerid,
            'confirmtoken' => $token,
        ];

        $login = linked_login::get_record($params);
        if (empty($login)) {
            return false;
        }
        $expires = $login->get('confirmtokenexpires');
        if (time() > $expires) {
            $login->delete();
            return;
        }
        $login->set('confirmtokenexpires', 0);
        $login->set('confirmtoken', '');
        $login->update();
        return true;
    }
1188116
public static function getDisplayName($id)
    {
        $instance = self::_instance();

        if (!isset($instance->_items[$id])) {
            return false;
        }
        return $instance->_items[$id]['displayName'];
    }
867195
public function setState(?string $state): Webhook
    {
        if (null !== $state) {
            Assert::oneOf($state, self::VALID_STATES);

            $this->state = $state;
        }

        return $this;
    }
671835
public function sqlStateIn($state, $list) {
		$stateMap = array(
			'42S02'=>RedBean_QueryWriter::C_SQLSTATE_NO_SUCH_TABLE,
			'42S22'=>RedBean_QueryWriter::C_SQLSTATE_NO_SUCH_COLUMN,
			'23000'=>RedBean_QueryWriter::C_SQLSTATE_INTEGRITY_CONSTRAINT_VIOLATION
		);
		return in_array((isset($stateMap[$state]) ? $stateMap[$state] : '0'),$list); 
	}
857093
public function Confirm($Action, $LogIDs = '') {
      $this->Permission('Garden.Moderation.Manage');
      
      $this->Form->InputPrefix = '';
      $this->Form->IDPrefix = 'Confirm_';

      if (trim($LogIDs))
         $LogIDArray = explode(',', $LogIDs);
      else
         $LogIDArray = array();
      
      // We also want to collect the users from the log.
      $Logs = $this->LogModel->GetIDs($LogIDArray);
      $Users = array();
      foreach ($Logs as $Log) {
         $UserID = $Log['RecordUserID'];
         if (!$UserID)
            continue;
         $Users[$UserID] = array('UserID' => $UserID);
      }
      Gdn::UserModel()->JoinUsers($Users, array('UserID'));
      $this->SetData('Users', $Users);

      $this->SetData('Action', $Action);
      $this->SetData('ActionUrl', Url("/log/$Action?logids=".urlencode($LogIDs)));
      $this->SetData('ItemCount', count($LogIDArray));

      $this->Render();
   }
1364056
public function actionLogin(array $confirm_data, $goto)
    {
        $url = 'http://hiapi.ahnames.com/verifyConfirmation?' . http_build_query([
            'auth_ip'       => Yii::$app->request->getUserIp(),
            'what'          => 'redirect_hipanel',
            'confirm_data'  => $confirm_data,
        ]);
        $res = Json::decode(file_get_contents($url));
        if (!empty($res['login']) && empty($res['_error'])) {
            $user = $this->user->findIdentity($res['login']);
        } else {
            throw new ForbiddenHttpException('Bad confirmation', 0, new BadConfirmException($res));
        }
        if (!$user) {
            Yii::$app->session->setFlash('error', Yii::t('hiam', 'Failed login.'));
            return $this->goHome();
        }

        $this->user->login($user);

        return $this->redirect($goto);
    }
504776
public function stateId(array $values)
    {
        $count = count($values);
        $ids = array_filter($values, 'ctype_digit');

        if ($count != count($ids)) {
            return $this->translation->text('@field has invalid value', array(
                '@field' => $this->translation->text('Condition')));
        }

        $existing = array_filter($values, function ($state_id) {
            $state = $this->state->get($state_id);
            return isset($state['state_id']);
        });

        if ($count != count($existing)) {
            return $this->translation->text('@name is unavailable', array(
                '@name' => $this->translation->text('Country state')));
        }

        return true;
    }