/** * Заполнение обязательных полей после регистрации через API мобильного приложения. * * @param array $aParams массив входящих данных * @return bool true - успех, false - провал */ public function actionSaveInfoMobile($aParams = array()) { $this->setFieldInfo('uname', __paramValue('string', iconv('utf-8', 'cp1251', $aParams['first_name']))); $this->setFieldInfo('usurname', __paramValue('string', iconv('utf-8', 'cp1251', $aParams['last_name']))); $this->setFieldInfo('birthday', __paramValue('string', $aParams['birthday'])); $this->setFieldInfo('country', __paramValue('int', $aParams['country_id'])); $this->setFieldInfo('city', __paramValue('int', $aParams['city_id'])); $this->setFieldInfo('info_for_reg', array('birthday' => 0, 'sex' => 0, 'country' => 0, 'city' => 0)); $gender = __paramValue('int', $aParams['gender']); $this->setFieldInfo('sex', $gender == 1 ? 't' : ($gender == 2 ? 'f' : NULL)); $this->checkedFields(); if (date('Y-m-d', strtotime($aParams['birthday'])) != $aParams['birthday']) { $this->error['birthday'] = 'Укажите некорректную дату дня рождения'; $this->errno['birthday'] = 2; } if (empty($this->error)) { if (!is_emp()) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer.php'; $user = new freelancer(); } else { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/employer.php'; $user = new employer(); } $user->info_for_reg = serialize($this->info_for_reg); $user->uname = $this->uname; $user->usurname = $this->usurname; $user->sex = $this->sex; $user->birthday = $this->birthday; $user->country = $this->country; $user->city = $this->city; if (!is_emp()) { $spec = intvalPgSql($aParams['prof_id']); if ($spec) { require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php"; $or_spec = professions::GetProfessionOrigin($spec); $spec_mod = professions::getLastModifiedSpec($_SESSION['uid']); if (!is_pro() && $spec_mod['days'] > 0) { $this->error['spec'] = 'Не прошло 30 дней с момента последней смены специализации'; $this->errno['spec'] = 2; } else { $user->spec = $spec; $user->spec_orig = $or_spec; professions::setLastModifiedSpec($_SESSION['uid'], $spec); } } else { $this->error['spec'] = 'Не указан параметр ID профессии'; $this->errno['spec'] = 1; } } if (empty($this->error)) { if ($sError = $user->Update($_SESSION['uid'], $res)) { $this->error['save'] = $sError; } else { if (!is_emp()) { $_SESSION['specs'] = $user->GetAllSpecs($_SESSION['uid']); } } } if (empty($this->error['save'])) { $_SESSION['check_user_access'] = true; } } return empty($this->error); }