Beispiel #1
0
 public static function sendResetPasswordLink($userId)
 {
     $user = self::get($userId);
     if (!$user) {
         throw new \Ip\Exception("User doesn't exist");
     }
     $urlData = array('sa' => 'Admin.passwordReset', 'id' => $userId, 'secret' => self::generatePasswordResetSecret($userId));
     $contentData = array('link' => ipActionUrl($urlData));
     $content = ipView('view/passwordResetContent.php', $contentData)->render();
     $emailData = array('content' => $content);
     $email = ipEmailTemplate($emailData);
     $from = ipGetOptionLang('Config.websiteEmail');
     $fromName = ipGetOptionLang('Config.websiteTitle');
     $subject = __('Password reset instructions', 'Ip-admin', false);
     $to = $user['email'];
     $toName = $user['username'];
     ipSendEmail($from, $fromName, $to, $toName, $subject, $email);
 }
<?php

echo ipEmailTemplate($this->getVariables());
Beispiel #3
0
 /**
  * @param \Ip\Form $form
  * @param array $postData
  * @param array $data
  */
 public function sendEmail($form, $postData, $data)
 {
     $contentData = array();
     $websiteName = ipGetOptionLang('Config.websiteTitle');
     $websiteEmail = ipGetOptionLang('Config.websiteEmail');
     $from = $websiteEmail;
     $files = array();
     foreach ($form->getFields() as $field) {
         if ($field->getType() == \Ip\Form\Field::TYPE_REGULAR) {
             if (!isset($postData[$field->getName()])) {
                 $postData[$field->getName()] = null;
             }
             $title = $field->getLabel();
             $value = $field->getValueAsString($postData, $field->getName());
             $contentData[] = array('fieldClass' => get_class($field), 'title' => $title, 'value' => $value);
         }
         if (get_class($field) == 'Ip\\Form\\Field\\Email') {
             $userFrom = $field->getValueAsString($postData, $field->getName());
             if ($userFrom != '') {
                 $from = $userFrom;
             }
         }
         if (get_class($field) == 'Ip\\Form\\Field\\File') {
             $uploadedFiles = $field->getFiles($postData, $field->getName());
             $originalNames = $field->originalFileNames($postData, $field->getName());
             foreach ($uploadedFiles as $key => $uploadedFile) {
                 $files[] = array($uploadedFile, $originalNames[$key]);
             }
         }
     }
     $content = ipView('helperView/email_content.php', array('values' => $contentData))->render();
     $emailData = array('content' => $content);
     $email = ipEmailTemplate($emailData);
     //get page where this widget sits :)
     $fullWidgetRecord = \Ip\Internal\Content\Model::getWidgetRecord($postData['widgetId']);
     $pageTitle = '';
     if (isset($fullWidgetRecord['revisionId'])) {
         $revision = \Ip\Internal\Revision::getRevision($fullWidgetRecord['revisionId']);
         if (!empty($revision['pageId'])) {
             $pageTitle = ipPage($revision['pageId'])->getTitle();
         }
     }
     $subject = $websiteName . ': ' . $pageTitle;
     $emailQueue = new \Ip\Internal\Email\Module();
     if (!empty($data['sendTo']) && $data['sendTo'] == 'custom') {
         if (empty($data['emails'])) {
             $data['emails'] = '';
         }
         $emailList = preg_split("/[\\s,]+/", $data['emails']);
     } else {
         $emailList = array($websiteEmail);
     }
     foreach ($emailList as $listItem) {
         $emailQueue->addEmail($from, '', $listItem, '', $subject, $email, false, true, $files);
     }
     $emailQueue->send();
 }
Beispiel #4
0
 public static function sendMailNotification($page, $author, $date, $comm, $emailAuthor, $pageTitle = '', $vcode = '')
 {
     $sendEmail = ipGetOption('Comment.useSeparateEmail');
     if (empty($sendEmail)) {
         $sendEmail = ipGetOptionLang('Config.websiteEmail');
     }
     $noUser = '******' . __("You are not a registered user, or pehaps you were not logged in when have commented. So, you need to verify " . "your email address before your comment is moderated and published. Please, click on the following link for " . "such a thing: ", "Comments") . '<a href="' . ipHomeUrl() . ipContent()->getCurrentLanguage()->getUrlPath() . 'comments/' . $vcode . '-!' . $emailAuthor . '">' . __('Email verification', 'Comments') . '</a>' . __(" If it doesn't work, please copy and past the following in your web browser: ", "Comments") . "<strong>" . ipHomeUrl() . ipContent()->getCurrentLanguage()->getUrlPath() . "comments/" . $vcode . '-!' . $emailAuthor . '</strong></div><br />';
     if (ipUser()->isLoggedIn()) {
         $noUser = '';
     }
     //array can has: 'title', 'content', 'signature', 'footer'.
     $contentAdmin = sprintf('<div><strong>' . __('Page', 'Comments') . ':</strong> ' . __($pageTitle, 'Comments') . ' (%s)</div>' . '<div><strong>' . __('Author', 'Comments') . ':</strong> %s - ' . $emailAuthor . '</div>' . '<div><strong>' . __('Date', 'Comments') . ':</strong> %s</div>' . '<div><strong>' . __('Comment', 'Comments') . ':</strong></div>' . '<div><cite class="mail">%s</cite></div>', $page, $author, $date, $comm);
     $templateAdmin = array('title' => __('You just received a comment', 'Comments'), 'content' => $contentAdmin, 'signature' => '<h4>' . __('Internal Administration', 'Comments') . '</h4>', 'footer' => '<h4>' . ipGetOptionLang('Config.websiteTitle') . '</h4>');
     $contentAuthor = sprintf(__('Your comment has been sent and it is awaiting moderation. Thank you.', 'Comments') . $noUser . '<div><strong>' . __('Page', 'Comments') . ':</strong> ' . __($pageTitle, 'Comments') . ' (%s)</div>' . '<div><strong>' . __('Author', 'Comments') . ':</strong> %s - ' . $emailAuthor . '</div>' . '<div><strong>' . __('Date', 'Comments') . ':</strong> %s</div>' . '<div><strong>' . __('Comment', 'Comments') . ':</strong></div>' . '<div><cite class="mail">%s</cite></div>', $page, $author, $date, $comm);
     $templateAuthor = array('title' => __('You just sent a comment', 'Comments'), 'content' => $contentAuthor, 'signature' => '<div>' . __('Kindest regards', 'Comments') . ',</div>', 'footer' => '<h4>' . ipGetOptionLang('Config.websiteTitle') . '</h4>');
     /* ipSendEmail ( string $from , string $fromName , string $to , 
     		string $toName , string $subject , string $content , [ boolean $urgent ] ,
     		[ boolean $html ] , [ string|array|null $files ] ) */
     if (ipGetOption('Comments.informAboutNewComments') == 'Yes') {
         //ipSendEmail() Administration
         ipSendEmail($sendEmail, __('Site Comment', 'Comments'), $sendEmail, __('Comment Moderation', 'Comments'), __('There is a new comment', 'Comments') . ': ' . __($pageTitle, 'Comments'), ipEmailTemplate($templateAdmin), true, true);
     }
     if (ipGetOption('Comments.requireEmailConfirmation') == 'Yes') {
         //ipSendMail Author
         ipSendEmail($sendEmail, ipGetOptionLang('Config.websiteTitle'), $emailAuthor, $author, __('You have just done a comment in our website', 'Comments') . ': ' . __($pageTitle, 'Comments'), ipEmailTemplate($templateAuthor), true, true);
     }
 }