Пример #1
0
function _xConfirmShow()
{
    global $t, $C;
    require_once 'textdb.php';
    $db = new RegisterConfirmsDB();
    $db->DeleteExpired();
    $confirm = $db->Retrieve($_REQUEST['id']);
    require_once 'validator.php';
    $v =& Validator::Get();
    $v->Register(empty($confirm), VT_IS_FALSE, 'Invalid or expired confirmation code');
    if (!$v->Validate()) {
        $t->Assign('g_invalid_confirm', true);
    } else {
        $db->Delete($_REQUEST['id']);
        $defaults = unserialize(file_get_contents(FILE_NEW_TRADE_DEFAULTS));
        require_once 'dirdb.php';
        $password = get_random_password();
        $db = new TradeDB();
        $trade = $db->Update($confirm['domain'], array('status' => $defaults['status'], 'timestamp_autostop' => time(), 'password' => sha1($password)));
        $trade['password'] = $password;
        $t->AssignByRef('g_trade', $trade);
        require_once 'mailer.php';
        if ($C['flag_register_email_user'] && !string_is_empty($trade['email'])) {
            $m = new Mailer();
            $m->Mail('email-register-complete.tpl', $t, $trade['email'], $trade['email']);
        }
        if ($C['flag_register_email_admin']) {
            $m = new Mailer();
            $m->Mail('email-register-admin.tpl', $t, $C['email_address'], $C['email_name']);
        }
    }
    $t->Display('register-confirm.tpl');
}