| #0 | Hybrid_Providers_Facebook->initialize() /app/app/library/hybridauth/Hybrid/Provider_Model.php (99) <?php
/**
* HybridAuth
* http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
* (c) 2009-2015, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html
*/
/**
* Hybrid_Provider_Model provide a common interface for supported IDps on HybridAuth.
*
* Basically, each provider adapter has to define at least 4 methods:
* Hybrid_Providers_{provider_name}::initialize()
* Hybrid_Providers_{provider_name}::loginBegin()
* Hybrid_Providers_{provider_name}::loginFinish()
* Hybrid_Providers_{provider_name}::getUserProfile()
*
* HybridAuth also come with three others models
* Class Hybrid_Provider_Model_OpenID for providers that uses the OpenID 1 and 2 protocol.
* Class Hybrid_Provider_Model_OAuth1 for providers that uses the OAuth 1 protocol.
* Class Hybrid_Provider_Model_OAuth2 for providers that uses the OAuth 2 protocol.
*/
abstract class Hybrid_Provider_Model {
/**
* IDp ID (or unique name)
* @var mixed
*/
public $providerId = null;
/**
* Specific provider adapter config
* @var array
*/
public $config = null;
/**
* Provider extra parameters
* @var array
*/
public $params = null;
/**
* Endpoint URL for that provider
* @var string
*/
public $endpoint = null;
/**
* Hybrid_User obj, represents the current loggedin user
* @var Hybrid_User
*/
public $user = null;
/**
* The provider api client (optional)
* @var stdClass
*/
public $api = null;
/**
* Model should use "gzip,deflate" for CURLOPT_ENCODING
* @var stdClass
*/
public $compressed = false;
/** @var bool $useSafeUrls Enable this to replace '.' with '_' characters in the callback urls */
public $useSafeUrls = false;
/**
* Common providers adapter constructor
*
* @param mixed $providerId Provider ID
* @param array $config Provider adapter config
* @param array $params Provider extra params
*/
function __construct($providerId, $config, $params = null) {
# init the IDp adapter parameters, get them from the cache if possible
if (!$params) {
$this->params = Hybrid_Auth::storage()->get("hauth_session.$providerId.id_provider_params");
} else {
$this->params = $params;
}
// idp id
$this->providerId = $providerId;
// set HybridAuth endpoint for this provider
$this->endpoint = Hybrid_Auth::storage()->get("hauth_session.$providerId.hauth_endpoint");
// idp config
$this->config = $config;
// new user instance
$this->user = new Hybrid_User();
$this->user->providerId = $providerId;
// initialize the current provider adapter
$this->initialize();
Hybrid_Logger::debug("Hybrid_Provider_Model::__construct( $providerId ) initialized. dump current adapter instance: ", serialize($this));
}
/**
* IDp wrappers initializer
*
* The main job of wrappers initializer is to performs (depend on the IDp api client it self):
* - include some libs needed by this provider,
* - check IDp key and secret,
* - set some needed parameters (stored in $this->params) by this IDp api client
* - create and setup an instance of the IDp api client on $this->api
*
* @return void
* @throws Exception
*/
abstract protected function initialize();
/**
* Begin login
*
* @return void
* @throws \Exception
*/
abstract public
function loginBegin();
/**
* Finish login
*
* @return void
* @throws \Exception
*/
abstract public function loginFinish();
/**
* Generic logout, just erase current provider adapter stored data to let Hybrid_Auth all forget about it
* @return bool
*/
function logout() {
Hybrid_Logger::info("Enter [{$this->providerId}]::logout()");
$this->clearTokens();
return true;
}
/**
* Grab the user profile from the IDp api client
* @return Hybrid_User_Profile
* @throw Exception
*/
function getUserProfile() {
Hybrid_Logger::error("HybridAuth do not provide users contacts list for {$this->providerId} yet.");
throw new Exception("Provider does not support this feature.", 8);
}
/**
* Load the current logged in user contacts list from the IDp api client
* @return Hybrid_User_Contact[]
* @throws Exception
*/
function getUserContacts() {
Hybrid_Logger::error("HybridAuth do not provide users contacts list for {$this->providerId} yet.");
throw new Exception("Provider does not support this feature.", 8);
}
/**
* Return the user activity stream
* @return Hybrid_User_Activity[]
* @throws Exception
*/
function getUserActivity($stream) {
Hybrid_Logger::error("HybridAuth do not provide user's activity stream for {$this->providerId} yet.");
throw new Exception("Provider does not support this feature.", 8);
}
/**
* Set user status
* @return mixed Provider response
* @throws Exception
*/
function setUserStatus($status) {
Hybrid_Logger::error("HybridAuth do not provide user's activity stream for {$this->providerId} yet.");
throw new Exception("Provider does not support this feature.", 8);
}
/**
* Return the user status
* @return mixed Provider response
* @throws Exception
*/
function getUserStatus($statusid) {
Hybrid_Logger::error("HybridAuth do not provide user's status for {$this->providerId} yet.");
throw new Exception("Provider does not support this feature.", 8);
}
/**
* Return true if the user is connected to the current provider
* @return bool
*/
public function isUserConnected() {
return (bool) Hybrid_Auth::storage()->get("hauth_session.{$this->providerId}.is_logged_in");
}
/**
* Set user to connected
* @return void
*/
public function setUserConnected() {
Hybrid_Logger::info("Enter [{$this->providerId}]::setUserConnected()");
Hybrid_Auth::storage()->set("hauth_session.{$this->providerId}.is_logged_in", 1);
}
/**
* Set user to unconnected
* @return void
*/
public function setUserUnconnected() {
Hybrid_Logger::info("Enter [{$this->providerId}]::setUserUnconnected()");
Hybrid_Auth::storage()->set("hauth_session.{$this->providerId}.is_logged_in", 0);
}
/**
* Get or set a token
* @return string
*/
public function token($token, $value = null) {
if ($value === null) {
return Hybrid_Auth::storage()->get("hauth_session.{$this->providerId}.token.$token");
} else {
Hybrid_Auth::storage()->set("hauth_session.{$this->providerId}.token.$token", $value);
}
}
/**
* Delete a stored token
* @return void
*/
public function deleteToken($token) {
Hybrid_Auth::storage()->delete("hauth_session.{$this->providerId}.token.$token");
}
/**
* Clear all existent tokens for this provider
* @return void
*/
public function clearTokens() {
Hybrid_Auth::storage()->deleteMatch("hauth_session.{$this->providerId}.");
}
}
|
| #1 | Hybrid_Provider_Model->__construct(Facebook, Array([enabled] => 1, [keys] => Array([id] => 1684491378446204, [secret] => 12910123e9e15e2a367417e93bb2607e), [scope] => email, [trustForwarded] => 1), Array([hauth_return_to] => https://new.colindar.es/session/authSocial/facebook)) /app/app/library/hybridauth/Hybrid/Provider_Adapter.php (101) <?php
/**
* HybridAuth
* http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
* (c) 2009-2015, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html
*/
/**
* Hybrid_Provider_Adapter is the basic class which Hybrid_Auth will use
* to connect users to a given provider.
*
* Basically Hybrid_Provider_Adapter will create a bridge from your php
* application to the provider api.
*
* Hybrid_Auth will automatically load Hybrid_Provider_Adapter and create
* an instance of it for each authenticated provider.
*/
class Hybrid_Provider_Adapter {
/**
* Provider ID (or unique name)
* @var mixed
*/
public $id = null;
/**
* Provider adapter specific config
* @var array
*/
public $config = null;
/**
* Provider adapter extra parameters
* @var array
*/
public $params = array();
/**
* Provider adapter wrapper path
* @var string
*/
public $wrapper = null;
/**
* Provider adapter instance
* @var Hybrid_Provider_Model
*/
public $adapter = null;
/**
* Create a new adapter switch IDp name or ID
*
* @param string $id The id or name of the IDp
* @param array $params (optional) required parameters by the adapter
* @return Hybrid_Provider_Adapter
* @throws Exception
*/
function factory($id, $params = array()) {
Hybrid_Logger::info("Enter Hybrid_Provider_Adapter::factory( $id )");
# init the adapter config and params
$this->id = $id;
$this->params = $params;
$this->id = $this->getProviderCiId($this->id);
$this->config = $this->getConfigById($this->id);
# check the IDp id
if (!$this->id) {
throw new Exception("No provider ID specified.", 2);
}
# check the IDp config
if (!$this->config) {
throw new Exception("Unknown Provider ID, check your configuration file.", 3);
}
# check the IDp adapter is enabled
if (!$this->config["enabled"]) {
throw new Exception("The provider '{$this->id}' is not enabled.", 3);
}
# include the adapter wrapper
if (isset($this->config["wrapper"]) && is_array($this->config["wrapper"])) {
if (isset($this->config["wrapper"]["path"])) {
require_once $this->config["wrapper"]["path"];
}
if (!class_exists($this->config["wrapper"]["class"])) {
throw new Exception("Unable to load the adapter class.", 3);
}
$this->wrapper = $this->config["wrapper"]["class"];
} else {
require_once Hybrid_Auth::$config["path_providers"] . $this->id . ".php";
$this->wrapper = "Hybrid_Providers_" . $this->id;
}
# create the adapter instance, and pass the current params and config
$this->adapter = new $this->wrapper($this->id, $this->config, $this->params);
return $this;
}
/**
* Hybrid_Provider_Adapter::login(), prepare the user session and the authentication request
* for index.php
* @return void
* @throw Exception
*/
function login() {
Hybrid_Logger::info("Enter Hybrid_Provider_Adapter::login( {$this->id} ) ");
if (!$this->adapter) {
throw new Exception("Hybrid_Provider_Adapter::login() should not directly used.");
}
// clear all unneeded params
foreach (Hybrid_Auth::$config["providers"] as $idpid => $params) {
Hybrid_Auth::storage()->delete("hauth_session.{$idpid}.hauth_return_to");
Hybrid_Auth::storage()->delete("hauth_session.{$idpid}.hauth_endpoint");
Hybrid_Auth::storage()->delete("hauth_session.{$idpid}.id_provider_params");
}
// make a fresh start
$this->logout();
# get hybridauth base url
if (empty(Hybrid_Auth::$config["base_url"])) {
// the base url wasn't provide, so we must use the current
// url (which makes sense actually)
$url = empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off' ? 'http' : 'https';
$url .= '://' . $_SERVER['HTTP_HOST'];
$url .= $_SERVER['REQUEST_URI'];
$HYBRID_AUTH_URL_BASE = $url;
} else {
$HYBRID_AUTH_URL_BASE = Hybrid_Auth::$config["base_url"];
}
// make sure params is array
if (!is_array($this->params)) {
$this->params = array();
}
# we make use of session_id() as storage hash to identify the current user
# using session_regenerate_id() will be a problem, but ..
$this->params["hauth_token"] = session_id();
# set request timestamp
$this->params["hauth_time"] = time();
# for default HybridAuth endpoint url hauth_login_start_url
# auth.start required the IDp ID
# auth.time optional login request timestamp
if (!isset($this->params["login_start"]) ) {
$this->params["login_start"] = $HYBRID_AUTH_URL_BASE . ( strpos($HYBRID_AUTH_URL_BASE, '?') ? '&' : '?' ) . "hauth.start={$this->id}&hauth.time={$this->params["hauth_time"]}";
}
# for default HybridAuth endpoint url hauth_login_done_url
# auth.done required the IDp ID
if (!isset($this->params["login_done"]) ) {
$this->params["login_done"] = $HYBRID_AUTH_URL_BASE . ( strpos($HYBRID_AUTH_URL_BASE, '?') ? '&' : '?' ) . "hauth.done={$this->id}";
}
# workaround to solve windows live authentication since microsoft disallowed redirect urls to contain any parameters
# http://mywebsite.com/path_to_hybridauth/?hauth.done=Live will not work
if ($this->id=="Live") {
$this->params["login_done"] = $HYBRID_AUTH_URL_BASE."live.php";
}
# Workaround to fix broken callback urls for the Facebook OAuth client
if ($this->adapter->useSafeUrls) {
$this->params['login_done'] = str_replace('hauth.done', 'hauth_done', $this->params['login_done']);
}
if (isset($this->params["hauth_return_to"])) {
Hybrid_Auth::storage()->set("hauth_session.{$this->id}.hauth_return_to", $this->params["hauth_return_to"]);
}
if (isset($this->params["login_done"])) {
Hybrid_Auth::storage()->set("hauth_session.{$this->id}.hauth_endpoint", $this->params["login_done"]);
}
Hybrid_Auth::storage()->set("hauth_session.{$this->id}.id_provider_params", $this->params);
// store config to be used by the end point
Hybrid_Auth::storage()->config("CONFIG", Hybrid_Auth::$config);
// move on
Hybrid_Logger::debug("Hybrid_Provider_Adapter::login( {$this->id} ), redirect the user to login_start URL.");
// redirect
if (empty($this->params["redirect_mode"])) {
Hybrid_Auth::redirect($this->params["login_start"]);
} else {
Hybrid_Auth::redirect($this->params["login_start"],$this->params["redirect_mode"]);
}
}
/**
* Let hybridauth forget all about the user for the current provider
* @return bool
*/
function logout() {
$this->adapter->logout();
}
// --------------------------------------------------------------------
/**
* Return true if the user is connected to the current provider
* @return bool
*/
public function isUserConnected() {
return $this->adapter->isUserConnected();
}
// --------------------------------------------------------------------
/**
* Call adapter methods defined in the adapter model:
* getUserProfile()
* getUserContacts()
* getUserActivity()
* setUserStatus()
*
* @param string $name Method name
* @param array $arguments Call arguments
* @return mixed
* @throws Exception
*/
public function __call($name, $arguments) {
Hybrid_Logger::info("Enter Hybrid_Provider_Adapter::$name(), Provider: {$this->id}");
if (!$this->isUserConnected()) {
throw new Exception("User not connected to the provider {$this->id}.", 7);
}
if (!method_exists($this->adapter, $name)) {
throw new Exception("Call to undefined function Hybrid_Providers_{$this->id}::$name().");
}
return call_user_func_array(array($this->adapter, $name), $arguments);
}
/**
* If the user is connected, then return the access_token and access_token_secret
* if the provider api use oauth
*
* <code>
* array(
* 'access_token' => '',
* 'access_token_secret' => '',
* 'refresh_token' => '',
* 'expires_in' => '',
* 'expires_at' => '',
* )
* </code>
* @return array
*/
public function getAccessToken() {
if (!$this->adapter->isUserConnected()) {
Hybrid_Logger::error("User not connected to the provider.");
throw new Exception("User not connected to the provider.", 7);
}
return array(
"access_token" => $this->adapter->token("access_token"), // OAuth access token
"access_token_secret" => $this->adapter->token("access_token_secret"), // OAuth access token secret
"refresh_token" => $this->adapter->token("refresh_token"), // OAuth refresh token
"expires_in" => $this->adapter->token("expires_in"), // OPTIONAL. The duration in seconds of the access token lifetime
"expires_at" => $this->adapter->token("expires_at"), // OPTIONAL. Timestamp when the access_token expire. if not provided by the social api, then it should be calculated: expires_at = now + expires_in
);
}
/**
* Naive getter of the current connected IDp API client
* @return stdClass
* @throws Exception
*/
function api() {
if (!$this->adapter->isUserConnected()) {
Hybrid_Logger::error("User not connected to the provider.");
throw new Exception("User not connected to the provider.", 7);
}
return $this->adapter->api;
}
/**
* Redirect the user to hauth_return_to (the callback url)
* @return void
*/
function returnToCallbackUrl() {
// get the stored callback url
$callback_url = Hybrid_Auth::storage()->get("hauth_session.{$this->id}.hauth_return_to");
// if the user presses the back button in the browser and we already deleted the hauth_return_to from
// the session in the previous request, we will redirect to '/' instead of displaying a blank page.
if (!$callback_url) {
$callback_url = '/';
}
// remove some unneeded stored data
Hybrid_Auth::storage()->delete("hauth_session.{$this->id}.hauth_return_to");
Hybrid_Auth::storage()->delete("hauth_session.{$this->id}.hauth_endpoint");
Hybrid_Auth::storage()->delete("hauth_session.{$this->id}.id_provider_params");
// back to home
Hybrid_Auth::redirect($callback_url);
}
/**
* Return the provider config by id
*
* @param string $id Config key
* @return mixed
*/
function getConfigById($id) {
if (isset(Hybrid_Auth::$config["providers"][$id])) {
return Hybrid_Auth::$config["providers"][$id];
}
return null;
}
/**
* Return the provider config by id; case insensitive
*
* @param string $id Provider id
* @return mixed
*/
function getProviderCiId($id) {
foreach (Hybrid_Auth::$config["providers"] as $idpid => $params) {
if (strtolower($idpid) == strtolower($id)) {
return $idpid;
}
}
return null;
}
}
|
| #2 | Hybrid_Provider_Adapter->factory(facebook, Array([hauth_return_to] => https://new.colindar.es/session/authSocial/facebook)) /app/app/library/hybridauth/Hybrid/Auth.php (277) <?php
/**
* HybridAuth
* http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
* (c) 2009-2015, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html
*/
/**
* Hybrid_Auth class
*
* Hybrid_Auth class provide a simple way to authenticate users via OpenID and OAuth.
*
* Generally, Hybrid_Auth is the only class you should instanciate and use throughout your application.
*/
class Hybrid_Auth {
public static $version = "2.9.0";
/**
* Configuration array
* @var array
*/
public static $config = array();
/**
* Auth cache
* @var Hybrid_Storage
*/
public static $store = null;
/**
* Error pool
* @var Hybrid_Error
*/
public static $error = null;
/**
* Logger
* @var Hybrid_Logger
*/
public static $logger = null;
/**
* Try to start a new session of none then initialize Hybrid_Auth
*
* Hybrid_Auth constructor will require either a valid config array or
* a path for a configuration file as parameter. To know more please
* refer to the Configuration section:
* http://hybridauth.sourceforge.net/userguide/Configuration.html
*
* @param array $config Configuration array or path to a configratuion file
*/
function __construct($config) {
Hybrid_Auth::initialize($config);
}
/**
* Try to initialize Hybrid_Auth with given $config hash or file
*
* @param array $config Configuration array or path to a configratuion file
* @return void
* @throws Exception
*/
public static function initialize($config) {
if (!is_array($config) && !file_exists($config)) {
throw new Exception("Hybriauth config does not exist on the given path.", 1);
}
if (!is_array($config)) {
$config = include $config;
}
// build some need'd paths
$config["path_base"] = realpath(dirname(__FILE__)) . "/";
$config["path_libraries"] = $config["path_base"] . "thirdparty/";
$config["path_resources"] = $config["path_base"] . "resources/";
$config["path_providers"] = $config["path_base"] . "Providers/";
// reset debug mode
if (!isset($config["debug_mode"])) {
$config["debug_mode"] = false;
$config["debug_file"] = null;
}
# load hybridauth required files, a autoload is on the way...
require_once $config["path_base"] . "Error.php";
require_once $config["path_base"] . "Exception.php";
require_once $config["path_base"] . "Logger.php";
require_once $config["path_base"] . "Provider_Adapter.php";
require_once $config["path_base"] . "Provider_Model.php";
require_once $config["path_base"] . "Provider_Model_OpenID.php";
require_once $config["path_base"] . "Provider_Model_OAuth1.php";
require_once $config["path_base"] . "Provider_Model_OAuth2.php";
require_once $config["path_base"] . "User.php";
require_once $config["path_base"] . "User_Profile.php";
require_once $config["path_base"] . "User_Contact.php";
require_once $config["path_base"] . "User_Activity.php";
if (!class_exists("Hybrid_Storage", false)) {
require_once $config["path_base"] . "Storage.php";
}
// hash given config
Hybrid_Auth::$config = $config;
// instance of log mng
Hybrid_Auth::$logger = new Hybrid_Logger();
// instance of errors mng
Hybrid_Auth::$error = new Hybrid_Error();
// start session storage mng
Hybrid_Auth::$store = new Hybrid_Storage();
Hybrid_Logger::info("Enter Hybrid_Auth::initialize()");
Hybrid_Logger::info("Hybrid_Auth::initialize(). PHP version: " . PHP_VERSION);
Hybrid_Logger::info("Hybrid_Auth::initialize(). Hybrid_Auth version: " . Hybrid_Auth::$version);
Hybrid_Logger::info("Hybrid_Auth::initialize(). Hybrid_Auth called from: " . Hybrid_Auth::getCurrentUrl());
// PHP Curl extension [http://www.php.net/manual/en/intro.curl.php]
if (!function_exists('curl_init')) {
Hybrid_Logger::error('Hybridauth Library needs the CURL PHP extension.');
throw new Exception('Hybridauth Library needs the CURL PHP extension.');
}
// PHP JSON extension [http://php.net/manual/en/book.json.php]
if (!function_exists('json_decode')) {
Hybrid_Logger::error('Hybridauth Library needs the JSON PHP extension.');
throw new Exception('Hybridauth Library needs the JSON PHP extension.');
}
// session.name
if (session_name() != "PHPSESSID") {
Hybrid_Logger::info('PHP session.name diff from default PHPSESSID. http://php.net/manual/en/session.configuration.php#ini.session.name.');
}
// safe_mode is on
if (ini_get('safe_mode')) {
Hybrid_Logger::info('PHP safe_mode is on. http://php.net/safe-mode.');
}
// open basedir is on
if (ini_get('open_basedir')) {
Hybrid_Logger::info('PHP open_basedir is on. http://php.net/open-basedir.');
}
Hybrid_Logger::debug("Hybrid_Auth initialize. dump used config: ", serialize($config));
Hybrid_Logger::debug("Hybrid_Auth initialize. dump current session: ", Hybrid_Auth::storage()->getSessionData());
Hybrid_Logger::info("Hybrid_Auth initialize: check if any error is stored on the endpoint...");
if (Hybrid_Error::hasError()) {
$m = Hybrid_Error::getErrorMessage();
$c = Hybrid_Error::getErrorCode();
$p = Hybrid_Error::getErrorPrevious();
Hybrid_Logger::error("Hybrid_Auth initialize: A stored Error found, Throw an new Exception and delete it from the store: Error#$c, '$m'");
Hybrid_Error::clearError();
// try to provide the previous if any
// Exception::getPrevious (PHP 5 >= 5.3.0) http://php.net/manual/en/exception.getprevious.php
if (version_compare(PHP_VERSION, '5.3.0', '>=') && ($p instanceof Exception)) {
throw new Exception($m, $c, $p);
} else {
throw new Exception($m, $c);
}
}
Hybrid_Logger::info("Hybrid_Auth initialize: no error found. initialization succeed.");
}
/**
* Hybrid storage system accessor
*
* Users sessions are stored using HybridAuth storage system ( HybridAuth 2.0 handle PHP Session only) and can be accessed directly by
* Hybrid_Auth::storage()->get($key) to retrieves the data for the given key, or calling
* Hybrid_Auth::storage()->set($key, $value) to store the key => $value set.
*
* @return Hybrid_Storage
*/
public static function storage() {
return Hybrid_Auth::$store;
}
/**
* Get hybridauth session data
* @return string|null
*/
function getSessionData() {
return Hybrid_Auth::storage()->getSessionData();
}
/**
* Restore hybridauth session data
*
* @param string $sessiondata Serialized session data
* @retun void
*/
function restoreSessionData($sessiondata = null) {
Hybrid_Auth::storage()->restoreSessionData($sessiondata);
}
/**
* Try to authenticate the user with a given provider.
*
* If the user is already connected we just return and instance of provider adapter,
* ELSE, try to authenticate and authorize the user with the provider.
*
* $params is generally an array with required info in order for this provider and HybridAuth to work,
* like :
* hauth_return_to: URL to call back after authentication is done
* openid_identifier: The OpenID identity provider identifier
* google_service: can be "Users" for Google user accounts service or "Apps" for Google hosted Apps
*
* @param string $providerId ID of the provider
* @param array $params Params
* @return
*/
public static function authenticate($providerId, $params = null) {
Hybrid_Logger::info("Enter Hybrid_Auth::authenticate( $providerId )");
if (!Hybrid_Auth::storage()->get("hauth_session.$providerId.is_logged_in")) {
// if user not connected to $providerId then try setup a new adapter and start the login process for this provider
Hybrid_Logger::info("Hybrid_Auth::authenticate( $providerId ), User not connected to the provider. Try to authenticate..");
$provider_adapter = Hybrid_Auth::setup($providerId, $params);
$provider_adapter->login();
} else {
// else, then return the adapter instance for the given provider
Hybrid_Logger::info("Hybrid_Auth::authenticate( $providerId ), User is already connected to this provider. Return the adapter instance.");
return Hybrid_Auth::getAdapter($providerId);
}
}
/**
* Return the adapter instance for an authenticated provider
*
* @param string $providerId ID of the provider
* @return Hybrid_Provider_Adapter
*/
public static function getAdapter($providerId = null) {
Hybrid_Logger::info("Enter Hybrid_Auth::getAdapter( $providerId )");
return Hybrid_Auth::setup($providerId);
}
/**
* Setup an adapter for a given provider
*
* @param string $providerId ID of the provider
* @param array $params Adapter params
* @return Hybrid_Provider_Adapter
*/
public static function setup($providerId, $params = null) {
Hybrid_Logger::debug("Enter Hybrid_Auth::setup( $providerId )", $params);
if (!$params) {
$params = Hybrid_Auth::storage()->get("hauth_session.$providerId.id_provider_params");
Hybrid_Logger::debug("Hybrid_Auth::setup( $providerId ), no params given. Trying to get the stored for this provider.", $params);
}
if (!$params) {
$params = array();
Hybrid_Logger::info("Hybrid_Auth::setup( $providerId ), no stored params found for this provider. Initialize a new one for new session");
}
if (is_array($params) && !isset($params["hauth_return_to"])) {
$params["hauth_return_to"] = Hybrid_Auth::getCurrentUrl();
Hybrid_Logger::debug("Hybrid_Auth::setup( $providerId ). HybridAuth Callback URL set to: ", $params["hauth_return_to"]);
}
# instantiate a new IDProvider Adapter
$provider = new Hybrid_Provider_Adapter();
$provider->factory($providerId, $params);
return $provider;
}
/**
* Check if the current user is connected to a given provider
*
* @param string $providerId ID of the provider
* @return bool
*/
public static function isConnectedWith($providerId) {
return (bool) Hybrid_Auth::storage()->get("hauth_session.{$providerId}.is_logged_in");
}
/**
* Return array listing all authenticated providers
* @return array
*/
public static function getConnectedProviders() {
$idps = array();
foreach (Hybrid_Auth::$config["providers"] as $idpid => $params) {
if (Hybrid_Auth::isConnectedWith($idpid)) {
$idps[] = $idpid;
}
}
return $idps;
}
/**
* Return array listing all enabled providers as well as a flag if you are connected
*
* <code>
* array(
* 'Facebook' => array(
* 'connected' => true
* )
* )
* </code>
* @return array
*/
public static function getProviders() {
$idps = array();
foreach (Hybrid_Auth::$config["providers"] as $idpid => $params) {
if ($params['enabled']) {
$idps[$idpid] = array('connected' => false);
if (Hybrid_Auth::isConnectedWith($idpid)) {
$idps[$idpid]['connected'] = true;
}
}
}
return $idps;
}
/**
* A generic function to logout all connected provider at once
* @return void
*/
public static function logoutAllProviders() {
$idps = Hybrid_Auth::getConnectedProviders();
foreach ($idps as $idp) {
$adapter = Hybrid_Auth::getAdapter($idp);
$adapter->logout();
}
}
/**
* Utility function, redirect to a given URL with php header or using javascript location.href
*
* @param string $url URL to redirect to
* @param string $mode PHP|JS
*/
public static function redirect($url, $mode = "PHP") {
if(!$mode){
$mode = 'PHP';
}
Hybrid_Logger::info("Enter Hybrid_Auth::redirect( $url, $mode )");
// Ensure session is saved before sending response, see https://github.com/symfony/symfony/pull/12341
if ((PHP_VERSION_ID >= 50400 && PHP_SESSION_ACTIVE === session_status()) || (PHP_VERSION_ID < 50400 && isset($_SESSION) && session_id())) {
session_write_close();
}
if ($mode == "PHP") {
header("Location: $url");
} elseif ($mode == "JS") {
echo '<html>';
echo '<head>';
echo '<script type="text/javascript">';
echo 'function redirect(){ window.top.location.href="' . $url . '"; }';
echo '</script>';
echo '</head>';
echo '<body onload="redirect()">';
echo 'Redirecting, please wait...';
echo '</body>';
echo '</html>';
}
die();
}
/**
* Utility function, return the current url
*
* @param bool $request_uri true to get $_SERVER['REQUEST_URI'], false for $_SERVER['PHP_SELF']
* @return string
*/
public static function getCurrentUrl($request_uri = true) {
if (PHP_SAPI === 'cli') {
return '';
}
$protocol = 'http://';
if ((isset($_SERVER['HTTPS']) && ( $_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1 ))
|| (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))
{
$protocol = 'https://';
}
$url = $protocol . $_SERVER['HTTP_HOST'];
if ($request_uri) {
$url .= $_SERVER['REQUEST_URI'];
} else {
$url .= $_SERVER['PHP_SELF'];
}
// return current url
return $url;
}
}
|
| #3 | Hybrid_Auth::setup(facebook, Array([hauth_return_to] => https://new.colindar.es/session/authSocial/facebook)) /app/app/library/hybridauth/Hybrid/Auth.php (229) <?php
/**
* HybridAuth
* http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
* (c) 2009-2015, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html
*/
/**
* Hybrid_Auth class
*
* Hybrid_Auth class provide a simple way to authenticate users via OpenID and OAuth.
*
* Generally, Hybrid_Auth is the only class you should instanciate and use throughout your application.
*/
class Hybrid_Auth {
public static $version = "2.9.0";
/**
* Configuration array
* @var array
*/
public static $config = array();
/**
* Auth cache
* @var Hybrid_Storage
*/
public static $store = null;
/**
* Error pool
* @var Hybrid_Error
*/
public static $error = null;
/**
* Logger
* @var Hybrid_Logger
*/
public static $logger = null;
/**
* Try to start a new session of none then initialize Hybrid_Auth
*
* Hybrid_Auth constructor will require either a valid config array or
* a path for a configuration file as parameter. To know more please
* refer to the Configuration section:
* http://hybridauth.sourceforge.net/userguide/Configuration.html
*
* @param array $config Configuration array or path to a configratuion file
*/
function __construct($config) {
Hybrid_Auth::initialize($config);
}
/**
* Try to initialize Hybrid_Auth with given $config hash or file
*
* @param array $config Configuration array or path to a configratuion file
* @return void
* @throws Exception
*/
public static function initialize($config) {
if (!is_array($config) && !file_exists($config)) {
throw new Exception("Hybriauth config does not exist on the given path.", 1);
}
if (!is_array($config)) {
$config = include $config;
}
// build some need'd paths
$config["path_base"] = realpath(dirname(__FILE__)) . "/";
$config["path_libraries"] = $config["path_base"] . "thirdparty/";
$config["path_resources"] = $config["path_base"] . "resources/";
$config["path_providers"] = $config["path_base"] . "Providers/";
// reset debug mode
if (!isset($config["debug_mode"])) {
$config["debug_mode"] = false;
$config["debug_file"] = null;
}
# load hybridauth required files, a autoload is on the way...
require_once $config["path_base"] . "Error.php";
require_once $config["path_base"] . "Exception.php";
require_once $config["path_base"] . "Logger.php";
require_once $config["path_base"] . "Provider_Adapter.php";
require_once $config["path_base"] . "Provider_Model.php";
require_once $config["path_base"] . "Provider_Model_OpenID.php";
require_once $config["path_base"] . "Provider_Model_OAuth1.php";
require_once $config["path_base"] . "Provider_Model_OAuth2.php";
require_once $config["path_base"] . "User.php";
require_once $config["path_base"] . "User_Profile.php";
require_once $config["path_base"] . "User_Contact.php";
require_once $config["path_base"] . "User_Activity.php";
if (!class_exists("Hybrid_Storage", false)) {
require_once $config["path_base"] . "Storage.php";
}
// hash given config
Hybrid_Auth::$config = $config;
// instance of log mng
Hybrid_Auth::$logger = new Hybrid_Logger();
// instance of errors mng
Hybrid_Auth::$error = new Hybrid_Error();
// start session storage mng
Hybrid_Auth::$store = new Hybrid_Storage();
Hybrid_Logger::info("Enter Hybrid_Auth::initialize()");
Hybrid_Logger::info("Hybrid_Auth::initialize(). PHP version: " . PHP_VERSION);
Hybrid_Logger::info("Hybrid_Auth::initialize(). Hybrid_Auth version: " . Hybrid_Auth::$version);
Hybrid_Logger::info("Hybrid_Auth::initialize(). Hybrid_Auth called from: " . Hybrid_Auth::getCurrentUrl());
// PHP Curl extension [http://www.php.net/manual/en/intro.curl.php]
if (!function_exists('curl_init')) {
Hybrid_Logger::error('Hybridauth Library needs the CURL PHP extension.');
throw new Exception('Hybridauth Library needs the CURL PHP extension.');
}
// PHP JSON extension [http://php.net/manual/en/book.json.php]
if (!function_exists('json_decode')) {
Hybrid_Logger::error('Hybridauth Library needs the JSON PHP extension.');
throw new Exception('Hybridauth Library needs the JSON PHP extension.');
}
// session.name
if (session_name() != "PHPSESSID") {
Hybrid_Logger::info('PHP session.name diff from default PHPSESSID. http://php.net/manual/en/session.configuration.php#ini.session.name.');
}
// safe_mode is on
if (ini_get('safe_mode')) {
Hybrid_Logger::info('PHP safe_mode is on. http://php.net/safe-mode.');
}
// open basedir is on
if (ini_get('open_basedir')) {
Hybrid_Logger::info('PHP open_basedir is on. http://php.net/open-basedir.');
}
Hybrid_Logger::debug("Hybrid_Auth initialize. dump used config: ", serialize($config));
Hybrid_Logger::debug("Hybrid_Auth initialize. dump current session: ", Hybrid_Auth::storage()->getSessionData());
Hybrid_Logger::info("Hybrid_Auth initialize: check if any error is stored on the endpoint...");
if (Hybrid_Error::hasError()) {
$m = Hybrid_Error::getErrorMessage();
$c = Hybrid_Error::getErrorCode();
$p = Hybrid_Error::getErrorPrevious();
Hybrid_Logger::error("Hybrid_Auth initialize: A stored Error found, Throw an new Exception and delete it from the store: Error#$c, '$m'");
Hybrid_Error::clearError();
// try to provide the previous if any
// Exception::getPrevious (PHP 5 >= 5.3.0) http://php.net/manual/en/exception.getprevious.php
if (version_compare(PHP_VERSION, '5.3.0', '>=') && ($p instanceof Exception)) {
throw new Exception($m, $c, $p);
} else {
throw new Exception($m, $c);
}
}
Hybrid_Logger::info("Hybrid_Auth initialize: no error found. initialization succeed.");
}
/**
* Hybrid storage system accessor
*
* Users sessions are stored using HybridAuth storage system ( HybridAuth 2.0 handle PHP Session only) and can be accessed directly by
* Hybrid_Auth::storage()->get($key) to retrieves the data for the given key, or calling
* Hybrid_Auth::storage()->set($key, $value) to store the key => $value set.
*
* @return Hybrid_Storage
*/
public static function storage() {
return Hybrid_Auth::$store;
}
/**
* Get hybridauth session data
* @return string|null
*/
function getSessionData() {
return Hybrid_Auth::storage()->getSessionData();
}
/**
* Restore hybridauth session data
*
* @param string $sessiondata Serialized session data
* @retun void
*/
function restoreSessionData($sessiondata = null) {
Hybrid_Auth::storage()->restoreSessionData($sessiondata);
}
/**
* Try to authenticate the user with a given provider.
*
* If the user is already connected we just return and instance of provider adapter,
* ELSE, try to authenticate and authorize the user with the provider.
*
* $params is generally an array with required info in order for this provider and HybridAuth to work,
* like :
* hauth_return_to: URL to call back after authentication is done
* openid_identifier: The OpenID identity provider identifier
* google_service: can be "Users" for Google user accounts service or "Apps" for Google hosted Apps
*
* @param string $providerId ID of the provider
* @param array $params Params
* @return
*/
public static function authenticate($providerId, $params = null) {
Hybrid_Logger::info("Enter Hybrid_Auth::authenticate( $providerId )");
if (!Hybrid_Auth::storage()->get("hauth_session.$providerId.is_logged_in")) {
// if user not connected to $providerId then try setup a new adapter and start the login process for this provider
Hybrid_Logger::info("Hybrid_Auth::authenticate( $providerId ), User not connected to the provider. Try to authenticate..");
$provider_adapter = Hybrid_Auth::setup($providerId, $params);
$provider_adapter->login();
} else {
// else, then return the adapter instance for the given provider
Hybrid_Logger::info("Hybrid_Auth::authenticate( $providerId ), User is already connected to this provider. Return the adapter instance.");
return Hybrid_Auth::getAdapter($providerId);
}
}
/**
* Return the adapter instance for an authenticated provider
*
* @param string $providerId ID of the provider
* @return Hybrid_Provider_Adapter
*/
public static function getAdapter($providerId = null) {
Hybrid_Logger::info("Enter Hybrid_Auth::getAdapter( $providerId )");
return Hybrid_Auth::setup($providerId);
}
/**
* Setup an adapter for a given provider
*
* @param string $providerId ID of the provider
* @param array $params Adapter params
* @return Hybrid_Provider_Adapter
*/
public static function setup($providerId, $params = null) {
Hybrid_Logger::debug("Enter Hybrid_Auth::setup( $providerId )", $params);
if (!$params) {
$params = Hybrid_Auth::storage()->get("hauth_session.$providerId.id_provider_params");
Hybrid_Logger::debug("Hybrid_Auth::setup( $providerId ), no params given. Trying to get the stored for this provider.", $params);
}
if (!$params) {
$params = array();
Hybrid_Logger::info("Hybrid_Auth::setup( $providerId ), no stored params found for this provider. Initialize a new one for new session");
}
if (is_array($params) && !isset($params["hauth_return_to"])) {
$params["hauth_return_to"] = Hybrid_Auth::getCurrentUrl();
Hybrid_Logger::debug("Hybrid_Auth::setup( $providerId ). HybridAuth Callback URL set to: ", $params["hauth_return_to"]);
}
# instantiate a new IDProvider Adapter
$provider = new Hybrid_Provider_Adapter();
$provider->factory($providerId, $params);
return $provider;
}
/**
* Check if the current user is connected to a given provider
*
* @param string $providerId ID of the provider
* @return bool
*/
public static function isConnectedWith($providerId) {
return (bool) Hybrid_Auth::storage()->get("hauth_session.{$providerId}.is_logged_in");
}
/**
* Return array listing all authenticated providers
* @return array
*/
public static function getConnectedProviders() {
$idps = array();
foreach (Hybrid_Auth::$config["providers"] as $idpid => $params) {
if (Hybrid_Auth::isConnectedWith($idpid)) {
$idps[] = $idpid;
}
}
return $idps;
}
/**
* Return array listing all enabled providers as well as a flag if you are connected
*
* <code>
* array(
* 'Facebook' => array(
* 'connected' => true
* )
* )
* </code>
* @return array
*/
public static function getProviders() {
$idps = array();
foreach (Hybrid_Auth::$config["providers"] as $idpid => $params) {
if ($params['enabled']) {
$idps[$idpid] = array('connected' => false);
if (Hybrid_Auth::isConnectedWith($idpid)) {
$idps[$idpid]['connected'] = true;
}
}
}
return $idps;
}
/**
* A generic function to logout all connected provider at once
* @return void
*/
public static function logoutAllProviders() {
$idps = Hybrid_Auth::getConnectedProviders();
foreach ($idps as $idp) {
$adapter = Hybrid_Auth::getAdapter($idp);
$adapter->logout();
}
}
/**
* Utility function, redirect to a given URL with php header or using javascript location.href
*
* @param string $url URL to redirect to
* @param string $mode PHP|JS
*/
public static function redirect($url, $mode = "PHP") {
if(!$mode){
$mode = 'PHP';
}
Hybrid_Logger::info("Enter Hybrid_Auth::redirect( $url, $mode )");
// Ensure session is saved before sending response, see https://github.com/symfony/symfony/pull/12341
if ((PHP_VERSION_ID >= 50400 && PHP_SESSION_ACTIVE === session_status()) || (PHP_VERSION_ID < 50400 && isset($_SESSION) && session_id())) {
session_write_close();
}
if ($mode == "PHP") {
header("Location: $url");
} elseif ($mode == "JS") {
echo '<html>';
echo '<head>';
echo '<script type="text/javascript">';
echo 'function redirect(){ window.top.location.href="' . $url . '"; }';
echo '</script>';
echo '</head>';
echo '<body onload="redirect()">';
echo 'Redirecting, please wait...';
echo '</body>';
echo '</html>';
}
die();
}
/**
* Utility function, return the current url
*
* @param bool $request_uri true to get $_SERVER['REQUEST_URI'], false for $_SERVER['PHP_SELF']
* @return string
*/
public static function getCurrentUrl($request_uri = true) {
if (PHP_SAPI === 'cli') {
return '';
}
$protocol = 'http://';
if ((isset($_SERVER['HTTPS']) && ( $_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1 ))
|| (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))
{
$protocol = 'https://';
}
$url = $protocol . $_SERVER['HTTP_HOST'];
if ($request_uri) {
$url .= $_SERVER['REQUEST_URI'];
} else {
$url .= $_SERVER['PHP_SELF'];
}
// return current url
return $url;
}
}
|
| #4 | Hybrid_Auth::authenticate(facebook) /app/app/controllers/SessionController.php (580) <?php
namespace Colindar\Controllers;
use Colindar\Auth\Exception as AuthException;
use Colindar\Forms\ForgotPasswordForm;
use Colindar\Forms\LoginForm;
use Colindar\Forms\SignUpForm;
use Colindar\Marcas\Marca;
use Colindar\Models\Business;
use Colindar\Models\Community;
use Colindar\Models\Homes;
use Colindar\Models\RememberTokens;
use Colindar\Models\ResetPasswords;
use Colindar\Models\UserDetails;
use Colindar\Models\Users;
use Colindar\Models\UsersHomes;
use Exception;
use Hybrid_Auth;
use Hybrid_Endpoint;
use Phalcon\Assets\Filters\Cssmin;
use Phalcon\Mvc\Dispatcher;
use Phalcon\Mvc\View;
use Phalcon\Tag;
require_once(APP_DIR . '/library/hybridauth/Hybrid/Auth.php');
require_once(APP_DIR . '/library/hybridauth/Hybrid/Endpoint.php');
/**
* Controller used handle non-authenticated session actions like login/logout, user signup, and forgotten passwords
*/
class SessionController extends ControllerBase
{
/**
* Default action. Set the public layout (layouts/public.volt)
*/
public
function initialize()
{
parent::initialize();
$this->view->setTemplateBefore('public');
$this->assetsmanager
->collection('css')
->addCss('components/bootstrap-social/bootstrap-social.css')
// ->addCss('js/plugins/slick/slick/slick.css', true, false) // no se puede comprimir!!
// ->join(true)
// ->addFilter(new Cssmin());
;
$this->assetsmanager
->collection('js')
->addJs('https://cdnjs.cloudflare.com/ajax/libs/Glide.js/3.0.2/glide.js', false, false)
;
}
public
function indexAction()
{
//necesario para que funcione este plugin
Hybrid_Endpoint::process();
}
public
function beforeExecuteRoute(
Dispatcher $dispatcher
) {
//sobreescribimos para evitar el ciclyng route
return true;
}
/**
* Usaremos esta acción para los vecinos que quieran unirse a la plataforma
* por el bidi o por el codigo
*/
public
function joinAction(
string $joinCode,
string $homeCode = null
) {
[, $communityId] = explode('-', $joinCode, 2);
if (!$communityId) {
$this->flash->error(
$this->translation->_(
'Ha ocurrido un error al obtener la información de su comunidad, puede ser que el enlace que esté usando sea antiguo'
)
);
return $this->dispatcher->forward(
[
'controller' => 'index',
'action' => 'index',
]
);
}
$community = Community::findFirstById($communityId);
if (!$community) {
$this->flash->error(
$this->translation->_(
'Ha ocurrido un error al obtener la información de su comunidad, puede ser que el enlace que esté usando sea antiguo'
)
);
return $this->dispatcher->forward(
[
'controller' => 'index',
'action' => 'index',
]
);
}
if ($community->isClosed()) {
$this->flashSession->error($this->translation->_('Este entorno está cerrado o esta dirección de registro ya no está activa'));
return $this->dispatcher->forward(
[
'controller' => 'index',
'action' => 'index',
]
);
}
if (!$community->isSelectedOption('access_by_url')
/*|| ($community->isSelectedOption('control_access') && $homeCode !== null)*/
) {
$this->flashSession->error($this->translation->_('Este enlace de registro ya no está activo'));
return $this->dispatcher->forward(
[
'controller' => 'index',
'action' => 'index',
]
);
}
Tag::setTitle('Reservar ✅ ' . $community->name);
$this->view->descriptionTag = '⌛ Reserva en ' . $community->name . " ✍ y sus instalaciones con total comodidad y seguridad desde la app móvil o desde la web. ¡Reserva ya!";
setCookiesWithConsent('join-code', $joinCode, time() + 3600);
$this->cookies->set('join-code', $joinCode, time() + 3600);
$this->view->community = $community;
$this->view->facilities = $community->getFacilities([
'reservable = true'
]);
/*
* Buscamos el listado de hogares vacios
*/
$canCreateNewHome = $community->isSelectedOption('create_homes');
$this->view->canCreateNewHome = $canCreateNewHome;
/*
* Buscamos el hogar
*/
$this->view->home = null;
if ($homeCode !== null) {
$homes = $community->getHomes([
'code = ?0',
'bind' => [$homeCode]
]);
if (count($homes) === 0) {
$this->flashSession->error(
$this->translation->_(
'Parece no ser un código válido, no se ha encontrado ninguna propiedad o grupo con ese código'
)
);
return $this->dispatcher->forward(
[
'controller' => 'index',
'action' => 'index',
]
);
}
if (count($homes) === 1) {
$home = $homes->getFirst();
if (count($home->getColindados()) > 0 && (!$community->isSelectedOption('over_one'))) {
$this->flashSession->warning(
$this->translation->_(
'Ya hay algún usuario registrado en este propiedad, si realiza el registro eliminará la anterior cuenta.'
)
);
}
}
$this->view->home = $home;
}
if (!$canCreateNewHome && $homeCode === null) {
$this->view->homes = $community->getListHomesWithoutUsers(); //para seleccionable
}
$form = new SignUpForm(null, [
'communityId' => $community->id
]);
if ($this->request->isPost()) {
$form->isValid($this->request->getPost());
}
$this->view->form = $form;
$this->view->joinCode = $joinCode;
$this->view->aaff = $community->aaff;
}
public
function signupAction()
{
// https://colindar.com/#demo
// $url_demo = Marca::get()->getUrlDemo();
//
// return $this->response->redirect($url_demo);
return $this->response->redirect('/session/signupnormal');
}
/**
* Allow a user to signup to the system
*/
public
function signupnormalAction()
{
Tag::setTitle($this->translation->_('Registro'));
$this->view->descriptionTag = $this->translation->_('Registro de la aplicación de reservas.');
$joinCode = $this->cookies->get('join-code')->getValue();
if ($joinCode !== null) {
[, $communityId] = explode('-', $joinCode, 2);
if (!$communityId) {
$this->flash->error(
$this->translation->_(
'Ha ocurrido un error al obtener la información de su comunidad, puede ser que el enlace que esté usando sea antiguo'
)
);
return $this->dispatcher->forward(
[
'controller' => 'index',
'action' => 'index',
]
);
}
$form = new SignUpForm(null, [
'communityId' => $communityId,
]);
} else {
$form = new SignUpForm();
}
$this->view->closed = true;
if ($this->request->isPost() && $form->isValid($this->request->getPost()) !== false) {
$email = $this->request->getPost('email');
$user = Users::findFirstByEmail($email);
if ($user) {
//relacionamos y ya está
$name = $this->request->getPost('name', 'striptags');
if (!$this->createHomeInSign($name, $user)) {
$this->flashSession->error('Ya hay una propiedad con el mismo nombre');
$user->delete();
return $this->response->redirect('/');
}
$this->flashSession->notice(
$this->translation->_(
'Hemos detectado que ya existe un usuario con este email así que la hemos relacionado. Acceda con su usuario y su contraseña. Si no recuerda la contraseña use la opción "Olvidé mi contraseña"'
)
);
return $this->response->redirect('/');
}
//Seguimos por aquí si es un usuario nuevo (email no existe)
$user = new Users();
$email = strtolower(trim($email));
if ($this->isBannedMail($email)) {
$this->flashSession->error(
$this->translation->_(
'No aceptamos servicios de emails anónimos. Se ha generado un reporte con su IP %IP% y otros datos para ser auditado por Colindar Team.',
['IP' => $this->request->getClientAddress()]
)
);
return $this->dispatcher->forward(
[
'controller' => 'index',
'action' => 'index',
]
);
}
$name = $this->request->getPost('name', 'striptags');
$user->assign(
[
'name' => $name,
'surname' => $this->request->getPost('surname', 'striptags'),
'nif' => $this->request->getPost('dni', 'striptags'),
'email' => $email,
'password' => $this->security->hash($this->request->getPost('password')),
'profilesId' => Users::ROL_NORMAL
]
);
$user->setParamsEmail([
'esInvitado' => false,
]);
if ($user->save()) {
$homeCreated = $this->createHomeInSign($name, $user);
if (!$homeCreated) {
$this->flashSession->error('Ya exite una propiedad con este nombre.');
$user->delete();
return $this->response->redirect('/');
}
$this->flashSession->notice(
$this->translation->_(
'Hemos enviado un correo a su cuenta, siga las instrucciones allí detalladas. Si no lo ve revise la carpeta de SPAM.'
)
);
$this->flashSession->notice(
$this->translation->_('Si no lo recibe puede volver a enviarse el enlace de confirmación.')
);
return $this->response->redirect('/');
}
foreach ($user->getMessages() as $message) {
$this->flash->error($message);
}
}
/*
* Si ha entrado por enlace directo, se le redirige alli de nuevo
*/
$joinCode = $this->cookies->get('join-code')->getValue();
if ($joinCode) {
$this->flash->warning($this->translation->_('Hubo un error en algunos de los campos del formulario.'));
return $this->dispatcher->forward([
'controller' => 'session',
'action' => 'join',
'params' => [$joinCode]
]);
}
$this->view->form = $form;
/*
* Sacamos si viene por registro normal o por Administrador de Fincas/Presidente
*/
$this->view->special = 'false';
}
private
function isBannedMail(
string $email
): bool {
$banned_mail = [
'mvrht',
'yopmail',
'cool',
'jetable',
'nospam',
'nomail',
'mega',
'speed',
'courriel',
'moncourrier',
'monemail',
'monmail',
'hidemyass',
'mytrashmail',
'mailnesia',
'notsharingmy',
'mailinator',
'discard.email',
'lovesea.gq',
'btcmail.pw',
'knol-power.nl',
'everytg.ml',
'freemeil.gq',
'info-radio.ml',
'liveradio.tk',
'resgedvgfed.tk',
'susi.ml',
'muehlacker.tk',
'hartbot.de',
'lovefall.ml',
'keinpardon.de',
'savelife.ml',
'blutig.me',
'u14269.ml',
'freundin.ru',
'breadtimes.press',
'cyber-phone.eu',
'premium-mail.fr',
'disign-concept.eu',
'ecolo-online.fr',
'photo-impact.eu',
'web-ideal.fr',
'wazabi.club',
'used-product.fr',
'cyber-innovation.club',
'reality-concept.club',
'last-chance.pro',
'disign-revelation.com',
'art-en-ligne.pro',
'solar-impact.pro',
'smashmail.de',
'social-mailer.tk',
'teamspeak3.ga',
'gamno.config.work',
'smap.4nmv.ru',
'spam.2012-2016.ru',
'chechnya.conf.work',
'phus8kajuspa.cu.cc',
'shitaway.cu.cc',
'yourlifesucks.cu.cc',
'shitaway.tk',
'shitaway.cf',
'shitaway.ml',
'shitaway.ga',
'shitaway.gq',
'shitaway.igg.biz',
'shitaway.usa.cc',
'shitaway.nut.cc',
'shitaway.flu.cc',
'zhouemail.510520.org',
'contrasto.cu.cc',
'shockinmytown.cu.cc',
'jet-renovation.fr',
'babau.usa.cc',
'babau.nut.cc',
'babau.igg.biz',
'babau.flu.cc',
'babau.ml',
'babau.cf',
'babau.ga',
'babau.gq',
'goooogle.igg.biz',
'goooogle.nut.cc',
'goooogle.flu.cc',
'goooogle.usa.cc',
'mrresourcepacks.tk',
'takko345.wang ',
'zeta-telecom.com',
'2-ch.space',
'kanker.website',
'hoer.pw',
'belastingdienst.pw',
'puttanamaiala.tk',
'frappina99.tk',
'fragolina2.tk',
'tarzanmail',
'sperma.cf',
'zarratib',
'merda.tk',
'merda.ga',
'merda.gq',
'merda.ml',
'merda.cf',
'epicuro.tk',
'myway.com',
'DingBone.com',
'FudgeRub.com',
'LookUgly.com',
'SmellFear.com',
'tempinbox',
'mailbox92',
'awdrt.org',
'gexik.com',
'ttirv.com'
];
foreach ($banned_mail as $mailserve) {
if (strpos($email, $mailserve) !== false) {
return true;
}
}
return false;
}
/**
* Allow a user to signup to the system
*/
public
function signupAAFFAction()
{
Tag::setTitle($this->translation->_('Registro'));
$this->view->descriptionTag = $this->translation->_(
'Registro de la aplicación que ayuda a los vecinos en la gestión de su comunidad de propietarios.'
);
$form = new SignUpForm();
if ($this->request->isPost()) {
if ($form->isValid($this->request->getPost()) != false) {
$user = new Users();
$email = $this->request->getPost('email');
$email = strtolower(trim($email));
if ($this->isBannedMail($email)) {
$this->flashSession->error(
$this->translation->_(
'No aceptamos servicios de emails anónimos. Se ha generado un reporte con su IP %IP% y otros datos para ser auditado por Colindar Team.',
['IP' => $this->request->getClientAddress()]
)
);
return $this->dispatcher->forward(
[
'controller' => 'index',
'action' => 'index',
]
);
}
$user->assign(
[
'name' => $this->request->getPost('name', 'striptags'),
'surname' => $this->request->getPost('surname', 'striptags'),
'email' => $email,
'password' => $this->security->hash($this->request->getPost('password')),
'profilesId' => Users::ROL_ADMINFINCAS
]
);
$user->setParamsEmail([
'esInvitado' => false,
]);
if ($user->save()) {
$this->flashSession->notice(
$this->translation->_(
'Hemos enviado un correo a su cuenta, siga las instrucciones allí detalladas. Si no lo ve revise la carpeta de SPAM.'
)
);
$this->flashSession->notice(
$this->translation->_('Si no lo recibe puede volver a enviarse el enlace de confirmación.')
);
return $this->response->redirect('/');
}
foreach ($user->getMessages() as $message) {
$this->flash->error($message);
}
}
}
$this->view->form = $form;
$this->view->special = 'true';
}
public
function authSocialAction(
$provider
) {
$config = APP_DIR . '/library/hybridauth/config.php';
$hybridauth = new Hybrid_Auth($config);
try {
// $hybridauth_2.10 = $this->authsocial;
$adapter = $hybridauth->authenticate($provider);
$user_profile = $adapter->getUserProfile();
$email = trim($user_profile->email);
//guardamos y listo
$authUser = new UserDetails();
$authUser->identifier = $user_profile->identifier;
$authUser->webSiteURL = $user_profile->webSiteURL;
$authUser->profileURL = $user_profile->profileURL;
$authUser->photoURL = $user_profile->photoURL;
$authUser->displayName = $user_profile->displayName;
$authUser->description = $user_profile->description;
$authUser->firstName = $user_profile->firstName;
$authUser->lastName = $user_profile->lastName;
$authUser->gender = $user_profile->gender;
$authUser->language = $user_profile->language;
$authUser->age = (int)$user_profile->age;
$authUser->birthDay = (int)$user_profile->birthDay;
$authUser->birthMonth = (int)$user_profile->birthMonth;
$authUser->birthYear = (int)$user_profile->birthYear;
$authUser->email = $user_profile->email;
$authUser->phone = $user_profile->phone;
$authUser->address = $user_profile->address;
$authUser->country = $user_profile->country;
$authUser->region = $user_profile->region;
$authUser->city = $user_profile->city;
$authUser->zip = $user_profile->zip;
$authUser->username = isset($user_profile->username) ? $user_profile->username : '';
$authUser->coverInfoURL = isset($user_profile->coverInfoURL) ? $user_profile->coverInfoURL : '';
$user = Users::findFirstByEmail($email);
if (!$user) {
//1.- Usuario no existe, registramos
$user = new Users();
$user->email = $user_profile->email;
$user->name = $user_profile->firstName;
$user->profilesId = Users::DEFAULT_PROFILE;
$user->active = 'Y';
if ($user->save() == false) {
foreach ($user->getMessages() as $message) {
$this->flash->error($message);
}
}
}
if (is_null($authUser->idUser)) {
//2.- Obtenermos el idUser y lo guardamos
$authUser->idUser = $user->id;
if ($authUser->save() === false) {
foreach ($authUser->getMessages() as $message) {
$this->flash->error($message);
}
}
}
$this->auth->check([
'usuario' => $email,
'password' => null,
'remember' => 'on'
], $provider);
return $this->dispatcher->forward(
[
'controller' => 'dashboard',
'action' => 'index',
]
);
} catch (Exception $e) {
//Error Code Description
//http://hybridauth.sourceforge.net/userguide/Errors_and_Exceptions_Handling.html
//0 Unspecified error
//1 Hybriauth configuration error
//2 Provider not properly configured
//3 Unknown or disabled provider
//4 Missing provider application credentials (your application id, key or secret)
//5 Authentification failed
//6 User profile request failed
//7 User not connected to the provider
//8 Provider does not support this feature
if ($e->getCode() == 5 or $e->getCode() == 6) {
$this->flash->error($this->translation->_('Hemos detectado un error: ') . $e->getMessage());
$this->dispatcher->forward(
[
'controller' => 'session',
'action' => 'login',
]
);
return;
}
throw $e;
}
}
/**
* Starts a session in the admin backend
*/
public
function loginAction(
$idAAFF = null
) {
Tag::setTitle($this->translation->_('Login'));
$this->view->descriptionTag = $this->translation->_(Marca::get()->getDescriptive());
$this->view->business = null;
if ($idAAFF !== null) {
$idAAFF = Business::tokenLoginDecode($idAAFF);
if ($idAAFF !== null && is_numeric($idAAFF)) {
$business = Business::findFirst($idAAFF);
if ($business) {
$this->view->business = $business;
}
}
}
//mostramos página login
$form = new LoginForm();
if (!$this->request->isPost()) {
if ($this->auth->hasRememberMe()) {
return $this->auth->loginWithRememberMe();
}
} else {
if ($form->isValid($this->request->getPost()) === false) {
foreach ($form->getMessages() as $message) {
$this->flash->error($message);
}
} else {
$usuario = $this->request->getPost('usuario', 'string');
$usuario = mb_strtolower(trim($usuario));
try {
$this->auth->check(
[
'usuario' => $usuario,
'password' => $this->request->getPost('password'),
'remember' => $this->request->getPost('remember')
]
);
} catch (AuthException $e) {
$this->flashSession->error('<strong>ERROR LOGIN</strong><br><br> ' . $e->getMessage());
return $this->response->redirect('/login');
}
$url_redirect = $this->session->get('url_redirect');
if ($url_redirect !== null) {
$this->session->remove('url_redirect');
return $this->response->redirect($url_redirect);
}
return $this->response->redirect('/dashboard');
}
}
$this->view->form = $form;
}
public
function setLanguageAction(
$lang,
$idUser = null
) {
//deshabilitamos la vista para peticiones ajax
$this->view->disable();
$this->view->disableLevel(View::LEVEL_MAIN_LAYOUT);
//guardamos por cookies la elección del user
setCookiesWithConsent('code', $lang);
// $this->cookies->set('code', $lang);
//guardamos en la por bbdd
if (is_null($idUser)) {
$user = $this->auth->getUser();
} else {
$user = Users::findFirstById($idUser);
}
//si no hay usuario guardamos en cookies y ya está
if ($user) {
$user->lang = $lang;
@$user->save();
}
return $this->_redirectBack();
}
public
function activateAccountAction()
{
return $this->dispatcher->forward([
'controller' => 'session',
'action' => 'forgotPassword',
'params' => ['activate']
]);
}
/**
* Shows the forgot password form
*/
public
function forgotPasswordAction(
$action = null
) {
Tag::setTitle($this->translation->_('Recuperar contraseña'));
$this->view->descriptionTag = $this->translation->_(
'Recupera la contraseña de tu cuenta o vuelve a recibir el correo de confirmación de registro.'
);
if (is_null($action)) {
$this->view->title = $this->translation->_('Generar una nueva contraseña');
$this->view->subtitle = $this->translation->_(
'Se enviará un correo y/o un WhatsApp con un enlace para generar una nueva contraseña.'
);
} else {
$this->view->title = $this->translation->_('Confirmar cuenta');
$this->view->subtitle = $this->translation->_(
'<p><h3>Para poder entrar en la aplicación debes confirmar tu email y/o WhatsApp.</h3><hr> </p> <p>Si no has recibido las instrucciones de como hacerlo, pon tu email y/o WhatsApp en el formulario inferior y te las volveremos a mandar.</p><p>Una vez pulses en el enlace que te mandamos tu cuenta quedará confirmada. </p><p>Si aun no has especificado tu contraseña, la aplicación te pedirá que elijas una.</p>'
);
}
//eliminamos rastro que pueda haber
$this->auth->remove();
$form = new ForgotPasswordForm();
if ($this->request->isPost()) {
if ($form->isValid($this->request->getPost()) == false) {
foreach ($form->getMessages() as $message) {
$this->flash->error($message);
}
} else {
// $user = Users::findFirstByEmail($this->request->getPost('email'));
$dato_contacto = $this->request->getPost('usuario', 'string');
$user = Users::getUserByEmailOrMovil($dato_contacto);
if (!$user) {
$this->flash->warning($this->translation->_('No hay cuenta asociada a este email'));
} else {
try {
$resetPassword = new ResetPasswords();
$resetPassword->usersId = $user->id;
if ($resetPassword->save()) {
$this->flash->success(
$this->translation->_(
'Se le ha mandado un correo y/o WhatsApp, por favor sigua las indicaciones'
)
);
} else {
foreach ($resetPassword->getMessages() as $message) {
$this->flash->error($message);
}
}
} catch (Exception $e) {
$this->flash->error($e->getMessage());
}
}
}
}
$this->view->form = $form;
}
/**
* Closes the session
*/
public
function logoutAction()
{
$this->auth->remove();
$this->user = null;
return $this->response->redirect('index');
}
/**
* Login with token only for app mobile
*/
public
function loginWithTokenAction(
$token,
$redirect = ''
) {
$remember = RememberTokens::findFirstByToken($token);
if (!$remember || !$remember->user) {
echo $this->translation->_('Ha caducado su sessión, vuelva a hacer login en su aplicación móvil.');
return;
}
$user = $remember->user;
if ($remember) {
try {
// Check if the user was flagged
$this->auth->checkUserFlags($user);
} catch (Exception $e) {
$this->flashSession->error('<strong>ERROR LOGIN</strong><br><br> ' . $e->getMessage());
return $this->response->redirect('/login');
}
$user->setSession();
if ($redirect === '') {
return $this->response->redirect('/dashboard');
}
$redirect = base64_decode($redirect);
$redirect = HTTPS . '://' . DOMINIO . '/' . $redirect;
return $this->response->redirect($redirect);
}
$this->auth->registerUserThrottling($user->id);
return $this->response->redirect('/session');
}
public
function loginFromSuperAdminAction(
$uuid
) {
$user = Users::findFirstByUuid($uuid);
if (!$user) {
echo $this->translation->_('No se ha encontrado al usuario.');
return;
}
try {
// Check if the user was flagged
$this->auth->checkUserFlags($user);
} catch (Exception $e) {
$this->flashSession->error('<strong>ERROR LOGIN</strong><br><br> ' . $e->getMessage());
return $this->response->redirect('/login');
}
$user->setSession();
$this->auth->createRememberEnviroment($user);
return $this->response->redirect('/dashboard');
}
protected
function checkAndGetUser()
{
return false;
}
private
function validAccess(
?int $community_id
): bool {
if ($community_id === null) {
return false;
}
$community = Community::findFirstById($community_id);
return $community && !$community->isSelectedOption('control_access');
}
private
function createHomeInSign(
$name,
Users $user
): bool {
/**
* Comprobamos si venimos desde una comunidad, si es así:
* 1.- Creamos un hogar temporal
* 2.- Asignamos ese hogar a la comunidad susodicha
*/
$communityId = $this->request->getPost('communityId', 'int');
// $joinCode = $this->request->getPost('joinCode', 'string');
$homeCode = $this->request->getPost('homeCode', 'string');
$homeName = $this->request->getPost('nameHome', 'string');
if ($communityId !== '' && $communityId !== null) {
$community = Community::findFirstById($communityId);
$home = false;
if ($homeCode !== null) {
//relacionamos
$homes = $community->getHomes([
'code = ?0',
'bind' => [$homeCode]
]);
if (count($homes) === 1) {
$home = $homes->getFirst();
/**
* Si la opción 'over_one' está desactivada, solo permitimos un usuario por propiedad
*/
$colindados = $home->getColindados();
if (count($colindados) > 0 && (!$community->isSelectedOption('over_one'))) {
$this->flashSession->warning('Únicamente se permite un usuario por propiedad.');
foreach ($colindados as $colindado) {
$uh = UsersHomes::findFirst([
'idUser = ?0 and idHome = ?1',
'bind' => [
$colindado->id,
$home->id
]
]);
if ($uh && $uh->delete()) {
$this->flashSession->warning(
sprintf(
'El usuario %s ha sido eliminado de la propiedad %s',
$colindado->getName(),
$home->getName()
)
);
}
}
}
}
}
if (!$home) {
//creamos
if ($homeName === '' || $homeName === null) {
$alias = $name;
} else {
$alias = $this->request->getPost('nameHome', 'string');
}
// if (MARCA === 'COLINDAR'){
// $home = Homes::findFirst([
// 'communityId = ?0 and alias = ?1',
// 'bind' => [
// $communityId,
// $alias
// ]
// ]);
//
// if ($home){
// $this->flashSession->error('Ya hay una propiedad con el mismo nombre.');
//
// return false;
// }
// }
$home = new Homes();
$home->alias = $alias;
$home->active = $this->validAccess($communityId);
$home->createBy = $user->id;
$home->communityId = $communityId;
$home->save();
}
$user->homePrincipal = $home->id;
$user->homes = $home;
$user->save();
// if ($joinCode !== null && $joinCode !== '') {
//si venimos de enlace de registro o QR entonces mandamos emails para validar
// }
$home->sendMailAdminForValidateAccount($community);
}
return true;
}
private
function duplicateInCommunities(
$communityId,
Homes $home,
Users $user
): void {
if ((int)$communityId === 2466) { //VILLADA
//registrar tb en las comunidades 4595 (padel) y 4596 (gim)
$newHome1 = new Homes();
$newHome1->alias = $home->alias;
$newHome1->createBy = $home->createBy;
$newHome1->type = $home->type;
$newHome1->active = $home->active;
$newHome1->communityId = 4595;
$newHome1->create();
$uh = new UsersHomes();
$uh->idHome = $newHome1->id;
$uh->idUser = $user->id;
$uh->save();
$newHome2 = new Homes();
$newHome2->alias = $home->alias;
$newHome2->createBy = $home->createBy;
$newHome2->type = $home->type;
$newHome2->active = $home->active;
$newHome2->communityId = 4596;
$newHome2->create();
$uh = new UsersHomes();
$uh->idHome = $newHome2->id;
$uh->idUser = $user->id;
$uh->save();
}
}
}
|
| #5 | Colindar\Controllers\SessionController->authSocialAction(facebook) |
| #6 | Phalcon\Dispatcher->callActionMethod(Object(Colindar\Controllers\SessionController), authSocialAction, Array([0] => facebook)) |
| #7 | Phalcon\Dispatcher->dispatch() |
| #8 | Phalcon\Mvc\Application->handle() /app/public/index.php (75) <?php
use Colindar\Auth\Exception as AuthException;
use Phalcon\Di;
use Phalcon\Mvc\Application;
try {
/**
* Define some useful constants
*/
define('BASE_DIR', dirname(__DIR__));
define('APP_DIR', BASE_DIR . '/app');
defined('PUBLIC_DIR') || define('PUBLIC_DIR', BASE_DIR . '/public');
// http://stackoverflow.com/questions/16383776/detect-in-app-browser-webview-with-php-javascript
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] === 'com.colindar.ionic' || $_SERVER['HTTP_X_REQUESTED_WITH'] === 'com.Reservar_Zona_Comun.reservarzonacomun')) {
define('MOBILE', 'TRUE');
} elseif (isset($_SERVER['HTTP_USER_AGENT'])
&& ((strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile/') !== false)
&& (strpos($_SERVER['HTTP_USER_AGENT'], 'Safari/') !== false))) {
define('MOBILE', 'TRUE');
} else {
define('MOBILE', 'FALSE');
}
define('HTTPS',
((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] === 443)) ? "https" : "http");
define('DOMINIO', $_SERVER['HTTP_HOST'] ?? 'app.colindar.es');
define('IP', $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0');
if (strpos(DOMINIO, "colindar") !== false) {
define('MARCA', 'COLINDAR');
} elseif (strpos(DOMINIO, "graman") !== false) {
define('MARCA', 'GRAMAN');
} elseif (strpos(DOMINIO, "reservarzonacomun") !== false) {
define('MARCA', 'RZC');
} elseif (strpos(DOMINIO, "reserbando") !== false) {
define('MARCA', 'RESERBANDO');
} else {
define('MARCA', 'MICOMUNIWEB');
}
if (strpos(DOMINIO, "dev") !== false || strpos(DOMINIO, "localhost") !== false || getenv('DOCKER_ENV') === 'true') {
//estamos trabajando en desarrollo (TARA o Docker local)
define('DEBUG', true);
error_reporting(E_ALL);
ini_set("display_errors", "1");
} else {
//estamos en app.colindar.es o app.reservarzonacomun.com, osea en MAX
define('DEBUG', false);
}
/**
* Read the configuration
*/
$config = include APP_DIR . '/config/config.php';
/**
* Read auto-loader
*/
include APP_DIR . '/config/loader.php';
/**
* Read services
*/
include APP_DIR . '/config/services.php';
/**
* Handle the request
*/
$application = new Application($di);
echo $application->handle()->getContent();
} catch (AuthException $e) {
Di::getDefault()->getFlashSession()->error($e->getMessage());
header("Location: " . HTTPS . "://" . DOMINIO . "/406");
die();
} catch (Error $e) {
sendReportError($e);
triggerDebugPanel($e);
header("Location: " . HTTPS . "://" . DOMINIO . "/406");
die();
} catch (Exception $e) {
triggerDebugPanel($e);
if ((int)$e->getCode() === 2) {
Di::getDefault()
->getFlashSession()
->error(t("Enlace roto, el Equipo de Colindar ha recibido un aviso. Pronto lo solucionarán.<br> Se le redirige a la página principal. "));
header("Location: " . HTTPS . "://" . DOMINIO . "/");
}
sendReportError($e);
header("Location: " . HTTPS . "://" . DOMINIO . "/406");
die();
} |
| Key | Value |
|---|---|
| _url | /session/authSocial/facebook |
| Key | Value |
|---|---|
| STRIPE_TEST_PUBLIC_KEY | |
| HOSTNAME | 10d2e4d6f31f |
| DEBUG | true |
| DB_PORT | 3306 |
| PHP_INI_DIR | /usr/local/etc/php |
| CRYPT_SALT | d46f02d7e25d2a1b4199cd40fce7639dc9d1cd1b59a06f0514f0ef87e03cf678 |
| HOME | /var/www |
| DB_NAME | colindar |
| STRIPE_CONNECT_LIVE | |
| AWS_BACKUP_BUCKET | |
| STRIPE_TEST_SECRET_KEY | |
| PHP_LDFLAGS | -Wl,-O1 -pie |
| PHP_CFLAGS | -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 |
| PHP_VERSION | 7.3.33 |
| MEMCACHED_HOST | memcached |
| GPG_KEYS | CBAF69F173A0FEA4B537F470D66C9593118BCCB6 F38252826ACD957EF380D39F2F7956BC5DA04B5D |
| PHP_CPPFLAGS | -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 |
| PHP_ASC_URL | https://www.php.net/distributions/php-7.3.33.tar.xz.asc |
| PHP_URL | https://www.php.net/distributions/php-7.3.33.tar.xz |
| PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
| MEMCACHED_PORT | 11211 |
| DOCKER_ENV | true |
| STRIPE_CONNECT_TEST | |
| RECAPTCHA_PUBLIC_KEY | |
| STRIPE_LIVE_PUBLIC_KEY | |
| AWS_ACCESS_KEY_ID | |
| AWS_SECRET_ACCESS_KEY | |
| RECAPTCHA_SECRET_KEY | |
| STRIPE_LIVE_SECRET_KEY | |
| DB_PASSWORD | 27d5f477b64ed53634ff6ac7f4a7c396 |
| APP_ENV | staging |
| PHPIZE_DEPS | autoconf dpkg-dev file g++ gcc libc-dev make pkg-config re2c |
| PWD | /app |
| PHP_SHA256 | 166eaccde933381da9516a2b70ad0f447d7cec4b603d07b9a916032b215b90cc |
| DB_HOST | mysql |
| DB_USER | colindar |
| USER | www-data |
| HTTP_X_REAL_IP | 216.73.216.151 |
| HTTP_X_FORWARDED_SERVER | e59560ec7836 |
| HTTP_X_FORWARDED_PROTO | https |
| HTTP_X_FORWARDED_PORT | 443 |
| HTTP_X_FORWARDED_HOST | new.colindar.es |
| HTTP_X_FORWARDED_FOR | 216.73.216.151 |
| HTTP_ACCEPT_ENCODING | gzip, br, zstd, deflate |
| HTTP_ACCEPT | */* |
| HTTP_USER_AGENT | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com) |
| HTTP_HOST | new.colindar.es |
| SCRIPT_FILENAME | /app/public/index.php |
| PATH_TRANSLATED | /app/public |
| PATH_INFO | |
| REDIRECT_STATUS | 200 |
| SERVER_NAME | _ |
| SERVER_PORT | 80 |
| SERVER_ADDR | 172.18.0.3 |
| REMOTE_PORT | 39120 |
| REMOTE_ADDR | 172.18.0.2 |
| SERVER_SOFTWARE | nginx/1.24.0 |
| GATEWAY_INTERFACE | CGI/1.1 |
| REQUEST_SCHEME | http |
| SERVER_PROTOCOL | HTTP/1.1 |
| DOCUMENT_ROOT | /app/public |
| DOCUMENT_URI | /index.php |
| REQUEST_URI | /session/authSocial/facebook |
| SCRIPT_NAME | /index.php |
| CONTENT_LENGTH | |
| CONTENT_TYPE | |
| REQUEST_METHOD | GET |
| QUERY_STRING | _url=/session/authSocial/facebook& |
| FCGI_ROLE | RESPONDER |
| PHP_SELF | /index.php |
| REQUEST_TIME_FLOAT | 1768120477.6422 |
| REQUEST_TIME | 1768120477 |
| argv | Array([0] => _url=/session/authSocial/facebook&) |
| argc | 1 |
| # | Path |
|---|---|
| 0 | /app/public/index.php |
| 1 | /app/app/config/config.php |
| 2 | /app/app/config/loader.php |
| 3 | /app/vendor/autoload.php |
| 4 | /app/vendor/composer/autoload_real.php |
| 5 | /app/vendor/composer/platform_check.php |
| 6 | /app/vendor/composer/ClassLoader.php |
| 7 | /app/vendor/composer/autoload_static.php |
| 8 | /app/vendor/symfony/polyfill-mbstring/bootstrap.php |
| 9 | /app/vendor/symfony/deprecation-contracts/function.php |
| 10 | /app/vendor/symfony/polyfill-intl-normalizer/bootstrap.php |
| 11 | /app/vendor/symfony/polyfill-php72/bootstrap.php |
| 12 | /app/vendor/symfony/polyfill-php80/bootstrap.php |
| 13 | /app/vendor/ralouphie/getallheaders/src/getallheaders.php |
| 14 | /app/vendor/symfony/polyfill-intl-idn/bootstrap.php |
| 15 | /app/vendor/guzzlehttp/promises/src/functions_include.php |
| 16 | /app/vendor/guzzlehttp/promises/src/functions.php |
| 17 | /app/vendor/symfony/polyfill-php81/bootstrap.php |
| 18 | /app/vendor/ezyang/htmlpurifier/library/HTMLPurifier.composer.php |
| 19 | /app/vendor/guzzlehttp/guzzle/src/functions_include.php |
| 20 | /app/vendor/guzzlehttp/guzzle/src/functions.php |
| 21 | /app/vendor/symfony/polyfill-ctype/bootstrap.php |
| 22 | /app/vendor/symfony/polyfill-iconv/bootstrap.php |
| 23 | /app/vendor/symfony/translation/Resources/functions.php |
| 24 | /app/vendor/globalcitizen/php-iban/oophp-iban.php |
| 25 | /app/vendor/globalcitizen/php-iban/php-iban.php |
| 26 | /app/vendor/ramsey/uuid/src/functions.php |
| 27 | /app/vendor/swiftmailer/swiftmailer/lib/swift_required.php |
| 28 | /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php |
| 29 | /app/app/library/functions.php |
| 30 | /app/app/config/services.php |
| 31 | /app/app/config/routes.php |
| 32 | /app/app/controllers/SessionController.php |
| 33 | /app/app/library/hybridauth/Hybrid/Auth.php |
| 34 | /app/app/library/hybridauth/Hybrid/Endpoint.php |
| 35 | /app/app/controllers/ControllerBase.php |
| 36 | /app/app/library/Assets/AssetsManager.php |
| 37 | /app/app/library/Marcas/Marca.php |
| 38 | /app/app/library/Marcas/Base.php |
| 39 | /app/app/library/Translate/Translate.php |
| 40 | /app/app/lang/en/en.php |
| 41 | /app/app/models/Translations.php |
| 42 | /app/app/library/Auth/Auth.php |
| 43 | /app/app/models/Users.php |
| 44 | /app/app/models/ModelBase.php |
| 45 | /app/app/interfaces/hasNamespace.php |
| 46 | /app/app/models/Files.php |
| 47 | /app/app/interfaces/hasNotifications.php |
| 48 | /app/app/library/hybridauth/config.php |
| 49 | /app/app/library/hybridauth/Hybrid/Error.php |
| 50 | /app/app/library/hybridauth/Hybrid/Exception.php |
| 51 | /app/app/library/hybridauth/Hybrid/Logger.php |
| 52 | /app/app/library/hybridauth/Hybrid/Provider_Adapter.php |
| 53 | /app/app/library/hybridauth/Hybrid/Provider_Model.php |
| 54 | /app/app/library/hybridauth/Hybrid/Provider_Model_OpenID.php |
| 55 | /app/app/library/hybridauth/Hybrid/Provider_Model_OAuth1.php |
| 56 | /app/app/library/hybridauth/Hybrid/Provider_Model_OAuth2.php |
| 57 | /app/app/library/hybridauth/Hybrid/User.php |
| 58 | /app/app/library/hybridauth/Hybrid/User_Profile.php |
| 59 | /app/app/library/hybridauth/Hybrid/User_Contact.php |
| 60 | /app/app/library/hybridauth/Hybrid/User_Activity.php |
| 61 | /app/app/library/hybridauth/Hybrid/Storage.php |
| 62 | /app/app/library/hybridauth/Hybrid/StorageInterface.php |
| 63 | /app/app/library/hybridauth/Hybrid/Providers/Facebook.php |
| Memory | |
|---|---|
| Usage | 2097152 |