function status()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $users = new usersMenus();
    $t = time();
    $boot = new boostrap_form();
    $sock = new sockets();
    $MySQLSyslogType = $sock->GET_INFO("MySQLSyslogType");
    if (!is_numeric($MySQLSyslogType)) {
        $MySQLSyslogType = 1;
    }
    if ($MySQLSyslogType == 1) {
        status_server();
        return;
    }
    if ($MySQLSyslogType == 2) {
        status_client();
        return;
    }
    echo "<p class=text-error>Fatal Cannot understand MySQLSyslogType={$MySQLSyslogType} ???</p>";
}
function status()
{
    $sock = new sockets();
    $users = new usersMenus();
    $UseRemoteUfdbguardService = intval($sock->GET_INFO("UseRemoteUfdbguardService"));
    if ($UseRemoteUfdbguardService == 1) {
        status_client();
        exit;
    }
    $shield_ok = "shield-ok-256.png";
    $shield_disabled = "shield-grey-256.png";
    $shield_red = "shield-red-256.png";
    $shield_warn = "shield-warn-256.png";
    $ini = new Bs_IniHandler();
    $err = array();
    $tpl = new templates();
    $curs = "OnMouseOver=\"this.style.cursor='pointer';\"\n\tOnMouseOut=\"this.style.cursor='auto'\"";
    if ($sock->EnableUfdbGuard() == 0) {
        echo "<center><img src='img/{$shield_disabled}'></center>";
        return;
    }
    $ini->loadString(base64_decode($sock->getFrameWork("squid.php?ufdbguardd-all-status=yes")));
    $c = 0;
    while (list($key, $array) = each($ini->_params)) {
        $service_name = $array["service_name"];
        $service_disabled = intval($array["service_disabled"]);
        if ($service_disabled == 0) {
            continue;
        }
        $running = intval($array["running"]);
        $c++;
        if ($running == 0) {
            $icon = "disks-128-warn.png";
            $err[] = "<tr><td style='font-size:18px;color:#d32d2d;vertical-align:middle' OnClick=\"javascript:GoToServices()\">\n\t\t\t<img src='img/warn-red-32.png' style='float:left;margin-right:10px'>\n\t\t\t{{$service_name}} <span style='text-decoration:underline' {$curs}> {stopped}</span></td></tr>";
        }
    }
    if (count($err) > 0) {
        echo "<center><img src='img/{$shield_red}'></center>\n\t\t<table>" . @implode("\n", $err) . "</table>";
    } else {
        echo "<center><img src='img/{$shield_ok}'></center>";
    }
    $EnableArticaMetaClient = intval($sock->GET_INFO("EnableArticaMetaClient"));
    if ($EnableArticaMetaClient == 1) {
        $LOCAL_VERSION_TEXT = $tpl->time_to_date($sock->GET_INFO("UfdbMetaClientVersion"));
    } else {
        $MAINARR = unserialize(base64_decode($sock->GET_INFO("CATZ_ARRAY")));
        $LOCAL_VERSION_TEXT = $tpl->time_to_date($MAINARR["TIME"]);
    }
    echo $tpl->_ENGINE_parse_body("<center style='font-size:22px;margin-top:10px;font-weight:bold'>{running}</center>");
    echo $tpl->_ENGINE_parse_body("<center style='font-size:16px'>{since}:&nbsp;{$ini->_params["APP_UFDBGUARD"]["uptime"]}</center>");
    echo $tpl->_ENGINE_parse_body("<center style='font-size:16px'>{memory}:&nbsp;" . FormatBytes($ini->_params["APP_UFDBGUARD"]["master_memory"]) . "</center>");
    echo "<hr>";
    echo $tpl->_ENGINE_parse_body("<center style='font-size:16px'>{version}:&nbsp;{$LOCAL_VERSION_TEXT}</center>");
}