本文整理汇总了PHP中util::generateUID方法的典型用法代码示例。如果您正苦于以下问题:PHP util::generateUID方法的具体用法?PHP util::generateUID怎么用?PHP util::generateUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util
的用法示例。
在下文中一共展示了util::generateUID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeContact
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.es' => 'no-reply Voota'), $this->getUser()->getUsername(), true);
return "SendSuccess";
} catch (Exception $e) {
return "SendFail";
}
} else {
return "SendFail";
}
}
return "SendSuccess";
}
}
示例2: sendTasks
public function sendTasks(sfWebRequest $request)
{
$tw_publish = $request->getParameter("tw_publish", 0);
$t = $request->getParameter("t", false);
$v = $request->getParameter("v", false);
$e = $request->getParameter("e", false);
$review_text = $request->getParameter("review_text", false);
$this->updateSums($request);
if ($t) {
$type = SfReviewTypePeer::retrieveByPk($t);
$peer = $type->getModel() . "Peer";
$entity = call_user_func("{$peer}::retrieveByPk", $e);
} else {
$review = SfReviewPeer::retrieveByPk($request->getParameter('e'));
if ($typeId = $review->getSfReviewTypeId()) {
$type = SfReviewTypePeer::retrieveByPK($typeId);
$peer = $type->getModule() . 'Peer';
$entity = call_user_func("{$peer}::retrieveByPk", $review->getEntityId());
}
}
$msg = "";
if ($tw_publish && TwitterManager::verify($this->getUser())) {
switch ($t) {
case Politico::NUM_ENTITY:
$entityUrl = sfContext::getInstance()->getController()->genUrl("politico/show?id=" . $entity->getVanity(), true);
$msg = sfContext::getInstance()->getI18N()->__('Voto %1% de %2% en @Voota: %3%', array('%1%' => $v == -1 ? sfContext::getInstance()->getI18N()->__('en contra') : sfContext::getInstance()->getI18N()->__('a favor'), '%2%' => $entity, '%3%' => TwitterManager::shorten($entityUrl)));
break;
case Partido::NUM_ENTITY:
$entityUrl = sfContext::getInstance()->getController()->genUrl("partido/show?id=" . $entity->getAbreviatura(), true);
$msg = sfContext::getInstance()->getI18N()->__('Voto %1% del partido %2% en @Voota: %3%', array('%1%' => $v == -1 ? sfContext::getInstance()->getI18N()->__('en contra') : sfContext::getInstance()->getI18N()->__('a favor'), '%2%' => $entity->getAbreviatura(), '%3%' => TwitterManager::shorten($entityUrl)));
break;
case Propuesta::NUM_ENTITY:
$entityUrl = sfContext::getInstance()->getController()->genUrl("propuesta/show?id=" . $entity->getVanity(), true);
$msg = sfContext::getInstance()->getI18N()->__('Voto %1% de la propuesta "%2%" en @Voota: %3%', array('%1%' => $v == -1 ? sfContext::getInstance()->getI18N()->__('en contra') : sfContext::getInstance()->getI18N()->__('a favor'), '%2%' => SfVoUtil::cutToLength($entity->getTitulo(), 60, '...', true), '%3%' => TwitterManager::shorten($entityUrl)));
break;
case "":
$entityUrl = sfContext::getInstance()->getController()->genUrl($type->getModule() . "/show?id=" . $entity->getVanity(), true);
$msg = sfContext::getInstance()->getI18N()->__('Vooto %1% de una opinión sobre %2% en @Voota: %3%', array('%1%' => $v == -1 ? sfContext::getInstance()->getI18N()->__('en contra') : sfContext::getInstance()->getI18N()->__('a favor'), '%2%' => $entity, '%3%' => TwitterManager::shorten($entityUrl)));
break;
}
TwitterManager::post($this->getUser(), $msg);
}
// Enviar email
if (!$t) {
//echo $request->getParameter('i');
$user = $review->getsfGuardUser();
if ($user->getProfile()->getMailsComentarios()) {
if ($typeId) {
$user->getProfile()->setCodigo(util::generateUID());
$user->getProfile()->save();
$mailBody = $this->getPartial('reviewLeftMailBody', array('nombre' => $user->getProfile()->getNombre(), 'usuario' => $review->getAnonymous() ? sfContext::getInstance()->getI18N()->__('anónimo (está en su derecho)') : $this->getUser()->getProfile()->getNombre() . ' ' . $this->getUser()->getProfile()->getApellidos(), 'entity' => $typeId == Propuesta::NUM_ENTITY ? "\"{$entity}\"" : $entity, 'texto_ori' => $review->getText(), 'comentario' => $request->getParameter('review_text'), 'vanity' => $entity->getVanity(), 'codigo' => $user->getProfile()->getCodigo(), 'voto' => $request->getParameter('v'), 'module' => $entity->getModule()));
VoMail::send(sfContext::getInstance()->getI18N()->__('Tu vooto sobre %1% tiene un comentario', array('%1%' => $entity)), $mailBody, $user->getUsername(), array('no-reply@voota.es' => 'no-reply Voota'), true);
}
}
}
}
示例3: executeRemove
public function executeRemove(sfWebRequest $request)
{
$codigo = $request->getParameter("codigo");
$this->redirectUnless($this->getUser()->isAuthenticated(), "@sf_guard_signin");
if ($codigo == '') {
$this->getUser()->getProfile()->setCodigo(util::generateUID());
$this->getUser()->getProfile()->save();
$mailBody = $this->getPartial('removeMailBody', array('nombre' => $this->getUser()->getProfile()->getNombre(), 'codigo' => $this->getUser()->getProfile()->getCodigo()));
$this->email = $this->getUser()->getUsername();
VoMail::send(sfContext::getInstance()->getI18N()->__('Borrarse de Voota'), $mailBody, $this->getUser()->getUsername(), array('no-reply@voota.es' => 'no-reply Voota'), false);
} else {
$c = new Criteria();
$c->addJoin(SfGuardUserProfilePeer::USER_ID, sfGuardUserPeer::ID);
$c->add(SfGuardUserProfilePeer::CODIGO, $codigo);
$user = sfGuardUserPeer::doSelectOne($c);
$this->forward404Unless($user);
SfReviewManager::deleteReviewById($user->getId());
$user->delete();
if ($this->getUser()->isAuthenticated()) {
$this->getUser()->signOut();
}
return 'Confirm';
}
}