input = $CI->input; $this->session = $CI->session; } } array('title' => 'Не активирован','bgcolor' => 'eee'), 'active' => array('title' => 'Активный', 'bgcolor' => 'cfc'), 'blocked' => array('title' => 'Заблокирован','bgcolor' => 'fcc') ); function __construct() { parent::__construct(); } function getArrStatus() { return $this->arr_status; } function setAttrFromRow($row){ $this->id = @$row['id']; $this->master_id = @$row['master_id']; $this->master_referer = @$row['master_referer']; $this->login = @$row['login']; $this->password = @$row['password']; $this->name = @$row['name']; $this->surname = @$row['surname']; $this->email = @$row['email']; $this->icq = @$row['icq']; $this->reg_ip = @$row['reg_ip']; $this->last_ip = @$row['last_ip']; $this->reg_time = @$row['reg_time']; $this->last_active = @$row['last_active']; $this->restore_time = @$row['restore_time']; //$this->balance = @$row['balance']; $this->status = @$row['status']; $this->lang = @$row['lang']; $this->country_id = @$row['country_id']; $this->is_agree = @$row['is_agree']; $this->trust_status = @$row['trust_status']; //$this->block1_hide = @$row['block1_hide']; //$this->block2_hide = @$row['block2_hide']; //$this->block3_hide = @$row['block3_hide']; $this->sent_rec_email = @$row['sent_rec_email']; $this->sent_rec_sms = @$row['sent_rec_sms']; $this->can_frost = @$row['can_frost']; } function setPaymentAttt(){ $RevenueStatDayDB = new RevenueStatDayDB(); $RevenueStatDayDB->Item->user_id = $this->id; $RevenueStatDayDB->fetchTotalSumForUser(); $this->total_revenue = floatval($RevenueStatDayDB->Item->revenue + $RevenueStatDayDB->Item->ref_revenue); $PaymentDB = new PaymentDB(); $PaymentDB->Item->user_id = $this->id; $PaymentDB->fetchSumCompleteForUser(); $this->compltete_payment = floatval($PaymentDB->Item->total_revenue); $PaymentDB->fetchSumNewForUser(); $this->new_payment = floatval($PaymentDB->Item->total_revenue); $PaymentDB->fetchLastPaymentForUser(); $this->last_payment = $PaymentDB->Item->resolve_period; } function setAttrFromRegisterInput(){ $in = $this->input; $this->type = $in->post('userType'); $this->login = $in->post('login'); $this->password = $in->post('psw'); $this->email = $in->post('email'); $this->offer = $in->post('offer'); $this->email = trim($this->email); if(strlen($in->post('userType')) <= 0) throw new MyException(sprintf("Выберите \"%s\"", 'Тип пользователя')); if(strlen($in->post('login')) <= 0) throw new MyException(sprintf("Поле \"%s\" не может быть пустым", 'Логин')); if(strlen($in->post('email')) <= 0) throw new MyException(sprintf("Поле \"%s\" не может быть пустым", 'E-mail')); if(strlen($in->post('psw')) <= 0) throw new MyException(sprintf("Поле “%s” не может быть пустым", 'Пароль')); if($in->post('psw') != $in->post('psw2')) throw new MyException(sprintf("Пароли не совпадают")); if($in->post('offer') == 0) throw new MyException(sprintf("Необходимо принять Пользовательское соглашение")); } function setAttrFromRegisterApi(){ $this->type = $_POST['type']; $this->login = $_POST['login']; $this->password = $_POST['psw']; $this->email = $_POST['email']; $this->offer = $_POST['offer']; } function setAttrFromLoginInput(){ $in = $this->input; $this->login = $in->post('login'); $this->password = $in->post('psw'); } function setAttrFromLoginApi(){ $this->login = $_POST['login']; $this->password = $_POST['password']; } function setAttrFromUpdateProfileInput(){ $in = $this->input; $this->name = $in->post('name'); $this->surname = $in->post('sname'); //$this->email = $in->post('email'); //$this->icq = $in->post('icq'); //$this->country_id=$in->post('country'); $this->city_id=$in->post('city'); } function setAttrFromUpdateProfileInputApi($name, $sname, $city_id){ $this->name = $name; $this->surname = $sname; $this->city_id = $city_id; } function setAttrFromUpdatePasswordInput(){ $in = $this->input; if(strlen($in->post('psw1')) <= 0) throw new MyException(sprintf("The field “%s” can not be null", 'Password')); if($in->post('psw1') != $in->post('psw2')) throw new MyException(sprintf("Passwords do not match")); $this->password = $in->post('psw1'); } function setAttrFromUpdatePasswordInputApi($user_psw_old, $psw_encode, $psw1, $psw2){ if($user_psw_old !== $psw_encode) die( json_encode([ 'type' => 'error', 'data' => 'Старый пароль не правильный!', 'code' => 9 ])); if(strlen($psw1) <= 0) die( json_encode([ 'type' => 'error', 'data' => 'Пароль не может быть равен нулю!', 'code' => 10 ])); if($psw1 != $psw2) die(json_encode([ 'type' => 'error', 'data' => 'Пароли не совпадают!', 'code' => 11 ])); $this->password = $psw1; } function getEncodePassword(){ $Utils = new Utils(); return $Utils->encode($this->password); } function getEncodePasswordApi($psw){ $Utils = new Utils(); return $Utils->encode($psw); } }