Update files to use global $referrerurl variable

If possible, capture the referring URL to use in links to static website pages. This way when coming from a distributed HPR website and not hackerpublicradio.com, clicking on a page link will return you to the original domain.
This commit is contained in:
2025-09-30 23:32:20 -04:00
parent 4d51954c3c
commit fbac9f923d
6 changed files with 48 additions and 36 deletions

View File

@@ -258,10 +258,10 @@ The HPR Schedule is entirely community driven and we recommend that <strong>you<
</p>
<p>
There are only <strong><?php echo "${days_to_wait}"; ?></strong> days to wait until next free slot. Please consider <a aria-label="Help on Recording a podcast" href="<?php echo "${baseurl}about.html#recording_a_podcast"; ?>">recording</a> a show for us.
There are only <strong><?php echo "${days_to_wait}"; ?></strong> days to wait until next free slot. Please consider <a aria-label="Help on Recording a podcast" href="<?php echo "${referrerurl}about.html#recording_a_podcast"; ?>">recording</a> a show for us.
</p>
<ol>
<li>Review the updated <em><a aria-label="Learn the Stuff you need to know" href="<?php echo "${baseurl}about.html#agreement"; ?>">Stuff you need to know</a></em> page.</li>
<li>Review the updated <em><a aria-label="Learn the Stuff you need to know" href="<?php echo "${referrerurl}about.html#agreement"; ?>">Stuff you need to know</a></em> page.</li>
<li>Select a date, or post to the reserve queue.</li>
<li>Click the link in the confirmation email</li>
<li>Then <a aria-label="Help on Adding an episode" href="<?php echo "${baseurl}about.html#adding_an_episode"; ?>">fill in a form</a>.</li>
@@ -275,22 +275,22 @@ There are only <strong><?php echo "${days_to_wait}"; ?></strong> days to wait un
<li>When the queue is filling up then leave some slots free for new contributors.</li>
<li>Post non urgent shows into the first empty week.</li>
<li>If you are uploading a series of shows then post them one every two weeks.</li>
<li>If you have a non urgent show that is timeless, then add it to the <a href="https://hackerpublicradio.org/about.html#reserve_queue">Reserve Queue</a>.</li>
<li>If you have a non urgent show that is timeless, then add it to the <a href="<?php echo $referrerurl ?>about.html#reserve_queue">Reserve Queue</a>.</li>
</ol>
<h2 id="reserve_queue">Add to the Reserve Queue ?</h2>
<p>
<a aria-label="Post to the reserve queue" href="<?php echo "${hubBaseurl}"; ?>request.php?id=9999">Post your show to the <strong>reserve queue</strong></a> if you don't care when it will be released. <small><a aria-label="Help on the reserve queue" href="<?php echo "${baseurl}about.html#reserve_queue"; ?>">&#9432;</a></small>
<a aria-label="Post to the reserve queue" href="<?php echo "${hubBaseurl}"; ?>request.php?id=9999">Post your show to the <strong>reserve queue</strong></a> if you don't care when it will be released. <small><a aria-label="Help on the reserve queue" href="<?php echo "${referrerurl}"; ?>about.html#reserve_queue";">&#9432;</a></small>
</p>
<h2 id="current_schedule">Select a date in the current schedule ?</h2>
<p>
<strong>Schedule</strong> the release</a> day your show will be aired. <small><a aria-label="Help on the scheduling guidelines" href="<?php echo "${baseurl}about.html#scheduling_guidelines"; ?>">&#9432;</a></small>
<strong>Schedule</strong> the release</a> day your show will be aired. <small><a aria-label="Help on the scheduling guidelines" href="<?php echo "${referrerurl}"; ?>about.html#scheduling_guidelines">&#9432;</a></small>
</p>
<h3>Next Two Months <small><a aria-label="Help on the HPR processing workflow" href="<?php echo "${baseurl}about.html#workflow"; ?>">&#9432;</a></small></h3>
<h3>Next Two Months <small><a aria-label="Help on the HPR processing workflow" href="<?php echo "${referrerurl}"; ?>about.html#workflow">&#9432;</a></small></h3>

View File

