| Server IP : 172.67.201.108 / Your IP : 216.73.216.11 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
/**
* preview-program-content-pdf.php -- PDF content renderer (classic PDF mode)
* Converted from preview-program-content-pdf.php
*
* NOTE: The original used cfdocument/cfdocumentsection for PDF generation.
* PHP does not have a direct equivalent. This file renders the HTML content
* that would be passed to a PDF generator (e.g., wkhtmltopdf, DOMPDF, etc.).
* The cfdocumentsection markers are removed; the content flows as HTML.
*/
require_once __DIR__ . '/functions.php';
$programid = $programid ?? (int)($_GET['programid'] ?? 0);
$magtype = $magtype ?? (int)($_GET['magtype'] ?? 1);
$ua = $_SERVER['HTTP_USER_AGENT'] ?? '';
$isMobile = (stripos($ua, 'iphone') !== false || stripos($ua, 'ipod') !== false || stripos($ua, 'android') !== false || stripos($ua, 'ipad') !== false);
if (!isset($getdupe) || !$getdupe) {
if (isset($_GET['link'])) {
$stmtD = db_read()->prepare("SELECT * FROM stagemag.productions WHERE seo_friendly = :link");
$stmtD->execute([':link' => $_GET['link']]);
} else {
$stmtD = db_read()->prepare("SELECT * FROM stagemag.productions WHERE id = :pid");
$stmtD->execute([':pid' => $programid]);
}
$getdupe = $stmtD->fetch();
if (!$getdupe) {
header('Location: /', true, 301);
exit;
}
}
if (isset($_GET['link'])) {
$programid = (int)$getdupe['id'];
}
$bgColor = $getdupe['backgroundcolor'] ?? '#ffffff';
$textColor = $getdupe['textcolor'] ?? '#000000';
$linkColor = $getdupe['linkcolor'] ?? '#000000';
/* ── Track view ── */
$insView = db_write()->prepare("INSERT INTO stagemag.stats (programid, dater, views) VALUES (:pid, :d, 1)");
$insView->execute([':pid' => $getdupe['id'], ':d' => date('Y-m-d')]);
$updView = db_write()->prepare("UPDATE stagemag.productions SET viewcount = viewcount + 1 WHERE id = :pid");
$updView->execute([':pid' => $getdupe['id']]);
/* ── Logo ── */
$logotype = $getdupe['logotype'] ?? '';
if (stripos($logotype, 'Regular') !== false) $logoFile = 'WhiteBkgd.png';
elseif (stripos($logotype, 'Transparent - Black') !== false) $logoFile = 'TransparentBlack.png';
elseif (stripos($logotype, 'Transparent - White') !== false) $logoFile = 'TransparentWhite.png';
elseif (stripos($logotype, 'Black') !== false) $logoFile = 'BlackBkgd.png';
else $logoFile = 'WhiteBkgd.png';
?>
<style>
body { background-color:<?= $bgColor ?>; }
* { color:<?= $textColor ?>; font-family:Tahoma,Georgia,helvetica,sans-serif; }
a { color:<?= $linkColor ?>; }
h1 { font-family:Tahoma,Montserrat,sans-serif; color:<?= $textColor ?>; font-weight:bold; font-size:20px; }
.imgauto { width:100%; height:auto; padding:4px; }
.img2auto { width:300px; height:auto; padding:4px; }
.video-container { position:relative; padding-bottom:56.25%; padding-top:30px; height:0; margin-bottom:20px; overflow:hidden; }
.video-container iframe, .video-container object, .video-container embed { position:absolute; top:0; left:0; width:100%; height:100%; }
<?php if (!$isMobile): ?>.divart { column-count: 2; }<?php endif; ?>
</style>
<style type="text/css">
#container { position: relative; }
#example { position: absolute; top:0px; left:0px; width:100%; }
</style>
<!-- Cover -->
<div id="container" style="max-width:100%;padding:0px;align-content:center;text-align:center;">
<img src="https://cloudimages.broadwayworld.com/stagemag/newlogos/<?= $logoFile ?>" style="width:100%;<?= $magtype == 1 ? 'max-width:575px;' : 'max-width:100%;' ?>">
<center><img src="https://cloudimages.broadwayworld.com/stagemag/<?= htmlspecialchars($getdupe['image']) ?>" width="300" style="max-width:300px;">
<br>
<center><div align="center" style="text-align:center;">
<table border="0" width="200" style="margin-left:200px;margin-top:10px;"><tr><td>
<font size=+1 color="white">Open the Full Stage Mag</font><br>
</td><td>
<img src="https://api.qrserver.com/v1/create-qr-code/?data=https://stagemag.broadwayworld.com/modern/<?= urlencode($_GET['link'] ?? $getdupe['seo_friendly']) ?>&size=100x100" alt="" />
</td></tr></table>
</center></div>
</div>
<!-- Title page -->
<div style="padding:10px;"><?= $getdupe['titlepage'] ?? '' ?></div>
<?php
/* ── At This Performance ── */
$todaydate = date('Y-m-d');
$atp = $getdupe['atthisperformance'] ?? '';
$atpStart = $getdupe['atthisperformancestart'] ?? '';
$atpEnd = $getdupe['atthisperformanceend'] ?? '';
if ($atp !== '' && $atpStart >= $todaydate && $atpEnd >= $todaydate):
?>
<div style="padding:10px;">
<center><h1>At This Performance</h1></center>
<small><?= $atp ?></small>
</div>
<hr>
<?php endif; ?>
<?php
/* ── Extra pages: After Title Page ── */
$stmtExtra = db_read()->prepare("SELECT pagetitle, pagecopy FROM stagemag.extrapages WHERE aftersection = 'After Title Page' AND programid = :pid");
$stmtExtra->execute([':pid' => $programid]);
$getextra = $stmtExtra->fetchAll();
if (count($getextra) > 0) { include __DIR__ . '/preview-program-extra.php'; }
/* ── Opening note ── */
if (!empty($getdupe['openingnote'])):
?>
<div style="padding:10px;">
<?= str_ireplace('<img ', '<img class="imgauto" ', $getdupe['openingnote']) ?>
</div>
<?php endif; ?>
<?php
/* ── Extra pages: After Opening Pages ── */
$stmtExtra = db_read()->prepare("SELECT pagetitle, pagecopy FROM stagemag.extrapages WHERE aftersection = 'After Opening Pages' AND programid = :pid");
$stmtExtra->execute([':pid' => $programid]);
$getextra = $stmtExtra->fetchAll();
if (count($getextra) > 0) { include __DIR__ . '/preview-program-extra.php'; }
/* ── Song list ── */
if (!empty($getdupe['songlist'])):
?>
<div style="padding:10px;font-size:12pt;">
<center><h1>Song List</h1></center>
<small><?= $getdupe['songlist'] ?></small>
</div>
<?php endif; ?>
<?php
/* ── Ads position 2 ── */
$stmtAds2 = db_read()->prepare("SELECT * FROM stagemag.ads WHERE programid = :pid AND wheread = 2 ORDER BY ordernum");
$stmtAds2->execute([':pid' => $programid]);
$ads2 = $stmtAds2->fetchAll();
if (count($ads2) > 0):
?>
<center><h1 style="font-size:10pt;">Advertisement</h1>
<?php if (!empty($getdupe['sponsor3header'])): ?><div style="padding:10px;"><h1><?= htmlspecialchars($getdupe['sponsor3header']) ?></h1><br><?php endif; ?>
<?php foreach ($ads2 as $ad):
if (!empty($ad['codetag'])) echo $ad['codetag'];
elseif (!empty($ad['image'])) {
echo '<a href="https://stagemag.broadwayworld.com/track-click.php?adid=' . $ad['id'] . '&link=' . urlencode($ad['linker'] ?? '') . '" target="_new">';
echo '<img src="https://cloudimages.broadwayworld.com/stagemag/' . htmlspecialchars($ad['image']) . '" style="width:100%;max-width:100%;">';
echo '</a>';
}
echo '<p></p>';
endforeach; ?>
<?php if (!empty($getdupe['sponsor3header'])): ?></div><?php endif; ?>
</center>
<?php endif; ?>
<?php
/* ── Who's Who grid ── */
$stmtWho = db_read()->prepare("SELECT * FROM stagemag.cast WHERE programid = :pid AND typer = 1 AND name <> '' ORDER BY typer, ordernum");
$stmtWho->execute([':pid' => $programid]);
$whoRows = $stmtWho->fetchAll();
$stmtShow = db_read()->prepare("SELECT showwho, showcast FROM stagemag.productions WHERE id = :pid");
$stmtShow->execute([':pid' => $programid]);
$showme = $stmtShow->fetch();
if (count($whoRows) > 0 && ($showme['showwho'] ?? 0) == 0):
$colcount = $isMobile ? 2 : 4;
?>
<div style="padding:10px;">
<center><h1>Who's Who</h1>
<table style="width:100%;max-width:600px;align:center;">
<?php foreach ($whoRows as $i => $cast):
if ($i % $colcount == 0) echo '<tr>';
?>
<td style="vertical-align:top;max-width:150px;width:25%;"><div style="text-align:center;">
<?php if (!empty($cast['headshot'])): ?><img src="https://cloudimages.broadwayworld.com/stagemag/nd<?= htmlspecialchars($cast['headshot']) ?>" alt="<?= htmlspecialchars($cast['name']) ?>" style="width:125px;" width="125"><?php endif; ?><br>
<span style="font-size:10pt;"><b><?= htmlspecialchars($cast['name']) ?></b><br><?= htmlspecialchars($cast['role']) ?></span>
</div></td>
<?php if (($i + 1) % $colcount == 0) echo '</tr>'; endforeach; ?>
</table>
</center></div>
<?php endif; ?>
<?php
/* ── Cast list ── */
$stmtCast = db_read()->prepare("SELECT * FROM stagemag.cast WHERE programid = :pid AND typer = 1 AND name <> '' ORDER BY ordernum");
$stmtCast->execute([':pid' => $programid]);
$castRows = $stmtCast->fetchAll();
if (count($castRows) > 0 && ($showme['showcast'] ?? 0) == 0):
?>
<div style="padding:10px;">
<center><h1>Cast</h1></center>
<div align="center">
<table border="0" width="100%" cellpadding="4" cellspacing="0">
<?php foreach ($castRows as $c): ?>
<tr>
<td style="width:33%;font-size:10pt;"><center><?= htmlspecialchars($c['name']) ?></center></td>
<td style="width:33%;font-size:10pt;"><center><hr style="height:1px;"></center></td>
<td style="width:33%;font-size:10pt;"><center><?= htmlspecialchars($c['role']) ?></center></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
<?php
/* ── Creative Team ── */
$stmtCreative = db_read()->prepare("SELECT * FROM stagemag.cast WHERE programid = :pid AND typer = 2 AND name <> '' ORDER BY ordernum");
$stmtCreative->execute([':pid' => $programid]);
$creativeRows = $stmtCreative->fetchAll();
if (count($creativeRows) > 0):
?>
<div style="padding:10px;">
<center><h1>Creative Team</h1></center>
<div align="center"><center>
<table border="0" width="100%" cellpadding="4" cellspacing="0">
<?php foreach ($creativeRows as $c): ?>
<tr>
<td style="width:33%;font-size:10pt;"><center><?= htmlspecialchars($c['name']) ?></center></td>
<td style="width:33%;font-size:10pt;"><center><hr style="height:1px;"></center></td>
<td style="width:33%;font-size:10pt;"><center><?= htmlspecialchars($c['role']) ?></center></td>
</tr>
<?php endforeach; ?>
</table></center></div>
</div>
<?php endif; ?>
<?php
/* ── Extra pages: After Cast Page ── */
$stmtExtra = db_read()->prepare("SELECT pagetitle, pagecopy FROM stagemag.extrapages WHERE aftersection = 'After Cast Page' AND programid = :pid");
$stmtExtra->execute([':pid' => $programid]);
$getextra = $stmtExtra->fetchAll();
if (count($getextra) > 0) { include __DIR__ . '/preview-program-extra.php'; }
/* ── Meet the Company ── */
$stmtMeet = db_read()->prepare("SELECT * FROM stagemag.cast WHERE name <> '' AND bio <> '' AND programid = :pid ORDER BY typer, ordernum");
$stmtMeet->execute([':pid' => $programid]);
$meetRows = $stmtMeet->fetchAll();
if (count($meetRows) > 0):
?>
<center><h1>Meet the Company</h1></center><br>
<div style="padding:10px;">
<?php foreach ($meetRows as $c): ?>
<div class="divart" style="width:100%;border-bottom:1px;border-bottom-style:dashed;margin-bottom:15px;min-height:110px;font-size:12pt;page-break-inside:avoid;">
<?php if (!empty($c['headshot'])): ?>
<div style="float:right;padding:5px;"><img src="https://cloudimages.broadwayworld.com/stagemag/nd<?= htmlspecialchars($c['headshot']) ?>" style='height:100px;'></div>
<?php endif; ?>
<b><?= htmlspecialchars($c['name']) ?></b> (<?= htmlspecialchars($c['role']) ?>)<?php if (!empty($c['bio'])): ?><br><?= $c['bio'] ?><?php endif; ?>
</div>
<div style="clear: both;"></div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php
/* ── Extra pages: After Creative Team Page ── */
$stmtExtra = db_read()->prepare("SELECT pagetitle, pagecopy FROM stagemag.extrapages WHERE aftersection = 'After Creative Team Page' AND programid = :pid");
$stmtExtra->execute([':pid' => $programid]);
$getextra = $stmtExtra->fetchAll();
if (count($getextra) > 0) { include __DIR__ . '/preview-program-extra.php'; }
/* ── Photos ── */
$stmtPics = db_read()->prepare("SELECT * FROM stagemag.multimedia WHERE programid = :pid AND typer = 1 ORDER BY typer, ordernum");
$stmtPics->execute([':pid' => $programid]);
$pics = $stmtPics->fetchAll();
if (count($pics) > 0):
?>
<div style="padding:10px;">
<center><h1>Multimedia</h1><br>
<?php foreach ($pics as $p):
if (!empty($p['image']) && strlen($p['image']) > 4):
?>
<img src="https://cloudimages.broadwayworld.com/stagemag/<?= htmlspecialchars($p['image']) ?>" style='height:250px;margin-top:10px;'><br><?= htmlspecialchars($p['caption'] ?? '') ?><p></p>
<?php endif; endforeach; ?>
</center>
</div>
<?php endif; ?>
<?php
/* ── Donor list ── */
if (!empty($getdupe['donorlist']) && strlen($getdupe['donorlist']) > 10):
?>
<div style="padding:10px;">
<center><h1>Donor List</h1></center>
<?= str_ireplace('<img ', '<img class="imgauto" ', $getdupe['donorlist']) ?>
</div>
<?php endif; ?>
<?php /* ── Closing note ── */
if (!empty($getdupe['closingnote'])):
?>
<div style="padding:10px;">
<?= str_ireplace('<img ', '<img class="imgauto" ', $getdupe['closingnote']) ?>
</div>
<?php endif; ?>
<?php
/* ── Extra pages: End of Program ── */
$stmtExtra = db_read()->prepare("SELECT pagetitle, pagecopy FROM stagemag.extrapages WHERE aftersection = 'End of Program' AND programid = :pid");
$stmtExtra->execute([':pid' => $programid]);
$getextra = $stmtExtra->fetchAll();
if (count($getextra) > 0) { include __DIR__ . '/preview-program-extra.php'; }
?>