public function processRequest()
 {
     $action = __paramInit('string', '', 'action');
     switch ($action) {
         case 'setpro':
             $this->setProMonth();
             break;
         case 'setproWeek':
             $this->setProWeek();
             break;
         case 'setAnswers':
             $this->setAnswers();
             break;
         case 'setfp':
             $this->setCatalogOrFpPlace();
             break;
         case 'setrb':
             $this->setCatalogOrMainPageRoundabout();
             break;
         case 'set_upfp':
             $this->setUpActionInCatalogOrFpPlace();
             break;
         case 'setim':
             $this->setIMakeValues();
             break;
         default:
             if ($this->session_fail) {
                 $this->jsonError("Вероятно, вы перелогинились на сайте в другой вкладке этого браузера.\nОбновите страницу");
             }
     }
 }
Example #2
0
 public static function saveRedirect()
 {
     $emp_redirect = __paramInit('link', 'emp_redirect');
     if ($emp_redirect) {
         $_SESSION['opauth_emp_redirect'] = $emp_redirect;
     }
 }
Example #3
0
 public function setValue($value)
 {
     $db_id_idx = $this->getName() . '_db_id';
     $this->_db_id = __paramInit('int', $db_id_idx, $db_id_idx, 0);
     $columns_id_idx = 'el-' . $this->getName() . '_columns';
     $this->_columns = __paramInit('array_int', $columns_id_idx, $columns_id_idx, $this->_columns);
     return parent::setValue($value);
 }
 public function init()
 {
     parent::init();
     global $js_file;
     $js_file['tservices_order_messages'] = 'tservices/tservices_order_messages.js';
     $js_file['tservices_order_messages_attached'] = 'attachedfiles.js';
     $this->is_scroll = __paramInit('bool', null, 'form-block', false);
 }
Example #5
0
function YellowLine($text, $search = FALSE)
{
    if ($search === FALSE) {
        $search = clearInputText(__paramInit('string', 'search', null, ''));
    }
    $s = preg_split('/[\\s]+/', $search);
    for ($i = 0; $i < count($s); ++$i) {
        if ($s[$i]) {
            $text = preg_replace('/(' . preg_quote($s[$i]) . ')/i', "<span style='background-color: yellow; margin: 0;'>\$1</span>", $text);
        }
    }
    return $text;
}
Example #6
0
/**
* @desc Транслитирует отображаемое имя файла ($_POST['filename']) и возвращает его с расширением загружаемого файла
* @param CFile $cfile
* @return string 
*/
function dav_file_upload_createDestName($cfile)
{
    $uploadFileName = $cfile->name;
    $ext = preg_replace("#.*(\\.[0-9a-zA-Z]*)\$#", "\$1", $uploadFileName);
    //ext = .*
    $filename = __paramInit("string", null, "filename");
    $pattern = '#\\' . $ext . '#';
    $filename = preg_replace($pattern, '', $filename);
    if (strlen($filename) == 0) {
        $filename = preg_replace($pattern, '', $uploadFileName);
    }
    $filename = translit($filename) . $ext;
    return $filename;
}
 public function init($options = array())
 {
     if (isset($options['payments_exclude'])) {
         foreach ($options['payments_exclude'] as $payment_type) {
             unset($this->options['payments'][$payment_type]);
         }
     }
     if (isset($this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM])) {
         require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/platipotom.php';
         $platipotom = new platipotom();
         $this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['data-maxprice'] = $platipotom->getMaxPrice();
     }
     $this->options['is_show'] = __paramInit('bool', $options['popup_id'], $options['popup_id'], false);
     $this->options = array_merge($this->options, $options);
 }
 public function render($options = array())
 {
     $this->options['is_show'] = __paramInit('bool', $options['popup_id'], $options['popup_id'], false);
     //@todo: неиспользуется?
     $tservices_binds = new tservices_binds($this->options['kind']);
     $is_prolong = (bool) $options['date_stop'];
     $options['popup_title'] = $is_prolong ? 'Продление закрепления услуги' : 'Закрепление услуги';
     $options['popup_subtitle'] = $is_prolong ? 'Срок продления услуги' : 'Срок закрепления услуги';
     if ($is_prolong) {
         $options['tservices'] = '{' . $options['tservices_cur'] . ':' . $options['tservices_cur_text'] . '}';
         $options['disable_tservices'] = true;
     }
     $this->options = array_merge($this->options, $options);
     return Template::render(ABS_PATH . self::TPL_MAIN_PATH . $this->buy_popup_tpl, $this->options);
 }
 public function init()
 {
     global $js_file;
     $js_file['reserves_payout'] = 'reserves/reserves_payout.js';
     $uid = get_uid(false);
     $reqvs = ReservesHelper::getInstance()->getUserReqvs($uid);
     $form_type = $reqvs['form_type'];
     $rez_type = $reqvs['rez_type'];
     $reqv = $reqvs[$form_type];
     $payments = array(self::PAYMENT_TYPE_CARD => array('title' => 'Пластиковые<br/>карты', 'class' => 'b-button__pm_card', 'num' => @$reqv['el_ccard'], 'wait' => 'Идет выплата суммы.'), self::PAYMENT_TYPE_YA => array('title' => 'Яндекс.Деньги', 'class' => 'b-button__pm_yd', 'num' => @$reqv['el_yd'], 'wait' => 'Идет выплата суммы.'), self::PAYMENT_TYPE_BANK => array('title' => 'Банковский<br/>перевод', 'class' => 'b-button__pm_bank', 'num' => @$reqv['bank_rs'], 'wait' => 'Идет выплата суммы.'), self::PAYMENT_TYPE_RS => array('title' => 'Банковский<br/>перевод', 'class' => 'b-button__pm_bank', 'num' => @$reqv['bank_rs'], 'wait' => 'Идет выплата суммы.'));
     $form_list = array(sbr::FT_PHYS => 'физическое лицо', sbr::FT_JURI => 'юридическое лицо');
     $this->options['form_txt'] = @$form_list[$form_type];
     $this->options['rez_txt'] = sbr::getRezTypeText($rez_type);
     $allowed_payments = ReservesHelper::getInstance()->getAllowedPayoutTypes($form_type, $rez_type, $this->price);
     $this->options['payments'] = array_intersect_key($payments, $allowed_payments);
     $popup_id = self::getPopupId($this->options['idx']);
     $this->options['is_show'] = __paramInit('bool', $popup_id, $popup_id, false);
 }
 public function action2()
 {
     global $js_file;
     require_once ABS_PATH . "/classes/professions.php";
     $category = __paramInit('int', NULL, 'category', NULL);
     $subcategory = __paramInit('int', NULL, 'subcategory', NULL);
     if ($category > 0 && $subcategory > 0 && professions::isExistProfId($subcategory, $category)) {
         $data = array();
         $data['kind'] = 1;
         //проект!
         $data['pro_only'] = true;
         $data['verify_only'] = false;
         $data['categories'][] = array('category_id' => $category, 'subcategory_id' => $subcategory);
         $_SESSION['customer_wizard'] = $data;
         $this->redirect('/welcome/customer/3/');
     }
     $professions = professions::GetProfessionsAndGroup('g.cnt DESC, p.pcount DESC NULLS LAST');
     $suffix = isset($_SESSION['pda']) && $_SESSION['pda'] == 1 ? '_pda' : '';
     $js_file['ElementsFactory'] = 'form/ElementsFactory.js';
     $js_file['ElementVerticalSelect'] = 'form/VerticalSelect.js';
     $this->render("step2{$suffix}", array('professions' => $professions, 'default_group' => 2, 'default_spec' => 9));
 }
 public function init($options = array())
 {
     $this->options = array_merge($this->options, $options);
     if (isset($options['payments_exclude'])) {
         foreach ($options['payments_exclude'] as $payment_type) {
             unset($this->options['payments'][$payment_type]);
         }
     }
     if (isset($this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM])) {
         require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/platipotom.php';
         $platipotom = new platipotom();
         $this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['data-maxprice'] = $platipotom->getMaxPrice();
     }
     if (isset($_SESSION['ref_uri'])) {
         $ref_uri = urldecode($_SESSION['ref_uri']);
         $query = parse_url($ref_uri, PHP_URL_QUERY);
         $toAppend = strpos($query, $this->options['popup_id']) === false;
         if ($toAppend) {
             $delimitter = $query ? '&' : '?';
             $_SESSION['redirect_from_finance'] = urlencode($ref_uri . $delimitter . $this->options['popup_id'] . '=1');
         }
     }
     $this->options['is_show'] = __paramInit('bool', $this->options['popup_id'], $this->options['popup_id'], false);
 }
