public function isValid($value) { $isValid = true; $this->_setValue($value); $guestInviteUnsubscribeModel = new GuestInviteUnsubscribeModel(); if ($guestInviteUnsubscribeModel->isUnsubscribed($value)) { $this->_error(self::ERROR_USER_UNSUBSCRIBED); $isValid = false; } return $isValid; }
public function _sendActivation($email, $code, $user, $type, $link = '') { $suffix = ''; switch ($type) { case GuestConst::TYPE_PERSONAL_ORDER: $suffix = 'order'; break; case GuestConst::TYPE_PROJECT: $suffix = 'project'; break; case GuestConst::TYPE_VACANCY: $suffix = 'vacancy'; break; } if (empty($suffix)) { return false; } $template = 'activate'; $recepient = array('email' => $email); $is_pro = false; if ($user->uid > 0) { $is_pro = $user->is_pro == 't'; $recepient = $user; $template = 'accept'; } $ext_vars = array(); if (!empty($link)) { $ext_vars = array('link' => $link, 'unsubscribe_uri' => GuestInviteUnsubscribeModel::getUri($email)); $this->setBaseSuffix('_adm'); } $res = $this->sendFromTemplate($template . $this->base_suffix . '_' . $suffix, array('code' => $code, 'is_pro' => $is_pro) + $ext_vars, $recepient); return $res['ret']; }
/** * Отписка от приглашений */ public function actionUnsubscribe() { $hash = __paramInit('string', 'hash', 'hash', NULL); $email = __paramInit('string', 'email', 'email', NULL); $guestInviteUnsubscribeModel = new GuestInviteUnsubscribeModel(); $trueHash = $guestInviteUnsubscribeModel->getHash($email); if ($hash == $trueHash) { $guestInviteUnsubscribeModel->addEmail($email); //@todo: решение не учитывает что отписываться могу не только от вакансий // пока пришлось подправить сообщение $notification = GuestConst::$_unsubscribe_ok_message; $notification['message'] = sprintf($notification['message'], $email); require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/Helpers/PopupAfterPageLoaded.php"; PopupAfterPageLoaded::getInstance()->showAfterLoad($notification); $this->redirect('/'); } else { $this->missingAction(NULL); } }