1
0
forked from HPR/hpr_hub

9 Commits

6 changed files with 23 additions and 15 deletions

View File

@@ -61,26 +61,27 @@ function executeGET() {
die();
}
}
$ep_retrieve = "SELECT episode_id, filename, extension, `size`, sha1sum, mime_type
$ep_retrieve = "SELECT CONCAT( 'hpr', LPAD(CONVERT(`episode_id`,VARCHAR(4)),4,'0')) as episode, episode_id, filename, extension, `size`, sha1sum, mime_type
FROM assets
WHERE episode_id = '$id'
ORDER BY episode_id ASC;";
}
else {
$ep_retrieve = "SELECT episode_id, filename, extension, `size`, sha1sum, mime_type
$ep_retrieve = "SELECT CONCAT( 'hpr', LPAD(CONVERT(`episode_id`,VARCHAR(4)),4,'0')) as episode, episode_id, filename, extension, `size`, sha1sum, mime_type
FROM assets
ORDER BY episode_id ASC;";
}
if ($result = mysqli_query($connection, $ep_retrieve)) {
while ($row = mysqli_fetch_array($result)) {
$episode = $row['episode'];
$episode_id = $row['episode_id'];
$filename = $row['filename'];
$extension = $row['extension'];
$size = $row['size'];
$sha1sum = $row['sha1sum'];
$mime_type = $row['mime_type'];
$asset_array["hpr$episode_id"][$filename] = array (
$asset_array["$episode"][$filename] = array (
"episode_id" => $episode_id,
"filename" => $filename,
"extension" => $extension,
@@ -94,7 +95,7 @@ function executeGET() {
header('Content-Type: application/json');
header("Content-disposition: inline; filename=hpr_stats.json");
echo json_encode($asset_array);
echo json_encode($asset_array, JSON_NUMERIC_CHECK);
}
@@ -294,7 +295,7 @@ function executePOST() {
problem( "91c54771bcf68f974c9aa8959f953dd8" );
}
if ( intval($provided_size) > 3000000000 ){
if ( intval($provided_size) > 3500000000 ){
logextra( "The provided size is not a valid number because it's a lot larger than any show so far" );
problem( "8c085ec045b062e3a864e6fc22fceee4" );
}

View File

@@ -203,7 +203,7 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ),
"title" => $title,
"host" => $host,
"status" => "Waiting for media"
"status" => "Distributing media to the ccdn"
);
}
}

View File

@@ -17,6 +17,13 @@
#list1, #list2, #list3 {
display:none;
}
table.upload {
border-collapse: separate;
border-spacing: 0 0.75rem;
}
table.upload td {
vertical-align: top;
}
</style>
<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" />

View File

@@ -128,13 +128,13 @@ include 'header.html';
</p>
<h2><?php echo $status ?></h2>
<form method="POST" action="upload_confirm.php" enctype="multipart/form-data">
<table>
<table class="upload">
<tr>
<td>Host Email (<a href="<?php echo "${baseurl}about.html#email"; ?>" target="_blank">?</a>):</td>
<td><?php echo $email;?></td>
</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>
<?php
echo "<img src=\"$image_url\" alt=\"host image\" /><br /><small><em>";
@@ -168,7 +168,7 @@ include 'header.html';
</td>
</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>
<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>
@@ -178,7 +178,7 @@ include 'header.html';
</tr>
</table>
<h2>Please fill in some information about this episode</h2>
<table>
<table class="upload">
<tr>
<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>
@@ -258,7 +258,7 @@ include 'header.html';
</td>
</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>
<em>You have the choice of the following upload options:</em> <br />
<p>

View File

@@ -361,7 +361,7 @@ it with the HPR Volunteer at admin@hackerpublicradio.org
foreach($_FILES["media_files"]["tmp_name"] as $key => $val) {
if ( $_FILES["media_files"]["error"][ "$key"] == 0 ) {
$from = $_FILES["media_files"]["tmp_name"][ "$key"];
$to = "${dir_structure}/" . $_FILES["media_files"]["name"][ "$key"] ;
$to = "${dir_structure}/${db_key}_" . $_FILES["media_files"]["name"][ "$key"] ;
$moveResult = move_uploaded_file($from, $to);
if ($moveResult != true) {
echo "ERROR: File not moved correctly >$from< >$to<";

View File

@@ -334,11 +334,11 @@ if ($pos !== false) {
// General allowed Settings
$allowed_content_type = array( "application/json", "application/octet-stream", "application/ogg", "application/x-subrip", "audio/flac", "audio/mpeg", "audio/ogg", "audio/x-flac", "audio/x-wav", "image/jpeg", "image/png", "image/webp", "text/plain", "text/x-c" );
$allowed_content_type = array( "application/json", "application/octet-stream", "application/ogg", "application/x-subrip", "audio/flac", "audio/mpeg", "audio/ogg", "audio/x-flac", "audio/x-wav", "image/jpeg", "image/png", "image/webp", "text/plain", "text/x-c", "video/3gpp", "video/mp4", "audio/x-m4a" );
$allowed_extensions = array("wav", "flac", "opus", "ogg", "mp3", "jpg", "jpeg", "png", "webp", "srt", "txt" );
$allowed_extensions = array("m4a", "wav", "flac", "opus", "ogg", "mp3", "jpg", "jpeg", "png", "webp", "srt", "txt", "spx" );
$allowed_extensions_common = array("opus", "ogg", "mp3", "jpg", "jpeg", "png", "webp", "srt", "txt" );
$allowed_extensions_common = array("opus", "ogg", "mp3", "jpg", "jpeg", "png", "webp", "srt", "txt", "spx" );
#$ccdn_hosts_common = array("alpha.nl.eu.mirror.hackerpublicradio.org", "hpr.nyc3.cdn.digitaloceanspaces.com" );
$ccdn_hosts_common = array("alpha.nl.eu.mirror.hackerpublicradio.org", "hpr.nyc3.cdn.digitaloceanspaces.com" );