Пример #1
0
 function indexAction()
 {
     $img_id = $_SESSION['imag_id'];
     $imgAccount = ImgAccountUtil::getImgAccountById($img_id, TRUE);
     $v_params['sys_name'] = SysPropertiesUtil::getPropertyValue("sys_name");
     $v_params['sys_slog'] = SysPropertiesUtil::getPropertyValue("sys_slog");
     if (NULL != $imgAccount) {
         $v_params['logined'] = LoginChecker::isLogined();
         $v_params['in_card_count'] = CardCounter::countGDSinCard();
         if ($v_params['logined'] == $img_id) {
             $v_params['mysc']['main'] = TRUE;
         }
         $v_params['show_addr'] = $imgAccount['show_address'];
         $imgAddress = ImgAddressUtil::getImgAddressById($imgAccount['img_address_id']);
         $v_params['addr'] = AddressUtil::makeAddressString($imgAddress);
         $v_params['show_phone'] = $imgAccount['show_phone'];
         $v_params['phone'] = $imgAccount['img_phone'];
         $v_params['show_skype'] = $imgAccount['show_skype'];
         $v_params['skype'] = $imgAccount['img_skype'];
         $v_params['show_icq'] = $imgAccount['show_icq'];
         $v_params['icq'] = $imgAccount['img_icq'];
         $v_params['img_name'] = $imgAccount['img_name'];
         $v_params['img_slog'] = $imgAccount['img_slog'];
         $v_params['img_all_gds_cats_href'] = "/" . IMAG_PREFIX . $img_id . "/" . IMAG_DIR;
         $v_params['img_gds_cats_HTML'] = ImgGdsCatUtil::createTreeHTML($imgAccount['id'], "/" . IMAG_PREFIX . $img_id . "/" . IMAG_DIR . "?" . PROD_CAT_PARAM_NAME . "=");
         $v_params['img_gds_breadcrump_HTML'] = ImgGdsCatUtil::createBreadcrumpHTML($imgAccount['id'], $_REQUEST[PROD_CAT_PARAM_NAME]);
         $v_params['img_all_blog_cats_href'] = "/" . IMAG_PREFIX . $img_id . "/" . BLOG_DIR;
         $v_params['img_blog_cats_HTML'] = ImgBlogCatUtil::createTreeHTML($imgAccount['id'], "/" . IMAG_PREFIX . $img_id . "/" . BLOG_DIR . "?" . ART_CAT_PARAM_NAME . "=");
         $count_img_gdss = ImgGdsUtil::countImgGdssByAccountId($imgAccount['id'], $_REQUEST[PROD_CAT_PARAM_NAME]);
         for ($i = 0; $i < $count_img_gdss / GDS_ON_PAGE; $i++) {
             $item['value'] = $i + 1;
             $item['current'] = $i == $_REQUEST[PAGE_PARAM_NAME];
             if ($_REQUEST[PROD_CAT_PARAM_NAME]) {
                 $item['url'] = "/" . IMAG_PREFIX . $img_id . "/?" . PROD_CAT_PARAM_NAME . "=" . $_REQUEST[PROD_CAT_PARAM_NAME] . "&" . PAGE_PARAM_NAME . "=" . $i;
             } else {
                 $item['url'] = "/" . IMAG_PREFIX . $img_id . "/?" . PAGE_PARAM_NAME . "=" . $i;
             }
             $v_params['paginator'][] = $item;
         }
         $v_params['img_gdss'] = ImgGdsUtil::getImgGdssByAccountId($imgAccount['id'], $_REQUEST[PROD_CAT_PARAM_NAME], GDS_ON_PAGE * $_REQUEST[PAGE_PARAM_NAME], GDS_ON_PAGE);
         $v_params['img_gdss_new'] = ImgGdsUtil::getNewImgGdssByAccountId($imgAccount['id'], $_REQUEST[PROD_CAT_PARAM_NAME], GDS_ADDITIONAN_ON_PAGE);
         $v_params['img_gdss_recom'] = ImgGdsUtil::getRecommendedImgGdssByAccountId($imgAccount['id'], $_REQUEST[PROD_CAT_PARAM_NAME], GDS_ADDITIONAN_ON_PAGE);
         $v_params['img_gds_link'] = "/" . IMAG_PREFIX . $img_id . "/" . PRODUCT_DIR . "?" . PRODUCT_PARAM_NAME . "=";
         Application::fastView('imags/img_main', $v_params);
     } else {
         Application::fastView('main/sys_error', $v_params);
     }
 }
