checkDNS($host); if ($ip) { return sprintf(cplang('cloud_doctor_dns_success'), $host, $ip, $setIP, ADMINSCRIPT); } else { return sprintf(cplang('cloud_doctor_dns_failure'), $host, $setIP, ADMINSCRIPT); } } public function showPlugins() { global $_G; $plugins = array(); $identifiers = array('qqconnect', 'cloudstat', 'soso_smilies', 'cloudsearch', 'security', 'cloudcaptcha', 'cloudunion', 'manyou'); $plugins = C::t('common_plugin')->fetch_all_by_identifier($identifiers); if ($plugins && count($plugins) == count($identifiers)) { $systemPluginStatus = cplang('cloud_doctor_result_success').' '.cplang('available'); } else { $initsysFormHash = substr(md5(substr($_G['timestamp'], 0, -7).$_G['username'].$_G['uid'].$_G['authkey']), 8, 8); $systemPluginStatus = cplang('cloud_doctor_result_failure') . cplang('cloud_doctor_system_plugin_status_false', array('formhash' => $initsysFormHash)); } showtablerow('', array('class="td24"'), array( ''.cplang('cloud_doctor_system_plugin_status').'', $systemPluginStatus )); foreach($plugins as $plugin) { $moduleStatus = cplang('cloud_doctor_plugin_module_error'); $plugin['modules'] = @dunserialize($plugin['modules']); if(is_array($plugin['modules']) && $plugin['modules']) { $moduleStatus = ''; } showtablerow('', array('class="td24"'), array( ''.$plugin['name'].'', cplang('version').' '.$plugin['version'].' '.$moduleStatus )); } } public function showCloudStatus($cloudStatus) { $cloudStatus = intval($cloudStatus); return cplang('cloud_doctor_status_' . $cloudStatus); } public function testAPI($type = 1, $ip = '', $setting = array()) { switch ($type) { case 1: $url = 'http://api.discuz.qq.com/site.php'; $result = dfsockopen($url, 0, '', '', false, $ip ? $ip : $setting['cloud_api_ip'], 5); break; case 2: $url = 'http://api.manyou.com/uchome.php'; $result = dfsockopen($url, 0, 'action=siteRefresh', '', false, $ip ? $ip : $setting['my_ip'], 5); break; case 3: $url = 'http://openapi.qzone.qq.com/oauth/qzoneoauth_request_token'; $result = dfsockopen($url, 0, '', '', false, $ip ? $ip : $setting['connect_api_ip'], 5); if($result) { return true; } break; } $result = trim($result); if(!$result) { return false; } $result = @dunserialize($result); if(!$result) { return false; } return true; } public function showTestJS($type = 1, $ip = '') { $html = sprintf('
', $type, $ip, ADMINSCRIPT); return $html; } public function showAPIJS() { echo ' '; } public function showSiteTestAPIJS($position = 'doctor') { global $_G; require_once DISCUZ_ROOT.'./source/discuz_version.php'; echo ''; } public function showCloudDoctorJS($position = 'doctor') { global $_G; require_once DISCUZ_ROOT.'./source/discuz_version.php'; $url = $_G['siteurl']; $charset = CHARSET; $version = DISCUZ_VERSION; $rand = rand(); $time = time(); $output = << var discuzUrl = '$url'; var discuzCharset = '$charset'; var productVersion = '$version'; var checkPosition = '$position'; var discuzTime = '$time'; EOF; echo $output; } public function fixGuestGroup($name) { $connect = C::t('common_setting')->fetch('connect', true); $guestGroupId = $connect['guest_groupid']; $group = C::t('common_usergroup')->fetch($guestGroupId); if ($group) { return true; } $userGroupData = array( 'type' => 'special', 'grouptitle' => $name, 'allowvisit' => 1, 'color' => '', 'stars' => '', ); $newGroupId = C::t('common_usergroup')->insert($userGroupData, true); $dataField = array( 'groupid' => $newGroupId, 'allowsearch' => 2, 'readaccess' => 1, 'allowgetattach' => 1, 'allowgetimage' => 1, ); C::t('common_usergroup_field')->insert($dataField); $connect['guest_groupid'] = $newGroupId; C::t('common_setting')->update('connect', serialize($connect)); updatecache('usergroups'); } public function checkGuestGroup() { $connect = C::t('common_setting')->fetch('connect', true); $guestGroupId = $connect['guest_groupid']; $group = C::t('common_usergroup')->fetch($guestGroupId); if ($group) { return true; } return false; } public function changeQQUrl() { global $_G; return 'http://cp.discuz.qq.com/platform/changeQQ?s_id='.$_G['setting']['my_siteid'].'&s_site_uid='.$_G['uid']; } }