Example #12
0
 /**
  * Проверяем фиксируем UTM метки.
  * 
  * @return bool
  */
 public function checkUtm()
 {
     $sess_id = session_id();
     //После авторизации обновляем UID пользователя
     if (!isset($_SESSION['ga_stat_updated']) && isset($_SESSION['uid']) && $_SESSION['uid'] > 0) {
         $this->db()->update(self::TABLE, array('user_id' => $_SESSION['uid']), 'user_id IS NULL AND sess_id = ?', $sess_id);
         $_SESSION['ga_stat_updated'] = true;
     }
     if (!isset($_GET['utm_source'], $_GET['utm_medium'], $_GET['utm_campaign'])) {
         return false;
     }
     $utm_source = __paramInit('string', 'utm_source', null, null, 150);
     $utm_medium = __paramInit('string', 'utm_medium', null, null, 150);
     $utm_campaign = __paramInit('string', 'utm_campaign', null, null, 150);
     if (empty($utm_source) && empty($utm_medium) && empty($utm_campaign)) {
         return false;
     }
     //Хеш на ссылку живет 30 минут в течении жизни сессии
     $hash = md5($_SERVER['REQUEST_URI'] . date('d.m.Y H') . (date('i') > 30));
     //Не фиксируем метки на одинаковые страницы и исключаем накрутку
     if (isset($_SESSION['ga_stat_url_hash'][$hash])) {
         return false;
     }
     $_SESSION['ga_stat_url_hash'][$hash] = true;
     //Храним максимум до 100 разных хеш-ссылок в сессии и старые выбрасываем
     if (count($_SESSION['ga_stat_url_hash']) > 100) {
         $_SESSION['ga_stat_url_hash'] = array_slice($_SESSION['ga_stat_url_hash'], -100);
     }
     //Фиксируем метку
     $data = array('utm_source' => $utm_source, 'utm_medium' => $utm_medium, 'utm_campaign' => $utm_campaign, 'ip' => getRemoteIP(), 'url' => parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), 'sess_id' => $sess_id);
     if (isset($_SESSION['uid']) && $_SESSION['uid'] > 0) {
         $data['user_id'] = $_SESSION['uid'];
     }
     $ret = $this->db()->insert(self::TABLE, $data);
     return $ret;
 }
