public function completeData($type_role = 1) { if ($this->isDisable()) { header("Location: /wizard/registration/?step=1"); exit; } require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/employer.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/freelancer.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/city.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/country.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php"; $themes_blogs = blogs::getRandomThemes(5); $themes_commune = commune::getRandomCommunes(3); $month = array('1' => 'января', '2' => 'февраля', '3' => 'марта', '4' => 'апреля', '5' => 'мая', '6' => 'июня', '7' => 'июля', '8' => 'августа', '9' => 'сентября', '10' => 'октября', '11' => 'ноября', '12' => 'декабря'); if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) { $user = new employer(); $checkPRO = $this->checkWizardPRO(array(step_employer::OP_CODE_PRO)); $pro_emp = $checkPRO['id'] > 0 ? 1 : 0; if ($pro_emp) { $week_pro = round($checkPRO['ammount'] / 10); } } else { $user = new freelancer(); $checkPRO = $this->checkWizardPRO(step_freelancer::getOperationCodePRO()); $pro_frl = $checkPRO['id'] > 0 ? 1 : 0; if ($pro_frl) { $op_code = $checkPRO['op_code']; } } $user->GetUserByUID(wizard::getUserIDReg()); $info_for_reg = unserialize($user->info_for_reg); $uname = $user->uname; $usurname = $user->usurname; $sex = $user->sex == 't' ? 1 : ($user->sex == 'f' ? 0 : -1); $birthday = strtotime($user->birthday); if ($birthday) { $bday = date('d', $birthday); $bmonth = (int) date('m', $birthday); $bmonth_value = $month[$bmonth]; $byear = date('Y', $birthday); } else { $bday = ''; $bmonth = (int) date('m', $birthday); $bmonth_value = $month[$bmonth]; $byear = ''; } $city = $user->city; if ($city) { $city_value = city::GetCityName($city); } $country = $user->country; if ($country) { $country_value = country::GetCountryName($country); } if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) { $company = $user->compname; $about_company = $user->company; $logo_name = $user->logo; $dir = "users/" . substr($user->login, 0, 2) . "/" . $user->login . "/logo/"; $logo_path = WDCPREFIX . "/" . $dir . $user->logo; } $info['site'] = $this->loadMultiVal('site', 'site', $user); $info['email'] = $this->loadMultiVal('second_email', 'email', $user); $info['phone'] = $this->loadMultiVal('phone', 'phone', $user); $info['icq'] = $this->loadMultiVal('icq', 'icq', $user); $info['skype'] = $this->loadMultiVal('skype', 'skype', $user); $info['jabber'] = $this->loadMultiVal('jabber', 'jabber', $user); $info['lj'] = $this->loadMultiVal('ljuser', 'lj', $user); $action = __paramInit('string', null, 'action'); if ($action == 'upd_info') { $info_for_reg = $_POST['info_for_reg']; if ($info_for_reg['email_0'] !== null) { $info_for_reg['second_email'] = $info_for_reg['email_0']; unset($info_for_reg['email_0']); } if ($info_for_reg['phone_0'] !== null) { $info_for_reg['phone'] = $info_for_reg['phone_0']; unset($info_for_reg['phone_0']); } if ($info_for_reg['site_0'] !== null) { $info_for_reg['site'] = $info_for_reg['site_0']; unset($info_for_reg['site_0']); } if ($info_for_reg['lj_0'] !== null) { $info_for_reg['ljuser'] = $info_for_reg['lj_0']; unset($info_for_reg['lj_0']); } if ($info_for_reg['jabber_0'] !== null) { $info_for_reg['jabber'] = $info_for_reg['jabber_0']; unset($info_for_reg['jabber_0']); } if ($info_for_reg['skype_0'] !== null) { $info_for_reg['skype'] = $info_for_reg['skype_0']; unset($info_for_reg['skype_0']); } if ($info_for_reg['icq_0'] !== null) { $info_for_reg['icq'] = $info_for_reg['icq_0']; unset($info_for_reg['icq_0']); } if ($info_for_reg['compname'] !== null) { $info_for_reg['company'] = $info_for_reg['compname']; unset($info_for_reg['compname']); } $info_for_reg = array_map('intval', $info_for_reg); $user->info_for_reg = serialize($info_for_reg); $uname = __paramInit('string', null, 'uname', null, 21); $usurname = __paramInit('string', null, 'usurname', null, 21); if ($uname == '') { $error['uname'] = "Поле заполнено некорректно"; } if ($usurname == '') { $error['usurname'] = "Поле заполнено некорректно"; } if (!preg_match("/^[-a-zA-Zа-яёА-ЯЁ]+\$/", $uname)) { $error['uname'] = "Поле заполнено некорректно"; } else { $user->uname = $uname; } if (!preg_match("/^[-a-zA-Zа-яёА-ЯЁ]+\$/", $usurname)) { $error['usurname'] = "Поле заполнено некорректно"; } else { $user->usurname = $usurname; } $sex = __paramInit('int', null, 'sex', 1); // по умолчанию мужской пол $user->sex = $sex == 1 ? 't' : 'f'; $bday = __paramInit('int', null, 'bday', null); $bmonth = __paramInit('int', null, 'bmonth_db_id', 1); $bmonth_value = __paramInit('string', null, 'bmonth'); $byear = __paramInit('int', null, 'byear', null); if ($bday != null && $byear != null) { if (!is_numeric($bday) || !is_numeric($byear) || !checkdate($bmonth, $bday, $byear) || $byear < 1945 || $byear > date('Y')) { $error['birthday'] = "Поле заполнено некорректно"; } else { $user->birthday = dateFormat("Y-m-d", $byear . "-" . $bmonth . "-" . $bday); } } else { $user->birthday = "1910-01-01"; } if (!$error['birthday'] && $user->birthday && date("Y", strtotime($user->birthday)) >= date("Y")) { $error['birthday'] = "Поле заполнено некорректно"; } $city = __paramInit('int', null, 'city_db_id', 0); $city_value = __paramInit('string', null, 'city', false); $country = __paramInit('int', null, 'country_db_id', 0); $country_value = __paramInit('string', null, 'country', false); if ($city == 0 && strlen($city_value) != 0) { $error['city'] = 'Поле заполнено некорректно'; } if ($country == 0 && strlen($country_value) != 0) { $error['country'] = 'Поле заполнено некорректно'; } $user->country = $country; $user->city = $city; $company = __paramInit('string', null, 'company') ? substr(__paramInit('string', null, 'company'), 0, 64) : ''; $about_company = __paramInit('string', null, 'about_company'); $user->compname = $company; if (strlen($about_company) > 500) { $error['company'] = "Количество знаков в тексте о компании превышает допустимое значение"; } else { $user->company = $about_company; } $logo_id = __paramInit('int', null, 'logo_company'); $logo_name = __paramInit('string', null, 'logo_name'); if ($logo_name) { $user->logo = $logo_name; $user->Update(wizard::getUserIDReg(), $res); } $info['site'] = $this->initMultiVal('site'); $info['email'] = $this->initMultiVal('email'); $info['phone'] = $this->initMultiVal('phone'); $info['icq'] = $this->initMultiVal('icq'); $info['skype'] = $this->initMultiVal('skype'); $info['jabber'] = $this->initMultiVal('jabber'); $info['lj'] = $this->initMultiVal('lj'); if (!empty($info['site'])) { foreach ($info['site'] as $i => $value) { $name = 'site' . ($i != 0 ? "_{$i}" : ""); if (!url_validate(addhttp($value), true) && trimhttp($value) != '') { $error[$name] = "Поле заполнено некорректно"; } else { $user->{$name} = addhttp($value); } } } if (!empty($info['email'])) { foreach ($info['email'] as $i => $value) { if ($i == 0) { $name_save = "second_email"; } else { $name_save = "email_{$i}"; } $name = 'email' . ($i != 0 ? "_{$i}" : ""); if (!is_email($value) && $value != '') { $error[$name] = "Поле заполнено некорректно"; } else { $user->{$name_save} = $value; } } } if (!empty($info['phone'])) { foreach ($info['phone'] as $i => $value) { $name = 'phone' . ($i != 0 ? "_{$i}" : ""); if (!preg_match("/^[-+0-9)( #]*\$/", $value)) { $error[$name] = "Поле заполнено некорректно"; } else { $user->{$name} = $value; } } } if (!empty($info['icq'])) { foreach ($info['icq'] as $i => $value) { $name = 'icq' . ($i != 0 ? "_{$i}" : ""); if (!preg_match("/^[-0-9\\s]*\$/", $value) && !is_email($value)) { $error[$name] = "Поле заполнено некорректно"; } else { $user->{$name} = $value; } } } if (!empty($info['skype'])) { foreach ($info['skype'] as $i => $value) { $name = 'skype' . ($i != 0 ? "_{$i}" : ""); $user->{$name} = $value; } } if (!empty($info['jabber'])) { foreach ($info['jabber'] as $i => $value) { $name = 'jabber' . ($i != 0 ? "_{$i}" : ""); if (strlen($value) > 255) { $error[$name] = "Количество знаков превышает допустимое значение"; } else { $user->{$name} = $value; } } } if (!empty($info['lj'])) { foreach ($info['lj'] as $i => $value) { if ($i == 0) { $name_save = "ljuser"; } else { $name_save = "lj_{$i}"; } $name = 'lj' . ($i != 0 ? "_{$i}" : ""); if (!preg_match("/^[a-zA-Z0-9_-]*\$/", $value)) { $error[$name] = "Поле заполнено некорректно"; } else { $user->{$name_save} = $value; } } } if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) { $pro_emp = __paramInit('int', null, 'pro-emp', false); if ($pro_emp) { $week_pro = round(__paramInit('int', null, 'week_pro', 0)); } } else { $ammount = 0; $pro_frl = __paramInit('int', null, 'pro-frl', false); if ($pro_frl) { $pro = __paramInit('string', null, 'pro', -1); switch ($pro) { case "1week": $op_code = 76; $ammount = 7; break; case "1": $op_code = 48; $ammount = 19; break; case "3": $op_code = 49; $ammount = 54; break; case "6": $op_code = 50; $ammount = 102; break; case "12": $op_code = 51; $ammount = 180; break; case "-1": default: $ammount = 0; break; } } } if (!$error && wizard::getUserIDReg()) { $error['save'] = $user->Update(wizard::getUserIDReg(), $res); if (!$error['save']) { if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) { $ammount = $week_pro * 10; if ($ammount > 0) { $checkPRO = $this->checkWizardPRO(step_employer::OP_CODE_PRO); if ($checkPRO['id'] > 0) { $update = array("ammount" => $ammount); wizard_billing::editPaidOption($update, $checkPRO['id']); } else { $insert = array("wiz_uid" => step_wizard::getWizardUserID(), "op_code" => step_employer::OP_CODE_PRO, "type" => 3, "ammount" => $ammount, "parent" => wizard::getUserIDReg()); wizard_billing::addPaidOption($insert); } } else { $sql = "DELETE FROM wizard_billing WHERE wiz_uid = ? AND op_code = ?"; $this->_db->query($sql, step_wizard::getWizardUserID(), step_employer::OP_CODE_PRO); } } else { // Чистим $sql = "DELETE FROM wizard_billing WHERE wiz_uid = ? AND op_code IN (?l)"; $this->_db->query($sql, step_wizard::getWizardUserID(), step_freelancer::getOperationCodePRO()); if ($ammount > 0) { $insert = array("wiz_uid" => step_wizard::getWizardUserID(), "op_code" => $op_code, "type" => 4, "ammount" => $ammount, "parent" => wizard::getUserIDReg()); wizard_billing::addPaidOption($insert); } } $this->parent->setCompliteStep(true); $this->parent->setNextStep($this->parent->getPosition() + 1); header("Location: /wizard/registration/"); exit; } } if ($logo_id > 0) { $file = new CFile($logo_id); $logo_path = WDCPREFIX . "/" . $file->path . $file->name; } } include $_SERVER['DOCUMENT_ROOT'] . "/wizard/registration/steps/tpl.step.info.php"; }
if (!($info_for_reg['country'] && !$uid) && $user->country) { ?> <div class="b-layout__hover_bg_f0ffdf b-layout_padlr_10 b-layout_pad_3"> <div class="b-layout__txt b-layout__txt_padleft_35 b-layout__txt_lineheight_1 b-layout__txt_padtop_1"> <span class="b-icon b-icon__cont b-icon__cont_map b-icon_margleft_-35"></span> <?php if ($info_for_reg['country'] && !$uid) { ?> <?php echo $reg_string; ?> <?php } elseif ($user->country) { ?> <?php echo country::GetCountryName($user->country); if ($user->city && !($info_for_reg['city'] && !$uid)) { ?> , <?php echo city::GetCityName($user->city); } ?> <?php } ?> </div> </div> <?php } ?>
</a><?php echo view_mark_user(array('login' => $dContent['login'], 'is_pro' => true, 'role' => $dContent['role'], 'is_team' => $dContent['is_team'])); ?>  <?php echo $dContent['completed_sbr_cnt'] ? view_sbr_shield() : ''; ?> </h4> <p>На сайте: <?php echo ElapsedMnths(strtotime($dContent['reg_date'])); ?> </p> <p> <?php if (!$info_for_reg['country'] || get_uid(false)) { if (intval($dContent['country']) != 0) { print country::GetCountryName($dContent['country']); if ($dContent['city'] && !$info_for_reg['city'] || get_uid(false)) { if (intval($dContent['city']) != 0) { print ", " . city::GetCityName($dContent['city']); } } } } //else ?> </p> </div> <?php if ($n == 3) { echo '<div style="clear:both;"> </div>'; $n = 0;
public function getInformationUser($uid = false) { require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/employer.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/freelancer.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/country.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/city.php"; if (!$uid) { $uid = $_SESSION['uid']; } if (is_emp()) { $user = new employer(); } else { $user = new freelancer(); } $user->GetUserByUID($uid); $this->setFieldInfo('uname', $user->uname); $this->setFieldInfo('usurname', $user->usurname); $this->setFieldInfo('birthday', $user->birthday); $this->setFieldInfo('country', $user->country); $this->setFieldInfo('country_name', country::GetCountryName($user->country)); $this->setFieldInfo('city', $user->city); $this->setFieldInfo('city_name', city::GetCityName($user->city)); $this->setFieldInfo('sex', $user->sex == 't' ? 1 : ($user->sex == 'f' ? 0 : -1)); $this->setFieldInfo('info_for_reg', unserialize($user->info_for_reg)); }
$content = "new/tpl.step_1.php"; break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case 0: default: header_location_exit('/public/?step=1&kind=1'); break; } // Все изменения $tmpPrj->_project переносим в переменную. $project = $tmpPrj->getProject(); if (trim($project['contacts']) != '') { $contacts = unserialize($project['contacts']) ? unserialize($project['contacts']) : $contacts; } if ($project['country']) { $location = country::GetCountryName($project['country']); if ($project['city']) { $location .= ': ' . city::GetCityName($project['city']); } $project['location'] = $location; } $prj_categories = $tmpPrj->getCategories(); if ($prj_categories) { foreach ($prj_categories as $ind => $category) { $prj_categories[$ind]['prof_name'] = $category['subcategory_id'] ? professions::GetProfNameWP($category['subcategory_id'], ': ', '', false) : professions::GetGroupName($category['category_id']); } } if ($step > 0) { $tmpPrj->fix(); } if (!$additional_header) {
/** * Заполняет значения в зависимости от услуги. * * @param array $tservice Массив с данными услуги * @param string $user Массив с данными пользователя */ public function initTServicesCard($tservice, $user) { $prof_id = $this->getRealProfId($tservice['category_id']); $this->seo_value = new SeoValues(); $this->seo_value->initCard($prof_id); $title50 = LenghtFormatEx(trim(strip_tags($tservice['title'])), 50); $title100 = LenghtFormatEx(trim(strip_tags($tservice['title'])), 100); //Получаем названия страны и города $country_name = $city_name = ''; if ($user->country > 0) { $country = new country(); $country_name = $country->GetCountryName($user->country); } if ($user->city > 0) { $city = new city(); $city_name = $city->GetCityName($user->city); } $fullname = trim("{$user->uname} {$user->usurname} [{$user->login}]"); $this->title = sprintf(SeoText::TUC_TITLE, $title50, $tservice['price'], $fullname, $country_name, $city_name); $this->description = sprintf(SeoText::TUC_DESC, $fullname, $title100); $this->keywords = sprintf(SeoText::TUC_KEY, $fullname, $this->seo_value->getTUTitle(1), $this->seo_value->getKeysString()); $this->image_name = $title50; $this->image_description = sprintf(SeoText::TUC_IMG_DESC, $title50, $this->seo_value->getKey(1)); $this->footer_text = sprintf(SeoText::TUC_TAGS, $this->seo_value->getTUTitle(1), $this->seo_value->getKeysString()); }
</div> </div> <div class="b-freelancer__txt b-freelancer__txt_fontsize_11 b-freelancer__txt_padbot_5"> <div class="b-freelancer__txt b-freelancer__txt_valign_top b-freelancer__txt_inline-block b-freelancer__txt_width_120 b-freelancer__txt_bordbot_dot_e5"> <span class="b-freelancer__txt b-freelancer__txt_top_3 b-freelancer__txt_bg_fff">На сайте</span> </div> <div class="b-freelancer__txt b-freelancer__txt_inline-block b-freelancer__txt_width_320 b-freelancer__txt_top_3"><?php echo ElapsedMnths(strtotime($offer['reg_date'])); ?> </div> </div> <?php if ($offer['country'] && !($info_for_reg['country'] && !get_uid(false))) { ?> <div class="b-freelancer__txt b-freelancer__txt_fontsize_11 b-freelancer__txt_padbot_5"> <div class="b-freelancer__txt b-freelancer__txt_valign_top b-freelancer__txt_inline-block b-freelancer__txt_width_120 b-freelancer__txt_bordbot_dot_e5"> <span class="b-freelancer__txt b-freelancer__txt_top_3 b-freelancer__txt_bg_fff">Местонахождение</span> </div> <div class="b-freelancer__txt b-freelancer__txt_inline-block b-freelancer__txt_width_320 b-freelancer__txt_top_3"><?php echo country::GetCountryName($offer['country']); if ($offer['city'] && !($info_for_reg['city'] && !get_uid(false))) { print ", " . city::GetCityName($offer['city']); } ?> </div> </div> <?php } //if ?> <?php if ($user_ago && !($info_for_reg['birthday'] && !get_uid(false))) { ?> <div class="b-freelancer__txt b-freelancer__txt_fontsize_11 b-freelancer__txt_padbot_5"> <div class="b-freelancer__txt b-freelancer__txt_valign_top b-freelancer__txt_inline-block b-freelancer__txt_width_120 b-freelancer__txt_bordbot_dot_e5"> <span class="b-freelancer__txt b-freelancer__txt_top_3 b-freelancer__txt_bg_fff">Возраст</span> </div>
public function country($options) { extract($options); if (!$reqv || !$reqv['form_type']) { return false; } if ($reqv['country']) { return $reqv['country']; } elseif (in_array($reqv['rez_type'], array(sbr::RT_RU, sbr::RT_REFUGEE, sbr::RT_RESIDENCE))) { return 'Россия'; } else { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/country.php'; return country::GetCountryName($user_country_id); } }
/** * Обработка информации шага проекты. */ public function actionProjects() { $prj_id = $_SESSION['view_wizard_project']; if (!$prj_id) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/project_exrates.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/country.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php'; $prj_exrates = project_exrates::GetAll(); $categories = professions::GetAllGroupsLite(); $professions = professions::GetAllProfessions(); array_group($professions, 'groupid'); $professions[0] = array(); $addedPrc = is_pro() ? 0 : new_projects::PRICE_ADDED; $colorPrc = new_projects::PRICE_COLOR * ($addedPrc > 0 ? 1 : 0); $boldPrc = new_projects::PRICE_BOLD + $addedPrc; $logoPrc = new_projects::PRICE_LOGO + $addedPrc; $cTopPrice = new_projects::PRICE_CONTEST_TOP1DAY + $addedPrc; $pTopPrice = new_projects::PRICE_TOP1DAY + $addedPrc; $action = __paramInit('string', 'action', 'action', null); $attachedfiles_session = __paramInit('string', 'attachedfiles_session', 'attachedfiles_session', false); // проверяем есть ли уже созданый проект $projects = $this->getCreatedProjects(); $existPrjID = count($projects) > 0 ? $projects[0][id] : null; // выводим ранее сохраненный проект if ($action != 'create_project' && $existPrjID) { $data = $projects[0]; list($category, $subcategory) = explode('|', $data['categories']); $currency_name = $this->CURRENCY_TYPE[$data['currency']]; $priceby_name = $this->PRICEBY_TYPE[$data['priceby']]; $data['pro_only'] = $data['pro_only'] === 't'; $price = $data['payed']; $option = array(); $option['top'] = $data['top_count'] > 0; $option['top_count'] = $data['top_count']; $option['color'] = $data['is_color'] === 't'; $option['bold'] = $data['is_bold'] === 't'; $option['logo'] = $data['logo_id'] > 0; } elseif ($action == 'create_project') { // сохраняем новый проект или изменяем старый $in_office = __paramInit('int', null, 'in_office', 0); $type = __paramInit('string', null, 'kind'); if ($type == 'contest') { $data['kind'] = 7; $data['end_date'] = date('d-m-Y', strtotime(__paramInit('string', null, 'end_date_eng_format', 0))); $data['win_date'] = date('d-m-Y', strtotime(__paramInit('string', null, 'win_date_eng_format', 0))); } elseif ($in_office == 1) { $location = __paramInit('integer', null, 'location_column_id'); if ($location == 1) { $data['city'] = __paramInit('integer', null, 'location_db_id'); $data['country'] = country::getCountryByCityId($data['city']); } else { $data['country'] = __paramInit('integer', null, 'location_db_id'); } $data['kind'] = 4; } else { $data['kind'] = 1; } $data['name'] = __paramInit('string', null, 'name'); $data['descr'] = __paramInit('string', null, 'descr'); $category = __paramInit('int', null, 'r_category'); $subcategory = __paramInit('int', null, 'r_subcategory'); $agreement = __paramInit('int', null, 'agreement', 0); $data['pro_only'] = __paramInit('int', null, 'pro_only', 0) == 1 ? true : false; if ($agreement != 1) { $data['cost'] = __paramInit('int', null, 'cost', 0); $data['priceby'] = __paramInit('int', null, 'r_priceby', 0); $data['currency'] = __paramInit('int', null, 'r_currency', 0); $data['budget_type'] = __paramInit('int', null, 'budget_type', 0); } if (is_empty_html($data['descr'])) { $error['descr'] = 'Поле не заполнено'; } if (is_empty_html($data['name'])) { $error['name'] = 'Поле не заполнено'; } // проверяем длину необработанной строки, а иначе спецсимволы считаются как несколько символов if (strlen(stripslashes($_POST['name'])) > 60) { $error['name'] = 'Превышен лимит - 60 символов'; } if (!$category) { $error['category'] = 'Не выбран раздел'; } elseif ($subcategory) { $data['categories'] = "{$category}|{$subcategory}"; } else { $data['categories'] = $category; } if ($data['cost'] < 0) { $error['cost'] = 'Введите положительную сумму'; } if ($data['cost'] > 999999) { $error['cost'] = 'Слишком большая сумма'; } if ($data['cost'] > 0 && ($data['currency'] < 0 || $data['currency'] > 3)) { $error['currency'] = 'Валюта не определена'; } if ($data['cost'] > 0 && ($data['priceby'] < 1 || $data['priceby'] > 4)) { $error['priceby'] = 'Вид бюджета не определен'; } $descr_limit = projects::LIMIT_DESCR; if (strlen_real($data['descr']) > $descr_limit) { $error['descr'] = "Исчерпан лимит символов ({$descr_limit})"; } if ($data['kind'] == 7) { if (!preg_match("/^([0-9]{1,2})\\-([0-9]{1,2})\\-([0-9]{4})\$/", $data['end_date'], $o1) || !checkdate($o1[2], $o1[1], $o1[3])) { $error['end_date'] = 'Неправильная дата'; } if (!preg_match("/^([0-9]{1,2})\\-([0-9]{1,2})\\-([0-9]{4})\$/", $data['win_date'], $o2) || !checkdate($o2[2], $o2[1], $o2[3])) { $error['win_date'] = 'Неправильная дата'; } if (!$error['end_date'] && mktime(0, 0, 0, $o1[2], $o1[1], $o1[3]) <= mktime(0, 0, 0)) { $error['end_date'] = 'Дата окончания конкурса не может находиться в прошлом'; } if (!$error['win_date'] && mktime(0, 0, 0, $o2[2], $o2[1], $o2[3]) <= mktime(0, 0, 0, $o1[2], $o1[1], $o1[3])) { $error['win_date'] = 'Дата определения победителя должна быть больше даты окончания конкурса'; } } $option['top'] = __paramInit('int', null, 'option_top', 0); $option['top_count'] = __paramInit('int', null, 'option_top_count', 0); $option['color'] = __paramInit('int', null, 'option_color', 0); $option['bold'] = __paramInit('int', null, 'option_bold', 0); $option['logo'] = __paramInit('int', null, 'option_logo', 0); // логотип if ($option['logo'] == 1) { $data['logo_link'] = str_replace('http://', '', __paramInit('string', null, 'logo_link', null)); $data['logo_id'] = __paramInit('int', null, 'logo_id', null); // если выбрана опция "Логотип со ссылкой", то картинка должна быть обязательно if (!$data['logo_id']) { $error['logo_image'] = 'Отсутствует логотип'; } if ($data['logo_link'] === 'Адрес сайта') { $data['logo_link'] = ''; } if ($data['logo_link'] !== '' && !is_url($data['logo_link'])) { $error['logo_link'] = 'Не верно введен адрес'; } } else { $data['logo_id'] = null; } $price = 0; // закрепление на верху if ($option['top'] == 1 && $option['top_count'] > 0) { if ($option['top_count'] > 999) { $option['top_count'] = 999; } $price = (int) $option['top_count'] * ($data['kind'] == 7 ? $cTopPrice : $pTopPrice); $data['top_count'] = (int) $option['top_count']; $pay_option[] = array('wiz_uid' => $this->getWizardUserID(), 'op_code' => new_projects::OPCODE_PAYED, 'option' => self::PROJECT_OPTION_TOP, 'type' => $data['kind'] == 7 ? self::BILL_TYPE_CONTEST : self::BILL_TYPE_PROJECT, 'ammount' => $price); } else { $data['top_count'] = 0; } // выделение цветом if ($option['color'] == 1) { $price += (int) $colorPrc; $data['is_color'] = true; $pay_option[] = array('wiz_uid' => $this->getWizardUserID(), 'op_code' => new_projects::OPCODE_PAYED, 'option' => self::PROJECT_OPTION_COLOR, 'type' => $data['kind'] == 7 ? self::BILL_TYPE_CONTEST : self::BILL_TYPE_PROJECT, 'ammount' => $colorPrc); } else { $data['is_color'] = false; } // выделение жирным if ($option['bold'] == 1) { $price += (int) $boldPrc; $data['is_bold'] = true; $pay_option[] = array('wiz_uid' => $this->getWizardUserID(), 'op_code' => new_projects::OPCODE_PAYED, 'option' => self::PROJECT_OPTION_BOLD, 'type' => $data['kind'] == 7 ? self::BILL_TYPE_CONTEST : self::BILL_TYPE_PROJECT, 'ammount' => $boldPrc); } else { $data['is_bold'] = false; } if ($option['logo'] == 1) { $price += (int) $logoPrc; $pay_option[] = array('wiz_uid' => $this->getWizardUserID(), 'op_code' => new_projects::OPCODE_PAYED, 'option' => self::PROJECT_OPTION_LOGO, 'type' => $data['kind'] == 7 ? self::BILL_TYPE_CONTEST : self::BILL_TYPE_PROJECT, 'ammount' => $logoPrc); } if ($price > 0) { $data['payed'] = (int) $price; } if (!$error) { $data['wiz_uid'] = $this->getWizardUserID(); // если проект уже есть if ($existPrjID) { // то просто обновляем его $prj_id = $this->updateProject($data, $existPrjID); // и очищаем все платные опции для этого проекта wizard_billing::clearPayedOptions($prj_id); } else { $prj_id = $this->createProject($data); } if ($prj_id && $_POST['attachedfiles_session']) { $attachedfiles = new attachedfiles($_POST['attachedfiles_session']); $files = $attachedfiles->getFiles(array(1, 2, 3, 4)); $this->parent->addAttachedFiles($files, $prj_id); $attachedfiles->clear(); } if ($prj_id && $data['kind'] == 7) { $insert = array('wiz_uid' => $data['wiz_uid'], 'op_code' => new_projects::OPCODE_KON_NOPRO, 'type' => self::BILL_TYPE_CONTEST, 'ammount' => new_projects::getKonkursPrice(), 'parent' => $prj_id); wizard_billing::addPaidOption($insert); } if ($price > 0 && $prj_id) { foreach ($pay_option as $k => $opt) { $opt['parent'] = $prj_id; wizard_billing::addPaidOption($opt); } } if ($prj_id) { $_SESSION['view_wizard_project'] = $prj_id; header('Location: /wizard/registration/'); exit; } else { $error['project'] = 'Ошибка записи проекта'; } } $currency_name = __paramInit('string', null, 'currency'); $priceby_name = __paramInit('string', null, 'priceby'); } // Генерируем данные для вывода ошибок и заполнения полей $loc[] = country::GetCountryName($data['country']); if ($data['city']) { $loc[] = city::GetCityName($data['city']); } $location_name = implode(': ', $loc); $cat[] = professions::GetGroupName($category); if ($subcategory) { $cat[] = professions::GetProfName($subcategory); } $category_name = implode(': ', $cat); if ($data['logo_id']) { $file = new CFile($data['logo_id']); $logo_path = WDCPREFIX . '/' . $file->path . $file->name; } include $_SERVER['DOCUMENT_ROOT'] . '/wizard/registration/steps/tpl.step.project.php'; } else { $project = $this->getProjectById($prj_id); $attached = $this->getProjectAttach($prj_id); include $_SERVER['DOCUMENT_ROOT'] . '/wizard/registration/steps/tpl.step.project.view.php'; } }