Ejemplo n.º 1
0
function smarty_init()
{
    $smarty = new Smarty();
    $smarty->template_dir = util_getRootPath() . 'templates';
    $smarty->compile_dir = util_getRootPath() . 'templates_c';
    $smarty->assign('wwwRoot', util_getWwwRoot());
    $smarty->assign('cssRoot', util_getCssRoot());
    $smarty->assign('imgRoot', util_getImgRoot());
    $smarty->assign('sources', Model::factory('Source')->order_by_desc('isOfficial')->order_by_asc('displayOrder')->find_many());
    $smarty->assign('sUser', session_getUser());
    $smarty->assign('is_mirror', pref_isMirror());
    $smarty->assign('nick', session_getUserNick());
    $smarty->assign('contact_email', pref_getContactEmail());
    $smarty->assign('hostedBy', pref_getHostedBy());
    $smarty->assign('currentYear', date("Y"));
    $smarty->assign('bannerType', pref_getServerPreference('bannerType'));
    $smarty->assign('developmentMode', pref_getServerPreference('developmentMode'));
    $smarty->assign('isMobile', util_isMobile());
    smarty_registerFunction($smarty, 'getDebugInfo', 'smarty_function_getDebugInfo');
    $smarty->assign('GLOBALS', $GLOBALS);
    $GLOBALS['smarty_theSmarty'] = $smarty;
}
Ejemplo n.º 2
0
$identity = util_getRequestParameter('identity');
$email = util_getRequestParameter('email');
smarty_assign('identity', $identity);
smarty_assign('email', $email);
smarty_assign('page_title', 'Parolă uitată');
smarty_assign('suggestHiddenSearchForm', true);
if (!$submitButton) {
    smarty_displayCommonPageWithSkin('auth/parola-uitata.ihtml');
} else {
    if (!$email) {
        FlashMessage::add('Trebuie să introduceți o adresă de e-mail.');
    } else {
        $user = User::get_by_email($email);
        if ($user) {
            log_userLog("Password recovery requested for {$email} from " . $_SERVER['REMOTE_ADDR']);
            // Create the token
            $pt = Model::factory('PasswordToken')->create();
            $pt->userId = $user->id;
            $pt->token = util_randomCapitalLetterString(20);
            $pt->save();
            // Send email
            smarty_assign('homePage', util_getFullServerUrl());
            smarty_assign('token', $pt->token);
            $body = smarty_fetch('email/resetPassword.ihtml');
            $ourEmail = pref_getContactEmail();
            $result = mail($email, "Schimbarea parolei pentru DEX online", $body, "From: DEX online <{$ourEmail}>\r\nReply-To: {$ourEmail}");
            // Display a confirmation even for incorrect addresses.
            smarty_displayCommonPageWithSkin('auth/passwordRecoveryEmailSent.ihtml');
        }
    }
}