Пример #1
0
 public static function pagination($link_url, $page, $total_rows, $rows_per_page = 0, $max_pages = 0, $pagination_label = false, $target_elem = false)
 {
     global $CFG;
     $link_url = preg_replace("/[^a-zA-Z\\.]/", "", $link_url);
     $page = preg_replace("/[^0-9]/", "", $page);
     $total_rows = preg_replace("/[^0-9]/", "", $total_rows);
     $rows_per_page = preg_replace("/[^0-9]/", "", $rows_per_page);
     $max_pages = preg_replace("/[^0-9]/", "", $max_pages);
     $first_page = false;
     $last_page = false;
     $page = $page > 0 ? $page : 1;
     if (!($rows_per_page > 0)) {
         return false;
     }
     if ($total_rows > $rows_per_page) {
         $num_pages = ceil($total_rows / $rows_per_page);
         $page_array = range(1, $num_pages);
         if ($max_pages > 0) {
             $p_deviation = ($max_pages - 1) / 2;
             $alpha = $page - 1;
             $alpha = $alpha < $p_deviation ? $alpha : $p_deviation;
             $beta = $num_pages - $page;
             $beta = $beta < $p_deviation ? $beta : $p_deviation;
             if ($alpha < $p_deviation) {
                 $beta = $beta + ($p_deviation - $alpha);
             }
             if ($beta < $p_deviation) {
                 $alpha = $alpha + ($p_deviation - $beta);
             }
         }
         $first_text = Lang::string('first-page');
         $last_text = Lang::string('last-page');
         if ($page != 1) {
             $first_page = '<a href="' . $link_url . '?' . http_build_query(array('page' => 1)) . '">' . $first_text . '</a>';
         }
         if ($page != $num_pages) {
             $last_page = ' &nbsp;<a href="' . $link_url . '?' . http_build_query(array('page' => $num_pages)) . '">' . $last_text . '</a>';
         }
         $pagination = '<div class="pagination"><div style="float:left;">' . $first_page;
         foreach ($page_array as $p) {
             if ($p >= $page - $alpha && $p <= $page + $beta || $max_pages == 0) {
                 if ($p == $page) {
                     $pagination .= ' <span>' . $p . '</span> ';
                 } else {
                     $pagination .= ' <a href="' . $link_url . '?' . http_build_query(array('page' => $p)) . '">' . $p . '</a> ';
                 }
             }
         }
         $pagination .= '</div>';
         $label = str_ireplace('[results]', '<b>' . $total_rows . '</b>', Lang::string('transactions-pagination'));
         $label = str_ireplace('[num_pages]', '<b>' . $num_pages . '</b>', $label);
         $pagination .= '<div style="float:right" class="pagination_label">' . $label . '</div>';
         $pagination .= $last_page . '<div style="clear:both;height:0;">&nbsp;</div></div>';
         return $pagination;
     }
 }
Пример #2
0
    ?>
		    	<div style="margin-bottom:10px;">
		    		<div class="g-recaptcha" data-sitekey="<?php 
    echo $CFG->google_recaptch_api_key;
    ?>
"></div>
		    	</div>
		    	<?php 
}
?>
	    		<input type="hidden" name="submitted" value="1" />
	    		<input type="hidden" name="uniq" value="<?php 
echo $_SESSION["register_uniq"];
?>
" />
	    		<input type="submit" name="submit" value="<?php 
echo Lang::string('home-login');
?>
" class="but_user" />
	    	</div>
    	</form>
    	<a class="forgot" href="register.php?"><?php 
echo Lang::string('login-dont-have');
?>
</a>
    </div>
    <div class="bg"></div>
    <div class="clearfix mar_top8"></div>
</div>
<?php 
include 'includes/foot.php';
Пример #3
0
							<td>' . $CFG->currencies[$ask['currency']]['fa_symbol'] . '<span class="order_value">' . number_format($ask['btc'] * ($ask['fiat_price'] > 0 ? $ask['fiat_price'] : $ask['stop_price']), 2) . '</span></td>
							<td><a href="edit-order.php?order_id=' . $ask['id'] . '" title="' . Lang::string('orders-edit') . '"><i class="fa fa-pencil"></i></a> <a href="open-orders.php?delete_id=' . $ask['id'] . '&uniq=' . $_SESSION["openorders_uniq"] . '" title="' . Lang::string('orders-delete') . '"><i class="fa fa-times"></i></a></td>
						</tr>';
        if ($double) {
            echo '
						<tr id="ask_' . $ask['id'] . '" class="ask_tr double">
							<td><div class="identify stop_order">S</div></td>
							<td>' . $CFG->currencies[$ask['currency']]['fa_symbol'] . '<span class="order_price">' . number_format($ask['stop_price'], 2) . '</span></td>
							<td><span class="order_amount">' . number_format($ask['btc'], 8) . '</span></td>
							<td>' . $CFG->currencies[$ask['currency']]['fa_symbol'] . '<span class="order_value">' . number_format($ask['stop_price'] * $ask['btc'], 2) . '</span></td>
							<td><span class="oco"><i class="fa fa-arrow-up"></i> OCO</span></td>
						</tr>';
        }
    }
}
echo '<tr id="no_asks" style="' . (is_array($asks) && count($asks) > 0 ? 'display:none;' : '') . '"><td colspan="5">' . Lang::string('orders-no-ask') . '</td></tr>';
?>
					</table>
				</div>
				<div class="clear"></div>
			</div>
			<div class="clear"></div>
		</div>
<?php 
if (!$bypass) {
    ?>
		<div class="mar_top5"></div>
	</div>
	<?php 
    include 'includes/sidebar_account.php';
    ?>
Пример #4
0
            echo $api_key['withdraw'] == 'Y' ? 'checked="checked"' : '';
            ?>
 />
								<label for="permission_<?php 
            echo $api_key['id'];
            ?>
_withdraw"><?php 
            echo Lang::string('api-permission_withdraw');
            ?>
</label>
							</td>
							<td class="inactive"></td>
						</tr>
						<?php 
        }
    } else {
        echo '<tr><td colspan="5">' . Lang::string('api-keys-no') . '</td></tr>';
    }
    ?>
					</table>
				</div>
			</form>
           	<?php 
}
?>
            <div class="mar_top8"></div>
        </div>
	</div>
