foreach ($opened_incidents as $incident) { /* Check if it was already notified in a specified time interval */ $sql = sprintf('SELECT COUNT(id) FROM tevent WHERE type = "SLA_MAX_OPENED_INCIDENTS_NOTIFY" AND id_item = %d AND timestamp > "%s"', $incident['id_grupo'], $compare_timestamp); $notified = get_db_sql($sql); if ($notified > 0) { continue; } // Notify by mail for max. incidents opened (ONCE) to this // the group email, if defined, if not, to default user. if (!isset($noticed_groups[$incident['id_grupo']])) { $noticed_groups[$incident['id_grupo']] = 1; $group_name = dame_nombre_grupo($incident['id_grupo']); $subject = "[" . $config['sitename'] . "] Openened ticket limit reached ({$group_name})"; $body = "Opened ticket limit for this group has been exceeded. Please check open tickets.\n"; if ($sla['enforced'] == 1) { send_group_email($incident['id_grupo'], $subject, $body); insert_event('SLA_MAX_OPENED_INCIDENTS_NOTIFY', $incident['id_grupo']); } else { insert_event('SLA_MAX_OPENED_INCIDENTS_NOTIFY', $incident['id_grupo']); } } } } } // Clean temporal directory $temp_dir = $config["homedir"] . "/attachment/tmp"; delete_all_files_in_dir($temp_dir); // Update the incident statistics incidents_update_stats_data();
} // Message Verification if (isset($_POST['contact-email-message'])) { $inputValue[2] = $_POST['contact-email-message']; if ($Error->length($_POST['contact-email-message'], 10, 1000, 'error', 'Message body')) { $errorClass[2] = 'success'; } else { $errorClass[2] = 'error'; } } else { if (isset($_POST['action'])) { $Error->add('error', 'Message cannot be left empty'); $errorClass[2] = 'error'; } } // Instantiontiate the erroring before we need to refresh the page $msg = $Error->alert(); // Check if the form was submitted without any errors. if (isset($_POST['from-address']) && isset($_POST['contact-email-message']) && isset($_POST['contact-email-name']) && !$Error->ok()) { // Try to send the email if (send_group_email('admin', $_POST['from-address'], $_POST['contact-email-name'], 'Contact Form', nl2br($_POST['contact-email-message']))) { //$Error->add('info', 'Thank you, your email has been sent!'); $complete = 'true'; } else { $Error->add('error', 'Unfortunatel, there was in error in sending your email'); $complete = 'error'; } } Template::setBaseDir('./assets/tmpl'); $html = Template::loadTemplate('layout', array('header' => Template::loadTemplate('header', array('title' => $title, 'user' => $user, 'admin' => $isadmin, 'msg' => $msg, 'selected' => 'contact')), 'content' => Template::loadTemplate('contact', array('errorClass' => $errorClass, 'inputValue' => $inputValue, 'complete' => $complete)), 'footer' => Template::loadTemplate('footer', array('time_start' => $time_start)))); echo $html;