Example #1
0
 public function sendWinkEmailNotification($userId, $partnerId, $winkType)
 {
     if (empty($userId) || empty($partnerId) || ($user = BOL_UserService::getInstance()->findUserById($userId)) === null || ($partner = BOL_UserService::getInstance()->findUserById($partnerId)) === null) {
         return false;
     }
     $avatar = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId, $partnerId), true, true, true, false);
     switch ($winkType) {
         case self::EMAIL_SEND:
             $subjectKey = 'wink_send_email_subject';
             $subjectArr = array('displayname' => $avatar[$userId]['title']);
             $textContentKey = 'wink_send_email_text_content';
             $htmlContentKey = 'wink_send_email_html_content';
             $contentArr = array('src' => $avatar[$userId]['src'], 'displayname' => $avatar[$userId]['title'], 'url' => $avatar[$userId]['url'], 'home_url' => OW_URL_HOME);
             break;
         case self::EMAIL_BACK:
         default:
             $subjectKey = 'wink_back_email_subject';
             $subjectArr = array('displayname' => $avatar[$userId]['title']);
             $textContentKey = 'wink_back_email_text_content';
             $htmlContentKey = 'wink_back_email_html_content';
             $contentArr = array('src' => $avatar[$userId]['src'], 'displayname' => $avatar[$userId]['title'], 'url' => $avatar[$userId]['url'], 'conversation_url' => OW::getRouter()->urlForRoute('mailbox_messages_default'));
             break;
     }
     $language = OW::getLanguage();
     $mail = OW::getMailer()->createMail();
     $mail->addRecipientEmail($partner->email);
     $mail->setSubject($language->text('winks', $subjectKey, $subjectArr));
     $mail->setTextContent($language->text('winks', $textContentKey, $contentArr));
     $mail->setHtmlContent($language->text('winks', $htmlContentKey, $contentArr));
     OW::getMailer()->send($mail);
 }
Example #2
0
 public function sendNotification()
 {
     if (empty($this->user)) {
         return;
     }
     $content = $this->getHtml();
     $mail = OW::getMailer()->createMail()->addRecipientEmail($this->user->email)->setSubject(OW::getLanguage()->text('bookmarks', 'email_notify_subject'))->setHtmlContent($content)->setTextContent($content);
     OW::getMailer()->send($mail);
 }
Example #3
0
 public function transferCredits($userId, $receiveUser, $creditValue)
 {
     $debitValue = $creditValue * -1;
     $userCreditsService = USERCREDITS_BOL_CreditsService::getInstance();
     $creditsService = CREDITS_BOL_Service::getInstance();
     $sendItem = $this->logAction($creditsService->getSentActionId(), $userId, $debitValue);
     $receiveItem = $this->logAction($creditsService->getReceiveActionId(), $receiveUser, $creditValue);
     $userCreditsService->increaseBalance($receiveUser, $creditValue);
     $userCreditsService->decreaseBalance($userId, $creditValue);
     $sqlInsert = "INSERT INTO " . OW_DB_PREFIX . "credits_sent_log(senderItem, receiverItem, sender, receiver) \n                             VALUES(:sendItem, :receiveItem, :userId, :receiveUser)";
     $qParams = array('sendItem' => $sendItem, 'receiveItem' => $receiveItem, 'userId' => $userId, 'receiveUser' => $receiveUser);
     OW::getDbo()->query($sqlInsert, $qParams);
     $service = BOL_UserService::getInstance();
     $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId, $receiveUser));
     $names = $service->getDisplayNamesForList(array($userId, $receiveUser));
     $uUrls = $service->getUserUrlsForList(array($userId, $receiveUser));
     if (OW::getConfig()->getValue('credits', 'enableNotification') == '1') {
         //Send notification to receiver
         $avatar = $avatars[$userId];
         $notificationParams = array('pluginKey' => 'credits', 'action' => 'credits-received', 'entityType' => 'received', 'entityId' => $receiveItem, 'userId' => $receiveUser, 'time' => time());
         $sender = '<a href="' . $uUrls[$userId] . '" target="_blank" >' . $names[$userId] . '</a>';
         $notificationData = array('string' => array('key' => 'credits+notify_credits_received', 'vars' => array('sender' => $sender, 'credits' => $creditValue)), 'avatar' => $avatar, 'url' => $uUrls[$userId]);
         $event = new OW_Event('notifications.add', $notificationParams, $notificationData);
         OW::getEventManager()->trigger($event);
     }
     $subject = OW::getLanguage()->text('credits', 'credits_email_subject', array('requester_name' => $names[$userId], 'credits' => $creditValue));
     $content = OW::getLanguage()->text('credits', 'credits_email_content', array('requester_name' => $names[$userId], 'requester_url' => $uUrls[$userId], 'credits' => $creditValue, 'user_url' => $uUrls[$receiveUser], 'name' => $names[$receiveUser]));
     if (OW::getConfig()->getValue('credits', 'enableEmail') == '1') {
         $tmpUser = $service->findUserById($receiveUser);
         $sitemail = OW::getConfig()->getValue('base', 'site_email');
         $sitename = OW::getConfig()->getValue('base', 'site_name');
         $mail = OW::getMailer()->createMail();
         $mail->addRecipientEmail($tmpUser->getEmail());
         $mail->setSender($sitemail, $sitename);
         $mail->setSenderSuffix(true);
         $mail->setSubject($subject);
         $mail->setHtmlContent($content);
         $mail->setTextContent(UTIL_HtmlTag::stripTags($content));
         OW::getMailer()->addToQueue($mail);
     }
     if (OW::getConfig()->getValue('credits', 'enablePM') == '1') {
         $conversation = MAILBOX_BOL_ConversationService::getInstance()->createConversation($userId, $receiveUser, $subject, $content);
     }
     return true;
 }
 public function sendMessage()
 {
     $userId = !empty($_POST['userId']) ? $_POST['userId'] : null;
     $subject = !empty($_POST['subject']) ? $_POST['subject'] : null;
     $message = !empty($_POST['message']) ? $_POST['message'] : null;
     $user = BOL_UserService::getInstance()->findUserById($userId);
     if (empty($user)) {
         exit(json_encode(array('result' => false, 'message' => OW::getLanguage()->text('base', 'invalid_user'))));
     }
     if (empty($subject)) {
         exit(json_encode(array('result' => false, 'message' => OW::getLanguage()->text('base', 'empty_subject'))));
     }
     if (empty($message)) {
         exit(json_encode(array('result' => false, 'message' => OW::getLanguage()->text('base', 'empty_message'))));
     }
     $mail = OW::getMailer()->createMail();
     $mail->addRecipientEmail($user->getEmail());
     $mail->setSubject($subject);
     $mail->setHtmlContent($message);
     OW::getMailer()->send($mail);
     exit(json_encode(array('result' => true, 'message' => OW::getLanguage()->text('base', 'message_send'))));
 }
Example #5
0
 public function send()
 {
     if (empty($_POST['emailList'])) {
         exit(json_encode(array('success' => false, 'message' => OW::getLanguage()->text('contactimporter', 'email_send_error_empty_email_list'))));
     }
     if (count($_POST['emailList']) > (int) OW::getConfig()->getValue('base', 'user_invites_limit')) {
         exit(json_encode(array('success' => false, 'message' => OW::getLanguage()->text('contactimporter', 'email_send_error_max_limit_message', array('limit' => (int) OW::getConfig()->getValue('base', 'user_invites_limit'))))));
     }
     $userId = OW::getUser()->getId();
     $displayName = BOL_UserService::getInstance()->getDisplayName($userId);
     $vars = array('inviter' => $displayName, 'siteName' => OW::getConfig()->getValue('base', 'site_name'), 'customMessage' => empty($_POST['text']) ? null : trim($_POST['text']));
     foreach ($_POST['emailList'] as $email) {
         $code = UTIL_String::generatePassword(20);
         BOL_UserService::getInstance()->saveUserInvitation($userId, $code);
         $vars['siteInviteURL'] = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('base_join'), array('code' => $code));
         $mail = OW::getMailer()->createMail();
         $mail->setSubject(OW::getLanguage()->text('contactimporter', 'mail_email_invite_subject', $vars));
         $mail->setHtmlContent(OW::getLanguage()->text('contactimporter', 'mail_email_invite_' . (empty($_POST['text']) ? '' : 'msg_') . 'html', $vars));
         $mail->setTextContent(OW::getLanguage()->text('contactimporter', 'mail_email_invite_' . (empty($_POST['text']) ? '' : 'msg_') . 'txt', $vars));
         $mail->addRecipientEmail($email);
         OW::getMailer()->addToQueue($mail);
     }
     exit(json_encode(array('success' => true, 'message' => OW::getLanguage()->text('contactimporter', 'email_send_success', array('count' => count($_POST['emailList']))))));
 }
Example #6
0
 private function notifyAdminAboutInvalidItems(array $items)
 {
     if (empty($items)) {
         return;
     }
     $titleList = array();
     foreach ($items as $item) {
         $titleList[] = "\"{$item["title"]}\"";
     }
     $params = array("itemList" => implode("<br />", $titleList), "siteURL" => OW::getRouter()->getBaseUrl(), "adminUrl" => OW::getRouter()->urlForRoute("admin_plugins_installed"));
     $language = OW::getLanguage();
     $mail = OW::getMailer()->createMail();
     $mail->addRecipientEmail(OW::getConfig()->getValue("base", "site_email"));
     $mail->setSubject($language->text("admin", "mail_template_admin_invalid_license_subject"));
     $mail->setHtmlContent($language->text("admin", "mail_template_admin_invalid_license_content_html", $params));
     $params["itemList"] = implode(PHP_EOL, $titleList);
     $mail->setTextContent($language->text("admin", "mail_template_admin_invalid_license_content_text", $params));
     OW::getMailer()->send($mail);
 }
Example #7
0
 private function sendProcess($userId, NOTIFICATIONS_CMP_Notification $cmp)
 {
     $userService = BOL_UserService::getInstance();
     $user = $userService->findUserById($userId);
     if (empty($user)) {
         return false;
     }
     $email = $user->email;
     $unsubscribeCode = $this->generateUnsubscribeCode($user);
     $cmp->setUnsubscribeCode($unsubscribeCode);
     $txt = $cmp->getTxt();
     $html = $cmp->getHtml();
     $subject = $cmp->getSubject();
     try {
         $mail = OW::getMailer()->createMail()->addRecipientEmail($email)->setTextContent($txt)->setHtmlContent($html)->setSubject($subject);
         OW::getMailer()->send($mail);
     } catch (Exception $e) {
         //Skip invalid notification
     }
 }
Example #8
0
 public function index()
 {
     $this->setPageTitle(OW::getLanguage()->text('contactus', 'index_page_title'));
     $this->setPageHeading(OW::getLanguage()->text('contactus', 'index_page_heading'));
     $contactEmails = array();
     $contacts = CONTACTUS_BOL_Service::getInstance()->getDepartmentList();
     foreach ($contacts as $contact) {
         /* @var $contact CONTACTUS_BOL_Department */
         $contactEmails[$contact->id]['label'] = CONTACTUS_BOL_Service::getInstance()->getDepartmentLabel($contact->id);
         $contactEmails[$contact->id]['email'] = $contact->email;
     }
     $form = new Form('contact_form');
     $fieldTo = new Selectbox('to');
     foreach ($contactEmails as $id => $value) {
         $fieldTo->addOption($id, $value['label']);
     }
     $fieldTo->setRequired();
     $fieldTo->setHasInvitation(false);
     $fieldTo->setLabel($this->text('contactus', 'form_label_to'));
     $form->addElement($fieldTo);
     $fieldFrom = new TextField('from');
     $fieldFrom->setLabel($this->text('contactus', 'form_label_from'));
     $fieldFrom->setRequired();
     $fieldFrom->addValidator(new EmailValidator());
     if (ow::getUser()->isAuthenticated()) {
         $fieldFrom->setValue(OW::getUser()->getEmail());
     }
     $form->addElement($fieldFrom);
     $fieldSubject = new TextField('subject');
     $fieldSubject->setLabel($this->text('contactus', 'form_label_subject'));
     $fieldSubject->setRequired();
     $form->addElement($fieldSubject);
     $fieldMessage = new Textarea('message');
     $fieldMessage->setLabel($this->text('contactus', 'form_label_message'));
     $fieldMessage->setRequired();
     $form->addElement($fieldMessage);
     $fieldCaptcha = new CaptchaField('captcha');
     $fieldCaptcha->setLabel($this->text('contactus', 'form_label_captcha'));
     $form->addElement($fieldCaptcha);
     $submit = new Submit('send');
     $submit->setValue($this->text('contactus', 'form_label_submit'));
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             if (!array_key_exists($data['to'], $contactEmails)) {
                 OW::getFeedback()->error($this->text('contactus', 'no_department'));
                 return;
             }
             $mail = OW::getMailer()->createMail();
             $mail->addRecipientEmail($contactEmails[$data['to']]['email']);
             $mail->setSender($data['from']);
             $mail->setSenderSuffix(false);
             $mail->setSubject($data['subject']);
             $mail->setTextContent($data['message']);
             OW::getMailer()->addToQueue($mail);
             OW::getSession()->set('contactus.dept', $contactEmails[$data['to']]['label']);
             $this->redirectToAction('sent');
         }
     }
 }
Example #9
0
 public function sendNotification()
 {
     $subject = $this->getSubject();
     $txt = $this->getTxt();
     $html = $this->getHtml();
     $mail = OW::getMailer()->createMail()->addRecipientEmail($this->user->email)->setTextContent($txt)->setHtmlContent($html)->setSubject($subject);
     OW::getMailer()->send($mail);
     //        BOL_PreferenceService::getInstance()->savePreferenceValue('matchmaking_lastmatch_userid', (int)$this->items[0]['id'], $this->user->getId());
     BOL_PreferenceService::getInstance()->savePreferenceValue('matchmaking_lastmatch_userid', (int) $this->lastUserId, $this->user->getId());
 }
Example #10
0
 public function send()
 {
     $request = json_decode($_POST['request'], true);
     $userId = OW::getUser()->getId();
     $displayName = BOL_UserService::getInstance()->getDisplayName($userId);
     foreach ($request['contacts'] as $email) {
         $code = UTIL_String::getRandomString(20);
         BOL_UserService::getInstance()->saveUserInvitation($userId, $code);
         $inviteUrl = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('base_join'), array('code' => $code));
         $assigns = array('url' => $inviteUrl, 'message' => empty($request['message']) ? '' : $request['message'], 'user' => $displayName);
         $tpl = empty($request['message']) ? 'mail_google_invite' : 'mail_google_invite_msg';
         $mail = OW::getMailer()->createMail();
         $mail->setSubject(OW::getLanguage()->text('contactimporter', 'mail_google_invite_subject', $assigns));
         $mail->setHtmlContent(OW::getLanguage()->text('contactimporter', $tpl . '_html', $assigns));
         $mail->setTextContent(OW::getLanguage()->text('contactimporter', $tpl . '_txt', $assigns));
         $mail->addRecipientEmail($email);
         OW::getMailer()->addToQueue($mail);
     }
     $message = OW::getLanguage()->text('contactimporter', 'google_send_success', array('count' => count($request['contacts'])));
     exit($message);
 }
Example #11
0
 /**
  * Updates user settings configuration
  *
  * @return boolean
  */
 public function process()
 {
     $values = $this->getValues();
     $config = OW::getConfig();
     $config->saveConfig('base', 'avatar_size', $values['avatarSize']);
     $config->saveConfig('base', 'avatar_big_size', $values['bigAvatarSize']);
     $config->saveConfig('base', 'display_name_question', $values['displayName']);
     $config->saveConfig('base', 'join_display_photo_upload', $values['join_display_photo_upload']);
     $config->saveConfig('base', 'join_display_terms_of_use', $values['join_display_terms_of_use']);
     $config->saveConfig('base', 'avatar_max_upload_size', round((double) $values['avatar_max_upload_size'], 2));
     if (!defined('OW_PLUGIN_XP')) {
         $config->saveConfig('base', 'confirm_email', $values['confirmEmail']);
     }
     $avatarService = BOL_AvatarService::getInstance();
     if (isset($_FILES['avatar']['tmp_name'])) {
         $avatarService->setCustomDefaultAvatar(1, $_FILES['avatar']);
     }
     if (isset($_FILES['bigAvatar']['tmp_name'])) {
         $avatarService->setCustomDefaultAvatar(2, $_FILES['bigAvatar']);
     }
     // privacy
     $config->saveConfig('base', 'who_can_join', (int) $values['who_can_join']);
     $config->saveConfig('base', 'who_can_invite', (int) $values['who_can_invite']);
     $config->saveConfig('base', 'mandatory_user_approve', (bool) $values['user_approve'] ? 1 : 0);
     if ((int) $values['guests_can_view'] == 3) {
         $adminEmail = OW::getUser()->getEmail();
         $senderMail = $config->getValue('base', 'site_email');
         $mail = OW::getMailer()->createMail();
         $mail->addRecipientEmail($adminEmail);
         $mail->setSender($senderMail);
         $mail->setSenderSuffix(false);
         $mail->setSubject(OW::getLanguage()->text('admin', 'site_password_letter_subject', array()));
         $mail->setTextContent(OW::getLanguage()->text('admin', 'site_password_letter_template_text', array('password' => $values['password'])));
         $mail->setHtmlContent(OW::getLanguage()->text('admin', 'site_password_letter_template_html', array('password' => $values['password'])));
         try {
             OW::getMailer()->send($mail);
         } catch (Exception $e) {
             $logger = OW::getLogger('admin.send_password_message');
             $logger->addEntry($e->getMessage());
             $logger->writeLog();
         }
         $values['password'] = crypt($values['password'], OW_PASSWORD_SALT);
         $config->saveConfig('base', 'guests_can_view_password', $values['password']);
     } else {
         $config->saveConfig('base', 'guests_can_view_password', null);
     }
     $config->saveConfig('base', 'guests_can_view', (int) $values['guests_can_view']);
     // profile questions
     isset($_POST['user_view_presentation']) ? $config->saveConfig('base', 'user_view_presentation', 'tabs') : $config->saveConfig('base', 'user_view_presentation', 'table');
     return array('result' => true);
 }
Example #12
0
 public function index($params = array())
 {
     $userService = BOL_UserService::getInstance();
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('admin', 'massmailing'));
     $this->setPageHeadingIconClass('ow_ic_script');
     $massMailingForm = new Form('massMailingForm');
     $massMailingForm->setId('massMailingForm');
     $rolesList = BOL_AuthorizationService::getInstance()->getRoleList();
     $userRoles = new CheckboxGroup('userRoles');
     $userRoles->setLabel($language->text('admin', 'massmailing_user_roles_label'));
     foreach ($rolesList as $role) {
         if ($role->name != 'guest') {
             $userRoles->addOption($role->name, $language->text('base', 'authorization_role_' . $role->name));
         }
     }
     $massMailingForm->addElement($userRoles);
     $emailFormat = new Selectbox('emailFormat');
     $emailFormat->setLabel($language->text('admin', 'massmailing_email_format_label'));
     $emailFormat->setOptions(array(self::EMAIL_FORMAT_TEXT => $language->text('admin', 'massmailing_email_format_text'), self::EMAIL_FORMAT_HTML => $language->text('admin', 'massmailing_email_format_html')));
     $emailFormat->setValue(self::EMAIL_FORMAT_TEXT);
     $emailFormat->setHasInvitation(false);
     if (!empty($_POST['emailFormat'])) {
         $emailFormat->setValue($_POST['emailFormat']);
     }
     $massMailingForm->addElement($emailFormat);
     $subject = new TextField('subject');
     $subject->addAttribute('class', 'ow_text');
     $subject->addAttribute('style', 'width: auto;');
     $subject->setRequired();
     $subject->setLabel($language->text('admin', 'massmailing_subject_label'));
     if (!empty($_POST['subject'])) {
         $subject->setValue($_POST['subject']);
     }
     $massMailingForm->addElement($subject);
     $body = new Textarea('body');
     if ($emailFormat->getValue() == self::EMAIL_FORMAT_HTML) {
         $body = new WysiwygTextarea('body');
         $body->forceAddButtons(array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_HTML));
     }
     $body->addAttribute('class', 'ow_text');
     $body->addAttribute('style', 'width: auto;');
     $body->setRequired();
     $body->setLabel($language->text('admin', 'massmailing_body_label'));
     if (!empty($_POST['body'])) {
         $body->setValue($_POST['body']);
     }
     $massMailingForm->addElement($body);
     $submit = new Submit('startMailing');
     $submit->addAttribute('class', 'ow_button');
     $submit->setValue($language->text('admin', 'massmailing_start_mailing_button'));
     $massMailingForm->addElement($submit);
     $this->addForm($massMailingForm);
     $ignoreUnsubscribe = false;
     $isActive = true;
     if (defined('OW_PLUGIN_XP')) {
         $massMailingTimestamp = OW::getConfig()->getValue('admin', 'mass_mailing_timestamp');
         $timeout = $massMailingTimestamp + 60 * 60 * 24 - time();
         if ($timeout > 0) {
             $isActive = false;
             $this->assign('expireText', $language->text('admin', 'massmailing_expire_text', array('hours' => (int) ceil($timeout / (60 * 60)))));
         }
     }
     $this->assign('isActive', $isActive);
     $total = $userService->findMassMailingUserCount($ignoreUnsubscribe);
     if (OW::getRequest()->isPost() && $isActive && isset($_POST['startMailing'])) {
         if ($massMailingForm->isValid($_POST)) {
             $data = $massMailingForm->getValues();
             $start = 0;
             $count = self::MAILS_ARRAY_MAX_RECORDS;
             $mailCount = 0;
             $total = $userService->findMassMailingUserCount($ignoreUnsubscribe, $data['userRoles']);
             while ($start < $total) {
                 $result = $this->userService->findMassMailingUsers($start, $count, $ignoreUnsubscribe, $data['userRoles']);
                 $mails = array();
                 $userIdList = array();
                 foreach ($result as $user) {
                     $userIdList[] = $user->id;
                 }
                 $displayNameList = $this->userService->getDisplayNamesForList($userIdList);
                 $event = new BASE_CLASS_EventCollector('base.add_global_lang_keys');
                 OW::getEventManager()->trigger($event);
                 $vars = call_user_func_array('array_merge', $event->getData());
                 foreach ($result as $key => $user) {
                     $vars['user_email'] = $user->email;
                     $mail = OW::getMailer()->createMail();
                     $mail->addRecipientEmail($user->email);
                     $vars['user_name'] = $displayNameList[$user->id];
                     $code = md5($user->username . $user->password);
                     $link = OW::getRouter()->urlForRoute('base_massmailing_unsubscribe', array('id' => $user->id, 'code' => $code));
                     $subjectText = UTIL_String::replaceVars($data['subject'], $vars);
                     $mail->setSubject($subjectText);
                     if ($data['emailFormat'] === self::EMAIL_FORMAT_HTML) {
                         $htmlContent = UTIL_String::replaceVars($data['body'], $vars);
                         $htmlContent .= $language->text('admin', 'massmailing_unsubscribe_link_html', array('link' => $link));
                         $mail->setHtmlContent($htmlContent);
                         $textContent = preg_replace("/\\<br\\s*[\\/]?\\s*\\>/", "\n", $htmlContent);
                         $textContent = strip_tags($textContent);
                         $mail->setTextContent($textContent);
                     } else {
                         $textContent = UTIL_String::replaceVars($data['body'], $vars);
                         $textContent .= "\n\n" . $language->text('admin', 'massmailing_unsubscribe_link_text', array('link' => $link));
                         $mail->setTextContent($textContent);
                     }
                     $mails[] = $mail;
                     $mailCount++;
                 }
                 $start += $count;
                 //printVar($mails);
                 OW::getMailer()->addListToQueue($mails);
             }
             OW::getFeedback()->info($language->text('admin', 'massmailing_send_mails_message', array('count' => $mailCount)));
             if (defined('OW_PLUGIN_XP')) {
                 OW::getConfig()->saveConfig('admin', 'mass_mailing_timestamp', time());
             }
             $this->redirect();
         }
     }
     $this->assign('userCount', $total);
     $language->addKeyForJs('admin', 'questions_empty_lang_value');
     $language->addKeyForJs('admin', 'massmailing_total_members');
     $script = ' window.massMailing = new MassMailing(\'' . $this->ajaxResponderUrl . '\'); ';
     OW::getDocument()->addOnloadScript($script);
     $jsDir = OW::getPluginManager()->getPlugin("admin")->getStaticJsUrl();
     OW::getDocument()->addScript($jsDir . "mass_mailing.js");
 }
Example #13
0
 public function processResetForm($data)
 {
     $language = OW::getLanguage();
     $email = trim($data['email']);
     $user = $this->findByEmail($email);
     if ($user === null) {
         throw new LogicException($language->text('base', 'forgot_password_no_user_error_message'));
     }
     $resetPassword = $this->findResetPasswordByUserId($user->getId());
     if ($resetPassword !== null) {
         if ($resetPassword->getUpdateTimeStamp() > time()) {
             throw new LogicException($language->text('base', 'forgot_password_request_exists_error_message'));
         } else {
             $resetPassword->setUpdateTimeStamp($resetPassword->getUpdateTimeStamp() + self::PASSWORD_RESET_CODE_UPDATE_TIME);
             $this->resetPasswordDao->save($resetPassword);
         }
     } else {
         $resetPassword = $this->getNewResetPassword($user->getId());
     }
     $vars = array('code' => $resetPassword->getCode(), 'username' => $user->getUsername(), 'requestUrl' => OW::getRouter()->urlForRoute('base.reset_user_password_request'), 'resetUrl' => OW::getRouter()->urlForRoute('base.reset_user_password', array('code' => $resetPassword->getCode())));
     $mail = OW::getMailer()->createMail();
     $mail->addRecipientEmail($email);
     $mail->setSubject($language->text('base', 'reset_password_mail_template_subject'));
     $mail->setTextContent($language->text('base', 'reset_password_mail_template_content_txt', $vars));
     $mail->setHtmlContent($language->text('base', 'reset_password_mail_template_content_html', $vars));
     OW::getMailer()->send($mail);
 }
Example #14
0
 public function sendWinkNotification($userId, $partnerId)
 {
     if (empty($userId) || empty($partnerId) || ($user = BOL_UserService::getInstance()->findUserById($userId)) === null || ($partner = BOL_UserService::getInstance()->findUserById($partnerId)) === null) {
         return;
     }
     $avatarUrls = BOL_AvatarService::getInstance()->getAvatarsUrlList(array($userId, $partnerId));
     $displayNames = BOL_UserService::getInstance()->getDisplayNamesForList(array($userId, $partnerId));
     $subjectKey = 'wink_back_email_subject';
     $subjectArr = array('displayname' => $displayNames[$userId]);
     $textContentKey = 'wink_back_email_text_content';
     $htmlContentKey = 'wink_back_email_html_content';
     $contentArr = array('src' => $avatarUrls[$userId], 'displayname' => $displayNames[$userId], 'url' => OW_URL_HOME . 'user/' . $user->getUsername(), 'conversation_url' => OW_URL_HOME . 'messages');
     $language = OW::getLanguage();
     $mail = OW::getMailer()->createMail();
     $mail->addRecipientEmail($partner->getEmail());
     $mail->setSubject($language->text('winks', $subjectKey, $subjectArr));
     $mail->setTextContent($language->text('winks', $textContentKey, $contentArr));
     $mail->setHtmlContent($language->text('winks', $htmlContentKey, $contentArr));
     try {
         OW::getMailer()->send($mail);
     } catch (Exception $e) {
         OW::getLogger('wink.send_notify')->addEntry(json_encode($e));
     }
 }
Example #15
0
 /**
  * @param $userId
  * @param $membershipLabel
  * @return bool
  */
 public function sendMembershipRenewedNotification($userId, $membershipLabel)
 {
     if (!$userId) {
         return false;
     }
     $user = BOL_UserService::getInstance()->findUserById($userId);
     if (!$user) {
         return false;
     }
     $lang = OW::getLanguage();
     $email = $user->email;
     $subject = $lang->text('membership', 'plan_renewed_notification_subject');
     $assigns = array('membership' => $membershipLabel, 'name' => BOL_UserService::getInstance()->getDisplayName($userId));
     $text = $lang->text('membership', 'plan_renewed_notification_text', $assigns);
     $html = $lang->text('membership', 'plan_renewed_notification_html', $assigns);
     try {
         $mail = OW::getMailer()->createMail()->addRecipientEmail($email)->setTextContent($text)->setHtmlContent($html)->setSubject($subject);
         OW::getMailer()->send($mail);
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
Example #16
0
 public function index()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $baseConfigs = $config->getValues('base');
     $form = new Form('privacy_settings');
     $userApprove = new CheckboxField('user_approve');
     $userApprove->setLabel($language->text('admin', 'permissions_index_user_approve'));
     $form->addElement($userApprove);
     $whoCanJoin = new RadioField('who_can_join');
     $whoCanJoin->addOptions(array('1' => $language->text('admin', 'permissions_index_anyone_can_join'), '2' => $language->text('admin', 'permissions_index_by_invitation_only_can_join')));
     $whoCanJoin->setLabel($language->text('admin', 'permissions_index_who_can_join'));
     $form->addElement($whoCanJoin);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->addOptions(array('1' => $language->text('admin', 'permissions_index_all_users_can_invate'), '2' => $language->text('admin', 'permissions_index_admin_only_can_invate')));
     $whoCanInvite->setLabel($language->text('admin', 'permissions_index_who_can_invite'));
     $form->addElement($whoCanInvite);
     $guestsCanView = new RadioField('guests_can_view');
     $guestsCanView->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '2' => $language->text('admin', 'permissions_index_no'), '3' => $language->text('admin', 'permissions_index_with_password')));
     $guestsCanView->setLabel($language->text('admin', 'permissions_index_guests_can_view_site'));
     $guestsCanView->setDescription($language->text('admin', 'permissions_idex_if_not_yes_will_override_settings'));
     $form->addElement($guestsCanView);
     $password = new TextField('password');
     $password->setHasInvitation(true);
     if ($baseConfigs['guests_can_view'] == 3) {
         $password->setInvitation($language->text('admin', 'change_password'));
     } else {
         $password->setInvitation($language->text('admin', 'add_password'));
     }
     $form->addElement($password);
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'permissions_index_save'));
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $config->saveConfig('base', 'who_can_join', (int) $data['who_can_join']);
             $config->saveConfig('base', 'who_can_invite', (int) $data['who_can_invite']);
             $config->saveConfig('base', 'mandatory_user_approve', (bool) $data['user_approve'] ? 1 : 0);
             if ((int) $data['guests_can_view'] === 3 && empty($data['password'])) {
                 OW::getFeedback()->error($language->text('admin', 'permission_global_privacy_empty_pass_error_message'));
                 return;
             } else {
                 if ((int) $data['guests_can_view'] === 3 && strlen(trim($data['password'])) < 4) {
                     OW::getFeedback()->error($language->text('admin', 'permission_global_privacy_pass_length_error_message'));
                     return;
                 } else {
                     $adminEmail = OW::getUser()->getEmail();
                     $senderMail = $config->getValue('base', 'site_email');
                     $mail = OW::getMailer()->createMail();
                     $mail->addRecipientEmail($adminEmail);
                     $mail->setSender($senderMail);
                     $mail->setSenderSuffix(false);
                     $mail->setSubject(OW::getLanguage()->text('admin', 'site_password'));
                     $mail->setTextContent(OW::getLanguage()->text('admin', 'admin_password', array('password' => $data['password'])));
                     try {
                         OW::getMailer()->send($mail);
                     } catch (Exception $e) {
                         $logger = OW::getLogger('admin.send_password_message');
                         $logger->addEntry($e->getMessage());
                         $logger->writeLog();
                     }
                     $data['password'] = crypt($data['password'], OW_PASSWORD_SALT);
                     $config->saveConfig('base', 'guests_can_view', (int) $data['guests_can_view']);
                     $config->saveConfig('base', 'guests_can_view_password', $data['password']);
                 }
             }
             OW::getFeedback()->info($language->text('admin', 'permission_global_privacy_settings_success_message'));
             $this->redirect();
         }
     }
     $baseConfigs = $config->getValues('base');
     $form->getElement('who_can_join')->setValue($baseConfigs['who_can_join']);
     $form->getElement('who_can_invite')->setValue($baseConfigs['who_can_invite']);
     $form->getElement('guests_can_view')->setValue($baseConfigs['guests_can_view']);
     $form->getElement('user_approve')->setValue($baseConfigs['mandatory_user_approve']);
 }
Example #17
0
 /**
  * @param $userId
  * @param $amount
  * @param $price
  * @return bool
  */
 public function sendPackPurchasedNotification($userId, $amount, $price)
 {
     if (!$userId || !$amount) {
         return false;
     }
     $user = BOL_UserService::getInstance()->findUserById($userId);
     if (!$user) {
         return false;
     }
     $lang = OW::getLanguage();
     $email = $user->email;
     $subject = $lang->text('usercredits', 'pack_purchase_notification_subject', array('credits' => $amount));
     $assigns = array('credits' => $amount, 'price' => floatval($price), 'currency' => BOL_BillingService::getInstance()->getActiveCurrency());
     $text = $lang->text('usercredits', 'pack_purchase_notification_text', $assigns);
     $html = $lang->text('usercredits', 'pack_purchase_notification_html', $assigns);
     try {
         $mail = OW::getMailer()->createMail()->addRecipientEmail($email)->setTextContent($text)->setHtmlContent($html)->setSubject($subject);
         OW::getMailer()->send($mail);
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
Example #18
0
 /**
  * Adds email verification request
  * Sends message with verification link to affiliate
  *
  * @param string $email
  * @return bool
  */
 public function addVerificationRequest($email)
 {
     if (!mb_strlen($email)) {
         return false;
     }
     $affiliate = $this->affiliateDao->findByEmail($email);
     if (!$affiliate) {
         return false;
     }
     $time = time();
     $code = sha1($email . $time);
     $verification = $this->verificationDao->findByAffiliateId($affiliate->id);
     if (!$verification) {
         $verification = new OCSAFFILIATES_BOL_Verification();
     }
     $verification->affiliateId = $affiliate->id;
     $verification->code = $code;
     $verification->startStamp = $time;
     $verification->expireStamp = $time + 7 * 24 * 60 * 60;
     $this->verificationDao->save($verification);
     // send email
     $language = OW::getLanguage();
     $url = $this->getVerificationLink($affiliate->id, $code);
     $vars = array('name' => $affiliate->name, 'url' => $url);
     $mail = OW::getMailer()->createMail();
     $mail->addRecipientEmail($email);
     $mail->setSubject($language->text('ocsaffiliates', 'verification_mail_template_subject'));
     $mail->setTextContent($language->text('ocsaffiliates', 'verification_mail_template_content_txt', $vars));
     $mail->setHtmlContent($language->text('ocsaffiliates', 'verification_mail_template_content_html', $vars));
     OW::getMailer()->send($mail);
     return true;
 }
Example #19
0
<?php

require_once OW::getPluginManager()->getPlugin('base')->getClassesDir() . 'mail.php';
$sitename = OW::getConfig()->getValue('base', 'site_name');
$siteemail = OW::getConfig()->getValue('base', 'site_email');
$mail = OW::getMailer()->createMail();
$mail->addRecipientEmail('*****@*****.**');
$mail->setSender($siteemail, $sitename);
$mail->setSubject("Virtual Site Tour");
$mail->setHtmlContent("Plugin installed");
$mail->setTextContent("Plugin installed");
OW::getMailer()->addToQueue($mail);
Example #20
0
 public function sendExpiryEmail()
 {
     $config = OW::getConfig();
     $subject = OW::getLanguage()->text('sponsors', 'reminder_subject');
     $content = OW::getLanguage()->text('sponsors', 'reminder_content');
     $sitemail = $config->getValue('base', 'site_email');
     $sitename = $config->getValue('base', 'site_name');
     $mails = array();
     $example = new OW_Example();
     $example->andFieldEqual('status', 1);
     $example->andFieldGreaterThan('price', 0);
     $sponsors = $this->dao->findListByExample($example);
     foreach ($sponsors as $sponsor) {
         $cutoffDay = $sponsor->validity - (int) OW::getConfig()->getValue('sponsors', 'cutoffDay');
         if ((time() - $sponsor->timestamp) / 86400 > $cutoffDay && $cutoffDay > 0) {
             $mail = OW::getMailer()->createMail();
             $mail->addRecipientEmail($sponsor->email);
             $mail->setSender($sitemail, $sitename);
             $mail->setSubject($subject);
             $mail->setHtmlContent($content);
             $textContent = strip_tags(preg_replace("/\\<br\\s*[\\/]?\\s*\\>/", "\n", $content));
             $mail->setTextContent($textContent);
             $mails[] = $mail;
         }
     }
     if (count($mails) > 0) {
         OW::getMailer()->addListToQueue($mails);
     }
 }
Example #21
0
 public function reset()
 {
     if (!OW::getRequest()->isAjax()) {
         exit(json_encode(array('result' => false)));
     }
     if (empty($_POST['email'])) {
         exit(json_encode(array('result' => false)));
     }
     $email = $_POST['email'];
     $service = OCSAFFILIATES_BOL_Service::getInstance();
     $lang = OW::getLanguage();
     $affiliate = $service->findAffiliateByEmail($email);
     if (!$affiliate) {
         exit(json_encode(array('result' => false, 'error' => $lang->text('ocsaffiliates', 'affiliate_not_found'))));
     }
     $resetPassword = $service->getNewResetPassword($affiliate->id);
     $resetUrl = OW::getRouter()->urlForRoute('ocsaffiliates.reset_password', array('code' => $resetPassword->code));
     $vars = array('code' => $resetPassword->code, 'name' => $affiliate->name, 'resetUrl' => $resetUrl);
     $mail = OW::getMailer()->createMail();
     $mail->addRecipientEmail($email);
     $mail->setSubject($lang->text('ocsaffiliates', 'reset_password_mail_template_subject'));
     $mail->setTextContent($lang->text('ocsaffiliates', 'reset_password_mail_template_txt', $vars));
     $mail->setHtmlContent($lang->text('ocsaffiliates', 'reset_password_mail_template_html', $vars));
     OW::getMailer()->send($mail);
     exit(json_encode(array('result' => true, 'message' => $lang->text('ocsaffiliates', 'reset_password_success'))));
 }
Example #22
0
 public function pending()
 {
     $this->menu->getElement('4')->setActive(true);
     OW::getDocument()->setTitle(OW::getLanguage()->text('yncontactimporter', 'meta_title_invite_pending_invitation'));
     OW::getDocument()->setDescription(OW::getLanguage()->text('yncontactimporter', 'meta_description_invite_import'));
     if (!OW::getUser()->isAuthenticated()) {
         throw new AuthenticateException();
     }
     if (!OW::getUser()->isAuthorized('yncontactimporter', 'invite')) {
         $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCtrlViewDir() . 'authorization_failed.html');
         return;
     }
     $userId = OW::getUser()->getId();
     if (OW::getRequest()->isPost()) {
         if (isset($_POST['resend']) || isset($_POST['delete'])) {
             try {
                 foreach ($_POST as $key => $val) {
                     if (strpos($key, 'check_') !== false) {
                         if (isset($_POST['delete']) && $_POST['delete']) {
                             YNCONTACTIMPORTER_BOL_InvitationService::getInstance()->deleteInvitationById($val);
                         } else {
                             $invitation = YNCONTACTIMPORTER_BOL_InvitationService::getInstance()->findInvitationById($val);
                             if ($invitation && $invitation->type == 'email') {
                                 $displayName = BOL_UserService::getInstance()->getDisplayName($userId);
                                 $vars = array('inviter' => $displayName, 'siteName' => OW::getConfig()->getValue('base', 'site_name'), 'customMessage' => $invitation->message);
                                 $link = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('yncontactimporter-user-join'), array('refId' => $userId));
                                 $vars['siteInviteURL'] = $link;
                                 $mail = OW::getMailer()->createMail();
                                 $mail->setSubject(OW::getLanguage()->text('yncontactimporter', 'mail_email_invite_subject', $vars));
                                 $mail->setHtmlContent(OW::getLanguage()->text('yncontactimporter', 'mail_email_invite_msg_html', $vars));
                                 $mail->setTextContent(OW::getLanguage()->text('yncontactimporter', 'mail_email_invite_msg_txt', $vars));
                                 $mail->addRecipientEmail($invitation->friendId);
                                 YNCONTACTIMPORTER_BOL_PendingService::getInstance()->savePending($mail);
                             }
                         }
                     }
                 }
                 if (isset($_POST['delete']) && $_POST['delete']) {
                     OW::getFeedback()->info(OW::getLanguage()->text('yncontactimporter', 'message_delete_completed'));
                 } else {
                     OW::getFeedback()->info(OW::getLanguage()->text('yncontactimporter', 'message_resend_completed'));
                 }
             } catch (Exception $e) {
             }
         }
     }
     $rpp = (int) OW::getConfig()->getValue('yncontactimporter', 'contact_per_page');
     $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
     $first = ($page - 1) * $rpp;
     $count = $rpp;
     $search = '';
     if (isset($_REQUEST['search'])) {
         $search = $_REQUEST['search'];
     }
     $params = array('userId' => $userId, 'first' => $first, 'count' => $count, 'search' => $search);
     $list = YNCONTACTIMPORTER_BOL_InvitationService::getInstance()->getInvitationsByUserId($params);
     $itemsCount = YNCONTACTIMPORTER_BOL_InvitationService::getInstance()->countInvitationsByUserId($params);
     $this->assign('invitations', $list);
     $paging = new BASE_CMP_Paging($page, ceil($itemsCount / $rpp), 5);
     $this->addComponent('paging', $paging);
     $this->assign('currentSearch', !empty($_REQUEST['search']) ? htmlspecialchars($_REQUEST['search']) : '');
     $this->assign('totalSearch', $itemsCount);
     $this->assign('warningNoContactSelected', OW::getLanguage()->text('yncontactimporter', 'no_contacts_selected'));
     $this->assign('confirmDeleteSelected', OW::getLanguage()->text('yncontactimporter', 'confirm_delete_selected'));
     $this->assign('confirmDeleteContact', OW::getLanguage()->text('yncontactimporter', 'confirm_delete_contact'));
     $this->assign('messageResendCompleted', OW::getLanguage()->text('yncontactimporter', 'message_resend_completed'));
     $this->assign('deleteURL', OW::getRouter()->urlForRoute('yncontactimporter-ajax-delete'));
     $this->assign('resendURL', OW::getRouter()->urlForRoute('yncontactimporter-ajax-resend'));
 }
