예제 #1
0
function page()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $ini->loadString(@file_get_contents(dirname(__FILE__) . '/ressources/index.ini'));
    $users = new usersMenus();
    $ArchStruct = $users->ArchStruct;
    if ($ArchStruct == "32") {
        $ArchStruct = "i386";
    }
    if ($ArchStruct == "64") {
        $ArchStruct = "x64";
    }
    $GlobalApplicationsStatus = $sock->APC_GET("GlobalApplicationsStatus", 2);
    if ($GlobalApplicationsStatus == null) {
        $GlobalApplicationsStatus = base64_decode($sock->getFrameWork('cmd.php?Global-Applications-Status=yes'));
        $sock->APC_SAVE("GlobalApplicationsStatus", $GlobalApplicationsStatus);
        $GLOBALS["GlobalApplicationsStatus"] = $GlobalApplicationsStatus;
    }
    $squid_version = ParseAppli($GlobalApplicationsStatus, "APP_SQUID");
    $availableversion = $ini->_params["NEXT"]["squid32-{$ArchStruct}"];
    $actualversion = $sock->getFrameWork("squid.php?full-version=yes");
    if ($actualversion == null) {
        $actualversion = "0.0.0";
    }
    $availableversion_dansguardian = $ini->_params["NEXT"]["dansguardian2-{$ArchStruct}"];
    $actualversion_dansguardian = $sock->getFrameWork("squid.php?full-dans-version=yes");
    $html = "\n<H2>In dev progress, don't use ! - no 64 bits support...</H2>\n<div style='font-size:18px'>{current}:&nbsp;{APP_SQUID}:&nbsp;<strong>{$squid_version}</strong>&nbsp;&nbsp;|&nbsp;{architecture}:&nbsp;<strong>{$ArchStruct}</strong></div>\n<table style='width:100%;margin-top:15px'>\n<tbody>\n<tr>\n\t<td valign='top' width=1%><img src='img/bg_squid.jpg'></td>\n\t<td valign='top'>\n\t\t\t<table style='width:100%' class=form>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:14px'>{available_software}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{APP_SQUID2}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:14px'>&nbsp;</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$availableversion}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:14px'>{current}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$actualversion}</td>\n\t\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t</tbody>\n\t\t\t\t\n\t\t\t</table>\n\t\t\t<div style='font-size:12px'>{APP_SQUID_TEXT}</div>\n\t\t\t<p>&nbsp;</p>\n\t\t\t<span id='squid-install-status'></span>\n\t\t\t<div style='text-align:right;width:100%'>" . imgtootltip("refresh-24.png", "{refresh}", "squid_install_status()") . "</div>\n\t</td>\n</tr>\n\n<tr>\n\t<td colspan=2><hr></td>\n</tr>\n\n<tr>\n\t<td valign='top' width=1%><img src='img/bg_dansguardian.jpg'></td>\n\t<td valign='top'>\n\t\t\t<table style='width:100%' class=form>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:14px'>{available_software}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{APP_DANSGUARDIAN}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:14px'>&nbsp;</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$availableversion_dansguardian}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:14px'>{current}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$actualversion_dansguardian}</td>\n\t\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t</tbody>\n\t\t\t\t\n\t\t\t</table>\n\t\t\t<div style='font-size:12px'>{danseguardian_simple_intro}</div>\n\t\t\t<p>&nbsp;</p>\n\t\t\t<span id='dansguardian-install-status'></span>\n\t\t\t<div style='text-align:right;width:100%'>" . imgtootltip("refresh-24.png", "{refresh}", "dansguardian_install_status()") . "</div>\n\t</td>\n</tr>\n\n\n\n\n</tbody>\n</table>\n<script>\n\tfunction squid_install_status(){\n\t\tLoadAjaxTiny('squid-install-status','{$page}?install-status=yes&APPLI=APP_SQUID2');\n\t}\n\t\n\tfunction dansguardian_install_status(){\n\t\tLoadAjaxTiny('dansguardian-install-status','{$page}?install-status=yes&APPLI=APP_DANSGUARDIAN2');\n\t}\t\nsquid_install_status();\ndansguardian_install_status();\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}