</div>
<?php 
include 'includes/foot.php';
Пример #5
0
 public static function executeOrder($buy, $price, $amount, $currency1, $fee, $market_price, $edit_id = 0, $this_user_id = 0, $external_transaction = false, $stop_price = false, $use_maker_fee = false, $verbose = false)
 {
     global $CFG;
     if (!$CFG->session_active) {
         return false;
     }
     if ($CFG->trading_status == 'suspended') {
         db_commit();
         return array('error' => array('message' => Lang::string('buy-trading-disabled'), 'code' => 'TRADING_SUSPENDED'));
     }
     $this_user_id = preg_replace("/[^0-9]/", "", $this_user_id);
     $this_user_id = $this_user_id > 0 ? $this_user_id : User::$info['id'];
     if (!($this_user_id > 0)) {
         db_commit();
         return array('error' => array('message' => 'Invalid authentication.', 'code' => 'AUTH_ERROR'));
     }
     $amount = preg_replace("/[^0-9\\.]/", "", $amount);
     $orig_amount = $amount;
     $price = preg_replace("/[^0-9\\.]/", "", $price);
     $stop_price = preg_replace("/[^0-9\\.]/", "", $stop_price);
     $currency1 = strtolower(preg_replace("/[^a-zA-Z]/", "", $currency1));
     $edit_id = preg_replace("/[^0-9]/", "", $edit_id);
     db_start_transaction();
     $orig_order = false;
     if ($edit_id > 0) {
         if (empty($CFG->session_api) || $external_transaction) {
             $orig_order = DB::getRecord('orders', $edit_id, 0, 1, false, false, false, 1);
         } else {
             $orig_order = self::getRecord(false, $edit_id, $this_user_id, true);
         }
         if ($orig_order['site_user'] != $this_user_id || !$orig_order) {
             db_commit();
             return array('error' => array('message' => 'Order not found.', 'code' => 'ORDER_NOT_FOUND'));
         }
         $buy = $orig_order['order_type'] == $CFG->order_type_bid;
         $currency_info = $CFG->currencies[$orig_order['currency']];
         $currency1 = strtolower($currency_info['currency']);
         $edit_id = $orig_order['id'];
         $use_maker_fee = $use_maker_fee && $orig_order['market_price'] != 'Y';
         if ($external_transaction) {
             $amount = $orig_order['btc'];
             $orig_amount = $amount;
         }
     } else {
         $currency_info = $CFG->currencies[strtoupper($currency1)];
     }
     $bid_ask = self::getBidAsk($currency1);
     $bid = $bid_ask['bid'];
     $ask = $bid_ask['ask'];
     $bid = $bid > $ask ? $ask : $bid;
     $price = $market_price ? $buy ? $ask : $bid : $price;
     $usd_info = $CFG->currencies['USD'];
     $user_balances = User::getBalances($this_user_id, array($currency_info['id'], $CFG->btc_currency_id), true);
     $user_fee = FeeSchedule::getUserFees($this_user_id);
     $on_hold = User::getOnHold(1, $this_user_id, $user_fee, array($currency_info['id'], $CFG->btc_currency_id));
     $this_btc_balance = !empty($user_balances['btc']) ? $user_balances['btc'] : 0;
     $this_fiat_balance = !empty($user_balances[$currency1]) ? $user_balances[$currency1] : 0;
     $this_triggered_stop = $stop_price > 0 && $market_price;
     $stop_price = $stop_price > 0 && $market_price ? false : $stop_price;
     $fee = !$use_maker_fee ? $user_fee['fee'] : $user_fee['fee1'];
     $insert_id = 0;
     $transactions = 0;
     $new_order = 0;
     $edit_order = 0;
     $comp_btc_balance = array();
     $comp_btc_on_hold = array();
     $comp_fiat_balance = array();
     $comp_fiat_on_hold = array();
     $currency_max = false;
     $currency_max_str = false;
     $currency_min = false;
     $currency_min_str = false;
     $compatible = false;
     $trans_total = 0;
     $this_funds_finished = false;
     $hidden_executions = array();
     $max_price = 0;
     $min_price = 0;
     $executed_orders = array();
     $executed_prices = array();
     $executed_orig_prices = false;
     $no_compatible = false;
     $triggered_rows = false;
     if (!empty($on_hold['BTC']['total'])) {
         $this_btc_on_hold = $edit_id > 0 && !$buy ? $on_hold['BTC']['total'] - $amount : $on_hold['BTC']['total'];
     } else {
         $this_btc_on_hold = 0;
     }
     if (!empty($on_hold[strtoupper($currency1)]['total'])) {
         $this_fiat_on_hold = $edit_id > 0 && $buy ? $on_hold[strtoupper($currency1)]['total'] - ($amount * $orig_order['btc_price'] + $amount * $orig_order['btc_price'] * ($fee * 0.01)) : $on_hold[strtoupper($currency1)]['total'];
     } else {
         $this_fiat_on_hold = 0;
     }
     $error = self::checkPreconditions($buy, $currency_info, $amount, $price, $stop_price, $fee, $buy ? $this_fiat_balance - $this_fiat_on_hold : $this_btc_balance - $this_btc_on_hold, $bid, $ask, $market_price, $this_user_id, $orig_order);
     if ($error) {
         db_commit();
         return $error;
     }
     if (!$market_price) {
         $error = self::checkUserOrders($buy, $currency_info, $this_user_id, $price, $stop_price, $fee);
         if ($error) {
             db_commit();
             return $error;
         }
     }
     if (!($edit_id > 0)) {
         $order_log_id = db_insert('order_log', array('date' => date('Y-m-d H:i:s'), 'order_type' => $buy ? $CFG->order_type_bid : $CFG->order_type_ask, 'site_user' => $this_user_id, 'btc' => $amount, 'fiat' => $amount * $price, 'currency' => $currency_info['id'], 'btc_price' => $price, 'market_price' => $market_price ? 'Y' : 'N', 'stop_price' => $stop_price, 'status' => 'ACTIVE'));
     } else {
         if (!$external_transaction || $this_triggered_stop) {
             $order_log_id = db_insert('order_log', array('date' => date('Y-m-d H:i:s'), 'order_type' => $buy ? $CFG->order_type_bid : $CFG->order_type_ask, 'site_user' => $this_user_id, 'btc' => $amount, 'fiat' => $amount * $price, 'currency' => $currency_info['id'], 'btc_price' => $price, 'market_price' => $market_price ? 'Y' : 'N', 'p_id' => $orig_order['log_id'], 'stop_price' => $stop_price, 'status' => 'ACTIVE'));
             db_update('order_log', $orig_order['log_id'], array('status' => 'REPLACED', 'btc_remaining' => $orig_order['btc']));
         } else {
             $order_log_id = $orig_order['log_id'];
         }
     }
     if ($buy) {
         if ($price != $stop_price) {
             $compatible = self::getCompatible($CFG->order_type_ask, $price, $currency1, $amount, 1, $market_price, false, $use_maker_fee, $this_user_id);
             $no_compatible = !$compatible;
             $compatible = is_array($compatible) ? new ArrayIterator($compatible) : false;
             $compatible[] = array('continue' => 1);
             //$btc_commision = 0;
             $fiat_commision = false;
             $c = count($compatible);
             $i = 1;
         }
         if ($compatible) {
             foreach ($compatible as $comp_order) {
                 if (!empty($comp_order['is_market']) && $comp_order['is_market'] == 'Y' && $price < $bid) {
                     $hidden_executions[] = $comp_order;
                     continue;
                 }
                 if (!empty($comp_order['real_market_price']) && round($comp_order['real_market_price'], 2, PHP_ROUND_HALF_UP) <= $price && round($comp_order['fiat_price'], 2, PHP_ROUND_HALF_UP) > $price && !$market_price) {
                     $hidden_executions[] = $comp_order;
                     continue;
                 }
                 if (!empty($comp_order['order_type']) && $comp_order['order_type'] == $CFG->order_type_bid) {
                     if ($comp_order['is_market'] == 'Y') {
                         $hidden_executions[] = $comp_order;
                     }
                     continue;
                 }
                 if (!($amount > 0) || !($this_fiat_balance - $this_fiat_on_hold > 0)) {
                     $triggered = self::triggerStops($max_price, $min_price, $currency1, 1, $bid, $ask, $currency_max, $currency_min);
                     $triggered_rows = self::getMarketOrders();
                     if ($triggered_rows) {
                         $hidden_executions = array_merge($triggered_rows, $hidden_executions);
                     }
                     break;
                 } elseif ($i == $c && $max_price > 0) {
                     $triggered = self::triggerStops($max_price, $min_price, $currency1, 1, $bid, $ask, $currency_max, $currency_min);
                     if ($triggered > 0) {
                         $triggered_rows = self::getCompatible($CFG->order_type_ask, $max_price, $currency1, $amount, 1, $market_price, $executed_orders, false, false, true);
                         if ($triggered_rows) {
                             foreach ($triggered_rows as $triggered_row) {
                                 $compatible->append($triggered_row);
                             }
                         }
                     }
                 }
                 if (!empty($comp_order['continue']) || $comp_order['site_user'] == $this_user_id) {
                     $i++;
                     continue;
                 }
                 $comp_user_info = self::lockOrder($comp_order['site_user'], $comp_order['id'], $comp_order['currency_id']);
                 if (!$comp_user_info) {
                     continue;
                 }
                 $comp_order = array_merge($comp_order, $comp_user_info);
                 $comp_order['btc_balance'] = array_key_exists($comp_order['site_user'], $comp_btc_balance) ? $comp_btc_balance[$comp_order['site_user']] : $comp_order['btc_balance'];
                 $comp_order['fiat_balance'] = array_key_exists($comp_order['site_user'], $comp_fiat_balance) ? $comp_fiat_balance[$comp_order['site_user']] : $comp_order['fiat_balance'];
                 $comp_btc_on_hold[$comp_order['site_user']] = array_key_exists($comp_order['site_user'], $comp_btc_on_hold) ? $comp_btc_on_hold[$comp_order['site_user']] : $comp_order['btc_on_hold'];
                 $max_amount = ($this_fiat_balance - $this_fiat_on_hold) / $comp_order['fiat_price'] > $amount + $fee * 0.01 * $amount ? $amount : ($this_fiat_balance - $this_fiat_on_hold) / $comp_order['fiat_price'] - $fee * 0.01 * (($this_fiat_balance - $this_fiat_on_hold) / $comp_order['fiat_price']);
                 $max_comp_amount = $comp_order['btc_balance'] - ($comp_btc_on_hold[$comp_order['site_user']] - $comp_order['btc_outstanding']) > $comp_order['btc_outstanding'] ? $comp_order['btc_outstanding'] : $comp_order['btc_balance'] - ($comp_btc_on_hold[$comp_order['site_user']] - $comp_order['btc_outstanding']);
                 $this_funds_finished = $max_amount < $amount;
                 $comp_funds_finished = $max_comp_amount < $comp_order['btc_outstanding'];
                 if (!($max_amount > 0) || !($max_comp_amount > 0)) {
                     if ($comp_funds_finished) {
                         self::cancelOrder($comp_order['id'], 0, $comp_order['site_user']);
                     }
                     $i++;
                     continue;
                 }
                 if ($max_comp_amount >= $max_amount) {
                     $trans_amount = $max_amount;
                     $comp_order_outstanding = $comp_order['btc_outstanding'] - $max_amount;
                     $amount = $amount - $max_amount;
                 } else {
                     $trans_amount = $max_comp_amount;
                     $amount = $amount - $trans_amount;
                     $comp_order_outstanding = $comp_order['btc_outstanding'] - $max_comp_amount;
                 }
                 $this_fee = $fee * 0.01 * $trans_amount;
                 $comp_order_fee = $comp_order['fee1'] * 0.01 * $trans_amount;
                 $this_conversion_fee = $currency_info['id'] != $comp_order['currency_id'] ? $comp_order['fiat_price'] * $trans_amount - $comp_order['orig_btc_price'] * $comp_order['orig_conversion_factor'] * $trans_amount : 0;
                 $this_trans_amount_net = $trans_amount + $this_fee;
                 $comp_order_trans_amount_net = $trans_amount - $comp_order_fee;
                 $comp_btc_balance[$comp_order['site_user']] = $comp_order['btc_balance'] - $trans_amount;
                 $comp_fiat_balance[$comp_order['site_user']] = round($comp_order['fiat_balance'] + $comp_order['orig_btc_price'] * $comp_order_trans_amount_net, 2, PHP_ROUND_HALF_UP);
                 $comp_btc_on_hold[$comp_order['site_user']] = $comp_btc_on_hold[$comp_order['site_user']] - $trans_amount;
                 //$btc_commision += $this_fee;
                 if (!empty($fiat_commision[strtolower($currency_info['currency'])])) {
                     $fiat_commision[strtolower($currency_info['currency'])] += $this_fee * $comp_order['fiat_price'];
                 } else {
                     $fiat_commision[strtolower($currency_info['currency'])] = $this_fee * $comp_order['fiat_price'];
                 }
                 if (!empty($fiat_commision[strtolower($comp_order['currency_abbr'])])) {
                     $fiat_commision[strtolower($comp_order['currency_abbr'])] += $comp_order_fee * $comp_order['orig_btc_price'];
                 } else {
                     $fiat_commision[strtolower($comp_order['currency_abbr'])] = $comp_order_fee * $comp_order['orig_btc_price'];
                 }
                 $this_prev_btc = $this_btc_balance;
                 $this_prev_fiat = $this_fiat_balance;
                 $this_btc_balance += $trans_amount;
                 $this_fiat_balance -= round($this_trans_amount_net * $comp_order['fiat_price'], 2, PHP_ROUND_HALF_UP);
                 $trans_total += $trans_amount;
                 $max_price = $comp_order['fiat_price'] > $max_price ? $comp_order['fiat_price'] : $max_price;
                 $min_price = $comp_order['fiat_price'] < $min_price || !($min_price > 0) ? $comp_order['fiat_price'] : $min_price;
                 if ($currency_info['id'] != $comp_order['currency_id']) {
                     $currency_max[$comp_order['currency_id']] = $comp_order['orig_btc_price'] > $currency_max[$comp_order['currency_id']] ? $comp_order['orig_btc_price'] : $currency_max[$comp_order['currency_id']];
                     $currency_min[$comp_order['currency_id']] = $comp_order['orig_btc_price'] < $currency_min[$comp_order['currency_id']] || !($currency_min[$comp_order['currency_id']] > 0) ? $comp_order['orig_btc_price'] : $currency_min[$comp_order['currency_id']];
                 }
                 $trans_info = array('date' => date('Y-m-d H:i:s'), 'site_user' => $this_user_id, 'transaction_type' => $CFG->transactions_buy_id, 'site_user1' => $comp_order['site_user'], 'transaction_type1' => $CFG->transactions_sell_id, 'btc' => $trans_amount, 'btc_price' => $comp_order['fiat_price'], 'fiat' => $comp_order['fiat_price'] * $trans_amount, 'currency' => $currency_info['id'], 'currency1' => $comp_order['currency_id'], 'fee' => $this_fee, 'fee1' => $comp_order_fee, 'btc_net' => $this_trans_amount_net, 'btc_net1' => $comp_order_trans_amount_net, 'btc_before' => $this_prev_btc, 'btc_after' => $this_btc_balance, 'fiat_before' => $this_prev_fiat, 'fiat_after' => $this_fiat_balance, 'btc_before1' => $comp_order['btc_balance'], 'btc_after1' => $comp_btc_balance[$comp_order['site_user']], 'fiat_before1' => $comp_order['fiat_balance'], 'fiat_after1' => $comp_fiat_balance[$comp_order['site_user']], 'log_id' => $order_log_id, 'log_id1' => $comp_order['log_id'], 'fee_level' => $fee, 'fee_level1' => $comp_order['fee'], 'conversion_fee' => $this_conversion_fee, 'orig_btc_price' => $comp_order['orig_btc_price'], 'bid_at_transaction' => $bid, 'ask_at_transaction' => $ask);
                 if ($currency_info['id'] != $comp_order['currency_id']) {
                     $trans_info = array_merge($trans_info, array('conversion' => 'Y', 'convert_amount' => $comp_order['fiat_price'] * $trans_amount, 'convert_rate_given' => $comp_order['conversion_factor'], 'convert_system_rate' => $comp_order['orig_conversion_factor'], 'convert_from_currency' => $currency_info['id'], 'convert_to_currency' => $comp_order['currency_id']));
                 }
                 $transaction_id = db_insert('transactions', $trans_info);
                 $executed_orders[] = $comp_order['id'];
                 $executed_prices[] = array('price' => $comp_order['fiat_price'], 'amount' => $trans_amount);
                 $executed_orig_prices[$comp_order['id']] = array('price' => $comp_order['orig_btc_price'], 'amount' => $trans_amount);
                 ++$transactions;
                 if (round($comp_order_outstanding, 8, PHP_ROUND_HALF_UP) > 0) {
                     if (!$comp_funds_finished) {
                         db_update('orders', $comp_order['id'], array('btc_price' => $comp_order['orig_btc_price'], 'btc' => $comp_order_outstanding, 'fiat' => $comp_order['orig_btc_price'] * $comp_order_outstanding));
                         if ($comp_order['is_market'] == 'Y') {
                             $hidden_executions[] = $comp_order;
                         }
                     } else {
                         self::cancelOrder($comp_order['id'], $comp_order_outstanding, $comp_order['site_user']);
                     }
                 } else {
                     self::setStatus($comp_order['id'], 'FILLED');
                     db_delete('orders', $comp_order['id']);
                 }
                 User::updateBalances($comp_order['site_user'], array('btc' => $comp_btc_balance[$comp_order['site_user']], $comp_order['currency_abbr'] => $comp_fiat_balance[$comp_order['site_user']]));
                 $i++;
             }
         }
         if ($trans_total > 0) {
             User::updateBalances($this_user_id, array('btc' => $this_btc_balance, $currency1 => $this_fiat_balance));
             if ($fiat_commision) {
                 Status::updateEscrows($fiat_commision);
             }
             //db_update('status',1,array('btc_escrow'=>($status['btc_escrow']+$btc_commision),strtolower($currency_info['currency']).'_escrow'=>($status[strtolower($currency_info['currency']).'_escrow']+$fiat_commision)));
         }
         if (round($amount, 8, PHP_ROUND_HALF_UP) > 0) {
             if ($edit_id > 0) {
                 if (!$this_funds_finished) {
                     if (!($no_compatible && $external_transaction)) {
                         db_update('orders', $edit_id, array('btc' => $amount, 'fiat' => $amount * $price, 'currency' => $currency_info['id'], 'btc_price' => $price != $stop_price ? $price : 0, 'market_price' => $market_price ? 'Y' : 'N', 'log_id' => $order_log_id, 'stop_price' => $stop_price));
                         $edit_order = 1;
                     }
                     $order_status = 'ACTIVE';
                 } else {
                     self::cancelOrder($edit_id, $amount, $this_user_id);
                     $order_status = 'OUT_OF_FUNDS';
                 }
             } else {
                 if (!$this_funds_finished) {
                     db_insert('orders', array('date' => date('Y-m-d H:i:s'), 'order_type' => $CFG->order_type_bid, 'site_user' => $this_user_id, 'btc' => $amount, 'fiat' => $amount * $price, 'currency' => $currency_info['id'], 'btc_price' => $price != $stop_price ? $market_price && $max_price > 0 ? $max_price : $price : 0, 'market_price' => $market_price ? 'Y' : 'N', 'log_id' => $order_log_id, 'stop_price' => $stop_price));
                     $new_order = $stop_price != $price && $stop_price > 0 ? 2 : 1;
                     $order_status = 'ACTIVE';
                 } else {
                     self::cancelOrder(false, $amount, $this_user_id);
                     $order_status = 'OUT_OF_FUNDS';
                 }
             }
         } elseif ($edit_id > 0) {
             self::setStatus($edit_id, 'FILLED');
             db_delete('orders', $edit_id);
             $order_status = 'FILLED';
         } else {
             self::setStatus(false, 'FILLED', $order_log_id);
             $order_status = 'FILLED';
         }
         db_insert('history', array('date' => date('Y-m-d H:i:s'), 'ip' => !empty($CFG->client_ip) ? $CFG->client_ip : '', 'history_action' => $CFG->history_buy_id, 'site_user' => $this_user_id, 'order_id' => $order_log_id));
     } else {
         if ($price != $stop_price) {
             $compatible = self::getCompatible($CFG->order_type_bid, $price, $currency1, $amount, 1, $market_price, false, $use_maker_fee, $this_user_id);
             $no_compatible = !$compatible;
             $compatible = is_array($compatible) ? new ArrayIterator($compatible) : false;
             $compatible[] = array('continue' => 1);
             //$btc_commision = 0;
             $fiat_commision = false;
             $c = count($compatible);
             $i = 1;
         }
         if ($compatible) {
             foreach ($compatible as $comp_order) {
                 if (!empty($comp_order['is_market']) && $comp_order['is_market'] == 'Y' && $price > $ask) {
                     $hidden_executions[] = $comp_order;
                     continue;
                 }
                 if (!empty($comp_order['real_market_price']) && round($comp_order['real_market_price'], 2, PHP_ROUND_HALF_UP) >= $price && round($comp_order['fiat_price'], 2, PHP_ROUND_HALF_UP) < $price && !$market_price) {
                     $hidden_executions[] = $comp_order;
                     continue;
                 }
                 if (!empty($comp_order['order_type']) && $comp_order['order_type'] == $CFG->order_type_ask) {
                     if ($comp_order['is_market'] == 'Y') {
                         $hidden_executions[] = $comp_order;
                     }
                     continue;
                 }
                 if (!($amount > 0) || !($this_btc_balance - $this_btc_on_hold > 0)) {
                     $triggered = self::triggerStops($max_price, $min_price, $currency1, false, $bid, $ask, $currency_max, $currency_min);
                     $triggered_rows = self::getMarketOrders();
                     if ($triggered_rows) {
                         $hidden_executions = array_merge($triggered_rows, $hidden_executions);
                     }
                     break;
                 } elseif ($i == $c && $min_price > 0) {
                     $triggered = self::triggerStops($max_price, $min_price, $currency1, false, $bid, $ask, $currency_max, $currency_min);
                     if ($triggered > 0) {
                         $triggered_rows = self::getCompatible($CFG->order_type_bid, $min_price, $currency1, $amount, 1, $market_price, $executed_orders, false, false, true);
                         if ($triggered_rows) {
                             foreach ($triggered_rows as $triggered_row) {
                                 $compatible->append($triggered_row);
                             }
                         }
                     }
                 }
                 if (!empty($comp_order['continue']) || $comp_order['site_user'] == $this_user_id) {
                     $i++;
                     continue;
                 }
                 $comp_user_info = self::lockOrder($comp_order['site_user'], $comp_order['id'], $comp_order['currency_id']);
                 if (!$comp_user_info) {
                     continue;
                 }
                 $comp_order = array_merge($comp_order, $comp_user_info);
                 $comp_order['btc_balance'] = array_key_exists($comp_order['site_user'], $comp_btc_balance) ? $comp_btc_balance[$comp_order['site_user']] : $comp_order['btc_balance'];
                 $comp_order['fiat_balance'] = array_key_exists($comp_order['site_user'], $comp_fiat_balance) ? $comp_fiat_balance[$comp_order['site_user']] : $comp_order['fiat_balance'];
                 $comp_fiat_on_hold[$comp_order['site_user']] = array_key_exists($comp_order['site_user'], $comp_fiat_on_hold) ? $comp_fiat_on_hold[$comp_order['site_user']] : round($comp_order['fiat_on_hold'], 2, PHP_ROUND_HALF_UP);
                 $comp_fiat_this_on_hold = $comp_fiat_on_hold[$comp_order['site_user']] - ($comp_order['btc_outstanding'] * $comp_order['orig_btc_price'] + $comp_order['fee1'] * 0.01 * ($comp_order['btc_outstanding'] * $comp_order['orig_btc_price']));
                 $max_amount = $this_btc_balance - $this_btc_on_hold > $amount ? $amount : $this_btc_balance - $this_btc_on_hold;
                 $max_comp_amount = ($comp_order['fiat_balance'] - $comp_fiat_this_on_hold) / $comp_order['orig_btc_price'] > $comp_order['btc_outstanding'] + $comp_order['fee1'] * 0.01 * $comp_order['btc_outstanding'] ? $comp_order['btc_outstanding'] : ($comp_order['fiat_balance'] - $comp_fiat_this_on_hold) / $comp_order['orig_btc_price'] - $comp_order['fee1'] * 0.01 * (($comp_order['fiat_balance'] - $comp_fiat_this_on_hold) / $comp_order['orig_btc_price']);
                 $this_funds_finished = $max_amount < $amount;
                 $comp_funds_finished = $max_comp_amount < $comp_order['btc_outstanding'];
                 if (!($max_amount > 0) || !($max_comp_amount > 0)) {
                     if ($comp_funds_finished) {
                         self::cancelOrder($comp_order['id'], 0, $comp_order['site_user']);
                     }
                     $i++;
                     continue;
                 }
                 if ($max_comp_amount >= $max_amount) {
                     $trans_amount = $max_amount;
                     $comp_order_outstanding = $comp_order['btc_outstanding'] - $amount;
                     $amount = $amount - $max_amount;
                 } else {
                     $trans_amount = $max_comp_amount;
                     $amount = $amount - $trans_amount;
                     $comp_order_outstanding = $comp_order['btc_outstanding'] - $max_comp_amount;
                 }
                 $this_fee = $fee * 0.01 * $trans_amount;
                 $comp_order_fee = $comp_order['fee1'] * 0.01 * $trans_amount;
                 $this_trans_amount_net = $trans_amount - $this_fee;
                 $this_conversion_fee = $currency_info['id'] != $comp_order['currency_id'] ? $comp_order['orig_btc_price'] * $comp_order['orig_conversion_factor'] * $trans_amount - $comp_order['fiat_price'] * $trans_amount : 0;
                 $comp_order_trans_amount_net = $trans_amount + $comp_order_fee;
                 $comp_btc_balance[$comp_order['site_user']] = $comp_order['btc_balance'] + $trans_amount;
                 $comp_fiat_balance[$comp_order['site_user']] = $comp_order['fiat_balance'] - round($comp_order['orig_btc_price'] * $comp_order_trans_amount_net, 2, PHP_ROUND_HALF_UP);
                 $comp_fiat_on_hold[$comp_order['site_user']] = $comp_fiat_on_hold[$comp_order['site_user']] - round($comp_order['orig_btc_price'] * $comp_order_trans_amount_net, 2, PHP_ROUND_HALF_UP);
                 //$btc_commision += $comp_order_fee;
                 if (!empty($fiat_commision[strtolower($currency_info['currency'])])) {
                     $fiat_commision[strtolower($currency_info['currency'])] += $this_fee * $comp_order['fiat_price'];
                 } else {
                     $fiat_commision[strtolower($currency_info['currency'])] = $this_fee * $comp_order['fiat_price'];
                 }
                 if (!empty($fiat_commision[strtolower($comp_order['currency_abbr'])])) {
                     $fiat_commision[strtolower($comp_order['currency_abbr'])] += $comp_order_fee * $comp_order['orig_btc_price'];
                 } else {
                     $fiat_commision[strtolower($comp_order['currency_abbr'])] = $comp_order_fee * $comp_order['orig_btc_price'];
                 }
                 $this_prev_btc = $this_btc_balance;
                 $this_prev_fiat = $this_fiat_balance;
                 $this_btc_balance -= $trans_amount;
                 $this_fiat_balance += round($this_trans_amount_net * $comp_order['fiat_price'], 2, PHP_ROUND_HALF_UP);
                 $trans_total += $trans_amount;
                 $max_price = $comp_order['fiat_price'] > $max_price ? $comp_order['fiat_price'] : $max_price;
                 $min_price = $comp_order['fiat_price'] < $min_price || !($min_price > 0) ? $comp_order['fiat_price'] : $min_price;
                 if ($currency_info['id'] != $comp_order['currency_id']) {
                     $currency_max[$comp_order['currency_id']] = $comp_order['orig_btc_price'] > $currency_max[$comp_order['currency_id']] ? $comp_order['orig_btc_price'] : $currency_max[$comp_order['currency_id']];
                     $currency_min[$comp_order['currency_id']] = $comp_order['orig_btc_price'] < $currency_min[$comp_order['currency_id']] || !($currency_min[$comp_order['currency_id']] > 0) ? $comp_order['orig_btc_price'] : $currency_min[$comp_order['currency_id']];
                 }
                 $trans_info = array('date' => date('Y-m-d H:i:s'), 'site_user' => $this_user_id, 'transaction_type' => $CFG->transactions_sell_id, 'site_user1' => $comp_order['site_user'], 'transaction_type1' => $CFG->transactions_buy_id, 'btc' => $trans_amount, 'btc_price' => $comp_order['fiat_price'], 'fiat' => $comp_order['fiat_price'] * $trans_amount, 'currency' => $currency_info['id'], 'currency1' => $comp_order['currency_id'], 'fee' => $this_fee, 'fee1' => $comp_order_fee, 'btc_net' => $this_trans_amount_net, 'btc_net1' => $comp_order_trans_amount_net, 'btc_before' => $this_prev_btc, 'btc_after' => $this_btc_balance, 'fiat_before' => $this_prev_fiat, 'fiat_after' => $this_fiat_balance, 'btc_before1' => $comp_order['btc_balance'], 'btc_after1' => $comp_btc_balance[$comp_order['site_user']], 'fiat_before1' => $comp_order['fiat_balance'], 'fiat_after1' => $comp_fiat_balance[$comp_order['site_user']], 'log_id' => $order_log_id, 'log_id1' => $comp_order['log_id'], 'fee_level' => $fee, 'fee_level1' => $comp_order['fee'], 'conversion_fee' => $this_conversion_fee, 'orig_btc_price' => $comp_order['orig_btc_price'], 'bid_at_transaction' => $bid, 'ask_at_transaction' => $ask);
                 if ($currency_info['id'] != $comp_order['currency_id']) {
                     $trans_info = array_merge($trans_info, array('conversion' => 'Y', 'convert_amount' => $comp_order['orig_btc_price'] * $trans_amount, 'convert_rate_given' => $comp_order['conversion_factor'], 'convert_system_rate' => $comp_order['orig_conversion_factor'], 'convert_from_currency' => $comp_order['currency_id'], 'convert_to_currency' => $currency_info['id']));
                 }
                 $transaction_id = db_insert('transactions', $trans_info);
                 $executed_orders[] = $comp_order['id'];
                 $executed_prices[] = array('price' => $comp_order['fiat_price'], 'amount' => $trans_amount);
                 $executed_orig_prices[$comp_order['id']] = array('price' => $comp_order['orig_btc_price'], 'amount' => $trans_amount);
                 ++$transactions;
                 if ($currency_info['id'] != $comp_order['currency_id']) {
                     db_update('transactions', $transaction_id, array('conversion' => 'Y', 'convert_amount' => $comp_order['orig_btc_price'] * $trans_amount, 'convert_rate_given' => $comp_order['conversion_factor'], 'convert_system_rate' => $comp_order['orig_conversion_factor'], 'convert_from_currency' => $comp_order['currency_id'], 'convert_to_currency' => $currency_info['id']));
                 }
                 if (round($comp_order_outstanding, 8, PHP_ROUND_HALF_UP) > 0) {
                     if (!$comp_funds_finished) {
                         db_update('orders', $comp_order['id'], array('btc_price' => $comp_order['orig_btc_price'], 'btc' => $comp_order_outstanding, 'fiat' => $comp_order['orig_btc_price'] * $comp_order_outstanding));
                         if ($comp_order['is_market'] == 'Y') {
                             $hidden_executions[] = $comp_order;
                         }
                     } else {
                         self::cancelOrder($comp_order['id'], $comp_order_outstanding, $comp_order['site_user']);
                     }
                 } else {
                     self::setStatus($comp_order['id'], 'FILLED');
                     db_delete('orders', $comp_order['id']);
                 }
                 User::updateBalances($comp_order['site_user'], array('btc' => $comp_btc_balance[$comp_order['site_user']], $comp_order['currency_abbr'] => $comp_fiat_balance[$comp_order['site_user']]));
                 $i++;
             }
         }
         if ($trans_total > 0) {
             User::updateBalances($this_user_id, array('btc' => $this_btc_balance, $currency1 => $this_fiat_balance));
             if ($fiat_commision) {
                 Status::updateEscrows($fiat_commision);
             }
         }
         if (round($amount, 8, PHP_ROUND_HALF_UP) > 0) {
             if ($edit_id > 0) {
                 if (!$this_funds_finished) {
                     if (!($no_compatible && $external_transaction)) {
                         db_update('orders', $edit_id, array('btc' => $amount, 'fiat' => $amount * $price, 'btc_price' => $price != $stop_price ? $price : 0, 'market_price' => $market_price ? 'Y' : 'N', 'log_id' => $order_log_id, 'stop_price' => $stop_price));
                         $edit_order = 1;
                     }
                     $order_status = 'ACTIVE';
                 } else {
                     self::cancelOrder($edit_id, $amount, $this_user_id);
                     $order_status = 'OUT_OF_FUNDS';
                 }
             } else {
                 if (!$this_funds_finished) {
                     $insert_id = db_insert('orders', array('date' => date('Y-m-d H:i:s'), 'order_type' => $CFG->order_type_ask, 'site_user' => $this_user_id, 'btc' => $amount, 'fiat' => $amount * $price, 'currency' => $currency_info['id'], 'btc_price' => $price != $stop_price ? $market_price && $min_price > 0 ? $min_price : $price : 0, 'market_price' => $market_price ? 'Y' : 'N', 'log_id' => $order_log_id, 'stop_price' => $stop_price));
                     $new_order = $stop_price != $price && $stop_price > 0 ? 2 : 1;
                     $order_status = 'ACTIVE';
                 } else {
                     self::cancelOrder(false, $amount, $this_user_id);
                     $order_status = 'OUT_OF_FUNDS';
                 }
             }
         } elseif ($edit_id > 0) {
             self::setStatus($edit_id, 'FILLED');
             db_delete('orders', $edit_id);
             $order_status = 'FILLED';
         } else {
             self::setStatus(false, 'FILLED', $order_log_id);
             $order_status = 'FILLED';
         }
         db_insert('history', array('date' => date('Y-m-d H:i:s'), 'ip' => !empty($CFG->client_ip) ? $CFG->client_ip : '', 'history_action' => $CFG->history_sell_id, 'site_user' => $this_user_id, 'order_id' => $order_log_id));
     }
     db_commit();
     if ($max_price > 0 && $currency1 == 'usd') {
         db_update('currencies', $CFG->btc_currency_id, array('usd_ask' => $max_price));
     }
     if ($min_price > 0 && $currency1 == 'usd') {
         db_update('currencies', $CFG->btc_currency_id, array('usd_bid' => $min_price));
     }
     if ($hidden_executions && !$external_transaction) {
         foreach ($hidden_executions as $comp_order) {
             if ($triggered_rows && $comp_order['is_market'] != 'Y') {
                 continue;
             }
             $return = self::executeOrder($comp_order['order_type'] == $CFG->order_type_bid, $comp_order['orig_btc_price'], $comp_order['btc_outstanding'], strtolower($comp_order['currency_abbr']), false, $comp_order['is_market'] == 'Y', $comp_order['id'], $comp_order['site_user'], true, $comp_order['stop_price'], true, true);
             if (!empty($return['order_info']['comp_orig_prices'][$edit_id ? $edit_id : $insert_id])) {
                 $executed_prices[] = $return['order_info']['comp_orig_prices'][$edit_id ? $edit_id : $insert_id];
                 ++$transactions;
             }
         }
         if ($verbose) {
             $reevaluated_order = DB::getRecord('orders', $edit_id ? $edit_id : $insert_id, 0, 1);
             if (!$reevaluated_order) {
                 $order_status = 'FILLED';
             } else {
                 $amount = $reevaluated_order['btc'];
             }
         }
     }
     $order_info = false;
     if ($verbose) {
         if ($executed_prices) {
             foreach ($executed_prices as $exec) {
                 $exec_amount[] = $exec['amount'];
             }
             $exec_amount_sum = array_sum($exec_amount);
             foreach ($executed_prices as $exec) {
                 $avg_exec[] = $exec['amount'] / $exec_amount_sum * $exec['price'];
             }
         }
         $order_info = array('id' => $order_log_id, 'side' => $buy ? 'buy' : 'sell', 'type' => $market_price ? 'market' : ($stop_price > 0 ? 'stop' : 'limit'), 'amount' => $orig_amount, 'amount_remaining' => $amount, 'price' => round($price, 8, PHP_ROUND_HALF_UP), 'avg_price_executed' => count($executed_prices) > 0 ? round(array_sum($avg_exec), 2, PHP_ROUND_HALF_UP) : 0, 'stop_price' => $stop_price, 'currency' => strtoupper($currency1), 'status' => $order_status, 'replaced' => $edit_id ? $orig_order['log_id'] : 0, 'comp_orig_prices' => $executed_orig_prices);
     }
     return array('transactions' => $transactions, 'new_order' => $new_order, 'edit_order' => $edit_order, 'executed' => $executed_orders, 'order_info' => $order_info);
 }
