1
0
forked from HPR/hpr_hub

Support for WYSIWYG upload

This commit is contained in:
Ken Fallon 2024-12-24 15:52:25 +01:00
parent 71124ab014
commit a553beafd5
3 changed files with 25 additions and 4 deletions

View File

@ -1,5 +1,9 @@
<?php
## Recent Changes
# Changed to support larger embedded images
# METADATA_PROCESSED is now folded into SHOW_SUBMITTED
require "/home/hpr/php/include.php";
date_default_timezone_set('UTC');
@ -104,7 +108,7 @@ logextra( "license is a valid value" );
$episode_license = $_POST["episode_license"];
if ( empty($_POST["notes"]) or strlen($_POST["notes"]) > 40000 ) {
if ( empty($_POST["notes"]) or strlen($_POST["notes"]) > 100000 ) {
problem("ERROR: Notes are missing not less than max");
}
logextra( "Notes are not missing and are less than max" );
@ -294,7 +298,7 @@ else {
$ep_num = intval($ep_num);
}
$result = mysqli_query($connection, "SELECT ep_num FROM reservations WHERE ep_num='$ep_num' AND status='METADATA_PROCESSED';");
$result = mysqli_query($connection, "SELECT ep_num FROM reservations WHERE ep_num='$ep_num' AND status='SHOW_SUBMITTED';");
if (!isset($result)) {
problem("ERROR: Cant get info from reservations db");
}
@ -303,7 +307,7 @@ $db_ep_num = $db_ep_num_array[0];
mysqli_free_result($result);
if ( $db_ep_num != $ep_num ){
problem("ERROR: Cant find $ep_num with status of METADATA_PROCESSED");
problem("ERROR: Cant find $ep_num with status of SHOW_SUBMITTED");
}
$result = mysqli_query($connection, "SELECT `id` FROM `eps` WHERE `id` = '$ep_num';");
@ -381,6 +385,8 @@ if (mysqli_errno( $connection )) {
problem("ERROR: MySQL error- The show $ep_num was not added to the eps db.\n$error");
}
logextra( "Added the entry: $query_add" );
$result = mysqli_query($connection, "SELECT `id` FROM `eps` WHERE `id` = '$ep_num';");
if (!isset($result)) {
problem("ERROR: DB problem - The show $ep_num has not been added to the eps db");

View File

@ -1,4 +1,8 @@
<?php
## Recent Changes
# $allowed_content_type moved to include.php
require "/home/hpr/php/include.php";
// curl --netrc-file $HOME/.netrc --verbose --request POST https://hub.hackerpublicradio.org/cms/assets.php --data-ascii @assets.json --header "Content-Type: application/json"
@ -259,7 +263,6 @@ foreach($decoded['assets'] as $asset) {
naughty( "fcec6e4039bc60daede3434e24c97a9f" );
}
$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", "text/plain", "text/plain", "text/vtt");
if (!in_array( $content_type, $allowed_content_type, true )) {
logextra( "This content_type \"$content_type\", is not in the list of allowed_extensions" );
naughty("4f29dcd2b3ef7efc5c4bc65be7a787ca");

View File

@ -332,6 +332,18 @@ if ($pos !== false) {
$HPR_Names = "Hackers";
}
// 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", "text/plain", "text/plain", "text/vtt", "text/x-c" );
$allowed_extensions = array("wav", "flac", "opus", "ogg", "spx", "mp3", "jpg", "png", "json", "srt", "tsv", "txt", "vtt");
$allowed_extensions_common = array("opus", "ogg", "spx", "mp3", "jpg", "png", "json", "srt", "tsv", "txt", "vtt");
#$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" );
#$ccdn_hosts_common = array( "hpr.nyc3.cdn.digitaloceanspaces.com" );
$ccdn_hosts_complete = array( "archive.org" );
?>