File: /home/httpd/html/xdudes.com/admin/blocks.php
<?php
require "header.php";
if ($_POST['list']) {
foreach ($_POST['list'] as $i) {
dbDelete('blocks', array('record_num' => $i));
dbDelete('blocks_languages', array(
'block_id' => $i,
), false, 'block_id');
}
}
?>
<div class="content-page">
<div class="header-area">
<div class="breadcrumbs">
<a href="index.php">Admin Home</a>
<span><a href="blocks.php">Custom Blocks</a></span>
</div>
</div>
<div class="content-outer">
<h2>Custom<strong>Blocks</strong></h2>
<div class="notification info">Custom blocks can be displayed in your template using PHP code: <b><?php echo htmlentities('<?php displayBlock(BLOCK_ID); ?>', ENT_QUOTES, 'UTF-8'); ?></b>, where BLOCK_ID is the ID of the block in the system (visible in blocks list in first column).</div>
<div class="content-inner">
<?php echo getMessages(); ?>
<form method="POST" action="" enctype="multipart/form-data" class="form" novalidate autocomplete="off">
<table class="pagetable">
<thead>
<tr>
<th>Block ID</th>
<th>Admin Title</th>
<th>Block Title</th>
<th>Status</th>
<th class="options"></th>
<th style="width:50px">
<label for="check-select-all-1" class="checkbox">
<input type="checkbox" name="select_all" value="1" data-items="list[]" id="check-select-all-1">
<i></i>
</label>
</th>
</tr>
</thead>
<?php $result = dbQuery("SELECT * FROM `blocks` ORDER BY `record_num`",false); ?>
<tbody>
<?php if (!is_array($result)) { ?>
<tr><td colspan="6"><div class="notification alert">No custom blocks found</div></td></tr>
<?php } else { ?>
<?php foreach($result as $row) { ?>
<tr>
<td><?php echo $row['record_num']; ?></a></td>
<td><?php echo $row['title']; ?></a></td>
<td><?php echo $row['subject']; ?></a></td>
<td><?php echo $row['status'] ? '<i class="ion ion-checkmark-circled icon-status enabled"></i>' : '<i class="ion ion-close-circled icon-status disabled"></i>'; ?></td>
<td class="options">
<a href="edit_block.php?id=<?php echo $row['record_num']; ?>" class="btn btn-xs btn-orange"><i class="ion ion-edit icon-edit"></i></a>
</td>
<td>
<label class="checkbox">
<input type="checkbox" name="list[]" value="<?php echo $row['record_num']; ?>" id="ids-<?php echo $row['record_num']; ?>"><i></i>
</label>
</td>
</tr>
<?php } ?>
<tr class="item submit">
<td colspan="6">
<?php if (count($result) > 0) { ?>
<button type="submit" class="btn action-delete">Delete Selected</button>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</form>
</div>
</div>
</div>
<?php require "footer.php"; ?>