<commit_before><?php
require('defines.php');
require('lib.php');

if( isset ($_POST["organ"]) && isset ($_POST["date"])){
  print("isset test");
  if (filter_var($_POST['date'], FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>DATEREGEX)))) {
    $date = explode("/",$_POST['date']);
    if (in_array($_POST['organ'],getOrgans())){ //sanitize _POST

      $filename = $date[0] . "-" . $date[1] . "-" . $date[2] . ".md";
      $filenamePub = REPORTDIR . SUBPUBLISHED . $_POST['organ'] . "/" . $date[0] . "-" . $date[1] . "-" . $date[2] . ".md";

      if(is_file(REPORTDIR . SUBUNPUBLISHED . $_POST['organ'] . "/" . $filename)){ // locate to edit.php
	header('Location: edit.php?file='.$filename . "&organ=" . $_POST['organ']);
      }
      if(is_file(REPORTDIR . SUBPUBLISHED . $_POST['organ'] . "/". $filename)){
	die("Already published");
      }
      print($filename);
    }

  }
}



?>
<commit_msg>Allow creation<commit_after><?php
require('defines.php');
require('lib.php');

if( isset ($_POST["organ"]) && isset ($_POST["date"])){
  print("isset test");
  if (filter_var($_POST['date'], FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>DATEREGEX)))) {
    $date = explode("/",$_POST['date']);
    if (! in_array($_POST['organ'],getOrgans())){ //sanitize _POST
      die("Invalid Organ!");
    }
    $filename = $date[0] . "-" . $date[1] . "-" . $date[2] . ".md";
    $filenamePub = REPORTDIR . SUBPUBLISHED . $_POST['organ'] . "/" . $date[0] . "-" . $date[1] . "-" . $date[2] . ".md";

    if(is_file(REPORTDIR . SUBUNPUBLISHED . $_POST['organ'] . "/" . $filename)){ // locate to edit.php
      header('Location: edit.php?file='.$filename . "&organ=" . $_POST['organ']);
      exit();
    }
    if(is_file(REPORTDIR . SUBPUBLISHED . $_POST['organ'] . "/". $filename)){
      die("Already published");
    }

    //  Copy Template file and open editor
    copy(REPORTDIR . $_POST['organ'] . ".template.md", REPORTDIR . SUBUNPUBLISHED . $_POST['organ'] . "/" . $filename);
    header('Location: edit.php?file='.$filename . "&organ=" . $_POST['organ']);
    exit();
  }
}



?>

{'fraction_non_alphanumeric': 0.2530981887511916, 'fraction_numerical': 0.005719733079122974, 'mean_word_length': 3.4096638655462184, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3126200', 'n_tokens_mistral': 770, 'n_tokens_neox': 749, 'n_words': 121}