function system_popup_report_contact_form_submit

6.x system.module system_popup_report_contact_form_submit($form, $form_state)
4.x system.module system_popup_report_contact_form_submit($form, $form_state)
5.x system.module system_popup_report_contact_form_submit($form, $form_state)

File

modules/system/system.module, line 681

Code

function system_popup_report_contact_form_submit($form, $form_state) {
  global $user;

  $category = strip_tags($form_state ["values"]["category"]);
  $comment = strip_tags($form_state ["values"]["comment"]);

  $possible_student = $_SESSION ["advising_student_id"];

  $user_roles = implode(", ", $user->roles);

  $datetime = date("Y-m-d H:i:s", strtotime("now"));

  //$headers = "From: FlightPath-noreply@noreply.com\n";
  $subject = t("FLIGHTPATH REPORT CONTACT") . " - $category ";
  $msg = "";
  $msg .= t("You have received a new report/contact on") . " $datetime.\n";
  $msg .= t("Name:") . " $user->f_name $user->l_name ($user->name)  CWID: $user->cwid  \n" . t("User roles:") . " $user_roles \n\n";
  $msg .= t("Category:") . " $category  \n";
  $msg .= t("Possible Student:") . " $possible_student  \n";
  $msg .= t("Comment:") . " \n $comment \n\n";
  $msg .= "------------------------------------------------ \n";

  $themd5 = md5($user->name . $user->cwid . $comment . $user_roles . $category);

  if ($_SESSION ["da_error_report_md5"] != $themd5) 
   { // Helps stop people from resubmitting over and over again
    // (by hitting refresh, or by malicious intent)..

    $msg = addslashes($msg);
    $to = variable_get("contact_email_address", "");

    if ($to != "") {
      //mail($to,$subject,$msg,$headers);
      mail($to, $subject, $msg);
    }

  }

  $_SESSION ["da_error_report_md5"] = $themd5;

}