index.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. if (cfr('SYSLOAD')) {
  3. if (ubRouting::checkGet('checkupdates')) {
  4. $latestStableRelease = zb_GetReleaseInfo('STABLE');
  5. die(zb_RenderUpdateInfo($latestStableRelease,'STABLE'));
  6. }
  7. if (ubRouting::checkGet('phpinfo')) {
  8. phpinfo();
  9. die();
  10. }
  11. zb_BillingStats(false);
  12. //ajax data loaders
  13. //database check
  14. if (ubRouting::checkGet('ajaxdbcheck')) {
  15. die(zb_DBCheckRender());
  16. }
  17. //database fix
  18. if (ubRouting::checkGet('dbrepairtable')) {
  19. die(zb_DBRepairTable(ubRouting::get('dbrepairtable')));
  20. }
  21. //database stats
  22. if (ubRouting::checkGet('ajaxdbstats')) {
  23. die(zb_DBStatsRender());
  24. }
  25. // Cache keys info
  26. if (ubRouting::checkGet('ajaxcacheinfo')) {
  27. die(zb_ListCacheInform());
  28. }
  29. // Cache keys and data info
  30. if (ubRouting::checkGet('ajaxcachedata')) {
  31. die(zb_ListCacheInform('data'));
  32. }
  33. //cache key data preview
  34. if (ubRouting::checkGet('datacachekeyview')) {
  35. die(zb_CacheInformKeyView(ubRouting::get('datacachekeyview')));
  36. }
  37. // Clear cache
  38. if (ubRouting::checkGet('ajaxcacheclear')) {
  39. die(zb_ListCacheInform('clear'));
  40. }
  41. //memcached stats
  42. if (ubRouting::checkGet('ajaxmemcachedstats')) {
  43. die(web_MemCachedRenderStats());
  44. }
  45. //redis stats
  46. if (ubRouting::checkGet('ajaxredisstats')) {
  47. die(web_RedisRenderStats());
  48. }
  49. //cache key destroy
  50. if (ubRouting::checkGet('deletecachekey')) {
  51. die(zb_CacheKeyDestroy(ubRouting::get('deletecachekey')));
  52. }
  53. $globconf = $ubillingConfig->getBilling();
  54. $alterconf = $ubillingConfig->getAlter();
  55. $monit_url = '';
  56. if (!empty($globconf['PHPSYSINFO'])) {
  57. $monit_url = MODULES_DOWNLOADABLE . $globconf['PHPSYSINFO'];
  58. }
  59. $cache_info = $alterconf['UBCACHE_STORAGE'];
  60. //custom scripts output handling. We must run this before all others.
  61. if (isset($alterconf['SYSLOAD_CUSTOM_SCRIPTS'])) {
  62. if (!empty($alterconf['SYSLOAD_CUSTOM_SCRIPTS'])) {
  63. $customScriptsData = web_ReportSysloadCustomScripts($alterconf['SYSLOAD_CUSTOM_SCRIPTS']);
  64. }
  65. }
  66. $sysInfoData = '';
  67. //phpinfo()
  68. $phpInfoCode = wf_modal(wf_img('skins/icon_puzzle.png') . ' ' . __('Check required PHP extensions'), __('Check required PHP extensions'), zb_CheckPHPExtensions(), 'ubButton', '800', '600');
  69. $phpInfoCode .= wf_tag('br');
  70. $phpInfoCode .= wf_tag('iframe', false, '', 'src="?module=report_sysload&phpinfo=true" width="1000" height="500" frameborder="0"') . wf_tag('iframe', true);
  71. $sysInfoData .= wf_modalAuto(wf_img('skins/icon_php.png') . ' ' . __('Information about PHP version'), __('Information about PHP version'), $phpInfoCode, 'ubButton');
  72. //database info
  73. $dbInfoCode = zb_DBStatsRenderContainer();
  74. $sysInfoData .= wf_modal(wf_img('skins/icon_restoredb.png') . ' ' . __('MySQL database info'), __('MySQL database info'), $dbInfoCode, 'ubButton', 1020, 570);
  75. //loaded modules info
  76. $loadedModulesCode = zb_ListLoadedModules();
  77. $sysInfoData .= wf_modal(wf_img('skins/icon_puzzle.png') . ' ' . __('Loaded modules'), __('Loaded modules'), $loadedModulesCode, 'ubButton', 1020, 570);
  78. //phpsysinfo frame
  79. if (!empty($monit_url)) {
  80. if (file_exists($monit_url . '/index.php')) {
  81. $monitCode = wf_tag('iframe', false, '', 'src="' . $monit_url . '" width="1000" height="500" frameborder="0"') . wf_tag('iframe', true);
  82. $sysInfoData .= wf_modalAuto(wf_img('skins/snmp.png') . ' ' . __('phpSysInfo'), __('System health with phpSysInfo'), $monitCode, 'ubButton');
  83. } else {
  84. //installing phpsysinfo
  85. if (ubRouting::checkGet(array('phpsysinfoinstall'))) {
  86. if (cfr('ROOT')) {
  87. zb_InstallPhpsysinfo();
  88. $installNotification = wf_tag('span', false, 'alert_success') . __('Done') . '! ' . __('Refresh page') . '.' . wf_tag('span', true);
  89. die($installNotification);
  90. } else {
  91. die(wf_tag('span', false, 'alert_error') . __('Access denied') . wf_tag('span', true));
  92. }
  93. }
  94. $monitCode = wf_AjaxLink('?module=report_sysload&phpsysinfoinstall=true', wf_img('skins/icon_download.png') . ' ' . __('Download') . ' ' . __('phpSysInfo'), 'phpsysinfoinstall', true, 'ubButton');
  95. $monitCode .= wf_AjaxContainer('phpsysinfoinstall');
  96. $sysInfoData .= wf_modalAuto(wf_img('skins/snmp.png') . ' ' . __('phpSysInfo'), __('System health with phpSysInfo'), $monitCode, 'ubButton');
  97. }
  98. }
  99. //xhprof installation
  100. if (ubRouting::checkGet('xhprofmoduleinstall')) {
  101. if (cfr('ROOT')) {
  102. zb_InstallXhprof();
  103. $installNotification = wf_tag('span', false, 'alert_success') . __('Done') . '! ' . __('Refresh page') . '.' . wf_tag('span', true);
  104. die($installNotification);
  105. } else {
  106. die(wf_tag('span', false, 'alert_error') . __('Access denied') . wf_tag('span', true));
  107. }
  108. }
  109. //Cache
  110. if ($cache_info == 'files' or $cache_info = 'memcached') {
  111. $cacheInfo = zb_ListCacheInformRenderContainer();
  112. $sysInfoData .= wf_modalAuto(wf_img('skins/icon_cache.png') . ' ' . __('Cache'), __('Cache information'), $cacheInfo, 'ubButton') . ' ';
  113. }
  114. //process monitor
  115. if (cfr('ROOT')) {
  116. $sysInfoData .= wf_Link(ProcessMon::URL_ME, wf_img('skins/icon_thread.png') . ' ' . __('Background processes'), false, 'ubButton') . ' ';
  117. }
  118. //apachezen
  119. if (cfr('ROOT')) {
  120. $sysInfoData .= wf_Link(ApacheZen::URL_ME, wf_img('skins/zen.png') . ' ' . __('Apache') . ' ' . __('Zen'), true, 'ubButton');
  121. }
  122. show_window('', $sysInfoData);
  123. //custom scripts shows data
  124. if (isset($alterconf['SYSLOAD_CUSTOM_SCRIPTS'])) {
  125. if (!empty($alterconf['SYSLOAD_CUSTOM_SCRIPTS'])) {
  126. show_window(__('Additional monitoring'), $customScriptsData);
  127. }
  128. }
  129. //system health here
  130. $sysHealthControls = wf_AjaxLink('?module=report_sysload&ajsysload=health', wf_img('skins/icon_health.png') . ' ' . __('System health'), 'reportsysloadcontainer', false, 'ubButton') . ' ';
  131. $sysHealthControls .= wf_AjaxLink('?module=report_sysload&ajsysload=top', wf_img('skins/icon_process.png') . ' ' . __('Process'), 'reportsysloadcontainer', false, 'ubButton') . ' ';
  132. $sysHealthControls .= wf_AjaxLink('?module=report_sysload&ajsysload=uptime', wf_img('skins/icon_uptime.png') . ' ' . __('Uptime'), 'reportsysloadcontainer', false, 'ubButton') . ' ';
  133. $sysHealthControls .= wf_AjaxLink('?module=report_sysload&ajsysload=df', wf_img('skins/icon_disks.png') . ' ' . __('Free space'), 'reportsysloadcontainer', false, 'ubButton') . ' ';
  134. show_window('', $sysHealthControls);
  135. $defaultContainerContent = web_ReportSysloadRenderLA();
  136. $defaultContainerContent .= web_ReportSysloadRenderDisksCapacity();
  137. $sysLoadContainer = wf_AjaxContainer('reportsysloadcontainer', '', $defaultContainerContent);
  138. if (ubRouting::checkGet('ajsysload')) {
  139. $renderAjData = ubRouting::get('ajsysload');
  140. switch ($renderAjData) {
  141. case 'health':
  142. die($defaultContainerContent);
  143. break;
  144. case 'top':
  145. die(web_ReportSysloadRenderTop());
  146. break;
  147. case 'uptime':
  148. die(web_ReportSysloadRenderUptime());
  149. break;
  150. case 'df':
  151. die(web_ReportSysloadRenderDF());
  152. break;
  153. }
  154. }
  155. show_window(__('System health'), $sysLoadContainer);
  156. } else {
  157. show_error(__('You cant control this module'));
  158. }