protected function doClean($value) { $criteria = new Criteria(); $criteria->add(EmailPeer::EMAIL, $value); $criteria->add(EmailPeer::IS_PRIMARY, true); $object = EmailPeer::doSelectOne($criteria); if (is_null($object)) { throw new sfValidatorError($this, 'invalid', array('value' => $value)); } return $object->getUserId(); }
/** * Handles badge action * * @param sfWebRequest $request Web request object */ public function executeBadge($request) { $this->jotag = TagPeer::getFromField(TagPeer::JOTAG, $request->getParameter('jotag')); $this->forward404Unless($this->jotag && $this->jotag->getStatus() == TagPeer::ST_ACTIVE); // get badge $this->badge = $this->jotag->getBadge(); // is authorized $this->authorized = TagPrivacyPeer::allowedToView($this->getUser(), $this->jotag); // reload $this->reload = $request->getParameter('reload') ? true : false; // build list of contact info $this->contacts = array(); $jotag =& $this->jotag; if ($jotag->getTagEmailsJoinEmail(EmailPeer::buildConfirmedCriteria())) { foreach ($jotag->getTagEmailsJoinEmail(EmailPeer::buildConfirmedCriteria()) as $k => $email) { $this->contacts["EMAIL"][] = $email->getEmail()->getEmail($this->authorized); } } if ($jotag->getTagPhonesJoinPhone()) { foreach ($jotag->getTagPhonesJoinPhone() as $k => $phone) { $this->contacts["PHONE"][] = array("number" => $phone->getPhone()->getNumber($this->authorized), "exten" => $phone->getPhone()->getExten($this->authorized)); } } if ($jotag->getTagUrlsJoinUrl()) { foreach ($jotag->getTagUrlsJoinUrl() as $k => $url) { $this->contacts["URL"][] = $url->getUrl()->getUrl($this->authorized); } } if ($jotag->getTagSNsJoinSN()) { foreach ($jotag->getTagSNsJoinSN() as $k => $sn) { $this->contacts["SN"][] = array("network" => $sn->getSN()->getNetwork(), "identifier" => $sn->getSN()->getIdentifier($this->authorized)); } } if ($jotag->getTagIMsJoinIM()) { foreach ($jotag->getTagIMsJoinIM() as $k => $im) { $this->contacts["IM"][] = array("network" => $im->getIM()->getNetwork(), "identifier" => $im->getIM()->getIdentifier($this->authorized)); } } if ($jotag->getTagCustomsJoinCustom()) { foreach ($jotag->getTagCustomsJoinCustom() as $k => $custom) { $this->contacts["CUSTOM"][] = array("netname" => $custom->getCustom()->getNetName(), "netid" => $custom->getCustom()->getNetId($this->authorized)); } } }
public function executeInvite($request) { $user = $this->getUser()->getSubscriber(); // fetch list of invites already sent by this user and hydrate users $this->invites = $user->getInvites(); $this->wbForm = new InviteWebmailForm(array('provider' => 'yahoo')); $this->show_more = false; if ($request->isMethod('post')) { $this->form = new InviteForm($request->getParameter('invite')); if ($request->getParameter('step') == 'step2') { $message = trim($request->getParameter('message')); // re-validate emails $this->form->bind($request->getParameter('invite')); if (!$this->form->isValid()) { // not valid, most likely user tried to mess up, so redirect back to invite $this->redirect('@invite'); } $emails = $this->form->getValue("emails"); $requested = $request->getParameter("chkEmail"); $jotags = $request->getParameter("jotags"); $jotag_objects = array(); // check selected jotags if ($jotags) { foreach ($jotags as $tag) { $obj = TagPeer::getFromField(TagPeer::JOTAG, $tag); if ($obj && $obj->getUserId() == $user->getId() && TagPeer::isValid($obj)) { $jotag_objects[] = $obj; } } } $sent = 0; foreach ($emails as $k => $email) { if (!EmailPeer::getFromField(EmailPeer::EMAIL, $email["email"]) && !EmailPeer::getFromField(EmailPeer::ACTUAL_EMAIL, $email["email"])) { if (in_array($k, $requested)) { // create new invite $invite = InvitePeer::newInvite($email, $user, $jotag_objects); // send invite Mailer::sendEmail($email["email"], 'invite', array('user' => $user, 'email' => $email, 'invite' => $invite, 'message' => $message), $this->getUser()->getSubscriber()->getPreferedLanguage()); $sent++; } } } $this->setMessage("SENT", "SUCCESS", $sent); $this->redirect('@invite'); } else { $this->form->bind($request->getParameter('invite')); if ($this->form->isValid()) { // here we have an already parsed email address $this->emails = $this->form->getValue('emails'); $this->user = $user; // check emails already registered in the system $registered_count = 0; $total_emails = 0; foreach ($this->emails as $k => $v) { if (!$v["email"]) { continue; } $total_emails++; if (EmailPeer::getFromField(EmailPeer::EMAIL, $v["email"]) || EmailPeer::getFromField(EmailPeer::ACTUAL_EMAIL, $v["email"])) { $this->emails[$k]["registered"] = true; $registered_count++; } else { $this->emails[$k]["registered"] = false; } } // if all emails are already registered, redirect back to invite page if ($registered_count == $total_emails) { $this->setMessage("ALL_REGISTERED", "SUCCESS"); $this->redirect("@invite"); } return $this->setTemplate('inviteStep2'); } else { // error in form, check if we should show extra lines $invites = $request->getParameter('invite'); $invites = $invites["emails"]; for ($i = 3; $i < 6; $i++) { if (@$invites[$i]["first_name"] || @$invites[$i]["last_name"] || @$invites[$i]["email"]) { $this->show_more = true; break; } } } } } else { $this->form = new InviteForm(); } }
<!-- EMAILS --> <?php if ($jotag->getTagEmailsJoinEmail(EmailPeer::buildConfirmedCriteria())) { ?> <dl> <dd id="emails"><?php echo __("E-Mails"); ?> </dd> <?php foreach ($jotag->getTagEmailsJoinEmail(EmailPeer::buildConfirmedCriteria()) as $k => $email) { ?> <?php if ($k) { ?> </dl><dl><?php } ?> <dt class="column-1"><?php echo esc_entities(ContactPeer::getTypeName(ContactPeer::$EMAIL_TYPES, $email->getEmail())); ?> </dt> <?php } ?> </dl> <?php } ?> <!-- END OF EMAILS -->
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = EmailPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setSender($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setSubject($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setDetail($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setCreatedAt($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setType($arr[$keys[5]]); } }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(EmailPeer::ID, $pks, Criteria::IN); $objs = EmailPeer::doSelect($criteria, $con); } return $objs; }