Файл: join.php
Строк: 107
<?php
define('DIR', dirname(__FILE__));
include_once(DIR.'/core/Base.php');
class Join extends Base 
{
    protected function _before() {    
        parent::_before();
        $this->_al = true;
    }
    protected function act_index() {    
        Cur::$set['js'] = $this->view('join/js/js_join_index.js');
        Cur::$set['title'] = '';
        $this->setVarsMainTempl(array(
            'content' => $this->view('join/v_join_index.php')
      ));
    }
    protected function act_box() {    
        $this->setVarsMainTempl(array(
            'content' => $this->view('join/v_join_box.php'),
            'js' => $this->view('join/js/js_join_box.js'),
            'static' => 'join.css,page.css,index.css'
      ));
    }
    protected function act_start() {
        if(empty($_POST['fname']) || empty($_POST['lname'])) {
            Cur::$set['title'] = '<!int>1';
            $content = Lang::get('register_no_name');
        } else {
            if(!empty($_POST['sex'])) {
                $okReg = $this->mUser->register($_POST['fname'], $_POST['lname'], $_POST['sex']);
                if($okReg) {
                    Cur::$set['ajxCode'] = 4;
                    Cur::$set['title'] = '/join?act=finish';
                    Cur::$set['contType'] = 'bool';
                    $content = 1;
                }
            } else {
                Cur::$set['title'] = '<!int>3';
                $content = '<!json>[[1,"'.Lang::get('sex_fm').'"],[2,"'.Lang::get('sex_m').'"]]';
            }
        }
        
        $this->setVarsMainTempl(array(
            'content' => $content
      ));
    }
    
    protected function act_phone() {
        if(empty($_POST['phone']) || empty($_POST['email'])) {
            Cur::$set['ajxCode'] = 8;
            Cur::$set['title'] = Lang::get('register_incorrect_phone');
        } else {
            $content = '<!bool>';
            $js = '<!int>1';
        }
        $this->setVarsMainTempl(array(
            'content' => $content,
            'js' => $js
      ));
    }
    protected function act_finish() {
        if(empty($_SESSION['reg'])) {
            Request::redirect('/');
            die();
        }
        Cur::$set['js'] = $this->view('join/js/js_join_finish.js');
        Cur::$set['title'] = 'Register finish';
        Cur::$set['static'][] = 'join.css';
        Cur::$set['static'][] .= 'join.js';
        Cur::$set['static'][] .= 'tooltips.css';
        Cur::$set['static'][] .= 'tooltips.js';
        $this->setVarsMainTempl(array(
            'content' => $this->view('join/v_join_finish.php')
      ));
    }
    protected function act_done() {
        if($this->mUser->registerFinish($_POST['pass'], $_POST['email'], $_POST['phone'])) {
            $content = 'ok';
        } else {
            Cur::$set['ajxCode'] = 8;
            $content = 'error registration';
        }
        $this->setVarsMainTempl(array(
            'content' => $content
      ));
    }
} Loader::init(__FILE__);