Advertisement
Guest User

Untitled

a guest
Jan 14th, 2012
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1.    // http://vanillaforums.org/discussion/18495
  2.    public function Base_BeforeDispatch_Handler($Sender, $Args) {
  3.         if (Gdn::Session()->UserID > 0) return; // user signed in, don't check
  4.         $CookieName = C('Garden.Cookie.Name', 'Vanilla').'-ConnectFlood';
  5.         if (GetValue($CookieName, $_COOKIE)) { return; }
  6.         setcookie($CookieName, TRUE, time() + 60, '/'); // flood control 1 min
  7.         $Providers = self::GetAllProviders();
  8.         @session_write_close();
  9.         foreach ($Providers as $Provider) {
  10.             $Url = self::ConnectUrl($Provider, TRUE, FALSE);
  11.             if (strpos($Url, 'vanillajs.php') === FALSE)
  12.                 continue;
  13.             try {
  14.                 $Response = ProxyRequest($Url, 5, TRUE);
  15.             } catch (Exception $Ex) {
  16.                 echo "Error: ";
  17.                 echo $Ex->getMessage()."<br />\n";
  18.                 continue;
  19.             }
  20.             $Data = @json_decode($Response, TRUE);
  21.             if (!empty($Data['name'])) {
  22.                 $Data['Url'] = $Url;
  23.                 $client_id = GetValue('AuthenticationKey', $Provider);
  24.                 header('Location: ' . 'entry/jsconnect?client_id='.$client_id.'&Target=/');
  25.             }
  26.         }
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement