Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // http://vanillaforums.org/discussion/18495
- public function Base_BeforeDispatch_Handler($Sender, $Args) {
- if (Gdn::Session()->UserID > 0) return; // user signed in, don't check
- $CookieName = C('Garden.Cookie.Name', 'Vanilla').'-ConnectFlood';
- if (GetValue($CookieName, $_COOKIE)) { return; }
- setcookie($CookieName, TRUE, time() + 60, '/'); // flood control 1 min
- $Providers = self::GetAllProviders();
- @session_write_close();
- foreach ($Providers as $Provider) {
- $Url = self::ConnectUrl($Provider, TRUE, FALSE);
- if (strpos($Url, 'vanillajs.php') === FALSE)
- continue;
- try {
- $Response = ProxyRequest($Url, 5, TRUE);
- } catch (Exception $Ex) {
- echo "Error: ";
- echo $Ex->getMessage()."<br />\n";
- continue;
- }
- $Data = @json_decode($Response, TRUE);
- if (!empty($Data['name'])) {
- $Data['Url'] = $Url;
- $client_id = GetValue('AuthenticationKey', $Provider);
- header('Location: ' . 'entry/jsconnect?client_id='.$client_id.'&Target=/');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement