settings-settings-logs.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. if(file_exists('config'.DIRECTORY_SEPARATOR.'config.php')){
  3. $pageSettingsSettingsLogs = '
  4. <script>
  5. $(document).on("click", ".swapLog", function(e) {
  6. var log = $(this).attr(\'data-name\')+\'Div\';
  7. $(\'.logTable\').addClass(\'hidden\');
  8. $(\'.\'+log).addClass(\'show\').removeClass(\'hidden\');
  9. $(\'.swapLog\').removeClass(\'active\');
  10. $(this).addClass(\'active\');
  11. });
  12. </script>
  13. <div class="btn-group m-b-20 pull-left">
  14. <button type="button" class="btn btn-default btn-outline waves-effect bg-org swapLog active" data-name="loginLog" data-path="'.$GLOBALS['organizrLoginLog'].'" lang="en">Login Log</button>
  15. <button type="button" class="btn btn-default btn-outline waves-effect bg-org swapLog" data-name="orgLog" data-path="'.$GLOBALS['organizrLog'].'" lang="en">Organizr Log</button>
  16. </div>
  17. <button class="btn btn-danger btn-sm waves-effect waves-light pull-right purgeLog" type="button"><span class="btn-label"><i class="fa fa-trash"></i></span>Purge Log</button>
  18. <div class="clearfix"></div>
  19. <div class="white-box bg-org logTable loginLogDiv">
  20. <h3 class="box-title m-b-0" lang="en">Login Logs</h3>
  21. <div class="table-responsive">
  22. <table id="loginLogTable" class="table table-striped">
  23. <thead>
  24. <tr>
  25. <th lang="en">Date</th>
  26. <th lang="en">Username</th>
  27. <th lang="en">IP Address</th>
  28. <th lang="en">Type</th>
  29. </tr>
  30. </thead>
  31. <tfoot>
  32. <tr>
  33. <th lang="en">Date</th>
  34. <th lang="en">Username</th>
  35. <th lang="en">IP Address</th>
  36. <th lang="en">Type</th>
  37. </tr>
  38. </tfoot>
  39. <tbody></tbody>
  40. </table>
  41. </div>
  42. </div>
  43. <div class="white-box bg-org logTable orgLogDiv hidden">
  44. <h3 class="box-title m-b-0" lang="en">Organizr Logs</h3>
  45. <div class="table-responsive">
  46. <table id="organizrLogTable" class="table table-striped">
  47. <thead>
  48. <tr>
  49. <th lang="en">Date</th>
  50. <th lang="en">Username</th>
  51. <th lang="en">IP Address</th>
  52. <th lang="en">Message</th>
  53. <th lang="en">Type</th>
  54. </tr>
  55. </thead>
  56. <tfoot>
  57. <tr>
  58. <th lang="en">Date</th>
  59. <th lang="en">Username</th>
  60. <th lang="en">IP Address</th>
  61. <th lang="en">Message</th>
  62. <th lang="en">Type</th>
  63. </tr>
  64. </tfoot>
  65. <tbody></tbody>
  66. </table>
  67. </div>
  68. </div>
  69. <!-- /.container-fluid -->
  70. <script>
  71. //$.fn.dataTable.moment(\'DD-MMM-Y HH:mm:ss\');
  72. $("#loginLogTable").DataTable( {
  73. "ajax": "api/?v1/login_log",
  74. "columns": [
  75. { data: \'utc_date\',
  76. render: function ( data, type, row ) {
  77. if ( type === \'display\' || type === \'filter\' ) {
  78. var m = moment.tz(data, activeInfo.timezone);
  79. return moment(m).format(\'LLL\');
  80. }
  81. return data;
  82. }
  83. },
  84. { "data": "username" },
  85. { "data": "ip" },
  86. { data: \'auth_type\',
  87. render: function ( data, type, row ) {
  88. if ( type === \'display\' || type === \'filter\' ) {
  89. return logIcon(data);
  90. }
  91. return logIcon(data);
  92. }
  93. }
  94. ],
  95. "order": [[ 0, \'desc\' ]],
  96. } );
  97. $("#organizrLogTable").DataTable( {
  98. "ajax": "api/?v1/organizr_log",
  99. "columns": [
  100. { data: \'utc_date\',
  101. render: function ( data, type, row ) {
  102. // If display or filter data is requested, format the date
  103. if ( type === \'display\' || type === \'filter\' ) {
  104. var m = moment.tz(data, activeInfo.timezone);
  105. return moment(m).format(\'LLL\');
  106. }
  107. // Otherwise the data type requested (`type`) is type detection or
  108. // sorting data, for which we want to use the integer, so just return
  109. // that, unaltered
  110. return data;}
  111. },
  112. { "data": "username" },
  113. { "data": "ip" },
  114. { "data": "message" },
  115. { data: \'type\',
  116. render: function ( data, type, row ) {
  117. if ( type === \'display\' || type === \'filter\' ) {
  118. return logIcon(data);
  119. }
  120. return logIcon(data);
  121. }
  122. }
  123. ],
  124. "order": [[ 0, \'desc\' ]],
  125. } );
  126. </script>
  127. ';
  128. }