Beispiel #1
0
function auth_verif()
{
    $tpl = new templates();
    $u = new user($_POST["username-logon"]);
    $userPassword = $u->password;
    if (trim($u->uidNumber) == null) {
        writelogs('Unable to get user infos abort', __FUNCTION__, __FILE__);
        echo $tpl->_ENGINE_parse_body("<center><H2 style='color:red'>{unknown_user}</H2></center>");
        return null;
    }
    if (trim($_POST["username-password"]) == trim($userPassword)) {
        $ldap = new clladp();
        $users = new usersMenus();
        $privs = new privileges($u->uid);
        $privileges_array = $privs->privs;
        $_SESSION["InterfaceType"] = "{ARTICA_MINIADM}";
        setcookie("mem-logon-user", $_POST["username-logon"], time() + 172800);
        $_SESSION["privileges_array"] = $privs->privs;
        $_SESSION["privs"] = $privileges_array;
        $_SESSION["OU_LANG"] = $privileges_array["ForceLanguageUsers"];
        $_SESSION["uid"] = $_POST["username-logon"];
        $_SESSION["passwd"] = $_POST["username-logon"];
        $_SESSION["privileges"]["ArticaGroupPrivileges"] = $privs->content;
        $_SESSION["groupid"] = $ldap->UserGetGroups($_POST["artica_username"], 1);
        $_SESSION["DotClearUserEnabled"] = $u->DotClearUserEnabled;
        $_SESSION["MailboxActive"] = $u->MailboxActive;
        $_SESSION["ou"] = $u->ou;
        $_SESSION["UsersInterfaceDatas"] = trim($u->UsersInterfaceDatas);
        $lang = new articaLang();
        writelogs("[{$_POST["username-logon"]}]: Default organization language={$_SESSION["OU_LANG"]}", __FUNCTION__, __FILE__);
        if (trim($_SESSION["OU_LANG"]) != null) {
            $_SESSION["detected_lang"] = $_SESSION["OU_LANG"];
            setcookie("artica-language", $_SESSION["OU_LANG"], time() + 172800);
        } else {
            setcookie("artica-language", $_POST["lang"], time() + 172800);
            $_SESSION["detected_lang"] = $lang->get_languages();
        }
        echo "<script>\n\t\t\tYahooWinHide();\n\t\t\tLoadAjax('BodyContent','miniadm.index.php');\n\t\t</script>\n\t\t";
        return;
    } else {
        echo $tpl->_ENGINE_parse_body("<center><H2 style='color:red'>{bdu}</H2></center>");
    }
}
<?php