Пример #2
0
 function settingsAction()
 {
     $img_id = $_SESSION['imag_id'];
     $imgAccount = ImgAccountUtil::getImgAccountById($img_id, TRUE);
     $v_params['sys_name'] = SysPropertiesUtil::getPropertyValue("sys_name");
     $v_params['sys_slog'] = SysPropertiesUtil::getPropertyValue("sys_slog");
     if (NULL != $imgAccount) {
         $v_params['logined'] = LoginChecker::isLogined();
         if ($v_params['logined'] == $img_id) {
             $v_params['mysc']['main'] = TRUE;
             $imgAddress = ImgAddressUtil::getImgAddressById($imgAccount['img_address_id']);
             // Данные аккаунта
             if (isset($_REQUEST['name_form'])) {
                 if (isset($_REQUEST['img_name'])) {
                     $imgAccount['img_name'] = trim($_REQUEST['img_name']);
                 }
                 if (isset($_REQUEST['img_slog'])) {
                     $imgAccount['img_slog'] = trim($_REQUEST['img_slog']);
                 }
                 // Сохраняем изменения
                 ImgAccountUtil::updateImgAccount($imgAccount);
                 $imgAccount = ImgAccountUtil::getImgAccountById($img_id, TRUE);
                 $v_params['result_text'] = "Название и слоган торгового стенда успешно изменены";
             }
             // Контактная информация
             if (isset($_REQUEST['contacts_form'])) {
                 // Данные адреса
                 if (isset($_REQUEST['addr_region'])) {
                     $addr_region_code = intval($_REQUEST['addr_region']);
                     $addr_region = AddrRegionUtil::getRegionByCode($addr_region_code);
                     $imgAddress['region_id'] = $addr_region['id'];
                 }
                 if (isset($_REQUEST['addr_city'])) {
                     $imgAddress['sity'] = $_REQUEST['addr_city'];
                 }
                 if (isset($_REQUEST['addr_street'])) {
                     $imgAddress['street'] = $_REQUEST['addr_street'];
                 }
                 if (isset($_REQUEST['addr_house'])) {
                     $imgAddress['house'] = $_REQUEST['addr_house'];
                 }
                 if (isset($_REQUEST['contacts_form'])) {
                     if (0 == strcmp("on", $_REQUEST['addr_show'])) {
                         $imgAccount['show_address'] = 1;
                     } else {
                         $imgAccount['show_address'] = 0;
                     }
                 }
                 // Данные телефона
                 if (isset($_REQUEST['phone_phone'])) {
                     $imgAccount['img_phone'] = $_REQUEST['phone_phone'];
                 }
                 if (isset($_REQUEST['contacts_form'])) {
                     if (0 == strcmp("on", $_REQUEST['phone_show'])) {
                         $imgAccount['show_phone'] = 1;
                     } else {
                         $imgAccount['show_phone'] = 0;
                     }
                 }
                 // Данные скайпа
                 if (isset($_REQUEST['skype_skype'])) {
                     $imgAccount['img_skype'] = $_REQUEST['skype_skype'];
                 }
                 if (isset($_REQUEST['contacts_form'])) {
                     if (0 == strcmp("on", $_REQUEST['skype_show'])) {
                         $imgAccount['show_skype'] = 1;
                     } else {
                         $imgAccount['show_skype'] = 0;
                     }
                 }
                 // Данные ICQ
                 if (isset($_REQUEST['icq_icq'])) {
                     $imgAccount['img_icq'] = $_REQUEST['icq_icq'];
                 }
                 if (isset($_REQUEST['contacts_form'])) {
                     if (0 == strcmp("on", $_REQUEST['icq_show'])) {
                         $imgAccount['show_icq'] = 1;
                     } else {
                         $imgAccount['show_icq'] = 0;
                     }
                 }
                 // Сохраняем изменения
                 ImgAddressUtil::updateImgAddress($imgAddress);
                 ImgAccountUtil::updateImgAccount($imgAccount);
                 $imgAccount = ImgAccountUtil::getImgAccountById($img_id, TRUE);
                 $imgAddress = ImgAddressUtil::getImgAddressById($imgAccount['img_address_id']);
                 $v_params['result_text'] = "Контактная информация успешно изменена";
             }
             // Форма смены пароля
             if (isset($_REQUEST['pass_form'])) {
                 $old_pass = $_REQUEST['pass_old'];
                 $new_pass = $_REQUEST['pass_new'];
                 $new_pass2 = $_REQUEST['pass_new2'];
                 if (0 == strcmp("", $old_pass)) {
                     $v_params['errors'][] = "Текущий пароль обязателен для ввода";
                 } else {
                     if (0 != strcmp($imgAccount['hashpass'], Hasher::getHash($old_pass))) {
                         $v_params['errors'][] = "Текущий пароль введен не верно";
                     }
                 }
                 if (0 == strcmp("", $new_pass)) {
                     $v_params['errors'][] = "Новый пароль обязателен для ввода";
                 } else {
                     if (9 > strlen($new_pass)) {
                         $v_params['errors'][] = "Новый пароль должен быть длиной от 9 символов";
                     }
                 }
                 if (0 == strcmp("", $new_pass2)) {
                     $v_params['errors'][] = "Повторите новый пароль";
                 } else {
                     if (0 != strcmp($new_pass, $new_pass2)) {
                         $v_params['errors'][] = "Новый пароль и его повторение не совпадают";
                     }
                 }
                 if (!count($v_params['errors'])) {
                     $imgAccount['hashpass'] = Hasher::getHash($new_pass);
                     // Сохраняем изменения
                     ImgAccountUtil::updateImgAccount($imgAccount);
                     $imgAccount = ImgAccountUtil::getImgAccountById($img_id, TRUE);
                     $v_params['result_text'] = "Пароль успешно изменен";
                 }
             }
             // Данные аккаунта
             $v_params['img_name'] = $imgAccount['img_name'];
             $v_params['img_slog'] = $imgAccount['img_slog'];
             // Данные адреса
             $v_params['img_region_code'] = $imgAddress['rcode'];
             $v_params['img_sity'] = $imgAddress['sity'];
             $v_params['img_street'] = $imgAddress['street'];
             $v_params['img_house'] = $imgAddress['house'];
             $v_params['img_address_show'] = $imgAccount['show_address'];
             if (77 == $v_params['img_region_code'] || 78 == $v_params['img_region_code']) {
                 $v_params['img_sity_disabled'] = TRUE;
             }
             // Данные телефона
             $v_params['img_phone'] = $imgAccount['img_phone'];
             $v_params['img_phone_show'] = $imgAccount['show_phone'];
             // Данные скайпа
             $v_params['img_skype'] = $imgAccount['img_skype'];
             $v_params['img_skype_show'] = $imgAccount['show_skype'];
             // Данные ICQ
             $v_params['img_icq'] = $imgAccount['img_icq'];
             $v_params['img_icq_show'] = $imgAccount['show_icq'];
             $v_params['img_gds_cats_HTML'] = ImgGdsCatUtil::createTreeHTML($imgAccount['id'], "/" . IMAG_PREFIX . $img_id . "/" . IMAG_DIR . "?" . PROD_CAT_PARAM_NAME . "=");
             $v_params['img_blog_cats_HTML'] = ImgBlogCatUtil::createTreeHTML($imgAccount['id'], "/" . IMAG_PREFIX . $img_id . "/" . BLOG_DIR . "?" . ART_CAT_PARAM_NAME . "=");
             $v_params['addr_regions'] = AddrRegionUtil::getRegions();
             Application::fastView('imag-admin/img_admin_settings', $v_params);
             return;
         } else {
         }
     }
     Application::fastView('main/sys_error', $v_params);
 }
