events.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <script type="text/javascript" src="js/jquery/jquery-1.11.0.min.js"></script>
  2. <?php
  3. /*
  4. *
  5. * OGP - Open Game Panel
  6. * Copyright (C) 2008 - 2018 The OGP Development Team
  7. *
  8. * http://www.opengamepanel.org/
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version 2
  13. * of the License, or any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. *
  24. */
  25. error_reporting(E_ALL);
  26. function exec_ogp_module()
  27. {
  28. // Using the refreshed class
  29. if( isset($_GET['get_cronevents']) )
  30. {
  31. require_once('includes/lib_remote.php');
  32. global $db;
  33. $remote_server_id = $_GET['r_server_id'];
  34. $remote_server = $db->getRemoteServer($remote_server_id);
  35. $remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key'], $remote_server['timeout'] );
  36. if($remote->status_chk() != 1)
  37. {
  38. print_failure(get_lang("agent_offline"));
  39. return;
  40. }
  41. $remote->remote_readfile('scheduler.log', $events);
  42. if ($events != "")
  43. echo "<pre class='log' >$events</pre>";
  44. else
  45. echo "<pre class='log' >Log empty</pre>";
  46. }
  47. else
  48. {
  49. require_once("includes/refreshed.php");
  50. echo "<h2>".get_lang('cron_events')."</h2>";
  51. $control = '<form method="POST" >
  52. <input type="submit" name="';
  53. if( isset( $_POST['full'] ) )
  54. {
  55. $height = "100%";
  56. $control .= 'default" value="-';
  57. }
  58. else
  59. {
  60. $height = "500px";
  61. $control .= 'full" value="+';
  62. }
  63. $control .= '" /></form><br />';
  64. $intervals = array( "4s" => "4000",
  65. "8s" => "8000",
  66. "30s" => "30000",
  67. "2m" => "120000",
  68. "5m" => "300000" );
  69. $intSel = '<form action="" method="GET" >
  70. <input type="hidden" name="m" value="cron" />
  71. <input type="hidden" name="p" value="events" />
  72. <input type="hidden" name="r_server_id" value="'.$_GET['r_server_id'].'" />'.
  73. get_lang('refresh_interval').
  74. ':<select name="setInterval" onchange="this.form.submit();">';
  75. foreach ($intervals as $interval => $value )
  76. {
  77. $selected = "";
  78. if ( isset( $_GET['setInterval'] ) AND $_GET['setInterval'] == $value )
  79. $selected = 'selected="selected"';
  80. $intSel .= '<option value="'.$value.'" '.$selected.' >'.$interval.'</option>';
  81. }
  82. $intSel .= "</select></form>";
  83. $setInterval = isset( $_GET['setInterval'] ) ? $_GET['setInterval'] : 4000;
  84. $refresh = new refreshed();
  85. $pos = $refresh->add("home.php?m=cron&p=events&type=cleared&get_cronevents&r_server_id=".$_REQUEST['r_server_id']);
  86. echo $refresh->getdiv($pos,"height:".$height.";overflow:auto;max-width:1600px;");
  87. ?><script type="text/javascript">$(document).ready(function(){ <?php echo $refresh->build("$setInterval"); ?>} ); </script><?php
  88. echo "<table class='center' ><tr><td>$intSel</td><td>$control</td></tr></table>";
  89. echo create_back_button( $_GET['m'], 'cron' );
  90. }
  91. }
  92. ?>