Merge pull request 'I21_Improve_comment_system_v4' (#26) from I21_Improve_comment_system_v4 into main

Reviewed-on: HPR/hpr_hub#26
This commit is contained in:
Ken Fallon 2023-12-28 19:16:12 +00:00
commit 0467c2c5ac
7 changed files with 119 additions and 73 deletions

View File

@ -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}"
###################

View File

@ -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;
}

View File

@ -98,8 +98,9 @@ foreach ($filenames as $filename) {
<p>
<a href=\"https://hub.hackerpublicradio.org/cms/comment_process.php?key=$key&action=block\">Block</a>,
<a href=\"https://hub.hackerpublicradio.org/cms/comment_process.php?key=$key&action=delete\">Delete</a>, or
<a href=\"https://hub.hackerpublicradio.org/cms/comment_process.php?key=$key&action=approve\">Approve</a>.
<a href=\"https://hub.hackerpublicradio.org/cms/comment_process.php?key=$key&action=delete\">Delete</a>,
<a href=\"https://hub.hackerpublicradio.org/cms/comment_process.php?key=$key&action=approve\">Approve</a>, or
<a href=\"https://hub.hackerpublicradio.org/cms/comment_process.php?key=$key&action=publish\">Publish</a>.
</p>
<pre>

View File

@ -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);

View File

@ -279,8 +279,9 @@ See attachment for the json comment file.
</p>
<p>
<a href=\"https://hub.hackerpublicradio.org/cms/comment_process.php?key=$key&action=block\">Block</a>,
<a href=\"https://hub.hackerpublicradio.org/cms/comment_process.php?key=$key&action=delete\">Delete</a>, or
<a href=\"https://hub.hackerpublicradio.org/cms/comment_process.php?key=$key&action=approve\">Approve</a>.
<a href=\"https://hub.hackerpublicradio.org/cms/comment_process.php?key=$key&action=delete\">Delete</a>,
<a href=\"https://hub.hackerpublicradio.org/cms/comment_process.php?key=$key&action=approve\">Approve</a>, or
<a href=\"https://hub.hackerpublicradio.org/cms/comment_process.php?key=$key&action=publish\">Publish</a>.
</p>
<p>
@ -303,13 +304,12 @@ $user_agent
<strong>comment_author_name</strong> ($comment_author_name_ascii): $comment_author_name,<br />
<strong>comment_title</strong> ($comment_title_ascii): $comment_title,<br />
<strong>comment_text</strong> ($comment_text_ascii):
<pre>
$comment_text
</pre>
<br/>
<strong>justification</strong> ($justification_ascii):
<pre>
$justification
</pre>
</p>
<hr />
<strong>comment_title_json</strong>: $comment_title_json,<br />
@ -358,7 +358,6 @@ include 'header.html';
HPR Bot
</p>
<pre>
<pre>
<?php echo date('Y-m-d\TH:i:s') . "\n" . getUserIP() . "\n" . $_SERVER["HTTP_USER_AGENT"]; ?>
</pre>
</article>

View File