Пример #3
0
 function registrationAction()
 {
     $v_params['logined'] = LoginChecker::isLogined();
     $v_params['sys_name'] = SysPropertiesUtil::getPropertyValue("sys_name");
     $v_params['sys_slog'] = SysPropertiesUtil::getPropertyValue("sys_slog");
     $v_params['reg']['main'] = TRUE;
     if (0 < count($_POST)) {
         // Передача формы
         $containErrors = FALSE;
         if (isset($_POST['email'])) {
             $email = $_POST['email'];
             if (0 == strcmp("", $email)) {
                 $v_params['errors'][] = "Email не может быть пустым";
                 $containErrors = TRUE;
             } else {
                 if (!preg_match("/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}\$/", $email)) {
                     $v_params['errors'][] = "Скорее всего вы ввели email не правильно";
                     $containErrors = TRUE;
                 } else {
                     $imgAccount = ImgAccountUtil::getImgAccountByEmail($email);
                     if ($imgAccount) {
                         $v_params['errors'][] = "Такой Email уже зарегистрирован";
                         $containErrors = TRUE;
                     }
                 }
             }
         }
         if (isset($_POST['password1'])) {
             $password1 = $_POST['password1'];
             if ("" == $password1) {
                 $v_params['errors'][] = "Пароль не может быть пустым <br/>";
                 $containErrors = TRUE;
             } else {
                 if (9 > strlen($password1)) {
                     $v_params['errors'][] = "Длина пароля должна быть от 9 символов";
                     $containErrors = TRUE;
                 }
             }
         }
         if (0 != strcmp($_POST['password1'], $_POST['password2'])) {
             $v_params['errors'][] = "Пароль и его подтверждение не совпадают";
             $containErrors = TRUE;
         }
         if (isset($_POST['name'])) {
             $name = $_POST['name'];
             if ("" == $name) {
                 $v_params['errors'][] = "Введите название торгового стенда (позднее вы сможете его изменить)";
                 $containErrors = TRUE;
             }
         }
         $resp = recaptcha_check_answer(RECAPCHA_PRIVATE_KEY, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
         if (!$resp->is_valid) {
             $v_params['errors'][] = "Защита от роботов введена не верно";
             $containErrors = TRUE;
         }
         // Обработка
         if ($containErrors) {
             // Есть ошибки
             $v_params['addr_regions'] = AddrRegionUtil::getRegions();
             Application::fastView('main/sys_registration', $v_params);
         } else {
             // Нет ошибок, создаем аккаунт
             $imgAccount['email'] = $_POST['email'];
             $imgAccount['hashpass'] = Hasher::getHash($_POST['password1']);
             $imgAccount['show_email'] = 0;
             $imgAccount['active'] = 0;
             $imgAccount['img_name'] = $_POST['name'];
             $imgAccount['img_slog'] = $_POST['slog'];
             if (isset($_POST['region']) && "" != $_POST['region']) {
                 $addrRegion = AddrRegionUtil::getRegionByCode($_POST['region']);
                 $imgAddress['region_id'] = $addrRegion['id'];
             }
             $imgAddressId = ImgAddressUtil::insertImgAddress($imgAddress);
             $imgAccount['img_address_id'] = $imgAddressId;
             $imgAccount['show_address'] = 1;
             $activation_code = UUIDGenerator::generate();
             $imgAccount['check_code'] = $activation_code;
             $imgAccountId = ImgAccountUtil::createImgAccount($imgAccount);
             $mail_values['__root_url__'] = "http://" . $_SERVER["HTTP_HOST"];
             $mail_values['__act_url__'] = "http://" . $_SERVER["HTTP_HOST"] . "/activation?imgID=" . $imgAccountId . "&acode=" . $activation_code;
             MailWork::sendMailByTemplate($imgAccount['email'], "Завершение регистрации на сайте " . $_SERVER["HTTP_HOST"], "end_reg.html", $mail_values);
             $v_params['message'] = "На указаный email выслано письмо с подтверждением регистрации";
             $v_params['message_descr'] = "Проверьте свой почтовый ящик, там будет письмо с сылкой для активации созданного аккаунта, после чего вы сможете работать со своим торговым стендом";
             Application::fastView('main/sys_message', $v_params);
         }
     } else {
         $v_params['addr_regions'] = AddrRegionUtil::getRegions();
         Application::fastView('main/sys_registration', $v_params);
     }
 }