Пример #6
0
    Link::redirect('index.php');
}
API::add('Content', 'getRecord', array('logged-out'));
$query = API::send();
$page_title = Lang::string('log-out');
$content = $query['Content']['getRecord']['results'][0];
include 'includes/head.php';
?>
<div class="page_title">
	<div class="container">
		<div class="title"><h1><?php 
echo $page_title;
?>
</h1></div>
        <div class="pagenation">&nbsp;<a href="index.php"><?php 
echo Lang::string('home');
?>
</a> <i>/</i> <a href="news.php"><?php 
echo $page_title;
?>
</a></div>
	</div>
</div>
<div class="container">
	<div class="content_right">
		<h2><?php 
echo $content['title'];
?>
</h2>
        <div class="text"><?php 
echo $content['content'];
Пример #7
0
	<div class="container">
		<div class="title"><h1><?php 
echo $page_title;
?>
</h1></div>
        <div class="pagenation">&nbsp;<a href="<?php 
echo Lang::url('index.php');
?>
"><?php 
echo Lang::string('home');
?>
</a> <i>/</i> <a href="<?php 
echo Lang::url('our-security.php');
?>
"><?php 
echo Lang::string('our-security');
?>
</a></div>
	</div>
</div>
<div class="container">
	<div class="content_right">
    <div class="text1"><?php 
