5 Commits

Author SHA1 Message Date
02671e10e7 2025-09-08_08-25-59Z_Monday database changed 2025-09-08 10:25:59 +02:00
602bbc4e9e Move #88 2025-09-08 09:48:46 +02:00
d6f567d9ea encoding comments, add id to schedule export 2025-08-21 16:49:38 +02:00
8743922705 Merge pull request 'Fix upload form layout' (#95) from hub94_Upload-form-fields-need-changes into main
Reviewed-on: #95
2025-06-26 23:55:40 +00:00
7dfac7fc16 Fix upload form layout
Make sure tables cells are vertically aligned to the top of the cells.
2025-06-25 22:36:47 -04:00
10 changed files with 27 additions and 46 deletions

View File

@@ -1,4 +0,0 @@
#!/bin/bash
yesterday="$( \date -u +%Y-%m-%d -d yesterday)"
echo -e "${yesterday}\t$( grep -Ec "${yesterday}T.*Sending request to" /home/hpr/logs/naughty-ip.txt )" >> /home/hpr/hub/hpr_ccdn_stats.tsv

View File

@@ -1,7 +0,0 @@
#!/bin/bash
pw=$(grep -E '^\$databasePassword = ' /home/hpr/php/credentials.php | awk -F "'" '{print $2}' )
pw=${pw##* }
mysqldump --user=hpr_hpr --password="$pw" -c -e --default-character-set=utf8 --single-transaction --skip-set-charset --add-drop-database --databases hpr_hpr > /home/hpr/hpr_hpr.sql
mysqldump --databases hpr_hpr --add-drop-database --tz-utc --host=localhost --user=hpr_hpr --password="$pw" > /home/hpr/mysqldump.sql
mysqldump --user=hpr_hpr --password="$pw" -c -e --default-character-set=utf8 --single-transaction --skip-set-charset --add-drop-database --databases hpr_hpr --ignore-table=hpr_hpr.reservations > /home/hpr/www/hpr.sql

View File

@@ -1,4 +0,0 @@
#!/bin/bash
pw=$(grep -E '^\$databasePassword = ' /home/hpr/php/credentials.php | awk -F "'" '{print $2}' )
pw=${pw##* }
mysql --host=localhost --user=hpr_hpr --password="$pw" hpr_hpr

View File

@@ -1,6 +0,0 @@
#!/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

View File

@@ -1,8 +0,0 @@
#!/bin/bash
hub_dir="/home/hpr/hub"
for format in txt csv json xml
do
curl --silent --netrc-file /home/hpr/.netrc https://hub.hackerpublicradio.org/cms/stats.php?format=${format} --output ${hub_dir}/stats.${format}
done

View File

@@ -134,13 +134,13 @@
$justification_ascii = "EXTENDED"; $justification_ascii = "EXTENDED";
} }
$comment_author_name_json = json_encode( $comment_author_name ); $comment_author_name_json = json_encode( htmlentities( $comment_author_name ) );
$comment_title_json = json_encode( $comment_title ); $comment_title_json = json_encode( htmlentities( $comment_title ) );
$comment_text_json = json_encode( $comment_text ); $comment_text_json = json_encode( htmlentities( $comment_text ) );
$justification_json = json_encode( $justification ); $justification_json = json_encode( htmlentities( $justification ) );
$comment_timestamp_json = json_encode( $comment_timestamp ); $comment_timestamp_json = json_encode( $comment_timestamp );

View File

@@ -6,7 +6,6 @@ date_default_timezone_set('UTC');
if ( $_SERVER['REQUEST_METHOD'] !== 'GET' ) { if ( $_SERVER['REQUEST_METHOD'] !== 'GET' ) {
naughty("5c965856fd6e1af9256c04d400698fae not GET methog"); naughty("5c965856fd6e1af9256c04d400698fae not GET methog");
} }
$num_get_args=0; $num_get_args=0;
foreach($_GET as $k => $v) { foreach($_GET as $k => $v) {
@@ -56,7 +55,6 @@ if (count($files) === 0) {
else { else {
$file = $files[0]; $file = $files[0];
} }
list($begin, $file_ip, $end) = explode('_', $file); list($begin, $file_ip, $end) = explode('_', $file);
if ( ! filter_var($file_ip, FILTER_VALIDATE_IP) ) { if ( ! filter_var($file_ip, FILTER_VALIDATE_IP) ) {
@@ -93,14 +91,14 @@ if ( $action === 'approve' ) {
echo json_encode($db); echo json_encode($db);
exit; exit;
} }
if ( $action === 'publish' ) { if ( $action === 'publish' ) {
$comment = file_get_contents("$file"); $comment = file_get_contents("$file");
$json = json_decode($comment, true); $json = json_decode($comment, true);
require "/home/hpr/public_html_hub/cms/comment_checks.php"; require "/home/hpr/public_html/cms/comment_checks.php";
$ep_num = mysqli_real_escape_string( $connection, $ep_num ); $ep_num = mysqli_real_escape_string( $connection, $ep_num );
$comment_timestamp_db = mysqli_real_escape_string( $connection, $comment_timestamp_db ); $comment_timestamp_db = mysqli_real_escape_string( $connection, $comment_timestamp_db );

View File

@@ -73,7 +73,9 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
else { else {
$status = "Reserved"; $status = "Reserved";
} }
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ), $show_array[$id] = array (
"id" => $id,
"date" => date('Y-m-d', strtotime($date) ),
"title" => $title, "title" => $title,
"host" => $host, "host" => $host,
"status" => $status, "status" => $status,
@@ -102,7 +104,8 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
$id = $row['ep_num']; $id = $row['ep_num'];
$date = $row['ep_date']; $date = $row['ep_date'];
$status = $row['status']; $status = $row['status'];
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ), $show_array[$id] = array ( "id" => $id,
"date" => date('Y-m-d', strtotime($date) ),
"title" => $status, "title" => $status,
"host" => "Unverified", "host" => "Unverified",
"status" => "Processing", "status" => "Processing",
@@ -121,7 +124,8 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
$date = $row['ep_date']; $date = $row['ep_date'];
$seconds_to_expiration = $row['seconds_to_expiration']; $seconds_to_expiration = $row['seconds_to_expiration'];
$minutes = floor($seconds_to_expiration / 60) + 1; $minutes = floor($seconds_to_expiration / 60) + 1;
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ), $show_array[$id] = array ( "id" => $id,
"date" => date('Y-m-d', strtotime($date) ),
"title" => " Available again in $minutes minutes", "title" => " Available again in $minutes minutes",
"host" => "Unverified", "host" => "Unverified",
"status" => "Locked", "status" => "Locked",
@@ -153,7 +157,8 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
$date = $row['date']; $date = $row['date'];
$title = $row['title']; $title = $row['title'];
$host = $row['host']; $host = $row['host'];
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ), $show_array[$id] = array ( "id" => $id,
"date" => date('Y-m-d', strtotime($date) ),
"title" => $title, "title" => $title,
"host" => $host, "host" => $host,
"status" => "Finished", "status" => "Finished",

View File

@@ -17,6 +17,13 @@
#list1, #list2, #list3 { #list1, #list2, #list3 {
display:none; display:none;
} }
table.upload {
border-collapse: separate;
border-spacing: 0 0.75rem;
}
table.upload td {
vertical-align: top;
}
</style> </style>
<link rel="shortcut icon" href="https://hackerpublicradio.org/hpr.ico" > <link rel="shortcut icon" href="https://hackerpublicradio.org/hpr.ico" >
<link rel="alternate" type="application/rss+xml" title="Hacker Public Radio Opus RSS" href="https://hackerpublicradio.org/hpr_opus_rss.php" /> <link rel="alternate" type="application/rss+xml" title="Hacker Public Radio Opus RSS" href="https://hackerpublicradio.org/hpr_opus_rss.php" />

View File

@@ -128,13 +128,13 @@ include 'header.html';
</p> </p>
<h2><?php echo $status ?></h2> <h2><?php echo $status ?></h2>
<form method="POST" action="upload_confirm.php" enctype="multipart/form-data"> <form method="POST" action="upload_confirm.php" enctype="multipart/form-data">
<table> <table class="upload">
<tr> <tr>
<td>Host Email (<a href="<?php echo "${baseurl}about.html#email"; ?>" target="_blank">?</a>):</td> <td>Host Email (<a href="<?php echo "${baseurl}about.html#email"; ?>" target="_blank">?</a>):</td>
<td><?php echo $email;?></td> <td><?php echo $email;?></td>
</tr> </tr>
<tr> <tr>
<td style="vertical-align:top;">Image: (<a href="<?php echo "${baseurl}about.html#image"; ?>" target="_blank">?</a>)</td> <td>Image: (<a href="<?php echo "${baseurl}about.html#image"; ?>" target="_blank">?</a>)</td>
<td> <td>
<?php <?php
echo "<img src=\"$image_url\" alt=\"host image\" /><br /><small><em>"; echo "<img src=\"$image_url\" alt=\"host image\" /><br /><small><em>";
@@ -168,7 +168,7 @@ include 'header.html';
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="vertical-align:top;">Profile: (<a href="<?php echo "${baseurl}about.html#Profile"; ?>" target="_blank">?</a>)</td> <td>Profile: (<a href="<?php echo "${baseurl}about.html#Profile"; ?>" target="_blank">?</a>)</td>
<td> <td>
<noscript> <noscript>
<textarea name="host_profile" maxlength="2000" rows="10" cols="50" placeholder="Enter some text about yourself with links to your blog or other online presence."><?php echo htmlspecialchars($profile) ?></textarea> <textarea name="host_profile" maxlength="2000" rows="10" cols="50" placeholder="Enter some text about yourself with links to your blog or other online presence."><?php echo htmlspecialchars($profile) ?></textarea>
@@ -178,7 +178,7 @@ include 'header.html';
</tr> </tr>
</table> </table>
<h2>Please fill in some information about this episode</h2> <h2>Please fill in some information about this episode</h2>
<table> <table class="upload">
<tr> <tr>
<td><strong>Title(*) (<a href="<?php echo "${baseurl}about.html#Title"; ?>" target="_blank">?</a>):</strong></td> <td><strong>Title(*) (<a href="<?php echo "${baseurl}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> <td><input required type="text" name="title" size="50" maxlength="100" placeholder="Enter a short descriptive title for your show."></td>
@@ -258,7 +258,7 @@ include 'header.html';
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="vertical-align:top;"><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 "${baseurl}about.html#upload_method"; ?>" target="_blank">?</a>)</strong></td>
<td> <td>
<em>You have the choice of the following upload options:</em> <br /> <em>You have the choice of the following upload options:</em> <br />
<p> <p>