Example #13
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/employer.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/freelancer.php";
$blog = new blogs();
$gr = intval(trim($_GET['gr']));
$login = trim($_GET['user']);
$t = trim(__paramInit('string', 't'));
if (!$t) {
    $base = 0;
} else {
    $base = 1;
}
$page = intval(trim($_GET['page']));
$from = intval(trim($_GET['from']));
$from = 0;
//а нафига вообще тут это нужно?
if (!$page) {
    $page = 1;
}
if ($login) {
    // Ћичный блог пользовател¤
    $login = pg_escape_string($login);
    $user = new users();
    $user->GetUser($login);
    if ($user->uid && !$user->is_banned) {
        if (!is_emp($user->role)) {
            $user = new freelancer();
            $user->GetUser($login);
            $is_visible = substr($user->tabs, 3, 1);
Example #14
0
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/blogs.php';
$header = '../header.php';
//$additional_header = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Блоги на Free-lance.ru (".$gr_name.")\" href=\"/rss/blogs.php?gr=".$gr."&amp;t=".$t."\" />";
$css_file = array('lenta.css', 'commune.css', '/css/nav.css');
$content = 'content.php';
$js_file = array('polls.js', 'commune.js');
$footer = '../footer.html';
$user_mod = commune::MOD_ADMIN * hasPermissions('communes');
$user_mod |= commune::MOD_PRO * (users::IsPro($uid, $e) ? 1 : 0);
$user_mod |= commune::MOD_EMPLOYER * (int) is_emp();
$user_mod |= commune::MOD_BANNED * is_banned($uid);
$page = __paramInit('int', 'page', 'page', 1);
$action = __paramInit('string', NULL, 'action');
switch ($action) {
    case 'Save':
        $has_lenta = __paramInit('bool', NULL, 'has_lenta', NULL);
        $my_team = __paramInit('bool', NULL, 'my_team');
        $all_profs = __paramInit('bool', NULL, 'all_profs');
        $communes = __paramInit('array', NULL, 'commune_id');
        $prof_groups = __paramInit('array', NULL, 'prof_group_id');
        if (!lenta::SaveUserSettings($has_lenta, $uid, $my_team, $all_profs, $communes, $prof_groups)) {
        }
        // ошибка.
        header('Location: /lenta/');
        exit;
        break;
    default:
        break;
}
include '../template2.php';
Example #15
0
        <?php 
            echo $ban_count;
            ?>
    </li>
    <?php 
        }
    }
} else {
    if ($top['category_id'] && $top['category_name']) {
        ?>
<li class="b-post__links-item b-post__links-item_padright_10">
    Раздел: <a class="b-post__link b-post__link_color_000" href="<?php 
        echo getFriendlyURL('commune_commune', $top['commune_id']);
        ?>
?om=<?php 
        echo __paramInit("int", "om") ? __paramInit("int", "om") : '0';
        ?>
&cat=<?php 
        echo $top['category_id'];
        ?>
"><?php 
        echo $top['category_name'];
        ?>
</a>
</li>
<?php 
    }
}
?>
</ul>
Example #16
0
        if ($action == 'status_action') {
            $resend = __paramInit('bool', NULL, 'resend');
            $del = __paramInit('bool', NULL, 'del');
            $cancel = __paramInit('bool', NULL, 'cancel');
            $id = __paramInit('int', NULL, 'id');
            $ok = true;
            if ($resend) {
                $ok = $sbr->resendCanceled($id);
            } else {
                if ($cancel) {
                    $ok = $sbr->cancel($id);
                } else {
                    if ($del) {
                        $ok = $sbr->delete($id);
                    }
                }
            }
            if ($ok) {
                header_location_exit('/norisk2/' . ($del ? '' : "?id={$id}"));
            }
        }
        $anchor = __paramInit('int', 'id');
        if (!($sbr_currents = $sbr->getCurrents())) {
            header_location_exit('/promo/sbr/');
        } else {
            $sbr->getUserReqvs();
        }
        $_SESSION['sbr_tip_old'] = notifications::getSbrTip('old');
        $sbr->setLastView('old');
        break;
}
Example #17
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/xajax/commune.common.php";
$xajax->printJavascript('/xajax/');
global $id, $comm, $user_mod, $uid, $result;
$fromPage = __paramInit('string', 'fp', 'fp');
$name = $comm['name'];
//  if ( $restrict_type & commune::RESTRICT_READ_MASK )
//  {
if ($user_mod & (commune::MOD_COMM_ACCEPTED | commune::MOD_COMM_ASKED)) {
    $header = 'на выход из сообщества';
} else {
    $header = 'вступления в сообщество';
}
$comm_link = "<b class=\"vv\">&laquo;<a class=\"frlname11\" href=\"/commune/?id={$id}\">{$name}</a>&raquo;</b>";
?>
<h1 class="b-page__title">Вы не являетесь членом сообщества</h1>
<?php 
if ($user_mod & commune::MOD_COMM_ASKED) {
    ?>

		<div class="b-layout__txt b-layout__txt_padbot_10">Вы не являетесь членом сообщества <strong class="b-layout__bold">«<?php 
    echo $comm['name'];
    ?>
»</strong>. Просмотр этого сообщества вам недоступен.</div>
		<div class="b-layout__txt b-layout__txt_padbot_10">Вступление в сообщество возможно только после одобрения администратором. Ваша заявка отправлена администратору сообщества. <a class="b-layout__link b-layout__link_dot_c10600" href="javascript:void(0)" onclick="xajax_OutCommune(<?php 
    echo $comm["id"];
    ?>
, true); return false;">Отозвать</a></div>

		<div class="b-layout__txt"><a class="b-layout__link" href="/commune/">Остальные сообщества</a></div>