echo $content['content'];
?>
</div>
    </div>
    <?php 
include 'includes/sidebar_topics.php';
?>
	<div class="clearfix mar_top8"></div>
Пример #8
0
        ?>
</div>
					</div>
				</div>
			</div>
		</div>
		<?php 
        echo $c != $i ? '<div class="clearfix divider_line3"></div>' : '';
        ?>
			<?php 
        $i++;
    }
}
?>
        <div class="clearfix mar_top5"></div>
        <a href="<?php 
echo Lang::url('press-releases.php');
?>
" class="highlight gray bigger"><i class="fa fa-plus-square"></i> <?php 
echo Lang::string('news-see-all');
?>
</a>
    </div>
	<div class="clearfix mar_top8"></div>
</div><!-- end features section 3 -->




<?php 
include 'includes/foot.php';
Пример #9
0
            <div class="text"><p><?php 
echo Lang::string('settings-pass-explain');
?>
</p></div>
            <div class="content">
            	<h3 class="section_label">
                    <span class="left"><i class="fa fa-user fa-2x"></i></span>
                    <span class="right"><?php 
echo Lang::string('settings-personal-password');
?>
</span>
                </h3>
                <div class="clear"></div>
                <?php 
$personal->passwordInput('pass', Lang::string('settings-pass'), true);
$personal->passwordInput('pass2', Lang::string('settings-pass-confirm'), true, false, false, false, false, false, 'pass');
$personal->HTML('<div class="form_button"><input type="submit" name="submit" value="' . Lang::string('settings-save-password') . '" class="but_user" /></div>');
$personal->hiddenInput('uniq', 1, $_SESSION["firstlogin_uniq"]);
$personal->display();
?>
            	<div class="clear"></div>
            </div>       
            <div class="mar_top8"></div>
        </div>
	</div>
	<?php 
