forked from HPR/hpr_hub
		
	Support for WYSIWYG upload server side
This commit is contained in:
		@@ -1,6 +1,12 @@
 | 
			
		||||
<?php
 | 
			
		||||
# request.php > request_confirm.php > upload.php > upload_confirm.php 
 | 
			
		||||
 | 
			
		||||
## Recent Changes
 | 
			
		||||
# TODO disabled the max notes check. We need to re-enable after we get a feel for the max length
 | 
			
		||||
# Removed support for the txt file
 | 
			
		||||
# Removde the POST duplication from the json file
 | 
			
		||||
# No longer logs the post to log file
 | 
			
		||||
 | 
			
		||||
require "/home/hpr/php/include.php";
 | 
			
		||||
 | 
			
		||||
function goback() {
 | 
			
		||||
@@ -148,10 +154,14 @@ if ( !(
 | 
			
		||||
}
 | 
			
		||||
logextra( "license is a valid value" );
 | 
			
		||||
 | 
			
		||||
if ( empty($_POST["notes"]) or strlen($_POST["notes"]) > 40000 ) {
 | 
			
		||||
  naughty("5860799406a323209b902d5104fe7bae");
 | 
			
		||||
}
 | 
			
		||||
logextra( "Notes are less than max" );
 | 
			
		||||
// TODO re-enable after we get a feel for the max length
 | 
			
		||||
// if ( empty($_POST["notes"]) or strlen($_POST["notes"]) > 100000 ) {
 | 
			
		||||
//   naughty("5860799406a323209b902d5104fe7bae");
 | 
			
		||||
// }
 | 
			
		||||
// logextra( "Notes are less than max" );
 | 
			
		||||
 | 
			
		||||
$notes_length = strlen($_POST["notes"])
 | 
			
		||||
logextra( "Notes are $notes_length long." );
 | 
			
		||||
 | 
			
		||||
if ( ( empty($_POST["series"]) and ($_POST["series"] != 0 ) ) or (strlen($_POST["series"]) > 3 ) ) {
 | 
			
		||||
  naughty("f1c83b57821d562f66246d975ef28994");
 | 
			
		||||
@@ -247,12 +257,6 @@ if (!mkdir($dir_structure, 0777, true)) {
 | 
			
		||||
  naughty("804c4be123ca0327840b76bf4f8eb19e");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$shownote_file = "${dir_structure}/shownotes.txt";
 | 
			
		||||
if ( file_exists( $shownote_file ) ) {
 | 
			
		||||
  naughty("33370d1c5c19a6ca4ef3f3ce59158e57");
 | 
			
		||||
}
 | 
			
		||||
logextra( "The shownotes txt file exists $shownote_file" );
 | 
			
		||||
 | 
			
		||||
$shownote_file_json = "${dir_structure}/shownotes.json";
 | 
			
		||||
if ( file_exists( $shownote_file_json ) ) {
 | 
			
		||||
  naughty("85c8df74d172794c49233c1a94c299fd");
 | 
			
		||||
@@ -264,40 +268,6 @@ $this_file = print_r($_FILES, true);
 | 
			
		||||
 | 
			
		||||
logextra( "Received $this_post, $this_file" );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
$show_data = "------------------------------------------------------------";
 | 
			
		||||
$show_data = $show_data . "\nEpisode_Number:\t" . $ep_num;
 | 
			
		||||
$show_data = $show_data . "\nEpisode_Date:\t" . $ep_date;
 | 
			
		||||
$show_data = $show_data . "\nTimestamp:\t" . $db_timestamp;
 | 
			
		||||
$show_data = $show_data . "\nKey:\t" . $_POST['key'];
 | 
			
		||||
$show_data = $show_data . "\nHost_IP:\t" . $db_ip;
 | 
			
		||||
$show_data = $show_data . "\n------------------------------------------------------------";
 | 
			
		||||
$show_data = $show_data . "\nHost_ID:\t" . $_POST['hostid'];
 | 
			
		||||
$show_data = $show_data . "\nHost_Name:\t" . $_POST['host_name'];
 | 
			
		||||
$show_data = $show_data . "\nHost_Email:\t" . $db_email;
 | 
			
		||||
$show_data = $show_data . "\nHost_License:\t" . $_POST['host_license'];
 | 
			
		||||
$show_data = $show_data . "\nHost_Profile:\n" . $_POST['host_profile'];
 | 
			
		||||
$show_data = $show_data . "\n------------------------------------------------------------";
 | 
			
		||||
$show_data = $show_data . "\nTitle:\t" . $_POST['title'];
 | 
			
		||||
$show_data = $show_data . "\nSummary:\t" . $_POST['summary'];
 | 
			
		||||
$show_data = $show_data . "\nShownotes_Format:\t" . $_POST['shownotes_format'];
 | 
			
		||||
$show_data = $show_data . "\nExplicit:\t" . $_POST['explicit'];
 | 
			
		||||
$show_data = $show_data . "\nShow_License:\t" . $_POST['license'];
 | 
			
		||||
$show_data = $show_data . "\nSeries:\t" . $series;
 | 
			
		||||
$show_data = $show_data . "\nSeries_Name:\t" . $series_name;
 | 
			
		||||
$show_data = $show_data . "\nTags:\t" . $_POST['tags'];
 | 
			
		||||
$show_data = $show_data . "\nurl:\t" . $_POST['url'];
 | 
			
		||||
$show_data = $show_data . "\n------------------------------------------------------------";
 | 
			
		||||
$show_data = $show_data . "\nShow_Notes:\n" . $_POST['notes'];
 | 
			
		||||
$show_data = $show_data . "\n------------------------------------------------------------";
 | 
			
		||||
$show_data = $show_data . "\nPOST:\n" . $this_post;
 | 
			
		||||
$show_data = $show_data . "\n------------------------------------------------------------";
 | 
			
		||||
$show_data = $show_data . "\nFILES:\n" . $this_file;
 | 
			
		||||
$show_data = $show_data . "\n------------------------------------------------------------\n";
 | 
			
		||||
 | 
			
		||||
file_put_contents($shownote_file, stripslashes($show_data) );
 | 
			
		||||
logextra( "Wrote the $shownote_file" );
 | 
			
		||||
 | 
			
		||||
$show_data_json = array(
 | 
			
		||||
  "host" => array(
 | 
			
		||||
    "Host_ID" => $_POST['hostid'],
 | 
			
		||||
@@ -322,26 +292,22 @@ $show_data_json = array(
 | 
			
		||||
    "Timestamp" => $db_timestamp,
 | 
			
		||||
    "Key" => $_POST['key'],
 | 
			
		||||
    "Host_IP" => $db_ip,
 | 
			
		||||
    "POST" => $_POST,
 | 
			
		||||
    "FILES" => $_FILES,
 | 
			
		||||
    "url" => $_POST['url'],
 | 
			
		||||
    "Shownotes_Format" => $_POST['shownotes_format'],
 | 
			
		||||
  )
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
file_put_contents($shownote_file_json, json_encode($show_data_json) );
 | 
			
		||||
logextra( "Wrote the $shownote_file_json" );
 | 
			
		||||
file_put_contents($shownote_file_json, json_encode( $show_data_json ) );
 | 
			
		||||
$shownote_file_json_length = strlen( json_encode( $show_data_json ) );
 | 
			
		||||
 | 
			
		||||
logextra( "Wrote the shownotes which are $shownote_file_json_length long" );
 | 
			
		||||
 | 
			
		||||
if ( !file_exists( $dir_structure ) ) {
 | 
			
		||||
  naughty("a1534e6d525352dce7183a2e22862049");
 | 
			
		||||
}
 | 
			
		||||
logextra( "The dir_structure still exists" );
 | 
			
		||||
 | 
			
		||||
if ( !file_exists( "$dir_structure/shownotes.txt" ) ) {
 | 
			
		||||
  naughty("ab8051b531c120b8bffd2a5b25a19cc3");
 | 
			
		||||
}
 | 
			
		||||
logextra( "shownotes.txt still exists" );
 | 
			
		||||
 | 
			
		||||
if ( !file_exists( "$dir_structure/shownotes.json" ) ) {
 | 
			
		||||
  naughty("3eb02d6b9ea801d4c5909b4fac0ccd96");
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user