Compare commits

...

16 Commits
main ... main

Author SHA1 Message Date
06af0e06be Merge pull request 'Added the warning and link to feedback to the shownotes' (#59) from I52_Add_comment_link_to_the_end_of_the_shownotes_in_the_rss_feed into main
Reviewed-on: HPR/hpr_hub#59
2024-10-31 10:24:05 +00:00
297d2040db Added the warning and link to feedback to the shownotes 2024-10-31 11:21:19 +01:00
17e46fea75 irss-future is now in rss.php 2024-10-31 07:48:13 +01:00
043288e5e4 Merge pull request 'Added support to add/update metadata on multiple assets via a json file' (#56) from I226_Asset_table_management into main
Reviewed-on: HPR/hpr_hub#56
2024-10-27 12:16:27 +00:00
3fc4da18ed Added support to add/update metadata on multiple assets via a json file 2024-10-26 19:31:07 +02:00
1615626c42 Merge pull request 'Fix future feed by removing gomax and adding future switch' (#55) from I54_Future_feed_not_working_after_switching_to_ccdn into main
Reviewed-on: HPR/hpr_hub#55
2024-10-23 08:37:41 +00:00
236cd08e6f Removed gomax as it was not used and it didn't work
Added a future switch to switch before `now()` and after
Cleaned up some commented out lines
2024-10-23 10:18:52 +02:00
50945b9968 Merge pull request 'The addition of a ccdn redirector and updating the link to media to point to it' (#53) from 225_Switch_url_for_media_to_hpr_ccdn into main
Reviewed-on: HPR/hpr_hub#53
Reviewed-by: Roan Horning <rho_n@josh@anhonesthost.com>
2024-10-23 07:36:34 +00:00
b2708a2b3f The addition of a ccdn redirector and updating the link to media to point to it 2024-10-21 17:35:20 +02:00
faa14cd6da 2024-10-20_21-12-39_CEST 2024-10-20 21:12:39 +02:00
8bf6aad70b Fix stats page hpr shows with playtime 2024-10-10 11:02:03 +02:00
112f443a04 Fix stats page hpr shows 2024-10-10 10:48:23 +02:00
7fdf12df28 Added the Scheduling Guidelines to the upload page 2024-10-09 20:17:49 +02:00
f19938a0c2 2024-10-04_17-33-29Z_Friday 2024-10-04 19:33:29 +02:00
dd2c9e6382 2024-09-28_18-02-01Z_Saturday database changed 2024-09-28 20:02:01 +02:00
4b8f414d63 Merge pull request 'Added an episode counter for feed generation to determine whether or not to include show notes.' (#42) from kdmurrayhpr/hpr_hub:main into main
Reviewed-on: HPR/hpr_hub#42
2024-09-24 07:08:23 +00:00
13 changed files with 593 additions and 319 deletions

View File

@ -54,20 +54,20 @@ trap 'cleanup_temp $TMP1' SIGHUP SIGINT SIGPIPE SIGTERM EXIT
ffmpeg -v 0 -analyzeduration 900000000000 -probesize 200M -threads 2 -i "$AUDIO" \ ffmpeg -v 0 -analyzeduration 900000000000 -probesize 200M -threads 2 -i "$AUDIO" \
-filter_complex aformat=channel_layouts=mono,showwavespic=colors=white:s=3200x800 \ -filter_complex aformat=channel_layouts=mono,showwavespic=colors=white:s=3200x800 \
-frames:v 1 -f apng - 2>/dev/null | \ -frames:v 1 -f apng - 2>/dev/null | \
convert - -background black -alpha remove -alpha off "$TMP1" 2>/dev/null | cat > /dev/null 2>&1 magick convert - -background black -alpha remove -alpha off "$TMP1" 2>/dev/null | cat > /dev/null 2>&1
# #
# Not clear what's being done to the image here, but it produces a useful end # Not clear what's being done to the image here, but it produces a useful end
# result, or seems to! # result, or seems to!
# #
convert -background black "$TMP1" -gravity center -background black -transparent white - | \ magick convert -background black "$TMP1" -gravity center -background black -transparent white - | \
convert - -gravity South -background white -splice 0x5 -background black -splice 0x5 - | \ magick convert - -gravity South -background white -splice 0x5 -background black -splice 0x5 - | \
convert - -trim - | \ magick convert - -trim - | \
convert - -gravity South -chop 0x5 - | \ magick convert - -gravity South -chop 0x5 - | \
convert - -gravity North -background white -splice 0x5 -background black -splice 0x5 - | \ magick convert - -gravity North -background white -splice 0x5 -background black -splice 0x5 - | \
convert - -trim - | \ magick convert - -trim - | \
convert - -gravity North -chop 0x5 - | \ magick convert - -gravity North -chop 0x5 - | \
convert - -resize '800x200!' "$IMAGE" magick convert - -resize '800x200!' "$IMAGE"
# #
# The original renamed the temporary file to be the target image file, but # The original renamed the temporary file to be the target image file, but

27
bin/check_assets.bash Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
# CC-0 Ken Fallon
assets_db="assets_202410181601.csv"
total="$( wc -l assets_202410181601.csv | awk '{print $1}' )"
count=1
awk '{print $2}' "${assets_db}" | grep -E 'ogg|spx|mp3' | while read this_asset_name
do
this_asset="/mnt/data/HPR/${this_asset_name}"
#echo -ne "\r$(\date "+%Y-%m-%d %H:%M:%S") The scanner lid is CLOSED. \r"
if [ ! -s "${this_asset}" ]
then
echo "ERROR: \"${this_asset}\" missing."
else
this_size="$( ls -al "${this_asset}" | awk '{print $5}' )"
this_sha1sum="$( sha1sum "${this_asset}" | awk '{print $1}' )"
if [ "$( grep -cE "${this_asset_name}.*${this_size}.*${this_sha1sum}" "${assets_db}" )" -ne 1 ]
then
echo "ERROR: \"${this_asset}\" incorrect properties."
fi
fi
echo -ne "\rProcessing ${count} of ${total}"
count=$((count+1))
done
exit

View File

@ -575,7 +575,7 @@ then
# rsync -ave ssh --partial --progress --ignore-existing "${media_dir}/hpr${ep_num}.wav".txt hpr:www/eps/hpr${ep_num}/hpr${ep_num}.txt | tee -a ${fname}_tmp.log # rsync -ave ssh --partial --progress --ignore-existing "${media_dir}/hpr${ep_num}.wav".txt hpr:www/eps/hpr${ep_num}/hpr${ep_num}.txt | tee -a ${fname}_tmp.log
# #
# ssh hpr -t "ls -al /home/hpr/www/eps/hpr${ep_num}*" # ssh hpr -t "ls -al /home/hpr/www/eps/hpr${ep_num}*"
# cp -v "${mediafile}" "${upload_dir}/hpr${ep_num}_source.${mediaextension}" cp -v "${mediafile}" "${upload_dir}/hpr${ep_num}_source.${mediaextension}"
#echo "Remove temp files" #echo "Remove temp files"
rm -v ~hpr${ep_num}_summary.wav ~~hpr${ep_num}_summary.wav silence.wav rm -v ~hpr${ep_num}_summary.wav ~~hpr${ep_num}_summary.wav silence.wav
@ -606,5 +606,5 @@ else
echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_ogg_rss.php?gomax=1\" -O - | xmlstarlet val --err -" echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_ogg_rss.php?gomax=1\" -O - | xmlstarlet val --err -"
echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_mp3_rss.php?gomax=1\" -O - | xmlstarlet val --err -" echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_mp3_rss.php?gomax=1\" -O - | xmlstarlet val --err -"
echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_spx_rss.php?gomax=1\" -O - | xmlstarlet val --err -" echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_spx_rss.php?gomax=1\" -O - | xmlstarlet val --err -"
echo "rsync -ave ssh --partial --progress ${upload_dir}/ borg:/data/IA/uploads/" echo "rsync -ave ssh --partial --progress ${upload_dir}/hpr${ep_num}* borg:/data/IA/uploads/"
fi fi

6
bin/run-speedtest.bash Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# * * * * * /usr/local/bin/run-speedtest.bash >/dev/null 2>&1
speedtest-cli --json | jq '.' > /var/www/html/speedtest.json
chown apache:apache /var/www/html/speedtest.json

348
cms/assets.php Normal file
View File

@ -0,0 +1,348 @@
<?php
require "/home/hpr/php/include.php";
// curl --netrc-file $HOME/.netrc --verbose --request POST https://hub.hackerpublicradio.org/cms/asset.php --data-ascii @assets.json --header "Content-Type: application/json"
//Make sure that it is a POST request.
if(strcasecmp($_SERVER['REQUEST_METHOD'], 'POST') != 0){
throw new Exception('Request method must be POST!');
}
//Make sure that the content type of the POST request has been set to application/json
$contentType = isset($_SERVER["CONTENT_TYPE"]) ? trim($_SERVER["CONTENT_TYPE"]) : '';
if(strcasecmp($contentType, 'application/json') != 0){
throw new Exception('Content type must be: application/json');
}
//Receive the RAW post data.
$content = trim(file_get_contents("php://input"));
//Attempt to decode the incoming RAW post data from JSON.
$decoded = json_decode($content, true);
//If json_decode failed, the JSON is invalid.
if(!is_array($decoded)){
logextra( "Received content contained invalid JSON!" );
naughty( "0e0e69415750c96f19d234f83270fdea" );
}
foreach($decoded['assets'] as $asset) {
// Check episode_id
if ( isset( $asset['episode_id'] ) ) {
$provided_episode_id = $asset['episode_id'];
$provided_episode_id = filter_var($provided_episode_id, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
$result = mysqli_query($connection, 'SELECT MAX(id) FROM eps;');
if (!isset($result)) {
logextra( "Can't connect to db" );
naughty( "4c85d7b9e1d2eb741cdb60fd9f97b852" );
die('Could not query:' . mysqli_error());
}
$maxhost_array = mysqli_fetch_row( $result );
$maxhost = $maxhost_array[0];
$num_get_args=0;
foreach($_GET as $k => $v) {
++$num_get_args;
}
if (strval(intval($provided_episode_id)) != strval($provided_episode_id)) {
logextra( "ID is not a valid number because strval(intval($provided_episode_id)) != strval($provided_episode_id))" );
naughty( "b2babb5bebde79e08ddf3c780c56615d" );
}
if ( intval($provided_episode_id) <= 0 ){
logextra( "ID is not a valid number because intval($provided_episode_id) <= 0" );
naughty( "b245522d0582e61612e8b7dcdb0e0f4c" );
}
if ( intval($provided_episode_id) > $maxhost ){
logextra( "ID is not a valid number because intval($provided_episode_id) > $maxhost" );
naughty( "c6feadcf0b6eda204cbfba6824aa2c7a" );
}
if ( $num_get_args > 1 ){
logextra( "ID is not a valid number because \$num_get_args: $num_get_args > 1" );
naughty( "ba22518c5ced567cd0b855206985f036" );
}
$query = "SELECT id FROM eps WHERE id = '$provided_episode_id'";
$result = @mysqli_query($connection, $query);
if($result === FALSE) {
logextra( "No result returned for this query \"SELECT id FROM eps WHERE id = '$provided_episode_id'\"" );
naughty( "fa0778750519cb140b4076c844b3ec78" );
}
else {
$db = mysqli_fetch_array($result, MYSQLI_ASSOC);
if ( empty($db["id"]) ) {
logextra( "No result returned for this id:\"${id}\"" );
naughty( "1e09df9f3896da3e80507ea4538a4aca" );
}
}
$episode_id = $provided_episode_id;
logextra( "Found Valid \$episode_id: $episode_id" );
}
else {
logextra( "No episode_id provided" );
naughty( "eae535cc88680a5bdab4e7bb4e54d83e" );
exit;
}
// Check filename
if ( isset( $asset['filename'] ) ) {
$provided_filename = $asset['filename'];
$provided_filename = filter_var($provided_filename, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
$this_dirname = dirname("$provided_filename", 2);
if ( empty($this_dirname) ) {
logextra( "no dirname" );
naughty("b23ed28377cf4cf36cbf01931377ddc7");
}
if ( $this_dirname === "/" ) {
logextra( "dirname is root" );
naughty("b90228a9c4d008eab57304bd36b75a08");
}
$this_basename = basename($provided_filename);
if ( empty($this_basename) ) {
logextra( "Cound not extract basename from filename: $provided_filename" );
naughty("44b5022e3a32605c6b0afdf7699ed153");
}
if ( $this_basename !== $provided_filename ) {
logextra( "filename: $provided_filename does not match name:$this_basename" );
naughty("832f0283544692bd6691e3802e67099c");
}
$this_ext = pathinfo($provided_filename, PATHINFO_EXTENSION);
if ( empty($this_ext) ) {
logextra( "The extension for \"$provided_filename\" is empty" );
naughty("63166ba6572ac51b47804d9787152903");
}
$this_prefix =pathinfo($provided_filename, PATHINFO_FILENAME);
if ( empty($this_prefix) ) {
logextra( "The prefix for \"$provided_filename\" is empty" );
naughty("9ad9a6b9e47e6960ff30442c3c808609");
}
if ( strlen($provided_filename) < 5 ) {
logextra( "The length of \"$provided_filename\" is less than 5" );
naughty("e131ae01530f4098c299aaca0a6ee8e1");
}
if ( strlen($provided_filename) > 60 ) {
logextra( "The length of \"$provided_filename\" is greater than 60" );
naughty("d90560ef4cac05954c93523d529ed20e");
}
if (!in_array( $this_ext, $allowed_extensions, true )) {
logextra( "This extension $this_ext, is not in the list of allowed_extensions" );
naughty("dd98c84719083fb80fecbd0405504038");
}
$filename = $provided_filename;
logextra( "Found Valid \$filename: $filename" );
}
else {
logextra( "No filename provided" );
naughty( "1edd3bcd2a16c152f0a97106372862f9" );
exit;
}
// Check extension
if ( isset( $asset['extension'] ) ) {
$provided_extension = $asset['extension'];
$provided_extension = filter_var($provided_extension, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
if ( $provided_extension !== $this_ext ) {
logextra( "The extensions provided \"$provided_extension\" and in the filename dont match \"$provided_filename\"" );
naughty("ed58e1493aa56e0eaf50362cc6f64425");
}
if (!in_array( $provided_extension, $allowed_extensions, true )) {
logextra( "This extension $this_ext, is not in the list of allowed_extensions" );
naughty("dc406b9151871e38ac69c2bf44fa74da");
}
$extension = $provided_extension;
logextra( "Found Valid \$extension: $extension" );
}
else {
logextra( "No extension provided" );
naughty( "04b53ecd0ffa3faa68db1e541554903d" );
exit;
}
// Check size
if ( isset( $asset['size'] ) ) {
$provided_size = $asset['size'];
$provided_size = filter_var($provided_size, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
if (strval(intval($provided_size)) != strval($provided_size)) {
logextra( "The provided size is not a valid number because strval(intval($provided_size)) != strval($provided_size))" );
naughty( "cc349935f0d80b40d5593b0fd54eaf58" );
}
if ( intval($provided_size) <= 0 ){
logextra( "The provided size is not a valid number because intval($provided_size) <= 0" );
naughty( "91c54771bcf68f974c9aa8959f953dd8" );
}
if ( intval($provided_size) > 3000000000 ){
logextra( "The provided size is not a valid number because it's a lot larger than any show so far" );
naughty( "8c085ec045b062e3a864e6fc22fceee4" );
}
$size = $provided_size;
logextra( "Found Valid \$size: $size" );
}
else {
logextra( "No size provided" );
naughty( "a6d661c483c6d62d4df1df88a64118ce" );
exit;
}
// Check sha1sum
if ( isset( $asset['sha1sum'] ) ) {
$provided_sha1sum = $asset['sha1sum'];
$provided_sha1sum = filter_var($provided_sha1sum, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
if ( !preg_match('/^[0-9a-f]{40}$/i', $provided_sha1sum) ) {
logextra( "The format of the sha1sum is invalid $provided_sha1sum" );
naughty( "e30c8db8a7e07ba69ef18f957f3e8843" );
}
$sha1sum = $provided_sha1sum;
logextra( "Found Valid \$sha1sum: $sha1sum" );
}
else {
logextra( "No sha1sum provided" );
naughty( "cd3d303dbefec08016d567080116ef77" );
exit;
}
// Check mime_type
if ( isset( $asset['mime_type'] ) ) {
$provided_mime_type = $asset['mime_type'];
$provided_mime_type = filter_var($provided_mime_type, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
if ( !preg_match('/^[\w-]+\/[\w-]+(?:;\s*[\w-]+=[\w-]+)*$/i', $provided_mime_type) ) {
logextra( "The format of the mime_type is invalid \"$provided_mime_type\"" );
naughty( "b36041a7d959730a9a541404db3b5025" );
}
list($content_type, $charset_type) = explode('; charset=', $provided_mime_type);
if ( !isset( $content_type ) ) {
logextra( "Can't find content_type in \"$provided_mime_type\"" );
naughty( "c28ac580f5281ab2d97cbf052c92a25c" );
}
if ( empty( $content_type ) ) {
logextra( "Empty content_type in \"$provided_mime_type\"" );
naughty( "fcec6e4039bc60daede3434e24c97a9f" );
}
$allowed_content_type = array( "application/json", "application/octet-stream", "application/ogg", "audio/flac", "audio/mpeg", "audio/ogg", "audio/x-flac", "audio/x-wav", "image/jpeg", "image/png", "text/plain");
if (!in_array( $content_type, $allowed_content_type, true )) {
logextra( "This content_type \"$content_type\", is not in the list of allowed_extensions" );
naughty("4f29dcd2b3ef7efc5c4bc65be7a787ca");
}
if ( !isset( $charset_type ) ) {
logextra( "Can't find charset_type in \"$provided_mime_type\"" );
naughty( "" );
}
if ( empty( $charset_type ) ) {
logextra( "Empty charset_type in \"$provided_mime_type\"" );
naughty( "" );
}
$allowed_charset_type = array( "binary", "us-ascii", "utf-8");
if (!in_array( $charset_type, $allowed_charset_type, true )) {
logextra( "This charset_type \"$charset_type\", is not in the list of allowed_extensions" );
naughty("");
}
$mime_type = $provided_mime_type;
logextra( "Found Valid \$mime_type: $mime_type" );
}
else {
logextra( "No mime_type provided" );
naughty( "0c85eb982665a4978fea8f85611fbe88" );
exit;
}
// Check file_type
if ( isset( $asset['file_type'] ) ) {
$provided_file_type = $asset['file_type'];
$provided_file_type = filter_var($provided_file_type, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
if ( strlen($provided_file_type) < 5 ) {
logextra( "The length of \"$provided_file_type\" is less than 5" );
naughty("60839aaddc82e0fbe4f5da269c361cf6");
}
if ( strlen($provided_file_type) > 140 ) {
logextra( "The length of \"$provided_file_type\" is greater than 140" );
naughty("cafbb1b0c9955b92303fe34102890fa3");
}
$file_type = $provided_file_type;
logextra( "Found Valid \$file_type: $file_type" );
}
else {
logextra( "No file_type provided" );
naughty( "a1b6a02d68533f9749da16164cbe704e" );
exit;
}
// Write values to db
//$episode_id is a number
$filename = mysqli_real_escape_string( $connection, $filename );
$extension = mysqli_real_escape_string( $connection, $extension );
//$size is a number
$sha1sum = mysqli_real_escape_string( $connection, $sha1sum );
$mime_type = mysqli_real_escape_string( $connection, $mime_type );
$file_type = mysqli_real_escape_string( $connection, $file_type );
$query_replace = "REPLACE INTO assets VALUES ('$episode_id','{$filename}','{$extension}','$size','{$sha1sum}','{$mime_type}','{$file_type}')";
$result = mysqli_query($connection, $query_replace );
if(!$result) {
problem("ERROR: DB problem - The asset for \"$episode_id\" with filename of \"$filename\" was not added to the eps db.");
}
else{
logextra( "mysql_query.result: \"$result\"\n" );
}
if (mysqli_errno( $connection )) {
$error = "MySQL error ".mysqli_errno( $connection ).": ".mysqli_error()."\n";
problem("ERROR: MySQL error- The asset for \"$episode_id\" with filename of \"$filename\" was not added to the eps db.\n$error");
}
logextra( "Finished ." );
}
http_response_code(200);
?>

View File

@ -19,17 +19,17 @@ if (isset($_GET['id'])) {
$query = "SELECT id FROM eps WHERE id = '$id'"; $query = "SELECT id FROM eps WHERE id = '$id'";
$result = @mysqli_query($connection, $query); $result = @mysqli_query($connection, $query);
if($result === FALSE) { if($result === FALSE) {
call412( "a9564ebc3289b7a14551baf8ad5ec60a" ); call412( "dc5b8dae7ea2a7e70ac0b7ea65ce2d12" );
} }
else { else {
$db = mysqli_fetch_array($result, MYSQLI_ASSOC); $db = mysqli_fetch_array($result, MYSQLI_ASSOC);
if ( empty($db["id"]) ) { if ( empty($db["id"]) ) {
call412( "a9564ebc3289b7a14551baf8ad5ec60a" ); call412( "2b6462ff2389405a796066dfc73ccf55" );
} }
} }
} }
else { else {
call412( "a9564ebc3289b7a14551baf8ad5ec60a" ); call412( "ae1f3471af22d32d3bf2efc9130a00ae" );
exit; exit;
} }
Header('Content-type: text/tab-separated-values'); Header('Content-type: text/tab-separated-values');

View File

@ -18,11 +18,12 @@ if (isset($_GET['format'])){
} }
} }
$twat_startdate = abs(strtotime(date("c")) - strtotime("2005-09-19T00:00:00Z")); $total_twt_shows = 300;
$twat_years = floor($twat_startdate / (365*60*60*24)); $twt_startdate = abs(strtotime(date("c")) - strtotime("2005-09-19T00:00:00Z"));
$twat_months = floor(($twat_startdate - $twat_years * 365*60*60*24) / (30*60*60*24)); $twt_years = floor($twt_startdate / (365*60*60*24));
$twat_days = floor(($twat_startdate - $twat_years * 365*60*60*24 - $twat_months*30*60*60*24)/ (60*60*24)); $twt_months = floor(($twt_startdate - $twt_years * 365*60*60*24) / (30*60*60*24));
$agetwat = $twat_startdate; $twt_days = floor(($twt_startdate - $twt_years * 365*60*60*24 - $twt_months*30*60*60*24)/ (60*60*24));
$agetwt = $twt_startdate;
$hpr_startdate = abs(strtotime(date("c")) - strtotime("2007-12-31T00:00:00Z")); $hpr_startdate = abs(strtotime(date("c")) - strtotime("2007-12-31T00:00:00Z"));
$hpr_years = floor($hpr_startdate / (365*60*60*24)); $hpr_years = floor($hpr_startdate / (365*60*60*24));
@ -33,8 +34,27 @@ $agehpr = $hpr_startdate;
$last_show = mysqli_query($connection, "SELECT max(date), max(id) from eps"); $last_show = mysqli_query($connection, "SELECT max(date), max(id) from eps");
$last_show_date = mysqli_fetch_row($last_show); $last_show_date = mysqli_fetch_row($last_show);
$totalshows=$last_show_date[1]+300;
$totalhpr=$last_show_date[1]; // --------------------------------------------
// Reserve Shows
$result = mysqli_query($connection, 'SELECT COUNT(*) FROM reservations WHERE status="RESERVE_SHOW_SUBMITTED";');
if (!isset($result)) {
naughty("cac33babd8a24edd138087ef7e4280f6");
}
$reserve_array = mysqli_fetch_row( $result );
$reserve_shows = $reserve_array[0];
mysqli_free_result($result);
// --------------------------------------------
// Get total number of shows
$ep_retrieve = "SELECT id, COUNT(*) AS total_hpr_shows FROM eps ;";
if ($result = mysqli_query($connection, $ep_retrieve)) {
$data=mysqli_fetch_assoc($result);
$total_hpr_shows = $data['total_hpr_shows'];
}
// -------------------------------------------- // --------------------------------------------
// Get the number of hosts // Get the number of hosts
@ -139,21 +159,10 @@ $num_submitted_shows = $data['total'];
// -------------------------------------------- // --------------------------------------------
// Duration of all shows // Duration of all shows
$result=mysqli_query($connection, "SELECT SUM(duration) as total_duration FROM `eps`"); $result=mysqli_query($connection, "SELECT SUM(duration) as total_playtime FROM `eps`");
$data=mysqli_fetch_assoc($result); $data=mysqli_fetch_assoc($result);
$total_duration = $data['total_duration']; $total_playtime = $data['total_playtime'];
$human_total_duration = convertSecToTime($total_duration); $human_total_playtime = convertSecToTime($total_playtime);
// --------------------------------------------
// Reserve Shows
$result = mysqli_query($connection, 'SELECT COUNT(*) FROM reservations WHERE status="RESERVE_SHOW_SUBMITTED";');
if (!isset($result)) {
naughty("cac33babd8a24edd138087ef7e4280f6");
}
$reserve_array = mysqli_fetch_row( $result );
$reserve_shows = $reserve_array[0];
mysqli_free_result($result);
// -------------------------------------------- // --------------------------------------------
// workflow // workflow
@ -174,11 +183,11 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
},"; },";
// -------------------------------------------- // --------------------------------------------
// duration // playtime
$result=mysqli_query($connection, "SELECT SUM(duration) as total_duration FROM `eps`"); $result=mysqli_query($connection, "SELECT SUM(duration) as total_playtime FROM `eps`");
$data=mysqli_fetch_assoc($result); $data=mysqli_fetch_assoc($result);
$total_duration = $data['total_duration']; $total_playtime = $data['total_playtime'];
$human_total_duration = convertSecToTime($total_duration); $human_total_playtime = convertSecToTime($total_playtime);
// -------------------------------------------- // --------------------------------------------
// Unprocessed comments // Unprocessed comments
@ -198,6 +207,13 @@ if ($handle = opendir('/home/hpr/upload')) {
closedir($handle); closedir($handle);
} }
// --------------------------------------------
// Calculate Total Shows
$total_shows = $current_episode_number + $total_twt_shows + $num_future_shows + $reserve_shows;
// -------------------------------------------- // --------------------------------------------
// Produce output // Produce output
@ -212,10 +228,10 @@ if ($format === "json") {
\"start\": \"2005-09-19T00:00:00Z\", \"start\": \"2005-09-19T00:00:00Z\",
\"rename\": \"2007-12-31T00:00:00Z\", \"rename\": \"2007-12-31T00:00:00Z\",
\"since_start\": { \"since_start\": {
\"total_seconds\": ".$agetwat.", \"total_seconds\": ".$agetwt.",
\"years\": ".$twat_years.", \"years\": ".$twt_years.",
\"months\": ".$twat_months.", \"months\": ".$twt_months.",
\"days\": ".$twat_days." \"days\": ".$twt_days."
}, },
\"since_rename\": { \"since_rename\": {
\"total_seconds\": ".$agehpr.", \"total_seconds\": ".$agehpr.",
@ -225,11 +241,13 @@ if ($format === "json") {
} }
}, },
\"shows\": { \"shows\": {
\"total\": ".$totalshows.", \"total\": ".$total_shows.",
\"twat\": 300, \"twt\": $total_twt_shows,
\"hpr\": ".$totalhpr.", \"hpr\": ".$current_episode_number.",
\"duration\": ".$total_duration.", \"future\": ".$num_future_shows.",
\"human_duration\": \"".$human_total_duration."\" \"reserve\": ".$reserve_shows.",
\"playtime\": ".$total_playtime.",
\"human_playtime\": \"".$human_total_playtime."\"
}, },
\"hosts\": ".$num_of_hosts.", \"hosts\": ".$num_of_hosts.",
\"slot\": { \"slot\": {
@ -258,10 +276,10 @@ elseif ($format === "xml") {
<start>2005-09-19T00:00:00Z</start> <start>2005-09-19T00:00:00Z</start>
<rename>2007-12-31T00:00:00Z</rename> <rename>2007-12-31T00:00:00Z</rename>
<since_start> <since_start>
<total_seconds>".$agetwat."</total_seconds> <total_seconds>".$agetwt."</total_seconds>
<years>". $twat_years."</years> <years>". $twt_years."</years>
<months>".$twat_months."</months> <months>".$twt_months."</months>
<days>".$twat_days."</days> <days>".$twt_days."</days>
</since_start> </since_start>
<since_rename> <since_rename>
<total_seconds>".$agehpr."</total_seconds> <total_seconds>".$agehpr."</total_seconds>
@ -271,11 +289,11 @@ elseif ($format === "xml") {
</since_rename> </since_rename>
</age> </age>
<shows> <shows>
<total>".$totalshows."</total> <total>".$total_shows."</total>
<twat>300</twat> <twt>$total_twt_shows</twt>
<hpr>".$totalhpr."</hpr> <hpr>".$total_hpr_shows."</hpr>
<duration>".$total_duration."</duration> <playtime>".$total_playtime."</playtime>
<human_duration>".$human_total_duration."</human_duration> <human_playtime>".$human_total_playtime."</human_playtime>
</shows> </shows>
<hosts>".$num_of_hosts."</hosts> <hosts>".$num_of_hosts."</hosts>
<slot> <slot>
@ -296,20 +314,20 @@ elseif ($format === "csv") {
header("Content-type: text/csv"); header("Content-type: text/csv");
header("Content-disposition: inline; filename=hpr_stats.csv"); header("Content-disposition: inline; filename=hpr_stats.csv");
print "stats_generated,age_start,age_rename,age_since_start_total_seconds,age_since_start_years,age_since_start_months,age_since_start_days,age_since_rename_total_seconds,age_since_rename_years,age_since_rename_months,age_since_rename_days,shows_total,shows_twat,shows_hpr,hosts,slot_next_free,slot_no_media,number_future_hosts,number_future_shows,unprocessed_comments,shows_in_workflow,queue_reserve,duration\n"; print "stats_generated,age_start,age_rename,age_since_start_total_seconds,age_since_start_years,age_since_start_months,age_since_start_days,age_since_rename_total_seconds,age_since_rename_years,age_since_rename_months,age_since_rename_days,shows_total,shows_twt,shows_hpr,hosts,slot_next_free,slot_no_media,number_future_hosts,number_future_shows,unprocessed_comments,shows_in_workflow,queue_reserve,playtime\n";
print "${current_time},2005-09-19T00:00:00Z,2007-12-31T00:00:00Z,${agetwat},${twat_years},${twat_months},${twat_days},${agehpr},${hpr_years},${hpr_months},${hpr_days},${totalshows},300,${totalhpr},${num_of_hosts},${days_to_wait},${un_delivered},${num_future_hosts},${num_future_shows},${unprocessed_comments},${new_shows},${reserve_shows},${total_duration}\n"; print "${current_time},2005-09-19T00:00:00Z,2007-12-31T00:00:00Z,${agetwt},${twt_years},${twt_months},${twt_days},${agehpr},${hpr_years},${hpr_months},${hpr_days},${totalshows},$total_twt_shows,${totalhpr},${num_of_hosts},${days_to_wait},${un_delivered},${num_future_hosts},${num_future_shows},${unprocessed_comments},${new_shows},${reserve_shows},${total_playtime}\n";
} }
else { else {
Header('Content-type: text/tab-separated-values'); Header('Content-type: text/tab-separated-values');
header("Content-disposition: inline; filename=hpr_stats.txt"); header("Content-disposition: inline; filename=hpr_stats.txt");
printf("Started:\t%d years, %d months, %d days ago (2005-09-19)\n", $twat_years, $twat_months, $twat_days); printf("Started:\t%d years, %d months, %d days ago (2005-09-19)\n", $twt_years, $twt_months, $twt_days);
printf("Renamed HPR:\t%d years, %d months, %d days ago (2007-12-31)\n", $hpr_years, $hpr_months, $hpr_days); printf("Renamed HPR:\t%d years, %d months, %d days ago (2007-12-31)\n", $hpr_years, $hpr_months, $hpr_days);
echo "Total Shows:\t" . $totalshows . "\n"; echo "Total Shows:\t" . $total_shows . "\n";
echo "Total TWAT:\t300\n"; echo "Total TWAT:\t$total_twt_shows\n";
echo "Total HPR:\t" . $totalhpr . "\n"; echo "Total HPR:\t" . $total_hpr_shows . "\n";
echo "Duration:\t" . $total_duration . "\n"; echo "Duration:\t" . $total_playtime . "\n";
echo "Human Duration:\t" . $human_total_duration . "\n"; echo "Human Duration:\t" . $human_total_playtime . "\n";
echo "HPR Hosts:\t${num_of_hosts}\n"; echo "HPR Hosts:\t${num_of_hosts}\n";
echo "Days to next free slot:\t${days_to_wait}\n"; echo "Days to next free slot:\t${days_to_wait}\n";
echo "Hosts in Queue:\t$num_future_hosts\n"; echo "Hosts in Queue:\t$num_future_hosts\n";
@ -318,7 +336,7 @@ else {
echo "Files on the FTP Server:\t$new_shows\n"; echo "Files on the FTP Server:\t$new_shows\n";
echo "Number of Reserve Shows:\t$reserve_shows\n"; echo "Number of Reserve Shows:\t$reserve_shows\n";
echo "Days until show without media:\t$un_delivered\n"; echo "Days until show without media:\t$un_delivered\n";
print "$current_time,$agetwat,$agehpr,$totalshows,300,$totalhpr,$num_of_hosts,$days_to_wait,$num_future_hosts,$num_future_shows,$unprocessed_comments,$new_shows,$reserve_shows,$un_delivered"; print "$current_time,$agetwt,$agehpr,$total_shows,$total_twt_shows,$total_hpr_shows,$num_of_hosts,$days_to_wait,$num_future_hosts,$num_future_shows,$unprocessed_comments,$new_shows,$reserve_shows,$un_delivered";
// print_r($show_array); // print_r($show_array);
} }
mysqli_close($connection); mysqli_close($connection);

View File

@ -267,6 +267,17 @@ There are only <strong><?php echo "${days_to_wait}"; ?></strong> days to wait un
<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> <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>
</ol> </ol>
<h2 id="scheduling_guidelines">Scheduling Guidelines</h2>
<ol>
<li>You must have your audio recording ready to upload <strong>before</strong> you pick a slot.</li>
<li>New hosts, Interviews, and other time critical shows should use the first free slot.</li>
<li>Always try and fill any free slots that are available in the upcoming two weeks.</li>
<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>
</ol>
<h2 id="reserve_queue">Add to the Reserve Queue ?</h2> <h2 id="reserve_queue">Add to the Reserve Queue ?</h2>
<p> <p>

92
hub/ccdn.php Normal file
View File

@ -0,0 +1,92 @@
<?php
# request.php > request_confirm.php > upload.php > upload_confirm.php
require "/home/hpr/php/include.php";
$ip = $_SERVER["REMOTE_ADDR"];
if ( $_SERVER['REQUEST_METHOD'] !== 'GET' ) {
naughty("34522f7b9ba88b319afa9f063b98905c");
}
if ( empty($_SERVER["REMOTE_ADDR"]) ) {
naughty("021dbd5f91f40918ea68fd0ca1a2e381");
}
if ( count($_GET) !== 1 ) {
naughty("f5df1c0d9accb7868e601b60cf2f5c06");
}
if ( isset($_GET["filename"]) ) {
$filename = $_GET["filename"];
if ( empty($filename) ) {
naughty("ef50f1353583f371903daba3abc9b3a4");
}
$filename = filter_var($filename, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
$dirname = dirname("$filename", 2);
if ( empty($dirname) ) {
naughty("71b6b14eef459e0404311257dad8ffe4");
}
if ( $dirname === "/" ) {
naughty("9e342e30b911e1ac3c5e831a6da6116b");
}
if ( !(
strcmp($dirname, "/correspondents") === 0 or
strcmp($dirname, "/eps") === 0 or
strcmp($dirname, "/series") === 0 )
) {
naughty("f157a8f5fedc7282c7a6469931223dbf");
}
$name = basename($filename); // To get file name
if ( empty($name) ) {
naughty("27ece7c2dba5caa5885ef40737270fd3");
}
$ext = pathinfo($filename, PATHINFO_EXTENSION); // To get extension
if ( empty($ext) ) {
naughty("c6a4329fe2f3c2c739ec666e956c2c5f");
}
$prefix =pathinfo($filename, PATHINFO_FILENAME); // File name without extension
if ( empty($prefix) ) {
naughty("f398399ec10ec9ab4b5b23ae43f21b01");
}
if ( strlen($filename) < 5 ) {
naughty("f78bf180af9239fc7fcf5fbc2b13b59b");
}
if ( strlen($filename) > 60 ) {
naughty("38e9a0cf7f650ac62e75c08269c9d913");
}
if ( !(
strcmp($ext, "flac") === 0 or
strcmp($ext, "jpg") === 0 or
strcmp($ext, "json") === 0 or
strcmp($ext, "mp3") === 0 or
strcmp($ext, "ogg") === 0 or
strcmp($ext, "opus") === 0 or
strcmp($ext, "png") === 0 or
strcmp($ext, "spx") === 0 or
strcmp($ext, "srt") === 0 or
strcmp($ext, "tsv") === 0 or
strcmp($ext, "txt") === 0 or
strcmp($ext, "vtt") === 0 )
) {
naughty("545e49f7ac913863c6c3db40670ebb9d");
}
}
else {
naughty("0b78322e1c5010ba289c20250ca1fb1f");
}
header("location:https://alpha.nl.eu.mirror.hackerpublicradio.org${filename}");
?>

7
hub/redirect.php Normal file
View File

@ -0,0 +1,7 @@
<?php
# request.php > request_confirm.php > upload.php > upload_confirm.php
#require "/home/hpr/php/include.php";
?>
<?php
header('location:https://hub.hackerpublicradio.org/calendar.php');
?>

View File

@ -17,8 +17,6 @@ if ( ! $pos === false) {
date_default_timezone_set("UTC"); date_default_timezone_set("UTC");
if (!($connection = @ mysqli_connect("$databaseHostName", "$databaseUsername", "$databasePassword"))) if (!($connection = @ mysqli_connect("$databaseHostName", "$databaseUsername", "$databasePassword")))
die("Could not connect to database"); die("Could not connect to database");
@ -334,4 +332,6 @@ if ($pos !== false) {
$HPR_Names = "Hackers"; $HPR_Names = "Hackers";
} }
$allowed_extensions = array("flac", "opus", "ogg", "spx", "mp3", "jpg", "png", "json", "srt", "tsv", "txt", "vtt");
?> ?>

View File

@ -1,213 +0,0 @@
<?php
// TODO
// lisence
// filter by date
// if rss.php then use switches
// host out of eps
// explicit from db
#
$mimetype = "audio/ogg";
$format = "ogg";
require "/home/hpr/php/include.php";
$query = "SELECT hosts.host, eps.id, eps.series, eps.title, eps.notes, eps.date, hosts.email, eps.hostid, eps.explicit, eps.version, eps.valid, eps.duration, assets.size
FROM eps, hosts, assets
WHERE eps.valid=1
AND eps.hostid = hosts.hostid
AND eps.id = assets.episode_id
AND eps.duration > 0
AND eps.date >= UTC_DATE()";
if (isset($_GET['format'])) {
$this_format = $_GET['format'];
if ( $this_format === "mp3" ) {
$format = "mp3";
}
if ( $this_format === "ogg" ) {
$format = "ogg";
}
if ( $this_format === "spx" ) {
$format = "spx";
}
}
$query = "${query}\nAND assets.filename REGEXP \"^hpr[0-9]+.$format\"";
$query = "${query}\nAND assets.extension = '$format'";
$html = 1;
if (isset($_GET['html'])) {
$html = $_GET['html'];
if ( $html === "0" ) {
$html = 0;
}
}
$full = "1";
if (isset($_GET['full'])) {
$full = $_GET['full'];
if ( $full === "1" ) {
$feed = "total";
}
if ( $full === "0" ) {
$feed = "tenday";
}
}
if (isset($_GET['hostid'])) {
$hostid = $_GET['hostid'];
$hostid = intval($hostid);
if (is_int(intval($hostid))) {
$query = "$query AND hosts.hostid = '$hostid'";
}
}
if (isset($_GET['series'])) {
$series = $_GET['series'];
$series = intval($series);
if (is_int(intval($series))) {
$query = "$query AND eps.series = '$series'";
}
}
$query = "$query ORDER BY id DESC ";
if (isset($_GET['limit'])) {
$this_limit = $_GET['limit'];
$this_limit = intval($this_limit);
if (is_int(intval($this_limit))) {
$limit = $this_limit;
}
}
header("Content-type: application/xml");
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
date_default_timezone_set('UTC');
print '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
?>
<rss version="2.0" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" >
<channel>
<title>Hacker Public Radio - Future Feed</title>
<link><?php print "${baseurl}"; ?>about.html</link>
<itunes:subtitle>A daily show hosted the community on topics that are of interest to hackers and hobbyists.</itunes:subtitle>
<description>Hacker Public Radio is an podcast that releases shows every weekday Monday through Friday. Our shows are produced by the community (you) and can be on any topic that are of interest to hackers and hobbyists. This is the shows that are in the future feed.</description>
<language>en-us</language>
<itunes:category text="Technology">
<itunes:category text="Tech News"/>
</itunes:category>
<itunes:category text="Education">
<itunes:category text="Training"/>
</itunes:category>
<itunes:image href="<?php print "${baseurl}"; ?>images/hpr_feed_itunes.png"/>
<itunes:explicit>yes</itunes:explicit>
<itunes:author>Hacker Public Radio</itunes:author>
<itunes:keywords>Community Radio, Tech Interviews, Linux, Open, Hobby, Software Freedom</itunes:keywords>
<copyright>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) License</copyright>
<managingEditor>feedback@NOSPAM-hackerpublicradio.org (HPR Feedback)</managingEditor>
<!-- <author>feedback@NOSPAM-hackerpublicradio.org (HPR Feedback)</author> -->
<itunes:owner>
<itunes:name>HPR Volunteer</itunes:name>
<itunes:email>admin@hackerpublicradio.org</itunes:email>
</itunes:owner>
<webMaster>admin@hackerpublicradio.org (HPR Volunteer)</webMaster>
<generator>kate</generator>
<docs>http://www.rssboard.org/rss-specification</docs>
<ttl>720</ttl>
<skipDays>
<day>Saturday</day>
<day>Sunday</day>
</skipDays>
<image>
<url><?php print "${baseurl}"; ?>images/hpr_feed_small.png</url>
<title>Hacker Public Radio</title>
<link><?php print "${baseurl}"; ?>about.html</link>
<description>The Hacker Public Radio Old Microphone Logo</description>
<height>164</height>
<width>144</width>
</image>
<googleplay:author>HPR Volunteer</googleplay:author>
<googleplay:description>Hacker Public Radio is an podcast that releases shows every weekday Monday through Friday. Our shows are produced by the community (you) and can be on any topic that are of interest to hackers and hobbyists.</googleplay:description>
<googleplay:email>admin@hackerpublicradio.org</googleplay:email>
<googleplay:image href="<?php print "${baseurl}"; ?>images/hpr_feed_itunes.png"/>
<googleplay:category text="Technology"/>
<?php
print " <atom:link href=\"${baseurl}". str_replace('&', '&amp;', $_SERVER["REQUEST_URI"]) ."\" rel=\"self\" type=\"application/rss+xml\" />\n";
print " <pubDate>".date(DATE_RFC1123, strtotime(date('Y-m-d')))."</pubDate>\n";
//Set $r to SQL query for execution agains the table
if ($result = mysqli_query($connection, $query)) {
while ($row = mysqli_fetch_array($result)) {
$id = fixid(stripslashes($row['id']));
$version = $row['version'];
if ( $version === "0" ) {
$version = "";
}
else {
$version = ".${version}";
}
$episode_explicit = $row['explicit'];
if ($episode_explicit == 0) {
$episode_explicit = "Clean";
}
else{
$episode_explicit = "Explicit";
}
$url="${baseurl}eps/hpr${id}${version}";
if (isset($_GET['hostidinfilename'])) {
$hostidinfilename = $_GET['hostidinfilename'];
if ( $hostidinfilename === "1" ) {
$url = $url . "_host-" . htmlspecialchars(stripslashes(strip_tags($row["hostid"])));
}
}
if ( isset($_GET['seriesidinfilename']) ) {
$seriesidinfilename = $_GET['seriesidinfilename'];
if ( $seriesidinfilename === "1" ) {
$url = $url . "_series-" . htmlspecialchars(stripslashes(strip_tags($row["series"])));
}
}
$url = $url . "." . $format;
$itunes_summary = htmlspecialchars(stripslashes(strip_tags(substr($row["notes"],0,4000))));
$show_notes = $row["notes"];
$warning = "<p>This show has been flagged as $episode_explicit by the host.</p>\n";
$show_notes = $show_notes . utf8_encode ( $warning );
echo " <item>\n";
if ( $episode_explicit === "Clean" ) {
echo " <itunes:explicit>no</itunes:explicit>\n";
echo " <googleplay:explicit>No</googleplay:explicit>\n";
}
else {
echo " <itunes:explicit>yes</itunes:explicit>\n";
echo " <googleplay:explicit>Yes</googleplay:explicit>\n";
}
echo " <title>HPR$id: " . htmlspecialchars(stripslashes(strip_tags($row["title"]))) . "</title>\n";
// echo "<description> " . ($row["title"]) . "</description>\n";
$email_padded = formatemail($row['email']);
echo " <author>". $email_padded . " (" . htmlspecialchars(stripslashes(strip_tags($row["host"]))) .")</author>\n";
echo " <googleplay:author>". $email_padded . " (" . htmlspecialchars(stripslashes(strip_tags($row["host"]))) .")</googleplay:author>\n";
echo " <itunes:author>". $email_padded . " (" . htmlspecialchars(stripslashes(strip_tags($row["host"]))) .")</itunes:author>\n";
echo " <googleplay:image href=\"${baseurl}images/hpr_feed_itunes.png\"/>\n";
echo " <link>${baseurl}eps/hpr".$id."/index.html</link>\n";
echo " <description><![CDATA[" . $show_notes . "]]>\n</description>\n";
// echo " <googleplay:description><![CDATA[" . $show_notes . "]]>\n</googleplay:description>\n";
echo " <itunes:summary><![CDATA[" . $itunes_summary . "]]>\n</itunes:summary>\n";
echo " <pubDate>" .date(DATE_RFC1123, strtotime($row['date'])) . "</pubDate>\n";
$length = $row['size'];
echo " <enclosure url=\"$url\" length=\"$length\" type=\"$mimetype\"/>\n";
echo " <guid>" . $url . "</guid>\n";
echo " </item>\n";
}
}
//Display non-connection errors
//Close sql connection
mysqli_close($connection);
echo " </channel>
</rss>
";
?>

View File

@ -35,6 +35,11 @@ switch ($atomurl) {
$mimetype = "audio/mpeg"; $mimetype = "audio/mpeg";
$feed = "total"; $feed = "total";
break; break;
case "/rss-future.php":
$format = "mp3";
$mimetype = "audio/mpeg";
$feed = "future";
break;
case "/hpr_ogg_rss.php": case "/hpr_ogg_rss.php":
$format = "ogg"; $format = "ogg";
$mimetype = "audio/ogg"; $mimetype = "audio/ogg";
@ -60,11 +65,6 @@ switch ($atomurl) {
$mimetype = "audio/mpeg"; $mimetype = "audio/mpeg";
$feed = "tenday"; $feed = "tenday";
break; break;
case "/rss1.php":
$format = "spx";
$mimetype = "audio/ogg";
$feed = "tenday";
break;
} }
require "/home/hpr/php/include.php"; require "/home/hpr/php/include.php";
@ -121,14 +121,10 @@ if (isset($_GET['full'])) {
} }
} }
$gomax = "0"; if ( $feed === "future" ) {
if (isset($_GET['gomax'])) { $query = "${query}\nAND eps.date >= UTC_DATE() ";
$gomax = $_GET['gomax'];
if ( $gomax === "1" ) {
$gomax = "1";
}
} }
if ( $gomax === "0" ) { else {
$query = "${query}\nAND eps.date <= UTC_DATE() "; $query = "${query}\nAND eps.date <= UTC_DATE() ";
} }
@ -189,7 +185,6 @@ print '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
<itunes:keywords>Community Radio, Tech Interviews, Linux, Open, Hobby, Software Freedom</itunes:keywords> <itunes:keywords>Community Radio, Tech Interviews, Linux, Open, Hobby, Software Freedom</itunes:keywords>
<copyright>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) License</copyright> <copyright>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) License</copyright>
<managingEditor>feedback@NOSPAM-hackerpublicradio.org (HPR Feedback)</managingEditor> <managingEditor>feedback@NOSPAM-hackerpublicradio.org (HPR Feedback)</managingEditor>
<!-- <author>feedback@NOSPAM-hackerpublicradio.org (HPR Feedback)</author> -->
<itunes:owner> <itunes:owner>
<itunes:name>HPR Volunteer</itunes:name> <itunes:name>HPR Volunteer</itunes:name>
<itunes:email>admin@hackerpublicradio.org</itunes:email> <itunes:email>admin@hackerpublicradio.org</itunes:email>
@ -237,33 +232,19 @@ if ($result = mysqli_query($connection, $query)) {
else{ else{
$episode_explicit = "Explicit"; $episode_explicit = "Explicit";
} }
$url="http://hackerpublicradio.org/eps/hpr${id}${version}";
if (isset($_GET['hostidinfilename'])) { $url="https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr${id}/hpr${id}.${format}";
$hostidinfilename = $_GET['hostidinfilename'];
if ( $hostidinfilename === "1" ) {
$url = $url . "_host-" . htmlspecialchars(stripslashes(strip_tags($row["hostid"])));
}
}
if ( isset($_GET['seriesidinfilename']) ) {
$seriesidinfilename = $_GET['seriesidinfilename'];
if ( $seriesidinfilename === "1" ) {
$url = $url . "_series-" . htmlspecialchars(stripslashes(strip_tags($row["series"])));
}
}
$url = $url . "." . $format;
$itunes_summary = htmlspecialchars(stripslashes(strip_tags(substr($row["notes"],0,4000)))); $itunes_summary = htmlspecialchars(stripslashes(strip_tags(substr($row["notes"],0,4000))));
if ( $html == 1 ) { if ( $html == 1 ) {
# $show_notes = "<p>This show has been flagged as $episode_explicit by the host.</p>\n" . $row["notes"]; $show_notes = "<p>This show has been flagged as $episode_explicit by the host.</p>\n";
$show_notes = $row["notes"]; $show_notes = $show_notes . $row["notes"];
$warning = "<p>This show has been flagged as $episode_explicit by the host.</p>\n"; $show_notes = $show_notes . "<p><a href=\"https://hackerpublicradio.org/eps/hpr${id}/index.html#comments\">Provide <strong>feedback</strong> on this episode</a>.</p>";
} }
else { else {
# $show_notes = "This show has been flagged as $episode_explicit by the host.\n" . htmlspecialchars(stripslashes(strip_tags($row["notes"]))) ; $show_notes = "This show has been flagged as $episode_explicit by the host.\n";
$show_notes = htmlspecialchars(stripslashes(strip_tags($row["notes"]))) ; $show_notes = $show_notes . htmlspecialchars(stripslashes(strip_tags($row["notes"]))) ;
$warning = "This show has been flagged as $episode_explicit by the host.\n";
} }
# $show_notes = utf8_encode ( $show_notes );
$warning = utf8_encode ( $warning ); $warning = utf8_encode ( $warning );
echo " <item>\n"; echo " <item>\n";
if ( $episode_explicit === "Clean" ) { if ( $episode_explicit === "Clean" ) {
@ -289,7 +270,6 @@ if ($result = mysqli_query($connection, $query)) {
else { else {
echo " <description><![CDATA[" . $show_notes . "]]>\n</description>\n"; echo " <description><![CDATA[" . $show_notes . "]]>\n</description>\n";
} }
// echo " <googleplay:description><![CDATA[" . $show_notes . "]]>\n</googleplay:description>\n";
echo " <itunes:summary><![CDATA[" . $itunes_summary . "]]>\n</itunes:summary>\n"; echo " <itunes:summary><![CDATA[" . $itunes_summary . "]]>\n</itunes:summary>\n";
echo " <pubDate>" .date(DATE_RFC1123, strtotime($row['date'])) . "</pubDate>\n"; echo " <pubDate>" .date(DATE_RFC1123, strtotime($row['date'])) . "</pubDate>\n";
$length = $row['size']; $length = $row['size'];
@ -301,8 +281,6 @@ if ($result = mysqli_query($connection, $query)) {
} }
} }
//Display non-connection errors
//Close sql connection
mysqli_close($connection); mysqli_close($connection);
echo " </channel> echo " </channel>
</rss> </rss>