General cleanup of file locations

This commit is contained in:
2023-12-23 11:24:21 +01:00
parent 715184a535
commit 9e0298cf97
11 changed files with 659 additions and 39 deletions

View File

@@ -73,6 +73,22 @@ $max_episode_array = mysqli_fetch_row($query);
$max_episode_number = $max_episode_array[0];
print "<!-- max_episode_number is $max_episode_number -->\n";
// --------------------------------------------
// Get the number of shows in the reserve queue.
$query = mysqli_query($connection, "SELECT COUNT(*) as count_reserve_queue FROM reservations WHERE status = 'RESERVE_SHOW_SUBMITTED' AND ip = '127.0.0.1';");
$response_array = mysqli_fetch_row($query);
$count_reserve_queue = $response_array[0];
print "<!-- count_reserve_queue is $count_reserve_queue -->\n";
// --------------------------------------------
// Get the number of shows in the reserve queue yet to be processed.
$query = mysqli_query($connection, "SELECT COUNT(*) as count_reserve_queue_unprocessed FROM reservations WHERE status = 'RESERVE_SHOW_SUBMITTED' AND ip != '127.0.0.1';");
$response_array = mysqli_fetch_row($query);
$count_reserve_queue_unprocessed = $response_array[0];
print "<!-- count_reserve_queue_unprocessed is $count_reserve_queue_unprocessed -->\n";
// --------------------------------------------
// Populate array with future shows and reservations
$show_array = array ();
@@ -162,6 +178,36 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
}
}
$ep_retrieve = "SELECT
hosts.host,
eps.id,
eps.title,
eps.date
FROM
eps,
hosts,
assets
WHERE
eps.valid = 0
AND eps.hostid = hosts.hostid
AND eps.id = assets.episode_id
AND eps.date >= '$current_episode_date'
ORDER BY
date DESC";
if ($result = mysqli_query($connection, $ep_retrieve)) {
while ($row = mysqli_fetch_array($result)) {
$id = $row['id'];
$date = $row['date'];
$title = $row['title'];
$host = $row['host'];
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ),
"title" => $title,
"host" => $host,
"status" => "Waiting for media"
);
}
}
$ep_retrieve = "SELECT
hosts.host,
eps.id,

View File

@@ -60,17 +60,20 @@ if (count($_POST) !== 8) {
if ( empty($_POST["comment_author_name"]) or strlen($_POST["comment_author_name"]) > 40 or strtolower($_POST["comment_author_name"]) == "testdog" ) {
naughty("294356cd36d3f9b75da4d8c0a6108881");
}
$comment_author_name = json_encode( $_POST["comment_author_name"] );
$comment_author_name = $_POST["comment_author_name"];
$comment_author_name_json = json_encode( $_POST["comment_author_name"] );
if ( empty($_POST["comment_title"]) or strlen($_POST["comment_title"]) > 100 ) {
naughty("a89efb428cfe36996a65b371d5f4e303");
}
$comment_title = json_encode( $_POST["comment_title"] );
$comment_title = $_POST["comment_title"];
$comment_title_json = json_encode( $_POST["comment_title"] );
if ( empty($_POST["comment_text"]) or strlen($_POST["comment_text"]) > 2000 or strpos(strtolower($_POST["comment_text"]), "outlook.con") !== false ) {
naughty("cd57ab4d7b77a131ed3deb441bd93dcd");
}
$comment_text = json_encode( $_POST["comment_text"] );
$comment_text = $_POST["comment_text"];
$comment_text_json = json_encode( $_POST["comment_text"] );
if ( empty($_POST["spammer"]) or strcmp($_POST["spammer"], "No") !== 0 ) {
naughty("b2ec68bd04cee0f64143ce4827a97e7c");
@@ -154,7 +157,8 @@ if ( ( $eps_id <= $current_episode_number ) and ( $eps_id >= ( $current_episode_
naughty("9357d78bf73b03ee2dd902a4c975f91d");
}
else {
$justification = json_encode("Current Comment");
$justification = "Current Comment";
$justification_json = json_encode("Current Comment");
}
}
else {
@@ -163,7 +167,8 @@ else {
naughty("df4af9bdd0302f672d6311c76bdc461a");
}
else {
$justification = json_encode( $_POST["justification"] );
$justification = $_POST["justification"];
$justification_json = json_encode( $_POST["justification"] );
}
}
@@ -183,8 +188,9 @@ $key = uniqid(md5(rand()));
$timestamp = time()+date("Z");
$timestamp = gmdate("Y-m-d\TH:i:s\Z",$timestamp);
$comment_file = "${comment_directory}/${timestamp}_${ip}_${key}.json";
$timestamp = json_encode($timestamp);
$comment_key = json_encode( $key );
$timestamp = $timestamp;
$timestamp_json = json_encode($timestamp);
$comment_key_json = json_encode( $key );
if ( file_exists( $comment_file ) ) {
naughty("ef5d14b33b262bfbf5d40544fdeb9ec3");
}
@@ -192,12 +198,12 @@ if ( file_exists( $comment_file ) ) {
$comment_data = "{
\"eps_id\": $eps_id,
\"ip\": \"$ip\",
\"comment_timestamp\": $timestamp,
\"comment_author_name\": $comment_author_name,
\"comment_title\": $comment_title,
\"comment_text\": $comment_text,
\"justification\": $justification,
\"key\": $comment_key
\"comment_timestamp\": $timestamp_json,
\"comment_author_name\": $comment_author_name_json,
\"comment_title\": $comment_title_json,
\"comment_text\": $comment_text_json,
\"justification\": $justification_json,
\"key\": $comment_key_json
}";
file_put_contents($comment_file, $comment_data );
@@ -241,6 +247,12 @@ $mailer->MsgHTML("<p>hpr${eps_id} on ${ep_date} by ${host} with the title <stron
<p>
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>.
</p>
<p>
There are now " . ++$unprocessed_comments . " unprocessed comments.
</p>
@@ -248,7 +260,27 @@ There are now " . ++$unprocessed_comments . " unprocessed comments.
Thanks,<br />
HPR Bot
</p>
<pre>" . date('Y-m-d\TH:i:s') . "\t" . getUserIP() . "\t" . $key . "\t" . $_SERVER["HTTP_USER_AGENT"] . "</pre>"
<pre>" . date('Y-m-d\TH:i:s') . "\t" . getUserIP() . "\t" . $key . "\t" . $_SERVER["HTTP_USER_AGENT"] . "</pre>
<hr />
<p>
<strong>eps_id</strong>: $eps_id,<br />
<strong>ip</strong>: $ip,<br />
<strong>key</strong>: $key<br />
<strong>justification</strong>: $justification,<br />
<strong>comment_timestamp</strong>: $timestamp,<br />
<strong>comment_author_name</strong>: $comment_author_name,<br />
<strong>comment_title</strong>: $comment_title,<br />
<strong>comment_text</strong>:
</p>
<pre>
$comment_text
</pre>
<hr />
<strong>comment_text_json</strong>:
<pre>
$comment_text_json
</pre>
<hr />"
);
$mailer->AltBody = "hpr${eps_id} on ${ep_date} by ${host} with the title ${title} \"${summary}\"</p>
@@ -266,7 +298,6 @@ if (!$mailer->send()) {
echo 'Mailer Error: ' . $mailer->ErrorInfo;
}
$body="give";
//$body="index_full";
include 'header.html';