Added new FB sdk, request overload isue fixed, RMT trade upto 10 decimal place, send or recieve payment in BTC
This commit is contained in:
parent
a5f43c739e
commit
256ff392cf
74
ajax/add_bank_account.php
Normal file
74
ajax/add_bank_account.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Abhishek Kumar Sinha
|
||||
* Date: 10/21/2017
|
||||
* Time: 5:57 PM
|
||||
*/
|
||||
|
||||
require_once '../includes/imp_files.php';
|
||||
|
||||
if (!checkLoginStatus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($_POST['job']) && trim($_POST['job']) == "add_bank_account") {
|
||||
if (isset($_POST['account_holder_name'],$_POST['account_number'],$_POST['bank_name'],$_POST['branch_name'],$_POST['bank_addr'], $_POST['bk_ctry'])) {
|
||||
|
||||
$account_holder_name = trim($_POST['account_holder_name']);
|
||||
$account_number = trim($_POST['account_number']);
|
||||
$bank_name = trim($_POST['bank_name']);
|
||||
$branch_name = trim($_POST['branch_name']);
|
||||
$bank_addr = trim($_POST['bank_addr']);
|
||||
$bk_ctry = (string) trim($_POST['bk_ctry']);
|
||||
|
||||
$std = new stdClass();
|
||||
$std->mesg = array();
|
||||
$std->error = true;
|
||||
|
||||
if (empty($account_holder_name) || empty($account_number) || empty($bank_name) || empty($branch_name) || empty($bank_addr) || empty($bk_ctry)) {
|
||||
$mess = "Bank Account Addition Failure: Please fill all fields with valid data!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!preg_match("/^[a-zA-Z ]+$/", $account_holder_name) == 1) {
|
||||
$mess = "Bank Account Addition Failure: Account Holder name must be only in alphabetical characters!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!preg_match("/^[a-zA-Z0-9]+$/", $account_number) == 1) {
|
||||
$mess = "Bank Account Addition Failure: Account number must be only in alphanumeric characters!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if((!preg_match("/^[a-zA-Z ]+$/", $bank_name) == 1) || (!preg_match("/^[a-zA-Z-,: ]+$/", $branch_name) == 1) || (!preg_match("/^[a-zA-Z ]+$/", $bk_ctry) == 1)) {
|
||||
$mess = "Bank Account Addition Failure: Bank name, Bank country and branch name must be only in alphabetical characters!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$add_bank_account = $OrderClass->add_bank_account($user_id, $account_holder_name, $bank_name, $account_number, $branch_name, $bank_addr, $bk_ctry);
|
||||
|
||||
if ($add_bank_account) {
|
||||
$mess = "Bank Account Addition: Bank account <strong>$account_number</strong> was added successfully.!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
$std->error = false;
|
||||
}
|
||||
|
||||
echo json_encode($std);
|
||||
exit;
|
||||
|
||||
}
|
||||
}
|
||||
21
ajax/check_new_orders.php
Normal file
21
ajax/check_new_orders.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Abhishek Kumar Sinha
|
||||
* Date: 12/1/2017
|
||||
* Time: 3:31 PM
|
||||
*/
|
||||
require_once '../includes/imp_files.php';
|
||||
|
||||
if (!checkLoginStatus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$last_trade_date = $_SESSION['last_trade_date'];
|
||||
|
||||
$lod = $OrderClass->get_last_order_date($last_trade_date);
|
||||
|
||||
if ($lod) {
|
||||
$_SESSION['last_trade_date'] = $UserClass->time_now();
|
||||
}
|
||||
echo $lod;
|
||||
@ -27,8 +27,7 @@ if (isset($_POST['task'], $_POST['id']) && trim($_POST['task'])=="delOrder") {
|
||||
$del_order = $OrderClass->del_order($del_id);
|
||||
|
||||
if ($del_order) {
|
||||
print_r($del_order);
|
||||
//return true;
|
||||
echo true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -67,17 +67,17 @@ if(isset($_POST['req']) && $_POST['req'] == 'loadMoreMyOrders') {
|
||||
}
|
||||
|
||||
$iter .= "<tr>";
|
||||
$iter .= "<td>$myOrder->OfferAssetTypeId</td>";
|
||||
$iter .= "<td>$myOrder->WantAssetTypeId</td>";
|
||||
$iter .= "<td>$myOrder->Price</td>";
|
||||
$iter .= "<td>$myOrder->Quantity</td>";
|
||||
$iter .= "<td>$status</td>";
|
||||
$iter .= "<td>".date('d M, Y h:i:sa', strtotime($myOrder->InsertDate))."</td>";
|
||||
$iter .= "<td>";
|
||||
if (trim($status) == 'Pending') {
|
||||
$iter .= "<button class='btn btn-danger btn-xs del_order' id='del_$myOrder->OrderId'>Cancel</button></td>";
|
||||
$iter .= "<button class='btn-danger del_order' id='del_$myOrder->OrderId'>Cancel</button></td>";
|
||||
}
|
||||
$iter .= "</td>";
|
||||
$iter .= "<td>$myOrder->OfferAssetTypeId</td>";
|
||||
$iter .= "<td>$myOrder->WantAssetTypeId</td>";
|
||||
$iter .= "<td>$status</td>";
|
||||
$iter .= "<td>".date('d M, Y h:i:sa', strtotime($myOrder->InsertDate))."</td>";
|
||||
$iter .= "</tr>";
|
||||
endforeach;
|
||||
}
|
||||
|
||||
129
ajax/load_cash_in_bank.php
Normal file
129
ajax/load_cash_in_bank.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Abhishek Kumar Sinha
|
||||
* Date: 10/24/2017
|
||||
* Time: 9:37 PM
|
||||
*/
|
||||
|
||||
require_once '../includes/imp_files.php';
|
||||
|
||||
if (!checkLoginStatus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($_POST['job'])) {
|
||||
if ($_POST['job']=='get_btc2usd') {
|
||||
$btc2usd = bitcoin_price_today();
|
||||
echo (float) $btc2usd;
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_POST['job']=='lcma') {
|
||||
if (isset($_POST['amount_to_load'], $_POST['eqv_btc'], $_POST['remarks'], $_POST['btc_today'])) {
|
||||
$amount_to_load= (float) trim($_POST['amount_to_load']);
|
||||
$equivalent_btc = (float) trim($_POST['eqv_btc']);
|
||||
$remarks = trim($_POST['remarks']);
|
||||
$btc_today = (float) trim($_POST['btc_today']);
|
||||
|
||||
$std = new stdClass();
|
||||
$std->mesg = array();
|
||||
$std->error = true;
|
||||
|
||||
if (empty($btc_today)) {
|
||||
$mess[] = "BTC2CASH Error: Something went wrong. Please refresh the page and try again.";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess." Failed to fetch price of 1 bitcoin today.");
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($amount_to_load) || empty($equivalent_btc)) {
|
||||
$mess[] = "BTC2CASH Error: Please fill all the required fields.";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$validate_user = $UserClass->check_user($user_id);
|
||||
|
||||
if($validate_user == "" || empty($validate_user)) {
|
||||
$mess = "BTC2CASH error: No such user exist. Please login again.";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->error = true;
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$email_id = trim($validate_user->Email);
|
||||
|
||||
if (!is_email($email_id)) {
|
||||
$mess = "BTC2CASH error: Please provide a valid email id!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
$std->error = true;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strlen($remarks) > 250) {
|
||||
$mess = "BTC2CASH error: Remarks up to 250 characters allowed only!";
|
||||
$std->mesg[] = $mess;
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->error = true;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!preg_match("/^[a-zA-Z0-9 \r\n]*$/", $remarks)) {
|
||||
$mess = "BTC2CASH error: Only alphanumeric characters are allowed in remarks!";
|
||||
$std->mesg[] = $mess;
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$reciever_email[] = RT;
|
||||
$email_from = RM;
|
||||
$email_sender = EMAIL_SENDER_NAME;
|
||||
$email_subject = EMAIL_SUBJECT_BTC_TO_CASH;
|
||||
$email_body = "<div style='width:100%; background-color: #6b7b6b; padding: 2em; color: gainsboro; '>
|
||||
<div class='panel-heading'>
|
||||
<h2 class='panel-title'>Load Cash in Exchange Request</h2>
|
||||
</div>
|
||||
<div class='panel-body'>
|
||||
<h5>Transfer Type: BITCOIN to CASH in Exchange(BTC2CASH)</h5>
|
||||
<p>RECIPIENT FULL NAME: <strong>".$log_fullName."</strong></p>
|
||||
<p>BTC TO SEND: <strong>BTC $equivalent_btc</strong></p>
|
||||
<p>CASH TO RECEIVE: <strong>$ $amount_to_load</strong></p>
|
||||
<p>1 BTC AT THE TIME OF REQUEST: $ $btc_today</p>
|
||||
<p>EMAIL: $email_id</p>
|
||||
<p>REMARKS: <strong>".$remarks."</strong></p>
|
||||
<p>SENDER FB ID: facebook.com/".$fb_id."</p>
|
||||
</div>
|
||||
<footer>
|
||||
<p>Thank You</p>
|
||||
<span>Regards</span><br><br>
|
||||
<a href='http://ranchimall.net' style='color:aliceblue'>Ranchi Mall</a>
|
||||
</footer>
|
||||
</div>";
|
||||
|
||||
$send_mail = $OrderClass->send_notice_mail($reciever_email, $email_from, $email_sender, $email_subject, $email_body);
|
||||
|
||||
if($send_mail) {
|
||||
//$mess = "BTC2CASH Request: You sent a request to deposit BTC $equivalent_btc to Ranchi Mall to receive $ $amount_to_load. You will receive an email from Ranchi Mall. Please follow the instructions provided in that email.";
|
||||
$mess = "BTC2CASH Request: You sent a request to deposit BTC $equivalent_btc to Ranchi Mall to receive $ $amount_to_load. Please send the Bitcoins to address provided in the 'Load Cash to my trading account' tab below.";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->error = false;
|
||||
$std->mesg[] = $mess;
|
||||
}
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
@ -38,7 +38,7 @@ if(isset($_POST['job']) && $_POST['job'] == 'market_order') {
|
||||
$std->user = $validate_user;
|
||||
|
||||
if(isset($_POST['qty'], $_POST['type'])) {
|
||||
$qty = two_decimal_digit($_POST['qty']);
|
||||
$qty = (float) $_POST['qty'];
|
||||
$order_type = $_POST['type'];
|
||||
|
||||
if($qty >= 0.01) {
|
||||
@ -56,7 +56,7 @@ if(isset($_POST['job']) && $_POST['job'] == 'market_order') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$run_market_order = $OrderClass->market_order($order_type, abs($qty));
|
||||
$run_market_order = $OrderClass->market_order($order_type, $qty);
|
||||
|
||||
$std->user = $validate_user;
|
||||
$std->order = $run_market_order;
|
||||
|
||||
@ -57,17 +57,17 @@ if (isset($_POST['task']) && trim($_POST['task'])=='loadMyOrdersList') {
|
||||
}
|
||||
|
||||
$iter .= "<tr>";
|
||||
$iter .= "<td>$myOrder->OfferAssetTypeId</td>";
|
||||
$iter .= "<td>$myOrder->WantAssetTypeId</td>";
|
||||
$iter .= "<td>$myOrder->Price</td>";
|
||||
$iter .= "<td>$myOrder->Quantity</td>";
|
||||
$iter .= "<td>$status</td>";
|
||||
$iter .= "<td>".date('d M, Y h:i:sa', strtotime($myOrder->InsertDate))."</td>";
|
||||
$iter .= "<td>";
|
||||
if(trim($status) == 'Pending') {
|
||||
$iter .= "<button class='btn-xs btn btn-danger del_order' id='del_$myOrder->OrderId'>Cancel</button>";
|
||||
$iter .= "<button class='btn-danger del_order' id='del_$myOrder->OrderId'>Cancel</button>";
|
||||
}
|
||||
$iter .= "</td>";
|
||||
$iter .= "<td>$myOrder->OfferAssetTypeId</td>";
|
||||
$iter .= "<td>$myOrder->WantAssetTypeId</td>";
|
||||
$iter .= "<td>$status</td>";
|
||||
$iter .= "<td>".date('d M, Y h:i:sa', strtotime($myOrder->InsertDate))."</td>";
|
||||
$iter .= "</tr>";
|
||||
endforeach;
|
||||
}
|
||||
|
||||
181
ajax/pay_in_btc.php
Normal file
181
ajax/pay_in_btc.php
Normal file
@ -0,0 +1,181 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Abhishek Kumar Sinha
|
||||
* Date: 10/21/2017
|
||||
* Time: 8:19 PM
|
||||
*/
|
||||
|
||||
require_once '../includes/imp_files.php';
|
||||
|
||||
if (!checkLoginStatus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($_POST['job']) && trim($_POST['job']) == "pay_in_btc") {
|
||||
|
||||
if (isset($_POST['ref_amount'], $_POST['btc_addr'])) {
|
||||
$balance_to_transfer = (float) $_POST['ref_amount'];
|
||||
$btc_addr = (string) strtoupper($_POST['btc_addr']);
|
||||
$remarks = (string) $_POST['invst_remarks'];
|
||||
|
||||
$std = new stdClass();
|
||||
$std->mesg = array();
|
||||
$std->error = true;
|
||||
$std->user = null;
|
||||
|
||||
if (empty($balance_to_transfer) || empty($btc_addr)) {
|
||||
$mess = "E2BTC error: Please fill all the required fields!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
$std->error = true;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!preg_match("/^[a-zA-Z0-9]+$/", $btc_addr) == 1) || strlen(trim($btc_addr)) !== 34) {
|
||||
$mess = "E2BTC error: Invalid Bitcoin address!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
$std->error = true;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strlen($remarks) > 250) {
|
||||
$mess = "E2BTC error: Remarks up to 250 characters allowed only!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
$std->error = true;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!preg_match("/^[a-zA-Z0-9 \r\n]*$/",$remarks)) {
|
||||
$mess = "E2BTC error: Only alphanumeric characters allowed in Remarks!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
$std->error = true;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$validate_user = $UserClass->check_user($user_id);
|
||||
|
||||
if($validate_user == "" || empty($validate_user)) {
|
||||
$mess = "E2BTC error: No such user exist. Please login again.";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->error = true;
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$senders_email = trim($validate_user->Email);
|
||||
|
||||
if ($senders_email == null || !is_email($senders_email)) {
|
||||
$mess = "E2BTC error: Invalid email format!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
$std->error = true;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$customer_bal = (float) $OrderClass->check_customer_balance($assetType="traditional", $user_id)->Balance;
|
||||
|
||||
if ($balance_to_transfer > $customer_bal) {
|
||||
$mess = "E2BTC transaction failed: You have insufficient balance to make this transfer. Your current Cash balance is $ $customer_bal.";
|
||||
$std->error = true;
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
return false;
|
||||
}
|
||||
|
||||
$msss = '';
|
||||
|
||||
// Check order in buys table
|
||||
$OfferAssetTypeId= 'USD';
|
||||
$WantAssetTypeId = 'RMT';
|
||||
$assetType = 'traditional';
|
||||
$allowed_bid_amount = $customer_bal;
|
||||
$user_active_orders = $OrderClass->get_active_order_of_user($user_id, TOP_BUYS_TABLE);
|
||||
$frozen_bal_buys = 0;
|
||||
if (is_array($user_active_orders) && !empty($user_active_orders)) {
|
||||
foreach ($user_active_orders as $uao) {
|
||||
$frozen_bal_buys += (float) $uao->price * $uao->quantity;
|
||||
}
|
||||
$allowed_bid_amount = $customer_bal - $frozen_bal_buys;
|
||||
$ext_st = "You can refund up to $ $allowed_bid_amount only.";
|
||||
if ($allowed_bid_amount == 0) {
|
||||
$ext_st = "You don't have any cash balance to refund.";
|
||||
}
|
||||
$msss = "E2BTC Refund error: You have placed an order worth $ $frozen_bal_buys $ext_st Please cancel it or reduce your refund amount.";
|
||||
}
|
||||
|
||||
if ($frozen_bal_buys + $balance_to_transfer > $customer_bal) {
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $msss);
|
||||
$std->error = true;
|
||||
$std->mesg[] = $msss;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$reciever_email = [$senders_email];
|
||||
$email_from = RM;
|
||||
$email_sender = EMAIL_SENDER_NAME;
|
||||
$email_subject = EMAIL_SUBJECT;
|
||||
$email_body = "<div style='width:100%; background-color: #6b7b6b; padding: 2em; color: gainsboro; '>
|
||||
<div class='panel-heading'>
|
||||
<h2 class='panel-title'>E2BTC Fund Transfer Request</h2>
|
||||
</div>
|
||||
<div class='panel-body'>
|
||||
<h5>Transfer Type: Exchange Website to BITCOIN(E2BTC)</h5>
|
||||
|
||||
<p>Hello $log_fullName</p>
|
||||
|
||||
<p>We have received a request to refund $ $balance_to_transfer to you in Bitcoins.<br> Below is the details of your request.
|
||||
Please approve the Bitcoin address again before we send you Bitcoins.<br> If you did not send any request or if any data below
|
||||
is incorrect please report immediately.
|
||||
</p>
|
||||
|
||||
<p>BTC ADDRESS: $btc_addr</p>
|
||||
<p>AMOUNT TO TRANSFER: <strong>$ $balance_to_transfer</strong> (DO NOT SEND MORE THAN $ $allowed_bid_amount.)</p>
|
||||
<p>EMAIL: $senders_email</p>
|
||||
<p>REMARKS: <strong>".$remarks."</strong></p>
|
||||
<p>SENDER FB ID: facebook.com/".$fb_id."</p>
|
||||
</div>
|
||||
<footer>
|
||||
<p>Thank You</p>
|
||||
<span>Regards</span><br><br>
|
||||
<a href='http://ranchimall.net' style='color:aliceblue'>Ranchi Mall</a>
|
||||
</footer>
|
||||
</div>";
|
||||
|
||||
$send_mail = $OrderClass->send_notice_mail($reciever_email, $email_from, $email_sender, $email_subject, $email_body);
|
||||
$transfer_funds = null;
|
||||
if($send_mail) {
|
||||
/*Transfer funds from site to bank account*/
|
||||
$transfer_funds = $OrderClass->fund_transfer($fund_type="E2BTC", $from="Exchange", $to=$btc_addr, $balance_to_transfer, $remarks, $assetType = 'traditional');
|
||||
}
|
||||
|
||||
if ($transfer_funds) {
|
||||
$mess = "E2BTC Transaction Success: Please check your mail to approve this request.";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->error = false;
|
||||
$std->mesg[] = $mess;
|
||||
$std->user = $validate_user;
|
||||
|
||||
} else {
|
||||
$mess = "E2BTC error: Mail could not be sent. Try again.";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->error = true;
|
||||
$std->mesg[] = $mess;
|
||||
$std->user = $validate_user;
|
||||
}
|
||||
echo json_encode($std);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -17,8 +17,8 @@ if (isset($_POST['subject']) && trim($_POST['subject'])=='placeOrder') {
|
||||
if (isset($_POST['btn_id'], $_POST['qty'], $_POST['price'])) {
|
||||
|
||||
$btn_id = trim($_POST['btn_id']);
|
||||
$qty = two_decimal_digit($_POST['qty']);
|
||||
$item_price = two_decimal_digit($_POST['price']);
|
||||
$qty = (float) $_POST['qty'];
|
||||
$item_price = (float) $_POST['price'];
|
||||
$orderStatusId = 2; // 0 -> cancelled; 1 -> complete; 2 -> pending
|
||||
|
||||
$std = new stdClass();
|
||||
@ -30,11 +30,15 @@ if (isset($_POST['subject']) && trim($_POST['subject'])=='placeOrder') {
|
||||
if($btn_id == 'buy_btn') {
|
||||
$orderTypeId = 0; // It is a buy
|
||||
$OfferAssetTypeId= 'USD';
|
||||
$WantAssetTypeId = 'RTM';
|
||||
$WantAssetTypeId = 'RMT';
|
||||
$assetType = 'traditional';
|
||||
$total_trade_val = $qty * $item_price;
|
||||
} else if($btn_id == 'sell_btn') {
|
||||
$orderTypeId = 1; // It is a sell
|
||||
$OfferAssetTypeId = 'RTM';
|
||||
$OfferAssetTypeId = 'RMT';
|
||||
$WantAssetTypeId = 'USD';
|
||||
$assetType = 'btc';
|
||||
$total_trade_val = $qty;
|
||||
} else {
|
||||
$std->error = true;
|
||||
$std->msg = "Invalid button id.";
|
||||
@ -63,7 +67,55 @@ if (isset($_POST['subject']) && trim($_POST['subject'])=='placeOrder') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$place_order = $OrderClass->insert_pending_order($orderTypeId, abs($qty), abs($item_price), $orderStatusId, $OfferAssetTypeId, $WantAssetTypeId);
|
||||
$user_current_bal = (float) $OrderClass->check_customer_balance($assetType, $user_id)->Balance;
|
||||
|
||||
$top_tbl = null;
|
||||
if ($orderTypeId == 0) {
|
||||
$top_tbl = TOP_BUYS_TABLE;
|
||||
$user_active_orders = $OrderClass->get_active_order_of_user($user_id, $top_tbl);
|
||||
|
||||
$frozen_bal = 0;
|
||||
if (is_array($user_active_orders) && !empty($user_active_orders)) {
|
||||
foreach ($user_active_orders as $uao) {
|
||||
$frozen_bal += (float) $uao->price * $uao->quantity;
|
||||
}
|
||||
}
|
||||
$allowed_bid_amount = $user_current_bal - $frozen_bal;
|
||||
$ext_st = "You can put bid up to $ $allowed_bid_amount only.";
|
||||
$ext_st2 = "";
|
||||
if ($allowed_bid_amount == 0) {
|
||||
$ext_st = "You don't have any cash balance to spend.";
|
||||
}
|
||||
if ((float)$frozen_bal != 0) {
|
||||
$ext_st2 = "You have already placed an order worth $ $frozen_bal.";
|
||||
}
|
||||
$msss = "Insufficient Balance: $ext_st2 $ext_st";
|
||||
|
||||
} elseif ($orderTypeId == 1) {
|
||||
$top_tbl = TOP_SELL_TABLE;
|
||||
$user_active_orders = $OrderClass->get_active_order_of_user($user_id, $top_tbl);
|
||||
$frozen_bal = 0;
|
||||
if (is_array($user_active_orders) && !empty($user_active_orders)) {
|
||||
foreach ($user_active_orders as $uao) {
|
||||
$frozen_bal += (float) $uao->quantity;
|
||||
}
|
||||
}
|
||||
$allowed_bid_amount = $user_current_bal - $frozen_bal;
|
||||
$ext_st = "You can sell maximum $allowed_bid_amount tokens.";
|
||||
if ($allowed_bid_amount == 0) {
|
||||
$ext_st = "You don't have any tokens to sell.";
|
||||
}
|
||||
$msss = "Insufficient Balance: You have already placed an order of $frozen_bal tokens. $ext_st";
|
||||
}
|
||||
|
||||
if ($frozen_bal + $total_trade_val > $user_current_bal) {
|
||||
$std->error = true;
|
||||
$std->msg = $msss;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$place_order = $OrderClass->insert_pending_order($orderTypeId, $qty, $item_price, $orderStatusId, $OfferAssetTypeId, $WantAssetTypeId);
|
||||
|
||||
} else {
|
||||
$std->error = true;
|
||||
|
||||
@ -18,8 +18,8 @@ if (isset($_POST['task']) && trim($_POST['task'])=='refresh') {
|
||||
|
||||
if (isset($OrderClass, $UserClass)) {
|
||||
|
||||
$buy_list = $OrderClass->get_top_buy_sell_list($top_table='active_buy_list', $asc_desc='DESC'); // buy
|
||||
$sell_list = $OrderClass->get_top_buy_sell_list($top_table='active_selling_list', $asc_desc='ASC'); // sell
|
||||
$buy_list = $OrderClass->get_top_buy_sell_list(TOP_BUYS_TABLE, $asc_desc='DESC'); // buy
|
||||
$sell_list = $OrderClass->get_top_buy_sell_list(TOP_SELL_TABLE, $asc_desc='ASC'); // sell
|
||||
|
||||
$std->buys = $buy_list;
|
||||
$std->sells = $sell_list;
|
||||
|
||||
52
ajax/rm_root.php
Normal file
52
ajax/rm_root.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Abhishek Kumar Sinha
|
||||
* Date: 10/12/2017
|
||||
* Time: 10:43 AM
|
||||
*/
|
||||
|
||||
require_once '../includes/imp_files.php';
|
||||
|
||||
if (!checkLoginStatus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($_SESSION['fb_id'], $_SESSION['user_id'], $_SESSION['user_name'])) {
|
||||
$root_fb = (int) $_SESSION['fb_id'];
|
||||
$root_user_id = (int) $_SESSION['user_id'];
|
||||
$root_user_name = (string) $_SESSION['user_name'];
|
||||
|
||||
if ($root_fb != ADMIN_FB_ID && $root_user_id != ADMIN_ID && $root_user_name != ADMIN_UNAME) {
|
||||
redirect_to("index.php");
|
||||
}
|
||||
|
||||
if (isset($_POST['task'], $_POST['btn_id']) && trim($_POST['task']=="act_user")) {
|
||||
|
||||
$u_id = explode('_', trim($_POST['btn_id']));
|
||||
$u_id_int = extract_int($u_id[1]);
|
||||
$u_id_str = (string) trim($u_id[0]);
|
||||
$act = "";
|
||||
|
||||
if ($u_id_str == "off") {
|
||||
$act = "0";
|
||||
} else if($u_id_str == "on") {
|
||||
$act = "1";
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($OrderClass, $UserClass)) {
|
||||
|
||||
if ($u_id_str == "off") {
|
||||
$del_ord = $OrderClass->delete_orders_of_user($u_id_int);
|
||||
}
|
||||
$act_user = $UserClass->actions_user($u_id_int, $act);
|
||||
|
||||
if ($act_user) {
|
||||
echo $u_id_str;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
180
ajax/transfer_balance_to_bank.php
Normal file
180
ajax/transfer_balance_to_bank.php
Normal file
@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Abhishek Kumar Sinha
|
||||
* Date: 10/21/2017
|
||||
* Time: 8:19 PM
|
||||
*/
|
||||
|
||||
require_once '../includes/imp_files.php';
|
||||
|
||||
if (!checkLoginStatus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($_POST['job']) && trim($_POST['job']) == "transfer_to_bank") {
|
||||
|
||||
if (isset($_POST['acc'], $_POST['bal'])) {
|
||||
$account_number = $_POST['acc'];
|
||||
$balance_to_transfer = (float) $_POST['bal'];
|
||||
$remarks = (string) $_POST['remarks'];
|
||||
|
||||
$std = new stdClass();
|
||||
$std->mesg = array();
|
||||
$std->error = true;
|
||||
$std->user = null;
|
||||
|
||||
if (empty($account_number) || empty($balance_to_transfer)) {
|
||||
$mess = "E2B error: Please fill all the required fields!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
$std->error = true;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!preg_match("/^[a-zA-Z0-9 \r\n]*$/",$remarks)) {
|
||||
$mess = "E2B error: Only alphanumeric characters allowed in Remarks!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
$std->error = true;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strlen($remarks) > 250) {
|
||||
$mess = "E2B error: Remarks up to 250 characters allowed only!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
$std->error = true;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$validate_user = $UserClass->check_user($user_id);
|
||||
|
||||
if($validate_user == "" || empty($validate_user)) {
|
||||
$mess = "E2B error: No such user exist. Please login again.";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->error = true;
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$senders_email = trim($validate_user->Email);
|
||||
|
||||
if (!is_email($senders_email)) {
|
||||
$mess = "E2B error: Please provide a valid email id!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
$std->error = true;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$user_bank_details = $OrderClass->get_bank_details($user_id, $account_number);
|
||||
|
||||
if($user_bank_details == "" || empty($user_bank_details)) {
|
||||
$mess = "E2B error: No such bank account exist. Please check bank details again.";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->error = true;
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$customer_bal = (float) $OrderClass->check_customer_balance($assetType="traditional", $user_id)->Balance;
|
||||
|
||||
if ($balance_to_transfer > $customer_bal) {
|
||||
$mess = "E2B transaction failed: You have insufficient balance to make this transfer. Your current Cash balance is $ $customer_bal.";
|
||||
$std->error = true;
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
return false;
|
||||
}
|
||||
|
||||
$msss = '';
|
||||
|
||||
// Check order in buys table
|
||||
$OfferAssetTypeId= 'USD';
|
||||
$WantAssetTypeId = 'RMT';
|
||||
$assetType = 'traditional';
|
||||
$user_active_orders = $OrderClass->get_active_order_of_user($user_id, TOP_BUYS_TABLE);
|
||||
$frozen_bal_buys = 0;
|
||||
$allowed_bid_amount = $customer_bal;
|
||||
if (is_array($user_active_orders) && !empty($user_active_orders)) {
|
||||
foreach ($user_active_orders as $uao) {
|
||||
$frozen_bal_buys += (float) $uao->price * $uao->quantity;
|
||||
}
|
||||
$allowed_bid_amount = $customer_bal - $frozen_bal_buys;
|
||||
$ext_st = "You can refund up to $ $allowed_bid_amount only.";
|
||||
if ($allowed_bid_amount == 0) {
|
||||
$ext_st = "You don't have any cash balance to refund.";
|
||||
}
|
||||
$msss = "Refund error: You have placed an order worth $ $frozen_bal_buys $ext_st Please cancel it or reduce your refund amount.";
|
||||
}
|
||||
|
||||
if ($frozen_bal_buys + $balance_to_transfer > $customer_bal) {
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $msss);
|
||||
$std->error = true;
|
||||
$std->mesg[] = $msss;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$reciever_email = [PI, FINANCE];
|
||||
$email_from = RM;
|
||||
$email_sender = EMAIL_SENDER_NAME;
|
||||
$email_subject = EMAIL_SUBJECT;
|
||||
$email_body = "<div style='width:100%; background-color: #6b7b6b; padding: 2em; color: gainsboro; '>
|
||||
<div class='panel-heading'>
|
||||
<h2 class='panel-title'>Fund Transfer Request</h2>
|
||||
</div>
|
||||
<div class='panel-body'>
|
||||
<h5>Transfer Type: Exchange Website to Bank Account(E2B)</h5>
|
||||
<p>RECIPIENT FULL NAME: <strong>".$user_bank_details[0]->acc_holder."</strong></p>
|
||||
<p>BANK NAME: <strong>".$user_bank_details[0]->bank_name."</strong></p>
|
||||
<p>BANK ACCOUNT NUMBER: <strong>".$user_bank_details[0]->acc_num."</strong></p>
|
||||
<p>BRANCH: <strong>".$user_bank_details[0]->branch_name."</strong></p>
|
||||
<p>FULL BANK ADDRESS: <strong>".$user_bank_details[0]->bank_addr."</strong></p>
|
||||
<p>COUNTRY: ".$user_bank_details[0]->bank_ctry."</p>
|
||||
<p>AMOUNT TO TRANSFER: <strong>$ $balance_to_transfer</strong> (DO NOT SEND MORE THAN $ $allowed_bid_amount.)</p>
|
||||
<p>EMAIL: $senders_email</p>
|
||||
<p>REMARKS: <strong>".$remarks."</strong></p>
|
||||
<p>SENDER FB ID: facebook.com/".$fb_id."</p>
|
||||
</div>
|
||||
<footer>
|
||||
<p>Thank You</p>
|
||||
<span>Regards</span><br><br>
|
||||
<a href='http://ranchimall.net' style='color:aliceblue'>Ranchi Mall</a>
|
||||
</footer>
|
||||
</div>";
|
||||
|
||||
$send_mail = $OrderClass->send_notice_mail($reciever_email, $email_from, $email_sender, $email_subject, $email_body);
|
||||
$transfer_funds = null;
|
||||
if($send_mail) {
|
||||
/*Transfer funds fro site to bank account*/
|
||||
$transfer_funds = $OrderClass->fund_transfer($fund_type="E2B", $from="Exchange", $to=$user_bank_details[0]->acc_num, $balance_to_transfer, $remarks, $assetType = 'traditional');
|
||||
}
|
||||
|
||||
if ($transfer_funds) {
|
||||
$mess = "E2B Transaction Success: Your request has been recorded and will be processed very soon by our team.";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->error = false;
|
||||
$std->mesg[] = $mess;
|
||||
$std->user = $validate_user;
|
||||
|
||||
} else {
|
||||
$mess = "E2B error: Mail could not be sent. Try again.";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->error = true;
|
||||
$std->mesg[] = $mess;
|
||||
$std->user = $validate_user;
|
||||
}
|
||||
echo json_encode($std);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
166
ajax/transfer_rtm_to_bchain.php
Normal file
166
ajax/transfer_rtm_to_bchain.php
Normal file
@ -0,0 +1,166 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Abhishek Kumar Sinha
|
||||
* Date: 10/24/2017
|
||||
* Time: 9:35 AM
|
||||
*/
|
||||
|
||||
/**
|
||||
* This section is incomplete
|
||||
1. Check token sell order
|
||||
2. Deduct tokens after transfer to Blockchain
|
||||
*/
|
||||
return false;
|
||||
|
||||
|
||||
require_once '../includes/imp_files.php';
|
||||
|
||||
if (!checkLoginStatus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($_POST['job']) && trim($_POST['job']) == "rtm_to_bchain") {
|
||||
if (isset($_POST['flo_addr'], $_POST['rmt_amnt'], $_POST['remarks_flo'])) {
|
||||
$wallet_address = (string) trim($_POST['flo_addr']);
|
||||
$balance_to_transfer = (float) $_POST['rmt_amnt'];
|
||||
$remarks = (string) trim($_POST['remarks_flo']);
|
||||
|
||||
$std = new stdClass();
|
||||
$std->mesg = array();
|
||||
$std->error = true;
|
||||
|
||||
if (empty($wallet_address) || empty($balance_to_transfer)) {
|
||||
$mess = "E2W error: Please fill all the required fields!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!preg_match('/^[A-Za-z0-9]*$/', $wallet_address)) {
|
||||
$mess = "E2W error (Invalid Wallet Address): Only alphanumeric characters are allowed in wallet address!";
|
||||
$std->mesg[] = $mess;
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!preg_match("/^[a-zA-Z0-9 \r\n]*$/",$remarks)) {
|
||||
$mess = "E2W error: Only alphanumeric characters are allowed in remarks!";
|
||||
$std->mesg[] = $mess;
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$customer_bal = (float) $OrderClass->check_customer_balance($assetType="btc", $user_id)->Balance;
|
||||
|
||||
if ($balance_to_transfer > $customer_bal) {
|
||||
$mess = "E2W transaction failed: You have insufficient balance to make this transfer. Your current Token balance is $customer_bal RMTs.";
|
||||
$std->error = true;
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($balance_to_transfer < 0.0000000001) {
|
||||
$mess = "E2W error: Please provide minimum amount of 0.0000000001 RMTs!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strlen($remarks) > 250) {
|
||||
$mess = "E2W error: Remarks up to 250 characters allowed only!";
|
||||
$std->mesg[] = $mess;
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->error = true;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$validate_user = $UserClass->check_user($user_id);
|
||||
|
||||
if($validate_user == "" || empty($validate_user)) {
|
||||
$mess = "No such user exist. Please login again.";
|
||||
$std->error = true;
|
||||
$std->mesg[] = $mess;
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$email_id = trim($validate_user->Email);
|
||||
|
||||
if (!is_email($email_id)) {
|
||||
$mess = "E2W error: Invalid email format!";
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
$std->mesg[] = $mess;
|
||||
$std->error = true;
|
||||
echo json_encode($std);
|
||||
return false;
|
||||
}
|
||||
|
||||
$reciever_email[] = AB;
|
||||
$email_from = RM;
|
||||
$email_sender = EMAIL_SENDER_NAME;
|
||||
$email_subject = EMAIL_SUBJECT_RTM_TRANSFER;
|
||||
$email_body = "<div style='width:100%; background-color: #6b7b6b; padding: 2em; color: gainsboro; '>
|
||||
<div class='panel-heading'>
|
||||
<h2 class='panel-title'>RMT Transfer Request</h2>
|
||||
</div>
|
||||
<div class='panel-body'>
|
||||
<h5>Transfer Type: Exchange Website to FLORINCOIN BLOCKCHAIN WALLET(E2W)</h5>
|
||||
<p>RECIPIENT FULL NAME: <strong>".$log_fullName."</strong></p>
|
||||
<p>WALLET ADDRESS: <strong>".$wallet_address."</strong></p>
|
||||
<p>AMOUNT TO TRANSFER: <strong>RMT $balance_to_transfer</strong></p>
|
||||
<p>EMAIL: $email_id</p>
|
||||
<p>REMARKS: <strong>".$remarks."</strong></p>
|
||||
<p>SENDER FB ID: facebook.com/".$fb_id."</p>
|
||||
</div>
|
||||
<footer>
|
||||
<p>Thank You</p>
|
||||
<span>Regards</span><br><br>
|
||||
<a href='http://ranchimall.net' style='color:aliceblue'>Ranchi Mall</a>
|
||||
</footer>
|
||||
</div>";
|
||||
|
||||
$send_mail = $OrderClass->send_notice_mail($reciever_email, $email_from, $email_sender, $email_subject, $email_body);
|
||||
$transfer_funds = null;
|
||||
if($send_mail) {
|
||||
$transfer_funds = $OrderClass->fund_transfer($fund_type="E2W", $from="Exchange", $to=$wallet_address, $balance_to_transfer, $remarks, $asset_type='btc');
|
||||
}
|
||||
|
||||
if ($transfer_funds) {
|
||||
|
||||
$if_req_sent_to_bchain = sendReqtoURL($wallet_address, $balance_to_transfer);
|
||||
|
||||
if ($if_req_sent_to_bchain) {
|
||||
$mess = "E2W Transaction Success: Your request has been recorded and will be processed very soon by our team.";
|
||||
$std->error = false;
|
||||
$std->mesg[] = $mess;
|
||||
$std->user = $validate_user;
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
} else {
|
||||
$mess = "E2W error: API request could not be sent. ";
|
||||
$std->error = true;
|
||||
$std->mesg[] = $mess;
|
||||
$std->user = $validate_user;
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
$mess = "E2W error: Mail could not be sent. Try again.";
|
||||
$std->error = true;
|
||||
$std->mesg[] = $mess;
|
||||
$std->user = $validate_user;
|
||||
$OrderClass->storeMessagesPublic(null, $user_id, $mess);
|
||||
}
|
||||
echo json_encode($std);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
4
api/.htaccess
Normal file
4
api/.htaccess
Normal file
@ -0,0 +1,4 @@
|
||||
RewriteEngine on
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule . api.php [L]
|
||||
214
api/api.php
Normal file
214
api/api.php
Normal file
@ -0,0 +1,214 @@
|
||||
<?php
|
||||
use \Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use \Psr\Http\Message\ResponseInterface as Response;
|
||||
use Carbon\Carbon;
|
||||
use Carbon\CarbonInterval;
|
||||
|
||||
require '../includes/imp_files.php';
|
||||
require '../vendor/autoload.php';
|
||||
|
||||
$app = new \Slim\App;
|
||||
|
||||
if (isset($OrderClass, $UserClass)) {
|
||||
|
||||
// Get Market Price
|
||||
$app->get('/market_price', function (Request $request, Response $response) {
|
||||
try {
|
||||
$OrderClass = new Orders();
|
||||
$stmt = $OrderClass->LastTradedPrice();
|
||||
$market_price = $stmt;
|
||||
|
||||
echo json_encode($market_price);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo '{"error": {"text": ' . $e->getMessage() . '}}';
|
||||
}
|
||||
});
|
||||
|
||||
// Get Trade Volume in last 24 hours
|
||||
$app->get("/trade_volume_in_24hr/{start}/{end}", function (Request $request, Response $response) {
|
||||
try {
|
||||
|
||||
$starting = (string) trim($request->getAttribute('start'));
|
||||
$ending = (string) trim($request->getAttribute('end'));
|
||||
|
||||
$t1 = Carbon::now()->subDays($starting)->format('Y-m-d 00:00:00');
|
||||
$t2 = Carbon::now()->subDays($ending)->format('Y-m-d 00:00:00');
|
||||
|
||||
$ApiClass = new Api();
|
||||
$vol = $ApiClass->trade_volume($t2, $t1);
|
||||
$volume = $vol;
|
||||
echo json_encode($volume);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo '{"error": {"text": ' . $e->getMessage() . '}}';
|
||||
}
|
||||
});
|
||||
|
||||
// Get user to total balance ratio
|
||||
$app->get("/token_ratio/{user_id}/{asset_type}", function (Request $request, Response $response) {
|
||||
try {
|
||||
|
||||
$uid = (string) trim($request->getAttribute('user_id'));
|
||||
$asset = (string) trim($request->getAttribute('asset_type'));
|
||||
|
||||
if ($asset == 'rmt') {
|
||||
$asset = 'btc';
|
||||
} else if($asset == 'cash') {
|
||||
$asset = 'traditional';
|
||||
} else {
|
||||
echo '{"error": {"text": Invalid asset!}}';
|
||||
return false;
|
||||
}
|
||||
|
||||
$ApiClass = new Api();
|
||||
$ratio = $ApiClass->user_token_to_total_tokens_ratio($uid, $asset);
|
||||
$ratio_bal = $ratio;
|
||||
echo json_encode($ratio_bal);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo '{"error": {"text": ' . $e->getMessage() . '}}';
|
||||
}
|
||||
});
|
||||
|
||||
// Get total token volume and market cap
|
||||
$app->get("/market_cap", function (Request $request, Response $response) {
|
||||
try {
|
||||
$OrderClass = new Orders();
|
||||
$ApiClass = new Api();
|
||||
$total_tokens_sold = $ApiClass->total_assets('btc');
|
||||
$total = $total_tokens_sold;
|
||||
$ltp = $OrderClass->LastTradedPrice();
|
||||
|
||||
$obj = [
|
||||
'total_token_sold'=> $total,
|
||||
'last_traded_price'=> $ltp
|
||||
];
|
||||
|
||||
echo json_encode($obj);
|
||||
} catch (PDOException $e) {
|
||||
echo '{"error": {"text": ' . $e->getMessage() . '}}';
|
||||
}
|
||||
});
|
||||
|
||||
// Traders list
|
||||
$app->get("/traders_list", function(Request $request, Response $response) {
|
||||
try {
|
||||
$OrderClass = new Orders();
|
||||
$stmt = $OrderClass->UserBalanceList(1);
|
||||
$list = $stmt;
|
||||
|
||||
echo json_encode($list);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo '{"error": {"text": ' . $e->getMessage() . '}}';
|
||||
}
|
||||
});
|
||||
|
||||
// Trade Price History
|
||||
$app->get("/trade_price_history/{start}/{end}", function(Request $request, Response $response) {
|
||||
try {
|
||||
|
||||
$starting = (string) trim($request->getAttribute('start'));
|
||||
$ending = (string) trim($request->getAttribute('end'));
|
||||
|
||||
$t1 = Carbon::now()->subDays($starting)->format('Y-m-d 00:00:00');
|
||||
$t2 = Carbon::now()->subDays($ending)->format('Y-m-d 00:00:00');
|
||||
|
||||
$ApiClass = new Api();
|
||||
$stmt = $ApiClass->TradedPriceHistory($t2, $t1);
|
||||
$list = $stmt;
|
||||
|
||||
echo json_encode($list);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo '{"error": {"text": ' . $e->getMessage() . '}}';
|
||||
}
|
||||
});
|
||||
|
||||
// Number of token in Buy or Sell
|
||||
$app->get("/tokens_on_trade", function (Request $request, Response $response) {
|
||||
try {
|
||||
$ApiClass = new Api();
|
||||
$total_tokens = $ApiClass->number_of_tokens_on_buy_sell();
|
||||
$total = $total_tokens;
|
||||
echo json_encode($total);
|
||||
} catch (PDOException $e) {
|
||||
echo '{"error": {"text": ' . $e->getMessage() . '}}';
|
||||
}
|
||||
});
|
||||
|
||||
// Asset gain list
|
||||
$app->get("/returns", function (Request $request, Response $response) {
|
||||
try {
|
||||
$ApiClass = new Api();
|
||||
$return_list = $ApiClass->asset_gain_list();
|
||||
$total = $return_list;
|
||||
echo json_encode($total);
|
||||
} catch (PDOException $e) {
|
||||
echo '{"error": {"text": ' . $e->getMessage() . '}}';
|
||||
}
|
||||
});
|
||||
|
||||
// Asset value by month
|
||||
$app->get("/asset_by_month", function (Request $request, Response $response) {
|
||||
try {
|
||||
$ApiClass = new Api();
|
||||
$asset_list = $ApiClass->asset_value_by_month();
|
||||
$total = $asset_list;
|
||||
echo json_encode($total);
|
||||
} catch (PDOException $e) {
|
||||
echo '{"error": {"text": ' . $e->getMessage() . '}}';
|
||||
}
|
||||
});
|
||||
|
||||
// My Actions
|
||||
$app->get("/my_actions", function (Request $request, Response $response) {
|
||||
try {
|
||||
$ApiClass = new Api();
|
||||
$action_list = $ApiClass->my_actions_numbers();
|
||||
$total = $action_list;
|
||||
echo json_encode($total);
|
||||
} catch (PDOException $e) {
|
||||
echo '{"error": {"text": ' . $e->getMessage() . '}}';
|
||||
}
|
||||
});
|
||||
|
||||
// Get total number of users
|
||||
$app->get("/total_users", function (Request $request, Response $response) {
|
||||
try {
|
||||
$UserClass = new Users();
|
||||
$users_sum = $UserClass->get_total_users_count();
|
||||
$total = $users_sum;
|
||||
echo json_encode($total);
|
||||
} catch (PDOException $e) {
|
||||
echo '{"error": {"text": ' . $e->getMessage() . '}}';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Get Trade Volume week wise
|
||||
$app->get("/trade_volume_by_week/{start}/{end}", function (Request $request, Response $response) {
|
||||
try {
|
||||
|
||||
$starting = (string) trim($request->getAttribute('start'));
|
||||
$ending = (string) trim($request->getAttribute('end'));
|
||||
|
||||
$t1 = Carbon::now()->subDays($starting)->format('Y-m-d 00:00:00');
|
||||
$t2 = Carbon::now()->subDays($ending)->format('Y-m-d 00:00:00');
|
||||
|
||||
$ApiClass = new Api();
|
||||
$vol = $ApiClass->week_wise_trade_volume($t2, $t1);
|
||||
$volume = $vol;
|
||||
echo json_encode($volume);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo '{"error": {"text": ' . $e->getMessage() . '}}';
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
echo '{"error": {"text": "API could not be loaded."}}';
|
||||
}
|
||||
|
||||
$app->run();
|
||||
244
classes/Api.php
Normal file
244
classes/Api.php
Normal file
@ -0,0 +1,244 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Abhishek Kumar Sinha
|
||||
* Date: 11/7/2017
|
||||
* Time: 3:31 PM
|
||||
*/
|
||||
class Api extends Orders {
|
||||
|
||||
public function trade_volume($t2, $t1) {
|
||||
|
||||
if ($this->databaseConnection()) {
|
||||
if (trim($t1)==null || trim($t2)==null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = $this->db_connection->prepare(
|
||||
"SELECT *, DAYOFWEEK(InsertDate) as DWNum FROM ".ORDERS_TABLE." WHERE `InsertDate` BETWEEN :t2 AND :t1"
|
||||
);
|
||||
$query->bindParam('t2', $t2);
|
||||
$query->bindParam('t1', $t1);
|
||||
|
||||
$query->execute();
|
||||
|
||||
$vol_arr = array();
|
||||
|
||||
if ($cffuount = $query->rowCount() > 0) {
|
||||
while ($vol = $query->fetchObject()) {
|
||||
$vol_arr[] = $vol;
|
||||
}
|
||||
}
|
||||
return $vol_arr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function user_token_to_total_tokens_ratio($user_id, $asset_type) {
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$assets = array(
|
||||
'user' => null,
|
||||
'total' => null
|
||||
);
|
||||
|
||||
$query = $this->db_connection->prepare(
|
||||
"SELECT SUM(Balance) AS TOTAL_BAL,
|
||||
(SELECT Balance FROM ".CREDITS_TABLE." WHERE `AssetTypeId`=:ast AND `CustomerId`= :u_id) AS USER_BAL
|
||||
FROM ".CREDITS_TABLE." WHERE `AssetTypeId`=:ast LIMIT 1"
|
||||
);
|
||||
$query->bindParam('u_id', $user_id);
|
||||
$query->bindParam('ast', $asset_type);
|
||||
|
||||
$query->execute();
|
||||
|
||||
if ($query->rowCount() ==1) {
|
||||
$balances = $query->fetchObject();
|
||||
$assets['user'] = (float) $balances->USER_BAL;
|
||||
$assets['total'] = (float) $balances->TOTAL_BAL;
|
||||
}
|
||||
return $assets;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function total_assets($asset_type=null) {
|
||||
$total_asset = null;
|
||||
if ($this->databaseConnection()) {
|
||||
$query = $this->db_connection->prepare(
|
||||
"SELECT SUM(Balance) AS TOTAL_BAL
|
||||
FROM ".CREDITS_TABLE." WHERE `AssetTypeId`= :ast LIMIT 1
|
||||
");
|
||||
$query->bindParam('ast', $asset_type);
|
||||
|
||||
$query->execute();
|
||||
|
||||
if ($query->rowCount() == 1) {
|
||||
$balances = $query->fetchObject();
|
||||
$total_asset = (float) $balances->TOTAL_BAL;
|
||||
}
|
||||
}
|
||||
return $total_asset;
|
||||
}
|
||||
|
||||
public function TradedPriceHistory($t2, $t1) {
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$query = $this->db_connection->prepare("
|
||||
SELECT `B_Amount`,InsertDate FROM ".TRANSACTIONS_TABLE."
|
||||
WHERE InsertDate BETWEEN :t2 AND :t1
|
||||
ORDER BY `InsertDate` ASC
|
||||
");
|
||||
|
||||
$query->bindParam('t2', $t2);
|
||||
$query->bindParam('t1', $t1);
|
||||
|
||||
$query->execute();
|
||||
|
||||
$vol_arr = array();
|
||||
|
||||
if ($cffuount = $query->rowCount() > 0) {
|
||||
while ($vol = $query->fetchObject()) {
|
||||
$vol_arr[] = $vol;
|
||||
}
|
||||
}
|
||||
return $vol_arr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function number_of_tokens_on_buy_sell() {
|
||||
if ($this->databaseConnection()) {
|
||||
$total = array();
|
||||
|
||||
$query = $this->db_connection->query(
|
||||
"SELECT (
|
||||
SELECT SUM(quantity)
|
||||
FROM ".TOP_BUYS_TABLE."
|
||||
) AS TOTAL_BUYS,
|
||||
( SELECT SUM(quantity)
|
||||
FROM ".TOP_SELL_TABLE."
|
||||
) AS TOTAL_SELLS,
|
||||
( SELECT SUM(Balance)
|
||||
FROM ".CREDITS_TABLE."
|
||||
WHERE AssetTypeId='btc'
|
||||
) AS TOTAL_TOKEN_BALANCE
|
||||
");
|
||||
|
||||
$query->execute();
|
||||
|
||||
$arr = [
|
||||
'token_on_buys'=>0,
|
||||
'token_on_sells'=>0,
|
||||
'all_tokens'=>0
|
||||
];
|
||||
|
||||
if ($query->rowCount() > 0) {
|
||||
foreach ($query->fetchObject() as $q) {
|
||||
$total[] = $q;
|
||||
}
|
||||
$arr['token_on_buys'] = $total[0];
|
||||
$arr['token_on_sells'] = $total[1];
|
||||
$arr['all_tokens'] = $total[2];
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function asset_gain_list() {
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$list = array();
|
||||
|
||||
$ltp = (float) $this->LastTradedPrice()->B_Amount;
|
||||
|
||||
$query = $this->db_connection->query("
|
||||
SELECT DISTINCT(".TRANSACTIONS_TABLE.".a_buyer) AS INVESTOR_ID, (SELECT Name FROM ".USERS_TABLE." WHERE CustomerId = INVESTOR_ID) AS INVESTOR, SUM(".TRANSACTIONS_TABLE.".qty_traded * ".TRANSACTIONS_TABLE.".B_Amount) AS INVESTMENT,
|
||||
(SELECT Balance * ".$ltp." FROM ".CREDITS_TABLE." WHERE `AssetTypeId`='btc' AND `CustomerId`=INVESTOR_ID) AS CURRENT_VALUE
|
||||
FROM ".TRANSACTIONS_TABLE."
|
||||
GROUP BY INVESTOR_ID
|
||||
");
|
||||
|
||||
$query->execute();
|
||||
|
||||
if ($query->rowCount() > 0) {
|
||||
while ($li = $query->fetchObject()) {
|
||||
$list[] = $li;
|
||||
}
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function asset_value_by_month() {
|
||||
if ($this->databaseConnection()) {
|
||||
$query = $this->db_connection->query("
|
||||
SELECT SUM(qty_traded) AS QTY_TRADED, InsertDate, AVG(B_Amount) AS MAX_TRADE_PRICE
|
||||
FROM ".TRANSACTIONS_TABLE." GROUP BY MONTH(InsertDate)
|
||||
");
|
||||
|
||||
$arr = array();
|
||||
|
||||
if ($query->rowCount() > 0) {
|
||||
while ($stmt = $query->fetchObject()) {
|
||||
$arr[] = $stmt;
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function my_actions_numbers() {
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$arr = array();
|
||||
$query = $this->db_connection->query("SELECT fund_type, COUNT(`fund_type`) AS TOTAL, datetime
|
||||
FROM ".TRANSFER_INFO_TABLE." GROUP BY fund_type");
|
||||
while ($dat = $query->fetchObject()) {
|
||||
$arr[] = $dat;
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function week_wise_trade_volume($t2, $t1) {
|
||||
|
||||
if ($this->databaseConnection()) {
|
||||
if (trim($t1)==null || trim($t2)==null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = $this->db_connection->prepare(
|
||||
"SELECT *, (SELECT WEEK(InsertDate)) AS WEEK_NUM
|
||||
FROM ".ORDERS_TABLE." WHERE `InsertDate` BETWEEN :t2 AND :t1
|
||||
AND `OrderStatusId`= 1
|
||||
ORDER BY InsertDate ASC"
|
||||
);
|
||||
$query->bindParam('t2', $t2);
|
||||
$query->bindParam('t1', $t1);
|
||||
|
||||
$query->execute();
|
||||
|
||||
$vol_arr = array();
|
||||
|
||||
if ($cffuount = $query->rowCount() > 0) {
|
||||
while ($vol = $query->fetchObject()) {
|
||||
$vol_arr[] = $vol;
|
||||
}
|
||||
}
|
||||
return $vol_arr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -11,13 +11,15 @@ class Orders extends Users {
|
||||
|
||||
protected $db_connection = null;
|
||||
private $errors = array();
|
||||
private $orders_table = "orderbook";
|
||||
private $customers_table = "customer";
|
||||
private $top_buy_table = "active_buy_list";
|
||||
private $top_sell_table = "active_selling_list";
|
||||
private $customer_balance_table = "assetbalance";
|
||||
private $transaction_table = "transaction";
|
||||
private $bal_history = "bal_history";
|
||||
private $orders_table = ORDERS_TABLE;
|
||||
private $customers_table = USERS_TABLE;
|
||||
private $top_buy_table = TOP_BUYS_TABLE;
|
||||
private $top_sell_table = TOP_SELL_TABLE;
|
||||
private $customer_balance_table = CREDITS_TABLE;
|
||||
private $transaction_table = TRANSACTIONS_TABLE;
|
||||
private $bal_history = CREDITS_HISTORY_TABLE;
|
||||
private $bank_acc = ACCOUNTS_TABLE;
|
||||
private $fund_trans = TRANSFER_INFO_TABLE;
|
||||
private $customerId = 0;
|
||||
private $orderTypeId = 0;
|
||||
private $quantity = 0;
|
||||
@ -31,8 +33,12 @@ class Orders extends Users {
|
||||
private function insert_order_in_active_table($top_table, $orderId, $price, $quantity) {
|
||||
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$n = new DateTime("now", new DateTimeZone("Asia/Kolkata"));
|
||||
$now = $n->format('Y-m-d H:i:s');
|
||||
|
||||
$query = $this->db_connection->prepare("INSERT INTO $top_table(`price`, `orderId`, `quantity`, `customerId`, `insertDate`)
|
||||
VALUES (:price, :orderId, :quantity, :user_id, NOW())");
|
||||
VALUES (:price, :orderId, :quantity, :user_id, '$now')");
|
||||
$query->bindParam("price", $price);
|
||||
$query->bindParam("orderId", $orderId);
|
||||
$query->bindParam("quantity", $quantity);
|
||||
@ -68,8 +74,11 @@ class Orders extends Users {
|
||||
|
||||
public function record_bal_history($user_id, $balance, $type) {
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$now = $this->time_now();
|
||||
|
||||
$query = $this->db_connection->prepare("INSERT INTO $this->bal_history (`id`, `user_id`, `balance`, `AssetType`, `datetime`)
|
||||
VALUES ('', :uid, :bal, :asset_type, NOW())");
|
||||
VALUES ('', :uid, :bal, :asset_type, '$now')");
|
||||
$query->bindParam('uid', $user_id);
|
||||
$query->bindParam('bal', $balance);
|
||||
$query->bindParam('asset_type', $type);
|
||||
@ -84,19 +93,19 @@ class Orders extends Users {
|
||||
public function update_user_balance($assetType, $balance=null, $user_id) {
|
||||
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$now = $this->time_now();
|
||||
$sql = "";
|
||||
if ($balance != null) {
|
||||
if ($balance >= 0) {
|
||||
$sql .= "UPDATE $this->customer_balance_table ";
|
||||
$sql .= " SET `Balance`= :balance, ";
|
||||
$sql .= " `UpdateDate`= NOW() ";
|
||||
$sql .= " `UpdateDate`= '$now' ";
|
||||
$sql .= " WHERE `CustomerId`= :user_id ";
|
||||
$sql .= " AND `AssetTypeId`= :asset_type ";
|
||||
$sql .= "LIMIT 1";
|
||||
|
||||
$query = $this->db_connection->prepare($sql);
|
||||
|
||||
if ($balance != null) {
|
||||
if ($balance >= 0) {
|
||||
$query->bindParam("balance", $balance);
|
||||
}
|
||||
$query->bindParam("user_id", $user_id);
|
||||
@ -114,7 +123,7 @@ class Orders extends Users {
|
||||
public function insert_pending_order($orderTypeId, $qty, $price, $orderStatusId, $OfferAssetTypeId=null, $WantAssetTypeId=null) {
|
||||
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$now = $this->time_now();
|
||||
$messages = null;
|
||||
|
||||
$this->customerId = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : 0;
|
||||
@ -163,7 +172,7 @@ class Orders extends Users {
|
||||
}
|
||||
|
||||
$query = $this->db_connection->prepare("INSERT INTO $this->orders_table (`OrderId`, `CustomerId`, `OrderTypeId`, `OfferAssetTypeId`, `WantAssetTypeId`, `Quantity`, `Price`, `OrderStatusId`, `UpdateDate`, `InsertDate`, `SaveDate`)
|
||||
VALUES ('', " . $this->customerId . ", :a, :e, :f, :b, :c, :d, NULL, Now(), NULL)");
|
||||
VALUES ('', " . $this->customerId . ", :a, :e, :f, :b, :c, :d, NULL, '$now', NULL)");
|
||||
|
||||
$query->bindParam(':a', $this->orderTypeId, PDO::PARAM_STR);
|
||||
$query->bindParam(':e', $OfferAssetTypeId, PDO::PARAM_STR);
|
||||
@ -222,8 +231,9 @@ class Orders extends Users {
|
||||
|
||||
$top_list = array();
|
||||
|
||||
$query = $this->db_connection->query("SELECT OrderId, customerId, Quantity, Price, (Quantity * Price) AS TOTAL_COST
|
||||
FROM $top_table
|
||||
$query = $this->db_connection->query("SELECT $top_table.OrderId, $top_table.customerId, $top_table.Quantity, $top_table.Price, ".USERS_TABLE.".Name
|
||||
FROM $top_table, ".USERS_TABLE."
|
||||
WHERE $top_table.customerId = ".USERS_TABLE.".CustomerId
|
||||
ORDER BY price $asc_desc
|
||||
LIMIT $this->max_top_bids
|
||||
");
|
||||
@ -283,6 +293,23 @@ class Orders extends Users {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get_active_order_of_user($user_id, $top_table) {
|
||||
if ($this->databaseConnection()) {
|
||||
$query = $this->db_connection->prepare("
|
||||
SELECT * FROM $top_table WHERE `customerId`= :uid ORDER BY `insertDate` DESC
|
||||
");
|
||||
$query->bindParam('uid', $user_id);
|
||||
$query->execute();
|
||||
|
||||
$arr = array();
|
||||
while ($qr = $query->fetchObject()) {
|
||||
$arr[] = $qr;
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function OrderMatchingQuery() {
|
||||
|
||||
if ($this->databaseConnection()) {
|
||||
@ -325,7 +352,7 @@ class Orders extends Users {
|
||||
|
||||
private function updateOrderStatus($orderId=null, $status=null) {
|
||||
if ($this->databaseConnection()) {
|
||||
$query = $this->db_connection->prepare("UPDATE `orderbook` SET `OrderStatusId`= '$status' WHERE `OrderId` = :id LIMIT 1");
|
||||
$query = $this->db_connection->prepare("UPDATE ".ORDERS_TABLE." SET `OrderStatusId`= '$status' WHERE `OrderId` = :id LIMIT 1");
|
||||
$query->bindParam("id", $orderId);
|
||||
if ($query->execute()) {
|
||||
return true;
|
||||
@ -378,14 +405,21 @@ class Orders extends Users {
|
||||
|
||||
if ($buyer_balance_cash < $cost_of_total_supply) {
|
||||
/*Record the message*/
|
||||
//$this->storeMessages($buy_order_id, $buyer_id, $msg="Transaction failed: You have insufficient cash balance.");
|
||||
$message[] = "Transaction failed: You have insufficient cash balance.";
|
||||
$this->storeMessages($buy_order_id, $buyer_id, $msg="Transaction failed: You have insufficient cash balance.");
|
||||
if ($_SESSION['user_id'] == $buyer_id) {
|
||||
$message[] = "Transaction failed: You have insufficient cash balance.";
|
||||
}
|
||||
// Delete the culprit order
|
||||
$this->del_order($buy_order_id, $buyer_id);
|
||||
break;
|
||||
}
|
||||
if (($seller_balance_btc == 0) || ($seller_balance_btc < $available->Quantity)) {
|
||||
/*Record the message*/
|
||||
//$this->storeMessages($seller_order_id, $seller_id, $msg="Transaction failed: You had insufficient RMT balance");
|
||||
$message[] = "Transaction failed: You had insufficient RMT balance";
|
||||
$this->storeMessages($seller_order_id, $seller_id, $msg="Transaction failed: You had insufficient RMT balance");
|
||||
if ($_SESSION['user_id'] == $seller_id) {
|
||||
$message[] = "Transaction failed: You had insufficient RMT balance";
|
||||
}
|
||||
$this->del_order($seller_order_id, $seller_id);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -397,15 +431,15 @@ class Orders extends Users {
|
||||
$new_buyer_balance_cash = $buyer_balance_cash - $cost_of_total_supply; // traditional or cash
|
||||
|
||||
// subtract the debit access (customers balance of $ or BTC)
|
||||
$this->update_user_balance($assetType = 'btc', $balance = $new_buyer_balance_btc, $user_id = $buyer_id);
|
||||
$this->update_user_balance($assetType = 'btc', $balance = $new_buyer_balance_btc, $buyer_id);
|
||||
|
||||
// increment the credit asset (customers balance of $ or BTC)
|
||||
$this->update_user_balance($assetType = 'traditional', $balance = $new_seller_balance_cash, $user_id = $seller_id);
|
||||
$this->update_user_balance($assetType = 'traditional', $balance = $new_seller_balance_cash, $seller_id);
|
||||
|
||||
// record the commission in the commission account
|
||||
// decrease respective balances
|
||||
$this->update_user_balance($assetType = 'btc', $balance = $new_seller_balance_btc, $user_id = $seller_id);
|
||||
$this->update_user_balance($assetType = 'traditional', $balance = $new_buyer_balance_cash, $user_id = $buyer_id);
|
||||
$this->update_user_balance($assetType = 'btc', $balance = $new_seller_balance_btc, $seller_id);
|
||||
$this->update_user_balance($assetType = 'traditional', $balance = $new_buyer_balance_cash, $buyer_id);
|
||||
}
|
||||
|
||||
$this->demanded_qty = $this->demanded_qty - $available->Quantity;
|
||||
@ -447,12 +481,20 @@ class Orders extends Users {
|
||||
|
||||
if ($buyer_balance_cash < $cost_of_total_supply) {
|
||||
/*Record the message*/
|
||||
//$this->storeMessages($buy_order_id, $buyer_id, $msg="Transaction failed: You had insufficient cash balance.");
|
||||
$this->storeMessages($buy_order_id, $buyer_id, $msg="Transaction failed: You had insufficient cash balance.");
|
||||
if ($_SESSION['user_id'] == $buyer_id) {
|
||||
$message[] = "Transaction failed: You have insufficient cash balance.";
|
||||
}
|
||||
$this->del_order($buy_order_id, $buyer_id);
|
||||
break;
|
||||
}
|
||||
if (($seller_balance_btc == 0) || ($seller_balance_btc < $available->Quantity)) {
|
||||
/*Record the message*/
|
||||
//$this->storeMessages($seller_order_id, $seller_id, $msg="Transaction failed: You had insufficient RMT balance.");
|
||||
$this->storeMessages($seller_order_id, $seller_id, $msg="Transaction failed: You had insufficient RMT balance.");
|
||||
if ($_SESSION['user_id'] == $seller_id) {
|
||||
$message[] = "Transaction failed: You had insufficient RMT balance";
|
||||
}
|
||||
$this->del_order($seller_order_id, $seller_id);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -513,12 +555,20 @@ class Orders extends Users {
|
||||
|
||||
if ($buyer_balance_cash < $cost_of_total_supply) {
|
||||
/*Record the message*/
|
||||
//$this->storeMessages($buy_order_id, $buyer_id, $msg="Transaction failed: You had insufficient cash balance.");
|
||||
$this->storeMessages($buy_order_id, $buyer_id, $msg="Transaction failed: You had insufficient cash balance.");
|
||||
if ($_SESSION['user_id'] == $buyer_id) {
|
||||
$message[] = "Transaction failed: You have insufficient cash balance.";
|
||||
}
|
||||
$this->del_order($buy_order_id, $buyer_id);
|
||||
break;
|
||||
}
|
||||
if (($seller_balance_btc == 0) || ($seller_balance_btc < $this->demanded_qty)) {
|
||||
/*Record the message*/
|
||||
//$this->storeMessages($seller_order_id, $seller_id, $msg="Transaction failed: You had insufficient RMT balance.");
|
||||
$this->storeMessages($seller_order_id, $seller_id, $msg="Transaction failed: You had insufficient RMT balance.");
|
||||
if ($_SESSION['user_id'] == $seller_id) {
|
||||
$message[] = "Transaction failed: You had insufficient RMT balance";
|
||||
}
|
||||
$this->del_order($seller_order_id, $seller_id);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -590,10 +640,10 @@ class Orders extends Users {
|
||||
|
||||
private function record_transaction($buyer, $buy_order_id, $buy_amount, $buy_commission, $seller, $sell_order_id, $sell_amount, $sell_commission, $trade_qty) {
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$now = $this->time_now();
|
||||
$query = $this->db_connection->prepare("
|
||||
INSERT INTO $this->transaction_table(`TransactionId`, `a_buyer`, `A_OrderId`, `A_Amount`, `A_Commission`, `b_seller`, `B_OrderId`, `B_Amount`, `B_Commission`, `qty_traded`, `UpdateDate`, `InsertDate`, `SaveDate`)
|
||||
VALUES ('', :buyer,:buy_order_id, :buy_amount, :buy_commission, :seller, :sell_order_id, :sell_amount, :sell_commission, :trade_qty, NULL, NOW(), NOW())
|
||||
VALUES ('', :buyer,:buy_order_id, :buy_amount, :buy_commission, :seller, :sell_order_id, :sell_amount, :sell_commission, :trade_qty, NULL, '$now', '$now')
|
||||
");
|
||||
$query->bindParam("buyer", $buyer);
|
||||
$query->bindParam("buy_order_id", $buy_order_id);
|
||||
@ -626,9 +676,10 @@ class Orders extends Users {
|
||||
private function update_quantity($top_table, $qty, $orderId) {
|
||||
|
||||
if ($this->databaseConnection()) {
|
||||
$now = $this->time_now();
|
||||
$query = $this->db_connection->prepare("
|
||||
UPDATE $top_table
|
||||
SET `quantity`= :qty, `insertDate`=NOW()
|
||||
SET `quantity`= :qty, `insertDate`='$now'
|
||||
WHERE orderId = :orderId
|
||||
LIMIT 1
|
||||
");
|
||||
@ -644,9 +695,9 @@ class Orders extends Users {
|
||||
|
||||
private function insert_market_order($customerId, $orderTypeId, $OfferAssetTypeId=null, $WantAssetTypeId=null, $qty, $price) {
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$now = $this->time_now();
|
||||
$query = $this->db_connection->prepare("INSERT INTO $this->orders_table (`OrderId`, `CustomerId`, `OrderTypeId`, `OfferAssetTypeId`, `WantAssetTypeId`, `Quantity`, `Price`, `OrderStatusId`, `MarketOrder`, `UpdateDate`, `InsertDate`, `SaveDate`)
|
||||
VALUES ('', :u, :a, :d, :e, :b, :c, 1, 1, NULL, Now(), NULL)
|
||||
VALUES ('', :u, :a, :d, :e, :b, :c, 1, 1, NULL, '$now', NULL)
|
||||
");
|
||||
$query->bindParam(':u', $customerId, PDO::PARAM_INT);
|
||||
$query->bindParam(':a', $orderTypeId, PDO::PARAM_INT);
|
||||
@ -688,7 +739,7 @@ class Orders extends Users {
|
||||
if(is_float($qty) || is_int($qty)) {
|
||||
if ($qty > 0) {
|
||||
|
||||
$sell_list = $this->get_top_buy_sell_list($top_table='active_selling_list', $asc_desc='ASC');
|
||||
$sell_list = $this->get_top_buy_sell_list($top_table=TOP_SELL_TABLE, $asc_desc='ASC');
|
||||
|
||||
if (!empty($sell_list)) {
|
||||
|
||||
@ -775,7 +826,7 @@ class Orders extends Users {
|
||||
// Delete the row from Sell list
|
||||
$this->delete_order($this->top_sell_table, $available->OrderId);
|
||||
|
||||
// Update Order Status in Orderbook
|
||||
// Update Order Status in Order table
|
||||
$this->UpdateOrderStatus($available->OrderId, '1');
|
||||
|
||||
$message[] = "Instant Transaction Successful: You bought $available->Quantity RMT at $ $available->Price per token for $ $cost_of_total_supply.";
|
||||
@ -850,7 +901,7 @@ class Orders extends Users {
|
||||
// Delete the row from Sell list
|
||||
$this->delete_order($this->top_sell_table, $available->OrderId);
|
||||
|
||||
// Update Order Status in Orderbook
|
||||
// Update Order Status in Order table
|
||||
$this->UpdateOrderStatus($buy_order_id, '1');
|
||||
$this->UpdateOrderStatus($available->OrderId, '1');
|
||||
|
||||
@ -909,7 +960,7 @@ class Orders extends Users {
|
||||
// update the quantity field for supply
|
||||
$this->update_quantity($top_table = $this->top_sell_table, $available->Quantity, $available->OrderId);
|
||||
|
||||
// Update Order Status in Orderbook
|
||||
// Update Order Status in Order table
|
||||
$this->UpdateOrderStatus($buy_order_id, '1');
|
||||
|
||||
$message[] = "Instant Transaction Successful: You bought $qty tokens at $ $available->Price per token for $ $cost_of_total_supply.";
|
||||
@ -925,8 +976,8 @@ class Orders extends Users {
|
||||
}
|
||||
if (($available->Quantity <= 0) && ($qty > 0) && ($key === $last_iter)) {
|
||||
/*The supply of token is 0. Stop further transaction. */
|
||||
$message[] = "Instant Transaction failure: There's no token left to be sold any more. $qty tokens could not be sold.";
|
||||
$this->storeMessages($buy_order_id=null, $buyer_id, $msg="There's no token left to be sold any more. $qty tokens could not be sold.");
|
||||
$message[] = "Instant Transaction failure: There's no token left to be sold any more. $qty tokens could not be bought.";
|
||||
$this->storeMessages($buy_order_id=null, $buyer_id, $msg="There's no token left to be sold any more. $qty tokens could not be bought.");
|
||||
}
|
||||
}
|
||||
return $message;
|
||||
@ -941,7 +992,7 @@ class Orders extends Users {
|
||||
if(is_float($qty) || is_int($qty)) {
|
||||
if ($qty > 0) {
|
||||
|
||||
$buy_list = $this->get_top_buy_sell_list($top_table='active_buy_list', $asc_desc='DESC');
|
||||
$buy_list = $this->get_top_buy_sell_list($top_table=TOP_BUYS_TABLE, $asc_desc='DESC');
|
||||
|
||||
if (!empty($buy_list)) {
|
||||
foreach ($buy_list as $available) {
|
||||
@ -1022,7 +1073,7 @@ class Orders extends Users {
|
||||
// Delete the row from buy list
|
||||
$this->delete_order($this->top_buy_table, $available->OrderId);
|
||||
|
||||
// Update Order Status in Orderbook
|
||||
// Update Order Status in Order table
|
||||
$this->UpdateOrderStatus($available->OrderId, '1');
|
||||
|
||||
// Record the transaction
|
||||
@ -1089,7 +1140,7 @@ class Orders extends Users {
|
||||
|
||||
$qty = $qty - $available->Quantity;
|
||||
|
||||
// Update Order Status in Orderbook
|
||||
// Update Order Status in Order table
|
||||
$this->UpdateOrderStatus($sell_order_id, '1');
|
||||
$this->UpdateOrderStatus($available->OrderId, '1');
|
||||
|
||||
@ -1155,7 +1206,7 @@ class Orders extends Users {
|
||||
// update the quantity field for supply
|
||||
$this->update_quantity($top_table = $this->top_buy_table, $available->Quantity, $available->OrderId);
|
||||
|
||||
// Update Order Status in Orderbook
|
||||
// Update Order Status in Order table
|
||||
$this->UpdateOrderStatus($sell_order_id, '1');
|
||||
|
||||
$message[] = "Instant Transaction Successful: You sold $qty tokens for $ $cost_of_total_supply.";
|
||||
@ -1186,8 +1237,8 @@ class Orders extends Users {
|
||||
$list = array();
|
||||
|
||||
$query = $this->db_connection->query("
|
||||
SELECT TransactionId AS T_ID, a_buyer AS BUYER_ID, b_seller AS SELLER_ID, (SELECT customer.Name FROM customer WHERE customer.CustomerId=BUYER_ID) AS BUYER, (SELECT customer.Name FROM customer WHERE customer.CustomerId=SELLER_ID) AS SELLER, B_AMOUNT AS TRADE_PRICE, transaction.InsertDate, transaction.qty_traded AS TRADED_QTY
|
||||
FROM transaction, customer
|
||||
SELECT TransactionId AS T_ID, a_buyer AS BUYER_ID, b_seller AS SELLER_ID, (SELECT ".USERS_TABLE.".Name FROM ".USERS_TABLE." WHERE ".USERS_TABLE.".CustomerId=BUYER_ID) AS BUYER, (SELECT ".USERS_TABLE.".Name FROM ".USERS_TABLE." WHERE ".USERS_TABLE.".CustomerId=SELLER_ID) AS SELLER, B_AMOUNT AS TRADE_PRICE, ".TRANSACTIONS_TABLE.".InsertDate, ".TRANSACTIONS_TABLE.".qty_traded AS TRADED_QTY
|
||||
FROM ".TRANSACTIONS_TABLE.", ".USERS_TABLE."
|
||||
GROUP BY T_ID
|
||||
ORDER BY T_ID DESC
|
||||
LIMIT $start, $limit
|
||||
@ -1212,16 +1263,16 @@ class Orders extends Users {
|
||||
$extraQuerry = "";
|
||||
|
||||
if ($is_active != null) {
|
||||
$extraQuerry = "WHERE customer.is_active = 0 OR customer.is_active = 1";
|
||||
$extraQuerry = "WHERE ".USERS_TABLE.".is_active = 0 OR ".USERS_TABLE.".is_active = 1";
|
||||
} else {
|
||||
$extraQuerry = "WHERE customer.is_active = 1";
|
||||
$extraQuerry = "WHERE ".USERS_TABLE.".is_active = 1";
|
||||
}
|
||||
|
||||
$query = $this->db_connection->query("
|
||||
SELECT customer.CustomerId AS UID, customer.Name, customer.is_active,
|
||||
(SELECT assetbalance.Balance FROM assetbalance WHERE assetbalance.AssetTypeId='btc' AND assetbalance.CustomerId=UID) AS BTC,
|
||||
(SELECT assetbalance.Balance FROM assetbalance WHERE assetbalance.AssetTypeId='traditional' AND assetbalance.CustomerId=UID) AS CASH
|
||||
FROM customer, assetbalance
|
||||
SELECT ".USERS_TABLE.".CustomerId AS UID, ".USERS_TABLE.".Name, ".USERS_TABLE.".is_active, ".USERS_TABLE.".fb_id AS FACEBOOK_ID,
|
||||
(SELECT ".CREDITS_TABLE.".Balance FROM ".CREDITS_TABLE." WHERE ".CREDITS_TABLE.".AssetTypeId='btc' AND ".CREDITS_TABLE.".CustomerId=UID) AS BTC,
|
||||
(SELECT ".CREDITS_TABLE.".Balance FROM ".CREDITS_TABLE." WHERE ".CREDITS_TABLE.".AssetTypeId='traditional' AND ".CREDITS_TABLE.".CustomerId=UID) AS CASH
|
||||
FROM ".USERS_TABLE.", ".CREDITS_TABLE."
|
||||
$extraQuerry
|
||||
GROUP BY UID ORDER BY MAX(BTC) DESC
|
||||
");
|
||||
@ -1241,7 +1292,7 @@ class Orders extends Users {
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$query = $this->db_connection->query("
|
||||
SELECT `B_Amount` FROM `transaction` ORDER BY `InsertDate` DESC LIMIT 1
|
||||
SELECT `B_Amount`,InsertDate FROM ".TRANSACTIONS_TABLE." ORDER BY `InsertDate` DESC LIMIT 1
|
||||
");
|
||||
|
||||
if ($query->rowCount() == 1) {
|
||||
@ -1259,7 +1310,7 @@ class Orders extends Users {
|
||||
$list = array();
|
||||
$query = $this->db_connection->prepare("
|
||||
SELECT `OrderId`, `CustomerId`, `OrderTypeId`, `OfferAssetTypeId`, `WantAssetTypeId`, `Quantity`, `Price`, `OrderStatusId`, `MarketOrder`, `InsertDate`
|
||||
FROM `orderbook`
|
||||
FROM ".ORDERS_TABLE."
|
||||
WHERE `CustomerId`=:u_id
|
||||
ORDER BY InsertDate DESC
|
||||
LIMIT $start, $limit
|
||||
@ -1278,23 +1329,11 @@ class Orders extends Users {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function del_order($order_id) {
|
||||
protected function cancel_order($order_id=null, $user_id=null) {
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$user_id = 0;
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
return false;
|
||||
}
|
||||
$user_id = (int) $_SESSION['user_id'];
|
||||
$is_owner = $this->isUserOrderOwner($order_id, $user_id);
|
||||
|
||||
if (!$is_owner) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = $this->db_connection->prepare("
|
||||
DELETE FROM `active_buy_list` WHERE `orderId`=:id AND customerId = :cus_id;
|
||||
DELETE FROM `active_selling_list` WHERE `orderId`=:id AND customerId = :cus_id
|
||||
DELETE FROM ".TOP_BUYS_TABLE." WHERE `orderId`=:id AND customerId = :cus_id;
|
||||
DELETE FROM ".TOP_SELL_TABLE." WHERE `orderId`=:id AND customerId = :cus_id
|
||||
");
|
||||
|
||||
$query->bindParam('id', $order_id);
|
||||
@ -1304,7 +1343,7 @@ class Orders extends Users {
|
||||
unset($query); // Unset the query
|
||||
|
||||
$q = $this->db_connection->prepare("
|
||||
UPDATE `orderbook` SET `OrderStatusId`= 0
|
||||
UPDATE ".ORDERS_TABLE." SET `OrderStatusId`= 0
|
||||
WHERE `OrderId` = :ord
|
||||
AND CustomerId = :cust_id
|
||||
");
|
||||
@ -1315,29 +1354,64 @@ class Orders extends Users {
|
||||
unset($q);
|
||||
|
||||
$query2 = $this->db_connection->prepare("
|
||||
SELECT * FROM `active_buy_list` WHERE `orderId`=:o_id;
|
||||
SELECT * FROM `active_selling_list` WHERE `orderId`=:o_id
|
||||
SELECT * FROM ".TOP_BUYS_TABLE." WHERE `orderId`=:o_id;
|
||||
SELECT * FROM ".TOP_SELL_TABLE." WHERE `orderId`=:o_id
|
||||
");
|
||||
$query2->bindParam('o_id', $order_id);
|
||||
|
||||
if ($query2->execute()) {
|
||||
if ($query2->rowCount() == 0) {
|
||||
if ($_SESSION['user_id']==ADMIN_ID) {
|
||||
$this->storeMessages($order_id, ADMIN_ID, $msg="Order number $order_id was deleted by user id ".ADMIN_ID);
|
||||
$this->storeMessages($order_id, $user_id, $msg="Order number $order_id was deleted by Admin.");
|
||||
} else {
|
||||
$this->storeMessages($order_id, $user_id, $msg="Order number $order_id was deleted by you.");
|
||||
}
|
||||
return true; // This means row was actually deleted
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function storeMessages($order_id=null, $user_id=null, $msg=null) {
|
||||
if($this->databaseConnection()) {
|
||||
public function del_order($order_id, $usid=null) {
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$username = (string) trim($this->check_user($user_id)->Username);
|
||||
$user_id = 0;
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
return false;
|
||||
}
|
||||
$user_id = (int) $_SESSION['user_id'];
|
||||
// Allow Admin to delete order, if its not admin check owner of order
|
||||
if ($usid == null) {
|
||||
$is_owner = $this->isUserOrderOwner($order_id, $user_id);
|
||||
|
||||
if (!$is_owner) {
|
||||
return false;
|
||||
}
|
||||
} else if(($usid != null) && ($user_id == ADMIN_ID)) { // This else part to be used by admin in delete_orders_of_user()
|
||||
$user_id = $usid;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Finally cancel the order
|
||||
return $this->cancel_order($order_id, $user_id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function storeMessages($order_id=null, $user_id=null, $msg=null) {
|
||||
if($this->databaseConnection()) {
|
||||
$now = $this->time_now();
|
||||
if ($user_id == false) {
|
||||
return false;
|
||||
}
|
||||
$username = $this->get_username($user_id);
|
||||
|
||||
$query = $this->db_connection->prepare("
|
||||
INSERT INTO `messages`(`id`, `order_id`, `username_key`, `username`, `messages`, `datetime`)
|
||||
VALUES ('', :order_id, :user_id, :username, :msg, NOW())
|
||||
INSERT INTO ".MSG_TABLE."(`id`, `order_id`, `username_key`, `username`, `messages`, `datetime`)
|
||||
VALUES ('', :order_id, :user_id, :username, :msg, '$now')
|
||||
");
|
||||
$query->bindParam("order_id", $order_id);
|
||||
$query->bindParam("user_id", $user_id);
|
||||
@ -1366,7 +1440,7 @@ class Orders extends Users {
|
||||
}
|
||||
$query = $this->db_connection->prepare("
|
||||
SELECT COUNT(*) AS MY_TOTAL_MESSAGES
|
||||
FROM `messages`
|
||||
FROM ".MSG_TABLE."
|
||||
WHERE `username_key`=:u_id
|
||||
");
|
||||
$query->bindParam('u_id', $user_id);
|
||||
@ -1390,7 +1464,7 @@ class Orders extends Users {
|
||||
}
|
||||
$query = $this->db_connection->prepare("
|
||||
SELECT COUNT(*) AS MY_TOTAL_ORDERS
|
||||
FROM `orderbook`
|
||||
FROM ".ORDERS_TABLE."
|
||||
WHERE `CustomerId`=:u_id
|
||||
");
|
||||
$query->bindParam('u_id', $user_id);
|
||||
@ -1414,7 +1488,7 @@ class Orders extends Users {
|
||||
}
|
||||
$query = $this->db_connection->prepare("
|
||||
SELECT COUNT(*) AS MY_TOTAL_ORDERS
|
||||
FROM `transaction`
|
||||
FROM ".TRANSACTIONS_TABLE."
|
||||
WHERE `a_buyer`= :u_id OR `b_seller`= :u_id
|
||||
");
|
||||
$query->bindParam('u_id', $user_id);
|
||||
@ -1434,7 +1508,7 @@ class Orders extends Users {
|
||||
|
||||
$query = $this->db_connection->prepare("
|
||||
SELECT COUNT(*) AS TOTAL_ORDERS
|
||||
FROM `transaction`
|
||||
FROM ".TRANSACTIONS_TABLE."
|
||||
");
|
||||
if ($query->execute()) {
|
||||
$fetch = $query->fetchObject();
|
||||
@ -1448,7 +1522,7 @@ class Orders extends Users {
|
||||
private function isUserOrderOwner($order_id=0, $user_id=0) {
|
||||
if ($this->databaseConnection()) {
|
||||
$query = $this->db_connection->prepare("
|
||||
SELECT `OrderId` FROM `orderbook`
|
||||
SELECT `OrderId` FROM ".ORDERS_TABLE."
|
||||
WHERE `OrderId`=:o_id
|
||||
AND `CustomerId`=:c_id
|
||||
LIMIT 1
|
||||
@ -1464,5 +1538,184 @@ class Orders extends Users {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function storeMessagesPublic($order_id=null, $user_id=null, $msg=null) {
|
||||
if ($this->databaseConnection()) {
|
||||
$this->storeMessages($order_id, $user_id, $msg);
|
||||
}
|
||||
}
|
||||
|
||||
/*Add bank account*/
|
||||
public function add_bank_account($user_id, $holder, $bank_name, $account_num, $branch_name, $bank_addr, $bk_ctry) {
|
||||
if ($this->databaseConnection()) {
|
||||
$now = $this->time_now();
|
||||
$query = $this->db_connection->prepare(
|
||||
"INSERT INTO $this->bank_acc(`id`, `user_id`, `acc_holder`, `bank_name`, `acc_num`, `branch_name`, `bank_addr`, `bank_ctry`, `date_added`)
|
||||
VALUES ('', :uid, :holder, :bk_name, :acc_num, :br_name, :addr, :ctry, '$now')"
|
||||
);
|
||||
$query->bindParam("uid", $user_id);
|
||||
$query->bindParam("holder", $holder);
|
||||
$query->bindParam("bk_name", $bank_name);
|
||||
$query->bindParam("acc_num", $account_num);
|
||||
$query->bindParam("br_name", $branch_name);
|
||||
$query->bindParam("addr", $bank_addr);
|
||||
$query->bindParam("ctry", $bk_ctry);
|
||||
|
||||
if ($query->execute()) {
|
||||
$this->storeMessages(null, $user_id, $msg="You added a new bank account number $account_num.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function send_notice_mail($reciever_email, $email_from, $email_sender, $email_subject, $email_body) {
|
||||
$mail = new SendMail();
|
||||
$do_mail = $mail->do_email($reciever_email, $email_from, $email_sender, $email_subject, $email_body);
|
||||
if ($do_mail==true) {
|
||||
return $do_mail;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get_bank_details($user_id, $acc=null) {
|
||||
$acc_details = null;
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$ex = "";
|
||||
if ($acc != null) {
|
||||
$ex = "AND `acc_num`=:acc";
|
||||
}
|
||||
|
||||
$query = $this->db_connection->prepare(
|
||||
"SELECT * FROM $this->bank_acc WHERE `user_id`=:uid $ex"
|
||||
);
|
||||
$query->bindParam("uid", $user_id);
|
||||
if ($acc != null) {
|
||||
$query->bindParam("acc", $acc);
|
||||
}
|
||||
$query->execute();
|
||||
|
||||
if ($query->rowCount() > 0) {
|
||||
while ($acc_info = $query->fetchObject()) {
|
||||
$acc_details[] = $acc_info;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $acc_details;
|
||||
}
|
||||
|
||||
/*Fund transfer*/
|
||||
public function fund_transfer($fund_type, $from, $to, $amount, $remarks, $assetType) {
|
||||
$user_id = (isset($_SESSION['user_id']) && (int) $_SESSION['user_id'] != 0) ? $_SESSION['user_id'] : 0;
|
||||
$now = $this->time_now();
|
||||
if ($this->databaseConnection() && $user_id != 0) {
|
||||
|
||||
$user_bal_currently = (float)$this->check_customer_balance($assetType, $user_id)->Balance;
|
||||
|
||||
$new_bal = (float)$user_bal_currently - $amount;
|
||||
|
||||
$ft = $this->update_user_balance($assetType, $new_bal, $user_id);
|
||||
|
||||
if ($user_bal_currently == null || $ft == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sign = ($assetType == 'btc') ? 'RTM':'$';
|
||||
|
||||
$query = $this->db_connection->prepare(
|
||||
"INSERT INTO ".TRANSFER_INFO_TABLE."(`id`, `user_id`, `fund_type`, `tr_from`, `tr_to`, `fund_amount`, `remarks`, `datetime`)
|
||||
VALUES('', :uid, :fund_type, :tr_from, :tr_to, :tr_amount, :remarks, '$now')"
|
||||
);
|
||||
$query->bindParam('uid', $user_id);
|
||||
$query->bindParam('fund_type', $fund_type);
|
||||
$query->bindParam('tr_from', $from);
|
||||
$query->bindParam('tr_to', $to);
|
||||
$query->bindParam('tr_amount', $amount);
|
||||
$query->bindParam('remarks', $remarks);
|
||||
|
||||
if ($query->execute()) {
|
||||
$this->storeMessages(null, $user_id, $msg="You have requested to transfer $sign $amount to bank account number $to.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function record_root_bal_update($uid, $bal_prev, $bal_now, $bal_type) {
|
||||
if ($this->databaseConnection()) {
|
||||
$now = $this->time_now();
|
||||
$root = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : 0;
|
||||
$query = $this->db_connection->prepare("
|
||||
INSERT INTO ".ADMIN_BAL_RECORDS."(`BalStatusHistoryId`, `user_id`, `bal_prev`, `bal_now`, `type`, `root_id`, `UpdateDate`)
|
||||
VALUES ('', :uid, :prev, :now, :btype, :root, '$now')
|
||||
");
|
||||
$query->bindParam("uid", $uid);
|
||||
$query->bindParam("prev", $bal_prev);
|
||||
$query->bindParam("now", $bal_now);
|
||||
$query->bindParam("btype", $bal_type);
|
||||
$query->bindParam("root", $root);
|
||||
|
||||
if ($query->execute()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function list_root_bal_changes() {
|
||||
if ($this->databaseConnection()) {
|
||||
$list_details = array();
|
||||
$query = $this->db_connection->prepare("
|
||||
SELECT ".ADMIN_BAL_RECORDS.".*, ".USERS_TABLE.".Name, ".USERS_TABLE.".Email
|
||||
FROM ".ADMIN_BAL_RECORDS.", ".USERS_TABLE."
|
||||
WHERE ".ADMIN_BAL_RECORDS.".user_id=".USERS_TABLE.".CustomerId
|
||||
ORDER BY UpdateDate DESC
|
||||
LIMIT 200
|
||||
");
|
||||
$query->execute();
|
||||
|
||||
if ($query->rowCount() > 0) {
|
||||
while ($list = $query->fetchObject()) {
|
||||
$list_details[] = $list;
|
||||
}
|
||||
}
|
||||
return $list_details;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get_last_order_date($date=null) {
|
||||
if ($this->databaseConnection()) {
|
||||
$query = $this->db_connection->query("SELECT * FROM `orderbook` WHERE `InsertDate`> '$date'");
|
||||
if ($query->rowCount()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function delete_orders_of_user($user_id=null) {
|
||||
if ($this->databaseConnection()) {
|
||||
$order_ids = array();
|
||||
$query = $this->db_connection->prepare("
|
||||
SELECT orderId FROM ".TOP_BUYS_TABLE." WHERE `customerId`=:uid
|
||||
UNION
|
||||
SELECT orderId FROM ".TOP_SELL_TABLE." WHERE `customerId`=:uid
|
||||
");
|
||||
$query->bindParam('uid', $user_id);
|
||||
$query->execute();
|
||||
if ($query->rowCount() > 0) {
|
||||
while ($rr = $query->fetchObject()) {
|
||||
$order_ids[] = $rr;
|
||||
}
|
||||
foreach ($order_ids as $oid) {
|
||||
$this->del_order($oid->orderId, $user_id);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
2949
classes/PHPMailer.php
Normal file
2949
classes/PHPMailer.php
Normal file
File diff suppressed because it is too large
Load Diff
84
classes/SendMail.php
Normal file
84
classes/SendMail.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: user
|
||||
* Date: 07-Jul-16
|
||||
* Time: 9:23 PM
|
||||
*/
|
||||
|
||||
class SendMail extends Orders {
|
||||
|
||||
private $reciever_email = array();
|
||||
public $errors = array();
|
||||
private $from = null;
|
||||
private $sender = null;
|
||||
private $subject = null;
|
||||
private $body = null;
|
||||
//add a field to dynamically add subject and to be sent as a parameter in do_email fn
|
||||
|
||||
public function do_email($reciever_email=array(), $email_from=null, $email_sender=null, $email_subject=null, $email_body=null, $attachments=array()) {
|
||||
$this->reciever_email = $reciever_email;
|
||||
$this->from = $email_from;
|
||||
$this->sender = $email_sender;
|
||||
$this->subject = $email_subject;
|
||||
$this->body = $email_body;
|
||||
$this->attachments = $attachments;
|
||||
|
||||
$mail = new PHPMailer;
|
||||
|
||||
// please look into the config/config.php for much more info on how to use this!
|
||||
// use SMTP or use mail()
|
||||
if (EMAIL_USE_SMTP) {
|
||||
// Set mailer to use SMTP
|
||||
$mail->IsSMTP();
|
||||
//useful for debugging, shows full SMTP errors
|
||||
$mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
|
||||
// Enable SMTP authentication
|
||||
$mail->SMTPAuth = EMAIL_SMTP_AUTH;
|
||||
// Enable encryption, usually SSL/TLS
|
||||
if (defined(EMAIL_SMTP_ENCRYPTION)) {
|
||||
$mail->SMTPSecure = EMAIL_SMTP_ENCRYPTION;
|
||||
}
|
||||
$mail->SMTPSecure = "tls";
|
||||
// Specify host server
|
||||
$mail->Host = EMAIL_SMTP_HOST;
|
||||
$mail->Username = EMAIL_SMTP_USERNAME;
|
||||
$mail->Password = EMAIL_SMTP_PASSWORD;
|
||||
$mail->Port = EMAIL_SMTP_PORT;
|
||||
} else {
|
||||
$mail->IsMail();
|
||||
}
|
||||
|
||||
if(trim($email_from) != "" && !empty($reciever_email)) {
|
||||
$mail->From = $email_from;
|
||||
$mail->FromName = $email_sender;
|
||||
|
||||
$this->reciever_email[] = $reciever_email;
|
||||
$mail->IsHTML(true);
|
||||
foreach ($reciever_email as $rec) {
|
||||
$mail->AddAddress($rec);
|
||||
}
|
||||
$mail->AddCC(RT);
|
||||
$mail->AddCC(AB);
|
||||
$mail->Subject = $email_subject;
|
||||
$mail->Body = $email_body;
|
||||
|
||||
if ($attachments!==null && is_array($attachments) && !empty($attachments)) {
|
||||
foreach ($attachments as $attachment) {
|
||||
$path_to_file = $attachment;
|
||||
$arr = explode('/',$attachment);
|
||||
$att_file = end($arr);
|
||||
$mail->AddAttachment($path_to_file, $att_file);
|
||||
}
|
||||
}
|
||||
|
||||
if(!$mail->Send()) {
|
||||
$this->errors[] = "Mail could not be sent" . $mail->ErrorInfo;
|
||||
return $this->errors;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -9,10 +9,15 @@
|
||||
class Users {
|
||||
|
||||
protected $db_connection = null;
|
||||
private $customers_table = "customer";
|
||||
private $top_buy_table = "active_buy_list";
|
||||
private $top_sell_table = "active_selling_list";
|
||||
private $customer_balance_table = "assetbalance";
|
||||
private $orders_table = ORDERS_TABLE;
|
||||
private $customers_table = USERS_TABLE;
|
||||
private $top_buy_table = TOP_BUYS_TABLE;
|
||||
private $top_sell_table = TOP_SELL_TABLE;
|
||||
private $customer_balance_table = CREDITS_TABLE;
|
||||
private $transaction_table = TRANSACTIONS_TABLE;
|
||||
private $bal_history = CREDITS_HISTORY_TABLE;
|
||||
private $bank_acc = ACCOUNTS_TABLE;
|
||||
private $fund_trans = TRANSFER_INFO_TABLE;
|
||||
private $user_name = null;
|
||||
private $email = null;
|
||||
private $name = null;
|
||||
@ -37,9 +42,9 @@ class Users {
|
||||
}
|
||||
|
||||
private function insert_balance($CustomerId, $AssetTypeId, $Balance, $FrozenBalance) {
|
||||
|
||||
$now = $this->time_now();
|
||||
if ($this->databaseConnection()) {
|
||||
$query = $this->db_connection->prepare("INSERT INTO `$this->customer_balance_table`(`sr_no`, `CustomerId`, `AssetTypeId`, `Balance`, `FrozenBalance`, `UpdateDate`, `InsertDate`, `SaveDate`) VALUES ('', :CustomerId,:AssetTypeId,:Balance,:FrozenBalance,NULL,NOW(),NOW())");
|
||||
$query = $this->db_connection->prepare("INSERT INTO `$this->customer_balance_table`(`sr_no`, `CustomerId`, `AssetTypeId`, `Balance`, `FrozenBalance`, `UpdateDate`, `InsertDate`, `SaveDate`) VALUES ('', :CustomerId,:AssetTypeId,:Balance,:FrozenBalance,NULL,'$now','$now')");
|
||||
$query->bindValue(':CustomerId', $CustomerId, PDO::PARAM_STR);
|
||||
$query->bindValue(':AssetTypeId', $AssetTypeId, PDO::PARAM_STR);
|
||||
$query->bindValue(':Balance', $Balance, PDO::PARAM_STR);
|
||||
@ -55,7 +60,7 @@ class Users {
|
||||
public function is_fb_registered($fb_id) {
|
||||
|
||||
if ($this->databaseConnection()) {
|
||||
|
||||
$now = $this->time_now();
|
||||
$query = $this->db_connection->prepare("SELECT * FROM $this->customers_table WHERE `fb_id`=:fb_id");
|
||||
$query->bindValue(':fb_id', $fb_id, PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
@ -66,21 +71,20 @@ class Users {
|
||||
|
||||
$user_obj = $query->fetchObject();
|
||||
|
||||
$user_email = $user_obj->Email;
|
||||
|
||||
if($user_email !== '' || $user_email !== null) {
|
||||
|
||||
$update_query = $this->db_connection->prepare("UPDATE $this->customers_table
|
||||
SET `Email`=:email, `UpdateDate`=NOW(), `SaveDate`=NOW()
|
||||
$update_query = $this->db_connection->prepare("UPDATE $this->customers_table
|
||||
SET `SaveDate`='$now'
|
||||
WHERE `fb_id`=:fb_id
|
||||
LIMIT 1");
|
||||
$update_query->bindValue(':email', $user_email, PDO::PARAM_STR);
|
||||
$update_query->bindValue(':fb_id', $fb_id, PDO::PARAM_STR);
|
||||
$update_query->execute();
|
||||
}
|
||||
$update_query->bindValue(':fb_id', $fb_id, PDO::PARAM_STR);
|
||||
$update_query->execute();
|
||||
|
||||
$_SESSION['user_id'] = $user_obj->CustomerId;
|
||||
$_SESSION['user_name'] = $user_obj->Username;
|
||||
$_SESSION['email'] = $user_obj->Email;
|
||||
|
||||
if (!isset($_SESSION['last_trade_date'])) {
|
||||
$_SESSION['last_trade_date'] = $user_obj->SaveDate;
|
||||
}
|
||||
return true;
|
||||
|
||||
} else {
|
||||
@ -91,7 +95,7 @@ class Users {
|
||||
|
||||
$query = $this->db_connection->prepare("
|
||||
INSERT INTO $this->customers_table (`CustomerId`, `fb_id`, `Username`, `Email`, `Name`, `UpdateDate`, `InsertDate`, `SaveDate`, `is_active`)
|
||||
VALUES ('',:fb_id,:Username,:Email,:Name,NULL,NOW(),NULL,0)
|
||||
VALUES ('',:fb_id,:Username,:Email,:Name,NULL,'$now',NULL,0)
|
||||
");
|
||||
|
||||
$query->bindValue(':fb_id', $fb_id, PDO::PARAM_INT);
|
||||
@ -102,12 +106,12 @@ class Users {
|
||||
$_SESSION['user_id'] = $this->db_connection->lastInsertId();
|
||||
$_SESSION['user_name'] = $this->user_name;
|
||||
$AssetTypeId = 'btc';
|
||||
$Balance = 10.00;
|
||||
$Balance = 0.00;
|
||||
$FrozenBalance = 0.00;
|
||||
$crypto = $this->insert_balance($_SESSION['user_id'], $AssetTypeId, $Balance, $FrozenBalance);
|
||||
|
||||
$AssetTypeId = 'traditional';
|
||||
$Balance = 100.00;
|
||||
$Balance = 0.00;
|
||||
$FrozenBalance = 0.00;
|
||||
$cash = $this->insert_balance($_SESSION['user_id'], $AssetTypeId, $Balance, $FrozenBalance);
|
||||
|
||||
@ -149,8 +153,8 @@ class Users {
|
||||
$transactions = array();
|
||||
|
||||
$query = $this->db_connection->prepare("
|
||||
SELECT TransactionId AS T_ID, a_buyer AS BUYER_ID, b_seller AS SELLER_ID, (SELECT customer.Name FROM customer WHERE customer.CustomerId=BUYER_ID) AS BUYER, (SELECT customer.Name FROM customer WHERE customer.CustomerId=SELLER_ID) AS SELLER, B_AMOUNT AS TRADE_PRICE, transaction.InsertDate, transaction.qty_traded AS TRADED_QTY
|
||||
FROM transaction, customer
|
||||
SELECT TransactionId AS T_ID, a_buyer AS BUYER_ID, b_seller AS SELLER_ID, (SELECT ".USERS_TABLE.".Name FROM ".USERS_TABLE." WHERE ".USERS_TABLE.".CustomerId=BUYER_ID) AS BUYER, (SELECT ".USERS_TABLE.".Name FROM ".USERS_TABLE." WHERE ".USERS_TABLE.".CustomerId=SELLER_ID) AS SELLER, B_AMOUNT AS TRADE_PRICE, ".TRANSACTIONS_TABLE.".InsertDate, ".TRANSACTIONS_TABLE.".qty_traded AS TRADED_QTY
|
||||
FROM ".TRANSACTIONS_TABLE.", ".USERS_TABLE."
|
||||
WHERE `a_buyer`= :u_id OR `b_seller`= :u_id
|
||||
GROUP BY T_ID
|
||||
ORDER BY T_ID DESC
|
||||
@ -175,8 +179,8 @@ class Users {
|
||||
$messages = array();
|
||||
|
||||
$query = $this->db_connection->prepare("
|
||||
SELECT * FROM `messages` WHERE `username_key`= :uk
|
||||
ORDER BY order_id DESC
|
||||
SELECT * FROM ".MSG_TABLE." WHERE `username_key`= :uk
|
||||
ORDER BY datetime DESC
|
||||
LIMIT $start, $limit
|
||||
");
|
||||
$query->bindParam("uk", $user_id);
|
||||
@ -201,7 +205,7 @@ class Users {
|
||||
$u_id = (int) $u_id;
|
||||
|
||||
$query = $this->db_connection->prepare("
|
||||
UPDATE `customer` SET `is_active`= $act
|
||||
UPDATE ".USERS_TABLE." SET `is_active`= $act
|
||||
WHERE CustomerId = :u_id
|
||||
LIMIT 1
|
||||
");
|
||||
@ -214,5 +218,54 @@ class Users {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get_total_users_count() {
|
||||
if ($this->databaseConnection()) {
|
||||
$total_users = 0;
|
||||
$query = $this->db_connection->query("SELECT COUNT(*) AS TOTAL_COUNT FROM ".USERS_TABLE." WHERE `is_active`=1");
|
||||
if ($query->rowCount()) {
|
||||
$total_users = $query->fetchObject()->TOTAL_COUNT;
|
||||
}
|
||||
return (int) $total_users;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function time_now() {
|
||||
$n = new DateTime("now", new DateTimeZone("Asia/Kolkata"));
|
||||
$now = $n->format('Y-m-d H:i:s');
|
||||
return $now;
|
||||
}
|
||||
|
||||
public function get_username($customerId=0) {
|
||||
|
||||
if ($this->databaseConnection()) {
|
||||
$customerId = (int) $customerId;
|
||||
$query = $this->db_connection->prepare("SELECT Username FROM ".USERS_TABLE." WHERE customerId = :id LIMIT 1");
|
||||
$query->bindParam('id', $customerId);
|
||||
|
||||
$query->execute();
|
||||
$row_count = $query->rowCount();
|
||||
if ($row_count == 1) {
|
||||
return $query->fetchObject()->Username;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function input_user_email($email=null, $user_id=null) {
|
||||
if ($this->databaseConnection()) {
|
||||
$query = $this->db_connection->prepare("
|
||||
UPDATE ".USERS_TABLE." SET `Email`= :em WHERE CustomerId = :cid
|
||||
");
|
||||
$query->bindParam('em', $email);
|
||||
$query->bindParam('cid', $user_id);
|
||||
|
||||
if ($query->execute()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
1092
classes/class.smtp.php
Normal file
1092
classes/class.smtp.php
Normal file
File diff suppressed because it is too large
Load Diff
7
composer.json
Normal file
7
composer.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"require": {
|
||||
"facebook/php-sdk-v4": "^5.0",
|
||||
"slim/slim": "^3.0",
|
||||
"nesbot/carbon": "~1.21"
|
||||
}
|
||||
}
|
||||
549
composer.lock
generated
Normal file
549
composer.lock
generated
Normal file
@ -0,0 +1,549 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "40cfecfbf901d6e0cf22071e12538b1c",
|
||||
"content-hash": "2f47050126a7fb5ae8ebd8e0827de02d",
|
||||
"packages": [
|
||||
{
|
||||
"name": "container-interop/container-interop",
|
||||
"version": "1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/container-interop/container-interop.git",
|
||||
"reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8",
|
||||
"reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"psr/container": "^1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Interop\\Container\\": "src/Interop/Container/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
|
||||
"homepage": "https://github.com/container-interop/container-interop",
|
||||
"time": "2017-02-14 19:40:03"
|
||||
},
|
||||
{
|
||||
"name": "facebook/php-sdk-v4",
|
||||
"version": "5.6.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/php-graph-sdk.git",
|
||||
"reference": "2f9639c15ae043911f40ffe44080b32bac2c5280"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/facebook/php-graph-sdk/zipball/2f9639c15ae043911f40ffe44080b32bac2c5280",
|
||||
"reference": "2f9639c15ae043911f40ffe44080b32bac2c5280",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.4|^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"guzzlehttp/guzzle": "~5.0",
|
||||
"mockery/mockery": "~0.8",
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
"suggest": {
|
||||
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client",
|
||||
"paragonie/random_compat": "Provides a better CSPRNG option in PHP 5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "5.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Facebook\\": "src/Facebook/"
|
||||
},
|
||||
"files": [
|
||||
"src/Facebook/polyfills.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Facebook Platform"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Facebook",
|
||||
"homepage": "https://github.com/facebook/php-graph-sdk/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Facebook SDK for PHP",
|
||||
"homepage": "https://github.com/facebook/php-graph-sdk",
|
||||
"keywords": [
|
||||
"facebook",
|
||||
"sdk"
|
||||
],
|
||||
"abandoned": "facebook/graph-sdk",
|
||||
"time": "2017-08-16 17:28:07"
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "1.22.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/briannesbitt/Carbon.git",
|
||||
"reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
|
||||
"reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"symfony/translation": "~2.6 || ~3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "~2",
|
||||
"phpunit/phpunit": "~4.0 || ~5.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.23-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Carbon\\": "src/Carbon/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Brian Nesbitt",
|
||||
"email": "brian@nesbot.com",
|
||||
"homepage": "http://nesbot.com"
|
||||
}
|
||||
],
|
||||
"description": "A simple API extension for DateTime.",
|
||||
"homepage": "http://carbon.nesbot.com",
|
||||
"keywords": [
|
||||
"date",
|
||||
"datetime",
|
||||
"time"
|
||||
],
|
||||
"time": "2017-01-16 07:55:07"
|
||||
},
|
||||
{
|
||||
"name": "nikic/fast-route",
|
||||
"version": "v1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/FastRoute.git",
|
||||
"reference": "b5f95749071c82a8e0f58586987627054400cdf6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/FastRoute/zipball/b5f95749071c82a8e0f58586987627054400cdf6",
|
||||
"reference": "b5f95749071c82a8e0f58586987627054400cdf6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"FastRoute\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/functions.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nikita Popov",
|
||||
"email": "nikic@php.net"
|
||||
}
|
||||
],
|
||||
"description": "Fast request router for PHP",
|
||||
"keywords": [
|
||||
"router",
|
||||
"routing"
|
||||
],
|
||||
"time": "2017-01-19 11:35:12"
|
||||
},
|
||||
{
|
||||
"name": "pimple/pimple",
|
||||
"version": "v3.2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/silexphp/Pimple.git",
|
||||
"reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/silexphp/Pimple/zipball/4d45fb62d96418396ec58ba76e6f065bca16e10a",
|
||||
"reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"psr/container": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^3.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Pimple": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Pimple, a simple Dependency Injection Container",
|
||||
"homepage": "http://pimple.sensiolabs.org",
|
||||
"keywords": [
|
||||
"container",
|
||||
"dependency injection"
|
||||
],
|
||||
"time": "2017-07-23 07:32:15"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/container.git",
|
||||
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
|
||||
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Container\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common Container Interface (PHP FIG PSR-11)",
|
||||
"homepage": "https://github.com/php-fig/container",
|
||||
"keywords": [
|
||||
"PSR-11",
|
||||
"container",
|
||||
"container-interface",
|
||||
"container-interop",
|
||||
"psr"
|
||||
],
|
||||
"time": "2017-02-14 16:28:37"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/http-message.git",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Http\\Message\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for HTTP messages",
|
||||
"homepage": "https://github.com/php-fig/http-message",
|
||||
"keywords": [
|
||||
"http",
|
||||
"http-message",
|
||||
"psr",
|
||||
"psr-7",
|
||||
"request",
|
||||
"response"
|
||||
],
|
||||
"time": "2016-08-06 14:39:51"
|
||||
},
|
||||
{
|
||||
"name": "slim/slim",
|
||||
"version": "3.9.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/slimphp/Slim.git",
|
||||
"reference": "575a8b53a0a489447915029c69680156cd355304"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/slimphp/Slim/zipball/575a8b53a0a489447915029c69680156cd355304",
|
||||
"reference": "575a8b53a0a489447915029c69680156cd355304",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"container-interop/container-interop": "^1.2",
|
||||
"nikic/fast-route": "^1.0",
|
||||
"php": ">=5.5.0",
|
||||
"pimple/pimple": "^3.0",
|
||||
"psr/container": "^1.0",
|
||||
"psr/http-message": "^1.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-message-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0",
|
||||
"squizlabs/php_codesniffer": "^2.5"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Slim\\": "Slim"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Rob Allen",
|
||||
"email": "rob@akrabat.com",
|
||||
"homepage": "http://akrabat.com"
|
||||
},
|
||||
{
|
||||
"name": "Josh Lockhart",
|
||||
"email": "hello@joshlockhart.com",
|
||||
"homepage": "https://joshlockhart.com"
|
||||
},
|
||||
{
|
||||
"name": "Gabriel Manricks",
|
||||
"email": "gmanricks@me.com",
|
||||
"homepage": "http://gabrielmanricks.com"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Smith",
|
||||
"email": "a.smith@silentworks.co.uk",
|
||||
"homepage": "http://silentworks.co.uk"
|
||||
}
|
||||
],
|
||||
"description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs",
|
||||
"homepage": "https://slimframework.com",
|
||||
"keywords": [
|
||||
"api",
|
||||
"framework",
|
||||
"micro",
|
||||
"router"
|
||||
],
|
||||
"time": "2017-11-04 08:46:46"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
|
||||
"reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.6-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Mbstring\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for the Mbstring extension",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"mbstring",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2017-10-11 12:05:26"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
"version": "v3.3.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation.git",
|
||||
"reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/409bf229cd552bf7e3faa8ab7e3980b07672073f",
|
||||
"reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.5.9|>=7.0.8",
|
||||
"symfony/polyfill-mbstring": "~1.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/config": "<2.8",
|
||||
"symfony/yaml": "<3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~2.8|~3.0",
|
||||
"symfony/intl": "^2.8.18|^3.2.5",
|
||||
"symfony/yaml": "~3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "To use logging capability in translator",
|
||||
"symfony/config": "",
|
||||
"symfony/yaml": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Translation\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Translation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-10-02 06:42:24"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": []
|
||||
}
|
||||
138
css/custom.css
138
css/custom.css
@ -17,7 +17,7 @@ ul.msg-ul li {
|
||||
font-size: x-large;
|
||||
}
|
||||
.text--default {
|
||||
font-family: "Open Sans";
|
||||
font-family: 'Open Sans Condensed', sans-serif;
|
||||
font-weight: 300;
|
||||
font-size: 14px;
|
||||
color: #383838;
|
||||
@ -454,3 +454,139 @@ table.buy td {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.font-20 {
|
||||
font-size: 20px; !important;
|
||||
}
|
||||
|
||||
#login-modal .modal-dialog {
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
#login-modal input[type=text], input[type=password] {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#div-login-msg,
|
||||
#div-lost-msg,
|
||||
#div-register-msg {
|
||||
border: 1px solid #dadfe1;
|
||||
height: 30px;
|
||||
line-height: 28px;
|
||||
transition: all ease-in-out 500ms;
|
||||
}
|
||||
|
||||
#div-login-msg.success,
|
||||
#div-lost-msg.success,
|
||||
#div-register-msg.success {
|
||||
border: 1px solid #68c3a3;
|
||||
background-color: #c8f7c5;
|
||||
}
|
||||
|
||||
#div-login-msg.error,
|
||||
#div-lost-msg.error,
|
||||
#div-register-msg.error {
|
||||
border: 1px solid #eb575b;
|
||||
background-color: #ffcad1;
|
||||
}
|
||||
|
||||
#icon-login-msg,
|
||||
#icon-lost-msg,
|
||||
#icon-register-msg {
|
||||
width: 30px;
|
||||
float: left;
|
||||
line-height: 28px;
|
||||
text-align: center;
|
||||
background-color: #dadfe1;
|
||||
margin-right: 5px;
|
||||
transition: all ease-in-out 500ms;
|
||||
}
|
||||
|
||||
#icon-login-msg.success,
|
||||
#icon-lost-msg.success,
|
||||
#icon-register-msg.success {
|
||||
background-color: #68c3a3 !important;
|
||||
}
|
||||
|
||||
#icon-login-msg.error,
|
||||
#icon-lost-msg.error,
|
||||
#icon-register-msg.error {
|
||||
background-color: #eb575b !important;
|
||||
}
|
||||
|
||||
#img_logo {
|
||||
max-height: 100px;
|
||||
max-width: 100px;
|
||||
}
|
||||
|
||||
/* #########################################
|
||||
# override the bootstrap configs #
|
||||
######################################### */
|
||||
|
||||
.modal-backdrop.in {
|
||||
filter: alpha(opacity=50);
|
||||
opacity: .8;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background-color: #ececec;
|
||||
border: 1px solid #bdc3c7;
|
||||
border-radius: 0px;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
min-height: 16.43px;
|
||||
padding: 15px 15px 15px 15px;
|
||||
border-bottom: 0px;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
position: relative;
|
||||
padding: 5px 15px 5px 15px;
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
padding: 15px 15px 15px 15px;
|
||||
text-align: left;
|
||||
border-top: 0px;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
.btn:focus,
|
||||
.btn:active:focus,
|
||||
.btn.active:focus,
|
||||
.btn.focus,
|
||||
.btn:active.focus,
|
||||
.btn.active.focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.btn-lg, .btn-group-lg>.btn {
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
.btn-link {
|
||||
padding: 5px 10px 0px 0px;
|
||||
color: #95a5a6;
|
||||
}
|
||||
|
||||
.btn-link:hover, .btn-link:focus {
|
||||
color: #2c3e50;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.glyphicon {
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
@ -2,10 +2,11 @@
|
||||
if(!session_id()) {
|
||||
session_start();
|
||||
}
|
||||
require_once 'includes/imp_files.php';
|
||||
require_once 'vendor/autoload.php';
|
||||
$fb = new Facebook\Facebook([
|
||||
'app_id' => 'xxxxxxxxxxxxxxxxx',
|
||||
'app_secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
||||
'app_id' => APP_ID,
|
||||
'app_secret' => APP_SECRET,
|
||||
'default_graph_version' => 'v2.8',
|
||||
]);
|
||||
$helper = $fb->getRedirectLoginHelper();
|
||||
@ -83,5 +84,5 @@ if (isset($accessToken)) {
|
||||
|
||||
} else {
|
||||
// replace your website URL same as added in the developers.facebook.com/apps e.g. if you used http instead of https and you used non-www version or www version of your website then you must add the same here
|
||||
$loginUrl = $helper->getLoginUrl('http://something.com/fbconfig.php', $permissions);
|
||||
$loginUrl = $helper->getLoginUrl('http://yoursite.com/fbconfig.php', $permissions);
|
||||
}
|
||||
BIN
images/Thumbs.db
BIN
images/Thumbs.db
Binary file not shown.
BIN
images/bg.jpg
BIN
images/bg.jpg
Binary file not shown.
|
Before Width: | Height: | Size: 81 KiB |
BIN
images/pic02.jpg
BIN
images/pic02.jpg
Binary file not shown.
|
Before Width: | Height: | Size: 29 KiB |
BIN
images/pic04.jpg
BIN
images/pic04.jpg
Binary file not shown.
|
Before Width: | Height: | Size: 30 KiB |
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
require_once 'defines.php';
|
||||
require_once 'config.php';
|
||||
|
||||
function __autoload($class_name) {
|
||||
$class = explode("_", $class_name);
|
||||
$path = implode("/", $class).".php";
|
||||
|
||||
@ -4,8 +4,47 @@
|
||||
|
||||
/*Change these values according to your configurations*/
|
||||
|
||||
define("DB_HOST", "your-host");
|
||||
define("DB_NAME", "Your-DB-Name");
|
||||
define("DB_USER", "Your-User-Name");
|
||||
define("DB_PASS", "Your-Password");
|
||||
define("DB_HOST", "xxxxxxxxx");
|
||||
define("DB_NAME", "xxxxxxxxx");
|
||||
define("DB_USER", "xxxxxxxxx");
|
||||
define("DB_PASS", "xxxxxxxxx");
|
||||
define("MESSAGE_DATABASE_ERROR", "Failed to connect to database.");
|
||||
|
||||
define("EMAIL_USE_SMTP", true);
|
||||
define("EMAIL_SMTP_HOST", "xxxxxxxxxxxx");
|
||||
define("EMAIL_SMTP_AUTH", true);
|
||||
define("EMAIL_SMTP_USERNAME", "xxxxxxxxx");
|
||||
define("EMAIL_SMTP_PASSWORD", "xxxxxxxxx");
|
||||
define("EMAIL_SMTP_PORT", 587); //587
|
||||
define("EMAIL_SMTP_ENCRYPTION", "ssl");
|
||||
|
||||
define("RT", "xxxxxxxxx");
|
||||
define("RM", "xxxxxxxxx");
|
||||
define("PI", "xxxxxxxxx");
|
||||
define("AB", "xxxxxxxxx");
|
||||
define("RMGM", "xxxxxxxxx");
|
||||
define("FINANCE", "xxxxxxxxx");
|
||||
|
||||
define("EMAIL_SENDER_NAME", "Ranchi Mall");
|
||||
define("EMAIL_SUBJECT", "Ranchi Mall Fund Transfer Request.");
|
||||
define("EMAIL_SUBJECT_RTM_TRANSFER", "Ranchi Mall RMT Transfer Request.");
|
||||
define("EMAIL_SUBJECT_BTC_TO_CASH", "Ranchi Mall BTC To CASH exchange Request.");
|
||||
|
||||
define("TOP_BUYS_TABLE", "xxxxxxxxx");
|
||||
define("TOP_SELL_TABLE", "xxxxxxxxx");
|
||||
define("CREDITS_TABLE", "xxxxxxxxx");
|
||||
define("CREDITS_HISTORY_TABLE", "xxxxxxxxx");
|
||||
define("ACCOUNTS_TABLE", "xxxxxxxxx");
|
||||
define("USERS_TABLE", "xxxxxxxxx");
|
||||
define("TRANSFER_INFO_TABLE", "xxxxxxxxx");
|
||||
define("MSG_TABLE", "xxxxxxxxx");
|
||||
define("ORDERS_TABLE", "xxxxxxxxx");
|
||||
define("TRANSACTIONS_TABLE", "xxxxxxxxx");
|
||||
define("ADMIN_BAL_RECORDS", "xxxxxxxxx");
|
||||
|
||||
define("APP_ID", 'xxxxxxxxx');
|
||||
define("APP_SECRET", 'xxxxxxxxx');
|
||||
|
||||
define("ADMIN_FB_ID", "xxxxxxxxx");
|
||||
define("ADMIN_ID", "xxxxxxxxx");
|
||||
define("ADMIN_UNAME", "xxxxxxxxx");
|
||||
34
includes/dump.php
Normal file
34
includes/dump.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
include 'imp_files.php';
|
||||
|
||||
$DBUSER=DB_USER;
|
||||
$DBPASSWD=DB_PASS;
|
||||
$DATABASE= DB_NAME;
|
||||
|
||||
$dir = 'backups';
|
||||
|
||||
if (!file_exists($dir)) {
|
||||
mkdir($dir, 0777, true);
|
||||
}
|
||||
|
||||
$filename = $dir."/exchange_test_backup-" . date("d-m-Y-H-i-s") . ".sql.gz";
|
||||
$mime = "application/x-gzip";
|
||||
|
||||
//header( "Content-Type: " . $mime );
|
||||
//header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
|
||||
|
||||
$cmd = "mysqldump -u $DBUSER --password=$DBPASSWD $DATABASE | gzip > $filename";
|
||||
|
||||
passthru( $cmd );
|
||||
|
||||
// Send mail
|
||||
$reciever_email = [AB, RMGM];
|
||||
$email_from = RM;
|
||||
$email_sender = EMAIL_SENDER_NAME;
|
||||
$email_subject = "Backup-".date('Y-m-d H:i:s', time());
|
||||
$email_body ="Backup for Exchange Site. Date: ".date('Y-m-d H:i:s', time());
|
||||
$attachments = array($filename);
|
||||
$send_mail = $MailClass->do_email($reciever_email, $email_from, $email_sender, $email_subject, $email_body, $attachments);
|
||||
exit(0);
|
||||
?>
|
||||
@ -7,7 +7,8 @@
|
||||
*/
|
||||
|
||||
function two_decimal_digit($num=0, $deci=2) {
|
||||
$decimal = abs(number_format((float)$num, $deci, '.', ''));
|
||||
//$decimal = abs(number_format((float)$num, $deci, '.', ''));
|
||||
$decimal = (float)$num;
|
||||
return $decimal;
|
||||
}
|
||||
|
||||
@ -26,4 +27,68 @@ function checkLoginStatus() {
|
||||
function extract_int($string) {
|
||||
$int = intval(preg_replace('/[^0-9]+/', '', $string), 10);
|
||||
return $int;
|
||||
}
|
||||
|
||||
function bitcoin_price_today() {
|
||||
$bit_price = null;
|
||||
|
||||
try {
|
||||
$url = "https://bitpay.com/api/rates";
|
||||
|
||||
$json = file_get_contents($url);
|
||||
$data = json_decode($json, TRUE);
|
||||
|
||||
$rate = $data[1]["rate"];
|
||||
$usd_price = 1;
|
||||
$bit_price = round($rate/$usd_price , 8);
|
||||
} catch(Exception $e) {
|
||||
$bit_price = null;
|
||||
}
|
||||
|
||||
return (float) $bit_price;
|
||||
}
|
||||
|
||||
function bitcoin_calculator($usd=0) {
|
||||
$btc_usd_price = bitcoin_price_today();
|
||||
if (($usd > 0) && ($btc_usd_price > 0)) {
|
||||
return (float) $usd/$btc_usd_price;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function wapol_str($string) {
|
||||
if(preg_match('/[^a-z:\-0-9]/i', $string)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function sendReqtoURL($addr, $tokens) {
|
||||
|
||||
$url = 'http://ranchimall.net/test/test.php';
|
||||
$myvars = 'addr=' . $addr . '&tokens=' . $tokens;
|
||||
|
||||
$ch = curl_init( $url );
|
||||
curl_setopt( $ch, CURLOPT_POST, 1);
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
|
||||
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
$response = curl_exec( $ch );
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
return (int) $response;
|
||||
}
|
||||
|
||||
function is_email($email='') {
|
||||
$email = trim($email);
|
||||
if ($email != null) {
|
||||
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -6,11 +6,12 @@
|
||||
* Time: 7:49 PM
|
||||
*/
|
||||
|
||||
|
||||
if(!isset($_SESSION)) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
require_once 'defines.php';
|
||||
require_once 'config.php';
|
||||
include_once 'autoload.php';
|
||||
include_once 'functions.php';
|
||||
|
||||
@ -19,18 +20,28 @@ $fb_id = null;
|
||||
$user_name = null;
|
||||
$user_id = null;
|
||||
$log_fullName = null;
|
||||
$user_email = null;
|
||||
|
||||
if (checkLoginStatus()) {
|
||||
$fb_id = $_SESSION['fb_id'];
|
||||
$user_name = $_SESSION['user_name'];
|
||||
$user_id = $_SESSION['user_id'];
|
||||
$log_fullName = $_SESSION['full_name'];
|
||||
if (isset($_SESSION['fb_id'], $_SESSION['user_name'], $_SESSION['user_id'])) {
|
||||
$fb_id = $_SESSION['fb_id'];
|
||||
$user_name = $_SESSION['user_name'];
|
||||
$user_id = $_SESSION['user_id'];
|
||||
} else {
|
||||
redirect_to("logout.php");
|
||||
}
|
||||
$log_fullName = isset($_SESSION['full_name']) ? $_SESSION['full_name'] : '';
|
||||
$user_email = isset($_SESSION['email']) ? $_SESSION['email'] : '';
|
||||
}
|
||||
|
||||
$UserClass = null;
|
||||
$OrderClass = null;
|
||||
$ApiClass = null;
|
||||
$MailClass = null;
|
||||
|
||||
if (class_exists('Users') && class_exists('Orders')) {
|
||||
if (class_exists('Users') && class_exists('Orders') && class_exists('Api') && class_exists('SendMail')) {
|
||||
$UserClass = new Users();
|
||||
$OrderClass = new Orders();
|
||||
$ApiClass = new Api();
|
||||
$MailClass = new SendMail();
|
||||
}
|
||||
10
index.php
10
index.php
@ -1,10 +1,13 @@
|
||||
<?php
|
||||
//die('Site is currently under maintenance. We will return soon. Thanks for your patience.');
|
||||
ob_start();
|
||||
date_default_timezone_set('Asia/Kolkata'); ?>
|
||||
<?php $user_id = 0; ?>
|
||||
<!--Bootstrap-->
|
||||
<?php require_once 'views/header.php';?>
|
||||
<?php require_once "includes/imp_files.php";?>
|
||||
|
||||
<?php require_once 'views/header.php';?>
|
||||
<?php //echo $OrderClass->get_username(3);die; ?>
|
||||
<?php include_once 'acc_deact.php';?>
|
||||
|
||||
<!--Buy Sell div-->
|
||||
@ -22,5 +25,8 @@ date_default_timezone_set('Asia/Kolkata'); ?>
|
||||
<!--Messages-->
|
||||
<?php include_once 'views/user_messages.php'; ?>
|
||||
|
||||
<!--Transfers-->
|
||||
<?php include_once 'views/transfers.php';?>
|
||||
|
||||
<!--footer-->
|
||||
<?php include_once 'footer.php'; ?>
|
||||
<?php include_once 'footer.php'; ?>
|
||||
|
||||
@ -16,11 +16,11 @@
|
||||
<span style="font-size: 70px;">Woops! Page Not Found.</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<h4>Sorry! the page you were looking for does not exists. Press back to return or click <a href="http://maximumdemocracy.com">here</a>.</h4>
|
||||
<h4>Sorry! the page you were looking for does not exists. Press back to return or click <a href="http://ranchimall.net">here</a>.</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer style="text-align: center; position: fixed; bottom: 0; width: 100%;">© Maximum Democracy <?=date('Y');?></footer>
|
||||
<footer style="text-align: center; position: fixed; bottom: 0; width: 100%;">© Ranchi Mall <?=date('Y');?></footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
336
rm_root.php
Normal file
336
rm_root.php
Normal file
@ -0,0 +1,336 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Abhishek Kumar Sinha
|
||||
* Date: 10/9/2017
|
||||
* Time: 8:05 PM
|
||||
*/
|
||||
?>
|
||||
<?php ob_start(); date_default_timezone_set('Asia/Kolkata'); ?>
|
||||
<?php $user_id = 0; ?>
|
||||
<!--Bootstrap-->
|
||||
<?php require_once 'views/header.php';?>
|
||||
|
||||
<?php
|
||||
|
||||
require_once 'includes/imp_files.php';
|
||||
|
||||
if (!checkLoginStatus()) {
|
||||
redirect_to("index.php");
|
||||
}
|
||||
|
||||
if (isset($_SESSION['fb_id'], $_SESSION['user_id'], $_SESSION['user_name'])) {
|
||||
$root_fb = (int) $_SESSION['fb_id'];
|
||||
$root_user_id = (int) $_SESSION['user_id'];
|
||||
$root_user_name = (string) $_SESSION['user_name'];
|
||||
|
||||
/*This should match ajax/rm_root.php too*/
|
||||
if ($root_fb != ADMIN_ID && $root_user_id != ADMIN_ID && $root_user_name != ADMIN_UNAME) {
|
||||
redirect_to("index.php");
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
if (!empty($_POST['cus_id']) && $_POST['bal'] != null && !empty($_POST['bal_type'])) {
|
||||
$investor_id = (int) $_POST['cus_id'];
|
||||
$balance = (float) $_POST['bal'];
|
||||
$assetType = (string) $_POST['bal_type'];
|
||||
|
||||
if ($investor_id < 0 || is_float($investor_id)) {
|
||||
redirect_to("rm_root.php?msg=Invalid User Id!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($balance < 0) {
|
||||
redirect_to("rm_root.php?msg=Balance must be positive number!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isset($OrderClass, $UserClass)) {
|
||||
redirect_to("rm_root.php?msg=System Error!");
|
||||
return false;
|
||||
}
|
||||
|
||||
$validate_user = $UserClass->check_user($investor_id);
|
||||
|
||||
|
||||
if($validate_user == "" || empty($validate_user)) {
|
||||
redirect_to("rm_root.php?msg=Invalid User!");
|
||||
return false;
|
||||
}
|
||||
|
||||
$update_bal = null;
|
||||
|
||||
if ($assetType == "RMT") {
|
||||
|
||||
$assetType = "btc";
|
||||
|
||||
} elseif ($assetType == "Cash") {
|
||||
|
||||
$assetType = "traditional";
|
||||
|
||||
} else {
|
||||
redirect_to("rm_root.php?msg=Invalid balance type!");
|
||||
return false;
|
||||
}
|
||||
|
||||
//Prev balance of user
|
||||
$bal_prev = (float) $OrderClass->check_customer_balance($assetType, $investor_id)->Balance;
|
||||
|
||||
$update_bal = $OrderClass->update_user_balance($assetType, $balance, $investor_id);
|
||||
|
||||
if (!$update_bal) {
|
||||
redirect_to("rm_root.php?msg=Failed to update balance!");
|
||||
return false;
|
||||
} else if($update_bal) {
|
||||
// Record this change
|
||||
$OrderClass->record_root_bal_update($investor_id, $bal_prev, $balance, $assetType);
|
||||
redirect_to("rm_root.php?msg=Successfully updated balance!&type=info");
|
||||
} else {
|
||||
redirect_to("rm_root.php?msg= Something went wrong. Failed to update balance!");
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
redirect_to("rm_root.php?msg= Please fill all fields!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$traders = $OrderClass->UserBalanceList(1);
|
||||
|
||||
?>
|
||||
|
||||
<div class="container mt--2">
|
||||
|
||||
<div class="mt--2 mb--2 p--1">
|
||||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
|
||||
<div class="form-group">
|
||||
<label class="sr-only" for="cus_id">User Id</label>
|
||||
<input type="number" class="form-control" name="cus_id" id="cus_id" placeholder="User Id">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="sr-only" for="bal">Input Balance</label>
|
||||
<input type="text" class="form-control" name="bal" id="bal" placeholder="Input Balance">
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="bal_type" id="rmt" value="RMT">
|
||||
RMT
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="bal_type" id="cash" value="Cash">
|
||||
Cash
|
||||
</label>
|
||||
</div>
|
||||
<input type="submit" class="btn-sm mt--1" value="Update balance">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<input type="text" id="search_traders" onkeyup="search_traders()" placeholder="Search for names..">
|
||||
|
||||
<div class="table-responsive" id="traders_table">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>User</th>
|
||||
<th>RMT</th>
|
||||
<th>Cash</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$action_class = null;
|
||||
$btn_name = null;
|
||||
if (is_array($traders) && !empty($traders)) {
|
||||
foreach ($traders as $index=>$trader) {
|
||||
if ($trader->is_active) {
|
||||
$action_class = 'off';
|
||||
$btn_name = "Deactivate Account";
|
||||
} else {
|
||||
$action_class = 'on';
|
||||
$btn_name = "Activate Account";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?=$trader->UID?></td>
|
||||
<td><a href="http://facebook.com/<?=$trader->FACEBOOK_ID?>" target="_blank"><?=$trader->Name?></a></td>
|
||||
<td><?=$trader->BTC?></td>
|
||||
<td><?=$trader->CASH?></td>
|
||||
<td><input type="button" class="btn-ra" id="<?=$action_class.'_'.$trader->UID?>" value="<?=$btn_name?>"></td>
|
||||
</tr>
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container mt--2">
|
||||
<div class="table-responsive">
|
||||
<div class="table-responsive">
|
||||
<?php $list_bal_changes = $OrderClass->list_root_bal_changes(); ?>
|
||||
<h2>Update History</h2>
|
||||
<input type="text" id="audit_input" onkeyup="search_audit_table()" placeholder="Search for names or id..">
|
||||
<table class="table" id="audit_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>S.No</th>
|
||||
<th>Investor's Id</th>
|
||||
<th>Name</th>
|
||||
<th>Email</th>
|
||||
<th>Previous Balance</th>
|
||||
<th>Updated Balance</th>
|
||||
<th>Type</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($list_bal_changes as $ch):
|
||||
|
||||
$money_type = 'Invalid';
|
||||
if($ch->type == 'btc') {
|
||||
$money_type = 'Token';
|
||||
} else if($ch->type == 'traditional') {
|
||||
$money_type = 'Fiat';
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?=$ch->BalStatusHistoryId?></td>
|
||||
<td><?=$ch->user_id?></td>
|
||||
<td><?=$ch->Name?></td>
|
||||
<td><?=$ch->Email?></td>
|
||||
<td><?=$ch->bal_prev?></td>
|
||||
<td><?=$ch->bal_now?></td>
|
||||
<td><?=$money_type?></td>
|
||||
<td><?=$ch->UpdateDate?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!--footer-->
|
||||
<?php include_once 'footer.php'; ?>
|
||||
|
||||
<script>
|
||||
$(document).on('click', '.btn-ra', function (e) {
|
||||
e.preventDefault();
|
||||
var btn = $(this);
|
||||
var btn_id = $(this).attr('id');
|
||||
var btn_val = parseInt(btn_id.replace ( /[^\d.]/g, '' ));
|
||||
$.ajax({
|
||||
method:'post',
|
||||
url:'ajax/rm_root.php',
|
||||
data: { task : 'act_user', btn_id:btn_id}
|
||||
}).error(function(xhr, status, error) {
|
||||
console.log(error);
|
||||
}).success(function(data) {
|
||||
data = $.trim(data);
|
||||
if ($.trim(data) != '' && $.trim(data) != undefined && $.trim(data) != null) {
|
||||
if (data == 'on') {
|
||||
btn.attr("id", 'off_'+btn_val);
|
||||
btn.prop("value", "Deactivate Account");
|
||||
$.notify({
|
||||
title: "<strong>Success!:</strong> ",
|
||||
message: "User activated successfully."
|
||||
},{
|
||||
type: 'info'
|
||||
});
|
||||
} else if (data == 'off') {
|
||||
btn.attr("id", 'on_'+btn_val);
|
||||
btn.prop("value", "Activate Account");
|
||||
$.notify({
|
||||
title: "<strong>Success!:</strong> ",
|
||||
message: "User de-activated successfully."
|
||||
},{
|
||||
type: 'info'
|
||||
});
|
||||
} else {
|
||||
$.notify({
|
||||
title: "<strong>Process Failed!:</strong> ",
|
||||
message: "Process could not be completed."
|
||||
},{
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
displayNotice("Process could not be completed. Try again later.", "failure");
|
||||
}
|
||||
run_all();
|
||||
});
|
||||
});
|
||||
|
||||
function search_traders() {
|
||||
// Declare variables
|
||||
var input, filter, table, tr, td, i;
|
||||
input = document.getElementById("search_traders");
|
||||
filter = input.value.toUpperCase();
|
||||
table = document.getElementById("traders_table");
|
||||
tr = table.getElementsByTagName("tr");
|
||||
|
||||
// Loop through all table rows, and hide those who don't match the search query
|
||||
for (i = 0; i < tr.length; i++) {
|
||||
td = tr[i].getElementsByTagName("td")[1];
|
||||
|
||||
if (td) {
|
||||
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
|
||||
tr[i].style.display = "";
|
||||
} else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Audit table
|
||||
function search_audit_table() {
|
||||
var input, filter, table, tr, td, i;
|
||||
input = document.getElementById("audit_input");
|
||||
filter = input.value.toUpperCase();
|
||||
table = document.getElementById("audit_table");
|
||||
tr = table.getElementsByTagName("tr");
|
||||
|
||||
// Loop through all table rows, and hide those who don't match the search query
|
||||
if(!isNaN(filter)) {
|
||||
for (i = 0; i < tr.length; i++) {
|
||||
tdi = tr[i].getElementsByTagName("td")[1];
|
||||
|
||||
if (tdi) {
|
||||
//filter = input.value;
|
||||
if (tdi.innerHTML.indexOf(filter) > -1) {
|
||||
tr[i].style.display = "";
|
||||
} else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < tr.length; i++) {
|
||||
td = tr[i].getElementsByTagName("td")[2];
|
||||
if (td) {
|
||||
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
|
||||
tr[i].style.display = "";
|
||||
} else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
2
vendor/composer/autoload_files.php
vendored
2
vendor/composer/autoload_files.php
vendored
@ -6,5 +6,7 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
'253c157292f75eb38082b5acb06f3f01' => $vendorDir . '/nikic/fast-route/src/functions.php',
|
||||
'7e702cccdb9dd904f2ccf22e5f37abae' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/polyfills.php',
|
||||
);
|
||||
|
||||
1
vendor/composer/autoload_namespaces.php
vendored
1
vendor/composer/autoload_namespaces.php
vendored
@ -6,4 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Pimple' => array($vendorDir . '/pimple/pimple/src'),
|
||||
);
|
||||
|
||||
8
vendor/composer/autoload_psr4.php
vendored
8
vendor/composer/autoload_psr4.php
vendored
@ -6,5 +6,13 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
|
||||
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
|
||||
'Slim\\' => array($vendorDir . '/slim/slim/Slim'),
|
||||
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
|
||||
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
|
||||
'Interop\\Container\\' => array($vendorDir . '/container-interop/container-interop/src/Interop/Container'),
|
||||
'FastRoute\\' => array($vendorDir . '/nikic/fast-route/src'),
|
||||
'Facebook\\' => array($vendorDir . '/facebook/php-sdk-v4/src/Facebook'),
|
||||
'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'),
|
||||
);
|
||||
|
||||
65
vendor/composer/autoload_static.php
vendored
65
vendor/composer/autoload_static.php
vendored
@ -7,21 +7,85 @@ namespace Composer\Autoload;
|
||||
class ComposerStaticInita3842dcc011a3ab8bc308ff3c524501a
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
'253c157292f75eb38082b5acb06f3f01' => __DIR__ . '/..' . '/nikic/fast-route/src/functions.php',
|
||||
'7e702cccdb9dd904f2ccf22e5f37abae' => __DIR__ . '/..' . '/facebook/php-sdk-v4/src/Facebook/polyfills.php',
|
||||
);
|
||||
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'S' =>
|
||||
array (
|
||||
'Symfony\\Polyfill\\Mbstring\\' => 26,
|
||||
'Symfony\\Component\\Translation\\' => 30,
|
||||
'Slim\\' => 5,
|
||||
),
|
||||
'P' =>
|
||||
array (
|
||||
'Psr\\Http\\Message\\' => 17,
|
||||
'Psr\\Container\\' => 14,
|
||||
),
|
||||
'I' =>
|
||||
array (
|
||||
'Interop\\Container\\' => 18,
|
||||
),
|
||||
'F' =>
|
||||
array (
|
||||
'FastRoute\\' => 10,
|
||||
'Facebook\\' => 9,
|
||||
),
|
||||
'C' =>
|
||||
array (
|
||||
'Carbon\\' => 7,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'Symfony\\Polyfill\\Mbstring\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
|
||||
),
|
||||
'Symfony\\Component\\Translation\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/translation',
|
||||
),
|
||||
'Slim\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/slim/slim/Slim',
|
||||
),
|
||||
'Psr\\Http\\Message\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/psr/http-message/src',
|
||||
),
|
||||
'Psr\\Container\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/psr/container/src',
|
||||
),
|
||||
'Interop\\Container\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/container-interop/container-interop/src/Interop/Container',
|
||||
),
|
||||
'FastRoute\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/nikic/fast-route/src',
|
||||
),
|
||||
'Facebook\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/facebook/php-sdk-v4/src/Facebook',
|
||||
),
|
||||
'Carbon\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon',
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixesPsr0 = array (
|
||||
'P' =>
|
||||
array (
|
||||
'Pimple' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/pimple/pimple/src',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
@ -29,6 +93,7 @@ class ComposerStaticInita3842dcc011a3ab8bc308ff3c524501a
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInita3842dcc011a3ab8bc308ff3c524501a::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInita3842dcc011a3ab8bc308ff3c524501a::$prefixDirsPsr4;
|
||||
$loader->prefixesPsr0 = ComposerStaticInita3842dcc011a3ab8bc308ff3c524501a::$prefixesPsr0;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
||||
512
vendor/composer/installed.json
vendored
512
vendor/composer/installed.json
vendored
@ -1,17 +1,506 @@
|
||||
[
|
||||
{
|
||||
"name": "facebook/php-sdk-v4",
|
||||
"version": "5.3.1",
|
||||
"version_normalized": "5.3.1.0",
|
||||
"name": "psr/container",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/php-graph-sdk.git",
|
||||
"reference": "7ed1ecdae6a5b2f8b8f60e132d06594b39b16fb1"
|
||||
"url": "https://github.com/php-fig/container.git",
|
||||
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/facebook/php-graph-sdk/zipball/7ed1ecdae6a5b2f8b8f60e132d06594b39b16fb1",
|
||||
"reference": "7ed1ecdae6a5b2f8b8f60e132d06594b39b16fb1",
|
||||
"url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
|
||||
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"time": "2017-02-14 16:28:37",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Container\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common Container Interface (PHP FIG PSR-11)",
|
||||
"homepage": "https://github.com/php-fig/container",
|
||||
"keywords": [
|
||||
"PSR-11",
|
||||
"container",
|
||||
"container-interface",
|
||||
"container-interop",
|
||||
"psr"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "container-interop/container-interop",
|
||||
"version": "1.2.0",
|
||||
"version_normalized": "1.2.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/container-interop/container-interop.git",
|
||||
"reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8",
|
||||
"reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"psr/container": "^1.0"
|
||||
},
|
||||
"time": "2017-02-14 19:40:03",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Interop\\Container\\": "src/Interop/Container/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
|
||||
"homepage": "https://github.com/container-interop/container-interop"
|
||||
},
|
||||
{
|
||||
"name": "nikic/fast-route",
|
||||
"version": "v1.2.0",
|
||||
"version_normalized": "1.2.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/FastRoute.git",
|
||||
"reference": "b5f95749071c82a8e0f58586987627054400cdf6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/FastRoute/zipball/b5f95749071c82a8e0f58586987627054400cdf6",
|
||||
"reference": "b5f95749071c82a8e0f58586987627054400cdf6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"time": "2017-01-19 11:35:12",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"FastRoute\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/functions.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nikita Popov",
|
||||
"email": "nikic@php.net"
|
||||
}
|
||||
],
|
||||
"description": "Fast request router for PHP",
|
||||
"keywords": [
|
||||
"router",
|
||||
"routing"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
"version": "1.0.1",
|
||||
"version_normalized": "1.0.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/http-message.git",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"time": "2016-08-06 14:39:51",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Http\\Message\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for HTTP messages",
|
||||
"homepage": "https://github.com/php-fig/http-message",
|
||||
"keywords": [
|
||||
"http",
|
||||
"http-message",
|
||||
"psr",
|
||||
"psr-7",
|
||||
"request",
|
||||
"response"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "pimple/pimple",
|
||||
"version": "v3.2.2",
|
||||
"version_normalized": "3.2.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/silexphp/Pimple.git",
|
||||
"reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/silexphp/Pimple/zipball/4d45fb62d96418396ec58ba76e6f065bca16e10a",
|
||||
"reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"psr/container": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^3.2"
|
||||
},
|
||||
"time": "2017-07-23 07:32:15",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.2.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Pimple": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Pimple, a simple Dependency Injection Container",
|
||||
"homepage": "http://pimple.sensiolabs.org",
|
||||
"keywords": [
|
||||
"container",
|
||||
"dependency injection"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "slim/slim",
|
||||
"version": "3.9.0",
|
||||
"version_normalized": "3.9.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/slimphp/Slim.git",
|
||||
"reference": "575a8b53a0a489447915029c69680156cd355304"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/slimphp/Slim/zipball/575a8b53a0a489447915029c69680156cd355304",
|
||||
"reference": "575a8b53a0a489447915029c69680156cd355304",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"container-interop/container-interop": "^1.2",
|
||||
"nikic/fast-route": "^1.0",
|
||||
"php": ">=5.5.0",
|
||||
"pimple/pimple": "^3.0",
|
||||
"psr/container": "^1.0",
|
||||
"psr/http-message": "^1.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-message-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0",
|
||||
"squizlabs/php_codesniffer": "^2.5"
|
||||
},
|
||||
"time": "2017-11-04 08:46:46",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Slim\\": "Slim"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Rob Allen",
|
||||
"email": "rob@akrabat.com",
|
||||
"homepage": "http://akrabat.com"
|
||||
},
|
||||
{
|
||||
"name": "Josh Lockhart",
|
||||
"email": "hello@joshlockhart.com",
|
||||
"homepage": "https://joshlockhart.com"
|
||||
},
|
||||
{
|
||||
"name": "Gabriel Manricks",
|
||||
"email": "gmanricks@me.com",
|
||||
"homepage": "http://gabrielmanricks.com"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Smith",
|
||||
"email": "a.smith@silentworks.co.uk",
|
||||
"homepage": "http://silentworks.co.uk"
|
||||
}
|
||||
],
|
||||
"description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs",
|
||||
"homepage": "https://slimframework.com",
|
||||
"keywords": [
|
||||
"api",
|
||||
"framework",
|
||||
"micro",
|
||||
"router"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.6.0",
|
||||
"version_normalized": "1.6.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
|
||||
"reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "For best performance"
|
||||
},
|
||||
"time": "2017-10-11 12:05:26",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.6-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Mbstring\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for the Mbstring extension",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"mbstring",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
"version": "v3.3.10",
|
||||
"version_normalized": "3.3.10.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation.git",
|
||||
"reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/409bf229cd552bf7e3faa8ab7e3980b07672073f",
|
||||
"reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.5.9|>=7.0.8",
|
||||
"symfony/polyfill-mbstring": "~1.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/config": "<2.8",
|
||||
"symfony/yaml": "<3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~2.8|~3.0",
|
||||
"symfony/intl": "^2.8.18|^3.2.5",
|
||||
"symfony/yaml": "~3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "To use logging capability in translator",
|
||||
"symfony/config": "",
|
||||
"symfony/yaml": ""
|
||||
},
|
||||
"time": "2017-10-02 06:42:24",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.3-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Translation\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Translation Component",
|
||||
"homepage": "https://symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "1.22.1",
|
||||
"version_normalized": "1.22.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/briannesbitt/Carbon.git",
|
||||
"reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
|
||||
"reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"symfony/translation": "~2.6 || ~3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "~2",
|
||||
"phpunit/phpunit": "~4.0 || ~5.0"
|
||||
},
|
||||
"time": "2017-01-16 07:55:07",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.23-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Carbon\\": "src/Carbon/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Brian Nesbitt",
|
||||
"email": "brian@nesbot.com",
|
||||
"homepage": "http://nesbot.com"
|
||||
}
|
||||
],
|
||||
"description": "A simple API extension for DateTime.",
|
||||
"homepage": "http://carbon.nesbot.com",
|
||||
"keywords": [
|
||||
"date",
|
||||
"datetime",
|
||||
"time"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "facebook/php-sdk-v4",
|
||||
"version": "5.6.1",
|
||||
"version_normalized": "5.6.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/php-graph-sdk.git",
|
||||
"reference": "2f9639c15ae043911f40ffe44080b32bac2c5280"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/facebook/php-graph-sdk/zipball/2f9639c15ae043911f40ffe44080b32bac2c5280",
|
||||
"reference": "2f9639c15ae043911f40ffe44080b32bac2c5280",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -23,9 +512,10 @@
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
"suggest": {
|
||||
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
|
||||
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client",
|
||||
"paragonie/random_compat": "Provides a better CSPRNG option in PHP 5"
|
||||
},
|
||||
"time": "2016-08-09 11:32:26",
|
||||
"time": "2017-08-16 17:28:07",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
@ -48,11 +538,11 @@
|
||||
"authors": [
|
||||
{
|
||||
"name": "Facebook",
|
||||
"homepage": "https://github.com/facebook/facebook-php-sdk-v4/contributors"
|
||||
"homepage": "https://github.com/facebook/php-graph-sdk/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Facebook SDK for PHP",
|
||||
"homepage": "https://github.com/facebook/facebook-php-sdk-v4",
|
||||
"homepage": "https://github.com/facebook/php-graph-sdk",
|
||||
"keywords": [
|
||||
"facebook",
|
||||
"sdk"
|
||||
|
||||
3
vendor/container-interop/container-interop/.gitignore
vendored
Normal file
3
vendor/container-interop/container-interop/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
composer.lock
|
||||
composer.phar
|
||||
/vendor/
|
||||
20
vendor/container-interop/container-interop/LICENSE
vendored
Normal file
20
vendor/container-interop/container-interop/LICENSE
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 container-interop
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
148
vendor/container-interop/container-interop/README.md
vendored
Normal file
148
vendor/container-interop/container-interop/README.md
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
# Container Interoperability
|
||||
|
||||
[](https://packagist.org/packages/container-interop/container-interop)
|
||||
[](https://packagist.org/packages/container-interop/container-interop)
|
||||
|
||||
## Deprecation warning!
|
||||
|
||||
Starting Feb. 13th 2017, container-interop is officially deprecated in favor of [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md).
|
||||
Container-interop has been the test-bed of PSR-11. From v1.2, container-interop directly extends PSR-11 interfaces.
|
||||
Therefore, all containers implementing container-interop are now *de-facto* compatible with PSR-11.
|
||||
|
||||
- Projects implementing container-interop interfaces are encouraged to directly implement PSR-11 interfaces instead.
|
||||
- Projects consuming container-interop interfaces are very strongly encouraged to directly type-hint on PSR-11 interfaces, in order to be compatible with PSR-11 containers that are not compatible with container-interop.
|
||||
|
||||
Regarding the delegate lookup feature, that is present in container-interop and not in PSR-11, the feature is actually a design pattern. It is therefore not deprecated. Documentation regarding this design pattern will be migrated from this repository into a separate website in the future.
|
||||
|
||||
## About
|
||||
|
||||
*container-interop* tries to identify and standardize features in *container* objects (service locators,
|
||||
dependency injection containers, etc.) to achieve interoperability.
|
||||
|
||||
Through discussions and trials, we try to create a standard, made of common interfaces but also recommendations.
|
||||
|
||||
If PHP projects that provide container implementations begin to adopt these common standards, then PHP
|
||||
applications and projects that use containers can depend on the common interfaces instead of specific
|
||||
implementations. This facilitates a high-level of interoperability and flexibility that allows users to consume
|
||||
*any* container implementation that can be adapted to these interfaces.
|
||||
|
||||
The work done in this project is not officially endorsed by the [PHP-FIG](http://www.php-fig.org/), but it is being
|
||||
worked on by members of PHP-FIG and other good developers. We adhere to the spirit and ideals of PHP-FIG, and hope
|
||||
this project will pave the way for one or more future PSRs.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
You can install this package through Composer:
|
||||
|
||||
```json
|
||||
composer require container-interop/container-interop
|
||||
```
|
||||
|
||||
The packages adheres to the [SemVer](http://semver.org/) specification, and there will be full backward compatibility
|
||||
between minor versions.
|
||||
|
||||
## Standards
|
||||
|
||||
### Available
|
||||
|
||||
- [`ContainerInterface`](src/Interop/Container/ContainerInterface.php).
|
||||
[Description](docs/ContainerInterface.md) [Meta Document](docs/ContainerInterface-meta.md).
|
||||
Describes the interface of a container that exposes methods to read its entries.
|
||||
- [*Delegate lookup feature*](docs/Delegate-lookup.md).
|
||||
[Meta Document](docs/Delegate-lookup-meta.md).
|
||||
Describes the ability for a container to delegate the lookup of its dependencies to a third-party container. This
|
||||
feature lets several containers work together in a single application.
|
||||
|
||||
### Proposed
|
||||
|
||||
View open [request for comments](https://github.com/container-interop/container-interop/labels/RFC)
|
||||
|
||||
## Compatible projects
|
||||
|
||||
### Projects implementing `ContainerInterface`
|
||||
|
||||
- [Acclimate](https://github.com/jeremeamia/acclimate-container): Adapters for
|
||||
Aura.Di, Laravel, Nette DI, Pimple, Symfony DI, ZF2 Service manager, ZF2
|
||||
Dependency injection and any container using `ArrayAccess`
|
||||
- [Aura.Di](https://github.com/auraphp/Aura.Di)
|
||||
- [auryn-container-interop](https://github.com/elazar/auryn-container-interop)
|
||||
- [Burlap](https://github.com/codeeverything/burlap)
|
||||
- [Chernozem](https://github.com/pyrsmk/Chernozem)
|
||||
- [Data Manager](https://github.com/chrismichaels84/data-manager)
|
||||
- [Disco](https://github.com/bitexpert/disco)
|
||||
- [InDI](https://github.com/idealogica/indi)
|
||||
- [League/Container](http://container.thephpleague.com/)
|
||||
- [Mouf](http://mouf-php.com)
|
||||
- [Njasm Container](https://github.com/njasm/container)
|
||||
- [PHP-DI](http://php-di.org)
|
||||
- [Picotainer](https://github.com/thecodingmachine/picotainer)
|
||||
- [PimpleInterop](https://github.com/moufmouf/pimple-interop)
|
||||
- [Pimple3-ContainerInterop](https://github.com/Sam-Burns/pimple3-containerinterop) (using Pimple v3)
|
||||
- [SitePoint Container](https://github.com/sitepoint/Container)
|
||||
- [Thruster Container](https://github.com/ThrusterIO/container) (PHP7 only)
|
||||
- [Ultra-Lite Container](https://github.com/ultra-lite/container)
|
||||
- [Unbox](https://github.com/mindplay-dk/unbox)
|
||||
- [XStatic](https://github.com/jeremeamia/xstatic)
|
||||
- [Zend\ServiceManager](https://github.com/zendframework/zend-servicemanager)
|
||||
- [Zit](https://github.com/inxilpro/Zit)
|
||||
|
||||
### Projects implementing the *delegate lookup* feature
|
||||
|
||||
- [Aura.Di](https://github.com/auraphp/Aura.Di)
|
||||
- [Burlap](https://github.com/codeeverything/burlap)
|
||||
- [Chernozem](https://github.com/pyrsmk/Chernozem)
|
||||
- [InDI](https://github.com/idealogica/indi)
|
||||
- [League/Container](http://container.thephpleague.com/)
|
||||
- [Mouf](http://mouf-php.com)
|
||||
- [Picotainer](https://github.com/thecodingmachine/picotainer)
|
||||
- [PHP-DI](http://php-di.org)
|
||||
- [PimpleInterop](https://github.com/moufmouf/pimple-interop)
|
||||
- [Ultra-Lite Container](https://github.com/ultra-lite/container)
|
||||
|
||||
### Middlewares implementing `ContainerInterface`
|
||||
|
||||
- [Alias-Container](https://github.com/thecodingmachine/alias-container): add
|
||||
aliases support to any container
|
||||
- [Prefixer-Container](https://github.com/thecodingmachine/prefixer-container):
|
||||
dynamically prefix identifiers
|
||||
- [Lazy-Container](https://github.com/snapshotpl/lazy-container): lazy services
|
||||
|
||||
### Projects using `ContainerInterface`
|
||||
|
||||
The list below contains only a sample of all the projects consuming `ContainerInterface`. For a more complete list have a look [here](http://packanalyst.com/class?q=Interop%5CContainer%5CContainerInterface).
|
||||
|
||||
| | Downloads |
|
||||
| --- | --- |
|
||||
| [Adroit](https://github.com/bitexpert/adroit) |  |
|
||||
| [Behat](https://github.com/Behat/Behat/pull/974) |  |
|
||||
| [blast-facades](https://github.com/phpthinktank/blast-facades): Minimize complexity and represent dependencies as facades. |  |
|
||||
| [interop.silex.di](https://github.com/thecodingmachine/interop.silex.di): an extension to [Silex](http://silex.sensiolabs.org/) that adds support for any *container-interop* compatible container |  |
|
||||
| [mindplay/walkway](https://github.com/mindplay-dk/walkway): a modular request router |  |
|
||||
| [mindplay/middleman](https://github.com/mindplay-dk/middleman): minimalist PSR-7 middleware dispatcher |  |
|
||||
| [PHP-DI/Invoker](https://github.com/PHP-DI/Invoker): extensible and configurable invoker/dispatcher |  |
|
||||
| [Prophiler](https://github.com/fabfuel/prophiler) |  |
|
||||
| [Silly](https://github.com/mnapoli/silly): CLI micro-framework |  |
|
||||
| [Slim v3](https://github.com/slimphp/Slim) |  |
|
||||
| [Splash](http://mouf-php.com/packages/mouf/mvc.splash-common/version/8.0-dev/README.md) |  |
|
||||
| [Woohoo Labs. Harmony](https://github.com/woohoolabs/harmony): a flexible micro-framework |  |
|
||||
| [zend-expressive](https://github.com/zendframework/zend-expressive) |  |
|
||||
|
||||
|
||||
## Workflow
|
||||
|
||||
Everyone is welcome to join and contribute.
|
||||
|
||||
The general workflow looks like this:
|
||||
|
||||
1. Someone opens a discussion (GitHub issue) to suggest an interface
|
||||
1. Feedback is gathered
|
||||
1. The interface is added to a development branch
|
||||
1. We release alpha versions so that the interface can be experimented with
|
||||
1. Discussions and edits ensue until the interface is deemed stable by a general consensus
|
||||
1. A new minor version of the package is released
|
||||
|
||||
We try to not break BC by creating new interfaces instead of editing existing ones.
|
||||
|
||||
While we currently work on interfaces, we are open to anything that might help towards interoperability, may that
|
||||
be code, best practices, etc.
|
||||
15
vendor/container-interop/container-interop/composer.json
vendored
Normal file
15
vendor/container-interop/container-interop/composer.json
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "container-interop/container-interop",
|
||||
"type": "library",
|
||||
"description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
|
||||
"homepage": "https://github.com/container-interop/container-interop",
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Interop\\Container\\": "src/Interop/Container/"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"psr/container": "^1.0"
|
||||
}
|
||||
}
|
||||
114
vendor/container-interop/container-interop/docs/ContainerInterface-meta.md
vendored
Normal file
114
vendor/container-interop/container-interop/docs/ContainerInterface-meta.md
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
# ContainerInterface Meta Document
|
||||
|
||||
## Introduction
|
||||
|
||||
This document describes the process and discussions that lead to the `ContainerInterface`.
|
||||
Its goal is to explain the reasons behind each decision.
|
||||
|
||||
## Goal
|
||||
|
||||
The goal set by `ContainerInterface` is to standardize how frameworks and libraries make use of a
|
||||
container to obtain objects and parameters.
|
||||
|
||||
By standardizing such a behavior, frameworks and libraries using the `ContainerInterface`
|
||||
could work with any compatible container.
|
||||
That would allow end users to choose their own container based on their own preferences.
|
||||
|
||||
It is important to distinguish the two usages of a container:
|
||||
|
||||
- configuring entries
|
||||
- fetching entries
|
||||
|
||||
Most of the time, those two sides are not used by the same party.
|
||||
While it is often end users who tend to configure entries, it is generally the framework that fetch
|
||||
entries to build the application.
|
||||
|
||||
This is why this interface focuses only on how entries can be fetched from a container.
|
||||
|
||||
## Interface name
|
||||
|
||||
The interface name has been thoroughly discussed and was decided by a vote.
|
||||
|
||||
The list of options considered with their respective votes are:
|
||||
|
||||
- `ContainerInterface`: +8
|
||||
- `ProviderInterface`: +2
|
||||
- `LocatorInterface`: 0
|
||||
- `ReadableContainerInterface`: -5
|
||||
- `ServiceLocatorInterface`: -6
|
||||
- `ObjectFactory`: -6
|
||||
- `ObjectStore`: -8
|
||||
- `ConsumerInterface`: -9
|
||||
|
||||
[Full results of the vote](https://github.com/container-interop/container-interop/wiki/%231-interface-name:-Vote)
|
||||
|
||||
The complete discussion can be read in [the issue #1](https://github.com/container-interop/container-interop/issues/1).
|
||||
|
||||
## Interface methods
|
||||
|
||||
The choice of which methods the interface would contain was made after a statistical analysis of existing containers.
|
||||
The results of this analysis are available [in this document](https://gist.github.com/mnapoli/6159681).
|
||||
|
||||
The summary of the analysis showed that:
|
||||
|
||||
- all containers offer a method to get an entry by its id
|
||||
- a large majority name such method `get()`
|
||||
- for all containers, the `get()` method has 1 mandatory parameter of type string
|
||||
- some containers have an optional additional argument for `get()`, but it doesn't have the same purpose between containers
|
||||
- a large majority of the containers offer a method to test if it can return an entry by its id
|
||||
- a majority name such method `has()`
|
||||
- for all containers offering `has()`, the method has exactly 1 parameter of type string
|
||||
- a large majority of the containers throw an exception rather than returning null when an entry is not found in `get()`
|
||||
- a large majority of the containers don't implement `ArrayAccess`
|
||||
|
||||
The question of whether to include methods to define entries has been discussed in
|
||||
[issue #1](https://github.com/container-interop/container-interop/issues/1).
|
||||
It has been judged that such methods do not belong in the interface described here because it is out of its scope
|
||||
(see the "Goal" section).
|
||||
|
||||
As a result, the `ContainerInterface` contains two methods:
|
||||
|
||||
- `get()`, returning anything, with one mandatory string parameter. Should throw an exception if the entry is not found.
|
||||
- `has()`, returning a boolean, with one mandatory string parameter.
|
||||
|
||||
### Number of parameters in `get()` method
|
||||
|
||||
While `ContainerInterface` only defines one mandatory parameter in `get()`, it is not incompatible with
|
||||
existing containers that have additional optional parameters. PHP allows an implementation to offer more parameters
|
||||
as long as they are optional, because the implementation *does* satisfy the interface.
|
||||
|
||||
This issue has been discussed in [issue #6](https://github.com/container-interop/container-interop/issues/6).
|
||||
|
||||
### Type of the `$id` parameter
|
||||
|
||||
The type of the `$id` parameter in `get()` and `has()` has been discussed in
|
||||
[issue #6](https://github.com/container-interop/container-interop/issues/6).
|
||||
While `string` is used in all the containers that were analyzed, it was suggested that allowing
|
||||
anything (such as objects) could allow containers to offer a more advanced query API.
|
||||
|
||||
An example given was to use the container as an object builder. The `$id` parameter would then be an
|
||||
object that would describe how to create an instance.
|
||||
|
||||
The conclusion of the discussion was that this was beyond the scope of getting entries from a container without
|
||||
knowing how the container provided them, and it was more fit for a factory.
|
||||
|
||||
## Contributors
|
||||
|
||||
Are listed here all people that contributed in the discussions or votes, by alphabetical order:
|
||||
|
||||
- [Amy Stephen](https://github.com/AmyStephen)
|
||||
- [David Négrier](https://github.com/moufmouf)
|
||||
- [Don Gilbert](https://github.com/dongilbert)
|
||||
- [Jason Judge](https://github.com/judgej)
|
||||
- [Jeremy Lindblom](https://github.com/jeremeamia)
|
||||
- [Marco Pivetta](https://github.com/Ocramius)
|
||||
- [Matthieu Napoli](https://github.com/mnapoli)
|
||||
- [Paul M. Jones](https://github.com/pmjones)
|
||||
- [Stephan Hochdörfer](https://github.com/shochdoerfer)
|
||||
- [Taylor Otwell](https://github.com/taylorotwell)
|
||||
|
||||
## Relevant links
|
||||
|
||||
- [`ContainerInterface.php`](https://github.com/container-interop/container-interop/blob/master/src/Interop/Container/ContainerInterface.php)
|
||||
- [List of all issues](https://github.com/container-interop/container-interop/issues?labels=ContainerInterface&milestone=&page=1&state=closed)
|
||||
- [Vote for the interface name](https://github.com/container-interop/container-interop/wiki/%231-interface-name:-Vote)
|
||||
158
vendor/container-interop/container-interop/docs/ContainerInterface.md
vendored
Normal file
158
vendor/container-interop/container-interop/docs/ContainerInterface.md
vendored
Normal file
@ -0,0 +1,158 @@
|
||||
Container interface
|
||||
===================
|
||||
|
||||
This document describes a common interface for dependency injection containers.
|
||||
|
||||
The goal set by `ContainerInterface` is to standardize how frameworks and libraries make use of a
|
||||
container to obtain objects and parameters (called *entries* in the rest of this document).
|
||||
|
||||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
|
||||
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
|
||||
interpreted as described in [RFC 2119][].
|
||||
|
||||
The word `implementor` in this document is to be interpreted as someone
|
||||
implementing the `ContainerInterface` in a dependency injection-related library or framework.
|
||||
Users of dependency injections containers (DIC) are referred to as `user`.
|
||||
|
||||
[RFC 2119]: http://tools.ietf.org/html/rfc2119
|
||||
|
||||
1. Specification
|
||||
-----------------
|
||||
|
||||
### 1.1 Basics
|
||||
|
||||
- The `Interop\Container\ContainerInterface` exposes two methods : `get` and `has`.
|
||||
|
||||
- `get` takes one mandatory parameter: an entry identifier. It MUST be a string.
|
||||
A call to `get` can return anything (a *mixed* value), or throws an exception if the identifier
|
||||
is not known to the container. Two successive calls to `get` with the same
|
||||
identifier SHOULD return the same value. However, depending on the `implementor`
|
||||
design and/or `user` configuration, different values might be returned, so
|
||||
`user` SHOULD NOT rely on getting the same value on 2 successive calls.
|
||||
While `ContainerInterface` only defines one mandatory parameter in `get()`, implementations
|
||||
MAY accept additional optional parameters.
|
||||
|
||||
- `has` takes one unique parameter: an entry identifier. It MUST return `true`
|
||||
if an entry identifier is known to the container and `false` if it is not.
|
||||
`has($id)` returning true does not mean that `get($id)` will not throw an exception.
|
||||
It does however mean that `get($id)` will not throw a `NotFoundException`.
|
||||
|
||||
### 1.2 Exceptions
|
||||
|
||||
Exceptions directly thrown by the container MUST implement the
|
||||
[`Interop\Container\Exception\ContainerException`](../src/Interop/Container/Exception/ContainerException.php).
|
||||
|
||||
A call to the `get` method with a non-existing id SHOULD throw a
|
||||
[`Interop\Container\Exception\NotFoundException`](../src/Interop/Container/Exception/NotFoundException.php).
|
||||
|
||||
### 1.3 Additional features
|
||||
|
||||
This section describes additional features that MAY be added to a container. Containers are not
|
||||
required to implement these features to respect the ContainerInterface.
|
||||
|
||||
#### 1.3.1 Delegate lookup feature
|
||||
|
||||
The goal of the *delegate lookup* feature is to allow several containers to share entries.
|
||||
Containers implementing this feature can perform dependency lookups in other containers.
|
||||
|
||||
Containers implementing this feature will offer a greater lever of interoperability
|
||||
with other containers. Implementation of this feature is therefore RECOMMENDED.
|
||||
|
||||
A container implementing this feature:
|
||||
|
||||
- MUST implement the `ContainerInterface`
|
||||
- MUST provide a way to register a delegate container (using a constructor parameter, or a setter,
|
||||
or any possible way). The delegate container MUST implement the `ContainerInterface`.
|
||||
|
||||
When a container is configured to use a delegate container for dependencies:
|
||||
|
||||
- Calls to the `get` method should only return an entry if the entry is part of the container.
|
||||
If the entry is not part of the container, an exception should be thrown
|
||||
(as requested by the `ContainerInterface`).
|
||||
- Calls to the `has` method should only return `true` if the entry is part of the container.
|
||||
If the entry is not part of the container, `false` should be returned.
|
||||
- If the fetched entry has dependencies, **instead** of performing
|
||||
the dependency lookup in the container, the lookup is performed on the *delegate container*.
|
||||
|
||||
Important! By default, the lookup SHOULD be performed on the delegate container **only**, not on the container itself.
|
||||
|
||||
It is however allowed for containers to provide exception cases for special entries, and a way to lookup
|
||||
into the same container (or another container) instead of the delegate container.
|
||||
|
||||
2. Package
|
||||
----------
|
||||
|
||||
The interfaces and classes described as well as relevant exception are provided as part of the
|
||||
[container-interop/container-interop](https://packagist.org/packages/container-interop/container-interop) package.
|
||||
|
||||
3. `Interop\Container\ContainerInterface`
|
||||
-----------------------------------------
|
||||
|
||||
```php
|
||||
<?php
|
||||
namespace Interop\Container;
|
||||
|
||||
use Interop\Container\Exception\ContainerException;
|
||||
use Interop\Container\Exception\NotFoundException;
|
||||
|
||||
/**
|
||||
* Describes the interface of a container that exposes methods to read its entries.
|
||||
*/
|
||||
interface ContainerInterface
|
||||
{
|
||||
/**
|
||||
* Finds an entry of the container by its identifier and returns it.
|
||||
*
|
||||
* @param string $id Identifier of the entry to look for.
|
||||
*
|
||||
* @throws NotFoundException No entry was found for this identifier.
|
||||
* @throws ContainerException Error while retrieving the entry.
|
||||
*
|
||||
* @return mixed Entry.
|
||||
*/
|
||||
public function get($id);
|
||||
|
||||
/**
|
||||
* Returns true if the container can return an entry for the given identifier.
|
||||
* Returns false otherwise.
|
||||
*
|
||||
* `has($id)` returning true does not mean that `get($id)` will not throw an exception.
|
||||
* It does however mean that `get($id)` will not throw a `NotFoundException`.
|
||||
*
|
||||
* @param string $id Identifier of the entry to look for.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function has($id);
|
||||
}
|
||||
```
|
||||
|
||||
4. `Interop\Container\Exception\ContainerException`
|
||||
---------------------------------------------------
|
||||
|
||||
```php
|
||||
<?php
|
||||
namespace Interop\Container\Exception;
|
||||
|
||||
/**
|
||||
* Base interface representing a generic exception in a container.
|
||||
*/
|
||||
interface ContainerException
|
||||
{
|
||||
}
|
||||
```
|
||||
|
||||
5. `Interop\Container\Exception\NotFoundException`
|
||||
---------------------------------------------------
|
||||
|
||||
```php
|
||||
<?php
|
||||
namespace Interop\Container\Exception;
|
||||
|
||||
/**
|
||||
* No entry was found in the container.
|
||||
*/
|
||||
interface NotFoundException extends ContainerException
|
||||
{
|
||||
}
|
||||
```
|
||||
259
vendor/container-interop/container-interop/docs/Delegate-lookup-meta.md
vendored
Normal file
259
vendor/container-interop/container-interop/docs/Delegate-lookup-meta.md
vendored
Normal file
@ -0,0 +1,259 @@
|
||||
Delegate lookup feature Meta Document
|
||||
=====================================
|
||||
|
||||
1. Summary
|
||||
----------
|
||||
|
||||
This document describes the *delegate lookup feature*.
|
||||
Containers are not required to implement this feature to respect the `ContainerInterface`.
|
||||
However, containers implementing this feature will offer a greater lever of interoperability
|
||||
with other containers, allowing multiple containers to share entries in the same application.
|
||||
Implementation of this feature is therefore recommanded.
|
||||
|
||||
2. Why Bother?
|
||||
--------------
|
||||
|
||||
The [`ContainerInterface`](../src/Interop/Container/ContainerInterface.php) ([meta doc](ContainerInterface.md))
|
||||
standardizes how frameworks and libraries make use of a container to obtain objects and parameters.
|
||||
|
||||
By standardizing such a behavior, frameworks and libraries relying on the `ContainerInterface`
|
||||
could work with any compatible container.
|
||||
That would allow end users to choose their own container based on their own preferences.
|
||||
|
||||
The `ContainerInterface` is also enough if we want to have several containers side-by-side in the same
|
||||
application. For instance, this is what the [CompositeContainer](https://github.com/jeremeamia/acclimate-container/blob/master/src/CompositeContainer.php)
|
||||
class of [Acclimate](https://github.com/jeremeamia/acclimate-container) is designed for:
|
||||
|
||||

|
||||
|
||||
However, an instance in container 1 cannot reference an instance in container 2.
|
||||
|
||||
It would be better if an instance of container 1 could reference an instance in container 2,
|
||||
and the opposite should be true.
|
||||
|
||||

|
||||
|
||||
In the sample above, entry 1 in container 1 is referencing entry 3 in container 2.
|
||||
|
||||
3. Scope
|
||||
--------
|
||||
|
||||
### 3.1 Goals
|
||||
|
||||
The goal of the *delegate lookup* feature is to allow several containers to share entries.
|
||||
|
||||
4. Approaches
|
||||
-------------
|
||||
|
||||
### 4.1 Chosen Approach
|
||||
|
||||
Containers implementing this feature can perform dependency lookups in other containers.
|
||||
|
||||
A container implementing this feature:
|
||||
|
||||
- must implement the `ContainerInterface`
|
||||
- must provide a way to register a *delegate container* (using a constructor parameter, or a setter, or any
|
||||
possible way). The *delegate container* must implement the `ContainerInterface`.
|
||||
|
||||
When a *delegate container* is configured on a container:
|
||||
|
||||
- Calls to the `get` method should only return an entry if the entry is part of the container.
|
||||
If the entry is not part of the container, an exception should be thrown (as required in the `ContainerInterface`).
|
||||
- Calls to the `has` method should only return *true* if the entry is part of the container.
|
||||
If the entry is not part of the container, *false* should be returned.
|
||||
- Finally, the important part: if the entry we are fetching has dependencies,
|
||||
**instead** of perfoming the dependency lookup in the container, the lookup is performed on the *delegate container*.
|
||||
|
||||
Important! By default, the lookup should be performed on the delegate container **only**, not on the container itself.
|
||||
|
||||
It is however allowed for containers to provide exception cases for special entries, and a way to lookup into
|
||||
the same container (or another container) instead of the delegate container.
|
||||
|
||||
### 4.2 Typical usage
|
||||
|
||||
The *delegate container* will usually be a composite container. A composite container is a container that
|
||||
contains several other containers. When performing a lookup on a composite container, the inner containers are
|
||||
queried until one container returns an entry.
|
||||
An inner container implementing the *delegate lookup feature* will return entries it contains, but if these
|
||||
entries have dependencies, the dependencies lookup calls will be performed on the composite container, giving
|
||||
a chance to all containers to answer.
|
||||
|
||||
Interestingly enough, the order in which containers are added in the composite container matters. Indeed,
|
||||
the first containers to be added in the composite container can "override" the entries of containers with
|
||||
lower priority.
|
||||
|
||||

|
||||
|
||||
In the example above, "container 2" contains a controller "myController" and the controller is referencing an
|
||||
"entityManager" entry. "Container 1" contains also an entry named "entityManager".
|
||||
Without the *delegate lookup* feature, when requesting the "myController" instance to container 2, it would take
|
||||
in charge the instanciation of both entries.
|
||||
|
||||
However, using the *delegate lookup* feature, here is what happens when we ask the composite container for the
|
||||
"myController" instance:
|
||||
|
||||
- The composite container asks container 1 if if contains the "myController" instance. The answer is no.
|
||||
- The composite container asks container 2 if if contains the "myController" instance. The answer is yes.
|
||||
- The composite container performs a `get` call on container 2 for the "myController" instance.
|
||||
- Container 2 sees that "myController" has a dependency on "entityManager".
|
||||
- Container 2 delegates the lookup of "entityManager" to the composite container.
|
||||
- The composite container asks container 1 if if contains the "entityManager" instance. The answer is yes.
|
||||
- The composite container performs a `get` call on container 1 for the "entityManager" instance.
|
||||
|
||||
In the end, we get a controller instanciated by container 2 that references an entityManager instanciated
|
||||
by container 1.
|
||||
|
||||
### 4.3 Alternative: the fallback strategy
|
||||
|
||||
The first proposed approach we tried was to perform all the lookups in the "local" container,
|
||||
and if a lookup fails in the container, to use the delegate container. In this scenario, the
|
||||
delegate container is used in "fallback" mode.
|
||||
|
||||
This strategy has been described in @moufmouf blog post: http://mouf-php.com/container-interop-whats-next (solution 1).
|
||||
It was also discussed [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-33570697) and
|
||||
[here](https://github.com/container-interop/container-interop/pull/20#issuecomment-56599631).
|
||||
|
||||
Problems with this strategy:
|
||||
|
||||
- Heavy problem regarding infinite loops
|
||||
- Unable to overload a container entry with the delegate container entry
|
||||
|
||||
### 4.4 Alternative: force implementing an interface
|
||||
|
||||
The first proposed approach was to develop a `ParentAwareContainerInterface` interface.
|
||||
It was proposed here: https://github.com/container-interop/container-interop/pull/8
|
||||
|
||||
The interface would have had the behaviour of the delegate lookup feature but would have forced the addition of
|
||||
a `setParentContainter` method:
|
||||
|
||||
```php
|
||||
interface ParentAwareContainerInterface extends ReadableContainerInterface {
|
||||
/**
|
||||
* Sets the parent container associated to that container. This container will call
|
||||
* the parent container to fetch dependencies.
|
||||
*
|
||||
* @param ContainerInterface $container
|
||||
*/
|
||||
public function setParentContainer(ContainerInterface $container);
|
||||
}
|
||||
```
|
||||
|
||||
The interface idea was first questioned by @Ocramius [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-51721777).
|
||||
@Ocramius expressed the idea that an interface should not contain setters, otherwise, it is forcing implementation
|
||||
details on the class implementing the interface.
|
||||
Then @mnapoli made a proposal for a "convention" [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-51841079),
|
||||
this idea was further discussed until all participants in the discussion agreed to remove the interface idea
|
||||
and replace it with a "standard" feature.
|
||||
|
||||
**Pros:**
|
||||
|
||||
If we had had an interface, we could have delegated the registration of the delegate/composite container to the
|
||||
the delegate/composite container itself.
|
||||
For instance:
|
||||
|
||||
```php
|
||||
$containerA = new ContainerA();
|
||||
$containerB = new ContainerB();
|
||||
|
||||
$compositeContainer = new CompositeContainer([$containerA, $containerB]);
|
||||
|
||||
// The call to 'setParentContainer' is delegated to the CompositeContainer
|
||||
// It is not the responsibility of the user anymore.
|
||||
class CompositeContainer {
|
||||
...
|
||||
|
||||
public function __construct($containers) {
|
||||
foreach ($containers as $container) {
|
||||
if ($container instanceof ParentAwareContainerInterface) {
|
||||
$container->setParentContainer($this);
|
||||
}
|
||||
}
|
||||
...
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
**Cons:**
|
||||
|
||||
Cons have been extensively discussed [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-51721777).
|
||||
Basically, forcing a setter into an interface is a bad idea. Setters are similar to constructor arguments,
|
||||
and it's a bad idea to standardize a constructor: how the delegate container is configured into a container is an implementation detail. This outweights the benefits of the interface.
|
||||
|
||||
### 4.4 Alternative: no exception case for delegate lookups
|
||||
|
||||
Originally, the proposed wording for delegate lookup calls was:
|
||||
|
||||
> Important! The lookup MUST be performed on the delegate container **only**, not on the container itself.
|
||||
|
||||
This was later replaced by:
|
||||
|
||||
> Important! By default, the lookup SHOULD be performed on the delegate container **only**, not on the container itself.
|
||||
>
|
||||
> It is however allowed for containers to provide exception cases for special entries, and a way to lookup
|
||||
> into the same container (or another container) instead of the delegate container.
|
||||
|
||||
Exception cases have been allowed to avoid breaking dependencies with some services that must be provided
|
||||
by the container (on @njasm proposal). This was proposed here: https://github.com/container-interop/container-interop/pull/20#issuecomment-56597235
|
||||
|
||||
### 4.5 Alternative: having one of the containers act as the composite container
|
||||
|
||||
In real-life scenarios, we usually have a big framework (Symfony 2, Zend Framework 2, etc...) and we want to
|
||||
add another DI container to this container. Most of the time, the "big" framework will be responsible for
|
||||
creating the controller's instances, using it's own DI container. Until *container-interop* is fully adopted,
|
||||
the "big" framework will not be aware of the existence of a composite container that it should use instead
|
||||
of its own container.
|
||||
|
||||
For this real-life use cases, @mnapoli and @moufmouf proposed to extend the "big" framework's DI container
|
||||
to make it act as a composite container.
|
||||
|
||||
This has been discussed [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-40367194)
|
||||
and [here](http://mouf-php.com/container-interop-whats-next#solution4).
|
||||
|
||||
This was implemented in Symfony 2 using:
|
||||
|
||||
- [interop.symfony.di](https://github.com/thecodingmachine/interop.symfony.di/tree/v0.1.0)
|
||||
- [framework interop](https://github.com/mnapoli/framework-interop/)
|
||||
|
||||
This was implemented in Silex using:
|
||||
|
||||
- [interop.silex.di](https://github.com/thecodingmachine/interop.silex.di)
|
||||
|
||||
Having a container act as the composite container is not part of the delegate lookup standard because it is
|
||||
simply a temporary design pattern used to make existing frameworks that do not support yet ContainerInterop
|
||||
play nice with other DI containers.
|
||||
|
||||
|
||||
5. Implementations
|
||||
------------------
|
||||
|
||||
The following projects already implement the delegate lookup feature:
|
||||
|
||||
- [Mouf](http://mouf-php.com), through the [`setDelegateLookupContainer` method](https://github.com/thecodingmachine/mouf/blob/2.0/src/Mouf/MoufManager.php#L2120)
|
||||
- [PHP-DI](http://php-di.org/), through the [`$wrapperContainer` parameter of the constructor](https://github.com/mnapoli/PHP-DI/blob/master/src/DI/Container.php#L72)
|
||||
- [pimple-interop](https://github.com/moufmouf/pimple-interop), through the [`$container` parameter of the constructor](https://github.com/moufmouf/pimple-interop/blob/master/src/Interop/Container/Pimple/PimpleInterop.php#L62)
|
||||
|
||||
6. People
|
||||
---------
|
||||
|
||||
Are listed here all people that contributed in the discussions, by alphabetical order:
|
||||
|
||||
- [Alexandru Pătrănescu](https://github.com/drealecs)
|
||||
- [Ben Peachey](https://github.com/potherca)
|
||||
- [David Négrier](https://github.com/moufmouf)
|
||||
- [Jeremy Lindblom](https://github.com/jeremeamia)
|
||||
- [Marco Pivetta](https://github.com/Ocramius)
|
||||
- [Matthieu Napoli](https://github.com/mnapoli)
|
||||
- [Nelson J Morais](https://github.com/njasm)
|
||||
- [Phil Sturgeon](https://github.com/philsturgeon)
|
||||
- [Stephan Hochdörfer](https://github.com/shochdoerfer)
|
||||
|
||||
7. Relevant Links
|
||||
-----------------
|
||||
|
||||
_**Note:** Order descending chronologically._
|
||||
|
||||
- [Pull request on the delegate lookup feature](https://github.com/container-interop/container-interop/pull/20)
|
||||
- [Pull request on the interface idea](https://github.com/container-interop/container-interop/pull/8)
|
||||
- [Original article exposing the delegate lookup idea along many others](http://mouf-php.com/container-interop-whats-next)
|
||||
|
||||
60
vendor/container-interop/container-interop/docs/Delegate-lookup.md
vendored
Normal file
60
vendor/container-interop/container-interop/docs/Delegate-lookup.md
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
Delegate lookup feature
|
||||
=======================
|
||||
|
||||
This document describes a standard for dependency injection containers.
|
||||
|
||||
The goal set by the *delegate lookup* feature is to allow several containers to share entries.
|
||||
Containers implementing this feature can perform dependency lookups in other containers.
|
||||
|
||||
Containers implementing this feature will offer a greater lever of interoperability
|
||||
with other containers. Implementation of this feature is therefore RECOMMENDED.
|
||||
|
||||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
|
||||
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
|
||||
interpreted as described in [RFC 2119][].
|
||||
|
||||
The word `implementor` in this document is to be interpreted as someone
|
||||
implementing the delegate lookup feature in a dependency injection-related library or framework.
|
||||
Users of dependency injections containers (DIC) are referred to as `user`.
|
||||
|
||||
[RFC 2119]: http://tools.ietf.org/html/rfc2119
|
||||
|
||||
1. Vocabulary
|
||||
-------------
|
||||
|
||||
In a dependency injection container, the container is used to fetch entries.
|
||||
Entries can have dependencies on other entries. Usually, these other entries are fetched by the container.
|
||||
|
||||
The *delegate lookup* feature is the ability for a container to fetch dependencies in
|
||||
another container. In the rest of the document, the word "container" will reference the container
|
||||
implemented by the implementor. The word "delegate container" will reference the container we are
|
||||
fetching the dependencies from.
|
||||
|
||||
2. Specification
|
||||
----------------
|
||||
|
||||
A container implementing the *delegate lookup* feature:
|
||||
|
||||
- MUST implement the [`ContainerInterface`](ContainerInterface.md)
|
||||
- MUST provide a way to register a delegate container (using a constructor parameter, or a setter,
|
||||
or any possible way). The delegate container MUST implement the [`ContainerInterface`](ContainerInterface.md).
|
||||
|
||||
When a container is configured to use a delegate container for dependencies:
|
||||
|
||||
- Calls to the `get` method should only return an entry if the entry is part of the container.
|
||||
If the entry is not part of the container, an exception should be thrown
|
||||
(as requested by the [`ContainerInterface`](ContainerInterface.md)).
|
||||
- Calls to the `has` method should only return `true` if the entry is part of the container.
|
||||
If the entry is not part of the container, `false` should be returned.
|
||||
- If the fetched entry has dependencies, **instead** of performing
|
||||
the dependency lookup in the container, the lookup is performed on the *delegate container*.
|
||||
|
||||
Important: By default, the dependency lookups SHOULD be performed on the delegate container **only**, not on the container itself.
|
||||
|
||||
It is however allowed for containers to provide exception cases for special entries, and a way to lookup
|
||||
into the same container (or another container) instead of the delegate container.
|
||||
|
||||
3. Package / Interface
|
||||
----------------------
|
||||
|
||||
This feature is not tied to any code, interface or package.
|
||||
BIN
vendor/container-interop/container-interop/docs/images/interoperating_containers.png
vendored
Normal file
BIN
vendor/container-interop/container-interop/docs/images/interoperating_containers.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
BIN
vendor/container-interop/container-interop/docs/images/priority.png
vendored
Normal file
BIN
vendor/container-interop/container-interop/docs/images/priority.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
vendor/container-interop/container-interop/docs/images/side_by_side_containers.png
vendored
Normal file
BIN
vendor/container-interop/container-interop/docs/images/side_by_side_containers.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
15
vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php
vendored
Normal file
15
vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
|
||||
*/
|
||||
|
||||
namespace Interop\Container;
|
||||
|
||||
use Psr\Container\ContainerInterface as PsrContainerInterface;
|
||||
|
||||
/**
|
||||
* Describes the interface of a container that exposes methods to read its entries.
|
||||
*/
|
||||
interface ContainerInterface extends PsrContainerInterface
|
||||
{
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
|
||||
*/
|
||||
|
||||
namespace Interop\Container\Exception;
|
||||
|
||||
use Psr\Container\ContainerExceptionInterface as PsrContainerException;
|
||||
|
||||
/**
|
||||
* Base interface representing a generic exception in a container.
|
||||
*/
|
||||
interface ContainerException extends PsrContainerException
|
||||
{
|
||||
}
|
||||
15
vendor/container-interop/container-interop/src/Interop/Container/Exception/NotFoundException.php
vendored
Normal file
15
vendor/container-interop/container-interop/src/Interop/Container/Exception/NotFoundException.php
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
|
||||
*/
|
||||
|
||||
namespace Interop\Container\Exception;
|
||||
|
||||
use Psr\Container\NotFoundExceptionInterface as PsrNotFoundException;
|
||||
|
||||
/**
|
||||
* No entry was found in the container.
|
||||
*/
|
||||
interface NotFoundException extends ContainerException, PsrNotFoundException
|
||||
{
|
||||
}
|
||||
2
vendor/facebook/php-sdk-v4/LICENSE
vendored
2
vendor/facebook/php-sdk-v4/LICENSE
vendored
@ -1,4 +1,4 @@
|
||||
Copyright 2016 Facebook, Inc.
|
||||
Copyright 2017 Facebook, Inc.
|
||||
|
||||
You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
7
vendor/facebook/php-sdk-v4/composer.json
vendored
7
vendor/facebook/php-sdk-v4/composer.json
vendored
@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "facebook/php-sdk-v4",
|
||||
"name": "facebook/graph-sdk",
|
||||
"description": "Facebook SDK for PHP",
|
||||
"keywords": ["facebook", "sdk"],
|
||||
"type": "library",
|
||||
"homepage": "https://github.com/facebook/facebook-php-sdk-v4",
|
||||
"homepage": "https://github.com/facebook/php-graph-sdk",
|
||||
"license": "Facebook Platform",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Facebook",
|
||||
"homepage": "https://github.com/facebook/facebook-php-sdk-v4/contributors"
|
||||
"homepage": "https://github.com/facebook/php-graph-sdk/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
@ -20,6 +20,7 @@
|
||||
"guzzlehttp/guzzle": "~5.0"
|
||||
},
|
||||
"suggest": {
|
||||
"paragonie/random_compat": "Provides a better CSPRNG option in PHP 5",
|
||||
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
|
||||
},
|
||||
"autoload": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
@ -125,8 +125,8 @@ class OAuth2Client
|
||||
* Generates an authorization URL to begin the process of authenticating a user.
|
||||
*
|
||||
* @param string $redirectUrl The callback URL to redirect to.
|
||||
* @param array $scope An array of permissions to request.
|
||||
* @param string $state The CSPRNG-generated CSRF value.
|
||||
* @param array $scope An array of permissions to request.
|
||||
* @param array $params An array of parameters to generate URL.
|
||||
* @param string $separator The separator to use in http_build_query().
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
@ -53,12 +53,12 @@ class Facebook
|
||||
/**
|
||||
* @const string Version number of the Facebook PHP SDK.
|
||||
*/
|
||||
const VERSION = '5.3.1';
|
||||
const VERSION = '5.6.1';
|
||||
|
||||
/**
|
||||
* @const string Default Graph API version for requests.
|
||||
*/
|
||||
const DEFAULT_GRAPH_VERSION = 'v2.7';
|
||||
const DEFAULT_GRAPH_VERSION = 'v2.10';
|
||||
|
||||
/**
|
||||
* @const string The name of the environment variable that contains the app ID.
|
||||
@ -494,6 +494,27 @@ class Facebook
|
||||
return $this->lastResponse = $this->client->sendBatchRequest($batchRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates an empty FacebookBatchRequest entity.
|
||||
*
|
||||
* @param AccessToken|string|null $accessToken The top-level access token. Requests with no access token
|
||||
* will fallback to this.
|
||||
* @param string|null $graphVersion The Graph API version to use.
|
||||
* @return FacebookBatchRequest
|
||||
*/
|
||||
public function newBatchRequest($accessToken = null, $graphVersion = null)
|
||||
{
|
||||
$accessToken = $accessToken ?: $this->defaultAccessToken;
|
||||
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
|
||||
|
||||
return new FacebookBatchRequest(
|
||||
$this->app,
|
||||
[],
|
||||
$accessToken,
|
||||
$graphVersion
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new FacebookRequest entity.
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
@ -62,16 +62,17 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
|
||||
}
|
||||
|
||||
/**
|
||||
* A a new request to the array.
|
||||
* Adds a new request to the array.
|
||||
*
|
||||
* @param FacebookRequest|array $request
|
||||
* @param string|null $name
|
||||
* @param string|null|array $options Array of batch request options e.g. 'name', 'omit_response_on_success'.
|
||||
* If a string is given, it is the value of the 'name' option.
|
||||
*
|
||||
* @return FacebookBatchRequest
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function add($request, $name = null)
|
||||
public function add($request, $options = null)
|
||||
{
|
||||
if (is_array($request)) {
|
||||
foreach ($request as $key => $req) {
|
||||
@ -85,17 +86,28 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
|
||||
throw new \InvalidArgumentException('Argument for add() must be of type array or FacebookRequest.');
|
||||
}
|
||||
|
||||
if (null === $options) {
|
||||
$options = [];
|
||||
} elseif (!is_array($options)) {
|
||||
$options = ['name' => $options];
|
||||
}
|
||||
|
||||
$this->addFallbackDefaults($request);
|
||||
$requestToAdd = [
|
||||
'name' => $name,
|
||||
'request' => $request,
|
||||
];
|
||||
|
||||
// File uploads
|
||||
$attachedFiles = $this->extractFileAttachments($request);
|
||||
if ($attachedFiles) {
|
||||
$requestToAdd['attached_files'] = $attachedFiles;
|
||||
}
|
||||
|
||||
$name = isset($options['name']) ? $options['name'] : null;
|
||||
|
||||
unset($options['name']);
|
||||
|
||||
$requestToAdd = [
|
||||
'name' => $name,
|
||||
'request' => $request,
|
||||
'options' => $options,
|
||||
'attached_files' => $attachedFiles,
|
||||
];
|
||||
|
||||
$this->requests[] = $requestToAdd;
|
||||
|
||||
return $this;
|
||||
@ -168,8 +180,6 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
|
||||
|
||||
/**
|
||||
* Prepares the requests to be sent as a batch request.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function prepareRequestsForBatch()
|
||||
{
|
||||
@ -191,8 +201,15 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
|
||||
{
|
||||
$requests = [];
|
||||
foreach ($this->requests as $request) {
|
||||
$attachedFiles = isset($request['attached_files']) ? $request['attached_files'] : null;
|
||||
$requests[] = $this->requestEntityToBatchArray($request['request'], $request['name'], $attachedFiles);
|
||||
$options = [];
|
||||
|
||||
if (null !== $request['name']) {
|
||||
$options['name'] = $request['name'];
|
||||
}
|
||||
|
||||
$options += $request['options'];
|
||||
|
||||
$requests[] = $this->requestEntityToBatchArray($request['request'], $options, $request['attached_files']);
|
||||
}
|
||||
|
||||
return json_encode($requests);
|
||||
@ -217,14 +234,22 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
|
||||
/**
|
||||
* Converts a Request entity into an array that is batch-friendly.
|
||||
*
|
||||
* @param FacebookRequest $request The request entity to convert.
|
||||
* @param string|null $requestName The name of the request.
|
||||
* @param string|null $attachedFiles Names of files associated with the request.
|
||||
* @param FacebookRequest $request The request entity to convert.
|
||||
* @param string|null|array $options Array of batch request options e.g. 'name', 'omit_response_on_success'.
|
||||
* If a string is given, it is the value of the 'name' option.
|
||||
* @param string|null $attachedFiles Names of files associated with the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function requestEntityToBatchArray(FacebookRequest $request, $requestName = null, $attachedFiles = null)
|
||||
public function requestEntityToBatchArray(FacebookRequest $request, $options = null, $attachedFiles = null)
|
||||
{
|
||||
|
||||
if (null === $options) {
|
||||
$options = [];
|
||||
} elseif (!is_array($options)) {
|
||||
$options = ['name' => $options];
|
||||
}
|
||||
|
||||
$compiledHeaders = [];
|
||||
$headers = $request->getHeaders();
|
||||
foreach ($headers as $name => $value) {
|
||||
@ -244,18 +269,12 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
|
||||
$batch['body'] = $body;
|
||||
}
|
||||
|
||||
if (isset($requestName)) {
|
||||
$batch['name'] = $requestName;
|
||||
}
|
||||
$batch += $options;
|
||||
|
||||
if (isset($attachedFiles)) {
|
||||
if (null !== $attachedFiles) {
|
||||
$batch['attached_files'] = $attachedFiles;
|
||||
}
|
||||
|
||||
// @TODO Add support for "omit_response_on_success"
|
||||
// @TODO Add support for "depends_on"
|
||||
// @TODO Add support for JSONP with "callback"
|
||||
|
||||
return $batch;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
@ -108,7 +108,7 @@ class FacebookRequest
|
||||
/**
|
||||
* Set the access token for this request.
|
||||
*
|
||||
* @param AccessToken|string
|
||||
* @param AccessToken|string|null
|
||||
*
|
||||
* @return FacebookRequest
|
||||
*/
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
@ -724,6 +724,7 @@ class Mimetypes
|
||||
'spq' => 'application/scvp-vp-request',
|
||||
'spx' => 'audio/ogg',
|
||||
'src' => 'application/x-wais-source',
|
||||
'srt' => 'application/octet-stream',
|
||||
'sru' => 'application/sru+xml',
|
||||
'srx' => 'application/sparql-results+xml',
|
||||
'sse' => 'application/vnd.kodak-descriptor',
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
@ -28,7 +28,6 @@ namespace Facebook\GraphNodes;
|
||||
*
|
||||
* @package Facebook
|
||||
*/
|
||||
|
||||
class GraphAchievement extends GraphNode
|
||||
{
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
@ -235,4 +235,18 @@ class GraphEdge extends Collection
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function map(\Closure $callback)
|
||||
{
|
||||
return new static(
|
||||
$this->request,
|
||||
array_map($callback, $this->items, array_keys($this->items)),
|
||||
$this->metaData,
|
||||
$this->parentEdgeEndpoint,
|
||||
$this->subclassName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
@ -37,6 +37,8 @@ class GraphPage extends GraphNode
|
||||
'best_page' => '\Facebook\GraphNodes\GraphPage',
|
||||
'global_brand_parent_page' => '\Facebook\GraphNodes\GraphPage',
|
||||
'location' => '\Facebook\GraphNodes\GraphLocation',
|
||||
'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
|
||||
'picture' => '\Facebook\GraphNodes\GraphPicture',
|
||||
];
|
||||
|
||||
/**
|
||||
@ -99,6 +101,26 @@ class GraphPage extends GraphNode
|
||||
return $this->getField('location');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns CoverPhoto of the Page.
|
||||
*
|
||||
* @return GraphCoverPhoto|null
|
||||
*/
|
||||
public function getCover()
|
||||
{
|
||||
return $this->getField('cover');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Picture of the Page.
|
||||
*
|
||||
* @return GraphPicture|null
|
||||
*/
|
||||
public function getPicture()
|
||||
{
|
||||
return $this->getField('picture');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the page access token for the admin user.
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2016 Facebook, Inc.
|
||||
* Copyright 2017 Facebook, Inc.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user