/** * @return null|string */ public function getToken() { foreach ($this->providers as $provider) { $token = $provider->getToken(); if ($token) { return $token; } } if ($this->defaultProvider !== null) { return $this->defaultProvider->getToken(); } return null; }
/** * Retrieves configuration information from the database, if possible - while * ensuring that config.ini overwrites db fields. */ function load() { if ($config = \Idno\Core\Idno::site()->db()->getAnyRecord('config')) { $this->default_config = false; unset($config['dbname']); // Ensure we don't accidentally load protected data from db unset($config['dbpass']); unset($config['dbhost']); unset($config['dbstring']); unset($config['path']); unset($config['url']); unset($config['host']); unset($config['feed']); unset($config['uploadpath']); //unset($config['initial_plugins']); unset($config['antiplugins']); unset($config['alwaysplugins']); unset($config['session_path']); unset($config['session_hash_function']); unset($config['sessions_database']); unset($config['cookie_jar']); unset($config['proxy_string']); unset($config['proxy_type']); unset($config['disable_ssl_verify']); unset($config['upload_tmp_dir']); unset($config['bypass_fulltext_search']); $this->config = array_replace_recursive($this->config, $config); } $this->loadIniFiles(); // If we don't have a site secret, create it if (!isset($this->site_secret)) { $token_generator = new TokenProvider(); $this->site_secret = bin2hex($token_generator->generateToken(64)); $this->save(); } }