Example #18
0
function Lenta_Save($data)
{
    session_start();
    $objResponse = new xajaxResponse();
    $uid = get_uid(false);
    if ($data['commune_id']) {
        foreach ($data['commune_id'] as $k => $v) {
            if (is_array($v)) {
                unset($data['commune_id'][$k]);
            }
        }
    }
    if ($data['prof_group_id']) {
        foreach ($data['prof_group_id'] as $k => $v) {
            if (is_array($v)) {
                unset($data['prof_group_id'][$k]);
            }
        }
    }
    if ($data['blog_gr_id']) {
        foreach ($data['blog_gr_id'] as $k => $v) {
            if (is_array($v)) {
                unset($data['blog_gr_id'][$k]);
            }
        }
    }
    if ($uid = get_uid(false)) {
        $_POST = $data;
        $has_lenta = __paramInit('bool', NULL, 'has_lenta', NULL);
        $my_team = __paramInit('bool', NULL, 'my_team');
        $all_profs = __paramInit('bool', NULL, 'all_profs');
        $communes = __paramInit('array', NULL, 'commune_id');
        $prof_groups = __paramInit('array', NULL, 'prof_group_id');
        $blog_groups = __paramInit('array', NULL, 'blog_gr_id');
        lenta::SaveUserSettings($has_lenta, $uid, $my_team, $all_profs, $communes, $prof_groups, $blog_groups);
    }
    $objResponse->script('spiner.show(); xajax_Lenta_Show(1);');
    $objResponse->script('fix_banner();');
    return $objResponse;
}
Example #19
0
}
$_SESSION['quickbuypro_is_success'] = 'y';
if ($_SESSION['quickbuypro_is_begin'] == 1) {
    unset($_SESSION['quickbuypro_is_begin']);
    $opcode = @$_SESSION['quickbuypro_success_opcode2'];
    unset($_SESSION['quickbuypro_success_opcode2']);
    if ($opcode == 164) {
        header('Location: /profi/?quickprofi_ok=1');
    } else {
        $uri = $_SESSION['quickbuypro_redirect'] ?: (is_emp() ? '/payed-emp/' : '/payed/');
        unset($_SESSION['quickbuypro_redirect']);
        header('Location: ' . $uri . '?quickpro_ok=1');
    }
    exit;
}
if (__paramInit('string', 'quickprobuy', 'quickprobuy', null) == 1) {
    $_SESSION['quickpro_order'] = 'done';
    echo '<html><body><script>window.close();</script></body></html>';
    exit;
}
//После успешной оплаты по банковской карте за верификацию закрываем окно
if ($_SESSION['quickver_is_begin'] == 1) {
    unset($_SESSION['quickver_is_begin']);
    echo '<html><body><script>window.close();</script></body></html>';
    exit;
}
if ($_SESSION['quickacc_is_begin'] == 1) {
    unset($_SESSION['quickacc_is_begin']);
    header('Location: /bill/history/?period=3');
    exit;
}
Example #20
0
     if (!$searchcard) {
         $searchcard = trim(stripslashes($_GET['searchcard']));
     }
     $users = $users->FindByCard($searchcard);
     $no_more = 1;
     break;
 case 'searchbyid':
     $search = trim(stripslashes($_GET['search']));
     $additsql = "(users.uid = {$search})";
     unset($search);
     $no_more = 0;
 case 'selacop':
     $fdate = trim(stripslashes($_GET['fdate']));
     $tdate = trim(stripslashes($_GET['tdate']));
     $akop = trim(stripslashes($_GET['akop']));
     $domain_id = __paramInit('int', 'domain_id', null, 0);
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/account.php';
     $users = account::GetUsersByAkOp($akop, $fdate, $tdate, $domain_id);
     foreach ($users as $value) {
         if ($akop == 1 && $value['op_code'] == 108) {
             $value['ammount'] = '-19.00';
         }
         if ($akop == 73 && $value['op_code'] == 108) {
             $value['ammount'] = '-1.00';
         }
         $history_bill[$value['uid']][] = array('ammount' => $value['ammount'], 'op_date' => $value['op_date'], 'comments' => $value['descr'] . ($value['comments'] ? " ({$value['comments']})" : ''));
     }
     $no_more = 1;
     break;
 case 'change_email':
     $res = users::ChangeMail(trim($_POST['uid']), trim($_POST['email']));
