function my_to_date($in_date) { // date_time format to user's spec // $temp = mktime(substr($in_date,11,2),substr($in_date,14,2),substr($in_date,17,2),substr($in_date,5,2),substr($in_date,8,2),substr($in_date,0,4)); $temp = mysql2timestamp($d1); // 9/29/10 return good_date_time($in_date) ? date(get_variable("date_format"), $temp) : ""; // }
function mail_it($to_str, $text, $ticket_id, $text_sel = 1, $txt_only = FALSE) { // 10/6/08, 10/15/08, 2/18/09, 3/7/09 global $istest; /* Subject A Inciden B Title Priorit C Priorit Nature D Nature Written E Written Updated F As of Reporte G By Phone: H Phone: Status: I Status: Address J Location Descrip K Descrip Disposi L Disposi Start/end M Map: " N Map: " Actions O Patients P Host Q 911 contact R // 6/26/10 */ switch ($text_sel) { // 7/7/09 case 1: $match_str = strtoupper(get_variable("msg_text_1")); // note case break; case 2: $match_str = strtoupper(get_variable("msg_text_2")); break; case 3: $match_str = strtoupper(get_variable("msg_text_3")); break; } if (empty($match_str)) { $match_str = " " . implode("", range("A", "R")); } // empty get all - force non-zero hit // require_once("cell_addrs.inc.php"); // 10/22/08 // snap (__LINE__, count($cell_addrs)); // $cell_addrs = array( "vtext.com", "messaging.sprintpcs.com", "txt.att.net", "vmobl.com", "myboostmobile.com"); // 10/5/08 // if ($istest) {array_push($cell_addrs, "gmail.com");}; $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}ticket` WHERE `id`='{$ticket_id}' LIMIT 1"; $ticket_result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $t_row = stripslashes_deep(mysql_fetch_array($ticket_result)); // dump($t_row); $eol = "\n"; $locale = get_variable('locale'); $message = ""; $_end = good_date_time($t_row['problemend']) ? " End:" . $t_row['problemend'] : ""; // for ($i = 0; $i < strlen($match_str); $i++) { if (!($match_str[$i] == " ")) { switch ($match_str[$i]) { case "A": break; case "B": $message .= "Incident: " . $t_row['scope'] . $eol; break; case "C": $message .= "Priority: " . get_severity($t_row['severity']) . $eol; break; case "D": $message .= "Nature: " . get_type($t_row['in_types_id']) . $eol; break; case "J": $str = ""; $str .= empty($t_row['street']) ? "" : $t_row['street'] . " "; $str .= empty($t_row['city']) ? "" : $t_row['city'] . " "; $str .= empty($t_row['state']) ? "" : $t_row['state']; $message .= empty($str) ? "" : "Addr: " . $str . $eol; break; case "K": $message .= empty($t_row['description']) ? "" : "Descr: " . wordwrap($t_row['description']) . $eol; break; case "G": $message .= "Reported by: " . $t_row['contact'] . $eol; break; case "H": $message .= empty($t_row['phone']) ? "" : "Phone: " . format_phone($t_row['phone']) . $eol; break; case "E": $message .= empty($t_row['date']) ? "" : "Written: " . format_date_time($t_row['date']) . $eol; break; case "F": $message .= "Updated: " . format_date_time($t_row['updated']) . $eol; break; case "I": $message .= "Status: " . get_status($t_row['status']) . $eol; break; case "L": $message .= empty($t_row['comments']) ? "" : "Disp: " . wordwrap($t_row['comments']) . $eol; break; case "M": $message .= get_text("Run Start") . ": " . format_date_time($t_row['problemstart']) . $_end . $eol; break; case "N": if ($locale == 0) { $usng = LLtoUSNG($t_row['lat'], $t_row['lng']); $message .= "Map: " . $t_row['lat'] . " " . $t_row['lng'] . ", " . $usng . "\n"; } if ($locale == 1) { $osgb = LLtoOSGB($t_row['lat'], $t_row['lng']); $message .= "Map: " . $t_row['lat'] . " " . $t_row['lng'] . ", " . $osgb . "\n"; } if ($locale == 2) { $utm = LLtoUTM($t_row['lat'], $t_row['lng']); $message .= "Map: " . $t_row['lat'] . " " . $t_row['lng'] . ", " . $utm . "\n"; } break; case "P": $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}patient` WHERE ticket_id='{$ticket_id}'"; $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); if (mysql_affected_rows() > 0) { $message .= "\nPatient:\n"; while ($pat_row = stripslashes_deep(mysql_fetch_array($result))) { $message .= $pat_row['name'] . ", " . $pat_row['updated'] . "- " . wordwrap($pat_row['description'], 70) . "\n"; } } unset($result); break; case "O": $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}action` WHERE `ticket_id`='{$ticket_id}'"; // 10/16/08 $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); // 3/22/09 if (mysql_affected_rows() > 0) { $message .= "\nActions:\n"; $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($act_row = stripslashes_deep(mysql_fetch_array($result))) { $message .= $act_row['updated'] . " - " . wordwrap($act_row['description'], 70) . "\n"; } } unset($result); break; case "Q": $message .= "Tickets host: " . get_variable('host') . $eol; break; case "R": // 6/26/10 $message .= empty($t_row['nine_one_one']) ? "" : get_text('911 Contacted') . ": " . wordwrap($t_row['nine_one_one']) . $eol; // 11/10/11 break; default: $message = "Match string error:" . $match_str[$i] . " " . $match_str . $eol; } // end switch () } // end if(!($match_...)) } // end for ($i...) $message = str_replace("\n.", "\n..", $message); // see manual re mail win platform peculiarities $subject = strpos($match_str, "A") ? $text . $t_row['scope'] . " (#" . $t_row['id'] . ")" : ""; if ($txt_only) { return $subject . "\n" . $message; // 2/16/09 } else { do_send($to_str, $subject, $message); } }
function my_to_date_sh($in_date) { // short date_time string // $temp = mktime(substr($in_date,11,2),substr($in_date,14,2),substr($in_date,17,2),substr($in_date,5,2),substr($in_date,8,2),substr($in_date,0,4)); // $temp = mktime((int)substr($in_date,11,2), (int)substr($in_date,14,2), (int)substr($in_date,17,2), (int)substr($in_date,5,2), (int)substr($in_date,8,2), (int)substr($in_date,0,4)); // 9/29/10 $temp = mysql2timestamp($in_date); // 9/29/10 return good_date_time($in_date) ? date("H:i", $temp) : ""; // }
function my_to_date_sh($in_date) { // short date_time string $temp = mysql2timestamp($in_date); return good_date_time($in_date) ? date("H:i", $temp) : ""; // }