
<?php
if (!defined("WHMCS")) {
die("This file cannot be accessed directly");
}
function httpPostClasor($url,$params) {
$postData = '';
foreach($params as $k => $v) {
$postData .= $k . '='.$v.'&';
}
rtrim($postData, '&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, count($postData));
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$output=curl_exec($ch);
curl_close($ch);
return $output;
}
function clasorcontrol_MetaData()
{
return array(
'DisplayName' => 'Klasör Kontrol Modülü',
'APIVersion' => '1.1', // Use API Version 1.1
);
}
function clasorcontrol_ConfigOptions()
{
return array(
'Sunucu Ip Adresi' => array(
'Type' => 'text',
'Size' => '25',
'Description' => 'Sunucu IP Adresiniz',
),
'Sunucu SSH Portu' => array(
'Type' => 'text',
'Size' => '25',
'Description' => 'Sunucu SSH Bağlantı Portunuz',
'Default' => '22'
),
'Sunucu Şifresi' => array(
'Type' => 'text',
'Size' => '25',
'Description' => 'Sunucu Kullanıcı şifreniz',
),
'Kullanıcı Adı' => array(
'Type' => 'text',
'Size' => '25',
'Default' => 'root',
),
);
}
function clasorcontrol_CreateAccount(array $params)
{
try {
$vds_ip = $params['configoption1'];
$vds_port = $params['configoption2'];
$vds_pass = $params['configoption3'];
$vds_root = $params['configoption4'];
$klasorler = $params['customfields']['Klasorler'];
$array=array("vds_root"=>$vds_root,"vds_ip"=>$vds_ ip,"vds_port"=>$vds_port,"vds_pass"=>$vds_pass,"kl asor"=>$klasorler);
$posted=httpPostClasor("https://www.siteadi.com.tr/lisans/olustur.php",$array);
die($posted);
}
catch (Exception $e) {
// Record the error in WHMCS's module log.
logModuleCall(
'clasorcontrol',
__FUNCTION__,
$params,
$e->getMessage(),
$e->getTraceAsString()
);
return $e->getMessage();
}
return 'success';
}
function clasorcontrol_SuspendAccount(array $params)
{
try {
// Delete Clasor Actions
$vds_ip = $params['configoption1'];
$vds_port = $params['configoption2'];
$vds_pass = $params['configoption3'];
$vds_root = $params['configoption4'];
$klasorler = $params['customfields']['Klasorler'];
$array=array("vds_root"=>$vds_root,"vds_ip"=>$vds_ ip,"vds_port"=>$vds_port,"vds_pass"=>$vds_pass,"kl asor"=>$klasorler);
$posted=httpPostClasor("https://www.siteadi.com.tr/lisans/api.php",$array);
die($posted);
} catch (Exception $e) {
// Record the error in WHMCS's module log.
logModuleCall(
'clasorcontrol',
__FUNCTION__,
$params,
$e->getMessage(),
$e->getTraceAsString()
);
return $e->getMessage();
}
return 'success';
}
function clasorcontrol_UnsuspendAccount(array $params)
{
try {
// No Action
} catch (Exception $e) {
// Record the error in WHMCS's module log.
logModuleCall(
'clasorcontrol',
__FUNCTION__,
$params,
$e->getMessage(),
$e->getTraceAsString()
);
return $e->getMessage();
}
return 'success';
}
function clasorcontrol_TerminateAccount(array $params)
{
try {
if ( function_exists( 'clasorcontrol_terminate_pre' ) ) {
$res = clasorcontrol_terminate_pre( $params );
if( $res['cancel_process'] === true ){
return $_LANG['clasorcontrol_cancel_custom_terminate_process'];
}
}
// Delete Clasor Actions
$vds_ip = $params['configoption1'];
$vds_port = $params['configoption2'];
$vds_pass = $params['configoption3'];
$vds_root = $params['configoption4'];
$klasorler = $params['customfields']['Klasorler'];
$array=array("vds_root"=>$vds_root,"vds_ip"=>$vds_ ip,"vds_port"=>$vds_port,"vds_pass"=>$vds_pass,"kl asor"=>$klasorler);
$posted=httpPostClasor("https://www.siteadi.com.tr/lisans/api.php",$array);
} catch (Exception $e) {
// Record the error in WHMCS's module log.
logModuleCall(
'Terminate Account',
__FUNCTION__,
$params,
$e->getMessage(),
$e->getTraceAsString()
);
return $e->getMessage();
}
return 'success';
}
function clasorcontrol_AdminServicesTabFieldsSave(array $params)
{
// Fetch form submission variables.
$originalFieldValue = isset($_REQUEST['clasorcontrol_original_uniquefieldname'])
? $_REQUEST['clasorcontrol_original_uniquefieldname']
: '';
$newFieldValue = isset($_REQUEST['clasorcontrol_uniquefieldname'])
? $_REQUEST['clasorcontrol_uniquefieldname']
: '';
// Look for a change in value to avoid making unnecessary service calls.
if ($originalFieldValue != $newFieldValue) {
try {
// Call the service's function, using the values provided by WHMCS
// in `$params`.
} catch (Exception $e) {
// Record the error in WHMCS's module log.
logModuleCall(
'clasorcontrol',
__FUNCTION__,
$params,
$e->getMessage(),
$e->getTraceAsString()
);
// Otherwise, error conditions are not supported in this operation.
}
}
}
function clasorcontrol_ClientArea(array $params)
{
// Determine the requested action and set service call parameters based on
// the action.
/*
$requestedAction = isset($_REQUEST['customAction']) ? $_REQUEST['customAction'] : '';
if ($requestedAction == 'manage') {
$serviceAction = 'get_usage';
$templateFile = 'templates/manage.tpl';
} else {
$serviceAction = 'get_stats';
$templateFile = 'templates/overview.tpl';
}
*/
try {
return array(
'tabOverviewReplacementTemplate' => $templateFile,
'templateVariables' => array(
'vers' => $vers
),
);
} catch (Exception $e) {
// Record the error in WHMCS's module log.
logModuleCall(
'clasorcontrol',
__FUNCTION__,
$params,
$e->getMessage(),
$e->getTraceAsString()
);
// In an error condition, display an error page.
return array(
'templateVariables' => array(
'usefulErrorHelper' => $e->getMessage(),
),
);
}
}