Example #21
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/tu/controllers/TServiceOrderController.php';
session_start();
$stretch_page = true;
$showMainDiv = true;
// Формируем JS внизу страницы
define('JS_BOTTOM', true);
$css_file = array('/css/nav.css', '/css/block/b-tabs/b-tabs.css');
$js_file[] = 'mootools-form-validator.js';
$js_file[] = 'tservices/tservices_order.js';
$js_file[] = 'mAttach.js';
$js_file['tservices_order_feedback'] = 'tservices/tservices_order_feedback.js';
$content = 'tpl.order.php';
$header = '../header.php';
$footer = '../footer.html';
$module = new CModule('tu');
$module->setBasePath(dirname(__FILE__));
$controller = new TServiceOrderController('t-service-order', $module);
$controller->init();
// инициализация контролера
$controller->run(__paramInit('string', 'action', 'action', 'index'));
// отрисовка страницы
include '../template3.php';
Example #22
0
<?php

/**
 * Эмуляция ответа от ЯД при запросах на выплату.
 */
require_once __DIR__ . '/../../classes/stdf.php';
require_once ABS_PATH . '/classes/YandexMoney3/Utils/Array2XML.php';
use YandexMoney3\Utils\Array2XML;
if (is_release()) {
    exit;
}
$method = __paramInit('string', 'm', null, null);
$bodyRaw = file_get_contents('php://input');
if (empty($bodyRaw)) {
    exit;
}
$xml = simplexml_load_string($bodyRaw);
$json = json_encode($xml);
$decodedArray = json_decode($json, true);
$is_fail = false;
$clientOrderId = @$decodedArray['@attributes']['clientOrderId'];
if (!$clientOrderId) {
    $is_fail = true;
}
$converter = new Array2XML();
$converter->setConvertFromEncoding('windows-1251');
$converter->setTopNodeName($method . 'Response');
if ($is_fail) {
    $converter->importArray(array('clientOrderId' => $clientOrderId, 'status' => 3, 'error' => 41, 'processedDT' => date('c')));
    echo $converter->saveXml();
}
Example #23
0
/**
 * Проверка данных из формы.
 */
