Exemplo n.º 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);
 }
Exemplo n.º 2
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);
     }
 }