public function executeConfirmEmail($request) { // we only accept GET method $this->forward404Unless($request->isMethod('get')); $email = EmailPeer::getFromField(EmailPeer::CONFIRM_CODE, $this->getRequestParameter('confirm_code')); if ($email) { if ($email->getIsPrimary() && !$email->getActualEmail()) { // if invited, send acceptance email and add to quick contact $user = $email->getUser(); if ($user->getInvitedBy()) { // add to bookmark $b = new Bookmark(); $b->setUser($user->getUserRelatedByInvitedBy()); $b->setTag($user->retrievePrimaryJotag()); $b->save(); // give credit to the inviter $credits = $user->getUserRelatedByInvitedBy()->giveCredit(OptionPeer::retrieveOption('BONUS_ACCEPT_CREDIT')); Mailer::sendEmail($user->getUserRelatedByInvitedBy()->getPrimaryEmail(), 'inviteAccepted', array('owner' => $user->getUserRelatedByInvitedBy(), 'user' => $user, 'email' => $email, 'credits' => $credits), $user->getUserRelatedByInvitedBy()->getPreferedLanguage()); } // activate primary jotag $jotag = $email->getUser()->retrievePrimaryJotag(); $jotag->setStatus(TagPeer::ST_ACTIVE); $jotag->save(); $this->setMessage('ACCOUNT_CONFIRM', 'SUCCESS'); } else { $this->setMessage('EMAIL_CONFIRM', 'SUCCESS'); } $email->setIsConfirmed(true); $email->setConfirmCode(null); $email->setActualEmail(null); $email->save(); } else { $this->setMessage('EMAIL_CONFIRM_ERROR', 'ERROR'); } $this->redirect('@homepage'); }