PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/common/admin/admin_troubleshooting.php

https://code.google.com/
PHP | 143 lines | 117 code | 21 blank | 5 comment | 15 complexity | b3ac4e50fa7e3c638d80fc4ab544373f MD5 | raw file
Possible License(s): AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * @package EDK
  4. */
  5. require_once('common/admin/admin_menu.php');
  6. $page = new Page('Administration - Troubleshooting');
  7. $page->setAdmin();
  8. $sections = array();
  9. $trouble = array();
  10. $sections['Graphics'] = 'Graphics';
  11. if (function_exists('imagecreatefromstring'))
  12. {
  13. $html = ' GD is available.<br />';
  14. $trouble['Graphics'][] = array('passed'=>true, 'text'=> $html);
  15. if (!function_exists('imagecreatetruecolor'))
  16. {
  17. $html = ' Your GD is outdated though and will cause problems, please contact your system administrator to upgrade to GD 2.0 or higher.';
  18. $trouble['Graphics'][] = array('passed'=>false, 'text'=> $html);
  19. }
  20. if (function_exists('imagettftext'))
  21. {
  22. $html = ' FreeType support is enabled';
  23. $trouble['Graphics'][] = array('passed'=>true, 'text'=> $html);
  24. }
  25. else
  26. {
  27. $html = ' Unfortunately you do not have FreeType support so you cannot use all available signatures. :(';
  28. $trouble['Graphics'][] = array('passed'=>false, 'text'=> $html);
  29. }
  30. }
  31. else
  32. {
  33. $html = ' GD is NOT available.<br />The Killboard is unable to output character portraits or corporation logos, please speak with your system administrator to install GD 2.0 or higher.<br />';
  34. $html .= ' However, you can continue to use the Killboard but it might not run smoothly.';
  35. $trouble['Graphics'][] = array('passed'=>false, 'text'=> $html);
  36. }
  37. if (is_writeable(KB_CACHEDIR))
  38. {
  39. $html = ' Cache directory is writeable';
  40. $trouble['Graphics'][] = array('passed'=>true, 'text'=> $html);
  41. }
  42. else
  43. {
  44. $html = ' I cannot write into '.KB_CACHEDIR.'<br />';
  45. $html .= ' Please issue a "chmod 777 '.KB_CACHEDIR.'" and "chmod 777 '.KB_CACHEDIR.'/*" on the commandline inside of this directory<br />';
  46. $trouble['Graphics'][] = array('passed'=>false, 'text'=> $html);
  47. }
  48. // connectivity
  49. $sections['Connectivity'] = 'Connectivity';
  50. $url = 'http://www.evekb.org/';
  51. if (ini_get('allow_url_fopen'))
  52. {
  53. if (count(file($url)))
  54. {
  55. $html = ' allow_url_fopen is available.<br />';
  56. $trouble['Connectivity'][] = array('passed'=>true, 'text'=> $html);
  57. }
  58. else
  59. {
  60. $html = ' I could not get the file, this might be a firewall related issue or the eve-dev server is not available.<br />';
  61. $trouble['Connectivity'][] = array('passed'=>false, 'text'=> $html);
  62. }
  63. }
  64. $http = new http_request($url);
  65. if ($http->get_content())
  66. {
  67. $html = ' Socket Connect is available.';
  68. $trouble['Connectivity'][] = array('passed'=>true, 'text'=> $html);
  69. }
  70. else
  71. {
  72. $html = ' I could not get the file, this might be a firewall related issue or the eve-dev server is not available.<br />';
  73. $trouble['Connectivity'][] = array('passed'=>false, 'text'=> $html);
  74. }
  75. if (extension_loaded('openssl'))
  76. {
  77. $html = ' OpenSSL module is installed.<br />';
  78. $trouble['Connectivity'][] = array('passed'=>true, 'text'=> $html);
  79. }
  80. else
  81. {
  82. $html = ' OpenSSL module is not installed<br />';
  83. $trouble['Connectivity'][] = array('passed'=>false, 'text'=> $html);
  84. }
  85. if(array_search('https', stream_get_wrappers()))
  86. {
  87. $html = ' HTTPS wrapper is installed.';
  88. $trouble['Connectivity'][] = array('passed'=>true, 'text'=> $html);
  89. }
  90. else
  91. {
  92. $html = ' HTTPS wrapper is not installed<br />';
  93. $trouble['Connectivity'][] = array('passed'=>false, 'text'=> $html);
  94. }
  95. //yes this is a mess, pew pew and programming dont mix =P
  96. function find_SQL_Version()
  97. {
  98. $conn = new DBConnection();
  99. $value = (float) mysqli_get_server_info($conn->id());
  100. return $value;
  101. }
  102. $sections['PHP'] = 'PHP';
  103. $phpver = 'PHP version: ' . phpversion();
  104. $html = "$phpver <br />";
  105. if(phpversion() >= "5.1.2") $trouble['PHP'][] = array('passed'=>true, 'text'=> $html);
  106. else $trouble['PHP'][] = array('passed'=>false, 'text'=> $html);
  107. $html = 'Checking Magic Quotes Runtime is disabled';
  108. if(get_magic_quotes_runtime()) {
  109. $trouble['PHP'][] = array('passed'=>false, 'text'=> $html);
  110. } else {
  111. $trouble['PHP'][] = array('passed'=>true, 'text'=> $html);
  112. }
  113. $sections['Server'] = 'Server';
  114. $sqlver = 'MYSQL version: ' . find_SQL_Version();
  115. $html = " $sqlver";
  116. if(find_SQL_Version() >= 5) $trouble['Server'][] = array('passed'=>true, 'text'=> $html);
  117. else $html = $trouble['Server'][] = array('passed'=>false, 'text'=> $html);
  118. $smarty->assignByRef('sections', $sections);
  119. $smarty->assignByRef('trouble', $trouble);
  120. $page->setContent($smarty->fetch(get_tpl('admin_troubleshooting')));
  121. $page->addContext($menubox->generate());
  122. $page->generate();