Example #1
0
 public function resetPassword()
 {
     $possible_letters = '23456789bcdfghjkmnpqrstvwxyz';
     $number_of_characters = 8;
     $code = '';
     $i = 0;
     while ($i < $number_of_characters) {
         $code .= substr($possible_letters, mt_rand(0, strlen($possible_letters) - 1), 1);
         $i++;
     }
     $this->setPassword($code);
     $view = new \Alien\View('email/resetPassword.php');
     $view->meno = $this->firstname . ' ' . $this->surname;
     $view->heslo = $code;
     $message = $view->renderToString();
     $mail = new \PHPMailer();
     $mail->IsHTML(true);
     $mail->CharSet = 'UTF-8';
     $mail->Subject = 'Resetovanie hesla';
     $mail->SetFrom(Application::getParameter('emailDefaultFrom'), Application::getParameter('emailDefailtFromName'));
     $mail->AddAddress($this->email);
     $mail->MsgHTML($message);
     $mail->AltBody = Application::getParameter('emailAltHTMLBody');
     $mail->Send();
 }
Example #2
0
 public final function __toString()
 {
     $Class = get_called_class();
     $view = new View($this->getSRC());
     $view->setAutoEscape(false);
     $view->setAutoStripTags(false);
     if ($Class::useNotifications && $this->notificationContainer instanceof NotificationContainer) {
         $list = $this->notificationContainer->getNotifications();
         if (sizeof($list)) {
             $partialView = new View('display/system/notifications.php', null);
             $partialView->list = $list;
             $partialViewStr = $partialView->renderToString();
             $this->notificationContainer->flushNotifications();
         } else {
             $partialViewStr = '';
         }
         $view->notifications = $partialViewStr;
     }
     $partials = $this->getPartials();
     if (sizeof($partials)) {
         foreach ($partials as $k => $v) {
             $view->{$k} = $v;
         }
     }
     $scripts = '';
     foreach ($this->metaScripts as $script) {
         $scripts .= "<script type=\"{$script['type']}\" src=\"{$script['src']}\"></script>\n";
     }
     $view->metaScripts = $scripts;
     $styles = '';
     foreach ($this->metaStylesheets as $style) {
         $styles .= "<link type=\"{$style['type']}\"  href=\"{$style['href']}\" rel=\"{$style['rel']}\">\n";
     }
     $view->metaStylesheets = $styles;
     if ($Class::useConsole) {
         if ((true || Application::getParameter('debugMode')) && Authorization::getCurrentUser()->getId()) {
             $console = new View('display/system/console.php', null);
             $console->messages = Application::getInstance()->getConsole()->getMessageList();
             $view->terminal = $console->renderToString();
         }
     }
     $content = $view->renderToString();
     return $content;
 }