Beispiel #1
0
 /**
  * Заполнение обязательных полей после регистрации через 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);
 }
Beispiel #2
0
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
     $obj_prof = new professions();
     $error_prof .= $obj_prof->UpdateProfDesc($uid, $_POST['prof_id'], str_replace(" ", "", $_POST['prof_cost_from']), str_replace(" ", "", $_POST['prof_cost_to']), str_replace(" ", "", $_POST['prof_cost_hour']), str_replace(" ", "", $_POST['prof_cost_1000']), $_POST['prof_cost_type'], $_POST['prof_cost_type_hour'], $_POST['prof_time_type'], $_POST['prof_time_from'], $_POST['prof_time_to'], $_POST['prof_text'], $errorProfText);
     if (!$error_prof) {
         $info_prof = "Изменения внесены";
     }
     $saved_prof_id = intval($_POST['prof_id']);
     break;
 case "spec_change":
     $spec = trim($_POST['spec']);
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
     $or_spec = professions::GetProfessionOrigin($spec);
     $frl = new freelancer();
     $frl->spec = $spec;
     $frl->spec_orig = $or_spec;
     professions::setLastModifiedSpec($uid, $spec);
     $error .= $frl->Update($uid, $res);
     $_SESSION['specs'] = $frl->GetAllSpecs($uid);
     break;
 case "save_spec_add":
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
     if (professions::UpdateProfsAddSpec($uid, __paramInit('int', NULL, 'oldprof_id'), __paramInit('int', NULL, 'prof_id'), __paramInit('int', NULL, 'paid_id'))) {
         $_SESSION['specs'] = freelancer::GetAllSpecs($uid);
         header("Location: /users/{$login}/setup/specaddsetup/");
         exit;
     }
     break;
 case "portf_choise":
     unset($_SESSION['text_spec']);
     $params = $_POST['prof'];
     if (is_array($params)) {
Beispiel #3
0
 /**
  * Если у пользователя нет указанной специализации, то добавить ее
  * Предпочтительно в качестве основной
  * 
  * @param type $user_id ИД польователя
  * @param type $prof_id ИД специализации
  */
 private function addProfToUserIfNeed($user_id, $prof_id)
 {
     $add_key = self::needAddProf($user_id, $prof_id);
     if ($add_key == 1) {
         //Добавляем доп.специализацию
         professions::UpdateProfsAddSpec($user_id, 0, $prof_id, 0);
     } elseif ($add_key == 2) {
         //Устанавливаем основную специализацию
         $frl = new freelancer();
         $frl->spec = $prof_id;
         $frl->spec_orig = $prof_id;
         professions::setLastModifiedSpec($user_id, $prof_id);
         $frl->Update($user_id, $res);
     }
 }
 /**
  * Создает запись в таблице
  * @return type
  */
 public function create()
 {
     if ($this->bind_data['is_spec']) {
         $add_prof = $this->needAddProf($this->bind_data['user_id'], $this->bind_data['prof_id']);
         if ($add_prof == 1) {
             //Добавляем доп.специализацию
             professions::UpdateProfsAddSpec($this->bind_data['user_id'], 0, $this->bind_data['prof_id'], 0);
         } elseif ($add_prof == 2) {
             //Устанавливаем основную специализацию
             $frl = new freelancer();
             $frl->spec = $this->bind_data['prof_id'];
             $frl->spec_orig = $this->bind_data['prof_id'];
             professions::setLastModifiedSpec($this->bind_data['user_id'], $this->bind_data['prof_id']);
             $frl->Update($this->bind_data['user_id'], $res);
         }
     }
     $ok = $this->db->insert($this->TABLE, $this->bind_data);
     if ($ok) {
         freelancer::clearCacheFromProfIdNow($this->bind_data['prof_id'], $this->bind_data['is_spec']);
         return true;
     }
     return false;
 }
Beispiel #5
0
$profession_id = __paramInit('int', null, 'profession', null);
if ($profession_id !== null) {
    $redirect_to = '/projects/';
    if ($profession_id > 0) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects_filter.php';
        //Создаем фильтр для проектов
        $f_category[1][$profession_id] = 1;
        $prj_filter = new projects_filters();
        $prj_filter->Save($uid, '', '', 2, true, $f_category, '', '', '', false, $rerror, $error, 0, 0, false, false, false, false, false, false, false, false, 4, false, false);
        setcookie('new_pf0', 1, time() + 60 * 60 * 24 * 30, '/');
        //Сохраняем как основную специализацию
        $or_spec = professions::GetProfessionOrigin($profession_id);
        $frl = new freelancer();
        $frl->spec = $profession_id;
        $frl->spec_orig = $or_spec;
        professions::setLastModifiedSpec($uid, $profession_id);
        $frl->Update($uid, $error);
        $_SESSION['specs'] = $frl->GetAllSpecs($uid);
    }
    //Если есть редирект то он приоритетней
    if ($_SESSION['ref_uri']) {
        $redirect_to = urldecode($_SESSION['ref_uri']);
    }
    $_user_action = isset($_REQUEST['user_action']) && $_REQUEST['user_action'] ? substr(htmlspecialchars($_REQUEST['user_action']), 0, 25) : '';
    $_user_action = trim($_user_action);
    switch ($_user_action) {
        case 'tu':
            if (isset($_SESSION['tu_ref_uri'])) {
                $redirect_to = HTTP_PFX . $_SERVER['HTTP_HOST'] . urldecode($_SESSION['tu_ref_uri']);
            }
            break;