@@ -31,9 +31,9 @@
<link rel="alternate" type="application/rss+xml" title="Hacker Public Radio MP3 RSS" href="https://hackerpublicradio.org/hpr_mp3_rss.php" />
<link rel="alternate" type="application/rss+xml" title="Hacker Public Radio Comments RSS" href="https://hackerpublicradio.org/comments.rss" />
<link rel="license" title="CC BY-SA 4.0" href="https://creativecommons.org/licenses/by-sa/4.0/" />
<link href="https://hackerpublicradio.org/css/hpr.css" rel="stylesheet" />
<link href="<?php echo $referrerurl ?>css/hpr.css" rel="stylesheet" />
<!--[if IE]>
<link rel="stylesheet" href="https://hackerpublicradio.org/css/hpr.css" media="screen" type="text/css" />
<link rel="stylesheet" href="<?php echo $referrerurl ?>css/hpr.css" media="screen" type="text/css" />
<script src="/JavaScript/html5.js"></script>
<![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.5, user-scalable=yes"/>
@@ -42,16 +42,16 @@
<body id="give">
<div id="container" class="shadow">
<header>
<a href="https://hackerpublicradio.org/"><img id="hprlogo" src="https://hackerpublicradio.org/images/hpr_logo.png" alt="hprlogo"></a>
<a href="<?php echo $referrerurl ?>"><img id="hprlogo" src="<?php echo $referrerurl ?>images/hpr_logo.png" alt="hprlogo"></a>
<div id="hpr_banner">
<p id="accessible_menu">
<a href="https://hackerpublicradio.org/sitemap.html">Site Map</a>
<a href="<?php echo $referrerurl ?>sitemap.html">Site Map</a>
- <a href="#maincontent">skip to main content</a>
</p>
<h1 id="sitename">
<a href="https://hackerpublicradio.org/correspondents/index.html">H</a>acker
<a href="https://hackerpublicradio.org/comments_viewer.html">P</a>ublic
<a href="https://hackerpublicradio.org/syndication.html">R</a>adio
<a href="<?php echo $referrerurl ?>correspondents/index.html">H</a>acker
<a href="<?php echo $referrerurl ?>comments_viewer.html">P</a>ublic
<a href="<?php echo $referrerurl ?>syndication.html">R</a>adio
</h1>
<h2>Your ideas, projects, opinions - podcasted.</h2>
<h3>New episodes every weekday Monday through Friday.<br />
@@ -60,14 +60,14 @@
<hr />
<nav class="menu" role="navigation"> <ul>
<li><a href="https://hub.hackerpublicradio.org/calendar.php"><strong>⇧Upload⇧</strong></a></li>
<li><a href="https://hackerpublicradio.org/index.html"><strong>Home »</strong></a></li>
<li><a href="https://hackerpublicradio.org/syndication.html">Get Shows</a></li>
<li><a href="https://hackerpublicradio.org/about.html#so_you_want_to_record_a_podcast">Give Shows</a></li>
<li><a href="https://hackerpublicradio.org/about.html#how_to_help">Contribute</a></li>
<li><a href="https://hackerpublicradio.org/tags.html">Tags</a></li>
<li><a href="https://hackerpublicradio.org/about.html">About</a></li>
<li><a href="https://hackerpublicradio.org/search.html">Search</a></li>
<li><a href="<?php echo $referrerurl ?>calendar.php"><strong>⇧Upload⇧</strong></a></li>
<li><a href="<?php echo $referrerurl ?>index.html"><strong>Home »</strong></a></li>
<li><a href="<?php echo $referrerurl ?>syndication.html">Get Shows</a></li>
<li><a href="<?php echo $referrerurl ?>about.html#so_you_want_to_record_a_podcast">Give Shows</a></li>
<li><a href="<?php echo $referrerurl ?>about.html#how_to_help">Contribute</a></li>
<li><a href="<?php echo $referrerurl ?>tags.html">Tags</a></li>
<li><a href="<?php echo $referrerurl ?>about.html">About</a></li>
<li><a href="<?php echo $referrerurl ?>search.html">Search</a></li>
</ul>
</nav>
</header>

View File

@@ -1,3 +1,5 @@
<?php
header("location:${hubBaseurl}calendar.php");
?>
<meta name="referrer" content="<?php ${referrerurl} ?>">

View File

@@ -158,7 +158,7 @@ include 'header.php';
<main id="maincontent">
<h1>Requesting a slot for your show.</h1>
<p>Please select your desired slot, and enter a valid email address.<br />
See our <a aria-label="Help on adding an episode" href="<?php echo "${baseurl}about.html#adding_an_episode"; ?>">help page</a> for more information</a>
See our <a aria-label="Help on adding an episode" href="<?php echo "${referrerurl}about.html#adding_an_episode"; ?>">help page</a> for more information</a>
</p>
<form method="POST" action="request_confirm.php">
<table>
@@ -197,7 +197,7 @@ include 'header.php';
<td><input required type="email" name="email" placeholder="To send you the upload link"></td>
</tr>
</table>
<p><em>You must have your audio recording ready to upload <a aria-label="Help on the reserving a slot" href="<?php echo "${baseurl}about.html#reserving"; ?>"><strong>before</strong> you pick a slot</a>.</em></p>
<p><em>You must have your audio recording ready to upload <a aria-label="Help on the reserving a slot" href="<?php echo "${referrerurl}about.html#reserving"; ?>"><strong>before</strong> you pick a slot</a>.</em></p>
<input type="submit" value="Next">
</form>
<p>

View File

@@ -130,11 +130,11 @@ include 'header.php';
<form method="POST" action="upload_confirm.php" enctype="multipart/form-data">
<table class="upload">
<tr>
<td>Host Email (<a href="<?php echo "${baseurl}about.html#email"; ?>" target="_blank">?</a>):</td>
<td>Host Email (<a href="<?php echo "${referrerurl}about.html#email"; ?>" target="_blank">?</a>):</td>
<td><?php echo $email;?></td>
</tr>
<tr>
<td>Image: (<a href="<?php echo "${baseurl}about.html#image"; ?>" target="_blank">?</a>)</td>
<td>Image: (<a href="<?php echo "${referrerurl}about.html#image"; ?>" target="_blank">?</a>)</td>
<td>
<?php
echo "<img src=\"$image_url\" alt=\"host image\" /><br /><small><em>";
@@ -180,15 +180,15 @@ include 'header.php';
<h2>Please fill in some information about this episode</h2>
<table class="upload">
<tr>
<td><strong>Title(*) (<a href="<?php echo "${baseurl}about.html#Title"; ?>" target="_blank">?</a>):</strong></td>
<td><strong>Title(*) (<a href="<?php echo "${referrerurl}about.html#Title"; ?>" target="_blank">?</a>):</strong></td>
<td><input required type="text" name="title" size="50" maxlength="100" placeholder="Enter a short descriptive title for your show."></td>
</tr>
<tr>
<td><strong>Summary(*) (<a href="<?php echo "${baseurl}about.html#Short_Summary"; ?>" target="_blank">?</a>):</strong></td>
<td><strong>Summary(*) (<a href="<?php echo "${referrerurl}about.html#Short_Summary"; ?>" target="_blank">?</a>):</strong></td>
<td><input required type="text" name="summary" size="70" maxlength="100" placeholder="This is a short 100 character summary of what your show is about."></td>
</tr>
<tr>
<td><strong>Explicit: (<a href="<?php echo "${baseurl}about.html#Explicit"; ?>" target="_blank">?</a>)</strong></td>
<td><strong>Explicit: (<a href="<?php echo "${referrerurl}about.html#Explicit"; ?>" target="_blank">?</a>)</strong></td>
<td>
Is the show <em>Explicit</em> ?:
<input required type="radio" name="explicit" value="Yes">Yes
@@ -197,7 +197,7 @@ include 'header.php';
</td>
</tr>
<tr>
<td><strong>License: (<a href="<?php echo "${baseurl}about.html#License"; ?>" target="_blank">?</a>)</strong></td>
<td><strong>License: (<a href="<?php echo "${referrerurl}about.html#License"; ?>" target="_blank">?</a>)</strong></td>
<td>
<select name="license">
<option value="CC-BY-SA" selected>CC-BY-SA</option>
@@ -212,7 +212,7 @@ include 'header.php';
</td>
</tr>
<tr>
<td><strong>Notes(*) (<a href="<?php echo "${baseurl}about.html#show_notes"; ?>" target="_blank">?</a>):</strong></td>
<td><strong>Notes(*) (<a href="<?php echo "${referrerurl}about.html#show_notes"; ?>" target="_blank">?</a>):</strong></td>
<td>
<noscript>
<textarea required name="notes" maxlength="40000" rows="20" cols="70" placeholder="Please add your show notes here." ></textarea>
@@ -222,7 +222,7 @@ include 'header.php';
</tr>
<noscript>
<tr>
<td>Format: (<a href="<?php echo "${baseurl}about.html#shownotes_format"; ?>" target="_blank">?</a>)</td>
<td>Format: (<a href="<?php echo "${referrerurl}about.html#shownotes_format"; ?>" target="_blank">?</a>)</td>
<td>
<small>What format if any did you just use in the show notes above ?</small><br />
<select name="shownotes_format">
@@ -237,7 +237,7 @@ include 'header.php';
</tr>
</noscript>
<tr>
<td>Series: (<a href="<?php echo "${baseurl}about.html#series"; ?>" target="_blank">?</a>)</td>
<td>Series: (<a href="<?php echo "${referrerurl}about.html#series"; ?>" target="_blank">?</a>)</td>
<td>
<?php
$result = mysqli_query($connection, "SELECT id, name FROM miniseries WHERE private=0 ORDER BY name ASC");
@@ -251,22 +251,22 @@ include 'header.php';
</td>
</tr>
<tr>
<td>Tags: (<a href="<?php echo "${baseurl}about.html#tags"; ?>" target="_blank">?</a>)</td>
<td>Tags: (<a href="<?php echo "${referrerurl}about.html#tags"; ?>" target="_blank">?</a>)</td>
<td><input required type="text" name="tags" size="70" maxlength="100" placeholder="Add a list of comma separated tags." /><br />
Add a list of <strong>comma separated</strong> tags.<br />
If you can provide tags for your show that would be appreciated; you are certainly the best judge of what makes good tags, but if not then a volunteer will add them later.
</td>
</tr>
<tr>
<td><strong>Upload Method: (<a href="<?php echo "${baseurl}about.html#upload_method"; ?>" target="_blank">?</a>)</strong></td>
<td><strong>Upload Method: (<a href="<?php echo "${referrerurl}about.html#upload_method"; ?>" target="_blank">?</a>)</strong></td>
<td>
<em>You have the choice of the following upload options:</em> <br />
<p>
<strong>1. Upload now</strong> via this browser: (<a href="<?php echo "${baseurl}about.html#browser"; ?>" target="_blank">?</a>)<br />
<strong>1. Upload now</strong> via this browser: (<a href="<?php echo "${referrerurl}about.html#browser"; ?>" target="_blank">?</a>)<br />
<input type="file" multiple="multiple" name="media_files[]" title="select if using the http upload option" />
</p>
<p>
<strong>2. Provide a url</strong> we we can directly download it from: (<a href="<?php echo "${baseurl}about.html#url"; ?>" target="_blank">?</a>)<br />
<strong>2. Provide a url</strong> we we can directly download it from: (<a href="<?php echo "${referrerurl}about.html#url"; ?>" target="_blank">?</a>)<br />
This must be accessable using a curl or wget command.<br />
Please avoid services that require login or downloading via a browser.<br />
<input type="url" size="30" name="url" placeholder="https://example.com/hpr9999.flac">

View File

@@ -20,4 +20,14 @@ $naughty_stings_file = '/path/to/strings.txt';
$justification_file = '/path/to/justification.txt';
# Read more: http://vidiame.com/php/how-to-block-multiple-ip-addresses-using-php
# The $referrerurl is used for links to pages from the orginating HPR site.
$referrerurl = $baseurl;
session_start();
if ($_SESSION['referrerurl']) {
$referrerurl = $_SESSION['referrerurl'];
}
else if ($_SERVER["HTTP_REFERER"] && !str_starts_with($_SERVER["HTTP_REFERER"], $hubBaseurl)) {
$_SESSION['referrerurl'] = $_SERVER["HTTP_REFERER"];
$referrerurl = $_SERVER["HTTP_REFERER"];
}
?>