示例#1
0
文件: plugins.php 项目: MrWnn/cacti
function api_plugin_user_realm_auth($filename = '')
{
    global $user_auth_realm_filenames;
    /* list all realms that this user has access to */
    if ($filename != '' && isset($user_auth_realm_filenames[basename($filename)])) {
        if (is_realm_allowed($user_auth_realm_filenames[basename($filename)])) {
            return TRUE;
        }
    }
    return FALSE;
}
示例#2
0
文件: functions.php 项目: MrWnn/cacti
function clog_authorized()
{
    if (!isset($_SESSION['sess_clog_level'])) {
        if (isset($_SESSION['sess_user_id'])) {
            if (is_realm_allowed(18)) {
                $_SESSION['sess_clog_level'] = CLOG_PERM_ADMIN;
            } else {
                if (is_realm_allowed(19)) {
                    $_SESSION['sess_clog_level'] = CLOG_PERM_USER;
                } else {
                    $_SESSION['sess_clog_level'] = CLOG_PERM_NONE;
                }
            }
        } else {
            $_SESSION['sess_clog_level'] = CLOG_PERM_NONE;
        }
    }
    if ($_SESSION['sess_clog_level'] == CLOG_PERM_USER) {
        return true;
    } elseif ($_SESSION['sess_clog_level'] == CLOG_PERM_ADMIN) {
        return true;
    } else {
        return false;
    }
}
示例#3
0
$graph_weekdays = array(WD_SUNDAY => date('l', strtotime('Sunday')), WD_MONDAY => date('l', strtotime('Monday')), WD_TUESDAY => date('l', strtotime('Tuesday')), WD_WEDNESDAY => date('l', strtotime('Wednesday')), WD_THURSDAY => date('l', strtotime('Thursday')), WD_FRIDAY => date('l', strtotime('Friday')), WD_SATURDAY => date('l', strtotime('Saturday')));
$graph_dateformats = array(GD_MO_D_Y => 'Month Number, Day, Year', GD_MN_D_Y => 'Month Name, Day, Year', GD_D_MO_Y => 'Day, Month Number, Year', GD_D_MN_Y => 'Day, Month Name, Year', GD_Y_MO_D => 'Year, Month Number, Day', GD_Y_MN_D => 'Year, Month Name, Day');
$graph_datechar = array(GDC_HYPHEN => '-', GDC_SLASH => '/');
$dsstats_refresh_interval = array('boost' => 'After Boost', '60' => '1 Hour', '120' => '2 Hours', '180' => '3 Hours', '240' => '4 Hours', '300' => '5 Hours', '360' => '6 Hours');
$dsstats_max_memory = array('32' => '32 MBytes', '64' => '64 MBytes', '128' => '128 MBytes', '256' => '256 MBytes', '512' => '512 MBytes', '1024' => '1 GBytes', '1536' => '1.5 GBytes', '2048' => '2 GBytes', '3072' => '3 GBytes');
$dsstats_hourly_avg = array('60' => '1 Hour', '120' => '2 Hours', '180' => '3 Hours', '240' => '4 Hours', '300' => '5 Hours', '360' => '6 Hours');
$boost_max_rows_per_select = array('2000' => '2,000 Data Source Items', '5000' => '5,000 Data Source Items', '10000' => '10,000 Data Source Items', '15000' => '15,000 Data Source Items', '25000' => '25,000 Data Source Items', '50000' => '50,000 Data Source Items (Default)', '100000' => '100,000 Data Source Items', '200000' => '200,000 Data Source Items', '400000' => '400,000 Data Source Items');
$boost_utilities_interval = array('999999' => 'Disabled', '5' => '5 Seconds', '10' => '10 Seconds', '15' => '15 Seconds', '20' => '20 Seconds', '30' => '30 Seconds', '60' => '1 Minute', '300' => '5 Minutes');
$boost_refresh_interval = array('30' => '30 Minutes', '60' => '1 Hour', '120' => '2 Hours', '240' => '4 Hours', '360' => '6 Hours');
$boost_max_runtime = array('1200' => '20 Minutes', '2400' => '40 Minutes', '3600' => '1 Hour', '4800' => '1.5 Hours');
$boost_max_memory = array('32' => '32 MBytes', '64' => '64 MBytes', '128' => '128 MBytes', '256' => '256 MBytes', '512' => '512 MBytes', '1024' => '1 GBytes', '1536' => '1.5 GBytes', '2048' => '2 GBytes', '3072' => '3 GBytes');
$realtime_window = array(30 => "30 Seconds", 45 => "45 Seconds", 60 => "1 Minute", 90 => "1.5 Minutes", 120 => "2 Minutes", 300 => "5 Minutes", 600 => "10 Minutes", 1200 => "20 Minutes", 1800 => "30 Minutes", 3600 => "1 Hour");
$realtime_refresh = array(5 => "5 Seconds", 10 => "10 Seconds", 15 => "15 Seconds", 20 => "20 Seconds", 30 => "30 Seconds", 60 => "1 Minute", 120 => "2 Minutes");
$attachment_sizes = array(1048576 => "1 Megabyte", 2097152 => "2 Megabytes", 4194304 => "4 Megabytes", 10485760 => "10 Megabytes", 20971520 => "20 Megabytes", 52428800 => "50 Megabytes", 104857600 => "100 Megabytes");
$reports_actions = array(REPORTS_SEND_NOW => "Send Now", REPORTS_DUPLICATE => "Duplicate", REPORTS_ENABLE => "Enable", REPORTS_DISABLE => "Disable", REPORTS_DELETE => "Delete");
if (is_realm_allowed(22)) {
    $reports_actions[REPORTS_OWN] = "Take Ownership";
}
$attach_types = array(REPORTS_TYPE_INLINE_PNG => 'Inline PNG Image');
if (extension_loaded(REPORTS_EXTENSION_GD)) {
    $attach_types[REPORTS_TYPE_INLINE_JPG] = 'Inline JPEG Image';
    $attach_types[REPORTS_TYPE_INLINE_GIF] = 'Inline GIF Image';
}
$attach_types[REPORTS_TYPE_ATTACH_PNG] = 'Attached PNG Image';
if (extension_loaded(REPORTS_EXTENSION_GD)) {
    $attach_types[REPORTS_TYPE_ATTACH_JPG] = 'Attached JPEG Image';
    $attach_types[REPORTS_TYPE_ATTACH_GIF] = 'Attached GIF Image';
}
if (read_config_option("reports_allow_ln") != '') {
    $attach_types[REPORTS_TYPE_INLINE_PNG_LN] = 'Inline PNG Image, LN Style';
    if (extension_loaded(REPORTS_EXTENSION_GD)) {
示例#4
0
文件: html.php 项目: MrWnn/cacti
function html_show_tabs_left($show_console_tab)
{
    global $config, $tabs_left;
    if (read_config_option("selected_theme") == 'classic') {
        if ($show_console_tab == true) {
            ?>
<a href="<?php 
            echo $config['url_path'];
            ?>
index.php"><img src="<?php 
            echo $config['url_path'];
            ?>
images/tab_console<?php 
            print is_console_page(basename($_SERVER['PHP_SELF'])) ? '_down' : '';
            ?>
.gif" alt="Console" align="absmiddle" border="0"></a><?php 
        }
        if (is_realm_allowed(7)) {
            ?>
<a href="<?php 
            echo $config['url_path'];
            ?>
graph_view.php"><img src="<?php 
            echo $config['url_path'];
            ?>
images/tab_graphs<?php 
            $file = basename($_SERVER['PHP_SELF']);
            if ($file == "graph_view.php" || $file == "graph_settings.php" || $file == "graph.php") {
                print "_down";
            }
            print ".gif";
            ?>
" alt="Graphs" align="absmiddle" border="0"></a><?php 
        }
        if (is_realm_allowed(21) || is_realm_allowed(22)) {
            if (substr_count($_SERVER["REQUEST_URI"], "reports_")) {
                print '<a href="' . $config['url_path'] . (is_realm_allowed(22) ? 'reports_admin.php' : 'reports_user.php') . '"><img src="' . $config['url_path'] . 'images/tab_nectar_down.gif" alt="Reporting" align="absmiddle" border="0"></a>';
            } else {
                print '<a href="' . $config['url_path'] . (is_realm_allowed(22) ? 'reports_admin.php' : 'reports_user.php') . '"><img src="' . $config['url_path'] . 'images/tab_nectar.gif" alt="Reporting" align="absmiddle" border="0"></a>';
            }
        }
        if (is_realm_allowed(18) || is_realm_allowed(19)) {
            if (substr_count($_SERVER["REQUEST_URI"], "clog")) {
                print '<a href="' . $config['url_path'] . (is_realm_allowed(18) ? 'clog.php' : 'clog_user.php') . '"><img src="' . $config['url_path'] . 'images/tab_clog_down.png" alt="Cacti Log" align="absmiddle" border="0"></a>';
            } else {
                print '<a href="' . $config['url_path'] . (is_realm_allowed(18) ? 'clog.php' : 'clog_user.php') . '"><img src="' . $config['url_path'] . 'images/tab_clog.png" alt="Cacti Log" align="absmiddle" border="0"></a>';
            }
        }
        api_plugin_hook('top_graph_header_tabs');
    } else {
        if ($show_console_tab) {
            $tabs_left[] = array('title' => 'Console', 'image' => '', 'url' => $config['url_path'] . 'index.php');
        }
        $tabs_left[] = array('title' => 'Graphs', 'image' => '', 'url' => $config['url_path'] . 'graph_view.php');
        $tabs_left[] = array('title' => 'Reporting', 'image' => '', 'url' => $config['url_path'] . (is_realm_allowed(22) ? 'reports_admin.php' : 'reports_user.php'));
        $tabs_left[] = array('title' => 'Cacti Log', 'image' => '', 'url' => $config['url_path'] . (is_realm_allowed(18) ? 'clog.php' : 'clog_user.php'));
        // Get Plugin Text Out of Band
        ob_start();
        api_plugin_hook('top_graph_header_tabs');
        $tab_text = trim(ob_get_clean());
        $tab_text = str_replace('<a', '', $tab_text);
        $tab_text = str_replace('</a>', '|', $tab_text);
        $tab_text = str_replace('<img', '', $tab_text);
        $tab_text = str_replace('<', '', $tab_text);
        $tab_text = str_replace('"', "'", $tab_text);
        $tab_text = str_replace('>', '', $tab_text);
        $elements = explode('|', $tab_text);
        foreach ($elements as $p) {
            $p = trim($p);
            if ($p == '') {
                continue;
            }
            $altpos = strpos($p, 'alt=');
            $hrefpos = strpos($p, 'href=');
            if ($altpos >= 0) {
                $alt = substr($p, $altpos + 4);
                $parts = explode("'", $alt);
                if ($parts[0] == '') {
                    $alt = $parts[1];
                } else {
                    $alt = $parts[0];
                }
            } else {
                $alt = 'Title';
            }
            if ($hrefpos >= 0) {
                $href = substr($p, $hrefpos + 5);
                $parts = explode("'", $href);
                if ($parts[0] == '') {
                    $href = $parts[1];
                } else {
                    $href = $parts[0];
                }
            } else {
                $href = 'unknown';
            }
            $tabs_left[] = array('title' => ucwords($alt), 'url' => $href);
        }
        $i = 0;
        $me_base = basename($_SERVER['PHP_SELF']);
        foreach ($tabs_left as $tab) {
            $tab_base = basename($tab['url']);
            if ($tab_base == 'graph_view.php' && ($me_base == 'graph_view.php' || $me_base == 'graph.php')) {
                $tabs_left[$i]['selected'] = true;
            } elseif ($tab_base == 'index.php' && is_console_page($me_base)) {
                $tabs_left[$i]['selected'] = true;
            } elseif ($tab_base == $me_base) {
                $tabs_left[$i]['selected'] = true;
            }
            $i++;
        }
        print "<div class='maintabs'><nav><ul>\n";
        foreach ($tabs_left as $tab) {
            print "<li><a class='" . (isset($tab['selected']) ? 'selected' : '') . "' href='" . $tab['url'] . "'>" . $tab['title'] . "</a></li>\n";
        }
        print "</ul></nav></div>\n";
    }
}
示例#5
0
function is_reports_admin()
{
    return is_realm_allowed(22) ? true : false;
}