session_start();
include_once dirname(__FILE__) . "/ressources/class.mini.admin.inc";
include_once dirname(__FILE__) . "/ressources/class.langages.inc";
include_once dirname(__FILE__) . "/ressources/class.templates.inc";
include_once dirname(__FILE__) . "/ressources/class.user.inc";
include_once dirname(__FILE__) . "/ressources/class.langages.inc";
include_once dirname(__FILE__) . "/ressources/class.groups.inc";
if (!isset($_SESSION["detected_lang"])) {
    unset($_SESSION["LANG_FILES"]);
    unset($_SESSION["TRANSLATE"]);
    unset($_SESSION["translation"]);
    $lang = new articaLang();
    $_SESSION["detected_lang"] = $lang->get_languages();
    setcookie("artica-language", $_SESSION["detected_lang"], time() + 172800);
}
if (isset($_GET["confirm"])) {
    confirm();
    exit;
}
if (isset($_GET["create-ou"])) {
    create_ou();
    exit;
}
if (isset($_GET["create-domain"])) {
    create_domain();
    exit;
}
if (isset($_GET["create-user"])) {
    create_user();
Beispiel #3
0
function parseTemplate_build_main($ARRAY)
{
    $sock = new sockets();
    $page = CurrentPageName();
    if (!isset($GLOBALS["ARTICA_VERSION"])) {
        $GLOBALS["ARTICA_VERSION"] = null;
    }
    if ($GLOBALS["ARTICA_VERSION"] == null) {
        $GLOBALS["ARTICA_VERSION"] = trim(@file_get_contents(dirname(__FILE__) . "/VERSION"));
    }
    $version = $GLOBALS["ARTICA_VERSION"];
    $FOOTER = null;
    $users = new usersMenus();
    $HOST = $ARRAY["HOST"];
    $URL = $ARRAY["URL"];
    $IPADDR = $ARRAY["IPADDR"];
    $REASONGIVEN = $ARRAY["REASONGIVEN"];
    $_CATEGORIES_K = $ARRAY["CATEGORY"];
    $_RULE_K = $ARRAY["RULE"];
    $targetgroup = $ARRAY["targetgroup"];
    $IpToUid = $ARRAY["IpToUid"];
    $SquidGuardIPWeb = base64_decode($_GET["SquidGuardIPWeb"]);
    $client_username = $ARRAY["clientname"];
    $hostname = $sock->GET_INFO("myhostname");
    $ARRAY["Proxy Server"] = $hostname;
    $sock->BuildTemplatesConfig($ARRAY);
    $EnableSquidGuardMicrosoftTPL = intval($sock->GET_INFO("EnableSquidGuardMicrosoftTPL"));
    $SquidHTTPTemplateSmiley = intval($GLOBALS["UfdbGuardHTTP"]["SquidHTTPTemplateSmiley"]);
    if ($GLOBALS["VERBOSE"]) {
        echo "<div style='background-color:white'>";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "<li style='color:black'>" . __CLASS__ . "/" . __LINE__ . ":UfdbGuardHTTPNoVersion: {$GLOBALS["UfdbGuardHTTP"]["NoVersion"]}</li>";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "<li style='color:black'>" . __CLASS__ . "/" . __LINE__ . ":SquidHTTPTemplateSmileyEnable: {$GLOBALS["UfdbGuardHTTP"]["SquidHTTPTemplateSmileyEnable"]} / {$GLOBALS["UfdbGuardHTTP"]["SquidHTTPTemplateSmiley"]}</li>";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "</div>";
    }
    if (!isset($GLOBALS["UfdbGuardHTTP"]["SquidHTTPTemplateSmileyEnable"])) {
        $SquidHTTPTemplateSmileyEnable = 1;
    } else {
        $SquidHTTPTemplateSmileyEnable = $GLOBALS["UfdbGuardHTTP"]["SquidHTTPTemplateSmileyEnable"];
    }
    $BackgroundColorBLKBT = $GLOBALS["UfdbGuardHTTP"]["BackgroundColorBLKBT"];
    if (!is_numeric($SquidHTTPTemplateSmiley)) {
        $SquidHTTPTemplateSmiley = 2639;
    }
    if ($IPADDR == null) {
        $IPADDR = parseTemplate_GET_REMOTE_ADDR();
    }
    if ($HOST == null) {
        $HOST = $_SERVER["HTTP_HOST"];
    }
    if ($URL == null) {
        $proto = "http";
        if (isset($_SERVER["HTTPS"])) {
            if ($_SERVER["HTTPS"] == "on") {
                $proto = "https";
            }
        }
        $URL = "{$proto}://{$HOST}{$_SERVER["REQUEST_URI"]}";
    }
    if ($SquidGuardIPWeb == null) {
        $SquidGuardIPWeb = $sock->GET_INFO("SquidGuardIPWeb");
        $SquidGuardServerName = $sock->GET_INFO("SquidGuardServerName");
        $SquidGuardApachePort = intval($sock->GET_INFO("SquidGuardApachePort"));
        if ($SquidGuardApachePort == 0) {
            $SquidGuardApachePort = 9020;
        }
        if (!preg_match("#\\/\\/(.+?):{$SquidGuardApachePort}#", $SquidGuardIPWeb)) {
            if ($SquidGuardServerName != null) {
                $SquidGuardIPWeb = "http://{$SquidGuardServerName}:{$SquidGuardApachePort}";
            }
        }
    }
    if (strpos($SquidGuardIPWeb, $page) == 0) {
        if ($GLOBALS["VERBOSE"]) {
            echo "<H1>SquidGuardIPWeb = {$SquidGuardIPWeb} require {$page}</H1>";
        }
        $SquidGuardIPWeb = "{$SquidGuardIPWeb}/{$page}";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "<H1>{$SquidGuardIPWeb}</H1>";
    }
    $UfdbGuardHTTPUnbblockMaxTime = intval($sock->GET_INFO("UfdbGuardHTTPUnbblockMaxTime"));
    $UfdbGuardHTTPDisableHostname = intval($sock->GET_INFO("UfdbGuardHTTPDisableHostname"));
    $UfdbGuardHTTPUnbblockText2 = $sock->GET_INFO("UfdbGuardHTTPUnbblockText2");
    $UfdbGuardHTTPEnablePostmaster = $GLOBALS["UfdbGuardHTTP"]["EnablePostmaster"];
    $UfdbGuardHTTPNoVersion = $GLOBALS["UfdbGuardHTTP"]["NoVersion"];
    $UfdbGuardHTTPAllowUnblock = $GLOBALS["UfdbGuardHTTP"]["AllowUnblock"];
    if ($UfdbGuardHTTPEnablePostmaster == 1) {
        $emailTemplate = "URL:{$_GET["url"]}\nIP:{$_GET["clientaddr"]}\nREASON:{$REASONGIVEN}\nCategory:{$_CATEGORIES_K}\nrule:{$_RULE_K}";
        $Postmaster = parseadmin($emailTemplate, $URL);
    }
    $UfdbGuardHTTPAllowSMTP = intval($sock->GET_INFO("UfdbGuardHTTPAllowSMTP"));
    if ($UfdbGuardHTTPAllowSMTP == 1) {
        $UfdbGuardHTTPEnablePostmaster = 1;
        $Postmaster = parseTemplate_smtp_button($ARRAY, $SquidGuardIPWeb);
    }
    if (!isset($GLOBALS["UfdbGuardHTTP"]["FOOTER"])) {
        $GLOBALS["UfdbGuardHTTP"]["FOOTER"] = null;
    }
    $FOOTER = $GLOBALS["UfdbGuardHTTP"]["FOOTER"];
    $UFDBGUARD_TITLE_1 = $GLOBALS["UfdbGuardHTTP"]["UFDBGUARD_TITLE_1"];
    $UFDBGUARD_PARA1 = $GLOBALS["UfdbGuardHTTP"]["UFDBGUARD_PARA1"];
    $UFDBGUARD_PARA2 = $GLOBALS["UfdbGuardHTTP"]["UFDBGUARD_PARA2"];
    $UFDBGUARD_TITLE_2 = $GLOBALS["UfdbGuardHTTP"]["UFDBGUARD_TITLE_2"];
    $UFDBGUARD_UNLOCK_LINK = $GLOBALS["UfdbGuardHTTP"]["UFDBGUARD_UNLOCK_LINK"];
    $UFDBGUARD_TICKET_LINK = $GLOBALS["UfdbGuardHTTP"]["UFDBGUARD_TICKET_LINK"];
    $UfdbGuardHTTPDisableHostname = $GLOBALS["UfdbGuardHTTP"]["UfdbGuardHTTPDisableHostname"];
    if ($GLOBALS["VERBOSE"]) {
        echo "<div style='background-color:white'>";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "<li style='color:black'>UfdbGuardHTTPDisableHostname: {$UfdbGuardHTTPDisableHostname}</li>";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "<li style='color:black'>UfdbGuardHTTPNoVersion: {$UfdbGuardHTTPNoVersion}</li>";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "</div>";
    }
    $f[] = parseTemplate_headers("{$UFDBGUARD_TITLE_1} - {$_CATEGORIES_K}", null, $SquidGuardIPWeb);
    $f2[] = microsoft_ufdb_template("{$UFDBGUARD_TITLE_1}", null, $SquidGuardIPWeb);
    $f2[] = "<p style='font-size:25px'>{$REASONGIVEN}</p>";
    if ($SquidHTTPTemplateSmileyEnable == 1) {
        $f[] = "    <h1 class=bad></h1>";
    }
    if (trim(strtolower($UFDBGUARD_TITLE_1)) != "none") {
        $f[] = "    <h2>{$UFDBGUARD_TITLE_1}</h2>    ";
    }
    $f[] = "    <h2>{$REASONGIVEN}</h2>    ";
    if (trim(strtolower($UFDBGUARD_PARA1)) != "none") {
        $f[] = "    <p>{$UFDBGUARD_PARA1}</p>";
        $f2[] = "    <p>{$UFDBGUARD_PARA1}</p>";
    }
    if (trim(strtolower($UFDBGUARD_TITLE_2)) != "none") {
        $f[] = "    <h3>{$UFDBGUARD_TITLE_2}</h3>";
        $f2[] = "    <p style='font-size:25px'>{$UFDBGUARD_TITLE_2}</p>";
    }
    if (trim(strtolower($UFDBGUARD_PARA2)) != "none") {
        $f[] = "    <p>{$UFDBGUARD_PARA2}</p>    ";
        $f2[] = "    <p>{$UFDBGUARD_PARA2}</p>";
    }
    $f[] = "    ";
    $f[] = "    <div id=\"info\">";
    $f[] = "    <table width='100%'>";
    if ($client_username != null) {
        $members[] = $client_username;
    }
    $members[] = $IPADDR;
    if ($HOST != null) {
        $members[] = $HOST;
    }
    if (trim($IpToUid) != null) {
        $members[] = $IpToUid;
    }
    if (count($members) > 0) {
        while (list($num, $ligne) = each($members)) {
            $AAAA[$ligne] = true;
        }
        $members = array();
        while (list($num, $ligne) = each($AAAA)) {
            $members[] = $num;
        }
    }
    $membersTX = @implode(", ", $members);
    $f2[] = "<UL class=\"tasks\" id=\"cantDisplayTasks\">";
    if ($UfdbGuardHTTPDisableHostname == 0) {
        $hostname = $sock->GET_INFO("myhostname");
        if ($hostname == null) {
            $hostname = $sock->getFrameWork("system.php?hostname-g=yes");
            $sock->SET_INFO($hostname, "myhostname");
        }
        $f[] = "        <tr><td class=\"info_title\">{proxy_server}:</td><td class=\"info_content\">{$hostname}</td></tr>";
        $f2[] = "<li><strong>{proxy_server}</strong>: {$hostname}</li>";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "<span style='font-size:16px'>UfdbGuardHTTPEnablePostmaster:{$UfdbGuardHTTPEnablePostmaster}</span><br>\n";
    }
    if ($UfdbGuardHTTPEnablePostmaster == 1) {
        $f[] = "        <tr><td class=\"info_title\">{administrator}:</td><td class=\"info_content\">{$Postmaster}</td></tr>";
        $f2[] = "<li><strong>{administrator}</strong>: {$Postmaster}</li>";
    }
    if ($UfdbGuardHTTPNoVersion == 0) {
        $f2[] = "<li><strong>{application}</strong>: Version {$version}</li>";
        $f[] = "        <tr><td class=\"info_title\">{application}:</td><td class=\"info_content\">Version {$version}</td></tr>";
    }
    if ($targetgroup == "restricted_time") {
        $targetgroup = "{restricted_access}";
    }
    $f2[] = "<li><strong>{member}</strong>: {$membersTX}</li>";
    $f2[] = "<li><strong>{policy}</strong>: {$_RULE_K}, {$targetgroup}</li>";
    $f2[] = "<li><strong>{requested_uri}</strong>: {$URL}</li>";
    $f[] = "        <tr><td class=\"info_title\">{member}:</td><td class=\"info_content\">{$membersTX}</td></tr>";
    $f[] = "        <tr><td class=\"info_title\">{policy}:</td><td class=\"info_content\">{$_RULE_K}, {$targetgroup}</td></tr>";
    $f[] = "        <tr>";
    $f[] = "            <td class=\"info_title\" nowrap>{requested_uri}:</td>";
    $f[] = "            <td class=\"info_content\">";
    $f[] = "                <div class=\"break-word\">{$URL}</div>";
    $f[] = "            </td>";
    $f[] = "        </tr>";
    $f[] = "    </table>";
    $NOUNBLOCK = false;
    if (isset($_GET["fatalerror"])) {
        $NOUNBLOCK = true;
    }
    if (isset($_GET["loading-database"])) {
        $NOUNBLOCK = true;
    }
    $AllowTicket = 0;
    $q = new mysql_squid_builder();
    $CountOfufdb_page_rules = $q->COUNT_ROWS("ufdb_page_rules");
    parseTemplate_debug("ufdb_page_rules: {$CountOfufdb_page_rules}", __LINE__);
    if ($CountOfufdb_page_rules > 0) {
        include_once dirname(__FILE__) . "/ressources/class.ufdb.parsetemplate.inc";
        $unlock = new parse_template_ufdb();
        if ($GLOBALS["VERBOSE"]) {
            echo "<hr style='border-color:#35CA61'>\n";
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "<span style='color:#35CA61'>UfdbGuardHTTPAllowUnblock={$UfdbGuardHTTPAllowUnblock}</span><br>\n";
        }
        $UfdbGuardHTTPAllowUnblock = $unlock->parseTemplate_unlock_privs($ARRAY, "allow=1", $UfdbGuardHTTPAllowUnblock);
        if ($GLOBALS["VERBOSE"]) {
            echo "<span style='color:#35CA61'>allow: UfdbGuardHTTPAllowUnblock={$UfdbGuardHTTPAllowUnblock}</span><br>\n";
        }
        $UfdbGuardHTTPAllowUnblock = $unlock->parseTemplate_unlock_privs($ARRAY, "deny=1", $UfdbGuardHTTPAllowUnblock);
        if ($GLOBALS["VERBOSE"]) {
            echo "<span style='color:#35CA61'>Deny: UfdbGuardHTTPAllowUnblock={$UfdbGuardHTTPAllowUnblock}</span><br>\n";
        }
        $AllowTicket = $unlock->parseTemplate_unlock_privs($ARRAY, "ticket=1", 0);
        if ($AllowTicket == 1) {
            $UfdbGuardHTTPAllowUnblock = 0;
        }
    }
    $f2[] = "</ul>";
    if ($UfdbGuardHTTPAllowUnblock == 1) {
        if (!$NOUNBLOCK) {
            $URL_ENCODED = urlencode($URL);
            $IPADDR_ENCODE = urlencode($IPADDR);
            $page = CurrentPageName();
            $SquidGuardIPWeb_enc = urlencode($SquidGuardIPWeb);
            $unlock_web_site_text = "{unlock_web_site}";
            if ($UFDBGUARD_UNLOCK_LINK != null) {
                $unlock_web_site_text = $UFDBGUARD_UNLOCK_LINK;
            }
            if (isset($GLOBALS["RULE_MAX_TIME"])) {
                $ARRAY["RULE_MAX_TIME"] = $GLOBALS["RULE_MAX_TIME"];
            }
            $ARRAY_SERIALIZED = urlencode(base64_encode(serialize($ARRAY)));
            $unlock_text = "<p>{$GLOBALS["UfdbGuardHTTP"]["UnbblockText1"]}</p>\n\t\t\t<div style='text-align:right;border-top:1px solid {$GLOBALS["UfdbGuardHTTP"]["FontColor"]};padding-top:5px'>\n\t\t\t<a href='{$SquidGuardIPWeb}?unlock=yes&url={$URL_ENCODED}&ipaddr={$IPADDR_ENCODE}&SquidGuardIPWeb={$SquidGuardIPWeb_enc}&clientname={$ARRAY["clientame"]}&serialize={$ARRAY_SERIALIZED}' class=important>\n\t\t\t{$unlock_web_site_text}</a></div>";
            $f[] = $unlock_text;
            $f2[] = $unlock_text;
        }
    }
    if ($AllowTicket == 1) {
        $URL_ENCODED = urlencode($URL);
        $IPADDR_ENCODE = urlencode($IPADDR);
        $page = CurrentPageName();
        $SquidGuardIPWeb_enc = urlencode($SquidGuardIPWeb);
        $ticket_web_site_text = "{submit_a_ticket}";
        if ($UFDBGUARD_TICKET_LINK != null) {
            $ticket_web_site_text = $UFDBGUARD_TICKET_LINK;
        }
        $ARRAY_SERIALIZED = urlencode(base64_encode(serialize($ARRAY)));
        $unlock_text = "<p>{$GLOBALS["UfdbGuardHTTP"]["TICKET_TEXT"]}</p>\n\t\t<div style='text-align:right;border-top:1px solid {$GLOBALS["UfdbGuardHTTP"]["FontColor"]};padding-top:5px'>\n\t\t<a href='{$SquidGuardIPWeb}?ticket=yes&url={$URL_ENCODED}&ipaddr={$IPADDR_ENCODE}&SquidGuardIPWeb={$SquidGuardIPWeb_enc}&clientname={$ARRAY["clientame"]}&serialize={$ARRAY_SERIALIZED}' class=important>\n\t\t{$ticket_web_site_text}</a></div>";
        $f[] = $unlock_text;
        $f2[] = $unlock_text;
    }
    $f2[] = "{$FOOTER}</DIV>";
    $f2[] = "</DIV>";
    $f2[] = "</BODY>";
    $f2[] = "</HTML>";
    if (!isset($_SESSION["UFDB_PAGE_LANG"])) {
        if (!class_exists("articaLang")) {
            include_once dirname(__FILE__) . "/ressources/class.langages.inc";
        }
        $langAutodetect = new articaLang();
        $_SESSION["UFDB_PAGE_LANG"] = $langAutodetect->get_languages();
    }
    $tpl = new templates();
    $tpl->language = $_SESSION["UFDB_PAGE_LANG"];
    if ($EnableSquidGuardMicrosoftTPL == 1) {
        return $tpl->_ENGINE_parse_body(@implode("\n", $f2));
    }
    $f[] = "    </div>    {$FOOTER}";
    $f[] = "</div>";
    $f[] = "</body>";
    $f[] = "<!-- ";
    while (list($num, $ligne) = each($ARRAY)) {
        $f[] = "    {$num} = {$ligne}";
    }
    $f[] = " Language : {$tpl->language}";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $f[] = "-->";
    $f[] = "</html>";
    return $tpl->_ENGINE_parse_body(@implode("\n", $f));
}
Beispiel #4
0
function authenticate()
{
    error_log("1) Auth user:{$_SERVER['PHP_AUTH_USER']} password:{$_SERVER['PHP_AUTH_PW']}");
    if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['PHP_AUTH_PW'])) {
        return false;
    }
    $_POST["artica_username"] = $_SERVER['PHP_AUTH_USER'];
    $_POST["artica_password"] = $_SERVER['PHP_AUTH_PW'];
    include "ressources/settings.inc";
    if ($_POST["artica_username"] == $_GLOBAL["ldap_admin"]) {
        if ($_POST["artica_password"] != $_GLOBAL["ldap_password"]) {
            artica_mysql_events("Failed to logon on the Artica Web console from {$_SERVER["REMOTE_HOST"]}", @implode("\n", $notice), "security", "security");
            return false;
        } else {
            artica_mysql_events("Success to logon on the Artica Web console from {$_SERVER["REMOTE_HOST"]} as SuperAdmin", @implode("\n", $notice), "security", "security");
            //session_start();
            $_SESSION["uid"] = '-100';
            $_SESSION["groupid"] = '-100';
            $_SESSION["passwd"] = $_POST["artica_password"];
            setcookie("artica-language", $_POST["lang"], time() + 172800);
            $_SESSION["detected_lang"] = $_POST["lang"];
            $_SESSION["privileges"]["ArticaGroupPrivileges"] = '
			[AllowAddGroup]="yes"
			[AllowAddUsers]="yes"
			[AllowChangeKav]="yes"
			[AllowChangeKas]="yes"
			[AllowChangeUserPassword]="yes"
			[AllowEditAliases]="yes"
			[AllowEditAsWbl]="yes"
			[AsSystemAdministrator]="yes"
			[AsPostfixAdministrator]="yes"
			[AsArticaAdministrator]="yes"
			';
            return true;
        }
    }
    writelogs('This is not Global admin, so test user...', __FUNCTION__, __FILE__);
    $u = new user($_POST["artica_username"]);
    $userPassword = $u->password;
    if (trim($u->uidNumber) == null) {
        writelogs('Unable to get user infos abort', __FUNCTION__, __FILE__);
        return false;
    }
    if (trim($_POST["artica_password"]) != trim($userPassword)) {
        return false;
    }
    if (trim($_POST["artica_password"]) == trim($userPassword)) {
        $ldap = new clladp();
        $users = new usersMenus();
        $privs = new privileges($u->uid);
        $privileges_array = $privs->privs;
        setcookie("mem-logon-user", $_POST["artica_username"], time() + 172800);
        $_SESSION["privileges_array"] = $privs->privs;
        $_SESSION["privs"] = $privileges_array;
        $_SESSION["OU_LANG"] = $privileges_array["ForceLanguageUsers"];
        $_SESSION["uid"] = $_POST["artica_username"];
        $_SESSION["passwd"] = $_POST["artica_password"];
        $_SESSION["privileges"]["ArticaGroupPrivileges"] = $privs->content;
        $_SESSION["groupid"] = $ldap->UserGetGroups($_POST["artica_username"], 1);
        $_SESSION["DotClearUserEnabled"] = $u->DotClearUserEnabled;
        $_SESSION["MailboxActive"] = $u->MailboxActive;
        $_SESSION["ou"] = $u->ou;
        $_SESSION["UsersInterfaceDatas"] = trim($u->UsersInterfaceDatas);
        $lang = new articaLang();
        writelogs("[{$_POST["artica_username"]}]: Default organization language={$_SESSION["OU_LANG"]}", __FUNCTION__, __FILE__);
        if (trim($_SESSION["OU_LANG"]) != null) {
            $_SESSION["detected_lang"] = $_SESSION["OU_LANG"];
            setcookie("artica-language", $_SESSION["OU_LANG"], time() + 172800);
        } else {
            setcookie("artica-language", $_POST["lang"], time() + 172800);
            $_SESSION["detected_lang"] = $lang->get_languages();
        }
        $users->_TranslateRights($privileges_array, true);
        if (!$users->AsSquidAdministrator) {
            artica_mysql_events("failed to logon on the Artica Squid Stats Web console from {$_SERVER["REMOTE_HOST"]} as User", @implode("\n", $notice), "security", "security");
            writelogs("[{$_POST["artica_username"]}]: This is not an user =>admin.index.php", __FUNCTION__, __FILE__);
            return false;
        }
    }
    return true;
}
Beispiel #5
0
function checklogon($Aspost = false)
{
    include_once dirname(__FILE__) . "/ressources/class.user.inc";
    include "ressources/settings.inc";
    $username = $_POST["username"];
    $_POST["password"] = url_decode_special_tool($_POST["password"]);
    $password = trim($_POST["password"]);
    $users = new usersMenus();
    if ($users->WEBSTATS_APPLIANCE) {
        $users->SQUID_INSTALLED = true;
    }
    //echo $username."\n$password\n";
    if ($password == null) {
        if ($Aspost) {
            MainPage("Bad password");
            return;
        }
        echo "Bad password";
        return;
    }
    if (trim(strtolower($username)) == trim(strtolower($_GLOBAL["ldap_admin"]))) {
        $passwordMD = md5(trim($_GLOBAL["ldap_password"]));
        if ($password == $passwordMD) {
            $_SESSION["uid"] = '-100';
            $_SESSION["groupid"] = '-100';
            $_SESSION["passwd"] = $_GLOBAL["ldap_password"];
            $_SESSION["CORP"] = $users->CORP_LICENSE;
            $_SESSION["privileges"]["ArticaGroupPrivileges"] = '
			[AllowAddGroup]="yes"
			[AllowAddUsers]="yes"
			[AllowChangeKav]="yes"
			[AllowChangeKas]="yes"
			[AllowChangeUserPassword]="yes"
			[AllowEditAliases]="yes"
			[AllowEditAsWbl]="yes"
			[AsSystemAdministrator]="yes"
			[AsPostfixAdministrator]="yes"
			[AsArticaAdministrator]="yes"';
            $_SESSION["InterfaceType"] = "{APP_ARTICA_ADM}";
            $_SESSION["AsWebStatisticsAdministrator"] = true;
            if ($Aspost) {
                header("location:miniadm.index.php");
                return;
            }
            return;
        }
    }
    if ($users->SQUID_INSTALLED) {
        $q = new mysql_squid_builder();
        $passwordMD = md5($password);
        $sql = "SELECT webfilters_sqitems.gpid AS maingpid\n\t\t\tFROM webfilters_sqacllinks, webfilters_sqgroups, webfilters_sqitems, webfilters_sqacls\n\t\t\tWHERE webfilters_sqacllinks.gpid = webfilters_sqgroups.ID\n\t\t\tAND webfilters_sqacllinks.aclid = webfilters_sqacls.ID\n\t\t\tAND webfilters_sqgroups.ID = webfilters_sqitems.gpid\n\t\t\tAND webfilters_sqacls.enabled =1\n\t\t\tAND webfilters_sqgroups.enabled =1\n\t\t\tAND webfilters_sqitems.enabled =1\n\t\t\tAND webfilters_sqgroups.GroupType = 'dynamic_acls'\n\t\t\tAND webfilters_sqitems.pattern = '{$username}:{$passwordMD}'";
        $results = $q->QUERY_SQL($sql);
        if (!$q->mysql_error) {
            echo $q->mysql_error;
        }
        $CountDerules = mysql_num_rows($results);
        writelogs("{$username}::webfilters_sqitems:: {$CountDerules} rules", __FUNCTION__, __FILE__, __LINE__);
        if ($CountDerules > 0) {
            writelogs("{$username}::webfilters_sqitems:: Building rules....", __FUNCTION__, __FILE__, __LINE__);
            while ($ligne = mysql_fetch_assoc($results)) {
                $_SESSION["SQUID_DYNAMIC_ACLS_VIRTUALS"][$ligne["maingpid"]] = true;
            }
            $_SESSION["InterfaceType"] = "{ARTICA_MINIADM}";
            $_SESSION["VirtAclUser"] = true;
            $_SESSION["ou"] = "Proxy Service";
            $_SESSION["CORP"] = $users->CORP_LICENSE;
            setcookie("mem-logon-user", $_POST["username-logon"], time() + 172800);
            $_SESSION["privileges_array"] = $privs->privs;
            $_SESSION["uid"] = $username;
            $_SESSION["privileges"]["ArticaGroupPrivileges"] = array();
            BuildSession($username);
            if ($Aspost) {
                header("location:miniadm.index.php");
                return;
            }
            return;
        }
    }
    writelogs("{$username}:: Continue, processing....", __FUNCTION__, __FILE__, __LINE__);
    $ldap = new clladp();
    $IsKerbAuth = $ldap->IsKerbAuth();
    writelogs("{$username}:: Is AD -> {$IsKerbAuth}", __FUNCTION__, __FILE__, __LINE__);
    if ($ldap->IsKerbAuth()) {
        $external_ad_search = new external_ad_search();
        if ($external_ad_search->CheckUserAuth($username, $password)) {
            $users = new usersMenus();
            $privs = new privileges($_POST["username-logon"]);
            $privileges_array = $privs->privs;
            $_SESSION["InterfaceType"] = "{ARTICA_MINIADM}";
            $_SESSION["VirtAclUser"] = false;
            setcookie("mem-logon-user", $_POST["username-logon"], time() + 172800);
            $_SESSION["privileges_array"] = $privs->privs;
            $_SESSION["uid"] = $_POST["username-logon"];
            $_SESSION["passwd"] = $_POST["username-logon"];
            $_SESSION["privileges"]["ArticaGroupPrivileges"] = $privs->content;
            BuildSession($username);
            if ($Aspost) {
                header("location:miniadm.index.php");
                return;
            }
            return;
        }
        writelogs("{$username}:: Checks Active Directory failed, continue processing...", __FUNCTION__, __FILE__, __LINE__);
    }
    writelogs("{$username}:: Continue, processing....", __FUNCTION__, __FILE__, __LINE__);
    $q = new mysql();
    $sql = "SELECT `username`,`value`,id FROM radcheck WHERE `username`='{$username}' AND `attribute`='Cleartext-Password' LIMIT 0,1";
    writelogs("{$username}:: Is a RADIUS users \"{$sql}\"", __FUNCTION__, __FILE__, __LINE__);
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    if (!is_numeric($ligne["id"])) {
        $ligne["id"] = 0;
    }
    if (!$q->ok) {
        writelogs("{$username}:: {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__);
    }
    writelogs("{$username}:: {$password} <> " . md5($ligne["value"]), __FUNCTION__, __FILE__, __LINE__);
    if ($ligne["id"] > 0) {
        $checkRadiusPass = false;
        if (md5($ligne["value"]) == $password) {
            writelogs("{$username}:: RADIUS Password true for no MD5", __FUNCTION__, __FILE__, __LINE__);
            $checkRadiusPass = true;
        }
        if (md5($ligne["value"]) == $passwordMD) {
            writelogs("{$username}:: RADIUS Password true for yes MD5", __FUNCTION__, __FILE__, __LINE__);
            $checkRadiusPass = true;
        }
        if ($checkRadiusPass) {
            writelogs("{$username}:: Authenticated as a RADIUS users id={$ligne["id"]}", __FUNCTION__, __FILE__, __LINE__);
            $privs = new privileges($_POST["username-logon"], null, $ligne["id"]);
            $privileges_array = $privs->privs;
            $_SESSION["CORP"] = $users->CORP_LICENSE;
            $_SESSION["InterfaceType"] = "{ARTICA_MINIADM}";
            setcookie("mem-logon-user", $username, time() + 172800);
            $_SESSION["privileges_array"] = $privs->privs;
            while (list($key, $val) = each($_SESSION["privileges_array"])) {
                if (!isset($_SESSION[$key])) {
                    $_SESSION[$key] = $val;
                }
            }
            reset($_SESSION["privileges_array"]);
            $_SESSION["uid"] = $username;
            $_SESSION["RADIUS_ID"] = $ligne["id"];
            BuildSession($username);
            if ($Aspost) {
                header("location:miniadm.index.php");
                return;
            }
            return;
        }
    }
    writelogs("{$username}::Finally Is LOCAL LDAP ? -> {$IsKerbAuth}", __FUNCTION__, __FILE__, __LINE__);
    $u = new user($username);
    $tpl = new templates();
    $userPassword = $u->password;
    if (trim($u->uidNumber) == null) {
        writelogs('Unable to get user infos abort', __FUNCTION__, __FILE__);
        if ($Aspost) {
            MainPage("Unknown user (" . __LINE__ . ")");
            return;
        }
        echo "Unknown user (" . __LINE__ . ")";
        die;
    }
    writelogs("{$username}:: Password match ? Aspost = {$Aspost}", __FUNCTION__, __FILE__, __LINE__);
    if ($Aspost) {
        if (trim($password) != trim($userPassword)) {
            writelogs("{$username}:: Password match NO Aspost = {$Aspost}", __FUNCTION__, __FILE__, __LINE__);
            MainPage("Bad password (" . __LINE__ . ")");
            return;
        }
    }
    if (!$Aspost) {
        if (trim($password) != md5(trim($userPassword))) {
            writelogs("{$username}:: Password match NO Aspost = {$Aspost}", __FUNCTION__, __FILE__, __LINE__);
            writelogs("[{$_POST["username"]}]: The password typed  is not the same in ldap database...", __FUNCTION__, __FILE__);
            artica_mysql_events("Failed to logon on the management console as user `{$username}` from {$_SERVER["REMOTE_HOST"]} (bad password)", @implode("\n", $notice), "security", "security");
            if ($Aspost) {
                MainPage("Bad password (" . __LINE__ . ")");
                return;
            }
            echo "Error: (" . __LINE__ . ") bad password";
            return null;
        }
    }
    writelogs("{$username}:: Password match YES Aspost = {$Aspost}", __FUNCTION__, __FILE__, __LINE__);
    $ldap = new clladp();
    $users = new usersMenus();
    $_SESSION["CORP"] = $users->CORP_LICENSE;
    $privs = new privileges($u->uid);
    $privs->SearchPrivileges();
    $privileges_array = $privs->privs;
    $_SESSION["VirtAclUser"] = false;
    $_SESSION["privileges_array"] = $privs->privs;
    $_SESSION["privs"] = $privileges_array;
    if (isset($privileges_array["ForceLanguageUsers"])) {
        $_SESSION["OU_LANG"] = $privileges_array["ForceLanguageUsers"];
    }
    $_SESSION["uid"] = $username;
    $_SESSION["privileges"]["ArticaGroupPrivileges"] = $privs->content;
    $_SESSION["groupid"] = $ldap->UserGetGroups($_POST["username"], 1);
    $_SESSION["DotClearUserEnabled"] = $u->DotClearUserEnabled;
    $_SESSION["MailboxActive"] = $u->MailboxActive;
    $_SESSION["InterfaceType"] = "{APP_ARTICA_ADM}";
    $_SESSION["ou"] = $u->ou;
    $_SESSION["UsersInterfaceDatas"] = trim($u->UsersInterfaceDatas);
    include_once dirname(__FILE__) . "/ressources/class.translate.rights.inc";
    $cr = new TranslateRights(null, null);
    $r = $cr->GetPrivsArray();
    while (list($key, $val) = each($r)) {
        if ($users->{$key}) {
            $_SESSION[$key] = $users->{$key};
        }
    }
    if (is_array($_SESSION["privs"])) {
        $r = $_SESSION["privs"];
        while (list($key, $val) = each($r)) {
            $t[$key] = $val;
            $_SESSION[$key] = $val;
        }
    }
    if (!isset($_SESSION["OU_LANG"])) {
        $_SESSION["OU_LANG"] = null;
    }
    if (!isset($_SESSION["ASDCHPAdmin"])) {
        $_SESSION["ASDCHPAdmin"] = false;
    }
    if (trim($_SESSION["OU_LANG"]) != null) {
        $_SESSION["detected_lang"] = $_SESSION["OU_LANG"];
    } else {
        include_once dirname(__FILE__) . "/ressources/class.langages.inc";
        $lang = new articaLang();
        $_SESSION["detected_lang"] = $lang->get_languages();
    }
    if (isset($GLOBALS["FixedLanguage"])) {
        $sock = new sockets();
        $GLOBALS["FixedLanguage"] = $sock->GET_INFO("FixedLanguage");
    }
    if (trim($GLOBALS["FixedLanguage"]) != null) {
        $_SESSION["detected_lang"] = $GLOBALS["FixedLanguage"];
    }
    if ($Aspost) {
        header("location:miniadm.index.php");
        return;
    }
}
Beispiel #6
0
function logon()
{
    include "ressources/settings.inc";
    $sock = new sockets();
    $_POST["artica_password"] = url_decode_special($_POST["artica_password"]);
    writelogs("Testing logon....{$_POST["artica_username"]}", __FUNCTION__, __FILE__, __LINE__);
    writelogs("Testing logon.... password:{$_POST["artica_password"]}", __FUNCTION__, __FILE__, __LINE__);
    $_COOKIE["artica-language"] = $_POST["lang"];
    $FileCookyKey = md5($_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"]);
    $sock->SET_INFO($FileCookyKey, $_POST["Changelang"]);
    $socks = new sockets();
    if (!$socks->TestArticaPort()) {
        if (is_file("ressources/logs/boa.start")) {
            $boa_error = file_get_contents("ressources/logs/boa.start");
        }
        echo "Unable to connect to Artica daemon port:{$boa_error}";
        exit;
    }
    while (list($index, $value) = each($_SERVER)) {
        $notice[] = "{$index}:{$value}";
    }
    if ($_POST["artica_username"] == $_GLOBAL["ldap_admin"]) {
        if ($_POST["artica_password"] != $_GLOBAL["ldap_password"]) {
            writelogs("Testing logon.... password:{$_POST["artica_password"]}!==\"{$_GLOBAL["ldap_password"]}\"", __FUNCTION__, __FILE__, __LINE__);
            artica_mysql_events("Failed to logon on the Artica Web console from {$_SERVER["REMOTE_HOST"]}", @implode("\n", $notice), "security", "security");
            echo "bad password";
            return null;
        } else {
            artica_mysql_events("Success to logon on the Artica Web console from {$_SERVER["REMOTE_HOST"]} as SuperAdmin", @implode("\n", $notice), "security", "security");
            //session_start();
            $_SESSION["uid"] = '-100';
            $_SESSION["groupid"] = '-100';
            $_SESSION["passwd"] = $_POST["artica_password"];
            $_SESSION["InterfaceType"] = "{APP_ARTICA_ADM}";
            setcookie("artica-language", $_POST["lang"], time() + 172800);
            $_SESSION["detected_lang"] = $_POST["lang"];
            $_SESSION["privileges"]["ArticaGroupPrivileges"] = '
			[AllowAddGroup]="yes"
			[AllowAddUsers]="yes"
			[AllowChangeKav]="yes"
			[AllowChangeKas]="yes"
			[AllowChangeUserPassword]="yes"
			[AllowEditAliases]="yes"
			[AllowEditAsWbl]="yes"
			[AsSystemAdministrator]="yes"
			[AsPostfixAdministrator]="yes"
			[AsArticaAdministrator]="yes"
			';
            $tpl = new templates();
            echo "location:admin.index.php";
            exit;
        }
    }
    writelogs('This is not Global admin, so test user...', __FUNCTION__, __FILE__);
    $u = new user($_POST["artica_username"]);
    $userPassword = $u->password;
    if (trim($u->uidNumber) == null) {
        writelogs('Unable to get user infos abort', __FUNCTION__, __FILE__);
        echo "Unknown user";
        return null;
    }
    if (trim($_POST["artica_password"]) == trim($userPassword)) {
        $ldap = new clladp();
        $users = new usersMenus();
        $privs = new privileges($u->uid);
        $privileges_array = $privs->privs;
        setcookie("mem-logon-user", $_POST["artica_username"], time() + 172800);
        $_SESSION["privileges_array"] = $privs->privs;
        $_SESSION["privs"] = $privileges_array;
        $_SESSION["OU_LANG"] = $privileges_array["ForceLanguageUsers"];
        $_SESSION["uid"] = $_POST["artica_username"];
        $_SESSION["passwd"] = $_POST["artica_password"];
        $_SESSION["privileges"]["ArticaGroupPrivileges"] = $privs->content;
        $_SESSION["groupid"] = $ldap->UserGetGroups($_POST["artica_username"], 1);
        $_SESSION["DotClearUserEnabled"] = $u->DotClearUserEnabled;
        $_SESSION["MailboxActive"] = $u->MailboxActive;
        $_SESSION["InterfaceType"] = "{APP_ARTICA_ADM}";
        $_SESSION["ou"] = $u->ou;
        $_SESSION["UsersInterfaceDatas"] = trim($u->UsersInterfaceDatas);
        $lang = new articaLang();
        writelogs("[{$_POST["artica_username"]}]: Default organization language={$_SESSION["OU_LANG"]}", __FUNCTION__, __FILE__);
        if (trim($_SESSION["OU_LANG"]) != null) {
            $_SESSION["detected_lang"] = $_SESSION["OU_LANG"];
            setcookie("artica-language", $_SESSION["OU_LANG"], time() + 172800);
        } else {
            setcookie("artica-language", $_POST["lang"], time() + 172800);
            $_SESSION["detected_lang"] = $lang->get_languages();
        }
        $users->_TranslateRights($privileges_array, true);
        if (!$users->IfIsAnuser(true)) {
            artica_mysql_events("Success to logon on the Artica Web console from {$_SERVER["REMOTE_HOST"]} as User", @implode("\n", $notice), "security", "security");
            writelogs("[{$_POST["artica_username"]}]: This is not an user =>admin.index.php", __FUNCTION__, __FILE__);
            echo "location:admin.index.php";
            return null;
        }
        writelogs("[{$_POST["artica_username"]}]: IS AN USER =>../user-backup/logon.php", __FUNCTION__, __FILE__);
        $tpl = new templates();
        $array["USERNAME"] = $_POST["artica_username"];
        $array["PASSWORD"] = md5($_POST["artica_username"]);
        $credentials = base64_encode(serialize($array));
        artica_mysql_events("Success to redirect on the end-user management console from {$_SERVER["REMOTE_HOST"]} as User", @implode("\n", $notice), "security", "security");
        echo "location:../user-backup/logon.php?credentials={$credentials}";
        return null;
        exit;
    } else {
        writelogs("[{$_POST["artica_username"]}]: The password typed  is not the same in ldap database...", __FUNCTION__, __FILE__);
        artica_mysql_events("Failed to logon on the management console as user from {$_SERVER["REMOTE_HOST"]} (bad password)", @implode("\n", $notice), "security", "security");
        echo "bad password";
        return null;
    }
}
Beispiel #7
0
function final_show()
{
    $GLOBALS["DEBUG_TEMPLATE"] = true;
    include_once dirname(__FILE__) . "/ressources/class.langages.inc";
    $langAutodetect = new articaLang();
    $DetectedLanguage = $langAutodetect->get_languages();
    $GLOBALS["FIXED_LANGUAGE"] = $DetectedLanguage;
    $page = CurrentPageName();
    $tpl = new templates();
    $ldap = new clladp();
    $savedsettings = unserialize(base64_decode($_GET["savedsettings"]));
    $settings_final_show = $tpl->_ENGINE_parse_body("{settings_final_show}");
    $settings_final_show = str_replace("%a", "<strong style='color:#C91111'>{$savedsettings["administrator"]}</strong>", $settings_final_show);
    $settings_final_show = str_replace("%p", "<strong  style='color:#C91111'>{$savedsettings["administratorpass"]}</strong>", $settings_final_show);
    $webinterf = array();
    $webinterf[] = "<hr>";
    if ($savedsettings["adminwebserver"] != null) {
        $webinterf[] = "<div style='font-size:18px'><strong>WebAdmin Access:</strong> http://{$savedsettings["adminwebserver"]}</div>";
        $webinterf[] = "<div style='font-size:18px'><strong>WebAdmin Access:</strong> https://{$savedsettings["IPADDR"]}:9000/miniadm.logon.php</div>";
    }
    if ($savedsettings["second_webadmin"] != null) {
        $webinterf[] = "<div style='font-size:18px'><strong>WebAdmin Access:</strong> http://{$savedsettings["second_webadmin"]}</div>";
        $webinterf[] = "<div style='font-size:18px'><strong>WebAdmin Access:</strong> http://{$savedsettings["second_webadmin"]}/miniadm.logon.php</div>";
    }
    $webinterf[] = "<div style='font-size:18px'><strong>{artica_manager}:</strong>{$savedsettings["administrator"]}</div>";
    if ($savedsettings["adminwebserver"] != null) {
        if ($savedsettings["statsadministrator"] != null) {
            $webinterf[] = "<div style='font-size:18px'><strong>WebAccess {username} ({statistics}):</strong>{$savedsettings["statsadministrator"]}</div>";
        }
    }
    $t = time();
    $pleasewait = $tpl->_ENGINE_parse_body("{please_wait}");
    $html = "\n\t\t\n\n\t<center id='title{$t}' style='font-size:22px;font-weight:bold;margin-bottom:15px'>{$pleasewait}</center>\n\t<center style='margin-bottom:20px;margin-top:10px'>\n\t\t<div id='Status{$t}' style='height:50px;'></div>\n\t</center>\n\n\n\t\t<table style='width:99%' class=form>\n\t\t<tr>\n\t\t\t<td valign='top'><img src='img/ok64.png'></td>\n\t\t\t<td style='padding-left:15px'>\n\t\t\t\t<div style='font-size:18px'>{$settings_final_show}</strong>\n\t\t\t\t" . @implode("\n", $webinterf) . "\n\t\t\t\t\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n<script>\t\t\t\t\t\t\n\t\$('#Status{$t}').progressbar({ value: 2 });\t\n\tdocument.getElementById('content').style.height='424px';\n\tLoadjs('{$page}?progressbar-js=yes&t={$t}');\n</script>\n\n";
    //<center style='margin:10px'>". button("{close}","YahooSetupControlHide();document.location.href='logon.php'","22px")."
    $sock = new sockets();
    $sock->getFrameWork("system.php?create-new-uuid=yes");
    $sock->getFrameWork("system.php?wizard-execute=yes");
    echo $tpl->_ENGINE_parse_body($html);
}
function register_enable()
{
    $langAutodetect = new articaLang();
    unset($_SESSION);
    $DetectedLanguage = $langAutodetect->get_languages();
    $_SESSION["detected_lang"] = $DetectedLanguage;
    $GLOBALS["FIXED_LANGUAGE"] = $DetectedLanguage;
    $tpl = new templates();
    $tpl->language = $DetectedLanguage;
    $page = CurrentPageName();
    $sql = "SELECT userid,user_password,email FROM usersisp WHERE zmd5='{$_GET["actregistr"]}' AND enabled=0";
    $q = new mysql_squid_builder();
    $ligne = @mysql_fetch_array($q->QUERY_SQL($sql));
    if (!is_numeric($ligne["userid"])) {
        $ligne["userid"] = 0;
    }
    if ($ligne["userid"] == 0) {
        header("location:{$page}?SHOW_ERROR={unknown}");
        die;
    }
    $q->QUERY_SQL("UPDATE usersisp SET enabled=1 WHERE `userid`='{$ligne["userid"]}'");
    $_SESSION["uid"] = $ligne["userid"];
    $_SESSION["email"] = $ligne["email"];
    $_SESSION["passwd"] = $ligne["user_password"];
    $_SESSION["privileges"]["ArticaGroupPrivileges"] = null;
    $_SESSION["groupid"] = 0;
    $_SESSION["DotClearUserEnabled"] = 0;
    $_SESSION["MailboxActive"] = 0;
    $_SESSION["InterfaceType"] = "{ARTICA_ADMPRXY}";
    header("location:squid.users.index.php");
    die;
}
Beispiel #9
0
function logon()
{
    include "ressources/settings.inc";
    $_POST["artica_password"] = url_decode_special($_POST["artica_password"]);
    writelogs("Testing logon....{$_POST["artica_username"]}", __FUNCTION__, __FILE__, __LINE__);
    writelogs("Testing logon.... password:{$_POST["artica_password"]}", __FUNCTION__, __FILE__, __LINE__);
    $_COOKIE["artica-language"] = $_POST["lang"];
    $socks = new sockets();
    if (!$socks->TestArticaPort()) {
        if (is_file("ressources/logs/boa.start")) {
            $boa_error = file_get_contents("ressources/logs/boa.start");
        }
        echo "Unable to connect to Artica daemon port:{$boa_error}";
        exit;
    }
    if ($_POST["artica_username"] == $_GLOBAL["ldap_admin"]) {
        if ($_POST["artica_password"] != $_GLOBAL["ldap_password"]) {
            echo "bad password";
            return null;
        } else {
            //session_start();
            $_SESSION["uid"] = '-100';
            $_SESSION["groupid"] = '-100';
            $_SESSION["passwd"] = $_POST["artica_password"];
            setcookie("artica-language", $_POST["lang"], time() + 172800);
            $_SESSION["detected_lang"] = $_POST["lang"];
            $_SESSION["privileges"]["ArticaGroupPrivileges"] = '
			[AllowAddGroup]="yes"
			[AllowAddUsers]="yes"
			[AllowChangeKav]="yes"
			[AllowChangeKas]="yes"
			[AllowChangeUserPassword]="yes"
			[AllowEditAliases]="yes"
			[AllowEditAsWbl]="yes"
			[AsSystemAdministrator]="yes"
			[AsPostfixAdministrator]="yes"
			[AsArticaAdministrator]="yes"
			';
            $tpl = new templates();
            echo "location:admin.index.php";
            exit;
        }
    }
    writelogs('This is not Global admin, so test user...', __FUNCTION__, __FILE__);
    $u = new user($_POST["artica_username"]);
    $userPassword = $u->password;
    if (trim($u->uidNumber) == null) {
        writelogs('Unable to get user infos abort', __FUNCTION__, __FILE__);
        echo "Unknown user";
        return null;
    }
    if (trim($_POST["artica_password"]) == trim($userPassword)) {
        $ldap = new clladp();
        $ouprivs = $ldap->_Get_privileges_ou($u->uid, $u->ou);
        $privileges = $ldap->_Get_privileges_userid($_POST["artica_username"]);
        $_SESSION["OU_LANG"] = $ouprivs["ForceLanguageUsers"];
        $_SESSION["uid"] = $_POST["artica_username"];
        $_SESSION["passwd"] = $_POST["artica_password"];
        $_SESSION["privileges"]["ArticaGroupPrivileges"] = $privileges;
        $_SESSION["groupid"] = $ldap->UserGetGroups($_POST["artica_username"], 1);
        $_SESSION["DotClearUserEnabled"] = $u->DotClearUserEnabled;
        $_SESSION["MailboxActive"] = $u->MailboxActive;
        $_SESSION["ou"] = $u->ou;
        $_SESSION["UsersInterfaceDatas"] = trim($u->UsersInterfaceDatas);
        $lang = new articaLang();
        writelogs("default organization language={$_SESSION["OU_LANG"]}", __FUNCTION__, __FILE__);
        if (trim($_SESSION["OU_LANG"]) != null) {
            $_SESSION["detected_lang"] = $_SESSION["OU_LANG"];
            setcookie("artica-language", $_SESSION["OU_LANG"], time() + 172800);
        } else {
            setcookie("artica-language", $_POST["lang"], time() + 172800);
            $_SESSION["detected_lang"] = $lang->get_languages();
        }
        $users = new usersMenus();
        $privileges_array = $users->_ParsePrivieleges($privileges);
        $users->_TranslateRights($privileges_array, true);
        if (!$users->IfIsAnuser(true)) {
            writelogs('This is not an user =>admin.index.php ', __FUNCTION__, __FILE__);
            echo "location:admin.index.php";
            return null;
        }
        writelogs('IT IS AN USER =>../user-backup/logon.php ', __FUNCTION__, __FILE__);
        $tpl = new templates();
        $array["USERNAME"] = $_POST["artica_username"];
        $array["PASSWORD"] = md5($_POST["artica_username"]);
        $credentials = base64_encode(serialize($array));
        echo "location:../user-backup/logon.php?credentials={$credentials}";
        return null;
        exit;
    } else {
        writelogs("The passord typed  is not the same in ldap database...", __FUNCTION__, __FILE__);
        echo "bad password";
        return null;
    }
}
Beispiel #10
0
function buildPage()
{
    if ($GLOBALS["VERBOSE"]) {
        echo "<H1>buildPage() function line " . __LINE__ . "</H1>";
    }
    include_once 'ressources/class.templates.inc';
    include_once 'ressources/class.ldap.inc';
    include_once 'ressources/class.user.inc';
    include_once 'ressources/class.langages.inc';
    include_once 'ressources/class.sockets.inc';
    include_once 'ressources/class.mysql.inc';
    include_once 'ressources/class.privileges.inc';
    include_once 'ressources/class.browser.detection.inc';
    include_once dirname(__FILE__) . "/ressources/class.langages.inc";
    $page = CurrentPageName();
    $users = new usersMenus();
    $sock = new sockets();
    unset($_SESSION);
    unset($_COOKIE["artica-template"]);
    $sslcert = null;
    $GLOBALS["DEBUG_TEMPLATE"] = true;
    if ($GLOBALS["VERBOSE"]) {
        echo "<H1>articaLang() function line " . __LINE__ . "</H1>";
    }
    $langAutodetect = new articaLang();
    $DetectedLanguage = $langAutodetect->get_languages();
    if ($GLOBALS["VERBOSE"]) {
        echo "<H1>DetectedLanguage = {$DetectedLanguage} line " . __LINE__ . "</H1>";
    }
    $GLOBALS["FIXED_LANGUAGE"] = $DetectedLanguage;
    $TEMPLATE_INDEX = "logon.html";
    if (!isset($GLOBALS["FixedLanguage"])) {
        $GLOBALS["FixedLanguage"] = $sock->GET_INFO("FixedLanguage");
    }
    $ie = browser_detection();
    if ($ie == "ie") {
        FATAL_ERROR_SHOW_128_NO_IE();
        return;
    }
    $logo = "logo.gif";
    $logo_bg = "bg_header.gif";
    $bg_color = "#005447";
    $ProductName = "Artica";
    $link_company_name = "http://www.articatech.com";
    $OEM_CompanyName = "Artica Tech";
    $template = null;
    $MikrotikTransparent = intval($sock->GET_INFO('MikrotikTransparent'));
    $SquidActHasReverse = $sock->GET_INFO("SquidActHasReverse");
    $AsSquidLoadBalancer = $sock->GET_INFO("AsSquidLoadBalancer");
    $SSlBumpAllowLogon = intval($sock->GET_INFO("SSlBumpAllowLogon"));
    if (!is_numeric($SquidActHasReverse)) {
        $SquidActHasReverse = 0;
    }
    if (!is_numeric($AsSquidLoadBalancer)) {
        $AsSquidLoadBalancer = 0;
    }
    $LOCK_TEMPLATE = false;
    $AsCategoriesAppliance = intval($sock->GET_INFO("AsCategoriesAppliance"));
    $AsMetaServer = intval($sock->GET_INFO("AsMetaServer"));
    $EnableNginx = intval($sock->GET_INFO("EnableNginx"));
    $SQUIDEnable = trim($sock->GET_INFO("SQUIDEnable"));
    if (!is_numeric($SQUIDEnable)) {
        $SQUIDEnable = 1;
    }
    if ($SQUIDEnable == 0) {
        if ($EnableNginx == 1) {
            $SquidActHasReverse = 1;
        }
    }
    $hostname = $sock->GET_INFO("myhostname");
    if ($hostname == null) {
        $hostname = $sock->getFrameWork("system.php?hostname-g=yes");
        $sock->SET_INFO($hostname, "myhostname");
    }
    if ($hostname == null) {
        $hostname = $users->hostname;
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "new templates() line:" . __LINE__ . "<br>\n";
    }
    $tpl2 = new templates();
    if ($users->KASPERSKY_WEB_APPLIANCE) {
        if ($GLOBALS["VERBOSE"]) {
            echo "<div style='background-color:white;color:black'>" . __LINE__ . ": KASPERSKY_WEB_APPLIANCE DETECTED</div>\n";
        }
        $template = "Kav4Proxy";
        $logo = "logo-kav.gif";
    }
    if ($users->ZARAFA_APPLIANCE) {
        $template = "zarafa";
        $logo = "logo-kav.gif";
    }
    if ($users->MYCOSI_APPLIANCE) {
        $logo_bg = "bg_header_kavweb.gif";
        $logo = "logo-mycosi.gif";
        $bg_color = "#FFB683";
        $ProductName = "MyCosi";
        $template = "myCosi";
    }
    if ($users->APACHE_APPLIANCE) {
        $template = "Apache";
        $users->SAMBA_APPLIANCE = false;
        $logo = "logo-kav.gif";
    }
    if ($users->WEBSECURIZE) {
        $LOCK_TEMPLATE = true;
        $users->SQUID_APPLIANCE = false;
        $template = "Websecurize";
        $users->SAMBA_APPLIANCE = false;
        $logo = "logo-kav.gif";
        $ProductName = "Web Securize";
        $link_company_name = "http://www.lemnia.com";
        $OEM_CompanyName = "LEMNIA SAS";
    }
    if ($users->LANWANSAT) {
        $LOCK_TEMPLATE = true;
        $users->SQUID_APPLIANCE = false;
        $template = "LanWanSAT";
        $users->SAMBA_APPLIANCE = false;
        $logo = "logo-kav.gif";
        $ProductName = "LanWanSAT Proxy";
        $link_company_name = "http://lanwansan.synology.me/wordpress/";
        $OEM_CompanyName = "LanWanSan";
    }
    $LinkColor = "white";
    if (is_file("/usr/share/artica-postfix/ressources/templates/{$template}/logon-link-color.conf")) {
        $LinkColor = trim(@file_get_contents("/usr/share/artica-postfix/ressources/templates/{$template}/logon-link-color.conf"));
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "<H1>template={$template} line " . __LINE__ . "</H1>";
    }
    if ($users->SQUID_APPLIANCE) {
        if (!$users->KASPERSKY_WEB_APPLIANCE) {
            if ($GLOBALS["VERBOSE"]) {
                echo "<div style='background-color:{$LinkColor};color:black'>" . __LINE__ . ": SQUID_APPLIANCE DETECTED</div>\n";
            }
            $template = "Squid";
        }
    }
    if (!$LOCK_TEMPLATE) {
        if ($users->LOAD_BALANCE_APPLIANCE) {
            $template = "LoadBalance";
        }
        if ($users->HAPRROXY_APPLIANCE) {
            $template = "LoadBalance";
        }
        if ($users->WEBSTATS_APPLIANCE) {
            $template = "WebStats";
        }
        if ($users->GATEWAY_APPLIANCE) {
            $template = "Gateway";
            $TEMPLATE_INDEX = "logon.html";
        }
        if ($users->WORDPRESS_APPLIANCE) {
            $template = "Wordpress";
        }
        if ($AsCategoriesAppliance == 1) {
            $template = "UfdbCat";
        }
        if ($AsMetaServer == 1) {
            $template = "MetaServer";
        }
    }
    if ($template == null) {
        if ($users->SQUID_INSTALLED) {
            if (!$users->POSTFIX_INSTALLED) {
                if (!$users->SAMBA_INSTALLED) {
                    $SQUIDEnable = $sock->GET_INFO("SQUIDEnable");
                    if (!is_numeric($SQUIDEnable)) {
                        $SQUIDEnable = 1;
                    }
                    if ($SQUIDEnable == 1) {
                        $template = "Squid";
                    }
                }
            }
        }
    }
    if ($template == null) {
        if ($users->POSTFIX_INSTALLED) {
            if ($users->cyrus_imapd_installed) {
                $template = "Postfix";
                $TEMPLATE_INDEX = "logon.html";
            }
            if ($users->ZARAFA_INSTALLED) {
                $template = "zarafa";
                $TEMPLATE_INDEX = "logon.html";
            }
        }
    }
    if ($template == null) {
        if ($users->POSTFIX_INSTALLED) {
            if (!$users->SQUID_INSTALLED) {
                if (!$users->SAMBA_INSTALLED) {
                    $template = "Postfix";
                    $TEMPLATE_INDEX = "logon.html";
                }
            }
        }
    }
    if (trim($template) == null) {
        if ($users->SAMBA_APPLIANCE) {
            $template = "Samba";
        }
    }
    if (trim($template) == null) {
        if ($users->WORDPRESS_INSTALLED) {
            $template = "Wordpress";
        }
    }
    if (trim($template) == null) {
        if ($users->SQUID_INSTALLED) {
            $template = "Squid";
        }
    }
    if (trim($template) == null) {
        if ($users->SAMBA_INSTALLED) {
            $template = "Samba";
        }
    }
    if (trim($template) == null) {
        if ($users->APACHE_INSTALLED) {
            $template = "Apache";
        }
    }
    if ($template == "Squid") {
        if ($SquidActHasReverse == 1) {
            $TEMPLATE_INDEX = "logonr.html";
        }
        if ($AsSquidLoadBalancer == 1) {
            $TEMPLATE_INDEX = "logonb.html";
        }
        if ($MikrotikTransparent == 1) {
            $TEMPLATE_INDEX = "logon_mikrotik.html";
        }
    }
    if ($users->APP_UFDBGUARD_INSTALLED) {
        $q = new mysql_squid_builder();
        $sql = "SELECT COUNT( * ) AS tcount FROM personal_categories WHERE PublicMode=1";
        writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
        $ligneCatz = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        if ($ligneCatz["tcount"] > 0) {
            $categoriesPublic = "<span style='color:{$LinkColor}'>&nbsp;|&nbsp;</span>\n\t\t\t<a href='public.categories.personnal.php' style='color:{$LinkColor}'>" . $tpl2->_ENGINE_parse_body("{categories}") . "</a>&nbsp;";
        }
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "<H1>template={$template} line " . __LINE__ . "</H1>";
    }
    if ($template != null) {
        $jquery = null;
        include_once dirname(__FILE__) . "/ressources/class.page.builder.inc";
        if ($GLOBALS["VERBOSE"]) {
            echo "new pagebuilder() line " . __LINE__ . "</H1>";
        }
        $p = new pagebuilder();
        if (is_file("ressources/templates/{$template}/{$TEMPLATE_INDEX}")) {
        }
        $tpl = @file_get_contents("ressources/templates/{$template}/{$TEMPLATE_INDEX}");
        if ($GLOBALS["VERBOSE"]) {
            echo "<H1>ressources/templates/{$template}/{$TEMPLATE_INDEX} (" . strlen($tpl) . ") length line " . __LINE__ . "</H1>";
        }
        foreach (glob("ressources/templates/{$template}/css/*.css") as $filename) {
            //$datas=@file_get_contents("$filename");
            //$datas=str_replace("\n", " ", $datas);
            $css[] = "<link href=\"/{$filename}\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" >";
        }
        $log[] = "<!-- TEMPLATE_INDEX:{$TEMPLATE_INDEX} -->";
        if ($GLOBALS["VERBOSE"]) {
            echo "Scanning ressources/templates/{$template}/js/*.js" . __LINE__ . "<br>\n";
        }
        foreach (glob("ressources/templates/{$template}/js/*.js") as $filename) {
            $filename = basename($filename);
            if (preg_match("#^jquery-([0-9\\.]+)\\.min\\.js#", $filename)) {
                $log[] = "<!-- jquery = {$filename} -->";
                $jquery = $filename;
                continue;
            }
            $js[] = "<script type=\"text/javascript\" src=\"/ressources/templates/{$template}/js/{$filename}\"></script>";
            $log[] = "<!-- {$filename} -->";
        }
        $lang2Link = "<a href=\"javascript:blur();\" OnClick=\"javascript:PopupLogonLang()\" style='color:{$LinkColor} !important'>{language}</a>";
        if (trim($GLOBALS["FixedLanguage"]) != null) {
            $lang2Link = null;
        }
        if ($jquery != null) {
            $jquery = "<script type=\"text/javascript\" src=\"/ressources/templates/{$template}/js/{$jquery}\"></script>";
        }
        $jslogon = "<script type=\"text/javascript\" src=\"logon.php?start=yes\"></script>";
        if ($ProductName != null) {
            $ProductName = "<input type='hidden' id='change-artica-name' value='{$ProductName}'>";
        }
        $jsArtica = $p->jsArtica();
        $js[] = "<script type=\"text/javascript\" language=\"javascript\" src=\"/js/jquery.reject.js\"></script>";
        $css[] = "<link href=\"/css/jquery.reject.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" >";
        $sock = new sockets();
        $TITLE_RESSOURCE = "ressources/templates/{$template}/TITLE";
        $favicon = $p->favicon($template);
        if ($GLOBALS["VERBOSE"]) {
            echo "replace tokens line:" . __LINE__ . "<br>\n";
        }
        if (is_file($TITLE_RESSOURCE)) {
            $title = @file_get_contents($TITLE_RESSOURCE);
            $title = str_replace("%server", $users->hostname, $title);
        } else {
            $title = $users->hostname;
        }
        $FPM = null;
        if (method_exists("templates", "parsePHPModules")) {
            $modules = $tpl2->parsePHPModules();
            $PHPVERSION = null;
            if (isset($modules["Core"]["PHP Version"])) {
                if (preg_match("#([0-9\\.]+)#", $modules["Core"]["PHP Version"], $re)) {
                    $PHPVERSION = "&nbsp;|&nbsp;PHP v.{$re[1]}";
                }
            }
            if (isset($modules["cgi-fcgi"]["php-fpm"])) {
                $FPM = " (PHP-FPM)";
            }
        }
        $WizardSavedSettings = unserialize(base64_decode($sock->GET_INFO("WizardSavedSettings")));
        $WizardSavedSettingsSend = $sock->GET_INFO("WizardSavedSettingsSend");
        $UnlockCompanyName = $sock->GET_INFO("UnlockCompanyName");
        if (!is_numeric($WizardSavedSettingsSend)) {
            $WizardSavedSettingsSend = 0;
        }
        $roundcube_uri = roundcube_uri($users);
        if ($roundcube_uri != null) {
            $miniadm = "<span style='color:{$LinkColor} !important'>&nbsp;|&nbsp;</span><a href=\"{$roundcube_uri}\" style='color:{$LinkColor};text-decoration:underline'>WebMail<a>&nbsp;";
        }
        $miniadm = $miniadm . "<span style='color:{$LinkColor}'>&nbsp;|&nbsp;</span><a href='miniadm.logon.php' style='color:{$LinkColor}'>End-User WebAccess</a>&nbsp;";
        if (!isset($WizardSavedSettings["company_name"])) {
            $WizardSavedSettings["company_name"] = null;
        }
        $company_name = $WizardSavedSettings["company_name"];
        if ($UnlockCompanyName != null) {
            $company_name = $UnlockCompanyName;
        }
        if ($company_name != null) {
            $company_name = "<center style='margin:5px;font-size:16px;padding:5px;\n\t\t\t\tborder-top:1px solid {$LinkColor};border-bottom:1px solid {$LinkColor}'>-&nbsp;{$company_name}&nbsp;-</center>";
        }
        $company_name = "<center style='margin:5px;font-size:12px;padding:5px;'>-&nbsp;{$hostname}&nbsp;-</center>{$company_name}";
        $WEBSEVERV = null;
        if (isset($_SERVER["SERVER_SOFTWARE"])) {
            if (preg_match("#Apache\\/([0-9\\.]+)#", $_SERVER["SERVER_SOFTWARE"], $re)) {
                $WEBSEVERV = "&nbsp;|&nbsp;Apache v{$re[1]}";
            }
            if (preg_match("#lighttpd\\/([0-9\\.]+)#", $_SERVER["SERVER_SOFTWARE"], $re)) {
                $WEBSEVERV = "&nbsp;|&nbsp;LigHttpd v{$re[1]}";
            }
        }
        if ($users->SQUID_INSTALLED) {
            if ($SQUIDEnable == 1) {
                if ($GLOBALS["VERBOSE"]) {
                    echo "<div style='background-color:white;color:black'>" . __LINE__ . ": SQUID INSTALLED</div>\n";
                }
                $userslogs = "<span style='color:{$LinkColor}'>&nbsp;|&nbsp;</span><a href='squid.access-sql.php' style='color:{$LinkColor}'>Proxy requests</a>&nbsp;";
                $EnableSquidUrgencyPublic = $sock->GET_INFO("EnableSquidUrgencyPublic");
                if (!is_numeric($EnableSquidUrgencyPublic)) {
                    $EnableSquidUrgencyPublic = 0;
                }
                if ($EnableSquidUrgencyPublic == 1) {
                    $urgency_mode = $tpl2->_ENGINE_parse_body("{urgency_mode}");
                    $userslogs = "<span style='color:{$LinkColor}'>&nbsp;|&nbsp;</span><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.urgency.php',true);\" style='color:{$LinkColor}'>{$urgency_mode}</a>&nbsp;{$userslogs}";
                }
                if ($SSlBumpAllowLogon == 1) {
                    if (is_file("/usr/share/artica-postfix/ressources/squid/certificate.der")) {
                        $certificate = $tpl2->_ENGINE_parse_body("{certificate}");
                        $sslcert = "<span style='color:{$LinkColor}'>&nbsp;|&nbsp;</span>\n\t\t\t\t\t\t\t\t<a href='ressources/squid/certificate.der' style='color:{$LinkColor}'>\n\t\t\t\t\t\t{$certificate}</a>&nbsp;\n\t\t\t\t\t\t\t\t";
                    }
                }
            }
        } else {
            if ($GLOBALS["VERBOSE"]) {
                echo "<div style='background-color:white;color:{$LinkColor}'>" . __LINE__ . ": SQUID !!NOT!! INSTALLED</div>\n";
            }
        }
        if ($users->KAV4PROXY_INSTALLED) {
            $WEBSEVERV = "&nbsp;|&nbsp;Kav4Proxy v{$users->KAV4PROXY_VERSION}";
        }
        $ARTICAVER = @file_get_contents("VERSION") . $WEBSEVERV . $PHPVERSION . $FPM;
        $tpl = str_replace("{COPYRIGHT}", "{$lang2Link}{$miniadm}{$userslogs}{$sslcert}{$categoriesPublic}<br>{$company_name}Copyright 2003 - " . date('Y') . "&nbsp;<a href=\"{$link_company_name}\" style='color:{$LinkColor}'>{$OEM_CompanyName}</a>", $tpl);
        $tpl = str_replace("{copy-right}", "{$lang2Link}{$miniadm}{$userslogs}{$sslcert}{$categoriesPublic}<br>{$company_name}Copyright 2003 - " . date('Y') . "&nbsp;<a href=\"{$link_company_name}\" style='color:{$LinkColor}'>{$OEM_CompanyName}</a>", $tpl);
        $tpl = str_replace("{TEMPLATE_HEAD}", "<!-- HEAD TITLE: {$TITLE_RESSOURCE} -->\n{$favicon}\n{$jquery}\n{$jsArtica}\n" . @implode("\n", $js) . "\n{$jslogon}\n" . @implode("\n", $css) . "\n" . @implode("\n", $log), $tpl);
        $tpl = str_replace("{ARTICA_VERSION}", $ARTICAVER, $tpl);
        if ($SQUIDEnable == 1) {
            $tpl = str_replace("{SQUID_VERSION}", $users->SQUID_VERSION, $tpl);
        } else {
            $tpl = str_replace("{SQUID_VERSION}", null, $tpl);
        }
        $tpl = str_replace("{POSTFIX_VERSION}", $users->POSTFIX_VERSION, $tpl);
        $tpl = str_replace("{SAMBA_VERSION}", $users->SAMBA_VERSION, $tpl);
        $tpl = str_replace("{CROSSROADS_VERSION}", $users->CROSSROADS_VERSION, $tpl);
        $tpl = str_replace("{APACHE_VERSION}", $users->APACHE_VERSION, $tpl);
        if (!function_exists("ldap_connect")) {
            $tpl = str_replace("{LOGON_BUTTON}", "<span id='YouCanAnimateIt'></span><script>Loadjs('{$page}?ldap_connect=yes');</script>", $tpl);
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "p->YahooBody() line:" . __LINE__ . "<br>\n";
        }
        $tpl = str_replace("{TEMPLATE_BODY_YAHOO}", $p->YahooBody(), $tpl);
        if (trim($GLOBALS["FixedLanguage"]) == null) {
            $tpl = str_replace("{TEMPLATE_LANG_LINK}", "<span id='llang-select'></span><script>LoadAjaxTiny('llang-select','{$page}?TEMPLATE_LANG_LINK=yes')</script>", $tpl);
        } else {
            $tpl = str_replace("{TEMPLATE_LANG_LINK}", null, $tpl);
        }
        $tpl = str_replace("{artica_username}", $_GET["MEM_USERNAME"], $tpl);
        $reject_browser_automation = null;
        if (isset($_GET["automation"])) {
            $reject_browser_automation = "&automation=yes";
        }
        $tpl = str_replace("{LOGON_BUTTON}", "<span id='YouCanAnimateIt'></span>\n\t\t\t<script>Loadjs('{$page}?reject-browser=yes{$reject_browser_automation}');</script><input type='hidden' id='template' value='{$template}'>{$ProductName}" . button("{login}", "SendLogonStart()", "18px"), $tpl);
        $tpl = str_replace("{TEMPLATE_TITLE_HEAD}", $title, $tpl);
        if (strpos($tpl, "{ZARAFA_VERSION") > 0) {
            $sock = new sockets();
            $tpl = str_replace("{ZARAFA_VERSION}", $sock->getFrameWork("zarafa.php?getversion=yes"), $tpl);
        }
        if (trim($GLOBALS["FixedLanguage"]) == null) {
            $tpl2->language = $DetectedLanguage;
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "Langage {$tpl2->language} line:" . __LINE__ . "<br>\n";
        }
        $tpl = str_replace("User name", $tpl2->_ENGINE_parse_body("{username2}"), $tpl);
        $tpl = str_replace("Password", $tpl2->_ENGINE_parse_body("{password}"), $tpl);
        if ($GLOBALS["VERBOSE"]) {
            echo "Success return form " . strlen($tpl) . " bytes lenght<br>\n";
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "Success return complete page line " . __LINE__ . "<br>\n";
        }
        return $tpl2->_ENGINE_parse_body($tpl) . "<script>//LockPage();</script>";
    }
    $html = "<html xmlns='http://www.w3.org/1999/xhtml'>\n<head>\n\t<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n\t<title></title>\n\t<meta name='keywords' content=''>\n\t<meta name='description' content=\"\">\n\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7\" />\n\t<link href='css/styles_main.css'    rel=\"styleSheet\"  type='text/css' />\n\n\t<link href='css/styles_header.css'  rel=\"styleSheet\"  type='text/css' />\n\t<link href='css/styles_middle.css'  rel=\"styleSheet\"  type='text/css' />\n\t<link href='css/styles_tables.css'  rel=\"styleSheet\"  type='text/css' />\n\t<link href=\"css/styles_rounded.css\" rel=\"stylesheet\"  type=\"text/css\" />\n\t<!--[if lt IE 7]>\n\t<link rel='stylesheet' type='text/css' href='css/styles_ie.css' />\n\t<![endif]-->\n\t<!--[if IE 7]>\n\t<link rel='stylesheet' type='text/css' href='css/styles_ie7.css' />\n\t<![endif]-->\n\t\t<link rel=\"stylesheet\" type=\"text/css\" rel=\"styleSheet\"  href=\"ressources/templates/default/contact.css\" />\n\t\t<link rel=\"stylesheet\" type=\"text/css\" rel=\"styleSheet\"  href=\"ressources/templates/default/menus_top.css\" />\n\t\t<link href=\"css/calendar.css\" rel=\"stylesheet\" type=\"text/css\">\n\t\t<link href=\"js/jqueryFileTree.css\" rel=\"stylesheet\" type=\"text/css\">\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"css/uploadify.css\" />\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"css/artica-theme/jquery-ui-1.7.2.custom.css\" />\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"css/jquery.jgrowl.css\" />\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"css/jquery.cluetip.css\" />\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"css/jquery.treeview.css\" />\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"css/thickbox.css\" media=\"screen\"/>\n\t\t<div id='PopUpInfos' style='position:absolute'></div>\n\t\t<div id='find' style='position:absolute'></div>\n\t\t<script type=\"text/javascript\" language=\"javascript\" src=\"XHRConnection.js\"></script>\n\t\t<script type=\"text/javascript\" language=\"JavaScript\" src=\"mouse.js\"></script>\n\t\t<script type=\"text/javascript\" language=\"javascript\" src=\"default.js\"></script>\n\t\t<script type=\"text/javascript\" language=\"javascript\" src=\"js/cookies.js\"></script>\n\t\t<script type=\"text/javascript\" language=\"javascript\" src=\"js/jquery-1.6.1.min.js\"></script>\n\t\t<script type=\"text/javascript\" language=\"javascript\" src=\"js/jqueryFileTree.js\"></script>\n\t\t<script type=\"text/javascript\" language=\"javascript\" src=\"js/jquery.easing.1.3.js\"></script>\n\t\t<script type=\"text/javascript\" language=\"javascript\" src=\"js/jquery-ui-1.8.custom.min.js\"></script>\n\t\t<script type=\"text/javascript\" language=\"javascript\" src=\"js/thickbox-compressed.js\"></script>\n\t\t<script type=\"text/javascript\" language=\"javascript\" src=\"js/jquery.simplemodal-1.3.3.min.js\"></script>\n\t\t<script type=\"text/javascript\" language=\"javascript\" src=\"js/jquery.jgrowl_minimized.js\"></script>\n\t\t<script type=\"text/javascript\" language=\"javascript\" src=\"js/jquery.cluetip.js\"></script>\n\t\t<script type=\"text/javascript\" language=\"javascript\" src=\"js/jquery.blockUI.js\"></script>\n\t\t<script type=\"text/javascript\" language=\"javascript\" src=\"js/jquery.treeview.min.js\"></script>\n\t\t<script type='text/javascript' language='javascript' src='/js/jquery.uilock.min.js'></script>\n\t\t<script type='text/javascript' language='javascript' src='/js/jquery.blockUI.js'></script>  \n\t\t<!-- js Artica  -->\n\n\n</head>\n<body>\n<!-- LINE " . __LINE__ . " -->\t\t\n<center>\n<div style=\"width:900px;background-image:url(/css/images/{$logo_bg});background-repeat:repeat-x;background-position:center top;margin:0px;padding:0px;\">\n\t<table style=\"width:100%;margin:0px;padding:0px;border:0px;\">\n\t\t<tr>\n\t\t    <td valign=\"top\" style='padding:0px;margin:0px;border:0px;padding-top:24px'>\n\t\t\t<div style=\"height:72px\">\n\t\t\t\t<table style=\"padding:0px;margin:0px;border:0px;margin-left:-6px;\">\n\t\t\t\t<tr>\n\t\t\t   \t\t<td style='padding:0px;border:0px;' valign=\"top\" align=\"left\">\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t<table style=\"margin:0px;border:0px;padding:0px;\">\n\t\t\t\t\t\t\t<tr>\n\t\t\t \t\t\t\t<td style=\"margin:0px;padding:0px;background-color:{$bg_color}\" width=\"160px\">\n\n\t\t\t\t\t\t\t\t<img src='/css/images/{$logo}' style=\"margin:0px;padding:0px;\">\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td style=\"margin:0px;padding:0px;\" valign=\"middle\">\n\t\t\t\t\t\t\t\t<div style=\"margin-top:-7px;padding-left:5px\"> </div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td style=\"margin:0px;padding:0px;border:0px solid black\" valign=\"middle\" align='right' width=50%>\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\n\t\t\t\t\t  </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t  <td style='height:25px'>\n\t\t\t\t\t<div id='menus_2'><ul></ul></div id='menus_2'>\n\t\t\t\t </td>\n\t\t\t\t</tr>\n\t\t\t\t</table>\n\n\t\t</div>\n\t\t     </td>\n\t\t  \n\t\t\t\n\t\t \n\t    \t</tr>\n\t\t<tr>\n\t\t<td valign=\"top\" colspan=2 style=\"margin:0px;padding:0px;padding-top:4px;background-color:white;\">\t\n<div id='middle'>\n\t<div id='content' style='background-color:white;'>\n\t\t<table style='width:100%'>\n\t\t\t<tr>\n\n\t\t\t\t<td valign='top' style='padding:0px;margin:0px;width:150px'>\n\t\t\t\t\t\n\t\t\t\t</td>\n\t\t\t\t<td valign='top' style='padding-left:3px'>\n\t\t\t\t\t<div id='template_users_menus'></div>\n\t\t\t\t\t<div id='BodyContentTabs'></div>\n\t\t\t\t\t\t<div id='BodyContent'>\n\t\t\t\t\t\t\t<h1 id='template_title'></h1>\n\t\t\t\t\t\t\t<!-- content -->\n\t\t\t\t\t\t\t\n\n<script>\nfunction SaveSession(){\n\tvar template=document.getElementById('template').value;\n\tvar lang=document.getElementById('lang').value;\n\tSet_Cookie('artica-template', template, '3600', '/', '', '');\n\tSet_Cookie('artica-language', lang, '3600', '/', '', '');\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('lang',lang);\n\tXHR.sendAndLoad('logon.php', 'GET');\t\t\n\tlocation.reload();\n}\n\nfunction LoadModal(){\n\$('#loginform').modal({onOpen: function (dialog) {\n\tdialog.overlay.fadeIn('slow', function () {\n\t\tdialog.container.slideDown('slow', function () {\n\t\t\tdialog.data.fadeIn('slow');\n\t\t});\n\t});\n}});\n\n\n\n}\n\n\n</script>\n\n\n<center>\n\t<div id='loginform'></div>\n</center>\n<!-- content end -->\n\t\t\t\t\t\t</div>\n\n\t\t\t\t</td>\n\n\t\t\t\t<td valign='top'></td>\n\t\t\t</tr>\t\n\t</table>\t\n\n\t<div class='clearleft'></div>\n\t<div class='clearright'></div>\n\t</div id='content'>\n\n</div id='middle'>\n</td>\n</tr>\n<tr>\n<td valign='top' align=left colspan=2 >\n<div style='background-color:#736e6c;font-size:13px;color:{$LinkColor};height:25px;padding:0px;margin:0px;padding-top:5px;\nwidth:900px;text-align:center;margin-left:-5px;margin-bottom:-3px'>\n\n<strong>{$ProductName} Copyright 2006-" . date('Y') . "</strong>\n</div>\n</td>\n</tr>\n</table>\n</div>\n</center>\n<script>\ndocument.getElementById('loginform').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>';\nLoadjs('logon.php?start=yes',true);</script>\n\t\t<div id=\"SetupControl\" style='width:0;height:0'></div>\n\t\t<div id=\"dialogS\" style='width:0;height:0'></div> \n\t\t<div id=\"dialogT\" style='width:0;height:0'></div> \n\t\t<div id=\"dialog0\" style='width:0;height:0'></div> \n\t\t<div id=\"dialog1\" style='width:0;height:0'></div>\n\t\t<div id=\"dialog2\" style='width:0;height:0'></div> \n\t\t<div id=\"dialog3\" style='width:0;height:0'></div>\n\t\t<div id=\"dialog4\" style='width:0;height:0'></div>\n\t\t<div id=\"dialog5\" style='width:0;height:0'></div>\n\t\t<div id=\"dialog6\" style='width:0;height:0'></div>\n\t\t<div id=\"YahooUser\" style='width:0;height:0'></div>\n\t\t<div id=\"logsWatcher\" style='width:0;height:0'></div>\n\t\t<div id=\"WinORG\" style='width:0;height:0'></div>\n\t\t<div id=\"WinORG2\" style='width:0;height:0'></div>\n\t\t<div id=\"RTMMail\" style='width:0;height:0'></div>\n\t\t<div id=\"Browse\" style='width:0;height:0'></div>\n\t\t<div id=\"SearchUser\" style='width:0;height:0'></div>\n</body>\n</html>";
    return $html;
}