* adjust for sendcloud.
This commit is contained in:
+13
-18
@@ -109,7 +109,7 @@ class adminModel extends model
|
||||
*/
|
||||
public function registerByAPI()
|
||||
{
|
||||
$apiURL = 'http://www.zentao.net/user-register.json';
|
||||
$apiURL = 'http://www.zentao.net/user-register.json?bind=yes&HTTP_X_REQUESTED_WITH=XMLHttpRequest';
|
||||
return $this->postAPI($apiURL, $_POST);
|
||||
}
|
||||
|
||||
@@ -121,17 +121,16 @@ class adminModel extends model
|
||||
*/
|
||||
public function bindByAPI()
|
||||
{
|
||||
$apiURL = 'http://www.zentao.net/user-login.json';
|
||||
$apiURL = 'http://www.zentao.net/user-bindChanzhi.json?HTTP_X_REQUESTED_WITH=XMLHttpRequest';
|
||||
return $this->postAPI($apiURL, $_POST);
|
||||
}
|
||||
|
||||
public function getSecretKey()
|
||||
{
|
||||
//$apiURL = "http://www.zentao.net/user-secretKey.json";
|
||||
$apiURL = "http://www.zentao.cn/user-secretKey.json";
|
||||
$params['account'] = $this->config->global->community;
|
||||
$apiURL = "http://www.zentao.net/user-secretKey.json";
|
||||
$params['u'] = $this->config->global->community;
|
||||
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
||||
$params['signature'] = $this->getSignature($params);
|
||||
$params['k'] = $this->getSignature($params);
|
||||
$this->agent->cookies['lang'] = $this->cookie->lang;
|
||||
$this->agent->fetch($apiURL . '?' . http_build_query($params));
|
||||
$result = $this->agent->results;
|
||||
@@ -142,11 +141,10 @@ class adminModel extends model
|
||||
public function sendCodeByAPI($type)
|
||||
{
|
||||
$module = $type == 'mobile' ? 'sms' : 'mail';
|
||||
// $apiURL = "http://www.zentao.net/{$module}-apiSendCode.json";
|
||||
$apiURL = "http://www.zentao.cn/{$module}-apiSendCode.json";
|
||||
$params['account'] = $this->config->global->community;
|
||||
$apiURL = "http://www.zentao.net/{$module}-apiSendCode.json";
|
||||
$params['u'] = $this->config->global->community;
|
||||
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
||||
$params['signature'] = $this->getSignature($params);
|
||||
$params['k'] = $this->getSignature($params);
|
||||
|
||||
$param = http_build_query($params);
|
||||
return $this->postAPI($apiURL . '?' . $param, $_POST);
|
||||
@@ -155,11 +153,10 @@ class adminModel extends model
|
||||
public function certifyByAPI($type)
|
||||
{
|
||||
$module = $type == 'mobile' ? 'sms' : 'mail';
|
||||
// $apiURL = "http://www.zentao.net/{$module}-apiCertify.json";
|
||||
$apiURL = "http://www.zentao.cn/{$module}-apiCertify.json";
|
||||
$params['account'] = $this->config->global->community;
|
||||
$apiURL = "http://www.zentao.net/{$module}-apiCertify.json";
|
||||
$params['u'] = $this->config->global->community;
|
||||
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
||||
$params['signature'] = $this->getSignature($params);
|
||||
$params['k'] = $this->getSignature($params);
|
||||
|
||||
$param = http_build_query($params);
|
||||
return $this->postAPI($apiURL . '?' . $param, $_POST);
|
||||
@@ -167,11 +164,9 @@ class adminModel extends model
|
||||
|
||||
public function getSignature($params)
|
||||
{
|
||||
ksort($params);
|
||||
$data = '';
|
||||
foreach($params as $key => $value) $data .= $key . '=' . $value . '&';
|
||||
unset($params['u']);
|
||||
$privateKey = $this->config->global->ztPrivateKey;
|
||||
return md5($privateKey . '&' . $data . $privateKey);
|
||||
return md5(http_build_query($params) . md5($privateKey));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user