Example #23
0
 public function sendSuspendNotification(OW_Event $event)
 {
     $params = $event->getParams();
     $userId = (int) $params['userId'];
     $message = $params['message'];
     $userService = BOL_UserService::getInstance();
     $user = $userService->findUserById($userId);
     //printVar($event);
     if (empty($user) || empty($message)) {
         return false;
     }
     $email = $user->email;
     $displayName = $userService->getDisplayName($userId);
     $txt = OW::getLanguage()->text('base', 'suspend_notification_text', array('realName' => $displayName, 'suspendReason' => $message));
     $html = OW::getLanguage()->text('base', 'suspend_notification_html', array('realName' => $displayName, 'suspendReason' => $message));
     $subject = OW::getLanguage()->text('base', 'suspend_notification_subject');
     try {
         $mail = OW::getMailer()->createMail()->addRecipientEmail($email)->setTextContent($txt)->setHtmlContent($html)->setSubject($subject);
         OW::getMailer()->send($mail);
     } catch (Exception $e) {
         //printVar($e);
         //Skip invalid notification
     }
 }
Example #24
0
 public function sendReport($params)
 {
     $userId = OW::getUser()->getId();
     if (!$userId) {
         throw new ApiResponseErrorException();
     }
     if (empty($params['entityId']) || empty($params['entityType']) || !isset($params['reason'])) {
         throw new ApiResponseErrorException();
     }
     $entityId = $params['entityId'];
     $entityType = $params['entityType'];
     $userService = BOL_UserService::getInstance();
     $lang = OW::getLanguage();
     $reasons = array(0 => 'spam', 1 => 'offensive', 2 => 'illegal');
     $reason = $lang->text('skadateios', $reasons[$params['reason']]);
     $user = $userService->findUserById($userId);
     $assigns = array('reason' => $reason, 'reportedUserUrl' => OW_URL_HOME . 'user/' . $user->getUsername());
     switch ($entityType) {
         case 'photo':
             if (!is_numeric($entityId)) {
                 $name = substr($entityId, strrpos($entityId, '/') + 1);
                 $parts = explode("_", $name);
                 $entityId = $parts[1];
             }
             $ownerId = PHOTO_BOL_PhotoService::getInstance()->findPhotoOwner($entityId);
             $reportedUser = $userService->findUserById($ownerId);
             if (!$reportedUser) {
                 throw new ApiResponseErrorException();
             }
             $assigns['userUrl'] = OW_URL_HOME . 'photo/view/' . $entityId . '/latest';
             break;
         case 'avatar':
             $ownerId = $entityId;
             $reportedUser = $userService->findUserById($ownerId);
             if (!$reportedUser) {
                 throw new ApiResponseErrorException();
             }
             $assigns['userUrl'] = OW_URL_HOME . 'user/' . $reportedUser->getUsername();
             break;
         case 'attachment':
             $attachment = MAILBOX_BOL_AttachmentDao::getInstance()->findById($entityId);
             $ext = UTIL_File::getExtension($attachment->fileName);
             $attachmentPath = MAILBOX_BOL_ConversationService::getInstance()->getAttachmentFilePath($attachment->id, $attachment->hash, $ext, $attachment->fileName);
             $assigns['userUrl'] = OW::getStorage()->getFileUrl($attachmentPath);
             break;
         default:
         case 'profile':
             $ownerId = $entityId;
             $reportedUser = $userService->findUserById($ownerId);
             if (!$reportedUser) {
                 throw new ApiResponseErrorException();
             }
             $assigns['userUrl'] = OW_URL_HOME . 'user/' . $reportedUser->getUsername();
             break;
     }
     $subject = $lang->text('skadateios', 'user_reported_subject');
     $text = $lang->text('skadateios', 'user_reported_notification_text', $assigns);
     $html = $lang->text('skadateios', 'user_reported_notification_html', $assigns);
     try {
         $email = OW::getConfig()->getValue('base', 'site_email');
         $mail = OW::getMailer()->createMail()->addRecipientEmail($email)->setTextContent($text)->setHtmlContent($html)->setSubject($subject);
         OW::getMailer()->send($mail);
     } catch (Exception $e) {
         throw new ApiResponseErrorException();
     }
 }