예제 #2
0
function BuildRows($appli, $SockStatus, $internetkey, $noupgrade = false)
{
    $ini = new Bs_IniHandler();
    if ($GLOBALS["INDEXFF"] == null) {
        $GLOBALS["INDEXFF"] = @file_get_contents(dirname(__FILE__) . '/ressources/index.ini');
    }
    $ini->loadString($GLOBALS["INDEXFF"]);
    $tpl = new templates();
    $button_text = $tpl->_parse_body('{install_upgrade}');
    if (strlen($button_text) > 27) {
        $button_text = substr($button_text, 0, 24) . "...";
    }
    $bgcolor = "style='background-color:#DFFDD6'";
    $version = ParseAppli($SockStatus, $appli);
    $uninstall = ParseUninstall($SockStatus, $appli);
    if ($version == "0" or strlen($version) == 0) {
        $version = "{not_installed}";
        $bgcolor = null;
        $uninstall = null;
    }
    if (file_exists(dirname(__FILE__) . "/ressources/install/{$appli}.dbg")) {
        $dbg_exists = imgtootltip('22-logs.png', "{events}", "InstallLogs('{$appli}')");
        $styledbg = "background-color:yellow;border:1px solid black";
    } else {
        $dbg_exists = "<img src='img/fw_bold.gif'>";
    }
    $appli_text = $tpl->_ENGINE_parse_body("{{$appli}}");
    $appli_text = replace_accents($appli_text);
    if (strlen($appli_text) > 30) {
        $appli_text = texttooltip(substr($appli_text, 0, 27) . "...", $appli_text, null, null, 1);
    }
    $button_install = button($button_text, "ApplicationSetup('{$appli}')");
    if ($GLOBALS["ArticaMetaDisableSetupCenter"] == 1) {
        $button_install = null;
        $uninstall = null;
    }
    // UNINSTALL
    if ($uninstall != null) {
        $version = "<table><tr><td style='font-size:13px' valign='middle'>{$version}</td>\n\t\t\t<td valign='middle'>" . imgtootltip("ed_delete.gif", "{uninstall} {{$appli}}", "SetupCenterRemove('{$uninstall}','{$appli}')") . "</td></tr></table>";
    }
    if ($ini->_params["NEXT"]["{$internetkey}"] == null) {
        writelogs("Unable to stat NEXT/{$internetkey} \"{$ini->_params["NEXT"]["{$internetkey}"]}\"", __FUNCTION__, __FILE__, __LINE__);
        $ini->_params["NEXT"]["{$internetkey}"] = "<div style='color:#d32d2d'>{error_network}</div>";
        $button_install = null;
    }
    if ($internetkey == "openldap") {
        $sock = new sockets();
        if ($sock->GET_INFO("AllowUpgradeLdap") != 1) {
            $button_install = null;
        }
    }
    if ($noupgrade) {
        $button_install = null;
    }
    return "\n\t<tr {$bgcolor}>\n\t\t<td width=2% style=\"{$styledbg}\">{$dbg_exists}</td>\n\t\t<td style='font-size:13px' nowrap>{$appli_text}</td>\n\t\t<td style='font-size:13px'>{$version}</td>\n\t\t<td style='font-size:13px'>{$ini->_params["NEXT"]["{$internetkey}"]}</td>\n\t\t<td style='font-size:11px'>{$button_install}</td>\n\t\t<td style='font-size:13px'><div style='width:100px;height:22px;border:1px solid #CCCCCC' id='STATUS_{$appli}'>" . install_status($appli) . "</div></td>\n\t</tr>\n\t";
}
예제 #3
0
function install_status()
{
    $appname = $_GET["APPLI"];
    $users = new usersMenus();
    $page = CurrentPageName();
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $tpl = new templates();
    $dbg_exists = false;
    if (file_exists(dirname(__FILE__) . "/ressources/install/{$appname}.ini")) {
        $data = file_get_contents(dirname(__FILE__) . "/ressources/install/{$appname}.ini");
        $ini->loadString($data);
        $status = $ini->_params["INSTALL"]["STATUS"];
        $text_info = $ini->_params["INSTALL"]["INFO"];
        if (strlen($text_info) > 0) {
            $text_info = "<span style='color:black;font-size:10px'>{$text_info}...</span>";
        }
    } else {
        if ($appname == "APP_SQUID2") {
            if (file_exists(dirname(__FILE__) . "/ressources/install/APP_SQUID.ini")) {
                $data = file_get_contents(dirname(__FILE__) . "/ressources/install/{$appname}.ini");
                $ini->loadString($data);
                $status = $ini->_params["INSTALL"]["STATUS"];
                $text_info = $ini->_params["INSTALL"]["INFO"];
                if (strlen($text_info) > 0) {
                    $text_info = "<span style='color:black;font-size:10px'>{$text_info}...</span>";
                }
            }
        }
    }
    if ($status == null) {
        if ($appname == "APP_SQUID2") {
            if (file_exists(dirname(__FILE__) . "/ressources/install/APP_SQUID.ini")) {
                $data = file_get_contents(dirname(__FILE__) . "/ressources/install/{$appname}.ini");
                $ini->loadString($data);
                $status = $ini->_params["INSTALL"]["STATUS"];
                $text_info = $ini->_params["INSTALL"]["INFO"];
                if (strlen($text_info) > 0) {
                    $text_info = "<span style='color:black;font-size:10px'>{$text_info}...</span>";
                }
            }
        }
    }
    if ($appname == "APP_SQUID2") {
        $GlobalApplicationsStatus = $sock->APC_GET("GlobalApplicationsStatus", 2);
        if ($GlobalApplicationsStatus == null) {
            $GlobalApplicationsStatus = base64_decode($sock->getFrameWork('cmd.php?Global-Applications-Status=yes'));
            $sock->APC_SAVE("GlobalApplicationsStatus", $GlobalApplicationsStatus);
            $GLOBALS["GlobalApplicationsStatus"] = $GlobalApplicationsStatus;
        }
        $squid_version = ParseAppli($GlobalApplicationsStatus, "APP_SQUID");
        if (preg_match("#^([0-9]+)\\.([0-9]+)#", $squid_version, $re)) {
            $MAJOR = $re[1];
            $MINOR = $re[2];
        }
        if ($MAJOR == 3 && $MINOR == 1) {
            if ($users->LinuxDistriCode != "CENTOS") {
                $button31 = "<div style='margin-top:8px'>" . button("{install_upgrade} 3.1x", "Loadjs('setup.index.progress.php?product=APP_SQUID&start-install=yes')", 14) . "</div>";
            }
        }
    }
    if ($status == null) {
        $status = 0;
    }
    if ($status == 0) {
        if ($appname != "APP_SQUID2") {
            echo $tpl->_ENGINE_parse_body("<center style='margin:10px'>" . button("{install_upgrade}", "Loadjs('setup.index.progress.php?product={$appname}&start-install=yes')", 14) . "{$button31}</center>");
            return;
        } else {
            if ($users->LinuxDistriCode != "CENTOS") {
                echo $tpl->_ENGINE_parse_body("<center style='margin:10px'>" . button("{install_upgrade}", "Loadjs('setup.index.progress.php?product={$appname}&start-install=yes')", 14) . "{$button31}</center>");
            }
            return;
        }
    }
    if ($status > 100) {
        $color = "#D32D2D";
        $status = 100;
        $text = '{failed}';
    } else {
        $color = "#5DD13D";
        $text = $status . '%';
    }
    if ($status == 0) {
        $color = "transparent";
    }
    $pourc = pourcentage($status);
    $html = "\n\t<table style='width:100%'>\n\t<tbody>\n\t<tr>\n\t\t<td>{$pourc}</td>\n\t\t<td style='font-size:12px;font-weight:bold;background-color:{$color}'>{$text}&nbsp;{$text_info}</td>\n\t</tr>\n\t</tbody>\n\t</table>\n\t<script>\n\tLoadAjaxTiny('is31','{$page}?is31=yes');\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
예제 #4
0
function update_zoom()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $ini->loadString(@file_get_contents(dirname(__FILE__) . '/ressources/index.ini'));
    $users = new usersMenus();
    $ArchStruct = $users->ArchStruct;
    if ($ArchStruct == "32") {
        $ArchStruct = "i386";
    }
    if ($ArchStruct == "64") {
        $ArchStruct = "x64";
    }
    $GlobalApplicationsStatus = $sock->APC_GET("GlobalApplicationsStatus", 2);
    if ($GlobalApplicationsStatus == null) {
        $GlobalApplicationsStatus = base64_decode($sock->getFrameWork('cmd.php?Global-Applications-Status=yes'));
        $sock->APC_SAVE("GlobalApplicationsStatus", $GlobalApplicationsStatus);
        $GLOBALS["GlobalApplicationsStatus"] = $GlobalApplicationsStatus;
    }
    $squid_version = ParseAppli($GlobalApplicationsStatus, "APP_SQUID");
    $availableversion32 = $ini->_params["NEXT"]["squid32-i386"];
    $availableversion64 = $ini->_params["NEXT"]["squid32-x64"];
    $availableversion_ufdbguard = $ini->_params["NEXT"]["ufdbGuard"];
    $actualversion_ufdbguard = $sock->getFrameWork("squid.php?full-ufdbg-version=yes");
    if ($actualversion_ufdbguard == null) {
        $actualversion_ufdbguard = "0.0.0";
    }
    $availableversion_kav4proxy = $ini->_params["NEXT"]["kav4proxy"];
    $actualversion_kav4proxy = ParseAppli($GlobalApplicationsStatus, "APP_KAV4PROXY");
    if ($actualversion_kav4proxy == null) {
        $actualversion_kav4proxy = "0.0.0";
    }
    $q = new blackboxes();
    $availableversion32 = $q->last_available_squidx32_version();
    $availableversion64 = $q->last_available_squidx64_version();
    $html = "\n<div style='width:100%;height:650px;overflow:auto'>\n\n<table style='width:100%;margin-top:15px'>\n<tbody>\n<tr>\n\t<td valign='top' width=1%><img src='img/artica-350px.png'>\n\t\t\t\t<table style='width:99%' class=form>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available_software}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{APP_ARTICA_AGENT}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available} 32/64bits:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>" . $q->last_available_version() . "</td>\n\t\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\n\t</td>\n\t<td valign='top'>\n\n\t\t\t<div style='font-size:12px'>{APP_ARTICA_AGENT_TEXT}</div>\n\t\t\t<p>&nbsp;</p>\n\t\t\t<center style='margin:10px'>" . button("{install_upgrade}", "Loadjs('setup.index.progress.php?product=APP_ARTICA_AGENT&start-install=yes')", 14) . "</center>\n\t</td>\n</tr>\n\n\n<table style='width:100%;margin-top:15px'>\n<tbody>\n<tr>\n\t<td valign='top' width=1%><img src='img/bg_squid.jpg'>\n\t\t\t\t<table style='width:99%' class=form>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available_software}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{APP_SQUID2}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available} 32bits:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$availableversion32}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available} 64bits:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$availableversion64}</td>\n\t\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\n\t</td>\n\t<td valign='top'>\n\n\t\t\t<div style='font-size:12px'>{APP_SQUID_TEXT}</div>\n\t\t\t<p>&nbsp;</p>\n\t\t\t<center style='margin:10px'>" . button("{install_upgrade}", "Loadjs('setup.index.progress.php?product=APP_SQUID32_REPOS&start-install=yes')", 14) . "</center>\n\t</td>\n</tr>\n\n<tr>\n\t<td colspan=2><hr></td>\n</tr>\n<tr>\n\t<td valign='top' width=1%><img src='img/bg_kav4proxy.jpg'>\n\t\t\t\t<table style='width:99%' class=form>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available_software}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{APP_KAV4PROXY}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$availableversion_kav4proxy}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{current}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$actualversion_kav4proxy}</td>\n\t\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t</tbody>\n\t\t\t\t\n\t\t\t</table>\n\t\n\t</td>\n\t<td valign='top'>\n\n\t\t\t<div style='font-size:12px'>{APP_KAV4PROXY_TEXT}</div>\n\t\t\t<p>&nbsp;</p>\n\t\t\t<span id='kav4proxy-install-status'></span>\n\t\t\t<div style='text-align:right;width:100%'>" . imgtootltip("refresh-24.png", "{refresh}", "kav4proxy_install_status()") . "</div>\n\t</td>\n</tr>\n<tr>\n\t<td colspan=2><hr></td>\n</tr>\n<tr>\n\t<td colspan=2><hr></td>\n</tr>\n\n<tr>\n\t<td valign='top' width=1%><img src='img/bg_ufdbguard.png'>\n\t\t\t\t<table style='width:99%' class=form>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available_software}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{APP_UFDBGUARD}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$availableversion_ufdbguard}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{current}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$actualversion_ufdbguard}</td>\n\t\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\n\t</td>\n\t<td valign='top'>\n\n\t\t\t<div style='font-size:12px'>{ufdbguard_simple_intro}</div>\n\t\t\t<p>&nbsp;</p>\n\t\t\t<span id='ufdbguard-install-status'></span>\n\t\t\t<div style='text-align:right;width:100%'>" . imgtootltip("refresh-24.png", "{refresh}", "ufdbguard_install_status()") . "</div>\n\t</td>\n</tr>\n\n\n\n</tbody>\n</table>\n</div>\n<script>\n\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}
예제 #5
0
function ParseProducts()
{
    $unix = new unix();
    if (!$GLOBALS["FORCE"]) {
        $TimePid = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . md5(__FUNCTION__) . ".time";
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . md5(__FUNCTION__) . ".pid";
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $timefile = $unix->file_time_min($pidfile);
            system_admin_events(basename(__FILE__) . ": Already executed pid {$pid} since {$timefile} minutes.. aborting the process", "MAIN", __FILE__, __LINE__, "setup");
            die;
        }
        if ($GLOBALS["VERBOSE"]) {
            "->isMaxInstances()\n";
        }
        if ($unix->isMaxInstances()) {
            if ($GLOBALS["VERBOSE"]) {
                "->isMaxInstances -> TRUE -> DIE\n";
            }
            die;
        }
        $timefile = $unix->file_time_min($TimePid);
        if ($timefile < 30) {
            return;
        }
    }
    @unlink($timefile);
    @file_put_contents($timefile, time());
    if ($GLOBALS["FORCE"]) {
        echo "Scanning local softwares....\n";
        shell_exec("/usr/share/artica-postfix/bin/artica-install --write-versions >/dev/null 2>&1");
    }
    $q = new mysql();
    if (!$q->TABLE_EXISTS("setup_center", "artica_backup")) {
        $q->BuildTables();
    }
    if (!$q->TABLE_EXISTS("setup_center", "artica_backup", true)) {
        echo "setup_center no such table\n";
        return;
    }
    $index_ini = dirname(__FILE__) . '/ressources/index.ini';
    if (!is_file($index_ini)) {
        shell_exec("/usr/share/artica-postfix/bin/artica-update --index");
    }
    if (!is_file($index_ini)) {
        echo "{$index_ini} no such file\n";
        return;
    }
    $Softs = GetProductsArray();
    BuildVersions();
    if (!isset($GLOBALS["INDEXFF"])) {
        $GLOBALS["INDEXFF"] = null;
    }
    if ($GLOBALS["INDEXFF"] == null) {
        $GLOBALS["INDEXFF"] = @file_get_contents($index_ini);
    }
    $ini = new Bs_IniHandler();
    if ($GLOBALS["VERBOSE"]) {
        echo "INDEFF =  " . strlen($GLOBALS["INDEXFF"]) . " bytes..\n";
    }
    $ini->loadString($GLOBALS["INDEXFF"]);
    if (count($ini->_params["NEXT"]) < 5) {
        echo "{$index_ini} corrupted\n";
        return;
    }
    if ($GLOBALS["GLOBAL_VERSIONS_CONF"] < 3) {
        echo "ressources/logs/global.versions.conf corrupted\n";
        return;
    }
    $t = time();
    while (list($num, $ProductsArray) = each($Softs)) {
        $CODE_NAME = $ProductsArray["PRODUCT_CODE"];
        $CurrentVersion = ParseAppli($CODE_NAME);
        $NextVersion = $ini->_params["NEXT"][$ProductsArray["REPO_CODE"]];
        if (!isset($ProductsArray["ABOUT"])) {
            $ProductsArray["ABOUT"] = null;
        }
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `CODE_NAME` FROM setup_center WHERE `CODE_NAME`='{$CODE_NAME}'", "artica_backup"));
        $ttA[] = "{$CODE_NAME}: Current version: [{$CurrentVersion}], available: [{$NextVersion}]";
        $sql = "UPDATE setup_center SET `curversionstring`='{$CurrentVersion}',`nextversionstring`='{$NextVersion}' ,`CODE_NAME_ABOUT`='{$ProductsArray["ABOUT"]}' WHERE `CODE_NAME`='{$CODE_NAME}'";
        if (trim($ligne["CODE_NAME"]) == null) {
            $sql = "INSERT INTO setup_center (`CODE_NAME`,`curversionstring`,`nextversionstring`,`REPO_CODE`,`FAMILY`,`SUBFAMILY`,`CODE_NAME_ABOUT`) \n\t\t\t\tVALUES ('{$CODE_NAME}','{$CurrentVersion}','{$NextVersion}','{$ProductsArray["REPO_CODE"]}','{$ProductsArray["FAMILY"]}','{$ProductsArray["SUBFAMILY"]}','{$ProductsArray["ABOUT"]}')";
        }
        $q->QUERY_SQL($sql, "artica_backup");
        if (!$q->ok) {
            if (preg_match("#Error Unknown column#", $q->mysql_error)) {
                $q->BuildTables();
            }
        }
        echo "{$CODE_NAME}: {$CurrentVersion} <> {$NextVersion} \n";
    }
    $ttA_md5 = md5(serialize($ttA));
    $sock = new sockets();
    $ttACache = $sock->GET_INFO("SoftwaresListCached");
    if ($ttA_md5 != $ttACache) {
        $took = $unix->distanceOfTimeInWords($t, time(), true);
        system_admin_events("INFO, " . count($ttA) . " softwares parsed, took: {$took}\n" . @implode($ttA, "\n"), __FUNCTION__, __FILE__, __LINE__, "setup");
        $sock->SET_INFO("SoftwaresListCached", $ttA_md5);
    }
}
예제 #6
0
function BuildRows($appli, $SockStatus, $internetkey, $noupgrade = false)
{
    $ini = new Bs_IniHandler();
    $ini->loadFile(dirname(__FILE__) . '/ressources/index.ini');
    $tpl = new templates();
    $button_text = $tpl->_parse_body('{install_upgrade}');
    if (strlen($button_text) > 27) {
        $button_text = substr($button_text, 0, 24) . "...";
    }
    $bgcolor = "style='background-color:#DFFDD6'";
    $version = ParseAppli($SockStatus, $appli);
    $uninstall = ParseUninstall($SockStatus, $appli);
    if ($version == "0" or strlen($version) == 0) {
        $version = "{not_installed}";
        $bgcolor = null;
        $uninstall = null;
    }
    if (file_exists(dirname(__FILE__) . "/ressources/install/{$appli}.dbg")) {
        $dbg_exists = imgtootltip('22-logs.png', "{events}", "InstallLogs('{$appli}')");
        $styledbg = "background-color:yellow;border:1px solid black";
    } else {
        $dbg_exists = "<img src='img/fw_bold.gif'>";
    }
    $appli_text = $tpl->javascript_parse_text("{{$appli}}");
    $appli_text = html_entity_decode($appli_text, ENT_QUOTES, "UTF-8");
    if (strlen($appli_text) > 30) {
        $appli_text = texttooltip(htmlentities(substr($appli_text, 0, 27)) . "...", htmlentities($appli_text), null, null, 1);
    }
    $button_install = button($button_text, "ApplicationSetup('{$appli}')");
    // UNINSTALL
    if ($uninstall != null) {
        $version = "<table><tr><td style='font-size:13px' valign='middle'>{$version}</td>\n\t\t\t<td valign='middle'>" . imgtootltip("ed_delete.gif", "{uninstall} {{$appli}}", "SetupCenterRemove('{$uninstall}','{$appli}')") . "</td></tr></table>";
    }
    if ($ini->_params["NEXT"]["{$internetkey}"] == null) {
        $ini->_params["NEXT"]["{$internetkey}"] = "<div style='color:red'>{error_network}</div>";
        $button_install = null;
    }
    if ($noupgrade) {
        $button_install = null;
    }
    return "\n\t<tr {$bgcolor}>\n\t\t<td width=2% style=\"{$styledbg}\">{$dbg_exists}</td>\n\t\t<td style='font-size:13px' nowrap>{$appli_text}</td>\n\t\t<td style='font-size:13px'>{$version}</td>\n\t\t<td style='font-size:13px'>{$ini->_params["NEXT"]["{$internetkey}"]}</td>\n\t\t<td style='font-size:11px'>{$button_install}</td>\n\t\t<td style='font-size:13px'><div style='width:100px;height:22px;border:1px solid #CCCCCC' id='STATUS_{$appli}'>" . install_status($appli) . "</div></td>\n\t</tr>\n\t";
}