function tu_validation(&$tservice, $is_exist_feedbacks = 0)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_categories.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/validation.php';
    $errors = array();
    $validator = new validation();
    $tservices_categories = new tservices_categories();
    //---
    //$tservice->title = trim(htmlspecialchars(InPost('title'),ENT_QUOTES,'cp1251'));
    //$tservice->title = antispam(__paramInit('string', NULL, 'name', NULL, 60, TRUE));
    $tservice->title = sentence_case(__paramInit('html', null, 'title', null, 100, true));
    $title = trim(stripslashes(InPost('title')));
    if (!$validator->required($title)) {
        $errors['title'] = validation::VALIDATION_MSG_REQUIRED;
    } elseif (!$validator->symbols_interval($title, 4, 100)) {
        $errors['title'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 100);
    }
    //---
    $tservice->price = intval(trim(InPost('price')));
    if (!$validator->is_natural_no_zero($tservice->price)) {
        $errors['price'] = validation::VALIDATION_MSG_REQUIRED_PRICE;
    } elseif (!$validator->greater_than_equal_to($tservice->price, 300)) {
        $errors['price'] = sprintf(validation::VALIDATION_MSG_PRICE_GREATER_THAN_EQUAL_TO, '300 р.');
    } elseif (!$validator->less_than_equal_to($tservice->price, 999999)) {
        $errors['price'] = sprintf(validation::VALIDATION_MSG_PRICE_LESS_THAN_EQUAL_TO, '999 999 р.');
    }
    //---
    $days_db_id = intval(trim(InPost('days_db_id')));
    if (!$validator->is_natural_no_zero($days_db_id) || !in_array($days_db_id, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 21, 30, 45, 60, 90))) {
        $errors['days'] = validation::VALIDATION_MSG_FROM_LIST;
        $days_db_id = 1;
    }
    $tservice->days = $days_db_id;
    //---
    //Если есть отзывы то не даем изменить категорию
    if (!(InPost('action') == 'save' && $is_exist_feedbacks > 0)) {
        $category_id = intval(trim(InPost('category_db_id')));
        $parent_category_id = $tservices_categories->getCategoryParentId($category_id);
        if ($parent_category_id === false) {
            $errors['category'] = validation::VALIDATION_MSG_CATEGORY_FROM_LIST;
        } else {
            $tservice->category_id = $category_id;
            //$this->property()->parent_category_id = $parent_category_id;
        }
    }
    //---
    $str_tags = trim(preg_replace('/\\s+/s', ' ', strip_tags(InPost('tags'))));
    $tags = strlen($str_tags) > 0 ? array_unique(array_map('trim', explode(',', $str_tags))) : array();
    $tags = array_filter($tags, function ($el) {
        $len = strlen(stripslashes($el));
        return $len < 80 && $len > 2;
    });
    $tags_cnt = count(array_unique(array_map('strtolower', $tags)));
    $tags = array_map(function ($value) {
        return htmlspecialchars($value, ENT_QUOTES, 'cp1251');
    }, $tags);
    $tservice->tags = $tags;
    if (!$validator->required($str_tags)) {
        $errors['tags'] = validation::VALIDATION_MSG_REQUIRED;
    } elseif ($tags_cnt > 10) {
        $errors['tags'] = sprintf(validation::VALIDATION_MSG_MAX_TAGS, 10);
    }
    //---
    $videos = __paramInit('array', null, 'videos', array());
    $videos = is_array($videos) ? array_values($videos) : array();
    if (count($videos)) {
        $tservice->videos = null;
        foreach ($videos as $key => $video) {
            if ($validator->required($video)) {
                $_video_data = array('url' => $video, 'video' => false, 'image' => false);
                //$_video = $validator->video_validate($video);
                $_video = $validator->video_validate($video);
                $is_error = true;
                if ($_video) {
                    $_video_data['url'] = $_video;
                    if ($_video_meta = $validator->video_validate_with_thumbs($_video, 0)) {
                        $_video_data = array_merge($_video_data, $_video_meta);
                        $is_error = false;
                    }
                }
                if ($is_error) {
                    $errors['videos'][$key] = validation::VALIDATION_MSG_BAD_LINK;
                }
                $tservice->videos[$key] = $_video_data;
            }
        }
    }
    //---
    //$tservice->description = trim(htmlspecialchars(InPost('description'),ENT_QUOTES, "cp1251"));
    //$description = trim(InPost('description'));
    $tservice->description = trim(__paramInit('html', null, 'description', null, 5000, true));
    $description = trim(stripslashes(InPost('description')));
    if (!$validator->required($description)) {
        $errors['description'] = validation::VALIDATION_MSG_REQUIRED;
    } elseif (!$validator->symbols_interval($description, 4, 5000)) {
        $errors['description'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 5000);
    }
    //---
    //$tservice->requirement = trim(htmlspecialchars(InPost('requirement'),ENT_QUOTES, "cp1251"));
    //$requirement = trim(InPost('requirement'));
    $tservice->requirement = trim(__paramInit('html', null, 'requirement', null, 5000, true));
    $requirement = trim(stripslashes(InPost('requirement')));
    if (!$validator->required($requirement)) {
        $errors['requirement'] = validation::VALIDATION_MSG_REQUIRED;
    } elseif (!$validator->symbols_interval($requirement, 4, 5000)) {
        $errors['requirement'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 5000);
    }
    //---
    $extra = __paramInit('array', null, 'extra', array());
    $extra = is_array($extra) ? array_values($extra) : array();
    $total_extra_price = 0;
    if (count($extra)) {
        $key = 0;
        $tservice->extra = null;
        foreach ($extra as $el) {
            if (isset($el['title'], $el['price'], $el['days_db_id'])) {
                $el['title'] = stripslashes($el['title']);
                $title = trim(htmlspecialchars($el['title'], ENT_QUOTES, 'cp1251'));
                $title_native = trim($el['title']);
                $price = trim($el['price']);
                if (!$validator->required($title_native) && !$validator->required($price)) {
                    continue;
                }
                $is_title = $validator->min_length($title_native, 4) && $validator->max_length($title_native, 255);
                $is_price = $validator->is_integer_no_zero($price) && $validator->numeric_interval($price, -999999, 999999);
                if (!$is_price) {
                    $errors['extra'][$key]['price'] = validation::VALIDATION_MSG_REQUIRED_PRICE;
                }
                if (!$is_title) {
                    $errors['extra'][$key]['title'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 255);
                }
                $days = trim($el['days_db_id']);
                $is_days = $validator->is_natural($days) && $validator->less_than_equal_to($days, 5);
                if (!$is_days) {
                    $errors['extra'][$key]['days'] = sprintf(validation::VALIDATION_MSG_INTERVAL, '0', '5 дней');
                    $days = 1;
                }
                $price = intval($price);
                $days = intval($days);
                $tservice->extra[$key] = array('title' => $title, 'price' => $price, 'days' => $days);
                ++$key;
                if ($price < 0) {
                    $total_extra_price += $price;
                }
            }
        }
    }
    //---
    $tservice->is_express = 'f';
    $tservice->express_price = 0;
    $tservice->express_days = 1;
    if (InPost('express_activate') == 1 && $tservice->days > 1) {
        $express = InPost('express');
        $price = trim($express['price']);
        if (!$validator->is_natural_no_zero($price) || !$validator->less_than_equal_to($price, 999999)) {
            $errors['express']['price'] = validation::VALIDATION_MSG_REQUIRED_PRICE;
        }
        $days_db_id = intval(trim($express['days_db_id']));
        if (!$validator->is_natural_no_zero($days_db_id) || !in_array($days_db_id, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 21, 30, 45, 60, 90))) {
            $errors['express']['days'] = validation::VALIDATION_MSG_FROM_LIST;
            $days_db_id = 1;
        }
        $tservice->is_express = 't';
        $tservice->express_price = intval($price);
        $tservice->express_days = $days_db_id;
    }
    //---
    //Проверка общей суммы с учетом скидок, опций (срочность не учитываю так как она выбирается по желанию)
    if (!isset($errors['price']) && !$validator->greater_than_equal_to($tservice->price + $total_extra_price, 300)) {
        $errors['price'] = sprintf(validation::VALIDATION_MSG_PRICE_MIN_TOTAL, '300 р.');
    }
    //---
    //TODO: Есть проблема с контроллом выпадающего списка
    // он не отрабатывает новое значение укзанное по умолчанию
    if (!in_array(intval(InPost('distance')), array(1, 2))) {
        $errors['distance'] = validation::VALIDATION_MSG_FROM_RADIO;
    } elseif (intval(InPost('distance')) == 2) {
        $city_db_id = intval(InPost('city_db_id'));
        $city = new city();
        if ($city_db_id <= 0 || !$city->getCityName($city_db_id)) {
            $errors['distance'] = validation::VALIDATION_MSG_CITY_FROM_LIST;
        } else {
            $tservice->city = intval(InPost('city_db_id'));
            $tservice->is_meet = 't';
        }
    } else {
        $tservice->is_meet = 'f';
    }
    //---
    $tservice->agree = InPost('agree') == 1 ? 't' : 'f';
    if ($tservice->agree === 'f') {
        $errors['agree'] = validation::VALIDATION_MSG_ONE_REQUIRED;
    }
    //---
    if (in_array(InPost('active'), array(0, 1))) {
        $tservice->active = intval(InPost('active')) == 1 ? 't' : 'f';
        if ($tservice->is_angry) {
            $tservice->active = 't';
        }
    }
    //---
    //Вырезаем слеши если ошибка
    if (count($errors) > 0) {
        $attrs = array('title', 'description', 'requirement', 'tags');
        foreach ($attrs as $attr) {
            if (is_array($tservice->{$attr})) {
                foreach ($tservice->{$attr} as &$value) {
                    $value = stripslashes($value);
                }
            } else {
                $tservice->{$attr} = stripslashes($tservice->{$attr});
            }
        }
    }
    return $errors;
}
Example #24
0
<?php