include 'includes/sidebar_account.php';
?>
</div>
<?php 
include 'includes/foot.php';
Пример #10
0
        			</tr>
        			<?php 
if ($requests) {
    foreach ($requests as $request) {
        echo '
					<tr>
						<td>' . $request['id'] . '</td>
						<td><input type="hidden" class="localdate" value="' . strtotime($request['date']) . '" /></td>
						<td>' . $request['description'] . '</td>
						<td>' . ($CFG->currencies[$request['currency']]['is_crypto'] == 'Y' ? String::currency($request['amount'], true) . ' ' . $request['fa_symbol'] : $request['fa_symbol'] . String::currency($request['amount'])) . '</td>
    					<td>' . ($CFG->currencies[$request['currency']]['is_crypto'] == 'Y' ? String::currency($request['net_amount'] > 0 ? $request['net_amount'] : $request['amount'] - $request['fee'], true) . ' ' . $request['fa_symbol'] : $request['fa_symbol'] . String::currency($request['net_amount'] > 0 ? $request['net_amount'] : $request['amount'] - $request['fee'])) . '</td>
						<td>' . $request['status'] . '</td>
					</tr>';
    }
} else {
    echo '<tr><td colspan="6">' . Lang::string('withdraw-no') . '</td></tr>';
}
?>
        		</table>
			</div>
			<?php 
