Esempio n. 1
0
function authCodeSMS($code, $page = 'finance')
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sms_gate_a1.php';
    $objResponse = new xajaxResponse();
    $uid = get_uid();
    $reqv = sbr_meta::getUserReqvs($uid);
    $ureqv = $reqv[$reqv['form_type']];
    $sms_gate = new sms_gate_a1($ureqv['mob_phone']);
    $info = $sms_gate->getInfoSend();
    if ($info['data'] == $code && $info['data'] != null) {
        sbr_meta::authMobPhone($uid);
        $sms_gate->setIsAuth($info['id'], true);
        // Обновляем флаг
        switch ($page) {
            case 'finance':
                $html = '<div class="b-layout__txt b-layout__txt_padtop_7 b-layout__txt_nowrap b-layout__txt_inline-block"><span class="b-icon b-icon_sbr_gok b-icon_top_2"></span>Активирован</div>';
                $objResponse->script("\$('auth_popup').set('html', ''); \$('auth_popup').hide(); \$\$('.c_sms_main').set('html', '{$html}');");
                break;
            case 'safety':
                $html = '&#160;&#160;<div class="b-layout__txt b-layout__txt_inline-block"><a class="b-layout__link b-layout__link_fontsize_11 b-layout__link_bordbot_dot_0f71c8" href="javascript:void(0)">Отвязать</a></div>';
                $objResponse->script("\$('auth_popup').set('html', ''); \n                                      \$('auth_popup').hide(); \n                                      \$\$('.c_sms_main').set('html', '{$html}');\n                                      \$\$('.safety_phone_checks').each( function(el) {\n                                          \$(el).getElements('input[type=checkbox]').set('disabled', false);\n                                      });\n                                      \$('safety_mob_phone').addClass('b-combo__input_disabled');\n                                      \$('safety_mob_phone').getElement('input').set('disabled', true);\n                                      \$('safety_status').set('html', 'включена');\n                                      \$('safety_status').removeClass('b-layout__txt_color_c10600').addClass('b-layout__txt_color_6bb336');\n                                      bindLinkUnativateAuth('{$uid}');\n                                      ");
                break;
        }
    } else {
        $objResponse->script("\$('a_sms_act').getElement('.b-button__txt').removeClass('b-button__txt_hide');\n                              \$('a_sms_act').getElement('.b-button__load').hide();\n                              \$('a_sms_act').addClass('b-button_rectangle_color_disable');\n                              \$('a_sms_resend').set('text', 'Выслать СМС еще раз');");
        $objResponse->script("\$('sms_error').removeClass('b-layout__txt_hide'); \$('i_sms_code').getParent().addClass('b-combo__input_error');");
    }
    return $objResponse;
}