die('browser'); } /* * Важно! отключать в кроне при обнулении данных в БД */ define('DC', TRUE); set_time_limit(0); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; require_once ABSPATH . 'includes/errors.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); if (get_my_block_id($db) > get_block_id($db)) { die('get_my_block_id > get_block_id'); } $currency_list = get_currency_list($db); // нужно знать текущий блок, который есть у большинства нодов $block_id = get_confirmed_block_id($db); // сколько должно быть подтверждений, т.е. кол-во блоков сверху $confirmations = 5; // берем всех юзеров по порядку $community = get_community_users($db); for ($k = 0; $k < sizeof($community); $k++) { $private_key = ''; $MY_PREFIX = $community[$k] . '_'; //print $MY_PREFIX."\n"; $table_exists = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSHOW TABLES LIKE '" . DB_PREFIX . "{$MY_PREFIX}my_keys'\n\t\t\t", 'num_rows'); if (!$table_exists) { continue; } // проверим, майнер ли
<?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';
// set default date format $defaultdateformat = $plugin->default_dateformat; if (empty($defaultdateformat)) { $defaultdateformat = 'F j, Y'; } // available date formats $dformat = array("F j, Y" => "January 31, 2013", "j F, Y" => "31 January, 2013", "j, n, Y" => "31, 1, 2013", "m.d.y" => "01.31.13", "m.d.Y" => "01.31.2013", "m/d/y" => "01/31/13", "m/d/Y" => "01/31/2013", "d.m.y" => "31.01.13", "d.m.Y" => "31.01.2013", "d/m/y" => "31/01/13", "d/m/Y" => "31/01/2013", "n.d.y" => "1.31.13", "n.d.Y" => "1.31.2013", "n/d/y" => "1/31/13", "n/d/Y" => "1/31/2013", "d.n.y" => "31.1.13", "d.n.Y" => "31.1.2013", "d/n/y" => "31/1/13", "d/n/Y" => "31/1/2013"); $dateformat = elgg_view('input/dropdown', array('name' => 'params[default_dateformat]', 'value' => $defaultdateformat, 'options_values' => $dformat)); $dateformat .= "<span class='elgg-subtext'>" . elgg_echo('vouchers:settings:defaultdateformat:note') . "</span>"; echo elgg_view_module("inline", elgg_echo('vouchers:settings:defaultdateformat'), $dateformat); // set default currency $defaultcurrency = $plugin->default_currency; if (empty($defaultcurrency)) { $defaultdateformat = '€'; } $CurrOptions = get_currency_list(); // get currency list $currency = elgg_view('input/dropdown', array('name' => 'params[default_currency]', 'value' => $defaultcurrency, 'options_values' => $CurrOptions)); $currency .= "<span class='elgg-subtext'>" . elgg_echo('vouchers:settings:defaultcurrency:note') . "</span>"; echo elgg_view_module("inline", elgg_echo('vouchers:settings:defaultcurrency'), $currency); // set timezone $default_timezone = $plugin->default_timezone; if (empty($default_timezone)) { $defaulttimezone = 'UTC'; } $timezones_list = vouchers_get_all_times_zones(); $timezone = elgg_view('input/dropdown', array('name' => 'params[default_timezone]', 'value' => $default_timezone, 'options_values' => $timezones_list)); $timezone .= "<span class='elgg-subtext'>" . elgg_echo('vouchers:settings:defaulttimezone:note') . "</span>"; echo elgg_view_module("inline", elgg_echo('vouchers:settings:defaulttimezone'), $timezone); // set who can post vouchers $voucher_uploaders = $plugin->voucher_uploaders;
$res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT *\n\t\tFROM `" . DB_PREFIX . "credits`\n\t\tWHERE (`from_user_id` = {$user_id} OR `to_user_id` = {$user_id}) AND\n\t\t\t\t\t `del_block_id` = 0 AND\n\t\t\t\t\t `amount` > 0\n\t\t"); while ($row = $db->fetchArray($res)) { if ($user_id == $row['from_user_id']) { $tpl['I_debtor'][] = $row; } 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 = '';
<?php defined('CAFE') or die(header('Location: /')); check_error(); // Добавление валюты if ($_POST['add']) { $data = array('title' => $_POST['title'], 'code' => $_POST['code'], 'currency' => $_POST['currency'], 'period' => $_POST['period'], 'cur_date' => $date, 'nominal' => $nominal, 'rate' => $rate); $add_currency = $db->query("INSERT INTO " . DB_PREFIX . "_currency SET ?u", $data); if ($add_currency) { $message = 'Валюта добавлена'; } else { $error = 'Возникла ошибка при добавлении валюты'; } } // удаление валюты if ($_GET['action'] == 'delete' && empty($error)) { terminator(); } if ($_GET['action'] == 'add') { $tpl = "currency_add_tpl.php"; } if ($_GET['action'] == 'list') { if ($_GET['id']) { get_currency($_GET['id']); } $limit = '10'; $currency_list = get_currency_list($limit); $tpl = "currency_list_tpl.php"; } include "currency_main_tpl.php";