Ejemplo n.º 1
0
function status_right_image2()
{
    include_once dirname(__FILE__) . "/ressources/logs.inc";
    include_once dirname(__FILE__) . "/ressources/class.templates.inc";
    include_once dirname(__FILE__) . "/ressources/class.html.pages.inc";
    include_once dirname(__FILE__) . "/ressources/class.cyrus.inc";
    include_once dirname(__FILE__) . "/ressources/class.main_cf.inc";
    include_once dirname(__FILE__) . "/ressources/charts.php";
    include_once dirname(__FILE__) . "/ressources/class.syslogs.inc";
    include_once dirname(__FILE__) . "/ressources/class.system.network.inc";
    include_once dirname(__FILE__) . "/ressources/class.os.system.inc";
    $page = CurrentPageName();
    $users = new usersMenus();
    $tpl = new templates();
    $users = new usersMenus();
    $NOCACHE = true;
    $newfrontend = false;
    $sock = new sockets();
    $SambaEnabled = $sock->GET_INFO("SambaEnabled");
    if (!is_numeric($SambaEnabled)) {
        $SambaEnabled = 1;
    }
    if ($SambaEnabled == 0) {
        $users->SAMBA_INSTALLED = false;
    }
    $DisableMessaging = intval($sock->GET_INFO("DisableMessaging"));
    $EnableNginx = intval($sock->GET_INFO("EnableNginx"));
    $AsCategoriesAppliance = intval($sock->GET_INFO("AsCategoriesAppliance"));
    $status = new status();
    if ($GLOBALS["VERBOSE"]) {
        echo " DisableMessaging = {$DisableMessaging}\n";
    }
    if ($DisableMessaging == 1) {
        $users->POSTFIX_INSTALLED = false;
        $users->ZARAFA_INSTALLED = false;
    }
    if ($AsCategoriesAppliance == 1) {
        return $tpl->_ENGINE_parse_body($status->CATEGORIES_APPLIANCE());
    }
    $SQUIDEnable = trim($sock->GET_INFO("SQUIDEnable"));
    if (!is_numeric($SQUIDEnable)) {
        $SQUIDEnable = 1;
    }
    if ($SQUIDEnable == 0) {
        $users->SQUID_INSTALLED = false;
    }
    $NOCACHE = false;
    if ($GLOBALS["VERBOSE"]) {
        echo " -> Loading status()\n";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo " -> Checking\n";
    }
    if ($users->WEBSTATS_APPLIANCE) {
        if ($GLOBALS["VERBOSE"]) {
            echo " -> WEBSTATS()\n";
        }
        return $tpl->_ENGINE_parse_body($status->WEBSTATS());
    }
    if ($users->ZARAFA_APPLIANCE) {
        if ($GLOBALS["VERBOSE"]) {
            echo " -> ZARAFA()\n";
        }
        return $tpl->_ENGINE_parse_body($status->ZARAFA());
    }
    if ($users->HAPRROXY_APPLIANCE) {
        if ($GLOBALS["VERBOSE"]) {
            echo " -> haproxy_status()\n";
        }
        return $tpl->_ENGINE_parse_body($status->haproxy_status());
    }
    if ($users->LOAD_BALANCE_APPLIANCE) {
        if ($GLOBALS["VERBOSE"]) {
            echo " -> xr_status()\n";
        }
        return $tpl->_ENGINE_parse_body($status->xr_status());
    }
    if ($users->POSTFIX_INSTALLED) {
        if ($GLOBALS["VERBOSE"]) {
            echo " -> status_postfix()\n";
        }
        return status_postfix();
    }
    if ($users->SQUID_INSTALLED) {
        if ($users->KASPERSKY_WEB_APPLIANCE) {
            if ($GLOBALS["VERBOSE"]) {
                echo " -> KASPERSKY_WEB_APPLIANCE()\n";
            }
            return status_kav4proxy($NOCACHE);
        }
        if ($users->KASPERSKY_WEB_APPLIANCE) {
            return status_squid_kav($NOCACHE);
        }
        if ($GLOBALS["VERBOSE"]) {
            echo " -> status_squid()\n";
        }
        return status_squid($NOCACHE);
    } else {
        if ($users->KASPERSKY_WEB_APPLIANCE) {
            if ($GLOBALS["VERBOSE"]) {
                echo " -> status_kav4proxy()\n";
            }
            return status_kav4proxy($NOCACHE);
        }
        if ($users->KASPERSKY_WEB_APPLIANCE) {
            return status_squid_kav($NOCACHE);
        }
    }
    if ($users->NGINX_INSTALLED) {
        if ($GLOBALS["VERBOSE"]) {
            echo " -> StatusNginx()\n";
        }
        if ($EnableNginx == 1) {
            return StatusNginx();
        }
    }
    if ($users->SAMBA_INSTALLED) {
        if ($GLOBALS["VERBOSE"]) {
            echo " -> StatusSamba()\n";
        }
        return StatusSamba();
    }
    if ($users->APACHE_INSTALLED) {
        if ($GLOBALS["VERBOSE"]) {
            echo " -> StatusApache()\n";
        }
        return StatusApache();
    }
}
Ejemplo n.º 2
0
function status_right()
{
    include_once dirname(__FILE__) . "/ressources/class.browser.detection.inc";
    $users = new usersMenus();
    $sock = new sockets();
    $tpl = new templates();
    $newfrontend = false;
    $DisableNetworksManagement = $sock->GET_INFO("DisableNetworksManagement");
    $WizardNetLeaveUnconfigured = $sock->GET_INFO("WizardNetLeaveUnconfigured");
    if (!is_numeric($DisableNetworksManagement)) {
        $DisableNetworksManagement = 0;
    }
    if (!is_numeric($WizardNetLeaveUnconfigured)) {
        $WizardNetLeaveUnconfigured = 0;
    }
    if (isset($_GET["newfrontend"])) {
        $newfrontend = true;
    }
    if (!$users->AsArticaAdministrator) {
        die("<H2 style='color:red'>permission denied</H2>");
    }
    $page = CurrentPageName();
    $ldap = new clladp();
    if ($GLOBALS["VERBOSE"]) {
        echo "{$page} LINE:" . __LINE__ . "\n";
    }
    $hostname = base64_decode($sock->getFrameWork("network.php?fqdn=yes"));
    writelogs("network.php?fqdn=yes -> hostname=\"{$hostname}\"", __FUNCTION__, __FILE__, __LINE__);
    $mustchangeHostname = false;
    if (preg_match("#Name or service not known#", $hostname)) {
        $mustchangeHostname = true;
    }
    if (preg_match("#locahost\\.localdomain#", $hostname)) {
        $mustchangeHostname = true;
    }
    if (preg_match("#[A-Za-z]+\\s+[A-Za-z]+#", $hostname)) {
        $mustchangeHostname = true;
    }
    if (!$mustchangeHostname) {
        if (preg_match("#locahost\\.localdomain#", $users->hostname)) {
            $mustchangeHostname = true;
        }
    }
    if (!$mustchangeHostname) {
        if (strpos($hostname, ".") == 0) {
            $mustchangeHostname = true;
        }
    }
    if ($mustchangeHostname) {
        writelogs("hostname=\"{$hostname}\" mustchangeHostname=True", __FUNCTION__, __FILE__, __LINE__);
    } else {
        writelogs("hostname=\"{$hostname}\" mustchangeHostname=False", __FUNCTION__, __FILE__, __LINE__);
    }
    if ($mustchangeHostname) {
        echo "<script>Loadjs('admin.chHostname.php');</script>";
    }
    if ($DisableNetworksManagement == 0) {
        if ($WizardNetLeaveUnconfigured == 0) {
            if (!$mustchangeHostname) {
                $q = new mysql();
                $countDeNIC = $q->COUNT_ROWS("nics", "artica_backup");
                if ($countDeNIC == 0) {
                    echo "<script>Loadjs('admin.chNICs.php');</script>";
                }
            }
        }
    }
    $sock = new sockets();
    $sock->getFrameWork('cmd.php?ForceRefreshRight=yes');
    if (!$newfrontend) {
        $infos = "LoadAjaxTiny('right-status-infos','admin.left.php?part1=yes');";
    } else {
        $ajaxadd = "&newfrontend=yes";
    }
    $script = "\n\t<div id='mem_status_computer' style='text-align:center;width:100%;margin:10px'></div>\n\t\n\n\t<div id='right-status-infos'></div>\n\t<script>\n\t\tLoadAjax('left_status','{$page}?status=left{$ajaxadd}');\n\t\t{$infos}\n\t\tLoadAjax('mem_status_computer','{$page}?memcomputer=yes{$ajaxadd}');\n\t</script>\n";
    if ($users->ZARAFA_APPLIANCE) {
        $status = new status();
        echo $tpl->_ENGINE_parse_body($status->ZARAFA()) . $script;
        return;
    }
    if ($users->LOAD_BALANCE_APPLIANCE) {
        $status = new status();
        echo $tpl->_ENGINE_parse_body($status->xr_status()) . $script;
        return;
    }
    if ($users->POSTFIX_INSTALLED) {
        if ($GLOBALS["VERBOSE"]) {
            echo "{$page} -> status_postfix() LINE:" . __LINE__ . "\n";
        }
        echo status_postfix() . $script;
        return null;
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "{$page} LINE:" . __LINE__ . "\n";
    }
    if ($users->SQUID_INSTALLED) {
        $SQUIDEnable = trim($sock->GET_INFO("SQUIDEnable"));
        if (!is_numeric($SQUIDEnable)) {
            $SQUIDEnable = 1;
        }
        if ($SQUIDEnable == 0) {
            if ($users->KASPERSKY_WEB_APPLIANCE) {
                echo status_kav4proxy() . $script;
                return null;
            }
        }
        if ($users->KASPERSKY_WEB_APPLIANCE) {
            echo status_squid_kav() . $script;
            return;
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "{$page} LINE:" . __LINE__ . "\n";
        }
        echo $memory . status_squid() . $script;
        return null;
    } else {
        if ($users->KASPERSKY_WEB_APPLIANCE) {
            echo status_kav4proxy() . $script;
            return;
        }
    }
    if ($users->SAMBA_INSTALLED) {
        echo StatusSamba() . $script;
        return null;
    }
    echo "{$script}";
}