function system_popup_report_contact_form_submit

7.x system.module system_popup_report_contact_form_submit($form, $form_state)
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 1106

Code

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

  $category = filter_markup($form_state ["values"]["category"], 'plain');
  $comment = filter_markup($form_state ["values"]["comment"], 'plain');

  $possible_student = filter_markup($_SESSION ['last_student_selected'], 'plain');

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

  $datetime = date("Y-m-d H:i:s", convert_time(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("Last Student Selected:") . " $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)..

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

    if ($to != "") {
      fp_mail($to, $subject, $msg);
    }

  }

  $_SESSION ["da_error_report_md5"] = $themd5;

  watchdog("admin", "Sent message with popup report contact form: Category: $category; Comment: $comment");


}