function.copyright.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. <?php
  2. if(!defined('IN_DISCUZ')) {
  3. exit('Access Denied');
  4. }
  5. if(!defined('V_D')) {
  6. exit('error:V_D no define!');
  7. }
  8. define('VIP', strexists(strtolower(PLUGIN_VERSION), 'vip') ? TRUE : FALSE);
  9. if(VIP) sload('F:vip');
  10. function get_client_info(){
  11. global $_G;
  12. require_once libfile('function/misc');
  13. //if(strtoupper(convertip($_G['clientip'])) == '- LAN') return FALSE;
  14. $re['siteurl'] = $_G['siteurl'];
  15. $re['domain'] = st_get_domain($re['siteurl']);
  16. if(!$re['domain']) return FALSE;
  17. $re['sitename'] = $_G['setting']['bbname'];
  18. $re['version'] = PLUGIN_VERSION;
  19. $re['release'] = V_D;
  20. $re['discuz_version'] = DISCUZ_VERSION;
  21. $re['discuz_release'] = DISCUZ_RELEASE;
  22. return $re;
  23. }
  24. //取得网站的密钥
  25. function get_site_key(){
  26. global $_G;
  27. $client_info = get_client_info();
  28. if(!$client_info || !$client_info['siteurl']) cpmsg_error(stlang('server_no_use'));
  29. $cache_dir = DISCUZ_VERSION != 'X2' ? 'sysdata' : 'cache';
  30. $cachefile = DISCUZ_ROOT.'./data/'.$cache_dir.'/milu_seotool_key.php';
  31. if(file_exists($cachefile)){
  32. @include $cachefile;
  33. $data = unserialize($c_data);
  34. $data['version'] = PLUGIN_VERSION;
  35. if($data['domain'] == $client_info['domain'] && $data['key_code']) return $data;
  36. }
  37. $siteurl = $client_info['siteurl'];
  38. $key_file = PLUGIN_PATH.'/data/milu_seotool_key.php';
  39. file_put_contents($key_file, $_G['timestamp']);
  40. if(!file_exists($key_file)) cpmsg_error(stlang('dir_no_write', array('dir' => PLUGIN_PATH.'/data')));
  41. $msg = dfsockopen(GET_URL.'plugin.php?id=seotool_server:flink&tpl=no&myac=get_key&inajax=1&siteurl='.urlencode($siteurl));
  42. $msg = st_ajax_decode($msg);
  43. if($msg->status == -4) cpmsg_error(stlang('key_code_err4'));
  44. if($msg->status < 1) cpmsg_error(stlang('key_code_err', array('c' => $msg->status)));
  45. @unlink($key_file);
  46. $key_code = $msg->key_code;
  47. $c_data = array('domain' => $client_info['domain'], 'key_code' => $key_code);
  48. writetocache('milu_seotool_key', getcachevars(array('c_data' => serialize($c_data))),'');
  49. $c_data['version'] = PLUGIN_VERSION;
  50. return $c_data;
  51. }
  52. function GetHostInfo($gurl){
  53. $gurl = preg_replace("/^http:\/\//i", "", trim($gurl));
  54. $garr['host'] = preg_replace("/\/(.*)$/i", "", $gurl);
  55. $garr['query'] = "/".preg_replace("/^([^\/]*)\//i", "", $gurl);
  56. return $garr;
  57. }
  58. function get_user_system(){
  59. $c_info = get_client_info();
  60. $url = GET_URL.'plugin.php?id=seotool_server:pick_user&myac=auth&detail=1&domain='.urlencode($c_info['domain']).'&siteurl='.urlencode($c_info['siteurl']).'&version='.PLUGIN_VERSION.'&discuz_version='.DISCUZ_VERSION.'&discuz_release='.DISCUZ_RELEASE.'&release='.V_D.'&sitename='.urlencode($c_info['sitename']);
  61. return st_get_contents($url, array('cache' => -1));
  62. }
  63. function get_user_level(){
  64. global $_G;
  65. $status = 0;
  66. $name = stlang('free_user');
  67. $file_name = PLUGIN_DIR.'/data/plugin_auth.txt';
  68. $msg_arr = array();
  69. $vip_show = '<img border="0" src="'.PLUGIN_URL.'/static/image/vip.gif" /> '.stlang('vip_user').' ';
  70. $msg_arr = get_user_system();
  71. if($msg_arr < 0){
  72. $status = -1;
  73. $name = stlang('no_query_info');
  74. }
  75. $web_qq = st_get_contents(GET_URL.'plugin.php?id=seotool_server:upgrade&myac=get_qq&tpl=no', array('cache' => 3600*24*2) );
  76. $msg_arr = unserialize($msg_arr);
  77. extract($msg_arr);
  78. $show_use_time = $exp_dateline ? " ".stlang('no_user_dateline').":<font style='color:#09C'>".dgmdate($exp_dateline).'</font>' : '';
  79. if($msg == 'succeed'){
  80. dsetcookie('plugin_auth', $msg, -1);
  81. $show_use_time = $show_use_time ? $show_use_time : stlang('forever_use');
  82. $name = $vip_show.$show_use_time;
  83. $status = 1;
  84. }else if($msg == 'timeout'){
  85. @unlink($file_name);
  86. $name = stlang('no_free_use');
  87. $status = -2;
  88. }else if($msg == 'free' || $msg == 'first'){//如果是免费版本
  89. if(VIP){
  90. $status = 2;
  91. $name = stlang('free_use').' '.$show_use_time;
  92. }
  93. }else{
  94. $status = -3;
  95. if($msg == 'error'){
  96. $why = stlang('lan_network');
  97. }else{
  98. $why = stlang('no_conn_server');
  99. }
  100. $name = stlang('user_no_query').' ('.$why.')';
  101. }
  102. if($status < 0){
  103. $show_upgrade = '';//服务器网络限制,无法检测升级
  104. }else{
  105. $show_upgrade = VIP ? '<a href="?'.PLUGIN_GO.'system&ac=plugin_check">'.stlang('check_new').'</a>' : '<a href="?'.PLUGIN_GO.'system&ac=plugin_check">'.stlang('up_to_vip').'</a>';
  106. }
  107. $re['show_user_name'] = $name;
  108. $re['show_upgrade'] = $show_upgrade;
  109. $re['status'] = $status;
  110. $re['web_qq'] = $web_qq;
  111. return $re;
  112. }
  113. function version_check(){
  114. global $_G;
  115. $check = $_G['cache']['plugin']['milu_seotool']['check_version'];
  116. if(!VIP || $check != 1) return FALSE;
  117. $get_site = GET_URL;
  118. $client_info = get_client_info();
  119. if(!$client_info || !$client_info['domain']) return;
  120. $tips_arr = tool_common_get('plugin_tips');
  121. if($tips_arr['check_version']) return;
  122. if(st_load_cache('check_version')) return;
  123. $url = GET_URL.'plugin.php?id=seotool_server:upgrade&myac=check_version&tpl=no&php_version='.phpversion().'&version='.$client_info['version'].'&release='.$client_info['release'];
  124. $result = st_get_contents($url, array('cache' => -1));
  125. st_cache_data('check_version', 'ok', 5*3600);
  126. if($result == 'ok'){
  127. return seoOutput::show_tips('<div class="tipsblock"><li>'.stlang('have_new_version', array('url' => '?'.PLUGIN_GO.'system&ac=plugin_check&checking=1')).'</li></ul></div>', array('key' => 'check_version', 'w' => 380, 'h' => 250));
  128. }
  129. }
  130. function plugin_check(){
  131. global $_G;
  132. if(!$_GET['checking']) cpmsg(stlang('upgrade_checking'), PLUGIN_GO.'system&ac=plugin_check&checking=1', 'loading', '', false);
  133. $zend_check = is_zend();
  134. if($zend_check == -1){
  135. cpmsg_error(lang('plugin/milu_seotool','http_visit', array('file' => 'source/plugin/milu_seotool/zend/zendcheck.php')) );
  136. }else if($zend_check == -2){
  137. cpmsg_error(lang('plugin/milu_seotool', 'zend_enable'));
  138. }
  139. $key_file = PLUGIN_PATH.'/data/key.php';
  140. file_put_contents($key_file, $_G['timestamp']);
  141. if(!file_exists($key_file)) cpmsg_error(stlang('dir_no_write', array('dir' => PLUGIN_PATH.'/data')));
  142. $get_site = GET_URL;
  143. $client_info = get_client_info();
  144. if(!$client_info || !$client_info['domain']) cpmsg_error(stlang('lan_upgrage'));
  145. $url = GET_URL.'plugin.php?id=seotool_server:upgrade&myac=upgrade_check&tpl=no&get_type=1&php_version='.phpversion().'&domain='.urlencode($client_info['domain']).'&version='.$client_info['version'].'&release='.$client_info['release'].'&siteurl='.urlencode($client_info['siteurl']);
  146. $msg_arr = st_get_contents($url, array('cache' => -1));
  147. @unlink($key_file);
  148. if($msg_arr < 0) cpmsg_error(stlang('no_conn_up'));
  149. $msg_arr = json_decode(base64_decode($msg_arr));
  150. $status = $msg_arr->status;
  151. if(!$status) {
  152. cpmsg_error(stlang('up_no_err'));
  153. }
  154. if($status == -1) {
  155. cpmsg_error(stlang('up_no_free'));
  156. }else if($status == -2) {
  157. cpmsg_error(stlang('up_no_set_err'));
  158. }else if($status == -3){
  159. cpmsg_error(stlang('up_newed'));
  160. }else if($status == -4 || !$msg_arr->key){
  161. cpmsg_error(stlang('no_normal_up'));
  162. }else{
  163. $version_desc = base64_decode(dstripslashes($msg_arr->version_desc));
  164. $msg_arr->version_filename = base64_decode(dstripslashes($msg_arr->version_filename));
  165. }
  166. echo '<link href="'.PLUGIN_URL.'static/style.css?v='.PLUGIN_VERSION.'" rel="stylesheet" type="text/css" />';
  167. echo '<table class="tb tb2 ">
  168. <tbody><tr class="header hover"><td>'.stlang('check_have_new').'</td><td></td><td></td></tr>
  169. <tr class="hover"><td>DXC '.$msg_arr->version.stlang('version').' [Release '.$msg_arr->version_dateline.']</td><td><input type="button" class="btn" onclick="confirm(\''.stlang('cofirm_up').'\') ? window.location.href=\'?'.PLUGIN_GO.'system&ac=plugin_download&tpl=no&md5_total='.$msg_arr->version_md5total.'&key='.$msg_arr->key.'\' : \'\';" value="'.stlang('auto_up').'"></td><td><a href="'.$msg_arr->version_filename.'" target="_blank">'.stlang('no_auto_up').'</a></td></tr></tbody></table>';
  170. if($version_desc){
  171. $version_desc = $version_desc ? $version_desc : stlang('no_have');
  172. echo '<p class="partition">'.stlang('up_notice').'</p><div id="show_upgrade_info" class="showmess"><p>'.st_str_iconv($version_desc).'</p></div>';
  173. }
  174. exit();
  175. }
  176. function plugin_download(){
  177. $client_info = get_client_info();
  178. $version_md5total = $_GET['md5_total'];
  179. $key = $_GET['key'];
  180. $version = $_GET['version'];
  181. $version_dateline = $_GET['version_dateline'];
  182. $i = intval($_GET['i']);
  183. if(!$client_info) cpmsg_error(stlang('lan_upgrage'));
  184. $p = intval($_GET['p']);
  185. $count = $_GET['count'];
  186. $file_md5 = $_GET['file_md5'];
  187. $tmpdir = DISCUZ_ROOT.'./data/download/dxc_temp';
  188. sload('C:cache');
  189. $md5s = array();
  190. $str = $_SERVER['QUERY_STRING'];
  191. if($p == 0) {
  192. dir_clear($tmpdir);
  193. st_cache_del('new_version_md5total');
  194. dmkdir($tmpdir, 0777, false);
  195. cpmsg(stlang('diff_upgrade_file'), PLUGIN_GO.'system&ac=plugin_download&key='.$key.'&p=1', 'loading', '', false);
  196. }else if($p == 1){
  197. $url = GET_URL.'plugin.php?id=seotool_server:upgrade&myac=download_file&php_version='.phpversion().'&tpl=no&domain='.urlencode($client_info['domain']).'&key='.$key.'&file_md5='.$file_md5;
  198. $data = st_get_contents($url, array('cache' => -1));
  199. if(!$data || $data == '-1' ) cpmsg_error(stlang('no_normal_get'));
  200. $msg_arr = (array)json_decode(base64_decode($data));
  201. if(!$_GET['file_md5']){
  202. $download_file_data = upgrade_file_diff($msg_arr['md5']);
  203. $md5_temp_arr = array_keys($download_file_data);
  204. $version_md5total = md5((implode('', $md5_temp_arr)));
  205. $count = count($download_file_data);
  206. $version = $version ? $version : $msg_arr['Version'];
  207. $version_dateline = $version_dateline ? $version_dateline : $msg_arr['version_dateline'];
  208. }else{
  209. $download_file_data = st_load_cache('download_file_data');
  210. $new_version_md5total = st_load_cache('new_version_md5total');
  211. $filename = $tmpdir.'/'.$msg_arr['file'].'._addons_';
  212. $dirname = dirname($filename);
  213. dmkdir($dirname, 0777, false);
  214. $fp = fopen($filename, 'w');
  215. if(!$fp) {
  216. cpmsg('cloudaddons_download_write_error', '', 'error');
  217. }
  218. if($msg_arr['text']) {
  219. fwrite($fp, gzuncompress(base64_decode($msg_arr['text'])));
  220. fclose($fp);
  221. }else{
  222. cpmsg('cloudaddons_download_write_error', '', 'error');
  223. }
  224. if($msg_arr['MD5']) {
  225. $new_version_md5total[$i] = $msg_arr['MD5'];
  226. if($msg_arr['MD5'] != md5_file($filename)) {
  227. dir_clear($tmpdir);
  228. cpmsg(stlang('cloudaddons_download_error'), '', 'error');//数据下载错误
  229. }
  230. }else{
  231. cpmsg_error(stlang('no_normal_get').'error203');
  232. }
  233. }
  234. $file_md5_arr = array_keys($download_file_data);
  235. $file_md5 = $file_md5_arr[$i];
  236. $file = $download_file_data[$file_md5];
  237. $p = $i == $count ? 2 : 1;
  238. $percent = $i/$count;
  239. $percent = sprintf("%01.0f", $percent*100).'%';
  240. st_cache_data('download_file_data', $download_file_data);
  241. st_cache_data('new_version_md5total', $new_version_md5total);
  242. cpmsg(stlang('pick_upgrade_downloading_file', array('file' => $file, 'percent' => $percent)), PLUGIN_GO.'system&ac=plugin_download&i='.($i+1).'&md5_total='.$version_md5total.'&key='.$key.'&p='.$p.'&version='.$version.'&version_dateline='.$version_dateline.'&count='.$count.'&file_md5='.$file_md5, 'loading', '', false);
  243. }else if($p == 2){
  244. if(!$_GET['new_md5_total']){
  245. $new_version_md5total = st_load_cache('new_version_md5total');
  246. $new_version_md5total = implode('', $new_version_md5total);
  247. }else{
  248. $new_version_md5total = $_GET['new_md5_total'];
  249. }
  250. if($new_version_md5total !== '' && md5($new_version_md5total) !== $version_md5total) {
  251. dir_clear($tmpdir);
  252. cpmsg(stlang('cloudaddons_download_error'), '', 'error');//数据下载错误
  253. }
  254. cpmsg(stlang('_installing'), PLUGIN_GO.'system&ac=plugin_install&version='.$version.'&version_dateline='.$version_dateline, 'loading', '', false);
  255. }
  256. }
  257. function upgrade_file_diff($md5_data){
  258. $md5_data = (array) $md5_data;
  259. if(!$md5_data) return array();
  260. foreach($md5_data as $k => $v){
  261. if(md5(file_get_contents(PLUGIN_DIR.'/'.$v)) == $k) unset($md5_data[$k]);
  262. }
  263. return $md5_data;
  264. }
  265. function plugin_install(){
  266. global $_G;
  267. $tmpdir = DISCUZ_ROOT.'./data/download/dxc_temp';
  268. if(!is_dir($tmpdir)) {
  269. cpmsg(stlang('cloudaddons_download_error'), '', 'error');//数据下载错误
  270. }
  271. $_GET['type'] = 'plugin';
  272. $_GET['key'] = 'milu_seotool';
  273. $to_version = $_GET['version'];
  274. $to_version_dateline = $_GET['version_dateline'];
  275. if(!libfile('function/cloudaddons')) exit('error01:file not found');
  276. require_once libfile('function/cloudaddons');
  277. $descdir = DISCUZ_ROOT.'source/plugin/';
  278. $subdir = 'milu_seotool';
  279. $unwriteabledirs = cloudaddons_dirwriteable($descdir, $subdir, $tmpdir);
  280. if($unwriteabledirs) {//目录不可写
  281. showtips(stlang('cloudaddons_unwriteabledirs', array('basedir' => 'source/plugin', 'unwriteabledirs' => implode(', ', $unwriteabledirs))));
  282. exit;
  283. }
  284. $descdir .= $subdir;
  285. cloudaddons_comparetree($tmpdir, $descdir, $tmpdir, $_GET['key'].'.'.$_GET['type'].'vip', 1);
  286. if(!empty($_G['treeop']['oldchange']) && empty($_GET['confirmed'])) {
  287. cpmsg(stlang('cloudaddons_install_files_changed', array('files' => implode('<br />', $_G['treeop']['oldchange']))), '', 'form', '');
  288. }
  289. cloudaddons_copytree($tmpdir, $descdir);
  290. $client_info = get_client_info();
  291. $_GET['end'] = 'Status=End&ID=milu_seotool_vip.plugin&SN='.$client_info['domain'].'&RevisionID='.$client_info['domain'].'&RevisionDateline='.$client_info['domain'];
  292. cloudaddons_savemd5($_GET['key'].'.'.$_GET['type'].'vip', $_GET['end'], $_G['treeop']['md5']);
  293. cloudaddons_deltree($tmpdir);
  294. //成功之后的一些动作
  295. $set['check_version'] = 0;
  296. tool_common_set('plugin_tips', $set);
  297. $charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
  298. $locale = '';
  299. if($charset == 'BIG5') {
  300. $locale = 'TC';
  301. } elseif($charset == 'GBK') {
  302. $locale = 'SC';
  303. } elseif($charset == 'UTF8') {
  304. if($_G['config']['output']['language'] == 'zh_cn') {
  305. $locale = 'SC';
  306. } elseif($_G['config']['output']['language'] == 'zh_tw') {
  307. $locale = 'TC';
  308. }
  309. }
  310. $xml_ext = 'discuz_plugin_milu_seotool_'.$locale.'_'.$charset.'.xml';
  311. $xml_file = $descdir.'/'.$xml_ext;
  312. if(!file_exists($xml_file)) cpmsg(stlang('xml_no_found', array('f' => $xml_ext)), '', 'error');//xml文件丢失
  313. require_once libfile('class/xml');
  314. $data = file_get_contents($xml_file);
  315. $data_arr = xml2array($data);
  316. $xml_data = exportarray($data_arr['Data'], 0);
  317. $installtype = $locale.'_'.$charset;
  318. pluginupgrade($xml_data, $installtype);
  319. $auth_file = PLUGIN_DIR.'/data/plugin_auth.txt';
  320. $upgrade_file = $descdir.'/upgrade.php';
  321. if(file_exists($upgrade_file)) {
  322. $_GET['fromversion'] = PLUGIN_VERSION;
  323. include($upgrade_file);
  324. if(!$finish) cpmsg_error(stlang('up_fail'));
  325. }
  326. @unlink($auth_file);
  327. cpmsg('plugins_upgrade_succeed', PLUGIN_GO."system", 'succeed', array('toversion' => $to_version.' '.$to_version_dateline));
  328. }
  329. function num_limit($table_name, $limit_num, $lang){
  330. $f_num = DB::result(DB::query("SELECT COUNT(*) FROM ".DB::table($table_name)), 0);
  331. if(!VIP && $f_num > $limit_num) cpmsg_error(stlang($lang, array('n' => $limit_num)));
  332. }
  333. class RootDomain{
  334. private static $self;
  335. private $domain=null;
  336. private $host=null;
  337. private $state_domain;
  338. private $top_domain;
  339. /**
  340. * 取得域名分析实例
  341. * Enter description here ...
  342. */
  343. public static function instace(){
  344. if(!self::$self)
  345. self::$self=new self();
  346. return self::$self;
  347. }
  348. private function __construct(){
  349. $this->state_domain = array(
  350. 'al','dz','af','ar','ae','aw','om','az','eg','et','ie','ee','ad','ao','ai','ag','at','au','mo','bb','pg','bs','pk','py','ps','bh','pa','br','by','bm','bg','mp','bj','be','is','pr','ba','pl','bo','bz','bw','bt','bf','bi','bv','kp','gq','dk','de','tl','tp','tg','dm','do','ru','ec','er','fr','fo','pf','gf','tf','va','ph','fj','fi','cv','fk','gm','cg','cd','co','cr','gg','gd','gl','ge','cu','gp','gu','gy','kz','ht','kr','nl','an','hm','hn','ki','dj','kg','gn','gw','ca','gh','ga','kh','cz','zw','cm','qa','ky','km','ci','kw','cc','hr','ke','ck','lv','ls','la','lb','lt','lr','ly','li','re','lu','rw','ro','mg','im','mv','mt','mw','my','ml','mk','mh','mq','yt','mu','mr','us','um','as','vi','mn','ms','bd','pe','fm','mm','md','ma','mc','mz','mx','nr','np','ni','ne','ng','nu','no','nf','na','za','aq','gs','eu','pw','pn','pt','jp','se','ch','sv','ws','yu','sl','sn','cy','sc','sa','cx','st','sh','kn','lc','sm','pm','vc','lk','sk','si','sj','sz','sd','sr','sb','so','tj','tw','th','tz','to','tc','tt','tn','tv','tr','tm','tk','wf','vu','gt','ve','bn','ug','ua','uy','uz','es','eh','gr','hk','sg','nc','nz','hu','sy','jm','am','ac','ye','iq','ir','il','it','in','id','uk','vg','io','jo','vn','zm','je','td','gi','cl','cf','cn','yr', 'co.nz'
  351. );
  352. $this->top_domain=array('com','arpa','edu','gov','int','mil','net','org','biz','info','pro','name','museum','coop','aero','xxx','idv','me','mobi');
  353. }
  354. public function setUrl( $url = ''){
  355. if(empty($url)) FALSE;;
  356. if(!preg_match("/^http:/is", $url))
  357. $url="http://".$url;
  358. $url=parse_url(strtolower($url));
  359. $urlarr=explode(".", $url['host']);
  360. $count=count($urlarr);
  361. if ($count<=2){
  362. $this->domain=$url['host'];
  363. }else if ($count>2){
  364. $last=array_pop($urlarr);
  365. $last_1=array_pop($urlarr);
  366. if(in_array($last, $this->top_domain)){
  367. $this->domain=$last_1.'.'.$last;
  368. $this->host=implode('.', $urlarr);
  369. }else if(in_array($last_1.'.'.$last, $this->state_domain)){
  370. $last_2=array_pop($urlarr);
  371. $this->domain=$last_2.'.'.$last_1.'.'.$last;
  372. $this->host=implode('.', $urlarr);
  373. }else if (in_array($last, $this->state_domain)){
  374. $last_2=array_pop($urlarr);
  375. if(in_array($last_1, $this->top_domain)){
  376. $this->domain=$last_2.'.'.$last_1.'.'.$last;
  377. $this->host=implode('.', $urlarr);
  378. }else{
  379. $this->host=implode('.', $urlarr).$last_2;
  380. $this->domain=$last_1.'.'.$last;
  381. }
  382. }
  383. }
  384. return $this;
  385. }
  386. public function getDomain(){
  387. return $this->domain;
  388. }
  389. public function getHost(){
  390. return $this->host;
  391. }
  392. }
  393. function tips_no($key = ''){
  394. $key = $key ? $key : $_GET['key'];
  395. $set[$key] = 1;
  396. tool_common_set('plugin_tips', $set);
  397. return 'ok';
  398. }
  399. function is_zend(){
  400. global $_G;
  401. if(VIP) return 1;//如果是vip不检测
  402. if(file_exists(DISCUZ_ROOT.'/api/addons/zendcheck.php')){
  403. $zend_check = dfsockopen($_G['siteurl'].'api/addons/zendcheck.php');//discuz自带的zend检测文件大部分用户因为没有用二进制上传而导致文件无效。所以根据这个来判断并不准确
  404. if($zend_check){
  405. preg_match('/s=\'(.*?)\';v=\'(.*?)\';/is', $zend_check, $v_arr);
  406. if($v_arr[1] == 'OK') return 1;
  407. }
  408. }
  409. if (extension_loaded('Zend Optimizer') || extension_loaded('Zend Guard Loader') || get_cfg_var("zend_extension")||get_cfg_var("zend_optimizer.optimization_level")||get_cfg_var("zend_extension_manager.optimizer_ts")||get_cfg_var("zend_extension_ts")){
  410. return 1;
  411. }
  412. return -2;
  413. }
  414. ?>