From e2474d07ca079e5fadb7e314d70b0fce5daceb19 Mon Sep 17 00:00:00 2001
From: Ken Fallon
Date: Thu, 28 Dec 2023 20:00:28 +0100
Subject: [PATCH 1/6] A series of fixes related to stuff I came across
---
bin/postshow.bash | 7 ++++
cms/comment_process.php | 25 ++++++++++---
cms/comment_process_rss.php | 5 +--
cms/say.php | 22 ++++++++++--
hub/comment_confirm.php | 13 ++++---
hub/footer.html | 60 ++++++++++++++++---------------
hub/header.html | 70 +++++++++++++++++--------------------
7 files changed, 122 insertions(+), 80 deletions(-)
diff --git a/bin/postshow.bash b/bin/postshow.bash
index c8da522..9ae8dd2 100755
--- a/bin/postshow.bash
+++ b/bin/postshow.bash
@@ -52,6 +52,13 @@ then
exit 2
fi
+if [ "$( file "${shownotes_json}" | grep -ic "text" )" -eq 0 ]
+then
+ echo "ERROR: \"${shownotes_json}\" is not a text file"
+ exit 3
+fi
+
+
jq '.' "${shownotes_json}" | sponge "${shownotes_json}"
###################
diff --git a/cms/comment_process.php b/cms/comment_process.php
index a60ec1a..f0f8a78 100755
--- a/cms/comment_process.php
+++ b/cms/comment_process.php
@@ -37,7 +37,7 @@ else {
naughty("868d9cc49b2f1e4a9319a8e8755d6189 wrong key type");
}
-if ( !in_array($_GET["action"], array('approve','delete','block'), true ) ) {
+if ( !in_array($_GET["action"], array('publish','approve','delete','block'), true ) ) {
naughty("c0ca62c918f9bb0ab72da0cdf2f2e8df wrong action");
}
else {
@@ -81,17 +81,33 @@ if ( $action === 'delete' ) {
http_response_code(202);
header('Content-Type: application/json; charset=utf-8');
echo json_encode($db);
- unlink( "${file}" );
exit;
}
if ( $action === 'approve' ) {
+ unlink( "${file}" );
+ $db["http_code"] = "200";
+ $db["action"] = "approve";
+ http_response_code(200);
+ header('Content-Type: application/json; charset=utf-8');
+ echo json_encode($db);
+ exit;
+}
+
+if ( $action === 'publish' ) {
+
$comment = file_get_contents("$file");
$json = json_decode($comment, true);
require "/home/hpr/public_html_hub/cms/comment_checks.php";
+ $ep_num = mysqli_real_escape_string( $connection, $ep_num );
+ $comment_timestamp_db = mysqli_real_escape_string( $connection, $comment_timestamp_db );
+ $comment_author_name = mysqli_real_escape_string( $connection, $comment_author_name );
+ $comment_title = mysqli_real_escape_string( $connection, $comment_title );
+ $comment_text = mysqli_real_escape_string( $connection,$comment_text );
+
// OK I believe you
if ( strcmp($justification, "No justification is asked for or required.") !== 0 ) {
@@ -106,6 +122,7 @@ if ( $action === 'approve' ) {
}
}
+
$query_add = "INSERT INTO comments (eps_id,comment_timestamp,comment_author_name,comment_title,comment_text) VALUES ( '{$ep_num}', '{$comment_timestamp_db}', '{$comment_author_name}', '{$comment_title}', '{$comment_text}')";
$result = mysqli_query($connection, $query_add );
@@ -124,12 +141,12 @@ if ( $action === 'approve' ) {
if ( empty($db["id"]) ) {
naughty("1caead2716fb4e793b11f978eddd7559 could not find the id of the entry. comment_timestamp='$comment_timestamp_db' and comment_author_name='$comment_author_name'");
}
+ unlink( "${file}" );
$db["http_code"] = "200";
- $db["action"] = "approve";
+ $db["action"] = "publish";
http_response_code(200);
header('Content-Type: application/json; charset=utf-8');
echo json_encode($db);
- unlink( "${file}" );
exit;
}
diff --git a/cms/comment_process_rss.php b/cms/comment_process_rss.php
index 9171921..def20f8 100644
--- a/cms/comment_process_rss.php
+++ b/cms/comment_process_rss.php
@@ -98,8 +98,9 @@ foreach ($filenames as $filename) {
Block,
-Delete, or
-Approve.
+Delete,
+Approve, or
+Publish.
diff --git a/cms/say.php b/cms/say.php
index 72886f3..1d261ec 100644
--- a/cms/say.php
+++ b/cms/say.php
@@ -35,7 +35,24 @@ else {
Header('Content-type: text/tab-separated-values');
header("Content-disposition: inline; filename=say.txt");
-$ep_retrieve = "SELECT UNIX_TIMESTAMP(eps.date) AS timestamp, eps.title, eps.duration, eps.summary, hosts.host, eps.hostid, eps.series, eps.license, eps.explicit FROM eps, hosts WHERE hosts.valid = '1' AND id = '$id' AND eps.hostid = hosts.hostid";
+$ep_retrieve = "SELECT
+ UNIX_TIMESTAMP(eps.date) AS timestamp,
+ eps.title,
+ eps.duration,
+ eps.summary,
+ hosts.host,
+ eps.hostid,
+ eps.series,
+ eps.license,
+ licenses.long_name,
+ eps.explicit
+FROM
+ eps
+ LEFT JOIN hosts ON eps.hostid = hosts.hostid
+ LEFT JOIN licenses ON licenses.short_name = eps.license
+WHERE
+ hosts.valid = '1'
+ AND eps.id = '$id'";
if ($result = mysqli_query($connection, $ep_retrieve)) {
while ($row = mysqli_fetch_array($result)) {
$date = $row['timestamp'];
@@ -46,6 +63,7 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
$hostid = $row['hostid'];
$series = $row['series'];
$license = $row['license'];
+ $license_long_name = $row['long_name'];
$explicit = $row['explicit'];
$id = fixid($id);
@@ -91,7 +109,7 @@ if ( !empty( $summary ) ) {
$HPR_summary = "${HPR_summary}. The summary is. $summary";
}
if (strcmp($license, "CC-BY-SA" ) !== 0) {
- $HPR_summary = "${HPR_summary}. Todays show is licensed under a $license license.";
+ $HPR_summary = "${HPR_summary}. Todays show is licensed under a $license_long_name license.";
}
$HPR_summary = str_replace($host,$espeak_name,$HPR_summary);
diff --git a/hub/comment_confirm.php b/hub/comment_confirm.php
index e60e408..ccdc84e 100644
--- a/hub/comment_confirm.php
+++ b/hub/comment_confirm.php
@@ -279,8 +279,9 @@ See attachment for the json comment file.
Block,
-Delete, or
-Approve.
+Delete,
+Approve, or
+Publish.
@@ -303,13 +304,12 @@ $user_agent
comment_author_name ($comment_author_name_ascii): $comment_author_name,
comment_title ($comment_title_ascii): $comment_title,
comment_text ($comment_text_ascii):
-
+
$comment_text
-
+
+
justification ($justification_ascii):
-
$justification
-
comment_title_json: $comment_title_json,
@@ -358,7 +358,6 @@ include 'header.html';
HPR Bot
-
diff --git a/hub/footer.html b/hub/footer.html
index 9616906..232e9bd 100644
--- a/hub/footer.html
+++ b/hub/footer.html
@@ -4,51 +4,54 @@
+
Copyright Information
- Unless otherwise stated, our shows are released under a Creative Commons
- Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.
+ Unless otherwise stated, our shows are released under a
+ Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.
The HPR Website Design is released to the Public Domain.
diff --git a/hub/header.html b/hub/header.html
index cb4d0dd..78180e8 100644
--- a/hub/header.html
+++ b/hub/header.html
@@ -2,10 +2,14 @@
Hacker Public Radio ~ The Technology Community Podcast
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
css/hpr.css" media="screen" type="text/css" />
@@ -33,35 +37,27 @@
-
-
-
-
- Hacker
- Public
- Radio
-
-
Your ideas, projects, opinions - podcasted.
-
New episodes Monday through Friday.
-
-
-
-
+
+
+
+
+ Hacker
+ Public
+ Radio
+
+
Your ideas, projects, opinions - podcasted.
+
New episodes every weekday Monday through Friday.
+
+
+
+
+
-
--
2.43.5
From 65f0b2262b6bf99f0f8df469131fad81f1ff304d Mon Sep 17 00:00:00 2001
From: Ken Fallon
Date: Thu, 28 Dec 2023 20:06:02 +0100
Subject: [PATCH 2/6] The hub site needs full url
---
hub/header.html | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/hub/header.html b/hub/header.html
index 78180e8..575f132 100644
--- a/hub/header.html
+++ b/hub/header.html
@@ -21,14 +21,14 @@
}
-
-
-
-
+
+
+
+
-
+
css/hpr.css" media="screen" type="text/css" />
+
@@ -37,16 +37,16 @@
-
+
- Hacker
- Public
- Radio
+ Hacker
+ Public
+ Radio
Your ideas, projects, opinions - podcasted.
New episodes every weekday Monday through Friday.
--
2.43.5
From eeb9e5bcb54bd023cf76905c377c86508dbc0086 Mon Sep 17 00:00:00 2001
From: Ken Fallon
Date: Thu, 28 Dec 2023 20:07:30 +0100
Subject: [PATCH 3/6] when will it end
---
hub/header.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hub/header.html b/hub/header.html
index 575f132..9002cb8 100644
--- a/hub/header.html
+++ b/hub/header.html
@@ -20,7 +20,7 @@
display:none;
}
-
+
--
2.43.5
From 32c7efcc5ef67130e3bb265fa017c3cdf42e08e6 Mon Sep 17 00:00:00 2001
From: Ken Fallon
Date: Thu, 28 Dec 2023 20:08:57 +0100
Subject: [PATCH 4/6] copied from rendered files
---
hub/header.html | 42 +++++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/hub/header.html b/hub/header.html
index 9002cb8..2603e8e 100644
--- a/hub/header.html
+++ b/hub/header.html
@@ -1,13 +1,9 @@
- Hacker Public Radio ~ The Technology Community Podcast
-
-
-
-
+ Hacker Public Radio ~ The Technology Community Podcast
-
+
@@ -21,14 +17,14 @@
}
-
-
-
-
+
+
+
+
-
+
@@ -37,16 +33,16 @@
-
+
- Hacker
- Public
- Radio
+ Hacker
+ Public
+ Radio
Your ideas, projects, opinions - podcasted.
New episodes every weekday Monday through Friday.
@@ -54,8 +50,16 @@
-
--
2.43.5
From 2f337d1ed2c43a341656823c2a635ce943fab925 Mon Sep 17 00:00:00 2001
From: Ken Fallon
Date: Thu, 28 Dec 2023 20:10:17 +0100
Subject: [PATCH 5/6] The relative url wont work ont the hub
---
hub/header.html | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/hub/header.html b/hub/header.html
index 2603e8e..56cc081 100644
--- a/hub/header.html
+++ b/hub/header.html
@@ -17,14 +17,14 @@
}
-
-
-
-
+
+
+
+
-
+
@@ -33,16 +33,16 @@