<commit_before><?php
date_default_timezone_set('US/Eastern');

require($_SERVER['DOCUMENT_ROOT'].'/config/settings.php');
require('Akismet.class.php');
require('SMTP.class.php');

if(isset($_POST)) {
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  $ip = $_SERVER['REMOTE_ADDR'];

  $akismet = new Akismet($GLOBALS['DOMAIN'], $GLOBALS['AKISMET_API_KEY']);
  $akismet->setCommentAuthor($name);
  $akismet->setCommentAuthorEmail($email);
  $akismet->setCommentContent($message);
  $akismet->setUserIP($ip);

  if (send_mail( $name, $email, $ip, $akismet->isCommentSpam(), $message)) {
    $status = array('code' => '1');
  }
  else {
    $status = array('code' => '0');
  }
  echo json_encode($status);
}

function send_mail( $name, $email, $ip, $is_spam, $message) {
  $subject = '';
  if( $is_spam == false ) {
    $subject = $GLOBALS['CONTACT_SUBJECT'];

    $smtp = new SMTP($GLOBALS['SMTP_SERVER'], $GLOBALS['SMTP_PORT']);
    $smtp->mail_from($email);
    return $smtp->send($GLOBALS['CONTACT_RECIPIENT'], $subject, "Name: ".$name."\n\n".stripslashes($message));
  }
  else return true;
}
?>
<commit_msg>make sure name and email are entered<commit_after><?php
date_default_timezone_set('US/Eastern');

require($_SERVER['DOCUMENT_ROOT'].'/config/settings.php');
require('Akismet.class.php');
require('SMTP.class.php');

if(isset($_POST)) {
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  $ip = $_SERVER['REMOTE_ADDR'];

  $akismet = new Akismet($GLOBALS['DOMAIN'], $GLOBALS['AKISMET_API_KEY']);
  $akismet->setCommentAuthor($name);
  $akismet->setCommentAuthorEmail($email);
  $akismet->setCommentContent($message);
  $akismet->setUserIP($ip);

  if (send_mail( $name, $email, $ip, $akismet->isCommentSpam(), $message)) {
    $status = array('code' => '1');
  }
  else {
    $status = array('code' => '0');
  }
  echo json_encode($status);
}

function send_mail( $name, $email, $ip, $is_spam, $message) {
  $subject = '';
  if( $is_spam == false && empty($name) == false && empty($email) == false ) {
    $subject = $GLOBALS['CONTACT_SUBJECT'];

    $smtp = new SMTP($GLOBALS['SMTP_SERVER'], $GLOBALS['SMTP_PORT']);
    $smtp->mail_from($email);
    return $smtp->send($GLOBALS['CONTACT_RECIPIENT'], $subject, "Name: ".$name."\n\n".stripslashes($message));
  }
  else return true;
}
?>

{'fraction_non_alphanumeric': 0.22212837837837837, 'fraction_numerical': 0.0016891891891891893, 'mean_word_length': 5.420054200542006, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '2449354', 'n_tokens_mistral': 909, 'n_tokens_neox': 886, 'n_words': 138}