| Server IP : 104.21.21.239 / Your IP : 216.73.216.68 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/banners/domains/stagemag/ |
Upload File : |
<?php
include 'header.php';
set_time_limit(600);
$programid = resolve_programid();
require_program_access($programid, $getuser);
?>
<style>
.feature-card { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.08); }
.feature-card-header { background: linear-gradient(135deg, #b20223 0%, #8a011a 100%); color: #fff; padding: 12px 20px; border-radius: 7px 7px 0 0; font-size: 18px; font-weight: 600; }
.feature-card-body { padding: 20px; }
.feature-card-body p { color: #555; margin-bottom: 15px; line-height: 1.5; }
.feature-card-body label { font-weight: 600; color: #333; display: block; margin-bottom: 5px; }
.feature-card-body select, .feature-card-body input[type="text"] { padding: 8px 12px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; }
.feature-row { margin-bottom: 15px; }
.feature-row:last-child { margin-bottom: 0; }
.pages-table { width: 100%; border-collapse: collapse; }
.pages-table th { background: #f5f5f5; padding: 10px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid #e0e0e0; }
.pages-table td { padding: 10px 12px; border-bottom: 1px solid #eee; }
.pages-table tr:hover { background: #fafafa; }
.btn-action { color: #b20223; text-decoration: none; font-size: 13px; margin-right: 10px; }
.btn-action:hover { text-decoration: underline; }
.btn-delete { color: #c00; }
.btn-save { background-color: #b20223; color: white; border: none; padding: 10px 25px; border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-save:hover { background-color: #8a011a; }
.btn-add { background-color: #b20223; color: white; border: none; padding: 8px 16px; border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; margin-left: 10px; }
.btn-add:hover { background-color: #8a011a; }
</style>
<div id="content" style="max-width: 800px;">
<div id="content-header">
<h2> Edit Program - Extra Pages</h2>
</div>
<div class="container-fluid">
<?php
// Delete
if (isset($_GET['delete'])) {
$stmt = db_write()->prepare("DELETE FROM stagemag.extrapages WHERE id = ?");
$stmt->execute([intval($_GET['delete'])]);
header('Location: /programedit-extrapages.php?programid=' . urlencode($programid));
exit;
}
// Add
if (isset($_GET['add'])) {
$pagetitle = $_POST['pagetitle'] ?? '';
$aftersection = $_POST['aftersection'] ?? '';
$stmt = db_write()->prepare("INSERT INTO stagemag.extrapages (programid, pagetitle, aftersection) VALUES (?, ?, ?)");
$stmt->execute([$programid, $pagetitle, $aftersection]);
$stmt = db_write()->prepare("SELECT id FROM stagemag.extrapages ORDER BY id DESC LIMIT 1");
$stmt->execute();
$getblast = $stmt->fetch();
header('Location: /programedit-extrapages.php?programid=' . urlencode($programid) . '&editpage=' . $getblast['id']);
exit;
}
// Save edit
if (isset($_GET['editsaveclient'])) {
$editsaveclient = intval($_GET['editsaveclient']);
$strategy = in_array($_POST['pdf_strategy'] ?? '', ['flow', 'own_page'], true) ? $_POST['pdf_strategy'] : null;
$stmt = db_write()->prepare("UPDATE stagemag.extrapages SET pagetitle = ?, aftersection = ?, pagecopy = ?, pdf_strategy = ? WHERE id = ?");
$stmt->execute([$_POST['pagetitle'] ?? '', $_POST['aftersection'] ?? '', $_POST['pagecopy'] ?? '', $strategy, $editsaveclient]);
header('Location: /programedit-extrapages.php?programid=' . urlencode($programid));
exit;
}
// Quick save of pdf_strategy from the table list (no full edit needed)
if (isset($_GET['savestrategy'])) {
$rowId = intval($_GET['savestrategy']);
$strategy = in_array($_POST['pdf_strategy'] ?? '', ['flow', 'own_page'], true) ? $_POST['pdf_strategy'] : null;
$stmt = db_write()->prepare("UPDATE stagemag.extrapages SET pdf_strategy = ? WHERE id = ? AND programid = ?");
$stmt->execute([$strategy, $rowId, $programid]);
header('Location: /programedit-extrapages.php?programid=' . urlencode($programid));
exit;
}
if (isset($_GET['editpage'])):
$editpage = intval($_GET['editpage']);
$stmt = db_write()->prepare("SELECT * FROM stagemag.extrapages WHERE id = ?");
$stmt->execute([$editpage]);
$geter = $stmt->fetch();
?>
<FORM action="programedit-extrapages.php?editsaveclient=<?= $editpage ?>&programid=<?= $programid ?>" method="post" enctype="multipart/form-data">
<div class="feature-card">
<div class="feature-card-header">Edit Page</div>
<div class="feature-card-body">
<div class="feature-row">
<label>Page Title (required)</label>
<input name="pagetitle" style="width:100%; max-width:500px;" required type="text" value="<?= htmlspecialchars($geter['pagetitle']) ?>">
</div>
<div class="feature-row">
<label>Display Page After</label>
<select name="aftersection" style="width:100%; max-width:300px;">
<option value="<?= htmlspecialchars($geter['aftersection']) ?>"><?= htmlspecialchars($geter['aftersection']) ?></option>
<option value="End of Program">End of Program</option>
<option value="After Opening Pages">After Opening Pages</option>
<option value="After Title Page">After Title Page</option>
<option value="After Cast Page">After Cast Page</option>
<option value="After Creative Team Page">After Creative Team Page</option>
<option value="After Multimedia Page">After Multimedia Page</option>
<option value="After Donor List Page">After Donor List Page</option>
<option value="After Articles">After Articles</option>
</select>
</div>
<div class="feature-row">
<label>PDF page break</label>
<?php $strat = $geter['pdf_strategy'] ?: 'flow'; ?>
<select name="pdf_strategy" style="width:100%; max-width:300px;">
<option value="flow"<?= $strat === 'flow' ? ' selected' : '' ?>>Flow (no forced break)</option>
<option value="own_page"<?= $strat === 'own_page' ? ' selected' : '' ?>>Own page (start on a new PDF page)</option>
</select>
<p style="font-size:12px;color:#777;margin-top:6px;">Controls how the PDF generator handles this specific page. <em>Own page</em> forces the page to start on a fresh PDF sheet.</p>
</div>
<div class="feature-row">
<label>Page Content</label>
<textarea id="myarea12" name="pagecopy" style="width:100%;height:300px;" required><?= $geter['pagecopy'] ?></textarea>
<script src="/ckeditor0512z3/ckeditor.js" charset="utf-8"></script>
<script type="text/javascript" src="/ckfinder2025/ckfinder.js" charset="utf-8"></script>
<?php setcookie('folderme2', '/upload13/' . $programid . '/', 0, '/', 'stagemag.broadwayworld.com'); ?>
<script type="text/javascript">
CKEDITOR.on('dialogDefinition', function(ev) {
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
if (dialogName == 'link') {
var targetTab = dialogDefinition.getContents('target');
var targetDropdown = targetTab.get('linkTargetType');
targetDropdown.default = '_blank';
}
});
CKFinder.setupCKEditor(editor, '/ckfinder34/');
var editor = CKEDITOR.replace('myarea12', { height: '500px', width: '100%' });
editor.on('instanceReady', function() { console.log(editor.filter.allowedContent); });
</script>
</div>
<div style="margin-top: 20px;">
<button type="submit" name="buttadminman" class="btn-save">Save Page</button>
<a href="programedit-extrapages.php?programid=<?= $programid ?>" style="margin-left: 15px; color: #666;">Cancel</a>
</div>
</div>
</div>
</form>
<?php else: ?>
<div class="feature-card">
<div class="feature-card-header">Add New Page</div>
<div class="feature-card-body">
<p>Want to add more custom pages to your program? Add extra pages below and choose where to display them.</p>
<FORM action="programedit-extrapages.php?add=on&programid=<?= $programid ?>" method="post" enctype="multipart/form-data">
<div class="feature-row" style="display: flex; gap: 15px; align-items: flex-end; flex-wrap: wrap;">
<div>
<label>Page Title</label>
<input name="pagetitle" style="width:250px" type="text" required>
</div>
<div>
<label>Display After</label>
<select name="aftersection">
<option value="End of Program">End of Program</option>
<option value="After Opening Pages">After Opening Pages</option>
<option value="After Title Page">After Title Page</option>
<option value="After Cast Page">After Cast Page</option>
<option value="After Creative Team Page">After Creative Team Page</option>
<option value="After Multimedia Page">After Multimedia Page</option>
<option value="After Donor List Page">After Donor List Page</option>
<option value="After Articles">After Articles</option>
</select>
</div>
<div>
<button type="submit" name="buttadminman" class="btn-add">Add Page</button>
</div>
</div>
</form>
</div>
</div>
<?php
$stmt = db_write()->prepare("SELECT * FROM stagemag.extrapages WHERE programid = ?");
$stmt->execute([$programid]);
$pages = $stmt->fetchAll();
if (count($pages) > 0):
?>
<div class="feature-card">
<div class="feature-card-header">Existing Pages</div>
<div class="feature-card-body">
<table class="pages-table">
<tr><th>Page Title</th><th>Display After</th><th style="width: 200px;">PDF page break</th><th style="width: 120px;">Actions</th></tr>
<?php foreach ($pages as $row):
$strat = $row['pdf_strategy'] ?: 'flow';
?>
<tr>
<td><a href="programedit-extrapages.php?editpage=<?= $row['id'] ?>&programid=<?= $row['programid'] ?>" class="btn-action"><?= htmlspecialchars($row['pagetitle']) ?></a></td>
<td><?= htmlspecialchars($row['aftersection']) ?></td>
<td>
<form method="post" action="programedit-extrapages.php?savestrategy=<?= $row['id'] ?>&programid=<?= $row['programid'] ?>" style="margin:0;">
<select name="pdf_strategy" onchange="this.form.submit()">
<option value="flow"<?= $strat === 'flow' ? ' selected' : '' ?>>Flow</option>
<option value="own_page"<?= $strat === 'own_page' ? ' selected' : '' ?>>Own page</option>
</select>
</form>
</td>
<td>
<a href="programedit-extrapages.php?editpage=<?= $row['id'] ?>&programid=<?= $row['programid'] ?>" class="btn-action">Edit</a>
<a href="programedit-extrapages.php?delete=<?= $row['id'] ?>&programid=<?= $row['programid'] ?>" class="btn-action btn-delete" onclick="return confirm('Are you sure you want to delete this page?');">Delete</a>
</td>
</tr>
<?php endforeach; ?>
</table>
<p style="font-size:12px;color:#777;margin-top:10px;">PDF page break: <em>Flow</em> = continues on the previous page if there's room. <em>Own page</em> = forces this extra page to start on a fresh PDF sheet. Changes save automatically.</p>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<!--Footer-part-->
<br><br><br><br>
<?php include 'footer.php'; ?>