@ -4,51 +4,54 @@
<nav class="column">
<h2>Ancestry</h2>
<ul>
<li><a href="https://audio.textfiles.com/shows/radiofreekamerica/">Radio Freek America</a></li>
<li><a href="https://audio.textfiles.com/shows/binrev/">BinRev Radio</a></li>
<li><a href="https://audio.textfiles.com/shows/infonomicon/">Infonomicon</a></li>
<li><a href="https://audio.textfiles.com/shows/twat/">Talk With a Techie</a></li>
<li><a href="http://audio.textfiles.com/shows/radiofreekamerica/">Radio Freek America</a></li>
<li><a href="http://audio.textfiles.com/shows/binrev/">BinRev Radio</a></li>
<li><a href="http://audio.textfiles.com/shows/infonomicon/">Infonomicon</a></li>
<li><a href="http://audio.textfiles.com/shows/twat/">Talk With a Techie</a></li>
</ul>
</nav>
<nav class="column">
<h2>Social</h2>
<ul>
<li><a href="https://hackerpublicradio.org/mailman/listinfo/hpr_hackerpublicradio.org" target="_blank">Maillist</a></li>
<li><a href="<!--% absolute_url(baseurl,'/maillist') %-->" >Mailing list</a></li>
<li><a href="https://botsin.space/@hpr" >Mastodon</a></li>
<li><a href="https://matrix.to/#/#hpr:matrix.org" >Matrix</a></li>
<li><a href="mumble://chatter.skyehaven.net:64738/Hacker%20Public%20Radio?version=1.2.0" >Mumble</a></li>
<li><a href="https://web.libera.chat/gamja/?channels=oggcastplanet" target="_blank">#oggcastplanet</a></li>
<li><a href="https://botsin.space/@hpr" target="_blank" rel="me">Mastodon</a></li>
<li><a href="https://twitter.com/HPR" target="_blank" rel="me">Twitter.com</a></li>
<li><a href="https://www.facebook.com/home.php?sk=group_130169220378872¬if_t=group_r2j" target="_blank">Facebook</a></li>
<li><a href="https://www.linkedin.com/groups/Hacker-Public-Radio-3737302" target="_blank">Linked-In</a></li>
<li><a href="https://itunes.apple.com/us/podcast/hacker-public-radio/id281699640" target="_blank">iTunes</a></li>
<li><a href="https://archive.org/details/hackerpublicradio">Archive.org</a></li>
<li><a href="https://podcasts.google.com/feed/aHR0cDovL2hhY2tlcnB1YmxpY3JhZGlvLm9yZy9ocHJfcnNzLnBocA">Google Podcasts</a></li>
<li><a href="https://player.fm/series/hacker-public-radio">PlayerFM</a></li>
<li><a href="https://open.spotify.com/show/7e2hYcnHj9vKgUzsIOf4r3">Spotify</a></li>
<li><a href="https://www.mixcloud.com/hackerpublicradio/">MixCloud</a></li>
<li><a href="https://twitter.com/HPR">Twitter.com</a></li>
<li><a href="https://www.facebook.com/HenryPartickReilly" target="_blank">Facebook</a></li>
<li><a href="https://www.linkedin.com/company/hackerpublicradio/" target="_blank">Linked-In</a></li>
</ul>
</nav>
</nav>
<nav class="column">
<h2>Affiliates</h2>
<h2>Unaffiliates</h2>
<ul>
<li><a href="https://freeculturepodcasts.org/">Free Culture Podcasts</a></li>
<li><a href="https://www.hackradiolive.org/">Hack Radio Live</a></li>
<li><a href="https://www.binrev.com/">Binary Revolution</a></li>
<li><a href="https://hackermedia.org">Hackermedia</a></li>
<li><a href="https://www.packetsniffers.org/">Packetsniffers</a></li>
<li><a href="https://archive.org/details/hackerpublicradio">Archive.org</a></li>
<li><a href="https://music.amazon.fr/podcasts/9d9e6211-ff78-4501-93b6-6a9e560c4dbd/hacker-public-radio">Amazon Music</a></li>
<li><a href="https://podcasts.google.com/feed/aHR0cDovL2hhY2tlcnB1YmxpY3JhZGlvLm9yZy9ocHJfcnNzLnBocA">Google Podcasts</a></li>
<li><a href="https://www.iheart.com/podcast/256-hacker-public-radio-30994513/" target="_blank">iHeart Radio</a></li>
<li><a href="https://podcasts.apple.com/us/podcast/hacker-public-radio/id281699640">iTunes</a></li>
<li><a href="https://www.listennotes.com/de/podcasts/hacker-public-radio-hacker-public-radio-mNH-jsI7LcJ/">Listen Notes</a></li>
<li><a href="https://www.mixcloud.com/hackerpublicradio/">MixCloud</a></li>
<li><a href="https://player.fm/series/hacker-public-radio">PlayerFM</a></li>
<li><a href="https://www.podchaser.com/podcasts/hacker-public-radio-76781">Podchaser</a></li>
<li><a href="https://nl.radio.net/podcast/hacker-public-radio">Radio.net</a></li>
<li><a href="https://open.spotify.com/show/7e2hYcnHj9vKgUzsIOf4r3">Spotify</a></li>
<li><a href="https://toppodcast.com/podcast_feeds/hacker-public-radio/">Top Podcasts</a></li>
</ul>
</nav>
<nav class="column">
<h2>Commons</h2>
<ul>
<li><a href="https://freeculturepodcasts.org/">Free Culture Podcasts</a></li>
<li><a href="https://archive.org/details/hackerpublicradio">archive.org</a></li>
<li><a href="https://cchits.net/">cchits.net</a></li>
<li><a href="https://freesound.org/">freesound.org</a></li>
<li><a href="https://librivox.org/">librivox.org</a></li>
<li><a href="https://freesvg.org/">freesvg.org/</a></li>
<li><a href="https://openclipart.org/">openclipart.org</a></li>
<li><a href="https://openfontlibrary.org/">openfontlibrary.org</a></li>
<li><a href="https://openstax.org">https://openstax.org</a></li>
<li><a href="https://maps.openrouteservice.org">openrouteservice.org/</a></li>
<li><a href="https://standardebooks.org/">https://standardebooks.org/</a></li>
<li><a href="https://www.openrouteservice.org/">openrouteservice.org/</a></li>
<li><a href="https://pixabay.com/">pixabay.com/</a></li>
</ul>
</nav>
<nav class="column">
@ -56,14 +59,15 @@
<ul>
<li><a href="https://anhonesthost.com/hosting/shared-hosting">AnHonestHost.com</a></li>
<li><a href="https://archive.org/donate/">Archive.org</a></li>
<li><a href="https://rsync.net/">rsync.net</a></li>
</ul>
</nav>
</div><!-- more_info -->
<h1 class="thick_bar"><span style="padding-left: 1em;">Copyright Information</span></h1>
<div id="copyright">
<p>
Unless otherwise stated, our shows are released under a Creative Commons <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) </a> license.</p>
Unless otherwise stated, our shows are released under a <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</a> license.</p>
<p>
The <span property="dct:title">HPR Website Design</span> is released to the <a rel="license" href="https://creativecommons.org/publicdomain/mark/1.0/">Public Domain</a>.
</p>

