| 1 |
<?php |
| 2 |
|
| 3 |
// Do not allow the file to be called directly. |
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
// Determine the log table that should be shown. |
| 9 |
$logtype = ( isset( $_GET['logtype'] ) && $_GET['logtype'] == 'activity' ? 'activity' : 'firewall' ); |
| 10 |
$url = $_SERVER['REQUEST_URI']; |
| 11 |
$site_id = get_option( 'patchstack_site_id', 0 ); |
| 12 |
$app_url = $site_id != 0 ? 'https://app.patchstack.com/app/' . $site_id . '/"' : 'https://app.patchstack.com/apps/overview'; |
| 13 |
if ( strpos( $url, 'logtype' ) === false ) { |
| 14 |
$url .= '&logtype=' . $logtype; |
| 15 |
} |
| 16 |
?> |
| 17 |
<div class="patchstack-font"> |
| 18 |
<h2 class="patchstack-logs-nav"> |
| 19 |
<a href="<?php echo esc_url( str_replace( 'activity', 'firewall', $url ) ); ?>" class="nav-tab patchstack-nav-tab <?php echo $logtype == 'firewall' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>"> |
| 20 |
<?php echo __( 'Firewall Log', 'patchstack' ); ?> |
| 21 |
</a> |
| 22 |
|
| 23 |
<?php if ( $class >= 1 || $class === '' ) { ?> |
| 24 |
<a href="<?php echo esc_url( str_replace( 'firewall', 'activity', $url ) ); ?>" class="nav-tab patchstack-nav-tab <?php echo $logtype == 'activity' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>"> |
| 25 |
<?php echo __( 'Activity Log', 'patchstack' ); ?> |
| 26 |
</a> |
| 27 |
<?php } ?> |
| 28 |
</h2> |
| 29 |
<div class="patchstack-content-inner-table"> |
| 30 |
<div class="patchstack-font"> |
| 31 |
<h4>Log-in at <a href="<?php echo $app_url; ?>" target="_blank">Patchstack App</a> to view more logs.</h4> |
| 32 |
<?php if ( $logtype == 'firewall' ) { ?> |
| 33 |
<table class="table table-lg table-hover table-firewall-log"> |
| 34 |
<thead> |
| 35 |
<tr> |
| 36 |
<th>REASON</th> |
| 37 |
<th>URL REQUESTED</th> |
| 38 |
<th>METHOD</th> |
| 39 |
<th>ORIGIN</th> |
| 40 |
<th>DATE</th> |
| 41 |
</tr> |
| 42 |
</thead> |
| 43 |
<tbody> |
| 44 |
</tbody> |
| 45 |
</table> |
| 46 |
<?php } elseif ( $logtype == 'activity' ) { ?> |
| 47 |
<table class="table table-lg table-hover table-user-log dt-table"> |
| 48 |
<thead> |
| 49 |
<tr> |
| 50 |
<th>Username</th> |
| 51 |
<th>Action</th> |
| 52 |
<th>Object</th> |
| 53 |
<th>Object name</th> |
| 54 |
<th>IP</th> |
| 55 |
<th>Date</th> |
| 56 |
</tr> |
| 57 |
</thead> |
| 58 |
<tbody> |
| 59 |
</tbody> |
| 60 |
</table> |
| 61 |
<?php } ?> |
| 62 |
</div> |
| 63 |
</div> |
| 64 |
</div> |
| 65 |
|