events.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 exec_ogp_module()
  25. {
  26. // Using the refreshed class
  27. if( isset($_GET['get_cronevents']) )
  28. {
  29. require_once('includes/lib_remote.php');
  30. global $db;
  31. $remote_server_id = $_GET['r_server_id'];
  32. $remote_server = $db->getRemoteServer($remote_server_id);
  33. $remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key'], $remote_server['timeout'] );
  34. if($remote->status_chk() != 1)
  35. {
  36. print_failure(get_lang("agent_offline"));
  37. return;
  38. }
  39. $remote->remote_readfile('scheduler.log',$events);
  40. if ($events != "")
  41. echo "<pre class='log' >$events</pre>";
  42. else
  43. echo "<pre class='log' >Log empty</pre>";
  44. }
  45. else
  46. {
  47. require_once("includes/refreshed.php");
  48. echo "<h2>".get_lang('cron_events')."</h2>";
  49. $control = '<form method="POST" >
  50. <input type="submit" name="';
  51. if( isset( $_POST['full'] ) )
  52. {
  53. $height = "100%";
  54. $control .= 'default" value="-';
  55. }
  56. else
  57. {
  58. $height = "500px";
  59. $control .= 'full" value="+';
  60. }
  61. $control .= '" /></form><br />';
  62. $intervals = array( "4s" => "4000",
  63. "8s" => "8000",
  64. "30s" => "30000",
  65. "2m" => "120000",
  66. "5m" => "300000" );
  67. $intSel = '<form action="" method="GET" >
  68. <input type="hidden" name="m" value="cron" />
  69. <input type="hidden" name="p" value="events" />
  70. <input type="hidden" name="r_server_id" value="'.$_GET['r_server_id'].'" />'.
  71. get_lang('refresh_interval').
  72. ':<select name="setInterval" onchange="this.form.submit();">';
  73. foreach ($intervals as $interval => $value )
  74. {
  75. $selected = "";
  76. if ( isset( $_GET['setInterval'] ) AND $_GET['setInterval'] == $value )
  77. $selected = 'selected="selected"';
  78. $intSel .= '<option value="'.$value.'" '.$selected.' >'.$interval.'</option>';
  79. }
  80. $intSel .= "</select></form>";
  81. $setInterval = isset( $_GET['setInterval'] ) ? $_GET['setInterval'] : 4000;
  82. $refresh = new refreshed();
  83. $pos = $refresh->add("home.php?m=cron&p=events&type=cleared&get_cronevents&r_server_id=".$_REQUEST['r_server_id']);
  84. echo $refresh->getdiv($pos,"height:".$height.";overflow:auto;max-width:1600px;");
  85. ?><script type="text/javascript">$(document).ready(function(){ <?php echo $refresh->build("$setInterval"); ?>} ); </script><?php
  86. echo "<table class='center' ><tr><td>$intSel</td><td>$control</td></tr></table>";
  87. echo create_back_button( $_GET['m'], 'cron' );
  88. }
  89. }
  90. ?>