echo $pagination;
if (empty($_REQUEST['bypass'])) {
    ?>
		</div>
		<div class="mar_top5"></div>
	</div>
	<?php 
    include 'includes/sidebar_account.php';
    ?>
</div>
Пример #11
0
include 'includes/head.php';
?>
<div class="page_title">
	<div class="container">
		<div class="title"><h1><?php 
echo $page_title;
?>
</h1></div>
        <div class="pagenation">&nbsp;<a href="<?php 
echo Lang::url('index.php');
?>
"><?php 
echo Lang::string('home');
?>
</a> <i>/</i> <a href="withdrawing-account.php"><?php 
echo Lang::string('withdrawing-account');
?>
</a></div>
	</div>
</div>
<div class="container">
	<div class="content_right">
    <div class="text"><?php 
echo $content['content'];
?>
</div>
    </div>
    <?php 
include 'includes/sidebar_topics.php';
?>
	<div class="clearfix mar_top8"></div>
Пример #12
0
	<div class="container">
		<div class="title"><h1><?php 
echo $page_title;
?>
</h1></div>
        <div class="pagenation">&nbsp;<a href="<?php 
echo Lang::url('index.php');
?>
"><?php 
echo Lang::string('home');
?>
</a> <i>/</i> <a href="<?php 
echo Lang::url('terms.php');
?>
"><?php 
echo Lang::string('terms');
?>
</a></div>
	</div>
</div>
<div class="container">
	<div class="content_right">
    <div class="text"><?php 
echo $content['content'];
?>
</div>
    </div>
    <?php 
include 'includes/sidebar_topics.php';
?>
	<div class="clearfix mar_top8"></div>
Пример #13
0
$content = str_replace('(boolean)', '<u>(boolean)</u>', $content);
$content = str_replace('(array)', '<u>(array)</u>', $content);
$content = preg_replace("#<div\\s(.+?)>\\s+<p>(.+?)<\\/p>\\s+<\\/div>#is", "<pre \$1><code \$1>\$2</code></pre>", $content);
include 'includes/head.php';
?>
<div class="page_title">
	<div class="container">
		<div class="title"><h1><?php 
echo $page_title;
?>
</h1></div>
        <div class="pagenation">&nbsp;<a href="index.php"><?php 
echo Lang::string('home');
?>
</a> <i>/</i> <a href="api-docs.php"><?php 
echo Lang::string('api-docs');
?>
</a></div>
	</div>
</div>
<div class="container">
	<div class="content_right">
    <div class="text2"><?php 
echo $content['content'];
?>
</div>
    </div>
    <?php 
include 'includes/sidebar_topics.php';
?>
	<div class="clearfix mar_top8"></div>
Пример #14
0
} elseif (!User::isLoggedIn()) {
    Link::redirect('login.php');
}
include 'includes/head.php';
?>
<div class="page_title">
	<div class="container">
		<div class="title"><h1><?php 
