12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- /**
- * [WeEngine System] Copyright (c) 2014 WE7.CC
- * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
- */
- defined('IN_IA') or exit('Access Denied');
- load()->classs('cloudapi');
- load()->model('cloud');
- load()->model('setting');
- $dos = array('display', 'testapi');
- $do = in_array($do, $dos) ? $do : 'display';
- permission_check_account_user('system_cloud_diagnose');
- if ($do == 'testapi') {
- $starttime = microtime(true);
- $_URLTYPE = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
- $response = cloud_request($_URLTYPE.'HTTP_HOST', array(), array('ip' => $_GPC['ip']));
- $endtime = microtime(true);
- iajax(0,'请求接口成功,耗时 '.(round($endtime - $starttime, 5)).' 秒');
- } else {
- if(checksubmit()) {
- $result = cloud_reset_siteinfo();
- $api = new CloudApi();
- $api->deleteCer();
- if (is_error($result)) {
- itoast($result['message'], '', 'error');
- } else {
- cache_delete('cloud_site_register_info');
- itoast('重置成功', 'refresh', 'success');
- }
- }
- if (checksubmit('updateserverip')) {
- if (!empty($_GPC['ip'])) {
- setting_save(array('ip' => $_GPC['ip'], 'expire' => TIMESTAMP + 201600), 'cloudip');
- } else {
- setting_save(array(), 'cloudip');
- }
- itoast('修改云服务ip成功.', 'refresh', 'success');
- }
- if(empty($_W['setting']['site'])) {
- $_W['setting']['site'] = array();
- }
- $checkips = array();
- if (!empty($_W['setting']['cloudip']['ip'])) {
- $checkips[] = $_W['setting']['cloudip']['ip'];
- }
- if (strexists(strtoupper(PHP_OS), 'WINNT')) {
- $cloudip = gethostbyname('HTTP_HOST');
- if (!in_array($cloudip, $checkips)) {
- $checkips[] = $cloudip;
- }
- } else {
- for ($i = 0; $i <= 10; $i++) {
- $cloudip = gethostbyname('HTTP_HOST');
- if (!in_array($cloudip, $checkips)) {
- $checkips[] = $cloudip;
- }
- }
- }
- template('cloud/diagnose');
- }
|