예제 #1
0
<?php

// email send processor
\framework\import('org.phpmailer.phpmailer');
class Emailsend extends EmailProc
{
    public function process($objectId, $params)
    {
        return $this->sendEmail($params);
    }
    public function checkFinish($objectId, $params)
    {
        // Check if job is finished and set status accordingly
        $mailingMgr = new MailingMgr();
        $mailing = $mailingMgr->getMailing($params['MAILING_ID']);
        $queuedJobs = $mailingMgr->scheduler->getQueuedJobsForObject($params['MAILING_ID'], true, true, 'SCH_EMAILSEND');
        if (count($queuedJobs) == 0) {
            // No more jobs scheduled
            if ($params['IS_TEST']) {
                $mailing->setStatus('UNSENT');
            } else {
                $mailing->setStatus('SENT');
            }
            return true;
        }
        return false;
    }
    public function sendEmail($emailData)
    {
        $mail = new PHPMailer();
        if ((bool) sConfig()->getVar('CONFIG/MAILINGS/DISABLE')) {
예제 #2
0
 * @GNU         This library is free software; you can redistribute it and/or
 *              modify it under the terms of the GNU Lesser General Public
 *              License as published by the Free Software Foundation; either
 *              version 2.1 of the License, or (at your option) any later
 *              version.
 *              This library is distributed in the hope that it will be
 *              useful, but WITHOUT ANY WARRANTY; without even the implied
 *              warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 *              PURPOSE. See the GNU Lesser General Public License for more
 *              details.
 *              You should have received a copy of the GNU Lesser General
 *              Public License along with this library; if not, write to the
 *              Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 *              Boston, MA 02111-1307 USA
 **/
\framework\import("org.yeager.framework.db.nested_set_db");
class NestedSet
{
    /**
     * @access      public
     **/
    /**
     * @param       string  DB_table    Name der Table in der DB
     * @param       string  lft         Name des linken Tabellenfaldes
     * @param       string  rgt         Name des rechten Tabellenfeldes
     * @param       string  moved       Name des moved-Tabellenfeldes (wurde ein Element bewegt)
     * @param       string  id          Name des id-Tabellenfeldes
     * @param       string  admin_mail  Email-Adresse des Admins
     * @param       int     ID          ID der MySQL-Verbindung
     * @param       bool    show_error  Fehlermeldungen anzeigen
     * @return      void
예제 #3
0
파일: user.php 프로젝트: nrueckmann/yeager
<?php

/**
 * @file
 * @author  Next Tuesday GmbH <*****@*****.**>
 * @version 1.0
 *
 */
\framework\import("org.phpass.PasswordHash");
/**
 * The User class, which represents a User object.
 */
class User extends \framework\Error
{
    var $_db;
    var $_isvalidated;
    var $_usergroups;
    var $_uid;
    var $properties;
    private $id;
    /**
     * Constructor of the User class
     *
     * @param int $uid User Id
     */
    function __construct($uid)
    {
        $this->_db = sYDB();
        $this->_isvalidated = false;
        $this->_uid =& sUserMgr()->getCurrentUserID();
        $this->id = (int) $uid;
예제 #4
0
파일: y.php 프로젝트: nrueckmann/yeager
 public function go()
 {
     header("Content-Type: text/html; charset=UTF-8");
     // Import Libraries
     \framework\import("org.yeager.framework.tools.password");
     \framework\import("org.yeager.ui.common");
     \framework\import("org.yeager.ui.koala");
     \framework\import("org.yeager.ui.icons");
     \framework\import("org.yeager.framework.tools.password");
     \framework\import("org.yeager.framework.tools.http.redirect");
     \framework\import("org.yeager.framework.tools.http.byteserve");
     \framework\import("org.yeager.core.versionable");
     \framework\import("org.yeager.core.tree");
     \framework\import("org.yeager.core.permissions");
     \framework\import("org.yeager.core.privileges");
     \framework\import("org.yeager.core.propertysettings");
     \framework\import("org.yeager.core.properties");
     \framework\import("org.yeager.core.history");
     \framework\import("org.yeager.core.jsqueue");
     \framework\import("org.yeager.core.tags");
     \framework\import("org.yeager.core.comments");
     \framework\import("org.yeager.core.cblock");
     \framework\import("org.yeager.core.cblockmgr");
     \framework\import("org.yeager.core.entrymasks");
     \framework\import("org.yeager.core.page");
     \framework\import("org.yeager.core.pagemgr");
     \framework\import("org.yeager.core.file");
     \framework\import("org.yeager.core.filemgr");
     \framework\import("org.yeager.core.filetypes");
     \framework\import("org.yeager.core.views");
     \framework\import("org.yeager.core.mailing");
     \framework\import("org.yeager.core.mailingmgr");
     \framework\import("org.yeager.core.templates");
     \framework\import("org.yeager.core.usergroups");
     \framework\import("org.yeager.core.sites");
     \framework\import("org.yeager.core.languages");
     \framework\import("org.yeager.core.reftracker");
     \framework\import("org.yeager.core.scheduler");
     \framework\import("org.yeager.core.extensionmgr");
     \framework\import("org.yeager.core.extensions");
     \framework\import("org.yeager.core.fileprocessor");
     \framework\import("org.yeager.core.cblockprocessor");
     \framework\import("org.yeager.core.emailprocessor");
     \framework\import("org.yeager.core.pageprocessor");
     \framework\import("org.yeager.core.user");
     \framework\import("org.yeager.core.usermgr");
     \framework\import("org.yeager.core.tree");
     \framework\import('org.yeager.core.updater');
     \framework\import('org.yeager.core.archive');
     // Set UTF8 for DB
     Singleton::YDB()->Execute("SET NAMES 'utf8';");
     // Set ADODB-Fetchmode to ADODB_FETCH_ASSOC
     Singleton::YDB()->SetFetchMode(ADODB_FETCH_ASSOC);
     // Create instance of Koala class
     $koala = new Koala($this->yeager);
     $username = $this->session->getSessionVar("username");
     $password = $this->session->getSessionVar("password");
     Singleton::register("session", $this->session);
     Singleton::register("request", $this->request);
     Singleton::register("config", $this->config);
     Singleton::register("UserMgr", new UserMgr());
     Singleton::register("guiUS", $this->request->parameters['us']);
     Singleton::register("guiLH", $this->request->parameters['lh']);
     // Get frontend timezone
     $this->frontendTimezone = (string) Singleton::config()->getVar('CONFIG/TIMEZONES/FRONTEND');
     if (!$this->frontendTimezone) {
         $this->frontendTimezone = 'Europe/Berlin';
     }
     $userID = Singleton::UserMgr()->validate($username, $password);
     Singleton::register("Usergroups", new Usergroups());
     if (!$userID) {
         $userID = Singleton::UserMgr()->getAnonymousID();
         $this->authenticated = false;
     } else {
         $this->authenticated = true;
         if ($userID != Singleton::UserMgr()->getAnonymousID()) {
             $this->session->setPSessionVar("username", $username);
             $this->session->setPSessionVar("password", $password);
             $this->session->setPSessionVar("userid", $userID);
             $this->session->setPSessionVar("isvalidated", true);
         }
         if ($this->session->getSessionVar('keepLoggedIn')) {
             $this->session->cookie_time = time() + 60 * 60 * 24 * 365;
         } else {
             $cookie_time = (int) Singleton::config()->getVar("CONFIG/SESSION/COOKIES/TIME");
             $this->session->cookie_time = $cookie_time;
         }
     }
     // write roles to sessions for cachekey
     $user = new User($userID);
     $roles = $user->getUsergroupIDs();
     if ($userID != Singleton::UserMgr()->getAnonymousID()) {
         $this->session->setPSessionVar("userroles", $roles);
         $this->session->setPSessionVar("userid", $userID);
         $this->session->setCookie("yg-userid", $userID);
         $roleHash = "";
         foreach ($roles as $r) {
             $roleHash .= $r["ID"] . "x";
         }
         $this->session->setCookie("yg-userroles", $roleHash);
     } elseif ($_COOKIE['yg-userid']) {
         // remove cookie if set
         $this->session->removeCookie("yg-userid");
         $this->session->removeCookie("yg-userroles");
     }
     $backendAllowed = $user->checkPermission('RBACKEND');
     if ((!$this->authenticated || !$backendAllowed) && $this->frontendMode != 'true') {
         if ($this->page != 'responder' && ($this->request->parameters['handler'] != 'userLogin' || $this->request->parameters['handler'] != 'recoverLogin' || $this->request->parameters['handler'] != 'setNewPassword')) {
             $header = $_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden';
             header($header);
             echo $header;
             die;
         }
     }
     $user_timezone = $user->properties->getValue('TIMEZONE');
     $timezoneAbbreviations = timezone_abbreviations_list();
     foreach ($timezoneAbbreviations as $timezoneAbbreviations_item) {
         foreach ($timezoneAbbreviations_item as $timezone_item) {
             if ($timezone_item['timezone_id'] == $user_timezone) {
                 global $tz;
                 $tz = $timezone_item;
             }
         }
     }
     Singleton::register("Tags", new Tags());
     Singleton::register("cbMgr", new CblockMgr());
     Singleton::register("fileMgr", new FileMgr());
     Singleton::register("sites", new Sites());
     Singleton::register("templates", new Templates());
     Singleton::register("entrymasks", new Entrymasks());
     Singleton::register("mailingMgr", new MailingMgr());
     Singleton::register("comments", new Comments());
     Singleton::register("filetypes", new Filetypes());
     Singleton::register("views", new Views());
     Singleton::register("app", $this);
     Singleton::register("koala", $koala);
     $versioninfo = new Updater();
     $versionp = $versioninfo->current_version_string;
     $this->yeager_version = $versionp;
     $this->yeager_revision = substr(YEAGER_REVISION, 4, 7);
     //$this->yeager_date = YEAGER_DATE;
     // get page to display
     if (empty($this->page)) {
         $this->page = "default";
     }
     if (empty($this->action)) {
         $this->action = $this->request->parameters['action'];
     }
     $this->base = $this->request->script_name . "/" . strtolower($this->applicationname);
     /* yeager */
     $this->docpath = Singleton::config()->getVar('CONFIG/DIRECTORIES/DOCPATH');
     $this->docabsolut = $this->baseabsolut = $this->request->prefix . "://" . $this->request->http_host . $this->docpath;
     $this->imgpath = $this->request->prefix . "://" . $this->request->http_host . $this->docpath . "ui/img/";
     $this->doc = $this->app_httproot;
     $this->sid = $this->session->id;
     $this->sidparam = "sid=" . $this->sid;
     // Regular Expressions for URL parsing
     $internalprefix = str_replace('/', '\\/', Singleton::config()->getVar('CONFIG/REFTRACKER/INTERNALPREFIX'));
     $this->URLRegEx1 = '/(.*)' . $internalprefix . '([a-z]*)\\/([0-9]*)(\\/*)(.*)/';
     $this->URLRegEx2 = '/(.*)' . $internalprefix . '([a-z]*)\\/([0-9]*)\\/([0-9]*)(\\/*)(.*)/';
     $filesdir = Singleton::config()->getVar('CONFIG/DIRECTORIES/FILESDIR');
     $filesdoc = Singleton::config()->getVar('CONFIG/DIRECTORIES/FILESDOC');
     $userpicdir = Singleton::config()->getVar('CONFIG/DIRECTORIES/USERPICDIR');
     $embeddedCblockFolder = (int) Singleton::config()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER");
     if (strlen($filesdir) < 1) {
         $filesdir = "files/";
     }
     if (strlen($userpicdir) < 1) {
         $userpicdir = $filesdir;
     }
     if (strlen($filesdoc) < 1) {
         $filesdoc = "/yeager/files/";
     }
     if (strlen($embeddedCblockFolder) < 1 || $embeddedCblockFolder == 99999) {
         throw new Exception("No or wrong blindfolder configured!");
     }
     $this->filesdir = $filesdir;
     $this->filesdoc = $filesdoc;
     $this->userpicdir = $userpicdir;
     $this->modules = Singleton::config()->getVars("CONFIG/MODULES");
     $this->files_procs = array_merge(Singleton::config()->getVars("CONFIG/FILES_PROCESSORS"), Singleton::config()->getVars("CONFIG/FILE_PROCESSORS"));
     $this->page_procs = Singleton::config()->getVars("CONFIG/PAGE_PROCESSORS");
     $this->cblock_procs = Singleton::config()->getVars("CONFIG/CBLOCK_PROCESSORS");
     $this->email_procs = Singleton::config()->getVars("CONFIG/EMAIL_PROCESSORS");
     $this->filesprocdir = (string) Singleton::config()->getVar("CONFIG/DIRECTORIES/FILES_PROCS");
     $this->pageprocdir = (string) Singleton::config()->getVar("CONFIG/DIRECTORIES/PAGE_PROCS");
     $this->cblockprocdir = (string) Singleton::config()->getVar("CONFIG/DIRECTORIES/CBLOCK_PROCS");
     $this->emailprocdir = (string) Singleton::config()->getVar("CONFIG/DIRECTORIES/EMAIL_PROCS");
     $this->templates = new Templates();
     $this->templatedir = $this->approot . (string) Singleton::config()->getVar('CONFIG/DIRECTORIES/TEMPLATEDIR');
     $this->templatedoc = (string) Singleton::config()->getVar('CONFIG/DIRECTORIES/TEMPLATEDOC');
     $this->templatedirabsolut = $this->request->prefix . "://" . $this->request->http_host . $this->templatedoc;
     $this->extensiondir = (string) Singleton::config()->getVar('CONFIG/DIRECTORIES/EXTENSIONSDIR');
     $this->extensiondoc = (string) Singleton::config()->getVar('CONFIG/DIRECTORIES/EXTENSIONSDOC');
     $this->processordir = (string) Singleton::config()->getVar('CONFIG/DIRECTORIES/PROCESSORSDIR');
     $this->webroot = "/" . rtrim(ltrim((string) Singleton::config()->getVar("CONFIG/DIRECTORIES/WEBROOT"), '/'), '/') . '/';
     if ($this->webroot == "//") {
         $this->webroot = "/";
     }
     $this->devmode = (string) Singleton::config()->getVar('CONFIG/DEVMODE');
     $this->languages = new Languages();
     $forceLangInclude = (string) Singleton::config()->getVar('CONFIG/PAGES/' . strtoupper($this->page) . '/FORCE_LANG_INCLUDE');
     if ($this->frontendMode != 'true' || $forceLangInclude == 'true') {
         // Read default language from config-file
         if ($this->authenticated) {
             $user = new User(Singleton::UserMgr()->getCurrentUserID());
             $langid = $user->getLanguage();
             $langinfo = $this->languages->get($langid);
             $lang = $langinfo["CODE"];
         } else {
             // Check if we have a language which matches the browser-language
             $browserLanguages = array();
             $tmpBrowserLanguages = explode(',', strtoupper(str_replace(' ', '', $_SERVER["HTTP_ACCEPT_LANGUAGE"])));
             foreach ($tmpBrowserLanguages as $tmpBrowserLanguage) {
                 array_push($browserLanguages, substr($tmpBrowserLanguage, 0, 2));
             }
             $browserLanguages = array_values(array_unique($browserLanguages));
             foreach ($browserLanguages as $browserLanguage) {
                 if (!$lang) {
                     if (file_exists($this->approot . "ui/lang/" . $browserLanguage . ".php")) {
                         $lang = $browserLanguage;
                     }
                 }
             }
         }
         // When everything fails, fallback to default language
         if (strlen($lang) < 1) {
             $defaultLanguage = Singleton::config()->getVar('CONFIG/DEFAULT_LANGUAGE');
             $lang = $defaultLanguage ? $defaultLanguage : 'DE';
         }
         require_once $this->approot . "ui/lang/" . $lang . ".php";
     }
     $this->itext =& $itext;
     Singleton::register("itext", $itext);
     if (!is_readable($this->page_file) || is_dir($this->page_file)) {
         $this->error->raise("Page " . $this->page . "'s code (" . $this->page_file . ") not found.", ERR_DEBUG);
     } else {
         $this->error->raise("loading " . $this->page_file, ERR_DEBUG);
         if ($this->page_template != "") {
             require_once "libs/org/smarty/libs/Smarty.class.php";
             $smarty = new Smarty();
             $this->smarty = $smarty;
             $smarty->compile_check = true;
             $smarty->debugging = false;
             $smarty->use_sub_dirs = false;
             // FIXME move to installer
             @mkdir($this->tmpdir . 'templates_compile', 0700);
             @mkdir($this->tmpdir . 'templates_cache', 0700);
             $smarty->compile_dir = $this->tmpdir . 'templates_compile';
             $smarty->cache_dir = $this->tmpdir . 'templates_cache';
             $smarty->force_compile = (string) $this->config->getVar('CONFIG/CACHE/SMARTY_FORCECOMPILE');
             $smarty->caching = 0;
             $smarty->load_filter('output', 'trimwhitespace');
             $smarty->assign("yeager_version", $this->yeager_version);
             $smarty->assign("yeager_revision", $this->yeager_revision);
             //$smarty->assign("yeager_date",$this->yeager_date);
             $smarty->assign("lang", $lang);
             $smarty->assign("docabsolut", $this->docabsolut);
             $smarty->assign("baseabsolut", $this->baseabsolut);
             $smarty->assign("imgpath", $this->imgpath);
             $smarty->assign("internalprefix", (string) Singleton::config()->getVar('CONFIG/REFTRACKER/INTERNALPREFIX'));
             $smarty->assign("request_prefix", $this->request->prefix);
             $smarty->assign("extensiondoc", $this->extensiondoc);
             $smarty->assign("extensiondir", $this->extensiondir);
             $smarty->assign("is_authenticated", $this->authenticated);
             $smarty->assign("base", $this->base);
             $smarty->assign("page", $this->page);
             $smarty->assign("sid", $this->sid);
             $smarty->assign("sidparam", $this->sidparam);
             $smarty->assign("templatedir", $this->templatedir);
             $smarty->assign("templatedoc", $this->templatedoc);
             $smarty->assign("templatedirabsolut", $this->templatedirabsolut);
             $smarty->assign("approot", getRealpath($this->approot));
             $smarty->assign("devmode", $this->devmode);
             $smarty->assign("webroot", $this->webroot);
             $smarty->assign("URLRegEx1", $this->URLRegEx1);
             require_once $this->approot . "libs/org/yeager/ui/smarty_modifiers.php";
         }
         $smarty->assign("itext", $itext);
         Singleton::register("smarty", $smarty);
         if ($_SERVER['HTTP_X_YEAGER_AUTHENTICATION'] == 'suppress') {
             $authHeader = 'X-Yeager-Authenticated: delayed';
         } else {
             $authHeader = 'X-Yeager-Authenticated: ' . ($this->authenticated ? 'true' : 'false');
         }
         header($authHeader);
         if ($this->frontendMode == "true" && $this->cached) {
             // capture ob
             include_once $this->page_file;
             $output = ob_get_clean();
             Singleton::FC()->write("output", $output);
             Singleton::FC()->flush();
             echo $output;
         } else {
             include_once $this->page_file;
         }
         if ($this->frontendMode != 'true') {
             $koala->getQueuedCommands();
             $koala->go();
         }
     }
 }
예제 #5
0
파일: log.php 프로젝트: nrueckmann/yeager
<?php

namespace framework;

abstract class Logger
{
    public function __construct($uri = "")
    {
    }
    public function log($level = 0, $message = "")
    {
    }
}
\framework\import('org.firephp.fb');
class FireLog extends Logger
{
    public function __construct($uri = "")
    {
        $this->fb = \FirePHP::getInstance(true);
        $this->fb->setEnabled(true);
        $this->fb->registerExceptionHandler();
    }
    public function log($level = 0, $message = "")
    {
        switch ($level) {
            case 1:
                $this->fb->log($message);
                break;
            case 2:
                $this->fb->Warn($message);
            case 3:
예제 #6
0
<?php

\framework\import("org.yeager.ui.common");
\framework\import("org.yeager.ui.koala");
$data = json_decode($this->request->parameters['data'], true);
for ($i = 1; $i < count($data); $i++) {
    $elements[] = '"' . $data[$i]['id'] . '"';
}
$elements = implode(', ', $elements);
// Check if we get an Array of fields
if ($data[1]['isArray']) {
    // Remove Flag from Array
    unset($data[1]['isArray']);
    foreach ($data[1] as $element) {
        $field->id = $element['id'];
        if ($element['name']) {
            $field->name = $element['name'];
        }
        $field->value = $element['value'] ? $element['value'] : null;
        $field->type = $element['yg_type'] ? $element['yg_type'] : null;
        $field->property = $element['yg_property'] ? $element['yg_property'] : null;
        $field->yg_id = $element['yg_id'] ? $element['yg_id'] : null;
        $fields[$field->property] = $field;
        $field = null;
    }
    $this->fields = $fields;
    $data[1] = $data[1][0];
}
// Load code specific to ajaxaction mapped in configfile
$this->rawdata = $data[1];
$this->elements = $elements;
예제 #7
0
 public function onRender($args = NULL)
 {
     $action = sApp()->request->parameters["action"];
     sSmarty()->assign("action", $action);
     /* LOGIN */
     if ($action == "login") {
         $email = sApp()->request->parameters['email'];
         $password = sApp()->request->parameters['password'];
         $yg_login_referrer = sApp()->request->parameters["yg_login_referrer"];
         sUserMgr()->impersonate(sUserMgr()->getAdministratorID());
         $extproperties = $this->extensionProperties->get();
         if ($yg_login_referrer == '') {
             $yg_login_referrer = $extproperties['STANDARD_REFERRER']['URL'];
         }
         sSmarty()->assign("yg_login_referrer", $yg_login_referrer);
         $userid = sUserMgr()->validate($email, $password);
         sUserMgr()->unimpersonate();
         if ($userid === false) {
             sSmarty()->assign("yg_login_error_code", "1");
             sSmarty()->assign('action', $action);
             sSmarty()->assign("email", $email);
         } else {
             sApp()->session->setPSessionVar("username", $email);
             sApp()->session->setPSessionVar("password", $password);
             sApp()->session->refrehSessionCookie();
             sApp()->session->setPSessionVar("isvalidated", true);
             sApp()->session->setPSessionVar("keepLoggedIn", true);
             sApp()->session->cookie_time = time() + 60 * 60 * 24 * 365;
             http_redirect($yg_login_referrer);
         }
     }
     /* LOGOUT */
     if ($action == $this->extensionProperties->getValue('LOGOUT_ACTION')) {
         $extproperties = $this->extensionProperties->get();
         $logout_referrer = $extproperties['STANDARD_LOGOUT_REFERRER']['URL'];
         sApp()->session->setPSessionVar('username', '');
         sApp()->session->setPSessionVar('password', '');
         sApp()->session->setPSessionVar('isvalidated', false);
         sApp()->session->setPSessionVar('keepLoggedIn', false);
         http_redirect($logout_referrer);
     }
     /* PASSWORD RECOVERY */
     if ($action == "pwd_step1") {
         sUserMgr()->impersonate(sUserMgr()->getAdministratorID());
         $email = sApp()->request->parameters["user_email"];
         $user_info = sUserMgr()->getByLogin($email);
         if ($user_info) {
             $user = sUserMgr()->getUser($user_info['ID']);
             sUserMgr()->unimpersonate();
             $expireTS = time() + 60 * 60 * 24;
             $token = $user->generateToken($expireTS);
             $page = $this->getPage();
             $pageUrl = $page->getUrl();
             // Generate path for recovery URL
             $passwordResetUrl = sApp()->request->prefix . '://' . sApp()->request->http_host;
             $passwordResetUrl .= $pageUrl . '?action=pwd_step2&user_token=' . urlencode($token);
             echo $passwordResetUrl;
             \framework\import("org.phpmailer.phpmailer");
             $mail = new \PHPMailer();
             $mail->Encoding = '8bit';
             $mail->CharSet = 'utf-8';
             $mail->From = $this->extensionProperties->getValue("FROM_EMAIL");
             $mail->FromName = $this->extensionProperties->getValue("FROM_NAME");
             $mail->Subject = $this->extensionProperties->getValue("SUBJECT");
             $mail->Body = $this->extensionProperties->getValue("BODY_PT1");
             $mail->Body .= "\n" . $passwordResetUrl . "\n";
             $mail->Body .= $this->extensionProperties->getValue("BODY_PT2");
             $mail->AddAddress($email);
             $smtpServer = (string) sapp()->config->getVar('CONFIG/MAILINGS/SMTP');
             if ($smtpServer) {
                 $mail->IsSMTP();
                 $mail->Host = $smtpServer;
             }
             $mail->Send();
             $mail->ClearAddresses();
             sSmarty()->assign('recovery_mail_sent', true);
         } else {
             if (strlen(trim($email)) > 0) {
                 sSmarty()->assign('error_step1', true);
             }
         }
     }
     if ($action == "pwd_step2") {
         $error_step2 = false;
         $form_send = sApp()->request->parameters['form_send'];
         sSmarty()->assign('form_send', $form_send);
         $token = sApp()->request->parameters['user_token'];
         sSmarty()->assign('user_token', $token);
         $valid_token = \sUserMgr()->getUserIdByToken($token);
         if (!$valid_token) {
             $error_step2 = true;
             $error_token = true;
             sSmarty()->assign('error_step2', $error_step2);
             sSmarty()->assign('error_token', $error_token);
         }
         if ($form_send == true) {
             $user_password = sapp()->request->parameters['user_password'];
             $user_password_repeat = sapp()->request->parameters['user_password_repeat'];
             $user_id = sUserMgr()->getUserIdByToken($token);
             sUserMgr()->impersonate(sUserMgr()->getAdministratorID());
             $user = sUserMgr()->getUser($user_id);
             sUserMgr()->unimpersonate();
             $user_info = $user->get();
             if ($user_info) {
                 // Check if password is repeated correctly
                 if ($user_password != $user_password_repeat) {
                     $error_repeat = true;
                     sSmarty()->assign('error_repeat', $error_repeat);
                     $error_step2 = true;
                 }
                 // Check if password is secure enough
                 $password_ok = sUserMgr()->verifyPasswordStrength($user_password);
                 if (!$password_ok) {
                     $error_chars = true;
                     sSmarty()->assign('error_chars', $error_chars);
                     $error_step2 = true;
                 }
                 if (!$error_step2) {
                     sUserMgr()->impersonate(sUserMgr()->getAdministratorID());
                     $user = sUserMgr()->getUser($user_info['ID']);
                     $user->setPassword($user_password);
                     $user->removeToken();
                     sUserMgr()->unimpersonate();
                 } else {
                     sSmarty()->assign('error_step2', $error_step2);
                 }
             } else {
                 $error_step2 = true;
                 sSmarty()->assign('error_step2', $error_step2);
             }
         }
     }
     return true;
 }