Example #1
0
 public function EndSystemInitialize($pData = null)
 {
     // Bounce if requested.
     $this->_Bounce();
     $social = $this->GetSys('Request')->Get('_social');
     if ($social != 'true') {
         return false;
     }
     require ASD_PATH . 'hooks' . DS . 'quicksocial' . DS . 'libraries' . DS . 'QuickSocial-0.1.0' . DS . 'quicksocial.php';
     $social = new cQuickSocial();
     $social->SetCallback('CheckBlocked', array($this, '_CheckBlocked'));
     $social->Blocked();
     $task = $this->GetSys('Request')->Get('_task');
     switch ($task) {
         case 'verify':
             $social = new cQuickSocial();
             $social->SetCallback('CheckLocalToken', array($this, '_CheckLocalToken'));
             $social->ReplyToVerify();
             exit;
             break;
         case 'verify.remote':
             $social = new cQuickSocial();
             $social->SetCallback('CheckLocalToken', array($this, '_CheckLocalToken'));
             $social->ReplyToRemoteVerify();
             exit;
             break;
         case 'connect.check':
             require ASD_PATH . 'hooks' . DS . 'quicksocial' . DS . 'libraries' . DS . 'QuickSocial-0.1.0' . DS . 'quickconnect.php';
             $connect = new cQuickConnect();
             $connect->SetCallback('CheckLogin', array($this, '_CheckLogin'));
             $connect->SetCallback('CreateLocalToken', array($this, '_CreateLocalToken'));
             $connect->Check();
             exit;
             break;
         case 'connect.return':
             require ASD_PATH . 'hooks' . DS . 'quicksocial' . DS . 'libraries' . DS . 'QuickSocial-0.1.0' . DS . 'quickconnect.php';
             $connect = new cQuickConnect();
             $connect->SetCallback('CreateRemoteToken', array($this, '_CreateRemoteToken'));
             $connect->SetCallback('CheckRemoteToken', array($this, '_CheckRemoteToken'));
             $verified = $connect->Process();
             if ($verified->success == 'true') {
                 $username = $verified->username;
                 $domain = $verified->domain;
                 $returnTo = $verified->returnTo;
                 if (!strstr($returnTo, '://')) {
                     $returnTo = 'http://' . $returnTo;
                 }
                 $this->_SetRemoteSession($username, $domain);
                 header('Location:' . $returnTo);
                 exit;
             } else {
                 $this->GetSys('Session')->Context('login.login.4.remote');
                 $this->GetSys('Session')->Set('Message', $verified->error);
                 $this->GetSys('Session')->Set('Identity', $verified->username . '@' . $verified->domain);
                 $this->GetSys('Session')->Set('Error', true);
                 $redirect = 'http://' . ASD_DOMAIN . '/login/remote/';
                 header('Location: ' . $redirect);
             }
             exit;
             break;
         case 'node.synchronize':
             require ASD_PATH . 'hooks' . DS . 'quicksocial' . DS . 'libraries' . DS . 'QuickSocial-0.1.0' . DS . 'quicknode.php';
             $node = new cQuickNode();
             $node->SetCallback('CheckRemoteToken', array($this, '_CheckRemoteToken'));
             $node->SetCallback('LoadNodeNetwork', array($this, '_LoadNodeNetwork'));
             $node->SetCallback('NodeInformation', array($this, '_NodeInformation'));
             $node->SetCallback('StoreNodeNetwork', array($this, '_StoreNodeNetwork'));
             $node->ReplyToSynchronize();
             exit;
             break;
         case 'redirect':
             require ASD_PATH . 'hooks' . DS . 'quicksocial' . DS . 'libraries' . DS . 'QuickSocial-0.1.0' . DS . 'quickredirect.php';
             $redirect = new cQuickRedirect();
             $redirect->SetCallback('Redirect', array($this, '_Redirect'));
             $redirect->Redirect();
             exit;
             break;
         case 'user.icon':
             require ASD_PATH . 'hooks' . DS . 'quicksocial' . DS . 'libraries' . DS . 'QuickSocial-0.1.0' . DS . 'quickuser.php';
             $user = new cQuickUser();
             $user->SetCallback('UserIcon', array($this, '_UserIcon'));
             $user->ReplyToIcon();
             exit;
             break;
         case 'user.info':
             require ASD_PATH . 'hooks' . DS . 'quicksocial' . DS . 'libraries' . DS . 'QuickSocial-0.1.0' . DS . 'quickuser.php';
             $user = new cQuickUser();
             $user->SetCallback('CheckLocalToken', array($this, '_CheckLocalToken'));
             $user->SetCallback('CheckRemoteToken', array($this, '_CheckRemoteToken'));
             $user->SetCallback('UserInfo', array($this, '_UserInfo'));
             $user->ReplyToInfo();
             exit;
             break;
         case 'friend.add':
             require ASD_PATH . 'hooks' . DS . 'quicksocial' . DS . 'libraries' . DS . 'QuickSocial-0.1.0' . DS . 'quickfriend.php';
             $friend = new cQuickFriend();
             $friend->SetCallback('CheckLocalToken', array($this, '_CheckLocalToken'));
             $friend->SetCallback('CheckRemoteToken', array($this, '_CheckRemoteToken'));
             $friend->SetCallback('FriendAdd', array($this, '_FriendAdd'));
             $friend->ReplyToFriend();
             exit;
             break;
         case 'friend.approve':
             require ASD_PATH . 'hooks' . DS . 'quicksocial' . DS . 'libraries' . DS . 'QuickSocial-0.1.0' . DS . 'quickfriend.php';
             $friend = new cQuickFriend();
             $friend->SetCallback('CheckLocalToken', array($this, '_CheckLocalToken'));
             $friend->SetCallback('CheckRemoteToken', array($this, '_CheckRemoteToken'));
             $friend->SetCallback('FriendApprove', array($this, '_FriendApprove'));
             $friend->ReplyToApprove();
             exit;
             break;
         case 'friend.remove':
             require ASD_PATH . 'hooks' . DS . 'quicksocial' . DS . 'libraries' . DS . 'QuickSocial-0.1.0' . DS . 'quickfriend.php';
             $friend = new cQuickFriend();
             $friend->SetCallback('CheckLocalToken', array($this, '_CheckLocalToken'));
             $friend->SetCallback('CheckRemoteToken', array($this, '_CheckRemoteToken'));
             $friend->SetCallback('FriendRemove', array($this, '_FriendRemove'));
             $friend->ReplyToRemove();
             exit;
             break;
         case 'feed.synchronize':
             require ASD_PATH . 'hooks' . DS . 'quicksocial' . DS . 'libraries' . DS . 'QuickSocial-0.1.0' . DS . 'quickfeed.php';
             $notify = new cQuickFeed();
             $notify->SetCallback('CheckLocalToken', array($this, '_CheckLocalToken'));
             $notify->SetCallback('CheckRemoteToken', array($this, '_CheckRemoteToken'));
             $notify->SetCallback('FeedSynchronize', array($this, '_FeedSynchronize'));
             $notify->ReplyToSynchronize();
             exit;
             break;
         case '':
         default:
             exit;
             break;
     }
 }