forked from HPR/hpr_hub
Compare commits
30 Commits
821b7ff1b6
...
newsite
Author | SHA1 | Date | |
---|---|---|---|
7a777a2b64 | |||
7ac9582162 | |||
0dc05ed7ee | |||
37f2e01306 | |||
083d3d3390 | |||
007d9ba738 | |||
fbac9f923d | |||
4d51954c3c | |||
2609ee5710 | |||
56a876214f | |||
d6f567d9ea | |||
8743922705 | |||
7dfac7fc16 | |||
3b737fb286 | |||
7cc2fcf479 | |||
1906de88d3 | |||
9a7314247d | |||
4f3a1657a2 | |||
dcb8b9a872 | |||
|
136378cf7e | ||
|
faca25007d | ||
|
7882b5f994 | ||
5f1fb269ce | |||
|
6e7b739fbd | ||
2fc60e5f19 | |||
0c73c23394 | |||
64bb28b4b4 | |||
70fe1cac27 | |||
1a748c01f6 | |||
a6044e16a7 |
691
cms/assets.php
691
cms/assets.php
@@ -5,347 +5,440 @@
|
||||
|
||||
require "/home/hpr/php/include.php";
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
// curl --netrc-file $HOME/.netrc --verbose --request POST https://hub.hackerpublicradio.org/cms/assets.php --data-ascii @assets.json --header "Content-Type: application/json"
|
||||
|
||||
//Make sure that it is a POST request.
|
||||
if(strcasecmp($_SERVER['REQUEST_METHOD'], 'POST') != 0){
|
||||
if ( strcasecmp($_SERVER['REQUEST_METHOD'], 'POST') != 0 && strcasecmp($_SERVER['REQUEST_METHOD'], 'GET') != 0 ){
|
||||
throw new Exception('Request method must be POST!');
|
||||
}
|
||||
|
||||
//Make sure that the content type of the POST request has been set to application/json
|
||||
$contentType = isset($_SERVER["CONTENT_TYPE"]) ? trim($_SERVER["CONTENT_TYPE"]) : '';
|
||||
if(strcasecmp($contentType, 'application/json') != 0){
|
||||
throw new Exception('Content type must be: application/json');
|
||||
if ( strcasecmp($_SERVER['REQUEST_METHOD'], 'GET') == 0 ){
|
||||
executeGET();
|
||||
}
|
||||
|
||||
//Receive the RAW post data.
|
||||
$content = trim(file_get_contents("php://input"));
|
||||
|
||||
//Attempt to decode the incoming RAW post data from JSON.
|
||||
$decoded = json_decode($content, true);
|
||||
|
||||
//If json_decode failed, the JSON is invalid.
|
||||
if(!is_array($decoded)){
|
||||
logextra( "Received content contained invalid JSON!" );
|
||||
naughty( "0e0e69415750c96f19d234f83270fdea" );
|
||||
if ( strcasecmp($_SERVER['REQUEST_METHOD'], 'POST') == 0 ){
|
||||
executePOST();
|
||||
}
|
||||
|
||||
foreach($decoded['assets'] as $asset) {
|
||||
function executeGET() {
|
||||
global $connection;
|
||||
|
||||
// Check episode_id
|
||||
|
||||
if ( isset( $asset['episode_id'] ) ) {
|
||||
|
||||
$provided_episode_id = $asset['episode_id'];
|
||||
|
||||
$provided_episode_id = filter_var($provided_episode_id, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
$asset_array = array ();
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
$id = $_GET['id'];
|
||||
$result = mysqli_query($connection, 'SELECT MAX(id) FROM eps;');
|
||||
if (!isset($result)) {
|
||||
logextra( "Can't connect to db" );
|
||||
naughty( "4c85d7b9e1d2eb741cdb60fd9f97b852" );
|
||||
logextra( "unable to execute SELECT MAX(id) FROM eps;" );
|
||||
problem( "2f1497d7734f5dc7ce04e1a343cbd4cb" );
|
||||
die('Could not query:' . mysqli_error());
|
||||
}
|
||||
|
||||
$maxhost_array = mysqli_fetch_row( $result );
|
||||
$maxhost = $maxhost_array[0];
|
||||
$num_get_args=0;
|
||||
foreach($_GET as $k => $v) {
|
||||
++$num_get_args;
|
||||
}
|
||||
|
||||
if (strval(intval($provided_episode_id)) != strval($provided_episode_id)) {
|
||||
logextra( "ID is not a valid number because strval(intval($provided_episode_id)) != strval($provided_episode_id))" );
|
||||
naughty( "b2babb5bebde79e08ddf3c780c56615d" );
|
||||
if ( (strval(intval($id)) != strval($id)) OR ( intval($id) <= 0 ) OR ( intval($id) > $maxhost ) OR ( $num_get_args > 1 ) ){
|
||||
logextra( "The id \"$id\" is not valid." );
|
||||
problem( "6b070390632e12a962338d2e31464f9f" );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( intval($provided_episode_id) <= 0 ){
|
||||
logextra( "ID is not a valid number because intval($provided_episode_id) <= 0" );
|
||||
naughty( "b245522d0582e61612e8b7dcdb0e0f4c" );
|
||||
}
|
||||
|
||||
if ( intval($provided_episode_id) > $maxhost ){
|
||||
logextra( "ID is not a valid number because intval($provided_episode_id) > $maxhost" );
|
||||
naughty( "c6feadcf0b6eda204cbfba6824aa2c7a" );
|
||||
}
|
||||
|
||||
if ( $num_get_args > 1 ){
|
||||
logextra( "ID is not a valid number because \$num_get_args: $num_get_args > 1" );
|
||||
naughty( "ba22518c5ced567cd0b855206985f036" );
|
||||
}
|
||||
|
||||
$query = "SELECT id FROM eps WHERE id = '$provided_episode_id'";
|
||||
$query = "SELECT id FROM eps WHERE id = '$id'";
|
||||
$result = @mysqli_query($connection, $query);
|
||||
if($result === FALSE) {
|
||||
logextra( "No result returned for this query \"SELECT id FROM eps WHERE id = '$provided_episode_id'\"" );
|
||||
naughty( "fa0778750519cb140b4076c844b3ec78" );
|
||||
logextra( "Cud not run SELECT id FROM eps WHERE id = $id" );
|
||||
problem( "568dff032398640456d749135358a88b" );
|
||||
}
|
||||
else {
|
||||
$db = mysqli_fetch_array($result, MYSQLI_ASSOC);
|
||||
if ( empty($db["id"]) ) {
|
||||
logextra( "No result returned for this id:\"${id}\"" );
|
||||
naughty( "1e09df9f3896da3e80507ea4538a4aca" );
|
||||
logextra( "The \"$id\" is not in the database" );
|
||||
http_response_code(404);
|
||||
die();
|
||||
}
|
||||
}
|
||||
$episode_id = $provided_episode_id;
|
||||
logextra( "Found Valid \$episode_id: $episode_id" );
|
||||
|
||||
$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 {
|
||||
logextra( "No episode_id provided" );
|
||||
naughty( "eae535cc88680a5bdab4e7bb4e54d83e" );
|
||||
exit;
|
||||
$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;";
|
||||
}
|
||||
|
||||
// Check filename
|
||||
|
||||
if ( isset( $asset['filename'] ) ) {
|
||||
$provided_filename = $asset['filename'];
|
||||
|
||||
$provided_filename = filter_var($provided_filename, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
|
||||
$this_dirname = dirname("$provided_filename", 2);
|
||||
if ( empty($this_dirname) ) {
|
||||
logextra( "no dirname" );
|
||||
naughty("b23ed28377cf4cf36cbf01931377ddc7");
|
||||
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["$episode"][$filename] = array (
|
||||
"episode_id" => $episode_id,
|
||||
"filename" => $filename,
|
||||
"extension" => $extension,
|
||||
"size" => $size,
|
||||
"sha1sum" => $sha1sum,
|
||||
"mime_type" => $mime_type
|
||||
);
|
||||
}
|
||||
|
||||
if ( $this_dirname === "/" ) {
|
||||
logextra( "dirname is root" );
|
||||
naughty("b90228a9c4d008eab57304bd36b75a08");
|
||||
}
|
||||
|
||||
$this_basename = basename($provided_filename);
|
||||
if ( empty($this_basename) ) {
|
||||
logextra( "Cound not extract basename from filename: $provided_filename" );
|
||||
naughty("44b5022e3a32605c6b0afdf7699ed153");
|
||||
}
|
||||
|
||||
if ( $this_basename !== $provided_filename ) {
|
||||
logextra( "filename: $provided_filename does not match name:$this_basename" );
|
||||
naughty("832f0283544692bd6691e3802e67099c");
|
||||
}
|
||||
|
||||
$this_ext = pathinfo($provided_filename, PATHINFO_EXTENSION);
|
||||
if ( empty($this_ext) ) {
|
||||
logextra( "The extension for \"$provided_filename\" is empty" );
|
||||
naughty("63166ba6572ac51b47804d9787152903");
|
||||
}
|
||||
|
||||
$this_prefix =pathinfo($provided_filename, PATHINFO_FILENAME);
|
||||
if ( empty($this_prefix) ) {
|
||||
logextra( "The prefix for \"$provided_filename\" is empty" );
|
||||
naughty("9ad9a6b9e47e6960ff30442c3c808609");
|
||||
}
|
||||
|
||||
if ( strlen($provided_filename) < 5 ) {
|
||||
logextra( "The length of \"$provided_filename\" is less than 5" );
|
||||
naughty("e131ae01530f4098c299aaca0a6ee8e1");
|
||||
}
|
||||
|
||||
if ( strlen($provided_filename) > 60 ) {
|
||||
logextra( "The length of \"$provided_filename\" is greater than 60" );
|
||||
naughty("d90560ef4cac05954c93523d529ed20e");
|
||||
}
|
||||
|
||||
if (!in_array( $this_ext, $allowed_extensions, true )) {
|
||||
logextra( "This extension $this_ext, is not in the list of allowed_extensions" );
|
||||
naughty("dd98c84719083fb80fecbd0405504038 $this_ext");
|
||||
}
|
||||
|
||||
$filename = $provided_filename;
|
||||
logextra( "Found Valid \$filename: $filename" );
|
||||
}
|
||||
else {
|
||||
logextra( "No filename provided" );
|
||||
naughty( "1edd3bcd2a16c152f0a97106372862f9" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check extension
|
||||
header('Content-Type: application/json');
|
||||
header("Content-disposition: inline; filename=hpr_stats.json");
|
||||
|
||||
if ( isset( $asset['extension'] ) ) {
|
||||
$provided_extension = $asset['extension'];
|
||||
echo json_encode($asset_array, JSON_NUMERIC_CHECK);
|
||||
|
||||
$provided_extension = filter_var($provided_extension, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
if ( $provided_extension !== $this_ext ) {
|
||||
logextra( "The extensions provided \"$provided_extension\" and in the filename dont match \"$provided_filename\"" );
|
||||
naughty("ed58e1493aa56e0eaf50362cc6f64425");
|
||||
}
|
||||
|
||||
if (!in_array( $provided_extension, $allowed_extensions, true )) {
|
||||
logextra( "This extension $this_ext, is not in the list of allowed_extensions" );
|
||||
naughty("dc406b9151871e38ac69c2bf44fa74da");
|
||||
}
|
||||
$extension = $provided_extension;
|
||||
logextra( "Found Valid \$extension: $extension" );
|
||||
}
|
||||
else {
|
||||
logextra( "No extension provided" );
|
||||
naughty( "04b53ecd0ffa3faa68db1e541554903d" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check size
|
||||
|
||||
if ( isset( $asset['size'] ) ) {
|
||||
|
||||
$provided_size = $asset['size'];
|
||||
|
||||
$provided_size = filter_var($provided_size, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
|
||||
if (strval(intval($provided_size)) != strval($provided_size)) {
|
||||
logextra( "The provided size is not a valid number because strval(intval($provided_size)) != strval($provided_size))" );
|
||||
naughty( "cc349935f0d80b40d5593b0fd54eaf58" );
|
||||
}
|
||||
|
||||
if ( intval($provided_size) <= 0 ){
|
||||
logextra( "The provided size is not a valid number because intval($provided_size) <= 0" );
|
||||
naughty( "91c54771bcf68f974c9aa8959f953dd8" );
|
||||
}
|
||||
|
||||
if ( intval($provided_size) > 3000000000 ){
|
||||
logextra( "The provided size is not a valid number because it's a lot larger than any show so far" );
|
||||
naughty( "8c085ec045b062e3a864e6fc22fceee4" );
|
||||
}
|
||||
|
||||
$size = $provided_size;
|
||||
logextra( "Found Valid \$size: $size" );
|
||||
}
|
||||
else {
|
||||
logextra( "No size provided" );
|
||||
naughty( "a6d661c483c6d62d4df1df88a64118ce" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check sha1sum
|
||||
|
||||
if ( isset( $asset['sha1sum'] ) ) {
|
||||
|
||||
$provided_sha1sum = $asset['sha1sum'];
|
||||
|
||||
$provided_sha1sum = filter_var($provided_sha1sum, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
if ( !preg_match('/^[0-9a-f]{40}$/i', $provided_sha1sum) ) {
|
||||
logextra( "The format of the sha1sum is invalid $provided_sha1sum" );
|
||||
naughty( "e30c8db8a7e07ba69ef18f957f3e8843" );
|
||||
}
|
||||
|
||||
$sha1sum = $provided_sha1sum;
|
||||
logextra( "Found Valid \$sha1sum: $sha1sum" );
|
||||
}
|
||||
else {
|
||||
logextra( "No sha1sum provided" );
|
||||
naughty( "cd3d303dbefec08016d567080116ef77" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check mime_type
|
||||
|
||||
if ( isset( $asset['mime_type'] ) ) {
|
||||
|
||||
$provided_mime_type = $asset['mime_type'];
|
||||
|
||||
$provided_mime_type = filter_var($provided_mime_type, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
if ( !preg_match('/^[\w-]+\/[\w-]+(?:;\s*[\w-]+=[\w-]+)*$/i', $provided_mime_type) ) {
|
||||
logextra( "The format of the mime_type is invalid \"$provided_mime_type\"" );
|
||||
naughty( "b36041a7d959730a9a541404db3b5025" );
|
||||
}
|
||||
|
||||
list($content_type, $charset_type) = explode('; charset=', $provided_mime_type);
|
||||
|
||||
if ( !isset( $content_type ) ) {
|
||||
logextra( "Can't find content_type in \"$provided_mime_type\"" );
|
||||
naughty( "c28ac580f5281ab2d97cbf052c92a25c" );
|
||||
}
|
||||
|
||||
if ( empty( $content_type ) ) {
|
||||
logextra( "Empty content_type in \"$provided_mime_type\"" );
|
||||
naughty( "fcec6e4039bc60daede3434e24c97a9f" );
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
if ( !isset( $charset_type ) ) {
|
||||
logextra( "Can't find charset_type in \"$provided_mime_type\"" );
|
||||
naughty( "" );
|
||||
}
|
||||
|
||||
if ( empty( $charset_type ) ) {
|
||||
logextra( "Empty charset_type in \"$provided_mime_type\"" );
|
||||
naughty( "" );
|
||||
}
|
||||
|
||||
$allowed_charset_type = array( "binary", "us-ascii", "utf-8");
|
||||
if (!in_array( $charset_type, $allowed_charset_type, true )) {
|
||||
logextra( "This charset_type \"$charset_type\", is not in the list of allowed_extensions" );
|
||||
naughty("");
|
||||
}
|
||||
|
||||
$mime_type = $provided_mime_type;
|
||||
logextra( "Found Valid \$mime_type: $mime_type" );
|
||||
}
|
||||
else {
|
||||
logextra( "No mime_type provided" );
|
||||
naughty( "0c85eb982665a4978fea8f85611fbe88" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check file_type
|
||||
|
||||
if ( isset( $asset['file_type'] ) ) {
|
||||
$provided_file_type = $asset['file_type'];
|
||||
|
||||
$provided_file_type = filter_var($provided_file_type, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
|
||||
if ( strlen($provided_file_type) < 5 ) {
|
||||
logextra( "The length of \"$provided_file_type\" is less than 5" );
|
||||
naughty("60839aaddc82e0fbe4f5da269c361cf6");
|
||||
}
|
||||
|
||||
if ( strlen($provided_file_type) > 140 ) {
|
||||
logextra( "The length of \"$provided_file_type\" is greater than 140" );
|
||||
naughty("cafbb1b0c9955b92303fe34102890fa3");
|
||||
}
|
||||
|
||||
$file_type = $provided_file_type;
|
||||
logextra( "Found Valid \$file_type: $file_type" );
|
||||
}
|
||||
else {
|
||||
logextra( "No file_type provided" );
|
||||
naughty( "a1b6a02d68533f9749da16164cbe704e" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Write values to db
|
||||
|
||||
//$episode_id is a number
|
||||
$filename = mysqli_real_escape_string( $connection, $filename );
|
||||
$extension = mysqli_real_escape_string( $connection, $extension );
|
||||
//$size is a number
|
||||
$sha1sum = mysqli_real_escape_string( $connection, $sha1sum );
|
||||
$mime_type = mysqli_real_escape_string( $connection, $mime_type );
|
||||
$file_type = mysqli_real_escape_string( $connection, $file_type );
|
||||
|
||||
$query_replace = "REPLACE INTO assets VALUES ('$episode_id','{$filename}','{$extension}','$size','{$sha1sum}','{$mime_type}','{$file_type}')";
|
||||
|
||||
$result = mysqli_query($connection, $query_replace );
|
||||
if(!$result) {
|
||||
problem("ERROR: DB problem - The asset for \"$episode_id\" with filename of \"$filename\" was not added to the eps db.");
|
||||
}
|
||||
else{
|
||||
logextra( "mysql_query.result: \"$result\"\n" );
|
||||
}
|
||||
if (mysqli_errno( $connection )) {
|
||||
$error = "MySQL error ".mysqli_errno( $connection ).": ".mysqli_error()."\n";
|
||||
problem("ERROR: MySQL error- The asset for \"$episode_id\" with filename of \"$filename\" was not added to the eps db.\n$error");
|
||||
}
|
||||
|
||||
logextra( "Finished ." );
|
||||
}
|
||||
|
||||
http_response_code(200);
|
||||
|
||||
function executePOST() {
|
||||
global $connection, $allowed_extensions, $allowed_content_type;
|
||||
|
||||
//Make sure that the content type of the POST request has been set to application/json
|
||||
$contentType = isset($_SERVER["CONTENT_TYPE"]) ? trim($_SERVER["CONTENT_TYPE"]) : '';
|
||||
if(strcasecmp($contentType, 'application/json') != 0){
|
||||
throw new Exception('Content type must be: application/json');
|
||||
}
|
||||
|
||||
//Receive the RAW post data.
|
||||
$content = trim(file_get_contents("php://input"));
|
||||
|
||||
//Attempt to decode the incoming RAW post data from JSON.
|
||||
$decoded = json_decode($content, true);
|
||||
|
||||
//If json_decode failed, the JSON is invalid.
|
||||
if(!is_array($decoded)){
|
||||
logextra( "Received content contained invalid JSON!" );
|
||||
problem( "0e0e69415750c96f19d234f83270fdea" );
|
||||
}
|
||||
|
||||
foreach($decoded['assets'] as $asset) {
|
||||
|
||||
// Check episode_id
|
||||
|
||||
if ( isset( $asset['episode_id'] ) ) {
|
||||
|
||||
$provided_episode_id = $asset['episode_id'];
|
||||
|
||||
$provided_episode_id = filter_var($provided_episode_id, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
|
||||
$result = mysqli_query($connection, 'SELECT MAX(id) FROM eps;');
|
||||
if (!isset($result)) {
|
||||
logextra( "Can't connect to db" );
|
||||
problem( "4c85d7b9e1d2eb741cdb60fd9f97b852" );
|
||||
die('Could not query:' . mysqli_error());
|
||||
}
|
||||
|
||||
$maxhost_array = mysqli_fetch_row( $result );
|
||||
$maxhost = $maxhost_array[0];
|
||||
$num_get_args=0;
|
||||
foreach($_GET as $k => $v) {
|
||||
++$num_get_args;
|
||||
}
|
||||
|
||||
if (strval(intval($provided_episode_id)) != strval($provided_episode_id)) {
|
||||
logextra( "ID is not a valid number because strval(intval($provided_episode_id)) != strval($provided_episode_id))" );
|
||||
problem( "b2babb5bebde79e08ddf3c780c56615d" );
|
||||
}
|
||||
|
||||
if ( intval($provided_episode_id) <= 0 ){
|
||||
logextra( "ID is not a valid number because intval($provided_episode_id) <= 0" );
|
||||
problem( "b245522d0582e61612e8b7dcdb0e0f4c" );
|
||||
}
|
||||
|
||||
if ( intval($provided_episode_id) > $maxhost ){
|
||||
logextra( "ID is not a valid number because intval($provided_episode_id) > $maxhost" );
|
||||
problem( "c6feadcf0b6eda204cbfba6824aa2c7a" );
|
||||
}
|
||||
|
||||
if ( $num_get_args > 1 ){
|
||||
logextra( "ID is not a valid number because \$num_get_args: $num_get_args > 1" );
|
||||
problem( "ba22518c5ced567cd0b855206985f036" );
|
||||
}
|
||||
|
||||
$query = "SELECT id FROM eps WHERE id = '$provided_episode_id'";
|
||||
$result = @mysqli_query($connection, $query);
|
||||
if($result === FALSE) {
|
||||
logextra( "No result returned for this query \"SELECT id FROM eps WHERE id = '$provided_episode_id'\"" );
|
||||
problem( "fa0778750519cb140b4076c844b3ec78" );
|
||||
}
|
||||
else {
|
||||
$db = mysqli_fetch_array($result, MYSQLI_ASSOC);
|
||||
if ( empty($db["id"]) ) {
|
||||
logextra( "No result returned for this id:\"${id}\"" );
|
||||
problem( "1e09df9f3896da3e80507ea4538a4aca" );
|
||||
}
|
||||
}
|
||||
$episode_id = $provided_episode_id;
|
||||
logextra( "Found Valid \$episode_id: $episode_id" );
|
||||
|
||||
}
|
||||
else {
|
||||
logextra( "No episode_id provided" );
|
||||
problem( "eae535cc88680a5bdab4e7bb4e54d83e" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check filename
|
||||
|
||||
if ( isset( $asset['filename'] ) ) {
|
||||
$provided_filename = $asset['filename'];
|
||||
|
||||
$provided_filename = filter_var($provided_filename, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
|
||||
$this_dirname = dirname("$provided_filename", 2);
|
||||
if ( empty($this_dirname) ) {
|
||||
logextra( "no dirname" );
|
||||
problem("b23ed28377cf4cf36cbf01931377ddc7");
|
||||
}
|
||||
|
||||
if ( $this_dirname === "/" ) {
|
||||
logextra( "dirname is root" );
|
||||
problem("b90228a9c4d008eab57304bd36b75a08");
|
||||
}
|
||||
|
||||
$this_basename = basename($provided_filename);
|
||||
if ( empty($this_basename) ) {
|
||||
logextra( "Cound not extract basename from filename: $provided_filename" );
|
||||
problem("44b5022e3a32605c6b0afdf7699ed153");
|
||||
}
|
||||
|
||||
if ( $this_basename !== $provided_filename ) {
|
||||
logextra( "filename: $provided_filename does not match name:$this_basename" );
|
||||
problem("832f0283544692bd6691e3802e67099c");
|
||||
}
|
||||
|
||||
$this_ext = pathinfo($provided_filename, PATHINFO_EXTENSION);
|
||||
if ( empty($this_ext) ) {
|
||||
logextra( "The extension for \"$provided_filename\" is empty" );
|
||||
problem("63166ba6572ac51b47804d9787152903");
|
||||
}
|
||||
|
||||
$this_prefix =pathinfo($provided_filename, PATHINFO_FILENAME);
|
||||
if ( empty($this_prefix) ) {
|
||||
logextra( "The prefix for \"$provided_filename\" is empty" );
|
||||
problem("9ad9a6b9e47e6960ff30442c3c808609");
|
||||
}
|
||||
|
||||
if ( strlen($provided_filename) < 5 ) {
|
||||
logextra( "The length of \"$provided_filename\" is less than 5" );
|
||||
problem("e131ae01530f4098c299aaca0a6ee8e1");
|
||||
}
|
||||
|
||||
if ( strlen($provided_filename) > 60 ) {
|
||||
logextra( "The length of \"$provided_filename\" is greater than 60" );
|
||||
problem("d90560ef4cac05954c93523d529ed20e");
|
||||
}
|
||||
|
||||
if (!in_array( $this_ext, $allowed_extensions, true )) {
|
||||
logextra( "This extension $this_ext, is not in the list of allowed_extensions" );
|
||||
problem("dd98c84719083fb80fecbd0405504038 $this_ext");
|
||||
}
|
||||
|
||||
$filename = $provided_filename;
|
||||
logextra( "Found Valid \$filename: $filename" );
|
||||
}
|
||||
else {
|
||||
logextra( "No filename provided" );
|
||||
problem( "1edd3bcd2a16c152f0a97106372862f9" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check extension
|
||||
|
||||
if ( isset( $asset['extension'] ) ) {
|
||||
$provided_extension = $asset['extension'];
|
||||
|
||||
$provided_extension = filter_var($provided_extension, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
if ( $provided_extension !== $this_ext ) {
|
||||
logextra( "The extensions provided \"$provided_extension\" and in the filename dont match \"$provided_filename\"" );
|
||||
problem("ed58e1493aa56e0eaf50362cc6f64425");
|
||||
}
|
||||
|
||||
if (!in_array( $provided_extension, $allowed_extensions, true )) {
|
||||
logextra( "This extension $this_ext, is not in the list of allowed_extensions" );
|
||||
problem("dc406b9151871e38ac69c2bf44fa74da");
|
||||
}
|
||||
$extension = $provided_extension;
|
||||
logextra( "Found Valid \$extension: $extension" );
|
||||
}
|
||||
else {
|
||||
logextra( "No extension provided" );
|
||||
problem( "04b53ecd0ffa3faa68db1e541554903d" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check size
|
||||
|
||||
if ( isset( $asset['size'] ) ) {
|
||||
|
||||
$provided_size = $asset['size'];
|
||||
|
||||
$provided_size = filter_var($provided_size, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
|
||||
if (strval(intval($provided_size)) != strval($provided_size)) {
|
||||
logextra( "The provided size is not a valid number because strval(intval($provided_size)) != strval($provided_size))" );
|
||||
problem( "cc349935f0d80b40d5593b0fd54eaf58" );
|
||||
}
|
||||
|
||||
if ( intval($provided_size) <= 0 ){
|
||||
logextra( "The provided size is not a valid number because intval($provided_size) <= 0" );
|
||||
problem( "91c54771bcf68f974c9aa8959f953dd8" );
|
||||
}
|
||||
|
||||
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" );
|
||||
}
|
||||
|
||||
$size = $provided_size;
|
||||
logextra( "Found Valid \$size: $size" );
|
||||
}
|
||||
else {
|
||||
logextra( "No size provided" );
|
||||
problem( "a6d661c483c6d62d4df1df88a64118ce" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check sha1sum
|
||||
|
||||
if ( isset( $asset['sha1sum'] ) ) {
|
||||
|
||||
$provided_sha1sum = $asset['sha1sum'];
|
||||
|
||||
$provided_sha1sum = filter_var($provided_sha1sum, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
if ( !preg_match('/^[0-9a-f]{40}$/i', $provided_sha1sum) ) {
|
||||
logextra( "The format of the sha1sum is invalid $provided_sha1sum" );
|
||||
problem( "e30c8db8a7e07ba69ef18f957f3e8843" );
|
||||
}
|
||||
|
||||
$sha1sum = $provided_sha1sum;
|
||||
logextra( "Found Valid \$sha1sum: $sha1sum" );
|
||||
}
|
||||
else {
|
||||
logextra( "No sha1sum provided" );
|
||||
problem( "cd3d303dbefec08016d567080116ef77" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check mime_type
|
||||
|
||||
if ( isset( $asset['mime_type'] ) ) {
|
||||
|
||||
$provided_mime_type = $asset['mime_type'];
|
||||
|
||||
$provided_mime_type = filter_var($provided_mime_type, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
if ( !preg_match('/^[\w-]+\/[\w-]+(?:;\s*[\w-]+=[\w-]+)*$/i', $provided_mime_type) ) {
|
||||
logextra( "The format of the mime_type is invalid \"$provided_mime_type\"" );
|
||||
problem( "b36041a7d959730a9a541404db3b5025" );
|
||||
}
|
||||
|
||||
list($content_type, $charset_type) = explode('; charset=', $provided_mime_type);
|
||||
|
||||
if ( !isset( $content_type ) ) {
|
||||
logextra( "Can't find content_type in \"$provided_mime_type\"" );
|
||||
problem( "c28ac580f5281ab2d97cbf052c92a25c" );
|
||||
}
|
||||
|
||||
if ( empty( $content_type ) ) {
|
||||
logextra( "Empty content_type in \"$provided_mime_type\"" );
|
||||
problem( "fcec6e4039bc60daede3434e24c97a9f" );
|
||||
}
|
||||
|
||||
if (!in_array( $content_type, $allowed_content_type, true )) {
|
||||
logextra( "This content_type \"$content_type\", is not in the list of allowed_extensions" );
|
||||
problem("4f29dcd2b3ef7efc5c4bc65be7a787ca");
|
||||
}
|
||||
|
||||
if ( !isset( $charset_type ) ) {
|
||||
logextra( "Can't find charset_type in \"$provided_mime_type\"" );
|
||||
problem( "" );
|
||||
}
|
||||
|
||||
if ( empty( $charset_type ) ) {
|
||||
logextra( "Empty charset_type in \"$provided_mime_type\"" );
|
||||
problem( "" );
|
||||
}
|
||||
|
||||
$allowed_charset_type = array( "binary", "us-ascii", "utf-8");
|
||||
if (!in_array( $charset_type, $allowed_charset_type, true )) {
|
||||
logextra( "This charset_type \"$charset_type\", is not in the list of allowed_extensions" );
|
||||
problem("");
|
||||
}
|
||||
|
||||
$mime_type = $provided_mime_type;
|
||||
logextra( "Found Valid \$mime_type: $mime_type" );
|
||||
}
|
||||
else {
|
||||
logextra( "No mime_type provided" );
|
||||
problem( "0c85eb982665a4978fea8f85611fbe88" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check file_type
|
||||
|
||||
if ( isset( $asset['file_type'] ) ) {
|
||||
$provided_file_type = $asset['file_type'];
|
||||
|
||||
$provided_file_type = filter_var($provided_file_type, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
|
||||
|
||||
if ( strlen($provided_file_type) < 5 ) {
|
||||
logextra( "The length of \"$provided_file_type\" is less than 5" );
|
||||
problem("60839aaddc82e0fbe4f5da269c361cf6");
|
||||
}
|
||||
|
||||
if ( strlen($provided_file_type) > 140 ) {
|
||||
logextra( "The length of \"$provided_file_type\" is greater than 140" );
|
||||
problem("cafbb1b0c9955b92303fe34102890fa3");
|
||||
}
|
||||
|
||||
$file_type = $provided_file_type;
|
||||
logextra( "Found Valid \$file_type: $file_type" );
|
||||
}
|
||||
else {
|
||||
logextra( "No file_type provided" );
|
||||
problem( "a1b6a02d68533f9749da16164cbe704e" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Write values to db
|
||||
|
||||
//$episode_id is a number
|
||||
$filename = mysqli_real_escape_string( $connection, $filename );
|
||||
$extension = mysqli_real_escape_string( $connection, $extension );
|
||||
//$size is a number
|
||||
$sha1sum = mysqli_real_escape_string( $connection, $sha1sum );
|
||||
$mime_type = mysqli_real_escape_string( $connection, $mime_type );
|
||||
$file_type = mysqli_real_escape_string( $connection, $file_type );
|
||||
|
||||
$query_replace = "REPLACE INTO assets VALUES ('$episode_id','{$filename}','{$extension}','$size','{$sha1sum}','{$mime_type}','{$file_type}')";
|
||||
|
||||
$result = mysqli_query($connection, $query_replace );
|
||||
if(!$result) {
|
||||
problem("ERROR: DB problem - The asset for \"$episode_id\" with filename of \"$filename\" was not added to the eps db.");
|
||||
}
|
||||
else{
|
||||
logextra( "mysql_query.result: \"$result\"\n" );
|
||||
}
|
||||
if (mysqli_errno( $connection )) {
|
||||
$error = "MySQL error ".mysqli_errno( $connection ).": ".mysqli_error()."\n";
|
||||
problem("ERROR: MySQL error- The asset for \"$episode_id\" with filename of \"$filename\" was not added to the eps db.\n$error");
|
||||
}
|
||||
|
||||
logextra( "Finished ." );
|
||||
}
|
||||
|
||||
http_response_code(200);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
@@ -134,13 +134,13 @@
|
||||
$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 );
|
||||
|
||||
|
78
cms/say.php
78
cms/say.php
@@ -1,11 +1,14 @@
|
||||
<?php
|
||||
require "/home/hpr/php/include.php";
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
$id = $_GET['id'];
|
||||
$result = mysqli_query($connection, 'SELECT MAX(id) FROM eps;');
|
||||
if (!isset($result)) {
|
||||
die('Could not query:' . mysqli_error());
|
||||
problem( "45f606ad99fe4fca7430b7b5bba1c681" );
|
||||
die('Could not query:' . mysqli_error());
|
||||
}
|
||||
$maxhost_array = mysqli_fetch_row( $result );
|
||||
$maxhost = $maxhost_array[0];
|
||||
@@ -14,26 +17,25 @@ if (isset($_GET['id'])) {
|
||||
++$num_get_args;
|
||||
}
|
||||
if ( (strval(intval($id)) != strval($id)) OR ( intval($id) <= 0 ) OR ( intval($id) > $maxhost ) OR ( $num_get_args > 1 ) ){
|
||||
exit;
|
||||
problem( "ea860134910fecd136229e45262709d7" );
|
||||
exit;
|
||||
}
|
||||
$query = "SELECT id FROM eps WHERE id = '$id'";
|
||||
$result = @mysqli_query($connection, $query);
|
||||
if($result === FALSE) {
|
||||
call412( "dc5b8dae7ea2a7e70ac0b7ea65ce2d12" );
|
||||
problem( "dc5b8dae7ea2a7e70ac0b7ea65ce2d12" );
|
||||
}
|
||||
else {
|
||||
$db = mysqli_fetch_array($result, MYSQLI_ASSOC);
|
||||
if ( empty($db["id"]) ) {
|
||||
call412( "2b6462ff2389405a796066dfc73ccf55" );
|
||||
problem( "2b6462ff2389405a796066dfc73ccf55" );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
call412( "ae1f3471af22d32d3bf2efc9130a00ae" );
|
||||
problem( "ae1f3471af22d32d3bf2efc9130a00ae" );
|
||||
exit;
|
||||
}
|
||||
Header('Content-type: text/tab-separated-values');
|
||||
header("Content-disposition: inline; filename=say.txt");
|
||||
|
||||
$ep_retrieve = "SELECT
|
||||
UNIX_TIMESTAMP(eps.date) AS timestamp,
|
||||
@@ -88,42 +90,62 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
$HPR_summary = "This is Hacker Public Radio episode $id for " . date("l", $date) . " the " . date("jS", $date) . " of " . date("F Y", $date) . ". Todays show is entitled. ${title}.";
|
||||
else {
|
||||
http_response_code(404);
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$synopsis = "This is Hacker Public Radio episode $id for " . date("l", $date) . " the " . date("jS", $date) . " of " . date("F Y", $date) . ". Todays show is entitled. ${title}.";
|
||||
if ($series > "0"){
|
||||
$series_query = mysqli_query($connection, "SELECT name, description FROM miniseries WHERE id = '$series'");
|
||||
$series_result = mysqli_fetch_array($series_query);
|
||||
$series_title = $series_result['name'];
|
||||
$desc = $series_result['description'];
|
||||
$HPR_summary = "${HPR_summary} It is part of the series \"$series_title\"";
|
||||
$synopsis = "${synopsis} It is part of the series \"$series_title\"";
|
||||
}
|
||||
$HPR_summary = "${HPR_summary} ${host_notes} and is about " . round($duration/60) . " minutes long. It carries ";
|
||||
$synopsis = "${synopsis} ${host_notes} and is about " . round($duration/60) . " minutes long. It carries ";
|
||||
if ($explicit == 0) {
|
||||
$HPR_summary = "${HPR_summary} a clean flag. ";
|
||||
$synopsis = "${synopsis} a clean flag. ";
|
||||
$explicit = "Clean";
|
||||
}
|
||||
else{
|
||||
$HPR_summary = "${HPR_summary} an explicit flag. ";
|
||||
$synopsis = "${synopsis} an explicit flag. ";
|
||||
$explicit = "Explicit";
|
||||
}
|
||||
if ( !empty( $summary ) ) {
|
||||
$HPR_summary = "${HPR_summary}. The summary is. $summary";
|
||||
$synopsis = "${synopsis}. The summary is. $summary";
|
||||
}
|
||||
if (strcmp($license, "CC-BY-SA" ) !== 0) {
|
||||
$HPR_summary = "${HPR_summary}. Todays show is licensed under a $license_long_name license.";
|
||||
$synopsis = "${synopsis}. Todays show is licensed under a $license_long_name license.";
|
||||
}
|
||||
|
||||
$HPR_summary = str_replace($host,$espeak_name,$HPR_summary);
|
||||
$synopsis = str_replace($host,$espeak_name,$synopsis);
|
||||
|
||||
echo "HPR_summary: ${HPR_summary}\n";
|
||||
echo "HPR_album: Hacker Public Radio\n";
|
||||
echo "HPR_artist: ${host}\n";
|
||||
echo "HPR_hostid: ${hostid}\n";
|
||||
echo "HPR_comment: https://hackerpublicradio.org ${explicit}; $summary\n";
|
||||
echo "HPR_genre: Podcast\n";
|
||||
echo "HPR_license: ${license}\n";
|
||||
echo "HPR_title: ${title}\n";
|
||||
echo "HPR_track: $id\n";
|
||||
echo "HPR_year: " . date("Y", $date) . "\n";
|
||||
echo "HPR_duration: ${duration}\n";
|
||||
echo "HPR_explicit: ${explicit}\n";
|
||||
?>
|
||||
// --------------------------------------------
|
||||
// Display the results
|
||||
|
||||
$arr = array(
|
||||
'genre' => "Podcast",
|
||||
'album' => "Hacker Public Radio",
|
||||
'track' => "$id",
|
||||
'year' => date("Y", $date),
|
||||
'date' => date("Y-m-d", $date),
|
||||
'artist' => "${host}",
|
||||
'hostid' => "${hostid}",
|
||||
'title' => "${title}",
|
||||
'duration' => "${duration}",
|
||||
'license' => "${license}",
|
||||
'explicit' => "${explicit}",
|
||||
'summary' => "${summary}",
|
||||
'comment' => "https://hackerpublicradio.org ${explicit}; $summary",
|
||||
'synopsis' => "${synopsis}"
|
||||
);
|
||||
|
||||
header('Content-Type: application/json');
|
||||
header("Content-disposition: inline; filename=hpr_stats.json");
|
||||
|
||||
echo json_encode($arr);
|
||||
|
||||
mysqli_close($connection);
|
||||
|
@@ -42,7 +42,7 @@ $current_episode_number = $current_episode_array[1];
|
||||
// Populate array with future shows and reservations
|
||||
$show_array = array ();
|
||||
|
||||
// REQUEST_UNVERIFIED → SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_RSYNC_NET
|
||||
// REQUEST_UNVERIFIED → SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_CCDN
|
||||
$ep_retrieve = "SELECT hosts.host, eps.id, eps.title, eps.date FROM eps, hosts WHERE eps.valid=1 AND eps.hostid = hosts.hostid AND eps.date >= '$current_episode_date' ORDER BY date DESC";
|
||||
|
||||
$ep_retrieve = "SELECT
|
||||
@@ -73,14 +73,17 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
|
||||
else {
|
||||
$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,
|
||||
"host" => $host,
|
||||
"status" => $status
|
||||
"status" => $status,
|
||||
"workflow" => $status
|
||||
);
|
||||
}
|
||||
}
|
||||
// REQUEST_UNVERIFIED → SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_RSYNC_NET
|
||||
// REQUEST_UNVERIFIED → SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_CCDN
|
||||
|
||||
// Populate array with currently processing shows EMAIL_LINK_CLICKED
|
||||
$ep_retrieve = "
|
||||
@@ -101,10 +104,12 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
|
||||
$id = $row['ep_num'];
|
||||
$date = $row['ep_date'];
|
||||
$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,
|
||||
"host" => "Unverified",
|
||||
"status" => "Processing"
|
||||
"status" => "Processing",
|
||||
"workflow" => $status
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -119,10 +124,12 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
|
||||
$date = $row['ep_date'];
|
||||
$seconds_to_expiration = $row['seconds_to_expiration'];
|
||||
$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",
|
||||
"host" => "Unverified",
|
||||
"status" => "Locked"
|
||||
"status" => "Locked",
|
||||
"workflow" => "Locked"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -150,10 +157,12 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
|
||||
$date = $row['date'];
|
||||
$title = $row['title'];
|
||||
$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,
|
||||
"host" => $host,
|
||||
"status" => "Finished"
|
||||
"status" => "Finished",
|
||||
"workflow" => "Finished"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
126
cms/shownotes.php
Normal file
126
cms/shownotes.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
require "/home/hpr/php/include.php";
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
$id = $_GET['id'];
|
||||
$result = mysqli_query($connection, 'SELECT MAX(id) FROM eps;');
|
||||
if (!isset($result)) {
|
||||
problem( "d7f47a123af3ea10628ce44d2146b40e" );
|
||||
die('Could not query:' . mysqli_error());
|
||||
}
|
||||
$maxhost_array = mysqli_fetch_row( $result );
|
||||
$maxhost = $maxhost_array[0];
|
||||
$num_get_args=0;
|
||||
foreach($_GET as $k => $v) {
|
||||
++$num_get_args;
|
||||
}
|
||||
if ( (strval(intval($id)) != strval($id)) OR ( intval($id) <= 0 ) OR ( intval($id) > $maxhost ) OR ( $num_get_args > 1 ) ){
|
||||
problem( "5d45cb79dd9426e7e4ab5595ac647a62" );
|
||||
exit;
|
||||
}
|
||||
$query = "SELECT id FROM eps WHERE id = '$id'";
|
||||
$result = @mysqli_query($connection, $query);
|
||||
if($result === FALSE) {
|
||||
problem( "b26e5cea3779b66c76bf1c3c266e1a51" );
|
||||
}
|
||||
else {
|
||||
$db = mysqli_fetch_array($result, MYSQLI_ASSOC);
|
||||
if ( empty($db["id"]) ) {
|
||||
problem( "a5d5eab30290ba4460ceb337add11821" );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
problem( "39122c23e90fcf5cb9ca9e03a5c5a3c5" );
|
||||
exit;
|
||||
}
|
||||
|
||||
$ep_retrieve = "SELECT
|
||||
UNIX_TIMESTAMP(eps.date) AS timestamp,
|
||||
eps.title,
|
||||
eps.duration,
|
||||
eps.summary,
|
||||
eps.tags,
|
||||
hosts.host,
|
||||
hosts.email,
|
||||
hosts.license as host_license,
|
||||
hosts.profile,
|
||||
eps.hostid,
|
||||
eps.series,
|
||||
eps.notes,
|
||||
miniseries.name as series_name,
|
||||
eps.license as show_license,
|
||||
eps.explicit
|
||||
FROM
|
||||
eps
|
||||
LEFT JOIN hosts ON eps.hostid = hosts.hostid
|
||||
LEFT JOIN miniseries ON miniseries.id = eps.series
|
||||
WHERE
|
||||
hosts.valid = '1'
|
||||
AND eps.id = '$id'";
|
||||
if ($result = mysqli_query($connection, $ep_retrieve)) {
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$date = $row['timestamp'];
|
||||
$title = $row['title'];
|
||||
$duration = $row['duration'];
|
||||
$summary = $row['summary'];
|
||||
$host = $row['host'];
|
||||
$hostid = $row['hostid'];
|
||||
$host_email = $row['email'];
|
||||
$host_license = $row['host_license'];
|
||||
$host_profile = $row['profile'];
|
||||
$series = $row['series'];
|
||||
$series_name = $row['series_name'];
|
||||
$show_license = $row['show_license'];
|
||||
$explicit = $row['explicit'];
|
||||
$tags = $row['tags'];
|
||||
$notes = $row['notes'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
http_response_code(404);
|
||||
die();
|
||||
}
|
||||
|
||||
if ($explicit == 0) {
|
||||
$explicit = "Clean";
|
||||
}
|
||||
else{
|
||||
$explicit = "Explicit";
|
||||
}
|
||||
|
||||
// --------------------------------------------
|
||||
// Display the results
|
||||
|
||||
$arr = array(
|
||||
'host' => array (
|
||||
'Host_ID' => "${hostid}",
|
||||
'Host_Name' => "${host}",
|
||||
'Host_Email' => "${host_email}",
|
||||
'Host_License' => "${host_license}",
|
||||
'Host_Profile' => "${host_profile}"
|
||||
),
|
||||
'episode' => array (
|
||||
'Title' => "${title}",
|
||||
'Summary' => "${summary}",
|
||||
'Explicit' => "${explicit}",
|
||||
'Show_License' => "${show_license}",
|
||||
'Series' => "${series}",
|
||||
'Series_Name' => "${series_name}",
|
||||
'Tags' => "${tags}",
|
||||
'Show_Notes' => "${notes}"
|
||||
),
|
||||
'metadata' => array (
|
||||
'Episode_Number' => "${id}",
|
||||
'Episode_Date' => date("Y-m-d", $date)
|
||||
)
|
||||
);
|
||||
|
||||
header('Content-Type: application/json');
|
||||
header("Content-disposition: inline; filename=hpr_stats.json");
|
||||
|
||||
echo json_encode($arr);
|
||||
|
||||
mysqli_close($connection);
|
@@ -10,7 +10,7 @@ if ( ! $pos === false) {
|
||||
|
||||
$body="give";
|
||||
//$body="index_full";
|
||||
include 'header.html';
|
||||
include 'header.php';
|
||||
|
||||
// --------------------------------------------
|
||||
// Clean up stale reservations
|
||||
@@ -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"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -249,8 +249,6 @@ $next_show_date = date('Y-m-d', strtotime($show_array[$next_show_num - 1 ]["date
|
||||
$days_to_wait = floor((strtotime($next_show_date) - strtotime(gmdate('Y-m-d')))/(60*60*24));
|
||||
|
||||
?>
|
||||
<main id="maincontent">
|
||||
|
||||
<h1>Upload Your Show</h1>
|
||||
|
||||
<p>
|
||||
@@ -258,10 +256,10 @@ The HPR Schedule is entirely community driven and we recommend that <strong>you<
|
||||
</p>
|
||||
|
||||
<p>
|
||||
There are only <strong><?php echo "${days_to_wait}"; ?></strong> days to wait until next free slot. Please consider <a aria-label="Help on Recording a podcast" href="<?php echo "${baseurl}about.html#recording_a_podcast"; ?>">recording</a> a show for us.
|
||||
There are only <strong><?php echo "${days_to_wait}"; ?></strong> days to wait until next free slot. Please consider <a aria-label="Help on Recording a podcast" href="<?php echo "${referrerurl}about.html#recording_a_podcast"; ?>">recording</a> a show for us.
|
||||
</p>
|
||||
<ol>
|
||||
<li>Review the updated <em><a aria-label="Learn the Stuff you need to know" href="<?php echo "${baseurl}about.html#agreement"; ?>">Stuff you need to know</a></em> page.</li>
|
||||
<li>Review the updated <em><a aria-label="Learn the Stuff you need to know" href="<?php echo "${referrerurl}about.html#agreement"; ?>">Stuff you need to know</a></em> page.</li>
|
||||
<li>Select a date, or post to the reserve queue.</li>
|
||||
<li>Click the link in the confirmation email</li>
|
||||
<li>Then <a aria-label="Help on Adding an episode" href="<?php echo "${baseurl}about.html#adding_an_episode"; ?>">fill in a form</a>.</li>
|
||||
@@ -275,22 +273,22 @@ There are only <strong><?php echo "${days_to_wait}"; ?></strong> days to wait un
|
||||
<li>When the queue is filling up then leave some slots free for new contributors.</li>
|
||||
<li>Post non urgent shows into the first empty week.</li>
|
||||
<li>If you are uploading a series of shows then post them one every two weeks.</li>
|
||||
<li>If you have a non urgent show that is timeless, then add it to the <a href="https://hackerpublicradio.org/about.html#reserve_queue">Reserve Queue</a>.</li>
|
||||
<li>If you have a non urgent show that is timeless, then add it to the <a href="<?php echo $referrerurl ?>about.html#reserve_queue">Reserve Queue</a>.</li>
|
||||
</ol>
|
||||
|
||||
<h2 id="reserve_queue">Add to the Reserve Queue ?</h2>
|
||||
|
||||
<p>
|
||||
<a aria-label="Post to the reserve queue" href="<?php echo "${hubBaseurl}"; ?>request.php?id=9999">Post your show to the <strong>reserve queue</strong></a> if you don't care when it will be released. <small><a aria-label="Help on the reserve queue" href="<?php echo "${baseurl}about.html#reserve_queue"; ?>">ⓘ</a></small>
|
||||
<a aria-label="Post to the reserve queue" href="<?php echo "${hubBaseurl}"; ?>request.php?id=9999">Post your show to the <strong>reserve queue</strong></a> if you don't care when it will be released. <small><a aria-label="Help on the reserve queue" href="<?php echo "${referrerurl}"; ?>about.html#reserve_queue";">ⓘ</a></small>
|
||||
</p>
|
||||
|
||||
<h2 id="current_schedule">Select a date in the current schedule ?</h2>
|
||||
|
||||
<p>
|
||||
<strong>Schedule</strong> the release</a> day your show will be aired. <small><a aria-label="Help on the scheduling guidelines" href="<?php echo "${baseurl}about.html#scheduling_guidelines"; ?>">ⓘ</a></small>
|
||||
<strong>Schedule</strong> the release</a> day your show will be aired. <small><a aria-label="Help on the scheduling guidelines" href="<?php echo "${referrerurl}"; ?>about.html#scheduling_guidelines">ⓘ</a></small>
|
||||
</p>
|
||||
|
||||
<h3>Next Two Months <small><a aria-label="Help on the HPR processing workflow" href="<?php echo "${baseurl}about.html#workflow"; ?>">ⓘ</a></small></h3>
|
||||
<h3>Next Two Months <small><a aria-label="Help on the HPR processing workflow" href="<?php echo "${referrerurl}"; ?>about.html#workflow">ⓘ</a></small></h3>
|
||||
|
||||
|
||||
|
||||
@@ -312,7 +310,7 @@ for ( $slot = $current_episode_number; $slot < ( $current_episode_number + 60 );
|
||||
$sizeof_show_array--;
|
||||
}
|
||||
elseif ( empty( $show_array[$slot] ) ) {
|
||||
echo "<span style=\"font-family:monospace;\">${this_episode_date}: <a aria-label=\"Upload to the slot hpr${slot}\" href=\"${hubBaseurl}/request.php?id=${slot}\">hpr${slot}</span> is available - upload now</a>.<br />\n";
|
||||
echo "<span style=\"font-family:monospace;\">${this_episode_date}: <a aria-label=\"Upload to the slot hpr${slot}\" href=\"${hubBaseurl}request.php?id=${slot}\">hpr${slot}</span> is available - upload now</a>.<br />\n";
|
||||
}
|
||||
elseif ( $show_array[$slot]["valid"] == 0 ) {
|
||||
echo "<span style=\"font-family:monospace;\">${this_episode_date}: hpr${slot}</span> <strong>Unavailable</strong>.<br />\n";
|
||||
@@ -360,9 +358,6 @@ If you wish to pick an available slot in the next 12 months then go directly to
|
||||
<h3 id="workflow">Workflow</h3>
|
||||
<p>
|
||||
The HPR statistics are regenerated every 15 minutes and are available in <a aria-label="Go to the stats json page" href="<?php echo "${hubBaseurl}"; ?>stats.json">json format</a>. Note the format is liable to change without notice.</p>
|
||||
|
||||
</main>
|
||||
|
||||
<?php
|
||||
include 'footer.html';
|
||||
include 'footer.php';
|
||||
?>
|
||||
|
@@ -338,12 +338,9 @@ if (!$mailer->send()) {
|
||||
|
||||
$body="give";
|
||||
//$body="index_full";
|
||||
include 'header.html';
|
||||
include 'header.php';
|
||||
|
||||
?>
|
||||
|
||||
<main id="maincontent">
|
||||
<hr />
|
||||
<article>
|
||||
<header>
|
||||
<h1>Thank you</h1>
|
||||
@@ -360,11 +357,9 @@ include 'header.html';
|
||||
<?php echo date('Y-m-d\TH:i:s') . "\n" . getUserIP() . "\n" . $_SERVER["HTTP_USER_AGENT"]; ?>
|
||||
</pre>
|
||||
</article>
|
||||
</main>
|
||||
|
||||
<?php
|
||||
|
||||
include 'footer.html';
|
||||
include 'footer.php';
|
||||
|
||||
logextra( "Finished comment_confirm.php");
|
||||
|
||||
|
@@ -1,88 +0,0 @@
|
||||
<footer id="footer_page">
|
||||
<h1 class="thick_bar"><span style="padding-left: 1em;">More Information...</span></h1>
|
||||
<div id="more_info">
|
||||
<nav class="column">
|
||||
<h2>Ancestry</h2>
|
||||
<ul>
|
||||
<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://lists.hackerpublicradio.com/mailman/listinfo/hpr" >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://t.me/+6fEhQrf5IEc4ZGU8">Telegram</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 class="column">
|
||||
<h2>Unaffiliates</h2>
|
||||
<ul>
|
||||
<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://openclipart.org/">openclipart.org</a></li>
|
||||
<li><a href="https://openfontlibrary.org/">openfontlibrary.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">
|
||||
<h2>Patrons</h2>
|
||||
<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 <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>
|
||||
<hr />
|
||||
</div><!-- copyright -->
|
||||
<hr />
|
||||
</footer>
|
||||
</div>
|
||||
<!-- shadow -->
|
||||
<?php
|
||||
if ( $connection ) {
|
||||
mysqli_close($connection);
|
||||
}
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
15
hub/footer.php
Normal file
15
hub/footer.php
Normal file
@@ -0,0 +1,15 @@
|
||||
</main>
|
||||
<footer role="contentinfo">
|
||||
<hr class="no-css">
|
||||
<div id="copyright">
|
||||
<span>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.</span>
|
||||
<span>
|
||||
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>.
|
||||
</span>
|
||||
</div>
|
||||
<div id="generated_by">This page was <a href="https://repo.anhonesthost.net/HPR/hpr_hub">generated</a> by <a href="mailto:<?php echo $generator_email ?>"><?php echo $generator_name ?></a> at <time dateTime="<?php echo date(DATE_ISO8601, strtotime(date("Y-m-d h:i:s a"))) ?>"><?php echo date("r") ?></time></em>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
@@ -1,69 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Hacker Public Radio ~ The Technology Community Podcast</title>
|
||||
<base href="https://hub.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 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">
|
||||
article, aside, dialog, figure, footer, header, hgroup, menu, nav, section {
|
||||
display: block;
|
||||
}
|
||||
#list1, #list2, #list3 {
|
||||
display:none;
|
||||
}
|
||||
</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.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="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"/>
|
||||
</head>
|
||||
|
||||
<body id="give">
|
||||
<div id="container" class="shadow">
|
||||
<header>
|
||||
<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/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>
|
||||
</header>
|
||||
|
||||
<main id="maincontent">
|
||||
|
49
hub/header.php
Normal file
49
hub/header.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Hacker Public Radio ~ The Technology Community Podcast</title>
|
||||
<base href="<?php echo $hubBaseurl ?>">
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-Clacks-Overhead" content="GNU Terry Pratchett" />
|
||||
<meta http-equiv="last-modified" content="Thu, 2 Oct 2025 20:45 +0000">
|
||||
<meta name="keywords" content="Technology, Tech News, Education, Training" />
|
||||
<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." />
|
||||
<link rel="shortcut icon" href="<?php echo $baseurl ?>hpr.ico" >
|
||||
<link rel="alternate" type="application/rss+xml" title="Hacker Public Radio Opus RSS" href="<?php echo $baseurl ?>hpr_opus_rss.php" />
|
||||
<link rel="alternate" type="application/rss+xml" title="Hacker Public Radio Ogg Vorbis RSS" href="<?php echo $baseurl ?>hpr_ogg_rss.php" />
|
||||
<link rel="alternate" type="application/rss+xml" title="Hacker Public Radio MP3 RSS" href="<?php echo $baseurl ?>hpr_mp3_rss.php" />
|
||||
<link rel="alternate" type="application/rss+xml" title="Hacker Public Radio Comments RSS" href="<?php echo $baseurl ?>comments.rss" />
|
||||
<link rel="license" title="CC BY-SA 4.0" href="https://creativecommons.org/licenses/by-sa/4.0/" />
|
||||
<link href="<?php echo $baseurl ?>css/hpr.css" rel="stylesheet" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="top_navigation" class="sr-only">
|
||||
<nav id="accessible_menu">
|
||||
<menu>
|
||||
<li><a href="#main_content">Skip to Main Content</a></li>
|
||||
<li><a href="<?php echo $referrerurl ?>sitemap.html#main_content">Site Map</a></li>
|
||||
</menu>
|
||||
</nav>
|
||||
<hr class="no-css">
|
||||
</div>
|
||||
<header role="banner">
|
||||
<div class="bounding-box">
|
||||
<hgroup id="title">
|
||||
<h1 id="site_acronym"><a href="<?php echo $referrerurl ?>index.html">HPR</a></h1>
|
||||
<p id="site_name">
|
||||
<a href="<?php echo $referrerurl ?>correspondents/index.html">H</a>acker
|
||||
<a href="<?php echo $referrerurl ?>comments_viewer.html">P</a>ublic
|
||||
<a href="<?php echo $referrerurl ?>syndication.html">R</a>adio
|
||||
</p>
|
||||
</hgroup>
|
||||
<hgroup id="tag_line">
|
||||
<h2 id="tag1">The Community Podcast</h2>
|
||||
<p id="tag2">Sharing your ideas, projects, opinions since 2005</p>
|
||||
<p id="tag3">New episodes every weekday </p>
|
||||
</hgroup>
|
||||
</div>
|
||||
</header>
|
||||
<main id="maincontent" role="main">
|
||||
|
@@ -1,3 +1,5 @@
|
||||
<?php
|
||||
header('location:https://hub.hackerpublicradio.org/calendar.php');
|
||||
header("location:${hubBaseurl}calendar.php");
|
||||
?>
|
||||
<meta name="referrer" content="<?php ${referrerurl} ?>">
|
||||
|
||||
|
@@ -3,5 +3,5 @@
|
||||
#require "/home/hpr/php/include.php";
|
||||
?>
|
||||
<?php
|
||||
header('location:https://hub.hackerpublicradio.org/calendar.php');
|
||||
header("location:${hubBaseurl}calendar.php");
|
||||
?>
|
||||
|
@@ -26,6 +26,7 @@ if( !isset($row_dupe) or $num_from_this_ip != 0 ) {
|
||||
header('Cache-Control: no-cache');
|
||||
header('Pragma: no-cache');
|
||||
header("Status: 412 Precondition Failed");
|
||||
include("header.php");
|
||||
echo "<h1>Existing request detected: ";
|
||||
$timestamp = time()+date("Z");
|
||||
echo gmdate("Y-m-d\TH:i:s\Z",$timestamp);
|
||||
@@ -63,6 +64,7 @@ if( !isset($row_dupe) or $num_from_this_ip != 0 ) {
|
||||
echo "</pre>\n";
|
||||
echo "<hr />\n";
|
||||
file_put_contents($naughtyfile, date('Y-m-d\TH:i:s\Z') . "\t" . getUserIPAdress() . "\tExisting Request\t" . $_SERVER['REQUEST_URI'] . "\t" . $_SERVER["HTTP_USER_AGENT"] . "\n" , FILE_APPEND | LOCK_EX );
|
||||
include("footer.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -150,14 +152,12 @@ $next_show_num = $next_show_num_array[0] + 1;
|
||||
$next_show_date = date('Y-m-d', strtotime($next_show_num_array[1] . ' + 1 weekday'));
|
||||
$body="give";
|
||||
//$body="index_full";
|
||||
include 'header.html';
|
||||
include 'header.php';
|
||||
|
||||
?>
|
||||
|
||||
<main id="maincontent">
|
||||
<h1>Requesting a slot for your show.</h1>
|
||||
<p>Please select your desired slot, and enter a valid email address.<br />
|
||||
See our <a aria-label="Help on adding an episode" href="<?php echo "${baseurl}about.html#adding_an_episode"; ?>">help page</a> for more information</a>
|
||||
See our <a aria-label="Help on adding an episode" href="<?php echo "${referrerurl}about.html#adding_an_episode"; ?>">help page</a> for more information</a>
|
||||
</p>
|
||||
<form method="POST" action="request_confirm.php">
|
||||
<table>
|
||||
@@ -196,14 +196,12 @@ include 'header.html';
|
||||
<td><input required type="email" name="email" placeholder="To send you the upload link"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p><em>You must have your audio recording ready to upload <a aria-label="Help on the reserving a slot" href="<?php echo "${baseurl}about.html#reserving"; ?>"><strong>before</strong> you pick a slot</a>.</em></p>
|
||||
<p><em>You must have your audio recording ready to upload <a aria-label="Help on the reserving a slot" href="<?php echo "${referrerurl}about.html#reserving"; ?>"><strong>before</strong> you pick a slot</a>.</em></p>
|
||||
<input type="submit" value="Next">
|
||||
</form>
|
||||
<p>
|
||||
We will send you an email with a link to where you can upload your show.
|
||||
</p>
|
||||
</main>
|
||||
|
||||
<?php
|
||||
include 'footer.html';
|
||||
include 'footer.php';
|
||||
?>
|
||||
|
@@ -294,12 +294,9 @@ if (!$mailer->send()) {
|
||||
|
||||
$body="give";
|
||||
//$body="index_full";
|
||||
include 'header.html';
|
||||
include 'header.php';
|
||||
|
||||
?>
|
||||
|
||||
<main id="maincontent">
|
||||
<hr />
|
||||
<article>
|
||||
<header>
|
||||
<h1>Thank you</h1>
|
||||
@@ -324,8 +321,6 @@ include 'header.html';
|
||||
<?php print date('Y-m-d\TH:i:s') . "\t" . getUserIP() . "\t" . $db_key . "\t" . $_SERVER["HTTP_USER_AGENT"]; ?>
|
||||
</pre>
|
||||
</article>
|
||||
</main>
|
||||
|
||||
<?php
|
||||
include 'footer.html';
|
||||
include 'footer.php';
|
||||
?>
|
||||
|
@@ -51,7 +51,7 @@ if ( isset( $_GET['delete'] ) ) {
|
||||
call412("35a7f4e80ecba8284049e9d6261ae523");
|
||||
}
|
||||
else {
|
||||
header( "Location: https://" . $_SERVER['SERVER_NAME'] . "/calendar.php" ) ;
|
||||
header( "Location: ${hubBaseurl}calendar.php" ) ;
|
||||
$dir_structure = "/home/hpr/upload/" . strtotime($db_timestamp) . "_${ep_num}_${ep_date}_${db_key}/";
|
||||
rrmdir("$dir_structure");
|
||||
exit;
|
||||
@@ -106,15 +106,13 @@ if ( !file_exists( $image_url )) {
|
||||
|
||||
// $body="give";
|
||||
//$body="index_full";
|
||||
include 'header.html';
|
||||
include 'header.php';
|
||||
|
||||
?>
|
||||
|
||||
<body>
|
||||
<link href="quill.snow.css" rel="stylesheet">
|
||||
<script src="quill.js"></script>
|
||||
<main id="maincontent">
|
||||
<hr />
|
||||
<?php
|
||||
if ( $ep_num == 9999 ) {
|
||||
echo "<h2>Uploading to the Reserve Queue.</h2>\n";
|
||||
@@ -128,13 +126,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>Host Email (<a href="<?php echo "${referrerurl}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 "${referrerurl}about.html#image"; ?>" target="_blank">?</a>)</td>
|
||||
<td>
|
||||
<?php
|
||||
echo "<img src=\"$image_url\" alt=\"host image\" /><br /><small><em>";
|
||||
@@ -168,7 +166,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,17 +176,17 @@ 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><strong>Title(*) (<a href="<?php echo "${referrerurl}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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Summary(*) (<a href="<?php echo "${baseurl}about.html#Short_Summary"; ?>" target="_blank">?</a>):</strong></td>
|
||||
<td><strong>Summary(*) (<a href="<?php echo "${referrerurl}about.html#Short_Summary"; ?>" target="_blank">?</a>):</strong></td>
|
||||
<td><input required type="text" name="summary" size="70" maxlength="100" placeholder="This is a short 100 character summary of what your show is about."></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Explicit: (<a href="<?php echo "${baseurl}about.html#Explicit"; ?>" target="_blank">?</a>)</strong></td>
|
||||
<td><strong>Explicit: (<a href="<?php echo "${referrerurl}about.html#Explicit"; ?>" target="_blank">?</a>)</strong></td>
|
||||
<td>
|
||||
Is the show <em>Explicit</em> ?:
|
||||
<input required type="radio" name="explicit" value="Yes">Yes
|
||||
@@ -197,7 +195,7 @@ include 'header.html';
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>License: (<a href="<?php echo "${baseurl}about.html#License"; ?>" target="_blank">?</a>)</strong></td>
|
||||
<td><strong>License: (<a href="<?php echo "${referrerurl}about.html#License"; ?>" target="_blank">?</a>)</strong></td>
|
||||
<td>
|
||||
<select name="license">
|
||||
<option value="CC-BY-SA" selected>CC-BY-SA</option>
|
||||
@@ -212,7 +210,7 @@ include 'header.html';
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Notes(*) (<a href="<?php echo "${baseurl}about.html#show_notes"; ?>" target="_blank">?</a>):</strong></td>
|
||||
<td><strong>Notes(*) (<a href="<?php echo "${referrerurl}about.html#show_notes"; ?>" target="_blank">?</a>):</strong></td>
|
||||
<td>
|
||||
<noscript>
|
||||
<textarea required name="notes" maxlength="40000" rows="20" cols="70" placeholder="Please add your show notes here." ></textarea>
|
||||
@@ -222,7 +220,7 @@ include 'header.html';
|
||||
</tr>
|
||||
<noscript>
|
||||
<tr>
|
||||
<td>Format: (<a href="<?php echo "${baseurl}about.html#shownotes_format"; ?>" target="_blank">?</a>)</td>
|
||||
<td>Format: (<a href="<?php echo "${referrerurl}about.html#shownotes_format"; ?>" target="_blank">?</a>)</td>
|
||||
<td>
|
||||
<small>What format if any did you just use in the show notes above ?</small><br />
|
||||
<select name="shownotes_format">
|
||||
@@ -237,7 +235,7 @@ include 'header.html';
|
||||
</tr>
|
||||
</noscript>
|
||||
<tr>
|
||||
<td>Series: (<a href="<?php echo "${baseurl}about.html#series"; ?>" target="_blank">?</a>)</td>
|
||||
<td>Series: (<a href="<?php echo "${referrerurl}about.html#series"; ?>" target="_blank">?</a>)</td>
|
||||
<td>
|
||||
<?php
|
||||
$result = mysqli_query($connection, "SELECT id, name FROM miniseries WHERE private=0 ORDER BY name ASC");
|
||||
@@ -251,22 +249,22 @@ include 'header.html';
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Tags: (<a href="<?php echo "${baseurl}about.html#tags"; ?>" target="_blank">?</a>)</td>
|
||||
<td>Tags: (<a href="<?php echo "${referrerurl}about.html#tags"; ?>" target="_blank">?</a>)</td>
|
||||
<td><input required type="text" name="tags" size="70" maxlength="100" placeholder="Add a list of comma separated tags." /><br />
|
||||
Add a list of <strong>comma separated</strong> tags.<br />
|
||||
If you can provide tags for your show that would be appreciated; you are certainly the best judge of what makes good tags, but if not then a volunteer will add them later.
|
||||
</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 "${referrerurl}about.html#upload_method"; ?>" target="_blank">?</a>)</strong></td>
|
||||
<td>
|
||||
<em>You have the choice of the following upload options:</em> <br />
|
||||
<p>
|
||||
<strong>1. Upload now</strong> via this browser: (<a href="<?php echo "${baseurl}about.html#browser"; ?>" target="_blank">?</a>)<br />
|
||||
<strong>1. Upload now</strong> via this browser: (<a href="<?php echo "${referrerurl}about.html#browser"; ?>" target="_blank">?</a>)<br />
|
||||
<input type="file" multiple="multiple" name="media_files[]" title="select if using the http upload option" />
|
||||
</p>
|
||||
<p>
|
||||
<strong>2. Provide a url</strong> we we can directly download it from: (<a href="<?php echo "${baseurl}about.html#url"; ?>" target="_blank">?</a>)<br />
|
||||
<strong>2. Provide a url</strong> we we can directly download it from: (<a href="<?php echo "${referrerurl}about.html#url"; ?>" target="_blank">?</a>)<br />
|
||||
This must be accessable using a curl or wget command.<br />
|
||||
Please avoid services that require login or downloading via a browser.<br />
|
||||
<input type="url" size="30" name="url" placeholder="https://example.com/hpr9999.flac">
|
||||
@@ -334,7 +332,6 @@ include 'header.html';
|
||||
});
|
||||
</script>
|
||||
</form>
|
||||
</main>
|
||||
<?php
|
||||
include 'footer.html';
|
||||
include 'footer.php';
|
||||
?>
|
||||
|
@@ -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<";
|
||||
@@ -401,12 +401,9 @@ if (!isset($result)) {
|
||||
|
||||
$body="give";
|
||||
//$body="index_full";
|
||||
include 'header.html';
|
||||
include 'header.php';
|
||||
|
||||
?>
|
||||
|
||||
<main id="maincontent">
|
||||
<hr />
|
||||
<article>
|
||||
<header>
|
||||
<h1>Thank you</h1>
|
||||
@@ -426,8 +423,6 @@ include 'header.html';
|
||||
HPR Bot
|
||||
</p>
|
||||
</article>
|
||||
</main>
|
||||
|
||||
<?php
|
||||
logextra( "Sending email" );
|
||||
|
||||
@@ -505,7 +500,7 @@ if (!$mailer->send()) {
|
||||
}
|
||||
|
||||
|
||||
include 'footer.html';
|
||||
include 'footer.php';
|
||||
|
||||
logextra( "Finished upload_confirm.php");
|
||||
|
||||
|
@@ -11,13 +11,25 @@ $mailerHost = "smtp.example.com";
|
||||
$mailerUsername = 'robot@example.com';
|
||||
$mailerPassword = 'THE_SMTP_MAIL_PASSWORD_HERE';
|
||||
|
||||
$generator_name = 'The HPR Robot';
|
||||
$generator_email = 'robot.nospam@nospam.hackerpublicradio.org';
|
||||
|
||||
$hubBaseurl = "https://hub.hackerpublicradio.org/";
|
||||
$baseurl = "https://hackerpublicradio.org/";
|
||||
|
||||
$comment_directory = "/path/to/comments";
|
||||
$naughtyfile = '/path/to/naughty.txt';
|
||||
$naughty_stings_file = '/path/to/strings.txt';
|
||||
$justification_file = '/path/to/justification.txt';
|
||||
# Read more: http://vidiame.com/php/how-to-block-multiple-ip-addresses-using-php
|
||||
|
||||
# The $referrerurl is used for links to pages from the orginating HPR site.
|
||||
$referrerurl = $baseurl;
|
||||
session_start();
|
||||
if ($_SESSION['referrerurl']) {
|
||||
$referrerurl = $_SESSION['referrerurl'];
|
||||
}
|
||||
else if ($_SERVER["HTTP_REFERER"] && !str_starts_with($_SERVER["HTTP_REFERER"], $hubBaseurl)) {
|
||||
$_SESSION['referrerurl'] = $_SERVER["HTTP_REFERER"];
|
||||
$referrerurl = $_SERVER["HTTP_REFERER"];
|
||||
}
|
||||
?>
|
||||
|
@@ -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", "text/plain", "text/plain", "text/vtt", "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", "spx", "mp3", "jpg", "png", "json", "srt", "tsv", "txt", "vtt");
|
||||
$allowed_extensions = array("m4a", "wav", "flac", "opus", "ogg", "mp3", "jpg", "jpeg", "png", "webp", "srt", "txt", "spx" );
|
||||
|
||||
$allowed_extensions_common = array("opus", "ogg", "spx", "mp3", "jpg", "png", "json", "srt", "tsv", "txt", "vtt");
|
||||
$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" );
|
||||
|
12
www/rss.php
12
www/rss.php
@@ -51,13 +51,13 @@ switch ($atomurl) {
|
||||
$mimetype = "audio/ogg";
|
||||
$feed = "total";
|
||||
break;
|
||||
case "/hpr_spx_rss.php":
|
||||
$format = "spx";
|
||||
case "/hpr_opus_rss.php":
|
||||
$format = "opus";
|
||||
$mimetype = "audio/ogg";
|
||||
$feed = "tenday";
|
||||
break;
|
||||
case "/hpr_total_spx_rss.php":
|
||||
$format = "spx";
|
||||
case "/hpr_total_opus_rss.php":
|
||||
$format = "opus";
|
||||
$mimetype = "audio/ogg";
|
||||
$feed = "total";
|
||||
break;
|
||||
@@ -86,8 +86,8 @@ if (isset($_GET['format'])) {
|
||||
$format = "ogg";
|
||||
$mimetype = "audio/ogg";
|
||||
}
|
||||
if ( $this_format === "spx" ) {
|
||||
$format = "spx";
|
||||
if ( $this_format === "opus" ) {
|
||||
$format = "opus";
|
||||
$mimetype = "audio/ogg";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user