Example #1
0
function pay_place_top($catalog = 0, $caruselTop)
{
    global $DB, $session;
    if ($catalog == 0) {
        $yaM = "yaCounter6051055.reachGoal('main_carousel_ref');";
    } else {
        $yaM = "yaCounter6051055.reachGoal('cat_carousel_ref');";
    }
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pay_place.php';
    $payPlace = new pay_place($catalog);
    $ppAds = $payPlace->getUserPlaceNew();
    if (is_array($ppAds)) {
        foreach ($ppAds as $ppAd) {
            $pp_uids[] = $ppAd['uid'];
        }
        $pp_uids = array_unique($pp_uids);
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
        $usrs = new users();
        $pp_result = $usrs->getUsers('uid IN (' . implode(',', array_values($pp_uids)) . ')');
        foreach ($pp_result as $k => $v) {
            $toppay_usr[$v['uid']] = $v;
        }
        $pp_h = $payPlace->getAllInfo($pp_uids);
    }
    $not_load_info = true;
    ob_start();
    include $_SERVER['DOCUMENT_ROOT'] . '/templates/pay_place.php';
    $html = antispam(str_replace(array("\r", "\n"), '', ob_get_clean()));
    $aRes['success'] = true;
    $aRes['html'] = iconv('windows-1251', 'UTF-8', $html);
    echo json_encode($aRes);
}
 public function init($uid, $type_place = 0)
 {
     $promoCodes = new PromoCodes();
     $options = array('popup_title' => 'Размещение в Карусели', 'items_title' => 'Параметры объявления', 'payments_exclude' => array(self::PAYMENT_TYPE_BANK), 'price' => pay_place::getPrice(), 'promo_code' => $promoCodes->render(PromoCodes::SERVICE_CARUSEL));
     $this->addWaitMessageForAll();
     $form = new CaruselForm();
     //Если уже размещался то поумолчанию заполняем тексты
     $payPlace = new pay_place($type_place);
     $data = $payPlace->getUserRequest($uid);
     if ($data) {
         $form->setDefaults(array('title' => $data['ad_header'], 'description' => $data['ad_text']));
     }
     $this->setContent($form->render());
     parent::init($options);
     $this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'] = sprintf($this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'], 'карусель');
 }
Example #3
0
 /**
  * Функция оплаты акции.
  *  
  * @global object $DB база данных
  *
  * @param int $transaction_id ИД транзакции сделки
  * @param int $user_id        ИД пользователя
  *
  * @return int
  */
 public function setPayed($transaction_id, $user_id)
 {
     global $DB;
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/account.php';
     $account = new account();
     if (is_emp($_SESSION['role'])) {
         return 0;
     }
     $bill_id = 0;
     $error = $account->Buy($bill_id, $transaction_id, $this->getConst_OP_CODE(), $user_id, $this->title, $this->descr, $this->getConst_PAYED_SUM(), 0);
     if ($error !== 0) {
         return 0;
     }
     if ($bill_id) {
         require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pay_place.php';
         $pay_place = new pay_place(1);
         $account->commit_transaction($transaction_id, $user_id, $bill_id);
         $this->setUserPro($user_id, $bill_id);
         $pay_place->addUserTop($user_id);
         return $bill_id;
     }
     return 0;
 }
Example #4
0
$log->TRACE($scl->wordsStatRun());
if (date('H') == 1) {
    // разделение stat_monthly
    $log->TRACE($scl->stat_monthly_split());
}
// Отсылаем email тем у кого заканчивается закрепление проекта наверху главной страницы
$log->TRACE($mail->EndTopDaysPrjSendAlerts());
if (date('H') == 7) {
    $log->TRACE($mail->sendYdDayRegistry());
    //$log->TRACE( $mail->SbrReqvAlerts() );
    $log->TRACE($mail->SbrDeadlineAlert());
}
// платные места на верху
$pp = new pay_place();
$log->TRACE($pp->clearOldData());
$pp = new pay_place(1);
$log->TRACE($pp->clearOldData());
if (date('H') == 6) {
    $stc = new static_compress();
    $log->TRACE($stc->cleaner());
}
$rating = new rating();
if (date('H') == 1) {
    //$rating = new rating();
    //$log->TRACE( $rating->calcDaily() );
    $log->TRACE($rating->calcMonthly());
}
$log->TRACE($rating->calcDaily());
// перенесено в /minutly.php
/*if(date('H') >= 0 && date('H') <= 5) { 
    // разморозка ПРО
/**
 * Отдает HTML для Платные места
 * 
 * @param  object $objResponse xajaxResponse
 * @param  string $rec_id идентификатор записи
 * @param  string $rec_type тип записи
 * @param  array $aParams массив дополнительных параметров
 * @param string $sDrawFunc имя функции для выполнения после сохранения
 * @return string
 */
function _admEditCarouselParseForm(&$objResponse, $rec_id = '', $rec_type = '', $aParams = array(), $sDrawFunc = '')
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pay_place.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php';
    if ($sDrawFunc == 'adm_first_page') {
        if (!pay_place::checkModeration($rec_id)) {
            $objResponse->alert('Пользователь удалил или изменил данные.');
            $objResponse->script('adm_edit_content.cancel();');
            $objResponse->script("\$('my_div_content_" . user_content::MODER_CAROUSEL . "_{$rec_id}').destroy();");
            return false;
        }
    }
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php';
    $place = pay_place::getPaidPlace($rec_id);
    $attFiles = new attachedfiles();
    ob_start();
    include_once $_SERVER['DOCUMENT_ROOT'] . '/user/adm_edit_tpl/carousel.php';
    $sHtml = ob_get_contents();
    ob_end_clean();
    // текст
    $sOnReady = "if(document.getElementById('adm_edit_txt')){document.getElementById('adm_edit_txt').value=(\$('adm_edit_txt_source')?\$('adm_edit_txt_source').value:null);}";
    $objResponse->assign('h4_adm_edit', 'innerHTML', 'Редактировать карусель');
    $objResponse->assign('div_adm_edit', 'innerHTML', $sHtml);
    $objResponse->script($sOnReady);
    $objResponse->script("\$('div_adm_reason').setStyle('display', 'none');");
    $objResponse->script("adm_edit_content.editMenuItems = ['', 'Основное'];");
    $objResponse->script("adm_edit_content.userLogin = '******'login']}';");
    $objResponse->script('adm_edit_content.edit();');
    $objResponse->script('xajax_getAdmEditReasons(' . admin_log::ACT_ID_EDIT_FIRST_PAGE . ');');
}
Example #6
0
<?php

