Ejemplo n.º 1
0
    /**
     * Action to handle getting a confirmation code. Confirms user and spits out
     * a success page if the code checks out... spits out an error page otherwise
     */
    public function executeConfirmUser()
    {
        $user = UserPeer::doSelectFromConfirmationCode($this->getRequestParameter('code'));
        if (!$user) {
            $newCode = $this->getRequestParameter('code');
            $oC = new Criteria();
            $oC->add(UserPeer::ID, "SHA1(CONCAT(user.password, 'salt', user.id)) = '{$newCode}'", Criteria::CUSTOM);
            $oC->add(UserPeer::TYPE, '1');
            $userCheck = UserPeer::doSelectOne($oC);
            if (!$userCheck) {
                return sfView::ERROR;
            }
        }
        if ($user) {
            $user->setTypeConfirmed();
            $user->save();
        }
        if ($user) {
            $this->getUser()->signIn($user);
        } else {
            $this->getUser()->signIn($userCheck);
        }
        if ($kinkarsoUser) {
            if ($user) {
                $query = mysql_query("select * from  shout where recipient_id=" . $user->getId() . " and  poster_id=" . $kinkarsoUser->getId() . "") or die(mysql_error());
                if (mysql_num_rows($query) == 0) {
                    ShoutPeer::createWelcomeComment($user, $kinkarsoUser);
                }
            }
            $subject = 'Here\'s how to start tutoring on Rayku';
            if ($user) {
                $body = 'Hey ' . $user->getName() . ', welcome to Rayku.com!<br><br>';
            }
            $body .= 'Thanks for joining our community!<br><br>

                Before you get started, there are 3 important steps before you can start tutoring!<br><br>
                1) Activated your tutor status by clicking \'on\' in your <a href="' . sfConfig::get('app_rayku_url') . '/dashboard">dashboard page</a>.<br>
                2) Important: Learn how to tutor on Rayku in 10 minutes by watching our <a href="' . sfConfig::get('app_rayku_url') . '/tutorshelp">tutor help videos</a>.<br>
                3) Prepare to receive question notifications by connecting to our <strong><a href="' . sfConfig::get('app_notification_bot_url') . '/download/rayku.dmg">MacOS</a> / <a href="http://notification-bot.rayku.com/download/rayku.exe">Windows</a> notification software</strong>, <a href="http://rayku.com/dashboard/gtalk">google talk</a> and <a href="http://rayku.com/dashboard/facebook">facebook chat</a>.<br><br>

                Enjoy, and do let us know if you ever have any questions - we\'re here to help!<br><br>

                Thanks!<br>
                Rayku Administration';
            $currentuser = $kinkarsoUser;
            //Send the message
            if ($user) {
                $currentuser->sendMessage($user->getId(), $subject, $body);
            }
        }
        $this->forward('regtutor', 'profile');
    }
Ejemplo n.º 2
0
 public function executeConfirmuser()
 {
     //Load the user from activation code
     $user = UserPeer::doSelectFromConfirmationCode($_REQUEST['confirmationcode']);
     //If the user doesn't exist, display an error
     if (!$user) {
         $oC = new Criteria();
         $oC->add(UserPeer::ID, "SHA1( CONCAT( user.password, 'salt', user.id ) ) = '{$newCode}'", Criteria::CUSTOM);
         $oC->add(UserPeer::TYPE, '1');
         $userCheck = UserPeer::doSelectOne($oC);
         if (!$userCheck) {
             $_SESSION['confirm_user_error'] = "Invalid Confirmation Code.";
             $this->redirect("/quickreg/confirmationcode");
             //return sfView::ERROR;
         }
     }
     //print_r($_POST);exit;
     $newCode = $_REQUEST['confirmationcode'];
     $courseId = $_REQUEST['course_id'];
     $education = $_REQUEST['edu'];
     $university = $_REQUEST['name'];
     $courseCode = $_REQUEST['course_code'];
     $year = $_REQUEST['asker_year'];
     $grade = $_REQUEST['asker_grade'];
     $dashHidden = $_REQUEST['dash_hidden'];
     $_SESSION['course_id'] = $courseId;
     $_SESSION['edu'] = $education;
     $_SESSION['name'] = $university;
     $_SESSION['course_code'] = $courseCode;
     $_SESSION['dash_hidden'] = $dashHidden;
     if ($year != 'Choose year') {
         $_SESSION['year'] = $year;
     }
     if ($grade != 'Choose grade') {
         $_SESSION['grade'] = $grade;
     }
     if ($user) {
         $user->setTypeConfirmed();
         $user->save();
     }
     if ($user) {
         $this->getUser()->signIn($user);
     } else {
         $this->getUser()->signIn($userCheck);
     }
     $this->redirect("/expertmanager/list");
 }
Ejemplo n.º 3
0
 /**
  * Action to handle getting a confirmation code. Confirms user and spits out
  * a success page if the code checks out... spits out an error page otherwise
  */
 public function executeConfirmUser()
 {
     if (strlen($this->getRequestParameter('code')) > 40) {
         $req = unserialize(base64_decode(urldecode($this->getRequestParameter('code'))));
         $code = $req['code'];
         $question = $req['question'];
     } else {
         $code = $this->getRequestParameter('code');
     }
     $user = UserPeer::doSelectFromConfirmationCode($code);
     if (!$user) {
         $newCode = $this->getRequestParameter('code');
         $oC = new Criteria();
         $oC->add(UserPeer::ID, "SHA1( CONCAT( user.password, 'salt', user.id ) ) = '{$code}'", Criteria::CUSTOM);
         $oC->add(UserPeer::TYPE, '1');
         $userCheck = UserPeer::doSelectOne($oC);
         if (!$userCheck) {
             return sfView::ERROR;
         }
     }
     if ($user) {
         $user->setTypeConfirmed();
         $user->save();
         // Referral module
         // Rajesh Soni - 23 November 2012
         $ref_points = 6;
         $ref_points_user = 4;
         $sql2 = "select referred_by from user where id=" . $user->getId();
         if ($user->getId()) {
             $result = mysql_query($sql2) or die($sql2 . mysql_error());
             $row = mysql_fetch_row($result) or die($sql2 . mysql_error());
             $ref_by_user = $row[0];
             if ($ref_by_user) {
                 $sql2 = "update user set points= points + " . $ref_points . " where id=" . $ref_by_user . " LIMIT 1";
                 mysql_query($sql2) or die($sql2 . mysql_error());
                 $sql2 = "update user set points='" . $ref_points_user . "' where id=" . $user->getId() . " LIMIT 1";
                 mysql_query($sql2) or die($sql2 . mysql_error());
             }
         }
     }
     if ($user) {
         $this->getUser()->signIn($user);
     } else {
         $this->getUser()->signIn($userCheck);
     }
     if ($question) {
         $this->getRequest()->setParameter('question', $question);
         // Rajesh Soni - 28 November 2012
         $this->redirect("/referrals?register=success");
     } elseif ($user) {
         // Rajesh Soni - 28 November 2012
         $this->redirect("/referrals?register=success");
     } else {
         $this->redirect("/referrals?register=success");
     }
 }