Example #1
0
// информируем, что у юзера нет прав и нужно стать майнером
$miners_only = array('my_cf_projects', 'new_cf_project', 'cash_requests_in', 'cash_requests_out', 'change_node_key', 'voting', 'geolocation', 'promised_amount_list', 'promised_amount_add', 'holidays_list', 'new_holidays', 'points', 'tasks', 'change_host', 'new_user', 'change_commission');
if (in_array($tpl_name, $miners_only)) {
    $miner_id = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `miner_id`\n\t\t\tFROM `" . DB_PREFIX . "users`\n\t\t\tLEFT JOIN `" . DB_PREFIX . "miners_data` ON `" . DB_PREFIX . "users`.`user_id` = `" . DB_PREFIX . "miners_data`.`user_id`\n\t\t\tWHERE `" . DB_PREFIX . "users`.`user_id` = {$user_id}\n\t\t\tLIMIT 1\n\t\t\t", 'fetch_one');
    //print $db->printsql();
    if (!$miner_id) {
        echo "\n\t\t\t\t <div class=\"alert alert-danger alert-dismissable\" style='margin-top: 30px'><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button>\n\t\t\t\t <h4>Warning!</h4>\n\t\t\t\t <div>{$lng['only_for_miners']}</div>\n\t\t\t\t </div>\n\t\t\t\t ";
    }
}
// информируем, что необходимо вначале сменить праймари-ключ
//$primary_key_alert = array('wallets_list', 'upgrade', 'upgrade_0', 'upgrade_1', 'upgrade_2', 'upgrade_3', 'upgrade_4', 'upgrade_5', 'notifications');
//if (in_array($tpl_name, $primary_key_alert)) {
$log_id = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `log_id`\n\t\t\tFROM `" . DB_PREFIX . "users`\n\t\t\tWHERE `user_id` = {$user_id}\n\t\t\tLIMIT 1\n\t\t\t", 'fetch_one');
if (!$log_id) {
    // проверим, есть ли запросы на смену в тр-ях
    $last_tx = get_last_tx($user_id, types_to_ids(array('change_primary_key')), 1);
    if (!$last_tx) {
        // юзер еще не начинал смену ключа
        $text = $lng['alert_change_primary_key'];
    } else {
        if ($last_tx[0]['error'] || empty($last_tx[0]['queue_tx']) && empty($last_tx[0]['tx']) || time() - $last_tx[0]['time_int'] > 3600) {
            $text = $lng['please_try_again_change_key'];
        } else {
            $text = $lng['please_wait_changing_key'];
        }
    }
    echo "\n\t\t\t\t  <div class=\"alert alert-danger alert-dismissable\" style='margin-top: 30px'><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button>\n\t\t\t\t  <h4>{$lng['warning']}</h4>\n\t\t\t\t  <div>{$text}</div>\n\t\t\t\t  </div>\n\t\t\t\t  ";
} else {
    // возможно юзер еще не успел перелогинется после того, как в блок попала тр-ия смены его ключа
    /*if (!$_SESSION['key_changed']) {
    			unset($_SESSION['user_id']);
Example #2
0
<?php

if (!defined('DC')) {
    die("!defined('DC')");
}
// уведомления
$tpl['alert'] = @$_REQUEST['parameters']['alert'];
$tpl['currency_list'] = get_currency_list($db);
$tpl['currency_id'] = intval(@$_REQUEST['parameters']['currency_id']);
if (!$tpl['currency_id']) {
    $tpl['currency_id'] = 150;
}
if (empty($_SESSION['restricted'])) {
    // то, что еще не попало в блоки.
    $res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, '
			SELECT *
			FROM `' . DB_PREFIX . MY_PREFIX . 'my_promised_amount`
			');
    while ($row = $db->fetchArray($res)) {
        $tpl['promised_amount_list']['my_pending'][] = $row;
    }
}
$tpl['variables'] = ParseData::get_all_variables($db);
get_promised_amounts($user_id);
$tpl['limits_text'] = str_ireplace(array('[limit]', '[period]'), array($tpl['variables']['limit_promised_amount'], $tpl['periods'][$tpl['variables']['limit_promised_amount_period']]), $lng['limits_text']);
$tpl['last_tx'] = get_last_tx($user_id, types_to_ids(array('new_promised_amount', 'change_promised_amount', 'del_promised_amount', 'for_repaid_fix', 'actualization_promised_amounts', 'mining')));
if (!empty($tpl['last_tx'])) {
    $tpl['last_tx_formatted'] = make_last_txs($tpl['last_tx']);
}
require_once ABSPATH . 'templates/promised_amount_list.tpl';
Example #3
0
<?php

if (!defined('DC')) {
    die("!defined('DC')");
}
$tpl['data']['credit_part_type'] = 'money_back_request';
$tpl['data']['credit_part_type_id'] = ParseData::findType($tpl['data']['credit_part_type']);
$tpl['data']['time'] = time();
$tpl['data']['user_id'] = $user_id;
$tpl['my_orders'] = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT *\n\t\tFROM `" . DB_PREFIX . "orders`\n\t\tWHERE `buyer` = {$user_id}\n\t\tORDER BY `time` DESC\n\t\tLIMIT 20\n\t\t", 'all_data');
$tpl['currency_list'] = get_currency_list($db);
$tpl['last_tx'] = get_last_tx($user_id, types_to_ids(array('change_seller_hold_back', 'money_back')), 3);
if (!empty($tpl['last_tx'])) {
    $tpl['last_tx_formatted'] = make_last_txs($tpl['last_tx']);
}
require_once ABSPATH . 'templates/arbitration_buyer.tpl';
Example #4
0
<?php

if (!defined('DC')) {
    die("!defined('DC')");
}
$tpl['data']['type'] = 'user_avatar';
$tpl['data']['type_id'] = ParseData::findType($tpl['data']['type']);
$tpl['data']['time'] = time();
$tpl['data']['user_id'] = $user_id;
$data = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `name`,\n\t\t\t\t\t `avatar`\n\t\tFROM `" . DB_PREFIX . "users`\n\t\tWHERE `user_id`= {$user_id}\n\t\t", 'fetch_array');
$tpl = array_merge($tpl, $data);
if (empty($tpl['avatar'])) {
    $tpl['avatar'] = '0';
}
$tpl['last_tx'] = get_last_tx($user_id, $tpl['data']['type_id']);
if (!empty($tpl['last_tx'])) {
    $tpl['last_tx_formatted'] = make_last_tx($tpl['last_tx']);
}
require_once ABSPATH . 'templates/change_avatar.tpl';
}
$res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, '
		SELECT *
		FROM `' . DB_PREFIX . 'currency`
		');
while ($row = $db->fetchArray($res)) {
    if (isset($my_commission[$row['id']])) {
        $tpl['commission'][$row['id']] = $my_commission[$row['id']];
    } else {
        $tpl['commission'][$row['id']] = array(0.1, $tpl['currency_min'][$row['id']], 0);
    }
}
// для CF-проектов
$tpl['currency_list'][1000] = 'Crowdfunding';
if (isset($my_commission[1000])) {
    $tpl['commission'][1000] = $my_commission[1000];
} else {
    $tpl['commission'][1000] = array(0.1, 0.01, 0);
}
$tpl['conditions'] = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `conditions`\n\t\tFROM `" . DB_PREFIX . "arbitrator_conditions`\n\t\tWHERE `user_id` = {$user_id}\n\t\tLIMIT 1\n\t\t", 'fetch_one');
$tpl['conditions'] = json_decode($tpl['conditions'], true);
if (!$tpl['conditions']) {
    $tpl['conditions'][72] = array('0.01', '0', '0.01', '0', '0.1');
    $tpl['conditions'][23] = array('0.01', '0', '0.01', '0', '0.1');
}
$tpl['last_tx'] = get_last_tx($user_id, types_to_ids(array('change_arbitrator_conditions')), 3);
if (!empty($tpl['last_tx'])) {
    $tpl['last_tx_formatted'] = make_last_txs($tpl['last_tx']);
}
$tpl['pending_tx'] = @$pending_tx[ParseData::findType('change_arbitrator_conditions')];
require_once ABSPATH . 'templates/change_arbitrator_conditions.tpl';
Example #6
0
$promised_amount = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `id`\n\t\tFROM `" . DB_PREFIX . "promised_amount`\n\t\tWHERE `user_id` = {$user_id}\n\t\t", 'fetch_one');
// возможно юзер уже отправил запрос на добавление обещенной суммы
$last_tx = get_last_tx($user_id, types_to_ids(array('new_promised_amount')));
if (!empty($last_tx[0]['queue_tx']) || !empty($last_tx[0]['tx']) || $promised_amount) {
    $tpl['progress_bar']['promised_amount'] = 1;
}
// установлена ли комиссия
$commission = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `commission`\n\t\tFROM `" . DB_PREFIX . "commission`\n\t\tWHERE `user_id` = {$user_id}\n\t\t", 'fetch_one');
// возможно юзер уже отправил запрос на добавление комиссии
$last_tx = get_last_tx($user_id, types_to_ids(array('change_commission')));
if (!empty($last_tx[0]['queue_tx']) || !empty($last_tx[0]['tx']) || $commission) {
    $tpl['progress_bar']['commission'] = 1;
}
// голосование за параметры валют. для простоты смотрим в голоса за реф %
$vote = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `user_id`\n\t\tFROM `" . DB_PREFIX . "votes_referral`\n\t\tWHERE `user_id` = {$user_id}\n\t\t", 'fetch_one');
$last_tx = get_last_tx($user_id, types_to_ids(array('votes_complex')));
if (!empty($last_tx[0]['queue_tx']) || !empty($last_tx[0]['tx']) || $vote) {
    $tpl['progress_bar']['vote'] = 1;
}
if (empty($_SESSION['restricted'])) {
    // выполнялись ли задания
    $my_tasks = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `id`\n\t\tFROM `" . DB_PREFIX . MY_PREFIX . "my_tasks`\n\t\t", 'fetch_one');
    if ($my_tasks) {
        $tpl['progress_bar']['tasks'] = 1;
    }
}
// сколько майнеров зарегались по ключам данного юзера
$tpl['progress_bar']['referral'] = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT count(`miner_id`)\n\t\tFROM `" . DB_PREFIX . "users`\n\t\tLEFT JOIN `" . DB_PREFIX . "miners_data` on `" . DB_PREFIX . "miners_data`.`user_id` = `" . DB_PREFIX . "users`.`user_id`\n\t\tWHERE `referral` = {$user_id} AND\n\t\t\t\t\t `miner_id` > 0\n\t\t", 'fetch_one');
// итог
$tpl['progress_pct'] = $tpl['progress_bar_pct']['begin'];
foreach ($tpl['progress_bar'] as $name => $result) {
Example #7
0
    $row['count_rejected_refunds'] = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT count(`id`)\n\t\t\tFROM `" . DB_PREFIX . "orders`\n\t\t\tLEFT JOIN `" . DB_PREFIX . "miners_data` ON `" . DB_PREFIX . "miners_data`.`user_id` = `" . DB_PREFIX . "orders`.`buyer`\n\t\t\tWHERE  (`arbitrator0` = {$row['arbitrator_user_id']} OR `arbitrator1` = {$row['arbitrator_user_id']} OR `arbitrator2` = {$row['arbitrator_user_id']} OR `arbitrator3` = {$row['arbitrator_user_id']} OR `arbitrator4` = {$row['arbitrator_user_id']}) AND\n\t\t\t\t\t\t `" . DB_PREFIX . "orders`.`status` = 'refund' AND\n\t\t\t\t\t\t `end_time` > " . (time() - 3600 * 24 * 30) . " AND\n\t\t\t\t\t\t `end_time` < " . time() . " AND\n\t\t\t\t\t\t `voluntary_refund` = 0 AND\n\t\t\t\t\t\t `refund` = 0 AND\n\t\t\t\t\t\t `" . DB_PREFIX . "miners_data`.`status` = 'miner'\n\t\t\tGROUP BY `user_id`\n\t\t\t", 'fetch_one');
    $tpl['arbitrators'][] = $row;
}
/*
$tpl['arbitrators'] = array();
$tpl['arbitrators'][] = array('arbitrator_user_id'=>1967, 'url'=>'11111', 'count' => 1264, 'refund_data' =>array('count'=>687, 'sum'=>10250), 'count_rejected_refunds' =>12 );
$tpl['arbitrators'][] = array('arbitrator_user_id'=>2695, 'url'=>'11111', 'count' => 598, 'refund_data' =>array('count'=>212, 'sum'=>4691), 'count_rejected_refunds' =>3 );
$tpl['arbitrators'][] = array('arbitrator_user_id'=>1687, 'url'=>'11111', 'count' => 469, 'refund_data' =>array('count'=>316, 'sum'=>4269), 'count_rejected_refunds' =>26 );
$tpl['arbitrators'][] = array('arbitrator_user_id'=>256, 'url'=>'11111', 'count' => 369, 'refund_data' =>array('count'=>244, 'sum'=>2897), 'count_rejected_refunds' =>2 );
$tpl['arbitrators'][] = array('arbitrator_user_id'=>9753, 'url'=>'11111', 'count' => 122, 'refund_data' =>array('count'=>155, 'sum'=>1717), 'count_rejected_refunds' =>15 );
//print_R($tpl['arbitrators']);
//print_R($tpl['my_trust_list']);
$tpl['my_trust_list'] = array();
$tpl['my_trust_list'][] = array('arbitrator_user_id' => 1967, 'url' =>'111', 'count' => 1264);
$tpl['my_trust_list'][] = array('arbitrator_user_id' => 2695, 'url' =>'111', 'count' => 598);
$tpl['my_trust_list'][] = array('arbitrator_user_id' => 1687, 'url' =>'111', 'count' => 469);
$tpl['my_trust_list'][] = array('arbitrator_user_id' => 256, 'url' =>'111', 'count' => 369);
$tpl['my_trust_list'][] = array('arbitrator_user_id' => 9753, 'url' =>'111', 'count' => 122);
*/
// арбитр ли наш юзер
$tpl['arbitrator'] = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `conditions`\n\t\tFROM `" . DB_PREFIX . "arbitrator_conditions`\n\t\tWHERE `user_id` = {$user_id}\n\t\t", 'fetch_one');
// продавец ли
$tpl['arbitration_days_refund'] = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `arbitration_days_refund`\n\t\tFROM `" . DB_PREFIX . "users`\n\t\tWHERE `user_id` = {$user_id}\n\t\t", 'fetch_one');
$tpl['arbitration_trust_list'] = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `arbitrator_user_id`\n\t\tFROM `" . DB_PREFIX . "arbitration_trust_list`\n\t\tWHERE `user_id` = {$user_id}\n\t\t", 'fetch_one');
$tpl['currency_list'] = get_currency_list($db);
$tpl['last_tx'] = get_last_tx($user_id, types_to_ids(array('change_arbitrator_conditions', 'change_seller_hold_back', 'change_arbitrator_list', 'money_back_request', 'money_back', 'change_money_back_time')), 3);
if (!empty($tpl['last_tx'])) {
    $tpl['last_tx_formatted'] = make_last_txs($tpl['last_tx']);
}
$tpl['pending_tx'] = @$pending_tx[ParseData::findType('change_arbitrator_list')];
require_once ABSPATH . 'templates/arbitration.tpl';
Example #8
0
function check_commission()
{
    global $db, $tpl, $user_id, $lng;
    // установлена ли комиссия
    $commission = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\t\t\tSELECT `commission`\n\t\t\t\t\t\tFROM `" . DB_PREFIX . "commission`\n\t\t\t\t\t\tWHERE `user_id` = {$user_id}\n\t\t\t\t\t\t", 'fetch_one');
    if (!$commission) {
        // возможно юзер уже отправил запрос на добавление комиссии
        $tpl['last_tx'] = get_last_tx($user_id, types_to_ids(array('change_commission')));
        if (!empty($tpl['last_tx'][0]['queue_tx']) || !empty($tpl['last_tx'][0]['tx'])) {
            // авансом выдаем полное майнерское меню
            $tpl['result'] = 'full_mining_menu';
        } else {
            // возможно юзер нажал кнопку "пропустить"
            $hide_first_commission = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\t\tSELECT `hide_first_commission`\n\t\t\t\t\tFROM `" . DB_PREFIX . MY_PREFIX . "my_table`\n\t\t\t\t\tLIMIT 1\n\t\t\t\t\t", 'fetch_one');
            if ($hide_first_commission) {
                $tpl['result'] = 'full_mining_menu';
            } else {
                $tpl['result'] = 'need_commission';
            }
        }
    } else {
        $tpl['result'] = 'full_mining_menu';
    }
}