echo $page_title;
?>
</h1></div>
        <div class="pagenation">&nbsp;<a href="index.php"><?php 
echo Lang::string('home');
?>
</a> <i>/</i> <a href="account.php"><?php 
echo Lang::string('account');
?>
</a> <i>/</i> <a href="withdraw.php"><?php 
echo $page_title;
?>
</a></div>
	</div>
</div>
<div class="container">
	<div class="content_right">
		<div class="testimonials-4">
			<?php 
Errors::display();
?>
			<?php 
Messages::display();
Пример #15
0
		    	<?php 
} else {
    ?>
		    	<div style="margin-bottom:10px;">
		    		<div class="g-recaptcha" data-sitekey="<?php 
    echo $CFG->google_recaptch_api_key;
    ?>
"></div>
		    	</div>
		    	<?php 
}
?>
		    	<input type="hidden" name="uniq" value="<?php 
echo $_SESSION["forgot_uniq"];
?>
" />
	    		<input type="submit" name="submit" value="<?php 
echo Lang::string('login-forgot-send-new');
?>
" class="but_user" />
	    	</div>
    	</form>
    	<a class="forgot" href="login.php"><?php 
echo Lang::string('login-remembered');
?>
</a>
    </div>
    <div class="clearfix mar_top8"></div>
</div>
<?php 
include 'includes/foot.php';
Пример #16
0
    echo $CFG->self == 'withdraw.php' ? 'class="active"' : '';
    ?>
><?php 
    echo Lang::string('withdraw');
    ?>
</a></li>
                    <li style="display:none;"><a href="help.php"><?php 
    echo Lang::string('help');
    ?>
</a></li>
	                <li style="display:none;"><a href="contact.php"><?php 
    echo Lang::string('contact');
    ?>
</a></li>
	                <li style="display:none;"><a href="logout.php?log_out=1"><?php 
    echo Lang::string('log-out');
    ?>
</a></li>
	                <?php 
}
?>
                </ul>
            </div>
            
        </nav><!-- end nav menu -->
      
        </div>
        
        
		</div>
		
<?php

include '../lib/common.php';
if (User::$info['locked'] == 'Y' || User::$info['deactivated'] == 'Y') {
    Link::redirect('settings.php');
} elseif (User::$awaiting_token) {
    Link::redirect('verify-token.php');
} elseif (!User::isLoggedIn()) {
    Link::redirect('login.php');
}
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=transactions_' . date('Y-m-d') . '.csv');
API::add('Transactions', 'get', array(false, false, false, false, false, 1, false, false, false, false, false, 1));
$query = API::send();
$transactions = $query['Transactions']['get']['results'][0];
if ($transactions) {
    $output = fopen('php://output', 'w');
    fputcsv($output, array(' ' . Lang::string('transactions-type') . ' ', ' ' . Lang::string('transactions-time') . ' ', ' ' . Lang::string('market') . ' ', ' ' . Lang::string('currency') . ' ', ' ' . Lang::string('orders-amount') . ' ', ' ' . Lang::string('transactions-fiat') . ' ', ' ' . Lang::string('orders-price') . ' ', ' ' . Lang::string('transactions-fee') . ' '));
    foreach ($transactions as $transaction) {
        fputcsv($output, array(' ' . $transaction['type'] . ' ', ' ' . date('M j, Y, H:i', strtotime($transaction['date']) + $CFG->timezone_offset) . ' UTC ', ' ' . $CFG->currencies[$transaction['c_currency']]['currency'] . ' ', ' ' . $CFG->currencies[$transaction['currency']]['currency'] . ' ', ' ' . String::currency($transaction['btc'], true) . ' ', ' ' . String::currency($transaction['btc_net'] * $transaction['fiat_price'], $transaction['is_crypto'] == 'Y') . ' ', ' ' . String::currency($transaction['fiat_price'], $transaction['is_crypto'] == 'Y') . ' ', ' ' . String::currency($transaction['fee'] * $transaction['fiat_price'], $transaction['is_crypto'] == 'Y') . ' '));
    }
}
Пример #18
0
			    <h3><i><?php 
echo Lang::string('contact-inquiries');
?>
</i></h3>
			    <?php 
Messages::display();
Errors::display();
$contact->textInput('first_name', Lang::string('settings-first-name'), 0, User::$info['first_name']);
$contact->textInput('last_name', Lang::string('settings-last-name'), 0, User::$info['last_name']);
$contact->textInput('company', Lang::string('settings-company'));
$contact->textInput('email', Lang::string('settings-email'), 'email', User::$info['email']);
$contact->selectInput('country', Lang::string('settings-country'), 0, User::$info['country'], $countries, false, array('name'));
$contact->textInput('subject', Lang::string('settings-subject'), 1);
$contact->textEditor('message', Lang::string('settings-message'), 1, false, false, false, false, true, false, 200);
$contact->captcha(Lang::string('settings-capcha'));
$contact->HTML('<div class="form_button"><input type="submit" name="submit" value="' . Lang::string('contact-send') . '" class="but_user" /></div>');
$contact->hiddenInput('uniq', 1, $_SESSION["contact_uniq"]);
$contact->display();
?>
		    </div>
		    <div class="one_half last">
		        <div class="address-info">
		            <h3><i><?php 
echo $content1['title'];
?>
</i></h3>
		                <ul>
		                <li><?php 
echo $content1['content'];
?>
</li>
Пример #19
0
        			<?php 
if ($transactions) {
    foreach ($transactions as $transaction) {
        $trans_symbol = $CFG->currencies[$transaction['currency']]['fa_symbol'];
        echo '
					<tr id="transaction_' . $transaction['id'] . '">
						<td>' . $transaction['type'] . '</td>
						<td><input type="hidden" class="localdate" value="' . strtotime($transaction['date']) . '" /></td>
						<td>' . number_format($transaction['btc'], 8) . '</td>
						<td>' . $trans_symbol . number_format($transaction['btc_net'] * $transaction['fiat_price'], 2) . '</td>
						<td>' . $trans_symbol . number_format($transaction['fiat_price'], 2) . '</td>
						<td>' . $trans_symbol . number_format($transaction['fee'] * $transaction['fiat_price'], 2) . '</td>
					</tr>';
    }
}
echo '<tr id="no_transactions" style="' . (is_array($transactions) ? 'display:none;' : '') . '"><td colspan="6">' . Lang::string('transactions-no') . '</td></tr>';
?>
        		</table>
        		<?php 
echo $pagination;
?>
			</div>
			<div class="clear"></div>
		</div>