if (!$not_load_info) {
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pay_place.php';
    $payPlace = new pay_place($catalog);
    $pp_uids = $payPlace->getUserPlace();
    if (is_array($pp_uids)) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
        $usrs = new users();
        $pp_result = $usrs->getUsers('uid IN (' . implode(',', array_values($pp_uids)) . ')');
        foreach ($pp_result as $k => $v) {
            $toppay_usr[$v['uid']] = $v;
        }
        $pp_h = $payPlace->getAllInfo($pp_uids);
    }
}
$uid = get_uid(false);
$is_show_tizer = false;
//$uid && !is_emp();
?>
<div id="pay_place_carusel" class="b-carusel b-carusel_width_full" style="top:<?php 
echo $caruselTop;
?>
px">
    <div class="b-carusel__body">
        <div class="b-carusel__inner">
            <ul id="top-payed" class="b-carusel__list <?php 
if ($is_show_tizer) {
    ?>
b-carusel__list_width_3196<?php 
}
Example #7
0
//#0027582  аждую минуту обрабатывать запросы на размешение в карусели
pay_place::cronRequest();
//  аждые пол часа обновл¤ем статус рассылок
if (date('i') == 30) {
    require_once "classes/mailer.php";
    $mailer = new mailer();
    $mailer->updateStatusSending();
}
// ночные нестыковки во времени при переходе в следующий день #0021788
if (!in_array((int) date('Hi'), array(2358, 2359))) {
    payed::UpdateProUsers();
}
//@todo: непон¤тно дл¤ чего?
//если юзер провисел 10 сек с момента публикации
//то помечаем его как просмотренный хот¤ его мог никто и неувидеть!
$pp = new pay_place();
$pp->getDoneShow(0);
$user_content = new user_content();
$user_content->releaseDelayedStreams();
$user_content->getQueueCounts();
$user_content->getStreamsQueueCounts();
if (date('i') % 5 == 0) {
    walletAlpha::checkProgressOrders();
}
//  аждые 20 минут пересчитываем счетчики остальных сообществ
if (date('i') % 20 == 0) {
    commune::recalcThemesCountCommunes(null, commune::COMMUNE_BLOGS_ID);
}
if (date('i') % 15 == 0) {
    // проверка статусов платежей paymaster при возврате
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/pmpay.php";
Example #8
0
$res = $payPlace->cron(69683);
//$res = $payPlace->isDone();
var_dump($res);
exit;
*/
//-------------------------------------------------------
/*
$res = pay_place::getTypePlacesInRequest();
print_r($res);
exit;
*/
//-------------------------------------------------------
/*
$catalog = rand(0,1);
$payPlace = new pay_place(isset($catalog) ? $catalog : 1);



$res = $payPlace->cron_test();

print_r($res);
exit;
*/
//----------------------------------------------------
$catalog = rand(0, 1);
$payPlace = new pay_place(isset($catalog) ? $catalog : 1);
$uid = rand(1, 10000);
$options = array('uid' => $uid, 'ad_header' => "Я пользователь #{$uid}", 'ad_text' => "Это текст пользователя {$uid} до 500 символов!", 'num' => rand(1, 10), 'hours' => rand(1, 10));
$res = $payPlace->addUserRequest($options);
var_dump($res);
exit;
Example #9
0
 /**
  * Вывод страницы /gift/ "Подарок".
  */
 public function giftAction()
 {
     include $_SERVER['DOCUMENT_ROOT'] . '/404.php';
     exit;
     /*
      * @deprecated Все что ниже пока не используется
      */
     front::og('tpl')->page = 'gift';
     self::isBlockMoney();
     /**
      * Подключаем AJAX для страницы.
      */
     require_once $_SERVER['DOCUMENT_ROOT'] . '/xajax/bill.common.php';
     front::og('tpl')->script = '/scripts/bill2.js';
     front::og('tpl')->xajax = $xajax;
     front::og('tpl')->mnth = 1;
     // Месяцев оплаты по умолчанию
     $val = $this->uri[0];
     switch ($val) {
         case 'pro':
             // Вывод подстраницы "Аккаунт «PRO»"
             /*
              * Обработка события "Подарить"
              */
             if ($_POST['act']) {
                 $mnth = intval(trim($_POST['mnth']));
                 // месяцев
                 $login = trim(strip_tags($_POST['login']));
                 // логин пользователя
                 $msg = change_q_x(__paramInit('string', null, 'msg', null, 300));
                 $usertype = trim(strip_tags($_POST['usertype']));
                 /**
                  * Подключаем класс для оплаты подарка.
                  */
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/payed.php';
                 $prof = new payed();
                 $tr_id = $_REQUEST['transaction_id'];
                 if (!$tr_id) {
                     $this->account->view_error('Невозможно завершить транзакцию. Попробуйте повторить операцию с самого начала.');
                 }
                 front::og('tpl')->tr_id = $tr_id;
                 front::og('tpl')->login = $login;
                 front::og('tpl')->msg = $msg;
                 front::og('tpl')->mnth = $mnth;
                 /*
                  * Если нет ошибок выводим
                  */
                 if ($mnth > 0 && $login) {
                     // Класс для работы с пользователем
                     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
                     $user = new users();
                     $gid = $user->GetUid($error, $login);
                     $user->GetUser($login);
                     if (!$gid) {
                         $alert['login'] = '******';
                     }
                     if ($gid == get_uid()) {
                         $alert['login'] = '******';
                     }
                     if (defined('SPEC_USER') && get_uid() == SPEC_USER) {
                         $alert['login'] = '******';
                     }
                     if (!$alert) {
                         $role = $user->GetRole($login, $error);
                         /*
                          * Высчитываем тариф для обработки. Тариф зависит от количества месяцев (Действуют специальные скидки)
                          */
                         if (substr($role, 0, 1) != '0') {
                             $tarif = 16;
                         } else {
                             $tarif = 52;
                             if ($mnth == 3) {
                                 $tarif = 66;
                             }
                             if ($mnth == 6) {
                                 $tarif = 67;
                             }
                             if ($mnth == 12) {
                                 $tarif = 68;
                             }
                         }
                         $ok = $prof->GiftOrderedTarif($bill_id, $gift_id, $gid, get_uid(), $tr_id, $mnth, $msg, $tarif);
                         // Оплата подарка
                         if ($ok) {
                             // Посылаем уведомление о подарке и переносим на страницу успешной оплаты
                             $sm = new smail();
                             $sm->NewGift($_SESSION['login'], $login, $msg, $gift_id);
                             $_SESSION['success_aid'] = $bill_id;
                             header("Location: /{$this->name_page}/success/");
                             exit;
                         }
                         unset($msg);
                     }
                 } else {
                     $alert['login'] = '******';
                 }
                 front::og('tpl')->error = $alert;
             }
             front::og('tpl')->display('bill/bill_gift_pro.tpl');
             break;
         case 'main':
             // Вывод подстраницы "Платное размещение в разделе"
             front::og('tpl')->type = 1;
             // Типа размещения = неделя
             /*
              * Обработка события "Подарить" - при нажатии кнопки подарить
              */
             if ($_POST['act']) {
                 $type = intval(trim($_POST['type']));
                 // Сколько недель
                 $login = trim(strip_tags($_POST['login']));
                 $msg = change_q_x(__paramInit('string', null, 'msg', null, 300));
                 /**
                  * Класс для обработки оплаты и взаимодействия механизма вывода.
                  */
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/firstpage.php';
                 $prof = new firstpage();
                 $tr_id = $_REQUEST['transaction_id'];
                 if (!$tr_id) {
                     $this->account->view_error('Невозможно завершить транзакцию. Попробуйте повторить операцию с самого начала.');
                 }
                 front::og('tpl')->tr_id = $tr_id;
                 front::og('tpl')->login = $login;
                 front::og('tpl')->msg = $msg;
                 front::og('tpl')->type = $type;
                 if (!$type) {
                     $alert['type'] = 'Не выбрано количество недель.';
                 } else {
                     $d_time = "{$type} неделя";
                     $intv = "{$type} weeks";
                     if ($login) {
                         require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
                         $user = new users();
                         $gid = $user->GetUid($error, $login);
                         $user->GetUser($login);
                         if (!$gid) {
                             $alert['login'] = '******';
                         }
                         if (is_emp($user->role)) {
                             $alert['login'] = '******';
                         }
                         if ($gid == get_uid()) {
                             $alert['login'] = '******';
                         }
                         if (defined('SPEC_USER') && get_uid() == SPEC_USER) {
                             $alert['login'] = '******';
                         }
                         if (!$alert) {
                             $order_id = $prof->Gift($bill_id, $gift_id, $gid, get_uid(), $tr_id, $intv, 17, $msg, $type);
                             if (!$order_id) {
                                 header('Location: /bill/fail/');
                                 // Если оплата не прошла
                                 exit;
                             } else {
                                 // Уведомление на почту
                                 $sm = new smail();
                                 $sm->NewGift($_SESSION['login'], $login, $msg, $gift_id);
                                 $_SESSION['success_aid'] = $bill_id;
                                 header("Location: /{$this->name_page}/success/");
                                 // Если все прошло успешно переносим на страницу - Успешно
                                 exit;
                             }
                         }
                     } else {
                         $alert['login'] = '******';
                     }
                 }
                 front::og('tpl')->error = $alert;
             }
             front::og('tpl')->display('bill/bill_gift_main.tpl');
             break;
         case 'fronttop':
             // Обработка подстраницы "Платные места наверху главной страницы"
             // Событие нажатия кнопки "Подарить"
             if ($_POST['act']) {
                 $login = trim(strip_tags($_POST['login']));
                 // Логин
                 $msg = change_q_x(__paramInit('string', null, 'msg', null, 300));
                 $tr_id = $_REQUEST['transaction_id'];
                 if (!$tr_id) {
                     $this->account->view_error('Невозможно завершить транзакцию. Попробуйте повторить операцию с самого начала.');
                 }
                 front::og('tpl')->tr_id = $tr_id;
                 front::og('tpl')->login = $login;
                 front::og('tpl')->msg = $msg;
                 if ($login) {
                     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
                     $user = new users();
                     $gid = $user->GetUid($error, $login);
                     $user->GetUser($login);
                     if (is_emp($user->role)) {
                         $alert['login'] = '******';
                     }
                     if ($gid == get_uid()) {
                         $alert['login'] = '******';
                     }
                     if (defined('SPEC_USER') && get_uid() == SPEC_USER) {
                         $alert['login'] = '******';
                     }
                     if (!$gid) {
                         $alert['login'] = '******';
                     }
                     if (!$alert) {
                         /**
                          * Класс для работы с оплатой подарка.
                          */
                         require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pay_place.php';
                         $place = new pay_place();
                         $tarif = 69;
                         $profs = $place->gift($bill_id, $gift_id, $tr_id, $gid, get_uid(), $msg, $tarif);
                         // Оплачиваем подарок
                         if ($profs) {
                             $_SESSION['success_aid'] = $bill_id;
                             header("Location: /{$this->name_page}/success/");
                             // Все прошло успешно
                             exit;
                         }
                     }
                 } else {
                     $alert['login'] = '******';
                 }
                 front::og('tpl')->error = @$alert;
                 // Переменная ошибок
             }
             front::og('tpl')->display('bill/bill_gift_fronttop.tpl');
             break;
         case 'cattop':
             // Обработка подстраницы "Платные места наверху каталога"
             // Событие нажатия кнопки "Подарить"
             if ($_POST['act']) {
                 $login = trim(strip_tags($_POST['login']));
                 // Логин
                 $msg = change_q_x(__paramInit('string', null, 'msg', null, 300));
                 $tr_id = $_REQUEST['transaction_id'];
                 if (!$tr_id) {
                     $this->account->view_error('Невозможно завершить транзакцию. Попробуйте повторить операцию с самого начала.');
                 }
                 front::og('tpl')->tr_id = $tr_id;
                 front::og('tpl')->login = $login;
                 front::og('tpl')->msg = $msg;
                 if ($login) {
                     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
                     $user = new users();
                     $gid = $user->GetUid($error, $login);
                     $user->GetUser($login);
                     if (!$gid) {
                         $alert['login'] = '******';
                     }
                     if (is_emp($user->role)) {
                         $alert['login'] = '******';
                     }
                     if ($gid == get_uid()) {
                         $alert['login'] = '******';
                     }
                     if (defined('SPEC_USER') && get_uid() == SPEC_USER) {
                         $alert['login'] = '******';
                     }
                     if (!$alert) {
                         /**
                          * Класс для работы с оплатой подарка.
                          */
                         require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pay_place.php';
                         $place = new pay_place(1);
                         $tarif = 83;
                         $profs = $place->gift($bill_id, $gift_id, $tr_id, $gid, get_uid(), $msg, $tarif);
                         // Оплачиваем подарок
                         if ($profs) {
                             $_SESSION['success_aid'] = $bill_id;
                             header("Location: /{$this->name_page}/success/");
                             // Все прошло успешно
                             exit;
                         }
                     }
                 } else {
                     $alert['login'] = '******';
                 }
                 front::og('tpl')->error = @$alert;
                 // Переменная ошибок
             }
             front::og('tpl')->display('bill/bill_gift_cattop.tpl');
             break;
         case 'catalog':
             // Обработка подстраницы "Платные места в каталоге в подарок"
             // Событие нажатия кнопки "Подарить"
             front::og('tpl')->filter_categories = professions::GetAllGroupsLite(true);
             front::og('tpl')->filter_subcategories = professions::GetAllProfessions(1);
             $x = new op_codes();
             $x->GetRow(84);
             $top_p = $x->sum;
             $x->GetRow(85);
             $inside_p = $x->sum;
             front::og('tpl')->price_top = $top_p;
             front::og('tpl')->price_inside = $inside_p;
             if ($_POST['act']) {
                 $login = trim(strip_tags($_POST['login']));
                 // Логин
                 $msg = change_q_x(__paramInit('string', null, 'msg', null, 300));
                 $pf_category = __paramInit('int', null, 'pf_category', 0);
                 $pf_subcategory = __paramInit('int', null, 'pf_subcategory', 0);
                 //echo '<pre>'; print_r($_POST); exit('</pre>');
                 $tr_id = $_REQUEST['transaction_id'];
                 if (!$tr_id) {
                     $this->account->view_error('Невозможно завершить транзакцию. Попробуйте повторить операцию с самого начала.');
                 }
                 front::og('tpl')->tr_id = $tr_id;
                 front::og('tpl')->login = $login;
                 front::og('tpl')->msg = $msg;
                 front::og('tpl')->pf_category = $pf_category;
                 front::og('tpl')->pf_subcategory = $pf_subcategory;
                 if ($login) {
                     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
                     $user = new users();
                     $gid = $user->GetUid($error, $login);
                     $user->GetUser($login);
                     if (!$gid) {
                         $alert['login'] = '******';
                     }
                     if (is_emp($user->role)) {
                         $alert['login'] = '******';
                     }
                     if ($gid == get_uid()) {
                         $alert['login'] = '******';
                     }
                     if (defined('SPEC_USER') && get_uid() == SPEC_USER) {
                         $alert['login'] = '******';
                     }
                     $weeks = (int) $_POST['weeks'];
                     if (!$weeks) {
                         $alert['week'] = 'Данное поле является обязательным';
                     }
                     if (!$alert) {
                         require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/firstpage.php';
                         $prof = new firstpage();
                         $pf_category = (int) $_POST['pf_category'];
                         $pf_subcategory = (int) $_POST['pf_subcategory'];
                         $page = !$pf_subcategory ? 0 : $pf_subcategory;
                         $place_info = array($page => $weeks);
                         $op_code = $page ? 85 : 84;
                         //                                                                               require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/account.php");
                         //                                                                                $account = new account();
                         //                                                                                $account ->/ view_error("Невозможно завершить транзакцию. Попробуйте повторить операцию с самого начала.");
                         $account = new account();
                         if ($prof->GiftOrderedCat($bill_id, $gift_id, $gid, get_uid(), $tr_id, $page, (int) $weeks, $op_code, $msg)) {
                             $_SESSION['success_aid'] = $bill_id;
                             header("Location: /{$this->name_page}/success/");
                             // Все прошло успешно
                             exit;
                         }
                     }
                 } else {
                     $alert['login'] = '******';
                 }
                 front::og('tpl')->error = @$alert;
                 // Переменная ошибок
             }
             front::og('tpl')->display('bill/bill_gift_catalog.tpl');
             break;
         default:
             /*
              * По умолчанию выводим главную страницу раздела "Подарки"
              */
             front::og('tpl')->display('bill/bill_gift.tpl');
             break;
     }
 }
Example #10
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/pay_place.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
if (isset($_GET['user'])) {
    $pp = new pay_place();
    $usr = new Users();
    $uid = $usr->GetUid($error, pg_escape_string($_GET['user']));
    if ($uid == null) {
        echo "Данного юзера не существует";
        die;
    }
    //$role = $usr->GetRole(pg_escape_string($_GET['user']), $error);
    $r = $pp->addUser($uid);
    if (!$r) {
        echo "Ошибка";
        die;
    }
    echo "Вы будете показаны через " . $pp->getTimeShow() . " мин";
}
Example #11
0
 /**
  * Оплата услуг.
  * 
  * @param array $order Данные по оплачивоемой услуге
  *
  * @return bool
  */
 public function paymentOrder($order)
 {
     $_op_code = self::getOpCodeByDiscount($order['op_code']);
     switch ($_op_code) {
         // Верификация банковской картой через ЯКассу
         case 191:
             $error = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $order['descr'], $order['comment']);
             if (!$error) {
                 $success = true;
                 //Устанавливаем флаг верификации
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/Verification.php';
                 $verify = new Verification();
                 $verify->cardYK($this->user['uid']);
                 //Обновляем сессию
                 //@todo: эта штука не работает!
                 $session = new session();
                 $session->UpdateVerification($this->user['login']);
                 //Обновляем имя и фамилию
                 $fio = mb_unserialize($order['option']);
                 if (isset($fio['uname']) && isset($fio['usurname'])) {
                     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
                     $u = new users();
                     $u->GetUserByUID($this->user['uid']);
                     $u->uname = $fio['uname'];
                     $u->usurname = $fio['usurname'];
                     $u->Update($this->user['uid'], $db_errors);
                 }
                 //Назначаем возврат
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/billing/BillPayback.php';
                 BillPayback::getInstance()->requestPayback($order['id'], $this->paymentSysParams['invoiceId'], $order['ammount']);
             }
             break;
             //------------------------------------------------------------------
             // Верификация через FF
         //------------------------------------------------------------------
         // Верификация через FF
         case 117:
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/Verification.php';
             $error = $this->account->Buy($account_operation_id, $this->transaction, Verification::FF_OP_CODE, $this->user['uid'], $order['comment'], $order['descr'], 1, 0);
             $verify = new Verification();
             $verify->data = unserialize($order['option']);
             $this->_db->query('UPDATE verify_ff SET is_pro = ?, bill_id = ?  WHERE id = ?', false, $account_operation_id, $order['src_id']);
             if ($verify->verify($this->user['uid'])) {
                 $this->_db->query('UPDATE verify_ff SET result = TRUE WHERE id = ?', $order['src_id']);
                 $success = true;
             }
             break;
             //------------------------------------------------------------------
             // Конкурс
         //------------------------------------------------------------------
         // Конкурс
         case 9:
         case 106:
         case 121:
         case 122:
         case 123:
         case 124:
         case 125:
         case 126:
         case 127:
         case 128:
         case 129:
         case 130:
             // Платный конкурс
         // Платный конкурс
         case 86:
             // Платный проект (вакансия, устаревший опкод)
         // Платный проект (вакансия, устаревший опкод)
         case 53:
             //Покупка вакансии
         //Покупка вакансии
         case 113:
             //пользователь не PRO
         //пользователь не PRO
         case 192:
             //пользователь PRO
             //Платные услуги проектов
         //пользователь PRO
         //Платные услуги проектов
         case 138:
         case 139:
         case 140:
         case 141:
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/drafts.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/uploader/uploader.php';
             // Публикуем платный проект
             if ($order['parent_table'] == 'draft_projects') {
                 $draft_id = $order['parent_id'];
                 $this->project_key = md5(uniqid($this->user['uid']));
                 $tmpPrj = new tmp_project($this->project_key);
                 $tmpPrj->initFromDraft($draft_id, $this->user['uid']);
                 $tproject = $tmpPrj->getProject();
                 $isMovedToVacancy = false;
                 // Нет конкурса значит его уже опубликовали и оплатили, оставляем деньги на личном счете
                 if ((int) $tproject['prj_id'] <= 0) {
                     // Не тратим деньги на такой конкурс
                     if ($tmpPrj->isKonkurs() && strtotime($tproject['end_date']) <= time()) {
                         $success = true;
                         break;
                     }
                     $error = $tmpPrj->saveProject($this->user['uid'], $proj, $this->ordersPromoCodes);
                     $success = !$error;
                     // Отработали все по конкурсу удаляем его чтобы не мешал (после отработки всех операций)
                     $this->setAfterQuery($this->_db->parse('DELETE FROM draft_projects WHERE id = ? AND uid = ?', $draft_id, $this->user['uid']), $order['parent_id']);
                     $sql = 'UPDATE draft_projects SET prj_id = ? WHERE id = ? AND uid = ?';
                     $this->_db->query($sql, $proj['id'], $draft_id, $this->user['uid']);
                 } else {
                     $success = true;
                 }
             } elseif ($order['parent_table'] == 'projects') {
                 $prj_id = $order['parent_id'];
                 $this->project_key = md5(uniqid($this->user['uid']));
                 $tmpPrj = new tmp_project($this->project_key);
                 $tmpPrj->setInitFromDB($prj_id);
                 $tproject = $tmpPrj->getProject();
                 $isMovedToVacancy = $tmpPrj->isStateMovedToVacancy();
                 // Если закрыт или заблокирован не тратим деньги
                 if ($tproject['closed'] == 't' || $tproject['is_blocked'] == 't') {
                     $success = true;
                     break;
                 }
                 switch ($order['option']) {
                     case 'top':
                         $tmpPrj->setAddedTopDays($order['op_count']);
                         break;
                     case 'logo':
                         $LogoFile = new CFile($order['src_id']);
                         $tmpPrj->initLogo($LogoFile, $order['descr']);
                         break;
                     case 'urgent':
                         $tmpPrj->setProjectField('urgent', 't');
                         break;
                     case 'hide':
                         $tmpPrj->setProjectField('hide', 't');
                         break;
                     case 'office':
                         $tmpPrj->setProjectField('old_state', $tproject['state']);
                         $tmpPrj->setProjectField('state', projects::STATE_PUBLIC);
                         //Если оплачивается не перемещенная вакансия
                         //то работаем как обычно и подымаем вверх
                         if ($tproject['state'] != projects::STATE_MOVED_TO_VACANCY) {
                             $tmpPrj->setProjectField('post_now', true);
                         }
                         break;
                 }
                 $error = $tmpPrj->saveProject($this->user['uid'], $proj, $this->ordersPromoCodes);
                 $success = !$error;
                 if ($success) {
                     if (isset($tmpPrj->account_operation_id) && $tmpPrj->account_operation_id > 0) {
                         $account_operation_id = $tmpPrj->account_operation_id;
                     }
                     switch ($order['option']) {
                         case 'office':
                             if ($tproject['state'] == projects::STATE_MOVED_TO_VACANCY) {
                                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/smail.php';
                                 $smail = new smail();
                                 $smail->sendMovedToVacancySuccessPayed($tproject);
                                 require_once $_SERVER['DOCUMENT_ROOT'] . '/guest/models/GuestInviteModel.php';
                                 $guestInviteModel = new GuestInviteModel();
                                 $guestInviteModel->updateDatePublicBySrc($prj_id, array(GuestConst::TYPE_PROJECT, GuestConst::TYPE_VACANCY));
                                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/autoresponse.php';
                                 $autoresponse = new autoresponse();
                                 $autoresponse->reduceByProject($prj_id);
                             }
                             break;
                     }
                 }
             }
             //Сохраняем, чтобы показать попап юзеру
             $memBuff = new memBuff();
             $memBuff->add('bill_ok_project_' . $this->user['uid'], $proj['id']);
             //Если это оплата вакансии или конкусра то предлагаем еще купить платные опции
             if (in_array($order['option'], array('office', 'contest')) && !$isMovedToVacancy) {
                 $memBuff->add('bill_ok_project_payed_' . $this->user['uid'], true);
             }
             break;
             //------------------------------------------------------------------
             // Платное место в карусели
         //------------------------------------------------------------------
         // Платное место в карусели
         case 65:
             // На главной странице
             $catalog = 0;
         case 73:
             // В каталоге
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pay_place.php';
             $payPlace = new pay_place(isset($catalog) ? $catalog : 1);
             $buyMain = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $order['comment'], $order['descr'], $order['op_count'], 0, $order['promo_code']);
             if ($buyMain === 0) {
                 $options = unserialize($order['option']);
                 if (isset($options['adHead'])) {
                     //поддержка старого режима
                     $success = $payPlace->addUser($this->user['uid'], $options['adHead'], $options['adText'], $options['adImg']);
                 } else {
                     $success = $payPlace->addUserRequest($this->user['uid'], $options);
                 }
             }
             break;
             //------------------------------------------------------------------
             // ПРО аккаунт фрилансеры
         //------------------------------------------------------------------
         // ПРО аккаунт фрилансеры
         case 47:
             // Тестовый ПРО на 1 неделю
             if (payed::IsUserWasPro($this->user['uid'])) {
                 return false;
                 break;
             }
         case 15:
             // Про на 1 месяц (emp)
         // Про на 1 месяц (emp)
         case 48:
             // Про на 1 месяц (frl)
         // Про на 1 месяц (frl)
         case 118:
             // Про на 3 месяца (emp)
         // Про на 3 месяца (emp)
         case 49:
             // Про на 3 месяца (frl)
         // Про на 3 месяца (frl)
         case 119:
             // Про на 6 месяцeв (emp)
         // Про на 6 месяцeв (emp)
         case 50:
             // Про на 6 месяцев (frl)
         // Про на 6 месяцев (frl)
         case 120:
             // Про на 1 год (emp)
         // Про на 1 год (emp)
         case 51:
             // Про на 1 год (frl)
         // Про на 1 год (frl)
         case 132:
             // Про на 1 день (frl)
         // Про на 1 день (frl)
         case 131:
             // Про на 1 неделю (frl)
         // Про на 1 неделю (frl)
         case 163:
             // Тестовый ПРО на месяц
         // Тестовый ПРО на месяц
         case 164:
             // PROFI на 1 месяц
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/payed.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/employer.php';
             $payed = new payed();
             $user = is_emp($this->user['role']) ? new employer() : new freelancer();
             $success = $payed->SetOrderedTarif($this->user['uid'], $this->transaction, $order['op_count'], $order['comment'], $order['op_code'], $order['promo_code'], $error);
             if ($success) {
                 if (isset($payed->account_operation_id) && $payed->account_operation_id > 0) {
                     $account_operation_id = $payed->account_operation_id;
                 }
                 // Обновим сессию сразу!
                 if (get_uid(false) == $this->user['uid']) {
                     $_SESSION['pro_last'] = payed::ProLast($this->user['login']);
                     $_SESSION['pro_last'] = $_SESSION['pro_last']['is_freezed'] ? false : $_SESSION['pro_last']['cnt'];
                     if ($_SESSION['pro_last']['is_freezed']) {
                         $_SESSION['payed_to'] = $_SESSION['pro_last']['cnt'];
                     }
                 } else {
                     $membuff = new memBuff();
                     $membuff->set('is_changed_pro_' . $this->user['uid'], true);
                     //Этот подход не работает
                     //$session = new session();
                     //$session->UpdateProEndingDate($this->user['login']);
                 }
                 if ($order['auto'] == 't') {
                     $user->setPROAutoProlong('on', $this->user['uid']);
                 } else {
                     $user->setPROAutoProlong('off', $this->user['uid']);
                 }
                 //Опубликовать перемещенные вакансии при покупке ПРО
                 //@todo: Теперь вакансии для всех платные разница лишь в цене для ПРО дешевле
                 //поэтому отключаем публикацию после покупки ПРО
                 //https://beta.free-lance.ru/mantis/view.php?id=28579
                 /*
                                     if (is_emp($this->user['role'])) { 	 
                                         require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php"); 	
                                         $project = new projects();	 
                                         $project->publishedMovedToVacancy($this->user); 	
                                     }*/
                 //Чистим кеш каталога PROFI пользователей
                 if ($order['op_code'] == 164) {
                     freelancer::clearCacheProfiCatalog();
                 }
             }
             break;
             //------------------------------------------------------------------
         //------------------------------------------------------------------
         case 45:
             // рассылка по каталогу
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/masssending.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/messages.php';
             $masssending = masssending::Get($order['parent_id']);
             $masssending = $masssending[0];
             $error = $this->account->Buy($account_operation_id, $this->transaction, masssending::OPER_CODE, $this->user['uid'], $order['descr'], $order['comment'], $masssending['pre_sum'], 0, $order['promo_code']);
             if ($error) {
                 break;
             }
             masssending::UpdateAcOpID($order['parent_id'], $account_operation_id);
             $success = (bool) messages::Masssending($masssending['user_id'], $masssending['id'], $masssending['msgtext'], $masssending['posted_time']);
             break;
             //------------------------------------------------------------------
             /*
              * Погашение задолженности
              */
         //------------------------------------------------------------------
         /*
          * Погашение задолженности
          */
         case 135:
             $error = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $order['descr'], $order['comment'], 1, 1, 0, 0, $order['ammount']);
             if (!$error) {
                 $success = true;
                 //Начисление погашенной комиссии и удаление блокировки ТУ
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/tu/models/TServiceOrderModel.php';
                 TServiceOrderModel::model()->clearDebt($this->user['uid']);
             }
             break;
             //-------------------------------------------------------------------
             /*
              * Операции над бизнес логикой резерва средств 
              * при успешном зачислении денег
              */
         //-------------------------------------------------------------------
         /*
          * Операции над бизнес логикой резерва средств 
          * при успешном зачислении денег
          */
         case 136:
             $success = false;
             $data = @$this->list_service[$order['id']]['info'];
             if (!$data) {
                 break;
             }
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/reserves/ReservesModelFactory.php';
             $reserveInstance = ReservesModelFactory::getInstance($data['type']);
             //Уже была зарезервирована или нет нужный параметров то
             //ничего не покупаем деньги остаются на ЛС
             if (!$reserveInstance || !isset($this->paymentSysParams['invoiceId'])) {
                 break;
             }
             //Невозможно сменить статус сделки выходим
             $reserveInstance->setReserveData($data);
             if (!$reserveInstance->allowChangeStatus(ReservesModel::STATUS_RESERVE)) {
                 break;
             }
             $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $order['descr'], $order['comment'], $order['ammount']);
             if ($ret === 0) {
                 //Успешно купили услугу и теперь меняем статус резерва
                 $data['invoice_id'] = $this->paymentSysParams['invoiceId'];
                 $data['acc_op_id'] = $account_operation_id;
                 $reserveInstance->setReserveData($data);
                 $success = $reserveInstance->changeStatus(ReservesModel::STATUS_RESERVE);
             }
             break;
             //------------------------------------------------------------------
             /*
              * Завершение покупки автоответов.
              */
         //------------------------------------------------------------------
         /*
          * Завершение покупки автоответов.
          */
         case 137:
             $success = false;
             $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $order['descr'], $order['comment'], $order['ammount'], 1, $order['promo_code']);
             if ($ret === 0 && isset($order['parent_id']) && intval($order['parent_id'])) {
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/autoresponse.php';
                 autoresponse::$db = $GLOBALS['DB'];
                 // Активация покупки услуги автоответа
                 if ($autoresponse = autoresponse::get($order['parent_id'])) {
                     $autoresponse->activate();
                     $success = true;
                 }
             }
             break;
             //------------------------------------------------------------------
             // Закрепление в каталоге фрилансеров
         //------------------------------------------------------------------
         // Закрепление в каталоге фрилансеров
         case 142:
             // В корневом разделе
         // В корневом разделе
         case 143:
             // В разделе
             $is_spec = false;
         case 144:
             // В подразделе
             if (!isset($is_spec)) {
                 $is_spec = true;
             }
             $success = false;
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer_binds.php';
             $freelancer_binds = new freelancer_binds();
             $freelancer_binds->prepare($this->user['uid'], $order['src_id'], $is_spec, $order['op_count']);
             $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $freelancer_binds->bind_info['descr'], $freelancer_binds->bind_info['comment'], $order['ammount'], 1, $order['promo_code']);
             if ($ret === 0) {
                 $success = $freelancer_binds->create();
             }
             break;
             //------------------------------------------------------------------
             // Продление закрепления в каталоге фрилансеров
         //------------------------------------------------------------------
         // Продление закрепления в каталоге фрилансеров
         case 148:
             // В корневом разделе
         // В корневом разделе
         case 149:
             // В разделе
             $is_spec = false;
         case 150:
             // В подразделе
             if (!isset($is_spec)) {
                 $is_spec = true;
             }
             $success = false;
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer_binds.php';
             $freelancer_binds = new freelancer_binds();
             $bind_id = $freelancer_binds->isUserBinded($this->user['uid'], $order['src_id'], $is_spec);
             $ret = true;
             if ($bind_id) {
                 $freelancer_binds->getProlongInfo($this->user['uid'], $order['src_id'], $is_spec, $order['op_count']);
                 $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $freelancer_binds->bind_info['descr'], $freelancer_binds->bind_info['comment'], $order['ammount']);
             }
             if ($ret === 0) {
                 $success = $freelancer_binds->prolong($bind_id, $order['op_count'], $order['src_id'], $is_spec);
             }
             break;
             //------------------------------------------------------------------
             // Поднятие закрепления в каталоге фрилансеров
         //------------------------------------------------------------------
         // Поднятие закрепления в каталоге фрилансеров
         case 151:
             // В корневом разделе
         // В корневом разделе
         case 152:
             // В разделе
             $is_spec = false;
         case 153:
             // В подразделе
         // В подразделе
         case 194:
             //Оплата из буфера
             if (!isset($is_spec)) {
                 $is_spec = $order['src_id'] > 0;
             }
             $success = false;
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer_binds.php';
             $freelancer_binds = new freelancer_binds();
             $bind_id = $freelancer_binds->isUserBinded($this->user['uid'], $order['src_id'], $is_spec);
             if ($bind_id) {
                 $freelancer_binds->getUpInfo($this->user['uid'], $order['src_id'], $is_spec);
                 $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $freelancer_binds->bind_info['descr'], '', $order['ammount']);
                 if ($ret === 0) {
                     $success = $freelancer_binds->up($bind_id, $order['src_id'], $is_spec);
                 }
             }
             break;
             //------------------------------------------------------------------
             // Закрепление/продление в каталоге услуг
         //------------------------------------------------------------------
         // Закрепление/продление в каталоге услуг
         case 155:
             // В лендинге
         // В лендинге
         case 156:
             // В корневом разделе
         // В корневом разделе
         case 157:
             // В разделе
         // В разделе
         case 158:
             // В подразделе
             $success = false;
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_binds.php';
             $tservices_binds = new tservices_binds(tservices_binds::KIND_LANDING);
             $tservices_binds->setKindByOpCode($_op_code);
             $option = unserialize($order['option']);
             $tservice_id = isset($option['tservice_id']) ? $option['tservice_id'] : $order['option'];
             $is_prolong = isset($option['is_prolong']) ? $option['is_prolong'] : false;
             $tservices_binds->prepare($this->user['uid'], $tservice_id, $order['src_id'], $order['op_count'], $is_prolong);
             if ($tservices_binds->bind_info) {
                 $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $tservices_binds->bind_info['descr'], $tservices_binds->bind_info['comment'], $order['ammount']);
                 if ($ret === 0) {
                     $success = $is_prolong ? $tservices_binds->update() : $tservices_binds->create();
                 }
             }
             break;
             //------------------------------------------------------------------
             // Поднятие закрепления в каталоге услуг
         //------------------------------------------------------------------
         // Поднятие закрепления в каталоге услуг
         case 159:
             // В лендинге
         // В лендинге
         case 160:
             // В корневом разделе
         // В корневом разделе
         case 161:
             // В разделе
         // В разделе
         case 162:
             // В подразделе
         // В подразделе
         case 193:
             //Оплата из буфера
             $success = false;
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_binds.php';
             $tservices_binds = new tservices_binds(tservices_binds::KIND_LANDING);
             $tservices_binds->setKindByOpCode($_op_code);
             $bind = $tservices_binds->getItemById($order['src_id']);
             $tservices_binds->makeUpInfo($bind);
             if ($tservices_binds->bind_info) {
                 $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $tservices_binds->bind_info['descr'], $tservices_binds->bind_info['comment'], $order['ammount']);
                 if ($ret === 0) {
                     $success = $tservices_binds->update();
                 }
             }
             break;
     }
     if ($success) {
         $update = array('status' => self::STATUS_COMPLETE);
         $this->update($order['id'], $update);
         $memBuff = new memBuff();
         $memBuff->delete('last_operation_' . $order['uid'] . '_' . $order['service']);
         //Если только что была оплата из яндекс.кассы
         if ($this->paymentSysParams['invoiceId']) {
             //Фиксируем ID транзакции
             $label = op_codes::getLabel($order['op_code']);
             if (isset($account_operation_id) && $account_operation_id > 0) {
                 $label = (empty($label) ? '' : "{$label},") . "trans_{$account_operation_id}";
             }
             // Посылаем данные о покупке в google analytics
             $this->_db->query("SELECT pgq.insert_event('statistic', 'service_payed', ?)", http_build_query(array('is_emp' => is_emp($this->user['role']), 'label' => $label, 'ammount' => floatval($order['ammount']), 'cid' => $this->getCid())));
         }
     }
     return $success;
 }
