Beispiel #1
0
    } else {
        $tpl['I_creditor'][] = $row;
    }
}
// балансы
$wallets = get_balances($user_id);
foreach ($wallets as $id => $data) {
    $tpl['wallets'][$data['currency_id']] = $data;
}
$tpl['block_id'] = get_block_id($db);
$tpl['confirmed_block_id'] = get_confirmed_block_id($db);
$tpl['currency_list'] = get_currency_list($db, 'full');
// входящие запросы
$tpl['cash_requests'] = 0;
if (empty($_SESSION['restricted'])) {
    $my_user_id = get_my_user_id($db);
    $tpl['cash_requests'] = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\tSELECT count(`id`)\n\t\t\t\tFROM `" . DB_PREFIX . "cash_requests`\n\t\t\t\tWHERE `to_user_id` = {$my_user_id} AND\n\t\t\t\t\t\t\t `status` = 'pending' AND\n\t\t\t\t\t\t\t `for_repaid_del_block_id` = 0 AND\n\t\t\t\t\t\t\t `del_block_id` = 0\n\t\t\t\t", 'fetch_one');
    $tpl['cash_requests'] = $tpl['cash_requests'] ? 1 : 0;
}
/*
 *  Задания
*/
$tpl['tasks_count'] = 0;
$tpl['tasks_count'] += $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT count(`id`)\n\t\tFROM `" . DB_PREFIX . "votes_miners`\n\t\tWHERE  `votes_end` = 0 AND\n\t\t\t\t\t `type` = 'user_voting'\n\t\t", 'fetch_one');
// вначале получим ID валют, которые мы можем проверять.
$res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `currency_id`\n\t\tFROM `" . DB_PREFIX . "promised_amount`\n\t\tWHERE `status` IN ('mining', 'repaid') AND\n\t\t\t\t\t `user_id` = {$user_id}\n\t\t");
$currency_ids = '';
while ($row = $db->fetchArray($res)) {
    $currency_ids .= $row['currency_id'] . ',';
}
$currency_ids = substr($currency_ids, 0, -1);
Beispiel #2
0
<?php

if (!defined('DC')) {
    die("!defined('DC')");
}
$cash_requests_status = array('my_pending' => $lng['local_pending'], 'pending' => $lng['pending'], 'approved' => $lng['approved'], 'rejected' => $lng['rejected']);
// валюты
$res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, '
		SELECT `id`,
					 `name`
		FROM `' . DB_PREFIX . 'currency`
		ORDER BY `name`
		');
while ($row = $db->fetchArray($res)) {
    $tpl['currency_list'][$row['id']] = $row['name'];
}
// Узнаем свой user_id
$tpl['user_id'] = get_my_user_id($db);
$variables = ParseData::get_all_variables($db);
// актуальный запрос к нам на получение налички. Может быть только 1.
$tpl['data'] = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `" . DB_PREFIX . MY_PREFIX . "my_cash_requests`.`cash_request_id`,\n\t\t\t\t\t `" . DB_PREFIX . MY_PREFIX . "my_cash_requests`.`id`,\n\t\t\t\t\t `" . DB_PREFIX . MY_PREFIX . "my_cash_requests`.`comment_status`,\n\t\t\t\t\t `" . DB_PREFIX . MY_PREFIX . "my_cash_requests`.`comment`,\n\t\t\t\t\t `" . DB_PREFIX . "cash_requests`.`amount`,\n\t\t\t\t\t `" . DB_PREFIX . "cash_requests`.`currency_id`,\n\t\t\t\t\t `" . DB_PREFIX . "cash_requests`.`from_user_id`,\n\t\t\t\t\t LOWER(HEX(`" . DB_PREFIX . "cash_requests`.`hash_code`)) as `hash_code`\n\t\tFROM `" . DB_PREFIX . MY_PREFIX . "my_cash_requests`\n\t\tLEFT JOIN `" . DB_PREFIX . "cash_requests` ON `" . DB_PREFIX . "cash_requests`.`id` = `" . DB_PREFIX . MY_PREFIX . "my_cash_requests`.`cash_request_id`\n\t\tWHERE `" . DB_PREFIX . "cash_requests`.`to_user_id` = {$tpl['user_id']} AND\n\t\t\t\t\t `" . DB_PREFIX . "cash_requests`.`status` = 'pending' AND\n\t\t\t\t\t `" . DB_PREFIX . "cash_requests`.`time` > " . (time() - $variables['cash_request_time']) . " AND\n\t\t\t\t\t `" . DB_PREFIX . "cash_requests`.`del_block_id` = 0 AND\n\t\t\t\t\t `" . DB_PREFIX . "cash_requests`.`for_repaid_del_block_id` = 0\n\t\tORDER BY `cash_request_id` DESC\n\t\tLIMIT 1\n\t\t", 'fetch_array');
// список ранее отправленных ответов на запросы.
$res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT *\n\t\tFROM `" . DB_PREFIX . MY_PREFIX . "my_cash_requests`\n\t\tWHERE `to_user_id` = {$tpl['user_id']}\n\t\t");
while ($row = $db->fetchArray($res)) {
    $tpl['my_cash_requests'][] = $row;
}
$tpl['data']['type'] = 'cash_request_in';
$tpl['data']['type_id'] = ParseData::findType($tpl['data']['type']);
$tpl['data']['time'] = time();
$tpl['data']['user_id'] = $user_id;
require_once ABSPATH . 'templates/cash_requests_in.tpl';