$prjID = __paramInit('int', 'prj_id', null, null);
$link = $prjID ? '/public/?step=1&public=' . $prjID : '/service/top/';
?>
<td class="b-layout__td b-layout__td_width_70 b-layout__td_center b-layout__td_width_null_ipad"><span class="b-page__desktop"><img class="b-layout__pic" src="/images/promo-icons/small/5.png" alt=""  /></span></td>
<td class="b-layout__td"><h3 class="b-layout__h3 b-layout__h3_padbot_5"><a class="b-layout__link b-layout__link_bold" href="/service/top/">Закрепление проекта</a></h3>
<div class="b-layout__txt">Чтобы проект был замечен как можно большим количеством пользователей, его можно закрепить. Закрепленный проект находится наверху ленты проектов на главной странице.</div>
<div class="b-buttons b-buttons_padtop_10 b-page__iphone"><a href="<?php 
echo $link;
?>
" class="b-button b-button_flat b-button_flat_green b-button_height_auto">Закрепить этот проект</a></div>
</td>
<td class="b-layout__td b-layout__td_width_270 b-layout__td_center b-layout__td_valign_mid  b-layout__td_width_null_iphone b-layout__td_pad_10 b-layout__td_pad_null_iphone"><a href="<?php 
echo $link;
?>
" class="b-button b-button_flat b-button_flat_green b-button_height_auto b-page__desktop b-page__ipad">Закрепить этот проект</a></td>
Example #25
0
    $login = __paramInit('string', 'login', 'login');
    $result = array();
    $result['success'] = false;
    if ($login) {
        $users = new users();
        $users->GetUser($login);
        if ($users->uid) {
            $result['success'] = true;
            $result['user'] = array('uid' => $users->uid, 'login' => $users->login, 'uname' => iconv('CP1251', 'UTF-8', $users->uname), 'usurname' => iconv('CP1251', 'UTF-8', $users->usurname));
        }
    }
    $result['test'] = $login;
    echo json_encode($result);
    exit;
} elseif ($task == 'pdel') {
    $gray_ip->deletePrimaryUser(__paramInit('int', 'puid'));
    $_SESSION['gray_ip_parent_reload'] = $primary_id ? 'yes' : '';
    header('Location: ' . $_SERVER['HTTP_REFERER']);
    exit;
} elseif ($task == 'sdel') {
    $gray_ip->deleteSecondaryIp($_REQUEST['chk_users']);
    $_SESSION['gray_ip_parent_reload'] = $primary_id ? 'yes' : '';
    header('Location: ' . $_SERVER['HTTP_REFERER']);
    exit;
} elseif ($task == 'mass_sdel') {
    $gray_ip->deleteSecondaryIpByPrimary($_REQUEST['chk_users']);
    $_SESSION['gray_ip_parent_reload'] = $primary_id ? 'yes' : '';
    header('Location: ' . $_SERVER['HTTP_REFERER']);
    exit;
}
if ($cmd == 'filter') {
 /**
  * Инициализация полей 
  * 
  * @param type $name
  * @param type $itr
  * @return string 
  */
 public function initMultiVal($name, $itr = 4)
 {
     $result = array();
     for ($i = 0; $i < $itr; $i++) {
         $field = "{$name}_{$i}";
         $value = __paramInit('string', null, $field, false, $this->getMaxLenForInfoValue($name));
         if ($value) {
             $result[$i] = $value;
         }
         /* else {
                $result[$i] = '';
            }*/
     }
     return $result;
 }
Example #27
0
<?php

$g_page_id = '0|62';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/registration.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/account.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/splash_screens.php';
session_start();
$prj_id = __paramInit('int', 'prj_id', null, 0);
$contest = __paramInit('int', 'contest', null, 0);
$top = __paramInit('int', 'top', null, 0);
$top_days = __paramInit('int', 'top_days', null, 0);
$color = __paramInit('int', 'color', null, 0);
$bold = __paramInit('int', 'bold', null, 0);
$logo = __paramInit('int', 'logo', null, 0);
// страницу могут смотреть только зарегистрированые работодатели
if (!get_uid(0) || !is_emp() || !$prj_id) {
    include $_SERVER['DOCUMENT_ROOT'] . '/403.php';
    exit;
}
$prj_url = getFriendlyURL('project', $prj_id);
$stretch_page = true;
$header = '../header.php';
$footer = '../footer.html';
$content = 'tpl.contest_published.php';
$_SESSION['splash_prj_id'] = $prj_id;
//$_SESSION['do_show_splash'] = splash_screens::SPLASH_KONKURS;
include '../template2.php';
Example #28
0
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . '/classes/stdf.php';
require_once $_SERVER["DOCUMENT_ROOT"] . '/classes/account.php';
require_once $_SERVER["DOCUMENT_ROOT"] . '/classes/payed.php';
require_once $_SERVER["DOCUMENT_ROOT"] . '/classes/users.php';
DB::setStandby('master', NULL);
$uid = __paramInit("int", "uid", null, 0);
$uid = intval($uid);
$admin = 103;
if ($uid > 0) {
    global $DB;
    //Есть ли такой незабаненый не про, заходивший в проследний раз более года назад?
    $targetUser = users::userWasInOldYear($uid);
    if (is_array($targetUser)) {
        //Даем про на неделю
        $account = new account();
        $payed = new payed();
        $op_code = 115;
        // 52
        $tr_id = $account->start_transaction($admin);
        $interval = "7 days";
        if ($targetUser["role"][0] == 1) {
            $interval = "1 month";
        }
        $success = $payed->GiftOrderedTarif($bill_id, $gift_id, $uid, $admin, $tr_id, $interval, "Аккаунт PRO в подарок", $op_code);
        if (!$success) {
            $rpath = "./";
            if (!$fpath) {
                $fpath = "";
            }
Example #29
0
$tr_id = __paramInit('int', NULL, 'transaction_id');
$answer_pay = __paramInit('bool', NULL, 'answer_pay');
$spec_pay = __paramInit('bool', NULL, 'spec_pay');
$spec_prolong = __paramInit('bool', NULL, 'prolong_specs');
if ($spec_prolong) {
    return;
    // #0022795
    if ($err = professions::prolongSpecs($uid)) {
        $error['prolong_specs'] = $err;
    }
    $answer_pay = null;
} else {
    if ($spec_pay) {
        return;
        // #0022795
        if ($spec_cnt = __paramInit('int', NULL, 'spec_cnt')) {
            $err = professions::buySpec($uid, $spec_cnt, $tr_id, '1 mon', 0);
            if ($err) {
                $error['spec'] = $err;
            } else {
                $_SESSION['bill.GET']['addinfo'] = "<a href=\"/users/{$_SESSION['login']}/setup/specaddsetup/\">—траница управлени¤ специализаци¤ми</a>";
            }
        } else {
            $error['spec'] = 'Ќе верно указано заначение количества доп. специализаций ';
        }
    }
}
if ($answer_pay) {
    if ($_POST['answers_sum'] > 0) {
        $num_answers = intval($_POST['num_answers']);
        if (!($err = $answers->BuyByFM($uid, $num_answers, $tr_id, 0))) {
Example #30
0
        $kind = $_user_action == 'add_vacancy' ? 4 : 1;
        $redirectUriPlain = '/public/?step=1&kind=' . $kind;
    }
    if (strpos($redirectUriPlain, 'hash=') === false) {
        $redirectUriPlain .= (strpos($redirectUriPlain, '?') === false ? '?' : '&') . 'hash=' . $hash;
    }
}
$redirectUri = urlencode($redirectUriPlain);
$action = __paramInit('string', null, 'action');
$registration = new registration();
$registration->listenerAction($action);
$action = $registration->getNextAction();
if ($requestedRole == "empl") {
    $registration->role = registration::ROLE_EMPLOYER;
}
if (__paramInit('string', null, 'action') != 'registration' || $registration->error['captcha'] && __paramInit('string', null, 'action') == 'registration') {
    unset($_SESSION['reg_captcha_num']);
    $registration->setFieldInfo('captchanum', uniqid('', true));
    $captcha = new captcha($registration->captchanum);
    $captcha->setNumber();
} else {
    $registration->setFieldInfo('captchanum', $_SESSION['reg_captcha_num']);
    $captcha = new captcha($registration->captchanum);
}
unset($_SESSION['login_generated']);
// Пользовательское сообщение (Alert)
$alert_message = '';
if ($_user_action == 'add_project') {
    $alert_message = 'Зарегистрируйтесь или авторизуйтесь как Работодатель, чтобы опубликовать проект.';
    $registration->role = registration::ROLE_EMPLOYER;
} elseif ($_user_action == 'add_vacancy') {