status.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?php
  2. /*
  3. *
  4. * OGP - Open Game Panel
  5. * Copyright (C) 2008 - 2018 The OGP Development Team
  6. *
  7. * http://www.opengamepanel.org/
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. */
  24. function numbersFormatting($bytes){
  25. $si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
  26. $base = 1024;
  27. $class = min((int)log($bytes , $base) , count($si_prefix) - 1);
  28. return sprintf('%1.2f' , $bytes / pow($base,$class)) . ' ' . $si_prefix[$class];
  29. }
  30. function exec_ogp_module()
  31. {
  32. global $db;
  33. include_once ("modules/status/include/status_functions.php");
  34. include_once ("modules/status/config.php");
  35. include_once ("modules/status/include/os.php");
  36. //CPU Usage
  37. if ($modulecpu == "1") {
  38. include_once ("modules/status/include/cpu.php");
  39. }
  40. //RAM Usage
  41. if ($modulememory == "1") {
  42. include_once ("modules/status/include/ram.php");
  43. }
  44. //HDD Space
  45. if ($modulestorage == "1") {
  46. include_once ("modules/status/include/hdd.php");
  47. }
  48. //System Uptime
  49. if ($modulesystemuptime == "1")
  50. {
  51. include_once ("modules/status/include/uptime.php");
  52. }
  53. // System task information snapshot
  54. if ($modulesystemtasks == "1")
  55. {
  56. include_once ("modules/status/include/task.php");
  57. }
  58. if ($modulesystemuptime == "1")
  59. {
  60. echo "<div id=\"column4\" style=\"font-size:12pt;width:59%;float:left;margin-left:1%;\" >
  61. <div class=\"dragbox bloc rounded\" >
  62. <h4>".get_lang('system_uptime')."</h4>
  63. <div class=\"dragbox-content\">
  64. <center>
  65. <b>".get_lang('system_up_time').": " . @$indexuptime . "<br>
  66. ".get_lang('system_up_since').": " . @$indexuptimesince . "
  67. </b></center>
  68. </div>
  69. </div>
  70. </div>";
  71. }
  72. if (extension_loaded('gd')) {
  73. if ($modulecpu == "1" and $nocpushow != "1")
  74. {
  75. echo "<div id=\"column4\" style=\"width:49.5%;float:right;margin-top:1%;\" >
  76. <div class=\"dragbox bloc rounded\">
  77. <h4>".get_lang('cpu_usage')."</h4>
  78. <div class=\"dragbox-content\">";
  79. ksort($cores);
  80. foreach($cores as $cpu => $percent)
  81. {
  82. echo "<b>CPU" . $cpu . " ".get_lang('cpu_load').": " . $percent . " %</b><br>";
  83. drawBarDiv($percent, "CPU" . $cpu);
  84. }
  85. echo '</div>
  86. </div>
  87. </div>';
  88. }
  89. if ($modulememory == "1") {
  90. echo "<div id=\"column4\" style=\"width:49.5%;float:left;margin-top:1%;\" >
  91. <div class=\"dragbox bloc rounded\" >
  92. <h4>".get_lang('ram_usage')."</h4>
  93. <div class=\"dragbox-content\">
  94. <b>".get_lang('ram_used').": " . $ramusage . "<br></b>";
  95. drawBarDiv($rampercent, "RAM");
  96. echo "
  97. </div>
  98. </div></div>";
  99. }
  100. if ($modulestorage == "1")
  101. {
  102. echo "<div id=\"column4\" style=\"width:100%;float:left;margin-top:1%;\" >
  103. <div class=\"dragbox bloc rounded\" >
  104. <h4>".get_lang('storage_space')."</h4>
  105. <div class=\"dragbox-content\">
  106. <b>".get_lang('storage_total').": " . $diskspace . "<br>
  107. ".get_lang('storage_used').": " . $diskinuse . "<br>";
  108. drawBarDiv($hddbarusage, "HDD");
  109. echo get_lang('storage_free').": " . $hddfreespace . "</b>
  110. </div>
  111. </div>
  112. </div>";
  113. }
  114. } else {
  115. echo "<div id=\"column4\" style=\"width:100%;float:left;margin-top:1%;\"
  116. <div class=\"dragbox bloc rounded\">
  117. <h4>".get_lang('status_extension_required')."</h4>
  118. <div class=\"dragbox-content\"><center><b>".get_lang('gd_info')."</b></center></div>
  119. </div>
  120. </div>";
  121. }
  122. if($modulesystemtasks == "1"){
  123. echo "<div id=\"column4\" style=\"width:100%;float:left;margin-top:1%;\" >
  124. <div class=\"dragbox bloc rounded\" >
  125. <h4>".get_lang('process_monitor')."</h4>
  126. <div class=\"dragbox-content\">";
  127. if(isset($taskoutput) && is_array($taskoutput) && isset($taskoutput["task"]) && !empty($taskoutput["task"])){
  128. echo "<pre>" . htmlentities($taskoutput["task"]) . "</pre>";
  129. }
  130. echo ' </div>
  131. </div>
  132. </div>';
  133. }
  134. }
  135. ?>