Subversion Repositories oidplus

Compare Revisions

Regard whitespace Rev 1148 → Rev 1149

/trunk/plugins/viathinksoft/adminPages/400_oidinfo_export/OIDplusPageAdminOIDInfoExport.class.php
109,20 → 109,11
"signature" => base64_encode($signature)
);
 
if (!function_exists('curl_init')) {
throw new OIDplusException(_L('The "%1" PHP extension is not installed at your system. Please enable the PHP extension <code>%2</code>.','CURL','php_curl'));
}
 
if (OIDplus::getEditionInfo()['vendor'] != 'ViaThinkSoft') {
// The oid-info.com import functionality is a confidential API between ViaThinkSoft and oid-info.com and cannot be used in forks of OIDplus
throw new OIDplusException(_L('This feature is only available in the ViaThinkSoft edition of OIDplus'));
}
 
$ch = curl_init();
if (ini_get('curl.cainfo') == '') curl_setopt($ch, CURLOPT_CAINFO, OIDplus::localpath() . 'vendor/cacert.pem');
curl_setopt($ch, CURLOPT_URL, 'https://oidplus.viathinksoft.com/reg2/query.php');
curl_setopt($ch, CURLOPT_USERAGENT, 'ViaThinkSoft-OIDplus/2.0');
curl_setopt($ch, CURLOPT_POST, 1);
if (function_exists('gzdeflate')) {
$compressed = "1";
$data2 = gzdeflate(json_encode($data));
130,14 → 121,19
$compressed = "0";
$data2 = json_encode($data);
}
curl_setopt($ch, CURLOPT_POSTFIELDS, "query=".urlencode($query)."&compressed=$compressed&data=".urlencode(base64_encode($data2)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
if (!($res_curl = @curl_exec($ch))) {
throw new OIDplusException(_L('Communication with ViaThinkSoft server failed: %1',curl_error($ch)));
 
$res_curl = url_post_contents(
'https://oidplus.viathinksoft.com/reg2/query.php',
array(
"query" => $query,
"compressed" => $compressed,
"data" => base64_encode($data2)
)
);
 
if ($res_curl === false) {
throw new OIDplusException(_L('Communication with %1 server failed', 'ViaThinkSoft'));
}
curl_close($ch);
 
$json = @json_decode($res_curl, true);
 
225,20 → 221,11
"signature" => base64_encode($signature)
);
 
if (!function_exists('curl_init')) {
throw new OIDplusException(_L('The "%1" PHP extension is not installed at your system. Please enable the PHP extension <code>%2</code>.','CURL','php_curl'));
}
 
if (OIDplus::getEditionInfo()['vendor'] != 'ViaThinkSoft') {
// The oid-info.com import functionality is a confidential API between ViaThinkSoft and oid-info.com and cannot be used in forks of OIDplus
throw new OIDplusException(_L('This feature is only available in the ViaThinkSoft edition of OIDplus'));
}
 
$ch = curl_init();
if (ini_get('curl.cainfo') == '') curl_setopt($ch, CURLOPT_CAINFO, OIDplus::localpath() . 'vendor/cacert.pem');
curl_setopt($ch, CURLOPT_URL, 'https://oidplus.viathinksoft.com/reg2/query.php');
curl_setopt($ch, CURLOPT_USERAGENT, 'ViaThinkSoft-OIDplus/2.0');
curl_setopt($ch, CURLOPT_POST, 1);
if (function_exists('gzdeflate')) {
$compressed = "1";
$data2 = gzdeflate(json_encode($data));
246,14 → 233,19
$compressed = "0";
$data2 = json_encode($data);
}
curl_setopt($ch, CURLOPT_POSTFIELDS, "query=".urlencode($query)."&compressed=$compressed&data=".urlencode(base64_encode($data2)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
if (!($res_curl = @curl_exec($ch))) {
throw new OIDplusException(_L('Communication with ViaThinkSoft server failed: %1',curl_error($ch)));
 
$res_curl = url_post_contents(
'https://oidplus.viathinksoft.com/reg2/query.php',
array(
"query" => $query,
"compressed" => $compressed,
"data" => base64_encode($data2)
)
);
 
if ($res_curl === false) {
throw new OIDplusException(_L('Communication with %1 server failed', 'ViaThinkSoft'));
}
curl_close($ch);
 
$out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:datatransfer$export').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back to data transfer main page').'</a></p>';
 
506,20 → 498,11
"signature" => base64_encode($signature)
);
 
if (!function_exists('curl_init')) {
throw new OIDplusException(_L('The "%1" PHP extension is not installed at your system. Please enable the PHP extension <code>%2</code>.','CURL','php_curl'));
}
 
if (OIDplus::getEditionInfo()['vendor'] != 'ViaThinkSoft') {
// The oid-info.com import functionality is a confidential API between ViaThinkSoft and oid-info.com and cannot be used in forks of OIDplus
throw new OIDplusException(_L('This feature is only available in the ViaThinkSoft edition of OIDplus'));
}
 
$ch = curl_init();
if (ini_get('curl.cainfo') == '') curl_setopt($ch, CURLOPT_CAINFO, OIDplus::localpath() . 'vendor/cacert.pem');
curl_setopt($ch, CURLOPT_URL, 'https://oidplus.viathinksoft.com/reg2/query.php');
curl_setopt($ch, CURLOPT_USERAGENT, 'ViaThinkSoft-OIDplus/2.0');
curl_setopt($ch, CURLOPT_POST, 1);
if (function_exists('gzdeflate')) {
$compressed = "1";
$data2 = gzdeflate(json_encode($data));
527,14 → 510,19
$compressed = "0";
$data2 = json_encode($data);
}
curl_setopt($ch, CURLOPT_POSTFIELDS, "query=".urlencode($query)."&compressed=$compressed&data=".urlencode(base64_encode($data2)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
if (!($res = @curl_exec($ch))) {
throw new OIDplusException(_L('Communication with ViaThinkSoft server failed: %1',curl_error($ch)));
 
$res = url_post_contents(
'https://oidplus.viathinksoft.com/reg2/query.php',
array(
"query" => $query,
"compressed" => $compressed,
"data" => base64_encode($data2)
)
);
 
if ($res === false) {
throw new OIDplusException(_L('Communication with %1 server failed', 'ViaThinkSoft'));
}
curl_close($ch);
 
$out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:datatransfer$import').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back to data transfer main page').'</a></p>';
 
1172,7 → 1160,7
public function getNotifications(string $user=null): array {
$notifications = array();
if ((!$user || ($user == 'admin')) && OIDplus::authUtils()->isAdminLoggedIn()) {
if (!function_exists('curl_init')) {
if (!url_post_contents_available()) {
$title = _L('OID-Info.com import/export');
$notifications[] = array('ERR', _L('OIDplus plugin "%1" is enabled, but the required PHP extension "%2" is not installed.', '<a '.OIDplus::gui()->link('oidplus:datatransfer').'>'.htmlentities($title).'</a>', 'php_curl'));
}