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();
    }
}
Example #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}";
}
function BuildStatusRight()
{
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $minutes = file_time_min($pidfile);
    if ($minutes < 10) {
        events("Stopping status, currently {$minutes}Mn need to wait 10Mn", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    if (!isset($GLOBALS["CLASS_USERS_MENUS"])) {
        $users = new usersMenus();
        $GLOBALS["CLASS_USERS_MENUS"] = $users;
    } else {
        $users = $GLOBALS["CLASS_USERS_MENUS"];
    }
    $sock = new sockets();
    $tpl = new templates();
    $status = new status();
    $DisableMessaging = intval($sock->GET_INFO("DisableMessaging"));
    if ($DisableMessaging == 1) {
        $users->POSTFIX_INSTALLED = false;
    }
    $AsCategoriesAppliance = intval($sock->GET_INFO("AsCategoriesAppliance"));
    if ($AsCategoriesAppliance == 1) {
        return $status->CATEGORIES_APPLIANCE();
    }
    $SAMBA_INSTALLED = 0;
    $SQUID_INSTALLED = 0;
    $POSTFIX_INSTALLED = 0;
    if ($users->POSTFIX_INSTALLED) {
        $POSTFIX_INSTALLED = 1;
    }
    if ($users->SQUID_INSTALLED) {
        $SQUID_INSTALLED = 1;
        $SQUID_INSTALLED = $sock->GET_INFO("SQUIDEnable");
        if ($SQUID_INSTALLED == null) {
            $SQUID_INSTALLED = 1;
        }
    }
    if ($users->SAMBA_INSTALLED) {
        $SAMBA_INSTALLED = 1;
        $SAMBA_INSTALLED = $sock->GET_INFO("SambaEnabled");
        if (!is_numeric($SAMBA_INSTALLED)) {
            $SAMBA_INSTALLED = 1;
        }
    }
    events("POSTFIX_INSTALLED={$POSTFIX_INSTALLED},SQUID_INSTALLED={$SQUID_INSTALLED},SAMBA_INSTALLED={$SAMBA_INSTALLED}");
    writelogs("POSTFIX_INSTALLED={$POSTFIX_INSTALLED},SQUID_INSTALLED={$SQUID_INSTALLED},SAMBA_INSTALLED={$SAMBA_INSTALLED}", __FUNCTION__, __FILE__, __LINE__);
    if ($SQUID_INSTALLED == 1) {
        $Squid_status = $status->Squid_status();
    }
    if ($POSTFIX_INSTALLED == 0) {
        if ($SQUID_INSTALLED == 1) {
            return $Squid_status;
        }
        if ($SAMBA_INSTALLED == 1) {
            return StatusSamba();
        }
    } else {
        return $status->Postfix_satus();
    }
}
function BuildStatusRight()
{
    $users = new usersMenus();
    $sock = new sockets();
    $tpl = new templates();
    $SAMBA_INSTALLED = 0;
    $SQUID_INSTALLED = 0;
    $POSTFIX_INSTALLED = 0;
    if ($users->POSTFIX_INSTALLED) {
        $POSTFIX_INSTALLED = 1;
    }
    if ($users->SQUID_INSTALLED) {
        $SQUID_INSTALLED = 1;
        $SQUID_INSTALLED = $sock->GET_INFO("SQUIDEnable");
        if ($SQUID_INSTALLED == null) {
            $SQUID_INSTALLED = 1;
        }
    }
    if ($users->SAMBA_INSTALLED) {
        $SAMBA_INSTALLED = 1;
        $SAMBA_INSTALLED = $sock->GET_INFO("SambaEnabled");
        if ($SAMBA_INSTALLED == null) {
            $SAMBA_INSTALLED = 1;
        }
    }
    events("POSTFIX_INSTALLED={$POSTFIX_INSTALLED},SQUID_INSTALLED={$SQUID_INSTALLED},SAMBA_INSTALLED={$SAMBA_INSTALLED}");
    writelogs("POSTFIX_INSTALLED={$POSTFIX_INSTALLED},SQUID_INSTALLED={$SQUID_INSTALLED},SAMBA_INSTALLED={$SAMBA_INSTALLED}", __FUNCTION__, __FILE__, __LINE__);
    if ($POSTFIX_INSTALLED == 0) {
        if ($SQUID_INSTALLED == 1) {
            return StatusSquid();
        }
        if ($SAMBA_INSTALLED == 1) {
            return StatusSamba();
        }
    }
    return @file_get_contents("/usr/share/artica-postfix/ressources/logs/status.right.postfix.html");
}
Example #5
0
function status_right(){
	include_once(dirname(__FILE__)."/ressources/class.browser.detection.inc");
	$users=new usersMenus();
	$sock=new sockets();
	$tpl=new templates();
	if(!$users->AsArticaAdministrator){die("<H2 style='color:red'>permission denied</H2>");}
	$page=CurrentPageName();
	$script="\n<script>LoadAjax('left_status','$page?status=left');</script>\n";
	$ldap=new clladp();
	if($GLOBALS["VERBOSE"]){echo "$page LINE:".__LINE__."\n";}
	
	if($ldap->ldap_password=="secret"){
		echo RoundedLightGrey(Paragraphe("danger64-user-lock.png",'{MANAGER_DEFAULT_PASSWORD}','{MANAGER_DEFAULT_PASSWORD_TEXT}',"javascript:Loadjs('artica.settings.php?js=yes&bigaccount-interface=yes');",null,330))."<br>";
	}
	if(!function_exists("browser_detection")){include(dirname(__FILE__).'/ressources/class.browser.detection.inc');}
	$browser=browser_detection();
	
	if($browser=="ie"){
		echo Paragraphe("no-ie-64.png",'{NOIEPLEASE} !!','{NOIEPLEASE_TEXT}',"javascript:s_PopUp('http://www.mozilla-europe.org/en/firefox/','800',800);",null,330)."<br>";
	}
	
	if($sock->GET_INFO("EnableNightlyInFrontEnd")==1){NightlyNotifs();}
	
	if($users->VMWARE_HOST){
		if(!$users->VMWARE_TOOLS_INSTALLED){
			echo RoundedLightGrey(Paragraphe("vmware-logo.png",'{INSTALL_VMWARE_TOOLS}','{INSTALL_VMWARE_TOOLS_TEXT}',
			"javascript:Loadjs('setup.index.progress.php?product=APP_VMTOOLS&start-install=yes');",null,330))."<br>";
		}
	}
	if($GLOBALS["VERBOSE"]){echo "$page LINE:".__LINE__."\n";}
	if($users->VIRTUALBOX_HOST){
		if(!$users->APP_VBOXADDINTION_INSTALLED){
			echo RoundedLightGrey(Paragraphe("virtualbox-64.png",'{INSTALL_VBOX_TOOLS}','{INSTALL_VBOX_TOOLS_TEXT}',
			"javascript:Loadjs('setup.index.progress.php?product=APP_VBOXADDITIONS&start-install=yes');",null,330))."<br>";	
		}
	}
	
	
	$hostname=base64_decode($sock->getFrameWork("network.php?fqdn=yes"));
	$mustchangeHostname=false;
	if(preg_match("#Name or service not known#", $hostname)){$mustchangeHostname=true;}
	if(preg_match("#locahost\.localdomain#", $hostname)){$mustchangeHostname=true;}
	
	writelogs("hostname=$hostname mustchangeHostname=$mustchangeHostname",__FUNCTION__,__FILE__,__LINE__);
	
	
	if($mustchangeHostname){echo "<script>Loadjs('admin.chHostname.php');</script>";}	
	
	
	
	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";}
	$memory="<div id='mem_status_computer'>".$tpl->_ENGINE_parse_body(@file_get_contents("ressources/logs/status.memory.html"))."</div>";	
	
	if($users->SQUID_INSTALLED){
		if($GLOBALS["VERBOSE"]){echo "$page LINE:".__LINE__."\n";}
		echo $memory.status_squid().$script;
		return null;
	}
	
	if($users->SAMBA_INSTALLED){
		echo $memory.StatusSamba().$script;
		return null;	
	}
	echo "$memory$script";
	$sock=new sockets();
	$sock->getFrameWork('cmd.php?ForceRefreshRight=yes');
	}