Example #12
0
<?php

if (isset($is_show_tizer) && $is_show_tizer == true) {
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/quick_payment/quickPaymentPopupCarusel.php";
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/pay_place.php";
    $popupId = quickPaymentPopupCarusel::getInstance()->getPopupId();
    $payPlace = new pay_place($catalog);
    $payPlaceUserRequest = $payPlace->getUserRequest($uid);
    $pos = array_search($uid, $pp_uids);
    ?>
        <li id="carusel_tizer" class="b-carusel__item">
             <div class="b-pay-tu b-pay-tu_car">
               <a id="carusel_tizer_close" class="b-pay-tu__close" href="javascript:void(0);"></a>
               <a class="b-pay-tu__link b-pay-tu__link_color_6db335" data-popup="<?php 
    echo $popupId;
    ?>
" href="javascript:void(0);">
                   <?php 
    if (@$payPlaceUserRequest['num'] == 0 && ($pos === false || $pos >= 5)) {
        ?>
                   <span class="b-pay-tu__decor">Добавьте рекламу своих услуг</span><br/>и заявите о себе за <?php 
        echo pay_place::getPrice();
        ?>
 руб.
                   <?php 
    } elseif ($payPlaceUserRequest['num'] == 0 && $pos < 5) {
        ?>
                   <span class="b-pay-tu__decor">Купите несколько объявлений</span><br/>
                   размещайтесь автоматически
                   <?php 
    } else {
Example #13
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/pay_place.php";
$payPlace = new pay_place();
print_r($payPlace->getUserHistory());
Example #14
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pay_place.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
if (isset($_GET['user'])) {
    $pp = new pay_place();
    $usr = new Users();
    $uid = $usr->GetUid($error, pg_escape_string($_GET['user']));
    if ($uid == null) {
        echo 'Данного юзера не существует';
        die;
    }
    //$role = $usr->GetRole(pg_escape_string($_GET['user']), $error);
    $r = $pp->addUser($uid);
    if (!$r) {
        echo 'Ошибка';
        die;
    }
    echo 'Вы будете показаны через ' . $pp->getTimeShow() . ' мин';
}
 /**
  * Покупка места в карусели на главной и странице каталога.
  * */
 private function setCatalogOrMainPageRoundabout()
 {
     global $DB;
     $uid = (int) $_POST['uid'];
     $row = $DB->row("SELECT role, uname, usurname, login, sum  FROM users LEFT JOIN account ON account.uid = users.uid \n                          WHERE users.uid = {$uid}");
     $role = $row['role'][0];
     $user = $row['uname'] . ' ' . $row['usurname'] . ' [' . $row['login'] . ']';
     $sum = $row['sum'];
     if ($role !== '0') {
         $this->jsonError('Пользователь не найден или является работодателем');
     }
     $date = $_POST['date'];
     $f = preg_match("#[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}#", $date, $m);
     if (!$f) {
         $date = false;
     }
     if ($uid) {
         $catalog = $_POST['type'] == 'catalog';
         if ($_POST['type'] == 'catalog') {
             $tarif = 73;
         } elseif ($_POST['type'] == 'main') {
             $tarif = 65;
         }
         $payPlace = new pay_place($catalog ? 1 : 0);
         $account = new account();
         $transaction_id = $account->start_transaction($uid, $tr_id);
         if (($buy = $account->Buy($id, $transaction_id, $tarif, $uid, 'Оплата новых платных мест за FM', 'Оплачено', 1)) === 0) {
             $payPlace->addUser($uid);
             $t = intval($payPlace->getTimeShow());
             $msg = "{$user} будет размещен " . ($catalog ? 'в <a href="/freelancers/">каталоге</a> ' : 'на <a href="/">главной странице</a> ') . ($t == 0 ? 'сейчас' : "через {$t} минут" . ($t == 1 ? 'у' : ($t > 1 && $t < 5 ? 'ы' : ''))) . '.';
             $this->jsonOk('msg', $msg);
         } else {
             $msg = "В данный момент на счету у {$user} {$sum} FM. <a href=\"/bill\" target=\"_blank\">Пополнить счет</a><br/><br/>";
             $this->jsonError($msg);
         }
     }
 }