systeminfo.ctrl.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. load()->model('system');
  8. $dos = array('display', 'get_attach_size');
  9. $do = in_array($do, $dos) ? $do : 'display';
  10. if ($do == 'display') {
  11. $info = array(
  12. 'os' => php_uname(),
  13. 'php' => PHP_VERSION,
  14. 'sapi' => $_SERVER['SERVER_SOFTWARE'] ? $_SERVER['SERVER_SOFTWARE'] : php_sapi_name(),
  15. );
  16. $size = 0;
  17. $size = @ini_get('upload_max_filesize');
  18. if ($size) {
  19. $size = bytecount($size);
  20. }
  21. if ($size > 0) {
  22. $ts = @ini_get('post_max_size');
  23. if ($ts) {
  24. $ts = bytecount($size);
  25. }
  26. if ($ts > 0) {
  27. $size = min($size, $ts);
  28. }
  29. $ts = @ini_get('memory_limit');
  30. if ($ts) {
  31. $ts = bytecount($size);
  32. }
  33. if ($ts > 0) {
  34. $size = min($size, $ts);
  35. }
  36. }
  37. if (empty($size)) {
  38. $size = '';
  39. } else {
  40. $size = sizecount($size);
  41. }
  42. $info['limit'] = $size;
  43. $sql = 'SELECT VERSION();';
  44. $info['mysql']['version'] = pdo_fetchcolumn($sql);
  45. $tables = pdo_fetchall("SHOW TABLE STATUS LIKE '".$_W['config']['db']['tablepre']."%'");
  46. $size = 0;
  47. foreach ($tables as &$table) {
  48. $size += $table['Data_length'] + $table['Index_length'];
  49. }
  50. if (empty($size)) {
  51. $size = '';
  52. } else {
  53. $size = sizecount($size);
  54. }
  55. $info['mysql']['size'] = $size;
  56. $info['attach']['url'] = $_W['attachurl'];
  57. template('system/systeminfo');
  58. }
  59. if ($do == 'get_attach_size') {
  60. $path = IA_ROOT . '/' . $_W['config']['upload']['attachdir'];
  61. $size = dir_size($path);
  62. if (empty($size)) {
  63. $size = '';
  64. } else {
  65. $size = sizecount($size);
  66. }
  67. iajax(0, array('attach_size' => $size));
  68. }