Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
fix #1294 Bad layout on page template-bound resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmi3yy committed Nov 25, 2019
1 parent 6b980c3 commit 8c0334d
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions manager/processors/delete_template.processor.php
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
<?php
if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
}
if(!$modx->hasPermission('delete_template')) {
$modx->webAlertAndQuit($_lang["error_no_privileges"]);
$modx->webAlertAndQuit($_lang["error_no_privileges"]);
}

$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
if($id == 0) {
$modx->webAlertAndQuit($_lang["error_no_id"]);
$modx->webAlertAndQuit($_lang["error_no_id"]);
}

// delete the template, but first check it doesn't have any documents using it
$rs = $modx->getDatabase()->select('id, pagetitle,introtext', $modx->getDatabase()->getFullTableName('site_content'), "template='{$id}' AND deleted=0");
$limit = $modx->getDatabase()->getRecordCount($rs);
if($limit > 0) {
include MODX_MANAGER_PATH . "includes/header.inc.php";
?>
include MODX_MANAGER_PATH . "includes/header.inc.php";
?>

<h1><?php echo $_lang['manage_templates']; ?></h1>
<h1><?php echo $_lang['manage_templates']; ?></h1>

<div class="section">
<div class="sectionHeader"><?php echo $_lang['manage_templates']; ?></div>
<div class="sectionBody">
<p>This template is in use.</p>
<p>Please set the documents using the template to another template.</p>
<p>Documents using this template:</p>
<ul>
<?php
while($row = $modx->getDatabase()->getRow($rs)) {
echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>';
}
?>
</ul>
</div>
</div>
<?php
include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
exit;
<div class="tab-page">
<div class="container container-body">

<p>This template is in use.<br/>
Please set the documents using the template to another template.<br/>
Documents using this template:</p>
<ul>
<?php
while($row = $modx->getDatabase()->getRow($rs)) {
echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>';
}
?>
</ul>
</div>
</div>
<?php
include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
exit;
}

if($id == $default_template) {
$modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template.");
$modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template.");
}

// Set the item name for logger
Expand All @@ -50,8 +50,8 @@

// invoke OnBeforeTempFormDelete event
$modx->invokeEvent("OnBeforeTempFormDelete", array(
"id" => $id
));
"id" => $id
));

// delete the document.
$modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'");
Expand All @@ -60,8 +60,8 @@

// invoke OnTempFormDelete event
$modx->invokeEvent("OnTempFormDelete", array(
"id" => $id
));
"id" => $id
));

// empty cache
$modx->clearCache('full');
Expand Down

0 comments on commit 8c0334d

Please sign in to comment.