public function executeContact(sfWebRequest $request) { $t = $request->getParameter("t", ''); $e = $request->getParameter("e", ''); $this->form = new ContactForm(); if ($t) { $this->form->setDefaultMsg("{$e}: {$t}"); } if ($request->isMethod('post') && !$t) { $this->form->bind($request->getParameter('contact')); if ($this->form->isValid()) { try { $mailBody = $this->getPartial('contactMailBody', array('nombre' => $this->form->getValue('nombre'), 'mensaje' => $this->form->getValue('mensaje'), 'email' => $this->form->getValue('email'))); VoMail::sendWithRet("Contacto web [" . $this->form->getValue('tipo') . "]", $mailBody, '*****@*****.**', array('*****@*****.**' => 'no-reply Voota'), $this->form->getValue('email'), true); return "SendSuccess"; } catch (Exception $e) { return "SendFail"; } /* $c = new Criteria(); $c->add(sfGuardUserPeer::USERNAME, $this->form->getValue('username')); $user = sfGuardUserPeer::doSelectOne($c); if ($user){ $this->sendReminder( $user ); return "SentSuccess"; } else { return "SentFail"; } */ } } }
public function executeContact(sfWebRequest $request) { $this->checkUser(); $vanity = $request->getParameter('username'); $this->f = $request->getParameter('f'); $c = new Criteria(); $c->add(SfGuardUserProfilePeer::VANITY, $vanity, Criteria::EQUAL); $userProfile = SfGuardUserProfilePeer::doSelectOne($c); $this->forward404Unless($userProfile); $this->user = $userProfile->getsfGuardUser(); $this->form = new UserContactForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter('contact')); if ($this->form->isValid()) { if ($this->user->getProfile()->getMailsContacto() == 1) { $codigo = util::generateUID(); $this->user->getProfile()->setCodigo($codigo); $this->user->getProfile()->save(); $mailBody = $this->getPartial('contactMailBody', array('destinatario' => $this->user->getProfile()->getNombre(), 'remitente' => $this->getUser()->getProfile()->getNombre(), 'cuerpo' => $this->form->getValue('mensaje'), 'vanity' => $this->getUser()->getProfile()->getVanity(), 'codigo' => $codigo)); try { VoMail::sendWithRet("Tienes un mensaje de " . $this->getUser()->getProfile()->getNombre() . "", $mailBody, $this->user->getUsername(), array('*****@*****.**' => 'no-reply Voota'), $this->getUser()->getUsername(), true); return "SendSuccess"; } catch (Exception $e) { return "SendFail"; } } else { return "SendFail"; } } return "SendSuccess"; } }