fix
This commit is contained in:
@@ -3,9 +3,10 @@
|
|||||||
require_once 'config.php';
|
require_once 'config.php';
|
||||||
$url = $local_url . "/createuser";
|
$url = $local_url . "/createuser";
|
||||||
|
|
||||||
$username = urlencode("ses66181+" . rand(1000, 9999) . "@gmail.com");
|
$username = urlencode("jubaworker+" . rand(1000, 9999) . "@gmail.com");
|
||||||
|
|
||||||
$username = "ses66181+" . rand(1000, 9999) . "@gmail.com";
|
$username = "jubaworker+" . rand(1000, 9999) . "@gmail.com";
|
||||||
|
//$username = "ameye+" . rand(1000, 9999) . "@chiefsoft.com";
|
||||||
$phone = (rand(1, 2) > 1) ? "770222" . rand(2222, 9999) : '';
|
$phone = (rand(1, 2) > 1) ? "770222" . rand(2222, 9999) : '';
|
||||||
|
|
||||||
include 'sample_data.php'; // just for sample data
|
include 'sample_data.php'; // just for sample data
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ class Bkotransaction extends Bko_Controller {
|
|||||||
$mysql = "SELECT m.id,mp.confirmation, m.added,me.firstname||' '||me.lastname||'<br>'||me.email AS Sender,"
|
$mysql = "SELECT m.id,mp.confirmation, m.added,me.firstname||' '||me.lastname||'<br>'||me.email AS Sender,"
|
||||||
. "sr.firstname||' '||sr.lastname||'<br>ACC:'||sr.account_no||'-'||be.name AS recipient, m.initiatingamount*0.01 AS Amount,m.fee*0.01 AS Fee, "
|
. "sr.firstname||' '||sr.lastname||'<br>ACC:'||sr.account_no||'-'||be.name AS recipient, m.initiatingamount*0.01 AS Amount,m.fee*0.01 AS Fee, "
|
||||||
. "'<input type=submit id=\"accs'||m.id||'\" onclick=\"return smoneyDetail('||m.id||')\" name=\"manage\" class=\"btn btn-info btn-sm\" value=\"Detail\">' As Detail, "
|
. "'<input type=submit id=\"accs'||m.id||'\" onclick=\"return smoneyDetail('||m.id||')\" name=\"manage\" class=\"btn btn-info btn-sm\" value=\"Detail\">' As Detail, "
|
||||||
. "'<input type=submit id=\"acc'||m.id||'\" onclick=\"return smoneyProcess('||m.id||')\" name=\"manage\" class=\"btn btn-info btn-sm\" value=\"Process\">' As Process "
|
. "'<input type=submit id=\"acc'||m.id||'\" onclick=\"return smoneyProcess('||m.id||')\" name=\"manage\" class=\"btn btn-info btn-sm\" value=\"Process\">' As Process, "
|
||||||
|
. "m.initiatingamount AS raw_amount, m.fee AS raw_fee, sr.bank_code, sr.account_no "
|
||||||
. "FROM money_transfer m "
|
. "FROM money_transfer m "
|
||||||
. "LEFT JOIN members me ON me.id=m.member_id "
|
. "LEFT JOIN members me ON me.id=m.member_id "
|
||||||
. "LEFT JOIN sendmoney_recipient sr ON sr.id=m.recipientid "
|
. "LEFT JOIN sendmoney_recipient sr ON sr.id=m.recipientid "
|
||||||
@@ -39,7 +40,7 @@ class Bkotransaction extends Bko_Controller {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'TRANSDETAIL':
|
case 'TRANSDETAIL':
|
||||||
|
|
||||||
$mysql = "SELECT m.id,mp.confirmation, m.added,me.firstname||' '||me.lastname||'<br>'||me.email AS Sender,"
|
$mysql = "SELECT m.id,mp.confirmation, m.added,me.firstname||' '||me.lastname||'<br>'||me.email AS Sender,"
|
||||||
. "sr.firstname||' '||sr.lastname||'<br>ACC:'||sr.account_no||'-'||be.name AS recipient, m.initiatingamount*0.01 AS Amount,m.fee*0.01 AS Fee "
|
. "sr.firstname||' '||sr.lastname||'<br>ACC:'||sr.account_no||'-'||be.name AS recipient, m.initiatingamount*0.01 AS Amount,m.fee*0.01 AS Fee "
|
||||||
@@ -65,93 +66,155 @@ class Bkotransaction extends Bko_Controller {
|
|||||||
|
|
||||||
case 'COMPLETE':
|
case 'COMPLETE':
|
||||||
//echo 'complete 1';
|
//echo 'complete 1';
|
||||||
// url: "/bkotransaction/smprocess?proc=COMPLETE&sendmoney_id="+link_id+'&tcode='+tcode+'&tref='+tref
|
// url: "/bkotransaction/smprocess?proc=COMPLETE&sendmoney_id="+link_id+'&tcode='+tcode+'&tref='+tref
|
||||||
$data["trans_code"] = $this->input->get('tcode');
|
$data["trans_code"] = $this->input->get('tcode');
|
||||||
$data["trans_tref"] = $this->input->get('tref');
|
$data["trans_tref"] = $this->input->get('tref');
|
||||||
$data["sendmoney_id"] = $sendmoney_id;
|
$data["sendmoney_id"] = $sendmoney_id;
|
||||||
$data['action'] = WRENCHBOARD_SMONEY_BKOPROC;
|
echo $this->sendmoneyCompletePage($data);
|
||||||
$data['action_mode'] = SMONEY_PROCC_MANUAL;
|
|
||||||
$this->load->model('backend_model');
|
|
||||||
$out = array();
|
|
||||||
$this->backend_model->wrenchboard_api($data, $out);
|
|
||||||
echo $out['status'];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
protected function sendmoneyCompletePage($data) {
|
||||||
|
$data['action'] = WRENCHBOARD_SMONEY_BKOPROC;
|
||||||
|
$data['action_mode'] = SMONEY_PROCC_MANUAL;
|
||||||
|
$this->load->model('backend_model');
|
||||||
|
$out = array();
|
||||||
|
$this->backend_model->wrenchboard_api($data, $out);
|
||||||
|
return $out['status'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function smTransmitProcess() {
|
public function smTransmitProcess() {
|
||||||
// url: "/bkotransaction/smprocess?proc=PROCESS&sendmoney_id="+link_id
|
// url: "/bkotransaction/smprocess?proc=PROCESS&sendmoney_id="+link_id
|
||||||
$proc = $this->input->get('proc');
|
$proc = $this->input->get('proc');
|
||||||
$sendmoney_id = $this->input->get('sendmoney_id');
|
$sendmoney_id = $this->input->get('sendmoney_id');
|
||||||
|
|
||||||
switch ($proc) {
|
switch ($proc) {
|
||||||
case 'PROCESS':
|
case 'PROCESS':
|
||||||
$mysql = "SELECT m.id,mp.confirmation, m.added,me.firstname||' '||me.lastname||'<br>'||me.email AS Sender,"
|
$mysql = "SELECT m.id,mp.confirmation, m.added,me.firstname||' '||me.lastname||'<br>'||me.email AS Sender,"
|
||||||
. "sr.firstname||' '||sr.lastname||'<br>ACC:'||sr.account_no||'-'||be.name AS recipient, m.initiatingamount*0.01 AS Amount,m.fee*0.01 AS Fee, "
|
. "sr.firstname||' '||sr.lastname||'<br>ACC:'||sr.account_no||'-'||be.name AS recipient, m.initiatingamount*0.01 AS Amount,m.fee*0.01 AS Fee, "
|
||||||
. "'<input type=submit id=\"accs'||m.id||'\" onclick=\"return smoneyDetail('||m.id||')\" name=\"manage\" class=\"btn btn-info btn-sm\" value=\"Detail\">' As Detail, "
|
. "'<input type=submit id=\"accs'||m.id||'\" onclick=\"return smoneyDetail('||m.id||')\" name=\"manage\" class=\"btn btn-info btn-sm\" value=\"Detail\">' As Detail, "
|
||||||
. "'<input type=submit id=\"acc'||m.id||'\" onclick=\"return smoneyProcess('||m.id||')\" name=\"manage\" class=\"btn btn-info btn-sm\" value=\"Process\">' As Process "
|
. "'<input type=submit id=\"acc'||m.id||'\" onclick=\"return smoneyProcess('||m.id||')\" name=\"manage\" class=\"btn btn-info btn-sm\" value=\"Process\">' As Process, "
|
||||||
. "FROM money_transfer m "
|
. "m.initiatingamount AS raw_amount, m.fee AS raw_fee, sr.bank_code, sr.account_no "
|
||||||
. "LEFT JOIN members me ON me.id=m.member_id "
|
. "FROM money_transfer m "
|
||||||
. "LEFT JOIN sendmoney_recipient sr ON sr.id=m.recipientid "
|
. "LEFT JOIN members me ON me.id=m.member_id "
|
||||||
. "LEFT JOIN members_payments mp ON mp.what_sendmoney = m.id "
|
. "LEFT JOIN sendmoney_recipient sr ON sr.id=m.recipientid "
|
||||||
. "LEFT JOIN bank_entity_codes be ON be.code=sr.bank_code WHERE m.id=" . $sendmoney_id;
|
. "LEFT JOIN members_payments mp ON mp.what_sendmoney = m.id "
|
||||||
|
. "LEFT JOIN bank_entity_codes be ON be.code=sr.bank_code WHERE m.id=" . $sendmoney_id;
|
||||||
|
|
||||||
$query = $this->db->query($mysql);
|
$query = $this->db->query($mysql);
|
||||||
$row = $query->row_array();
|
$row = $query->row_array();
|
||||||
|
|
||||||
echo $this->sendmoneyProcessPage($row);
|
echo $this->sendmoneyProcessPage($row);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'DETAIL':
|
case 'DETAIL':
|
||||||
|
|
||||||
echo 'detail';
|
echo 'detail';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'TRANSMIT':
|
case 'TRANSMIT':
|
||||||
//echo 'complete 1';
|
//echo 'complete 1';
|
||||||
// url: "/bkotransaction/smprocess?proc=COMPLETE&sendmoney_id="+link_id+'&tcode='+tcode+'&tref='+tref
|
// url: "/bkotransaction/smprocess?proc=COMPLETE&sendmoney_id="+link_id+'&tcode='+tcode+'&tref='+tref
|
||||||
$data["trans_code"] = $this->input->get('tcode');
|
$data["trans_code"] = $this->input->get('tcode');
|
||||||
$data["trans_tref"] = $this->input->get('tref');
|
$data["trans_tref"] = $this->input->get('tref');
|
||||||
$data["sendmoney_id"] = $sendmoney_id;
|
$data["sendmoney_id"] = $sendmoney_id;
|
||||||
$data['action'] = WRENCHBOARD_SMONEY_BKOPROC;
|
$mysql = "SELECT m.id,mp.confirmation, m.added,me.firstname||' '||me.lastname||'<br>'||me.email AS sender,
|
||||||
$data['action_mode'] = SMONEY_PROCC_INTERSWITCH;
|
sr.firstname||' '||sr.lastname||'<br>ACC:'||sr.account_no||'-'||be.name AS recipient,
|
||||||
$this->load->model('backend_model');
|
m.initiatingamount*0.01 AS amount, m.fee*0.01 AS fee,
|
||||||
$out = array();
|
m.initiatingamount AS raw_amount, m.fee AS raw_fee, sr.bank_code, sr.account_no
|
||||||
$this->backend_model->wrenchboard_api($data, $out);
|
FROM money_transfer m
|
||||||
echo $out['status'];
|
LEFT JOIN members me ON me.id=m.member_id
|
||||||
|
LEFT JOIN sendmoney_recipient sr ON sr.id=m.recipientid
|
||||||
|
LEFT JOIN members_payments mp ON mp.what_sendmoney = m.id
|
||||||
|
LEFT JOIN bank_entity_codes be ON be.code=sr.bank_code WHERE m.id=" . $sendmoney_id;
|
||||||
break;
|
|
||||||
|
$query = $this->db->query($mysql);
|
||||||
|
$row = $query->row_array();
|
||||||
|
|
||||||
|
echo $this->sendmoneyProcessPage($row, $data);
|
||||||
|
/*
|
||||||
|
$data['action'] = WRENCHBOARD_SMONEY_BKOPROC;
|
||||||
|
$data['action_mode'] = SMONEY_PROCC_INTERSWITCH;
|
||||||
|
$this->load->model('backend_model');
|
||||||
|
$out = array();
|
||||||
|
$this->backend_model->wrenchboard_api($data, $out);
|
||||||
|
echo $out['status'];
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private function TransmitSendmoneyProcessPage($out) {
|
private function TransmitSendmoneyProcessPage($out) {
|
||||||
|
|
||||||
$myTable = "<form id='sendmoneyProcessPage" . $out['id'] . "' name='sendmoneyProcessPage" . $out['id'] . "'><table class='table table-striped table-hover table-bordered table-condensed'>";
|
$myTable = "<form id='sendmoneyProcessPage" . $out['id'] . "' name='sendmoneyProcessPage" . $out['id'] . "'><table class='table table-striped table-hover table-bordered table-condensed'>";
|
||||||
$myTable .="<tr><td style='width:100px;'><b>Confirmation</b></td><td>" . $out['confirmation'] . "</td></tr>";
|
$myTable .="<tr><td style='width:100px;'><b>Confirmation</b></td><td>" . $out['confirmation'] . "</td></tr>";
|
||||||
$myTable .="<tr><td style='width:100px;'><b>Trx. Date</b></td><td>" . $out['added'] . "</td></tr>";
|
$myTable .="<tr><td style='width:100px;'><b>Trx. Date</b></td><td>" . $out['added'] . "</td></tr>";
|
||||||
$myTable .="<tr><td style='width:100px;'><b>Sender</b></td><td>" . $out['sender'] . "</td></tr>";
|
$myTable .="<tr><td style='width:100px;'><b>Sender</b></td><td>" . $out['sender'] . "</td></tr>";
|
||||||
$myTable .="<tr><td style='width:100px;'><b>Recipient</b></td><td>" . $out['recipient'] . "</td></tr>";
|
$myTable .="<tr><td style='width:100px;'><b>Recipient</b></td><td>" . $out['recipient'] . "</td></tr>";
|
||||||
$myTable .="<tr><td style='width:100px;'><b>Amount</b></td><td>" . $out['amount'] . "</td></tr>";
|
$myTable .="<tr><td style='width:100px;'><b>Amount</b></td><td>" . $out['amount'] . "</td></tr>";
|
||||||
$myTable .="<tr><td style='width:100px;'><b>Fee</b></td><td>" . $out['fee'] . "</td></tr>";
|
$myTable .="<tr><td style='width:100px;'><b>Fee</b></td><td>" . $out['fee'] . "</td></tr>";
|
||||||
|
|
||||||
$myTable .="<tr><td style='width:100px;'><b></b></td><td></td></tr>";
|
$myTable .="<tr><td style='width:100px;'><b></b></td><td></td></tr>";
|
||||||
$myTable .="</table></form> ";
|
$myTable .="</table></form> ";
|
||||||
|
|
||||||
return $myTable;
|
return $myTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sendmoneyProcessPage($out) {
|
private function sendmoneyProcessPage($out, $page=array()) {
|
||||||
|
$data = array(
|
||||||
|
"account_bank" => $out['bank_code'],
|
||||||
|
"account_number" => $out['account_no'],
|
||||||
|
"amount" => $out['raw_amount'],
|
||||||
|
"narration" => $out['sender'],
|
||||||
|
"currency" => "NGN",
|
||||||
|
"reference" => $out['id'],
|
||||||
|
"debit_currency" => "NGN"
|
||||||
|
);
|
||||||
|
$url = "http://localhost:3000/create";
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch,CURLOPT_URL, $url);
|
||||||
|
curl_setopt($ch,CURLOPT_POST, count($data));
|
||||||
|
curl_setopt($ch,CURLOPT_POSTFIELDS, json_encode($data));
|
||||||
|
curl_setopt($ch,CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
|
||||||
|
curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE);
|
||||||
|
$result = curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
$myTable = "<form id='sendmoneyProcessPage" . $out['id'] . "' name='sendmoneyProcessPage" . $out['id'] . "'><table class='table table-striped table-hover table-bordered table-condensed'>";
|
$data = json_decode($result, true);
|
||||||
|
// Error
|
||||||
|
// {"status":"failure","message":"Invalid response","details":"Request failed with status code 400","code":400,"data":{"status":"error","code":"UNAUTHORIZED_ACCESS","message":"Unauthorized access. Compliance approval required to use this feature"}}
|
||||||
|
// Success
|
||||||
|
// ???
|
||||||
|
$page["message"] = "";
|
||||||
|
if ($data == null || $data == "" || (array_key_exists("status",$data) && $data["status"]=="failure")) {
|
||||||
|
if ($data == null || $data == "") {
|
||||||
|
// Invalid response, not clear what is going on (non-JSON response from the payment API)
|
||||||
|
$page["message"] = "Invalid payment API respose: ".htmlentities($result);
|
||||||
|
} else if (array_key_exists("data",$data) && array_key_exists("message",$data["data"])) {
|
||||||
|
// Payment processor message
|
||||||
|
$page["message"] = $data["data"]["message"];
|
||||||
|
} else if (array_key_exists("message",$data)) {
|
||||||
|
// Payment API message
|
||||||
|
$page["message"] = $data["message"];
|
||||||
|
} else {
|
||||||
|
// Not clear what is going on (failure with no messages?)
|
||||||
|
$page["message"] = "Invalid payment API respose: ".htmlentities($result);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// TODO: success
|
||||||
|
}
|
||||||
|
// $page['confirmation']
|
||||||
|
// $page['trans_code']
|
||||||
|
// $data['trans_tref']
|
||||||
|
|
||||||
|
$myTable = "<form id='sendmoneyProcessPage" . $out['id'] . "' name='sendmoneyProcessPage" . $out['id'] . "'>";
|
||||||
|
$myTable .="<span style='font-weight:bold;color:red'>".$page["message"]."</span>";
|
||||||
|
$myTable .="<table class='table table-striped table-hover table-bordered table-condensed'>";
|
||||||
$myTable .="<tr><td style='width:100px;'><b>Confirmation</b></td><td>" . $out['confirmation'] . "</td></tr>";
|
$myTable .="<tr><td style='width:100px;'><b>Confirmation</b></td><td>" . $out['confirmation'] . "</td></tr>";
|
||||||
$myTable .="<tr><td style='width:100px;'><b>Trx. Date</b></td><td>" . $out['added'] . "</td></tr>";
|
$myTable .="<tr><td style='width:100px;'><b>Trx. Date</b></td><td>" . $out['added'] . "</td></tr>";
|
||||||
$myTable .="<tr><td style='width:100px;'><b>Sender</b></td><td>" . $out['sender'] . "</td></tr>";
|
$myTable .="<tr><td style='width:100px;'><b>Sender</b></td><td>" . $out['sender'] . "</td></tr>";
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteBase /svs/api/
|
||||||
|
#RewriteBase /
|
||||||
|
|
||||||
|
#Checks to
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteRule ^(.*)$ index.php?endpoint=$1 [L,NC,QSA]
|
||||||
|
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule !mod_rewrite.c>
|
||||||
|
# If we don't have mod_rewrite installed, all 404's
|
||||||
|
# can be sent to index.php, and everything works as normal.
|
||||||
|
# Submitted by: ElliotHaughin
|
||||||
|
|
||||||
|
ErrorDocument 404 /index.php
|
||||||
|
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<?php
|
||||||
|
include 'index_backend.php';
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
include '../../backend.php';
|
||||||
|
include 'constants.php';
|
||||||
|
include 'formarter.php';
|
||||||
|
|
||||||
|
$endpoints = array(
|
||||||
|
'apigate' => array('POST'),
|
||||||
|
'generics' => array('POST')
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
header("Access-Control-Expose-Headers: Access-Control-Allow-Origin");
|
||||||
|
header("Access-Control-Allow-Headers: Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
|
||||||
|
header("Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS");
|
||||||
|
header('Content-type: application/json');
|
||||||
|
|
||||||
|
if ("OPTIONS" === $_SERVER['REQUEST_METHOD']) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$endpoint = strtolower(str_replace('/svs/user/', '', strtok($_SERVER['REQUEST_URI'], '?')));
|
||||||
|
|
||||||
|
$id = 0; // update, get & delete actions require ID
|
||||||
|
if (substr($endpoint, 0, 19) == 'gettransportrequest' || substr($endpoint, 0, 13) == 'updateprofile') {
|
||||||
|
$endpoint = strtok($endpoint, '/');
|
||||||
|
$id = strtok('/');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($endpoints[$endpoint])) {
|
||||||
|
header('HTTP/1.1 400 Bad Request');
|
||||||
|
header('Status: 400 Bad Request');
|
||||||
|
echo "{\"status\":\"Invalid endpoint url WRB\"}";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$methods = $endpoints[$endpoint];
|
||||||
|
|
||||||
|
if (array_search($_SERVER['REQUEST_METHOD'], $methods) === false) {
|
||||||
|
header('HTTP/1.1 405 Method Not Allowed');
|
||||||
|
header('Status: 405 Method Not Allowed');
|
||||||
|
echo "{\"status\":\"Invalid request method\"}";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
$in = flatten(json_decode(file_get_contents('php://input'), true));
|
||||||
|
}
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "PUT") {
|
||||||
|
parse_str(file_get_contents('php://input'), $in);
|
||||||
|
}
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "GET") {
|
||||||
|
$in = $_GET;
|
||||||
|
}
|
||||||
|
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
||||||
|
switch ($endpoint) {
|
||||||
|
case 'generics':
|
||||||
|
case 'apigate':
|
||||||
|
//$in["action"] = WRENCHBOARD_ACCOUNT_LOGIN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$in["pid"] = 100;
|
||||||
|
$out = array();
|
||||||
|
$ret = $wrenchboard->wrenchboard_api($in, $out);
|
||||||
|
$out['internal_return'] = $ret; // this is reserved array parameter - to be caprured and reoved before you use the out array()
|
||||||
|
|
||||||
|
header("HTTP/1.1 200 OK");
|
||||||
|
header("Status: 200 OK");
|
||||||
|
//$out = array_merge($in, $out); // DEBUG
|
||||||
|
echo json_encode(processOutJson($in, $out));
|
||||||
|
exit();
|
||||||
|
|
||||||
|
function flatten($data, $parentkey = "") {
|
||||||
|
$result = array();
|
||||||
|
foreach ($data as $key => $val) {
|
||||||
|
if (is_array($val)) {
|
||||||
|
$result = array_merge($result, flatten($val, $parentkey . $key . "_"));
|
||||||
|
} else {
|
||||||
|
$result[$parentkey . $key] = $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user