system.inc.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. if(!defined('IN_DISCUZ')) {
  3. exit('Access Denied');
  4. }
  5. require_once(DISCUZ_ROOT.'source/plugin/milu_seotool/config.inc.php');
  6. sload('F:copyright');
  7. if($_G['adminid'] < 1 ) exit('Access Denied:sb360');
  8. $ac = $_GET['ac'];
  9. if(!empty($ac) && function_exists($ac)) {
  10. if(!in_array($ac, array('plugin_check', 'plugin_download', 'plugin_install'))) exit('Access Denied:sb360');
  11. $info = $ac();
  12. return;
  13. }
  14. $user_arr = get_user_level();
  15. $evo_check_msg = evo_check();
  16. $evo_config_arr = evo_server_config();
  17. $plugin_count_msg = system_count();
  18. function system_count(){
  19. clear_plugin_cache();//缓存定期清理
  20. $spider_count = DB::result(DB::query("SELECT COUNT(*) FROM ".DB::table('milu_seotool_spider')), 0);
  21. $arr['spider']['name'] = stlang('spider_count');
  22. $arr['spider']['show'] = $spider_count.'<a style="padding-left:15px;" href="?'.PLUGIN_GO.'spider&myac=spider_data_clear">'.stlang('spider_data_clear').'</a>';
  23. $arr['spider']['msg'] = stlang('spider_notice');
  24. sload('C:cache');
  25. $cache_info = IO::info(PLUGIN_CACHE, 1, 1);
  26. $arr['cache']['name'] = stlang('cache_file_size');
  27. $arr['cache']['show'] = stlang('cache_size_value', array('s' => sizecount($cache_info['size']), 'p' => PLUGIN_CACHE_SIZE));
  28. $arr['cache']['msg'] = stlang('cache_notice');
  29. return $arr;
  30. }
  31. function clear_plugin_cache(){
  32. sload('C:cache');
  33. $clear_cache = (array)tool_common_get('clear_cache');
  34. $clear_cache = $clear_cache[0];
  35. if( (TIMESTAMP - $clear_cache) < 3600*2 && $del == 0) return;
  36. $cache_info = IO::info(PLUGIN_CACHE);
  37. if($cache_info['size'] > PLUGIN_CACHE_SIZE*1024*1024){
  38. IO::rm(PLUGIN_CACHE);
  39. }
  40. tool_common_set('clear_cache', TIMESTAMP);
  41. }
  42. function evo_check(){
  43. $arr[4]['name'] = stlang('plugin_dir_write');
  44. $arr[4]['check'] = 1;
  45. if(!dir_writeable(PLUGIN_PATH.'/data/cache')){
  46. $arr[4]['check'] = 0;
  47. $arr[4]['msg'] = '<li>'.stlang('dir_no_write', array('dir' => './source/plugin/milu_seotool/data/cache')).'</li>';
  48. }
  49. if($arr[4]['msg']) $arr[4]['msg'] = '<ul id="tipslis">'.$arr[4]['msg'].'</ul>';
  50. $arr[8]['name'] = stlang('open_zend');
  51. if(($zend_re = is_zend()) > 0){
  52. $arr[8]['check'] = 1;
  53. $arr[8]['msg'] = stlang('zend_notice');
  54. }else{
  55. $arr[8]['check'] = 0;
  56. $arr[8]['msg'] = $zend_re == -1 ? stlang('http_visit', array('file' => 'source/plugin/milu_seotool/zend/zendcheck.php')) : stlang('zend_enable');
  57. }
  58. return $arr;
  59. }
  60. //获取服务器参数
  61. function evo_server_config(){
  62. $get = function_exists('ini_get') ? TRUE : FALSE;
  63. $memory_str = $get ? ini_get('memory_limit') : '-1';
  64. if($memory_str >0){
  65. $m = intval($memory_str);
  66. $memory_msg = stlang('memory_notice');
  67. }
  68. $config_arr['php_version'] = array(
  69. 'name' => stlang('phpversion'),
  70. 'value' => phpversion(),
  71. 'msg' => '',
  72. 'best_value' => '',
  73. );
  74. $config_arr['memory_limit'] = array(
  75. 'name' => stlang('php_memory_set'),
  76. 'value' => $memory_str == '-1' ? stlang('un_know') : $memory_str,
  77. 'msg' => $memory_msg,
  78. 'best_value' => '128MB'.stlang('set_up'),
  79. );
  80. $dis_fun = $get ? ini_get("disable_functions") : '-1';
  81. $config_arr['display_function'] = array(
  82. 'name' => stlang('no_use_func'),
  83. 'value' => $dis_fun ? ($dis_fun != '-1' ? $dis_fun : stlang('un_know')) : stlang('no_have'),
  84. );
  85. $max_time = $get ? ini_get("max_execution_time") : '-1';
  86. $config_arr['max_execution_time'] = array(
  87. 'name' => stlang('time_out_time'),
  88. 'value' => $max_time ? ($max_time != '-1' ? $max_time.stlang('sec') : stlang('un_know')) : stlang('no_limit'),
  89. 'best_value' => stlang('no_limit'),
  90. );
  91. return $config_arr;
  92. }
  93. $_GET['tpl'] = $_GET['tpl'] ? $_GET['tpl'] : 'plugin_info';
  94. if($_GET['tpl'] != 'no' && $_GET['tpl']) include template('milu_seotool:'.$_GET['tpl']);
  95. ?>