* change for bind sendcloud.
This commit is contained in:
@@ -47,7 +47,10 @@ class admin extends control
|
||||
*/
|
||||
public function ignore()
|
||||
{
|
||||
$this->loadModel('setting')->setItem('system.common.global.community', 'na');
|
||||
$this->loadModel('setting');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=community');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=ztPrivateKey');
|
||||
$this->setting->setItem('system.common.global.community', 'na');
|
||||
die(js::locate(inlink('index'), 'parent'));
|
||||
}
|
||||
|
||||
@@ -57,16 +60,26 @@ class admin extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
public function register($from = 'admin')
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$response = $this->admin->registerByAPI();
|
||||
if($response == 'success')
|
||||
$response = json_decode($response);
|
||||
if($response->result == 'success')
|
||||
{
|
||||
$this->loadModel('setting')->setItem('system.common.global.community', $this->post->account);
|
||||
$user = json_decode($response->data);
|
||||
$data['community'] = $user->account;
|
||||
$data['ztPrivateKey'] = $user->privateKey;
|
||||
|
||||
$this->loadModel('setting');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=community');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=ztPrivateKey');
|
||||
$this->setting->setItems('system.common.global', $data);
|
||||
|
||||
echo js::alert($this->lang->admin->register->success);
|
||||
die(js::locate(inlink('index'), 'parent'));
|
||||
if($from == 'admin') die(js::locate(inlink('index'), 'parent'));
|
||||
if($from == 'mail') die(js::locate($this->createLink('mail', 'ztcloud'), 'parent'));
|
||||
}
|
||||
die($response);
|
||||
}
|
||||
@@ -75,6 +88,7 @@ class admin extends control
|
||||
$this->view->position[] = $this->lang->admin->register->caption;
|
||||
$this->view->register = $this->admin->getRegisterInfo();
|
||||
$this->view->sn = $this->config->global->sn;
|
||||
$this->view->from = $from;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -84,7 +98,7 @@ class admin extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function bind()
|
||||
public function bind($from = 'admin')
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
@@ -92,9 +106,18 @@ class admin extends control
|
||||
$response = json_decode($response);
|
||||
if($response->result == 'success')
|
||||
{
|
||||
$this->loadModel('setting')->setItem('system.common.global.community', $this->post->account);
|
||||
$user = $response->data;
|
||||
$data['community'] = $user->account;
|
||||
$data['ztPrivateKey'] = $user->privateKey;
|
||||
|
||||
$this->loadModel('setting');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=community');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=ztPrivateKey');
|
||||
$this->setting->setItems('system.common.global', $data);
|
||||
|
||||
echo js::alert($this->lang->admin->bind->success);
|
||||
die(js::locate(inlink('index'), 'parent'));
|
||||
if($from == 'admin') die(js::locate(inlink('index'), 'parent'));
|
||||
if($from == 'mail') die(js::locate($this->createLink('mail', 'ztcloud'), 'parent'));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -105,6 +128,7 @@ class admin extends control
|
||||
$this->view->title = $this->lang->admin->bind->caption;
|
||||
$this->view->position[] = $this->lang->admin->bind->caption;
|
||||
$this->view->sn = $this->config->global->sn;
|
||||
$this->view->from = $from;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -192,4 +216,64 @@ class admin extends control
|
||||
$this->view->code = isset($this->config->sso->code) ? $this->config->sso->code : '';
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function certifyZtEmail($email = '')
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$this->admin->certifyByAPI('mail');
|
||||
die(js::locate($this->createLink('mail', 'ztCloud'), 'parent'));
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->admin->certifyEmail;
|
||||
$this->view->position[] = $this->lang->admin->certifyEmail;
|
||||
|
||||
$this->view->email = helper::safe64Decode($email);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function certifyZtMobile($mobile = '')
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$this->admin->certifyByAPI('mobile');
|
||||
die(js::locate($this->createLink('mail', 'ztCloud'), 'parent'));
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->admin->certifyMobile;
|
||||
$this->view->position[] = $this->lang->admin->certifyMobile;
|
||||
|
||||
$this->view->mobile = helper::safe64Decode($mobile);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function ajaxSendCode($type)
|
||||
{
|
||||
die($this->admin->sendCodeByAPI($type));
|
||||
}
|
||||
|
||||
public function sendmail()
|
||||
{
|
||||
$url = 'http://api.sendcloud.net/apiv2/mail/send';
|
||||
$params['apiUser'] = 'zentao_chunsheng';
|
||||
$params['apiKey'] = 'I70rz0E5Org4N3jU';
|
||||
$params['from'] = '876333172@qq.com';
|
||||
$params['fromName'] = 'QQ';
|
||||
$params['to'] = 'wyd621@163.com';
|
||||
$params['subject'] = 'test';
|
||||
$params['html'] = 'test';
|
||||
|
||||
$data = http_build_query($params);
|
||||
|
||||
$options['http'] = array(
|
||||
'method' => 'POST',
|
||||
'header' => 'Content-Type: application/x-www-form-urlencoded',
|
||||
'content' => $data
|
||||
);
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, FILE_TEXT, $context);
|
||||
|
||||
a($result);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user