示例#1
0
function syslog_sendemail($to, $from, $subject, $message, $smsmessage)
{
    if (syslog_check_dependencies()) {
        syslog_debug("Sending Alert email to '" . $to . "'");
        $sms = "";
        $nonsms = "";
        /* if there are SMS emails, process separately */
        if (substr_count($to, "sms@")) {
            $emails = explode(",", $to);
            if (sizeof($emails)) {
                foreach ($emails as $email) {
                    if (substr_count($email, "sms@")) {
                        $sms .= (strlen($sms) ? ", " : "") . str_replace("sms@", "", trim($email));
                    } else {
                        $nonsms .= (strlen($nonsms) ? ", " : "") . trim($email);
                    }
                }
            }
        } else {
            $nonsms = $to;
        }
        if (strlen($sms)) {
            send_mail($sms, $from, $subject, $smsmessage);
        }
        if (strlen($nonsms)) {
            if (read_config_option("syslog_html") == "on") {
                send_mail($nonsms, $from, $subject, $message, 'html_please');
            } else {
                send_mail($nonsms, $from, $subject, $message);
            }
        }
    } else {
        syslog_debug("Could not send alert, you are missing the Settings plugin");
    }
}
示例#2
0
 +-------------------------------------------------------------------------+
 | http://www.cacti.net/                                                   |
 +-------------------------------------------------------------------------+
*/
define("MAX_DISPLAY_PAGES", 21);
/* allow guest account to see this page */
$guest_account = true;
/* initialize cacti environment */
chdir('../../');
include "./include/auth.php";
/* syslog specific database setup and functions */
include 'plugins/syslog/config.php';
include_once 'plugins/syslog/functions.php';
$title = "Syslog Viewer";
/* make sure syslog is setup correctly */
if (!syslog_check_dependencies()) {
    include_once dirname(__FILE__) . "/include/top_syslog_header.php";
    cacti_log("SYSLOG: You are missing a required dependency, please install the '<a href='http://cactiusers.org/'>Settings'</a> plugin.", true, "SYSTEM");
    print "<br><br><center><font color=red>You are missing a dependency for Syslog, please install the '<a href='http://cactiusers.org'>Settings</a>' plugin.</font></color>";
    exit;
}
/* set the default tab */
load_current_session_value("tab", "sess_syslog_tab", "syslog");
$current_tab = $_REQUEST["tab"];
/* validate the syslog post/get/request information */
if ($current_tab != "stats") {
    syslog_request_validation($current_tab);
}
/* draw the tabs */
/* display the main page */
if (isset($_REQUEST["export"])) {