File: //usr/src/installd-accountdnscheck/web/managereports.php
<?php
$nav = 'managereports';
if(isset($_REQUEST['delete'])) {
if(preg_match('/^[a-zA-Z0-9\-_\.]*$/', $_REQUEST['delete'])) {
if(is_file('/var/cpanel/addons/accountdnscheck/reports/' . $_REQUEST['delete'])) {
@unlink('/var/cpanel/addons/accountdnscheck/reports/' . $_REQUEST['delete']);
$success = 'Successfuly deleted report stored at /var/cpanel/addons/accountdnscheck/reports/' . $_REQUEST['delete'];
} else {
$error = 'The report you are trying to delete is not a file or does not exist';
}
} else {
$error = 'The report you are trying to delete contains invalid characters in it\'s name';
}
}
include_once('header.php');
?>
<div class="page-header">
<h1>Manage Reports <small>A full list of all reports generated and stored on your server</small></h1>
</div>
<?php if($accountdnscheck->showLicenseNag() === true) { ?>
<div class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<div class="media">
<div class="pull-left" style="font-size:48px;padding:0px 15px;">
<span class="glyphicon glyphicon-warning-sign"></span>
</div>
<div class="media-body">
<h3 class="media-heading">License Nag!</h3>
<p>We noticed that your license was not purchased through <a href="http://www.ndchost.com/" target="_new" class="alert-link">NDCHost</a>. Although this plugin will continue to work properly we would like to ask for your support by using <a href="http://www.ndchost.com/" target="_new" class="alert-link">NDCHost</a> for your cPanel licensing needs. We will price and bill date match your existing license provider. There will also be no downtime during the transfer process. If you are interesting in supporting the company that brought you this plugin please visit <a href="http://www.ndchost.com/" target="_new" class="alert-link">www.NDCHost.com</a>. Thanks!</p>
</div>
</div>
</div>
<?php } ?>
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>Name</th>
<th>Date</th>
<th style="width:25%">Action</th>
</tr>
</thead>
<tbody>
<?php
$reports = $accountdnscheck->reports();
if(count($reports) > 0) {
foreach($reports as $k => $v) {
?>
<tr>
<td><?php echo $v['filename']; ?></td>
<td><?php echo date("r", $v['date']); ?></td>
<td>
<?php if(preg_match('/\.csv$/', $v['filename'])) { ?>
<a href="<?php echo $baseurl; ?>/downloadreport.php?report=<?php echo $v['filename']; ?>" class="btn btn-primary btn-xs">Download</a>
<?php } else { ?>
<a href="<?php echo $baseurl; ?>/viewreport.php?report=<?php echo $v['filename']; ?>" class="btn btn-primary btn-xs">View</a>
<?php } ?>
<a href="<?php echo $baseurl; ?>/managereports.php?delete=<?php echo $v['filename']; ?>" class="btn btn-danger btn-xs" title="Delete" onClick="return confirm('Are you sure you want to delete this report?')">Delete</a>
</td>
</tr>
<?php
}
} else {
?>
<tr>
<td colspan="3" class="text-center">No reports found...</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php include_once('footer.php'); ?>