$data['identity'] = $provider; if (isset($data['name'])) { $data['fullname'] = $data['name']; } $user = User::get_by_identity_openidConnectSub($provider, $data['sub']); if (!$user && $oidc->getPlainOpenid()) { // This may be the first time the user logs in after the migration from // OpenID 2.0 to OpenID Connect. $user = User::get_by_identity($oidc->getPlainOpenid()); if ($user) { $user->identity = null; // session_login will overwrite it } } if ($user) { session_login($user, $data); } else { // First time logging in, must claim an existing account or create a new one // TODO this duplicates code in revenireOpenid.php $user = isset($data['email']) ? User::get_by_email($data['email']) : null; $loginType = $user ? 0 : (isset($data['fullname']) ? 1 : (isset($data['nickname']) ? 2 : 3)); // Store the identity in a temporary file. Don't print it in the form, because then it can be faked on the next page. $randString = util_randomCapitalLetterString(20); FileCache::put($randString, $data); SmartyWrap::assign('page_title', 'Autentificare cu OpenID'); SmartyWrap::assign('suggestHiddenSearchForm', true); SmartyWrap::assign('data', $data); SmartyWrap::assign('randString', $randString); SmartyWrap::assign('loginType', $loginType); SmartyWrap::display('auth/chooseIdentity.ihtml'); }
<?php error_reporting(8191); require_once 'class/IInterface.php'; require_once 'class/FileCacheAbstract.php'; require_once 'class/FileCache.php'; $expire = 10; // sec $cache = new FileCache('/cache'); // only as example do not set dir in real life! if ($content = $cache->get('main')) { echo 'This Page from cache for ' . $cache->getRemainigCacheTimeByKey('main') . ' sec!<br>'; echo $content; exit; } $cache->startCaching(); $param = 'This is main page'; echo '<h1>Main Page</h1>'; echo '<p>' . $param . '</p>'; $cache->put('main', $cache->getCacheContent(), $expire); header('Content-Type: text/html; charset=utf-8'); $cache->stopAndShowCaching(); exit;