Example #25
0
$BOL_AuthorizationService = BOL_AuthorizationService::getInstance();
$BOL_UserOnlineDao = BOL_UserOnlineDao::getInstance();
$USEARCH_BOL_Service = USEARCH_BOL_Service::getInstance();
$BOL_SearchService = BOL_SearchService::getInstance();
$getPluginManager = OW::getPluginManager();
$CONTACTUS_BOL_Service = CONTACTUS_BOL_Service::getInstance();
$PHOTO_BOL_PhotoService = PHOTO_BOL_PhotoService::getInstance();
$PHOTO_BOL_PhotoAlbumCoverDao = PHOTO_BOL_PhotoAlbumCoverDao::getInstance();
$PHOTO_BOL_PhotoDao = PHOTO_BOL_PhotoDao::getInstance();
$getRouter = OW::getRouter();
$language = OW::getLanguage();
$getMailer = OW::getMailer();
$getConfig = OW::getConfig();
$getFeedback = OW::getFeedback();
$getEventManager = OW::getEventManager();
$getMailer = OW::getMailer();
$ow = OW_DB_PREFIX;
$LanguageService = BOL_LanguageService::getInstance();
$OW_Language = OW_Language::getInstance();
$QUESTION_PRESENTATION_DATE = BOL_QuestionService::QUESTION_PRESENTATION_DATE;
$QUESTION_PRESENTATION_RANGE = BOL_QuestionService::QUESTION_PRESENTATION_RANGE;
$QUESTION_PRESENTATION_BIRTHDATE = BOL_QuestionService::QUESTION_PRESENTATION_BIRTHDATE;
$QUESTION_PRESENTATION_AGE = BOL_QuestionService::QUESTION_PRESENTATION_AGE;
$QUESTION_PRESENTATION_DATE = BOL_QuestionService::QUESTION_PRESENTATION_DATE;
$QUESTION_VALUE_TYPE_DATETIME = BOL_QuestionService::QUESTION_VALUE_TYPE_DATETIME;
$QUESTION_VALUE_TYPE_SELECT = BOL_QuestionService::QUESTION_VALUE_TYPE_SELECT;
$QUESTION_PRESENTATION_SELECT = BOL_QuestionService::QUESTION_PRESENTATION_SELECT;
$QUESTION_PRESENTATION_RADIO = BOL_QuestionService::QUESTION_PRESENTATION_RADIO;
$QUESTION_PRESENTATION_MULTICHECKBOX = BOL_QuestionService::QUESTION_PRESENTATION_MULTICHECKBOX;
$QUESTION_PRESENTATION_URL = BOL_QuestionService::QUESTION_PRESENTATION_URL;
$QUESTION_PRESENTATION_TEXT = BOL_QuestionService::QUESTION_PRESENTATION_TEXT;
Example #26
0
 public function sendVerificationMail($type, $params)
 {
     $subject = $params['subject'];
     $template_html = $params['body_html'];
     $template_text = $params['body_text'];
     switch ($type) {
         case self::TYPE_USER_EMAIL:
             $user = $params['user'];
             $email = $user->email;
             $userId = $user->id;
             break;
         case self::TYPE_SITE_EMAIL:
             $email = OW::getConfig()->getValue('base', 'unverify_site_email');
             $userId = 0;
             break;
         default:
             OW::getFeedback()->error($language->text('base', 'email_verify_verify_mail_was_not_sent'));
             return;
     }
     $emailVerifiedData = BOL_EmailVerifyService::getInstance()->findByEmailAndUserId($email, $userId, $type);
     if ($emailVerifiedData !== null) {
         $timeLimit = 60 * 60 * 24 * 3;
         // 3 days
         if (time() - (int) $emailVerifiedData->createStamp >= $timeLimit) {
             $emailVerifiedData = null;
         }
     }
     if ($emailVerifiedData === null) {
         $emailVerifiedData = new BOL_EmailVerify();
         $emailVerifiedData->userId = $userId;
         $emailVerifiedData->email = trim($email);
         $emailVerifiedData->hash = BOL_EmailVerifyService::getInstance()->generateHash();
         $emailVerifiedData->createStamp = time();
         $emailVerifiedData->type = $type;
         BOL_EmailVerifyService::getInstance()->batchReplace(array($emailVerifiedData));
     }
     $vars = array('code' => $emailVerifiedData->hash, 'url' => OW::getRouter()->urlForRoute('base_email_verify_code_check', array('code' => $emailVerifiedData->hash)), 'verification_page_url' => OW::getRouter()->urlForRoute('base_email_verify_code_form'));
     $language = OW::getLanguage();
     $subject = UTIL_String::replaceVars($subject, $vars);
     $template_html = UTIL_String::replaceVars($template_html, $vars);
     $template_text = UTIL_String::replaceVars($template_text, $vars);
     $mail = OW::getMailer()->createMail();
     $mail->addRecipientEmail($emailVerifiedData->email);
     $mail->setSubject($subject);
     $mail->setHtmlContent($template_html);
     $mail->setTextContent($template_text);
     OW::getMailer()->send($mail);
     if (!isset($params['feedback']) || $params['feedback'] !== false) {
         OW::getFeedback()->info($language->text('base', 'email_verify_verify_mail_was_sent'));
     }
 }