<?php 
if (!$bypass) {
    ?>
		<div class="mar_top5"></div>
	</div>
	<?php 
    include 'includes/sidebar_account.php';
Пример #20
0
        <div id="filters_area">
	        <?php 
}
if ($news) {
    $i = 1;
    $c = count($news);
    foreach ($news as $news_item) {
        ?>
			<div class="blog_post">
				<div class="blog_postcontent">
					<div class="post_info_content_small nomargin">
						<a class="date" href="#" onclick="return false;"><strong><?php 
        echo date('j', strtotime($news_item['date']));
        ?>
</strong><i><?php 
        echo Lang::string(strtolower(date('M', strtotime($news_item['date']))));
        ?>
</i></a>
						<div class="postcontent">	
							<h3><a href="#" onclick="return false;"><?php 
        echo $news_item['title_' . $CFG->language];
        ?>
</a></h3>
							<div class="posttext"><?php 
        echo $news_item['content_' . $CFG->language];
        ?>
</div>
						</div>
					</div>
				</div>
			</div>
Пример #21
0
$query = API::send();
$content = $query['Content']['getRecord']['results'][0];
$page_title = $content['title'];
include 'includes/head.php';
?>
<div class="page_title">
	<div class="container">
		<div class="title"><h1><?php 
echo $page_title;
?>
</h1></div>
        <div class="pagenation">&nbsp;<a href="index.php"><?php 
echo Lang::string('home');
?>
</a> <i>/</i> <a href="reset-2fa.php"><?php 
echo Lang::string('reset-2fa');
?>
</a></div>
	</div>
</div>
<div class="container">
	<div class="content_right">
    <div class="text"><?php 
echo $content['content'];
?>
</div>
    </div>
    <?php 
include 'includes/sidebar_topics.php';
?>
	<div class="clearfix mar_top8"></div>
Пример #22
0
"><?php 
    echo Lang::string('what-are-bitcoins');
    ?>
</a></li>
                <li><a href="<?php 
    echo Lang::url('how-bitcoin-works.php');
    ?>
"><?php 
    echo Lang::string('how-bitcoin-works');
    ?>
</a></li>
                <li><a href="<?php 
    echo Lang::url('buy-and-sell-bitcoin.php');
    ?>
"><?php 
    echo Lang::string('how-to-register');
    ?>
</a></li>
            </ul>
         </div>
         <?php 
}
?>
    </div>
	
    <div class="clearfix mar_top5"></div>
    
</div>


<div class="copyright_info">
Пример #23
0
    echo $token1;
    ?>
" />
								<div class="clear"></div>
							</div>
							 <div class="mar_top2"></div>
							 <ul class="list_empty">
								<li><input type="submit" name="submit" value="<?php 
    echo Lang::string('security-validate');
    ?>
" class="but_user" /></li>
								<?php 
    if (User::$info['using_sms'] == 'Y') {
        ?>
								<li><input type="submit" name="sms" value="<?php 
        echo Lang::string('security-resend-sms');
        ?>
" class="but_user" /></li>
								<?php 
    }
    ?>
							</ul>
						</div>
					</div>
				</form>
                <div class="clear"></div>
			</div>
            <?php 
}
?>
 
Пример #24
0
	<div class="container">
		<div class="title"><h1><?php 
echo $page_title;
?>
</h1></div>
        <div class="pagenation">&nbsp;<a href="<?php 
echo Lang::url('index.php');
?>
"><?php 
echo Lang::string('home');
?>
</a> <i>/</i> <a href="<?php 
echo Lang::url('about.php');
?>
"><?php 
echo Lang::string('about');
?>
</a></div>
	</div>
</div>
<div class="container">
	<div class="content_right">
    <div class="text1"><?php 
echo $content['content'];
?>
</div>
    </div>
    <?php 
include 'includes/sidebar_topics.php';
?>
	<div class="clearfix mar_top8"></div>
Пример #25
0
</th>
        			</tr>
        			<?php 
if ($requests) {
    foreach ($requests as $request) {
        echo '
					<tr>
						<td>' . $request['id'] . '</td>
						<td><input type="hidden" class="localdate" value="' . strtotime($request['date']) . '" /></td>
						<td>' . $request['description'] . '</td>
						<td>' . ($CFG->currencies[$request['currency']]['is_crypto'] == 'Y' ? String::currency($request['amount'], true) . ' ' . $request['fa_symbol'] : $request['fa_symbol'] . String::currency($request['amount'])) . '</td>
						<td>' . $request['status'] . '</td>
					</tr>';
    }
} else {
    echo '<tr><td colspan="5">' . Lang::string('deposit-no') . '</td></tr>';
}
?>
        		</table>
			</div>
			<?php 
echo $pagination;
if (empty($_REQUEST['bypass'])) {
    ?>
		</div>
		<div class="mar_top5"></div>
	</div>
	<?php 
    include 'includes/sidebar_account.php';
    ?>
</div>
Пример #26
0
><div class="contain"><?php 
        echo Lang::string('buy-sell');
        ?>
</div><div class="bg"></div></a></li>
                    <li><a href="deposit.php" <?php 
        echo $CFG->self == 'deposit.php' ? 'class="active"' : '';
        ?>
><div class="contain"><?php 
        echo Lang::string('deposit');
        ?>
</div><div class="bg"></div></a></li>
                    <li><a href="withdraw.php" <?php 
        echo $CFG->self == 'withdraw.php' ? 'class="active"' : '';
        ?>
><div class="contain"><?php 
        echo Lang::string('withdraw');
        ?>
</div><div class="bg"></div></a></li>
	                <?php 
    }
    ?>
                </ul>
            </div>
            
        </nav><!-- end nav menu -->
      
        </div>
        
        
		</div>
		
Пример #27
0
include 'includes/head.php';
?>
<div class="page_title">
	<div class="container">
		<div class="title"><h1><?php 
echo $page_title;
?>
</h1></div>
        <div class="pagenation">&nbsp;<a href="<?php 
echo Lang::url('index.php');
?>
"><?php 
echo Lang::string('home');
?>
</a> <i>/</i> <a href="securing-account.php"><?php 
echo Lang::string('securing-account');
?>
</a></div>
	</div>
</div>
<div class="container">
	<div class="content_right">
    <div class="text"><?php 
echo $content['content'];
?>
</div>
    </div>
    <?php 
include 'includes/sidebar_topics.php';
?>
	<div class="clearfix mar_top8"></div>
Пример #28
0
 static function sendSMS($authy_id = false)
 {
     global $CFG;
     API::add('User', 'sendSMS', array($authy_id));
     $query = API::send();
     $response = $query['User']['sendSMS']['results'][0];
     if (!$response || !is_array($response)) {
         Errors::add(Lang::string('security-com-error'));
     } elseif ($response['success'] == false) {
         Errors::merge($response['errors']);
     } else {
         return true;
     }
 }
Пример #29
0
<?php

include '../lib/common.php';
if (User::$info['locked'] == 'Y' || User::$info['deactivated'] == 'Y') {
    Link::redirect('settings.php');
} elseif (User::$awaiting_token) {
    Link::redirect('verify-token.php');
} elseif (!User::isLoggedIn()) {
    Link::redirect('login.php');
}
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=transactions_' . date('Y-m-d') . '.csv');
API::add('Transactions', 'get', array(false, false, false, false, 1, false, false, false, false, false, 1));
$query = API::send();
$transactions = $query['Transactions']['get']['results'][0];
if ($transactions) {
    $output = fopen('php://output', 'w');
    fputcsv($output, array(' ' . Lang::string('transactions-type') . ' ', ' ' . Lang::string('transactions-time') . ' ', ' ' . Lang::string('transactions-btc') . ' ', ' ' . Lang::string('currency') . ' ', ' ' . Lang::string('transactions-fiat') . ' ', ' ' . Lang::string('transactions-price') . ' ', ' ' . Lang::string('transactions-fee') . ' '));
    foreach ($transactions as $transaction) {
        fputcsv($output, array(' ' . $transaction['type'] . ' ', ' ' . date('M j, Y, H:i', strtotime($transaction['date']) + $CFG->timezone_offset) . ' UTC ', ' ' . number_format($transaction['btc'], 8) . ' ', ' ' . $transaction['currency'] . ' ', ' ' . number_format($transaction['btc_net'] * $transaction['fiat_price'], 2) . ' ', ' ' . number_format($transaction['fiat_price'], 2) . ' ', ' ' . number_format($transaction['fee'] * $transaction['fiat_price'], 2) . ' '));
    }
}
Пример #30
0
	                <div class="one_half last">
						<div class="label"><?php 
echo Lang::string('account-fee-bracket');
?>
:</div>
						<div class="amount"><?php 
echo $fee_bracket['fee'];
?>
% <a title="<?php 
echo Lang::string('account-view-fee-schedule');
?>
" href="fee-schedule.php"><i class="fa fa-question-circle"></i></a></div>
	                </div>
	                <div class="one_half">
	                	<div class="label"><?php 
echo str_replace('[currency]', $CFG->currencies[$main['fiat']]['currency'], Lang::string('account-30-day-vol'));
?>
:</div>
	                	<div class="amount"><?php 
echo $CFG->currencies[$main['fiat']]['fa_symbol'] . String::currency($volume / $CFG->currencies[$main['fiat']]['usd_ask']);
?>
</div>
	                </div>
		            <div class="clear"></div>
	            </div>
	            <div class="clear"></div>
            </div>
            <div class="mar_top8"></div>
        </div>
	</div>
	<?php