This commit is contained in:
2020-07-26 12:39:11 -04:00
parent 5008dff875
commit 013ee3b480
3 changed files with 20 additions and 170 deletions
+14 -14
View File
@@ -68,12 +68,12 @@ class COR_Controller extends CI_Controller {
}
protected function savvy_api($in, &$out) {
global $savvyext;
global $coregrade;
$ret = -1;
$in['pid'] = 115;
$in['backoffice'] = 1;
error_log(json_encode($in));
$out = $savvyext->savvyext_api($in);
$out = $coregrade->coregrade_api($in);
$ret = $out["retval"];
error_log("ret = $ret");
error_log(json_encode($out));
@@ -81,12 +81,12 @@ class COR_Controller extends CI_Controller {
}
protected function main_api_post($endpoint,$payload) {
global $savvyext;
global $coregrade;
$httpAuthToken = $savvyext->cfgReadChar('system.oauth2_token');
$encryptionAlg = $savvyext->cfgReadChar('encryption.algorithm');
$encryptionKey = $savvyext->cfgReadChar('encryption.key');
$encryptionIV = $savvyext->cfgReadChar('encryption.iv');
$httpAuthToken = $coregrade->cfgReadChar('system.oauth2_token');
$encryptionAlg = $coregrade->cfgReadChar('encryption.algorithm');
$encryptionKey = $coregrade->cfgReadChar('encryption.key');
$encryptionIV = $coregrade->cfgReadChar('encryption.iv');
$encrypted_payload = bin2hex(
openssl_encrypt(
@@ -97,7 +97,7 @@ class COR_Controller extends CI_Controller {
$encryptionIV
));
$postdata = "{\"encrypted_payload\": \"${encrypted_payload}\"}";
$url = $savvyext->cfgReadChar('system.api_url').$endpoint;
$url = $coregrade->cfgReadChar('system.api_url').$endpoint;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
@@ -133,14 +133,14 @@ class COR_Controller extends CI_Controller {
}
protected function main_api_get($endpoint,$payload) {
global $savvyext;
global $coregrade;
$httpAuthToken = $savvyext->cfgReadChar('system.oauth2_token');
$encryptionAlg = $savvyext->cfgReadChar('encryption.algorithm');
$encryptionKey = $savvyext->cfgReadChar('encryption.key');
$encryptionIV = $savvyext->cfgReadChar('encryption.iv');
$httpAuthToken = $coregrade->cfgReadChar('system.oauth2_token');
$encryptionAlg = $coregrade->cfgReadChar('encryption.algorithm');
$encryptionKey = $coregrade->cfgReadChar('encryption.key');
$encryptionIV = $coregrade->cfgReadChar('encryption.iv');
$url = $savvyext->cfgReadChar('system.api_url').$endpoint.$payload;
$url = $coregrade->cfgReadChar('system.api_url').$endpoint.$payload;
//echo $url;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");