Пример #1
0
 */
if (!empty($_GET) && isset($_SESSION['TWITTER_REQUEST_TOKEN'])) {
    $token = $consumer->getAccessToken($_GET, unserialize($_SESSION['TWITTER_REQUEST_TOKEN']));
    $tw_user_id = $token->getParam('user_id');
    $tw_screen_name = $token->getParam('screen_name');
    $tw_token = serialize($token);
    /**
     * Now that we have an Access Token, we can discard the Request Token
     */
    $_SESSION['TWITTER_REQUEST_TOKEN'] = null;
    /**
     * Record the Access Token if necessary and return to the appropriate page
     */
    if (isset($_SESSION['TWITTER_ENTRY'])) {
        if ($_SESSION['TWITTER_ENTRY'] == 'user_login.php') {
            $iduser = $do_twitter->getOfuzUserID($tw_user_id);
            if ($iduser) {
                $do_user = new User();
                $do_user->iduser = $iduser;
                $do_user->setSessionVariable();
                $do_login_audit = new LoginAudit();
                $do_login_audit->do_login_audit('Twitter');
                header('Location: index.php');
                exit;
            } else {
                $config = $do_twitter->getTwitterConfig();
                $ofuz_twitter = new Ofuz_Service_Twitter($tw_user_id, $config, $token);
                $userdetail = $ofuz_twitter->userShow($tw_user_id);
                list($firstname, $lastname) = split(' ', $userdetail->name);
                $_SESSION['TWITTER_REGISTER'] = array('tw_user_id' => $tw_user_id, 'tw_screen_name' => $tw_screen_name, 'tw_token' => $tw_token, 'firstname' => $firstname, 'lastname' => $lastname);
                header('Location: tw_user_register.php');
Пример #2
0
 /**
  * New User Registration with Twitter
  * @param object $evtcl
  */
 function eventRegNewTwUser(EventControler $evtcl)
 {
     if ($evtcl->tw_user_id && $evtcl->tw_user_id != '') {
         $do_twitter = new OfuzTwitter();
         if ($evtcl->emailid == '') {
             $err_disp = new Display($evtcl->errPage);
             $msg = "Please enter a valid email id.";
             $err_disp->addParam("message", $msg);
             $evtcl->setDisplayNext($err_disp);
         } elseif ($do_twitter->getOfuzUserID($evtcl->tw_user_id)) {
             $err_disp = new Display($evtcl->errPage);
             $msg = "Sorry! But it seems like you already registered, so please verify youself instead.";
             $err_disp->addParam("message", $msg);
             $evtcl->setDisplayNext($err_disp);
         } else {
             $this->firstname = $evtcl->firstname;
             $this->lastname = $evtcl->lastname;
             $this->email = $evtcl->emailid;
             $this->plan = 'free';
             $this->status = 'active';
             $this->add();
             $this->iduser = $this->getPrimaryKeyValue();
             $this->setSessionVariable();
             $do_twitter->setAccessToken($evtcl->tw_user_id, $evtcl->tw_screen_name, $evtcl->tw_token);
             $text = '';
             $text .= 'Hi ' . $this->firstname . '  </br >';
             $text .= 'Welcome to Ofuz. Thanks for logging in with Twitter. You will not need to use a username and password to login to Ofuz; all you need is the "Sign in with Twitter" button. However, you can set one username as well from the Settings menu, and then you can use the general login instead of Twitter.<br /><br />';
             $text .= 'Thank You !<br /> Ofuz Team';
             $do_template = new EmailTemplate();
             $do_template->senderemail = "*****@*****.**";
             $do_template->sendername = "Ofuz";
             $do_template->subject = "Welcome To Ofuz";
             $do_template->bodytext = $text;
             $do_template->bodyhtml = $do_template->bodytext;
             $this->sendMessage($do_template);
             $evtcl->setUrlNext("welcome_to_ofuz.php");
         }
     } else {
         $err_disp = new Display($evtcl->errPage);
         $msg = _('Sorry! But seems like you are not connected to Twitter. Please connect first.');
         $err_disp->addParam("message", $msg);
         $evtcl->setDisplayNext($err_disp);
     }
 }