View File

@ -1,11 +1,11 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Hacker Public Radio ~ The Technology Community Podcast</title>
<meta charset="utf-8" />
<title>Hacker Public Radio ~ The Technology Community Podcast</title> <base href="https://hackerpublicradio.org/"> <meta charset="utf-8" />
<meta http-equiv="X-Clacks-Overhead" content="GNU Terry Pratchett" />
<meta http-equiv="last-modified" content="Thu, 28 Dec 2023 17:36:30 +0000">
<meta name="keywords" content="Technology, Tech News, Education, Training" />
<meta name="description" content="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." />
<meta name="description" content="Hacker Public Radio is a podcast that releases shows every weekday Monday through Friday. Our shows are produced by the community (you) and can be on any topic that is of interest to hackers and hobbyists." />
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Internal CSS -->
<style type="text/css">
@ -17,14 +17,14 @@
}
</style>
<link rel="shortcut icon" href="https://hackerpublicradio.org/hpr.ico" >
<link rel="alternate" type="application/rss+xml" title="Hacker Public Radio Ogg Vorbis RSS" href="https://hackerpublicradio.org/hpr_ogg.rss" />
<link rel="alternate" type="application/rss+xml" title="Hacker Public Radio Speex RSS" href="https://hackerpublicradio.org/hpr_spx.rss" />
<link rel="alternate" type="application/rss+xml" title="Hacker Public Radio MP3 RSS" href="https://hackerpublicradio.org/hpr_mp3.rss" />
<link rel="alternate" type="application/rss+xml" title="Hacker Public Radio Comments RSS" href="https://hackerpublicradio.org/comments_rss.php" />
<link rel="license" title="cc by 3.0" href="https://creativecommons.org/licenses/by-sa/3.0/" />
<link href="css/hpr.css" rel="stylesheet" />
<link rel="alternate" type="application/rss+xml" title="Hacker Public Radio Ogg Vorbis RSS" href="https://hackerpublicradio.org/hpr_ogg_rss.php" />
<link rel="alternate" type="application/rss+xml" title="Hacker Public Radio Speex RSS" href="https://hackerpublicradio.org/hpr_spx_rss.php" />
<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" />
<!--[if IE]>
<link rel="stylesheet" href="css/hpr.css" media="screen" type="text/css" />
<link rel="stylesheet" href="https://hackerpublicradio.org/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"/>
@ -33,35 +33,35 @@
<body id="give">
<div id="container" class="shadow">
<header>
<a href=""><img id="hprlogo" src="/images/hpr_logo.png" alt=""></a>
<div id="hpr_banner">
<p id="accessible_menu">
<a href="https://hackerpublicradio.org/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
</h1>
<h2>Your ideas, projects, opinions - podcasted.</h2>
<h3>New episodes Monday through Friday.</h3>
</div>
<hr />
<nav class="menu" role="navigation"> <ul>
<a href="https://hackerpublicradio.org/"><img id="hprlogo" src="https://hackerpublicradio.org/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="#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
</h1>
<h2>Your ideas, projects, opinions - podcasted.</h2>
<h3>New episodes every weekday Monday through Friday.<br />
</div>
<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/contribute.html">Give 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/help_out.html">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>
</ul>
</nav>
</nav>
</header>
<main id="maincontent">