Esempio n. 1
0
function WhiteListSender()
{
    $sql = "SELECT mail_from,mail_to from messages WHERE zMD5=\"{$_GET["id"]}\"";
    $result = QUERY_SQL($sql);
    $ligne = @sqlite3_fetch_array(QUERY_SQL($sql));
    $mail_from = $ligne["mail_from"];
    if ($mail_from == null) {
        SinglePage(ParseLogs("ERROR\n"));
        exit;
    }
    $ldap = new clladp();
    $upd["KasperkyASDatasAllow"] = $mail_from;
    $uid = $ldap->uid_from_email($ligne["mail_to"]);
    if ($uid == null) {
        SinglePage(ParseLogs("ERROR\n"));
        exit;
    }
    $hash = $ldap->UserDatas($uid);
    $dn = $hash["dn"];
    if (!$ldap->Ldap_add_mod($dn, $upd)) {
        $error = $ldap->ldap_last_error . "\n";
    }
    $sock = new sockets();
    $error = $error . $sock->getfile('releaseallmailfrommd5:' . $_GET["id"]);
    SinglePage(ParseLogs($error));
}
Esempio n. 2
0
function search_user()
{
    header("Pragma: no-cache");
    header("Expires: 0");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-cache, must-revalidate");
    $stringtofind = $_GET["search_user"];
    $tpl = new templates();
    $usermenu = new usersMenus();
    $ldap = new clladp();
    if ($usermenu->AsAnAdministratorGeneric == true) {
        $hash_full = $ldap->UserSearch(null, $stringtofind);
    } else {
        $us = $ldap->UserDatas($_SESSION["uid"]);
        $hash_full = $ldap->UserSearch($us["ou"], $stringtofind);
    }
    $html = "<table style='width:100%'>";
    for ($i = 0; $i < $hash_full[0]["count"]; $i++) {
        $displayname = $hash_full[0][$i]["displayname"][0];
        $mail = $hash_full[0][$i]["mail"][0];
        if (strlen($mail) > 27) {
            $mail = substr($mail, 0, 24) . '...';
        }
        $uid = $hash_full[0][$i]["uid"][0];
        $js = "RestoreMbxSelectedUser('{$uid}');";
        $html = $html . "<tr " . CellRollOver($js) . ">\n\t\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t\t<td><code nowrap>{$displayname}</code></td>\n\t\t\t<td><code>{$mail}</code></td>\n\t\t</tr>\n\t\t\t\n\t\t";
    }
    $html = $html . "</table>";
    echo $html;
}
function INDEX()
{
    $ldap = new clladp();
    $hash = $ldap->UserDatas($_SESSION["uid"]);
    $mail = $hash["mail"];
    $Graph = InsertChart('js/charts.swf', "js/charts_library", "listener.graphs.php?weekMessagesPerDay={$mail}", 250, 250, "FFFFFF", true, $usermenus->ChartLicence);
    $html = $Graph;
    $JS["JS"][] = "js/user.quarantine.js";
    $tpl = new template_users('{messages_performance}', $html, 0, 0, 0, 0, $JS);
    echo $tpl->web_page;
}
Esempio n. 4
0
function UserEmptyQuarantine()
{
    $ldap = new clladp();
    include_once 'ressources/class.mysql.inc';
    $hash = $ldap->UserDatas($_SESSION["uid"]);
    $mail = $hash["mail"];
    $sql = "UPDATE `messages` SET `Deleted` = '1' WHERE mail_to LIKE '%{$mail}%' AND `filter_action`='quarantine' AND Deleted='0'";
    QUERY_SQL($sql);
    include_once 'ressources/class.sockets.inc';
    $sock = new sockets();
    $sock->getfile('quarantine_delete_all:' . $_SESSION["uid"]);
}
function INDEX()
{
    $ldap = new clladp();
    $hash = $ldap->UserDatas($_SESSION["uid"]);
    $mail = $hash["mail"];
    $Graph = InsertChart('js/charts.swf', "js/charts_library", "listener.graphs.php?weekMessagesPerDay={$mail}", 600, 250, "FFFFFF", true, $usermenus->ChartLicence);
    $Graph1 = InsertChart('js/charts.swf', "js/charts_library", "listener.graphs.php?QuarMessagesPerDay={$mail}", 600, 250, "FFFFFF", true, $usermenus->ChartLicence);
    $html = "\n<H4>{graph_week_receive}</H4>\n{$Graph}\n<H4>{graph_week_quarantine}</H4>\n{$Graph1}\n<H4>{quarantine_domains}</h4>\n" . BigDomainsReceive($mail);
    $JS["JS"][] = "js/user.quarantine.js";
    $tpl = new template_users('{messages_performance}', $html, 0, 0, 0, 0, $JS);
    echo $tpl->web_page;
}
function checkprivs()
{
    $_POST["userid"] = trim($_POST["userid"]);
    include "ressources/settings.inc";
    $socks = new sockets();
    if (strtolower($_POST["userid"]) == strtolower($_GLOBAL["ldap_admin"])) {
        if ($_POST["password"] != $_GLOBAL["ldap_password"]) {
            die("bad password");
        }
        $dans = new dansguardian_rules(null, 1);
        $dans->Add_exceptionsitelist(1, $_POST["uri"]);
        AddEvents("Manager", $_POST["uri"]);
        $sock = new sockets();
        $sock->getFrameWork("reload-dansguardian");
        die("SUCCESS");
    }
    $ldap = new clladp();
    writelogs('This is not Global admin, so test user...', __FUNCTION__, __FILE__);
    $hash = $ldap->UserDatas($_POST["userid"]);
    $userPassword = $hash["userPassword"];
    if (trim($hash["uid"]) == null) {
        writelogs('Unable to get user infos abort', __FUNCTION__, __FILE__);
        die("Unknown user");
    }
    if (trim($_POST["password"]) == trim($userPassword)) {
        $users = new usersMenus($ldap->_Get_privileges_userid($_POST["userid"]));
        $priv_array = $users->_ParsePrivieleges($ldap->_Get_privileges_userid($_POST["userid"]));
        $users->_TranslateRights($priv_array);
        if ($users->AllowDansGuardianBanned) {
            $dans = new dansguardian_rules(null, 1);
            $dans->Add_exceptionsitelist(1, $_POST["uri"]);
            $sock = new sockets();
            AddEvents($_POST["userid"], $_POST["uri"]);
            $sock->getFrameWork("cmd.php?reload-dansguardian");
            die("SUCCESS");
        }
    } else {
        die("BAD PASSWORD");
    }
    die("No privileges");
}
Esempio n. 7
0
function page($usersmenus)
{
    $left_menus = null;
    if (isset($_GET["admin-ajax"])) {
        echo "<script>LoadAjax('middle','quicklinks.php');</script>";
        return;
    } else {
        if (GET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__)) {
            return null;
        }
    }
    $ldap = new clladp();
    $page = CurrentPageName();
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    $hash = $ldap->UserDatas($_SESSION["uid"]);
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    if ($hash["displayName"] == null) {
        $hash["displayName"] = "{Administrator}";
    }
    $sock = new sockets();
    $ou = $hash["ou"];
    $users = new usersMenus();
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    if (isset($_COOKIE["artica-template"])) {
        if (is_file("ressources/templates/{$_COOKIE["artica-template"]}/JQUERY_UI")) {
            $GLOBALS["JQUERY_UI"] = trim(@file_get_contents("ressources/templates/{$_COOKIE["artica-template"]}/JQUERY_UI"));
        }
    }
    if ($users->KASPERSKY_SMTP_APPLIANCE) {
        if ($sock->GET_INFO("KasperskyMailApplianceWizardFinish") != 1) {
            $wizard_kaspersky_mail_appliance = "Loadjs('wizard.kaspersky.appliance.php');";
        }
    }
    if ($users->KASPERSKY_WEB_APPLIANCE) {
        //$GLOBALS["CHANGE_TEMPLATE"]="squid.kav.html";
        //$GLOBALS["JQUERY_UI"]="kavweb";
    }
    if (isset($_GET["admin-ajax"])) {
        $left_menus = "LoadAjax('TEMPLATE_LEFT_MENUS','/admin.tabs.php?left-menus=yes');";
    }
    $html = "\n<script>\n\tLoadAjax('middle','quicklinks.php');\n\tChangeHTMLTitle();\n</script>\n\n\n";
    $tpl = new template_users($title, $html, $_SESSION, 0, 0, 0, $cfg);
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    $html = $tpl->web_page;
    SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__, $html);
    echo $html;
    return;
    $html = "\t\n<script language=\"JavaScript\">       \nvar timerID  = null;\nvar timerID1  = null;\nvar tant=0;\nvar fire=0;\nvar loop=0;\nvar loop2=0;\nvar reste=0;\nvar mem_ossys=0;\n\nfunction Loop(){\n\tloop = loop+1;\n\tloop2 = loop2+1;\n\t\n\tif(loop2>10){\n\t\tif(!IfWindowsOpen()){if(RunJgrowlCheck()){Loadjs('jGrowl.php');}}\n\t\tloop2=0;\n\t}\n\t\n\t\n    fire=10-fire;\n    if(loop<25){\n    \tsetTimeout(\"Loop()\",5000);\n    }else{\n      loop=0;\n      Loop();\n    }\n}\n\n\tfunction RunJgrowlCheck(){\n\t\tif(!document.getElementById('navigation')){return false;}\n\t\tif(\$('#jGrowl').size()==0){return true;}\n\t\tif(\$('#jGrowl').size()==1){return true;}\n\t\treturn false;\n\t\n\t}\n\n\tfunction sysevents_query(){\n\t\tif(document.getElementById('q_daemons')){\n\t\t\tvar q_daemons=document.getElementById('q_daemons').value;\n\t\t\tvar q_lines=document.getElementById('q_lines').value;\n\t\t\tvar q_search=document.getElementById('q_search').value;\n\t\t\tLoadAjax('events','{$page}?main=logs&q_daemons='+ q_daemons +'&q_lines=' + q_lines + '&q_search='+q_search+'&hostname={$_GET["hostname"]}');\n\t\t\t}\n\t\n\t}\n\t\n\tfunction LoadCadencee(){\t\t\n\t\tLoadjs('jGrowl.php');\t\n\t\tsetTimeout(\"Loop()\",2000);\n\t}\n\n\n\tvar x_{$idmd}ChargeLogs= function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tdocument.getElementById('progression_js_left').innerHTML=tempvalue;\n\t\t}\t\t\n\t\nfunction LoadMemDump(){\n\t\tYahooWin(500,'{$page}?mem-dump=yes');\n\t}\n\n\n\nfunction CheckDaemon(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('CheckDaemon','yes');\n\tXHR.sendAndLoad('{$page}', 'GET');\n\t}\t\n\n\n</script>\t\n\t" . main_admin_tabs() . "\n\t\n\t<script>\n\t\n\t\tLoadCadencee();\n\t\tRTMMailHide();\n\t\t{$wizard_kaspersky_mail_appliance}\n\t\t{$left_menus}\n\t</script>\n\t{$arr[0]}\n\t";
    $cfg["JS"][] = $arr[1];
    $cfg["JS"][] = "js/admin.js";
    if (isset($_GET["admin-ajax"])) {
        $tpl = new templates();
        $html = $tpl->_ENGINE_parse_body($html);
        SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__ . "-admin-ajax", $html);
        echo $html;
        exit;
    }
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    $tpl = new templates();
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    $title = $tpl->_ENGINE_parse_body("<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('admin.chHostname.php');\" style='text-transform:lowercase;font-size:12px' >[<span id='hostnameInFront'>{$usersmenus->hostname}</span>]</a>&nbsp;{WELCOME} <span style='font-size:12px'>{$hash["displayName"]} </span>");
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    if ($users->KASPERSKY_SMTP_APPLIANCE) {
        $title = $tpl->_ENGINE_parse_body("<span style='color:#005447'>{WELCOME}</span> <span style='font-size:13px;color:#005447'>For Kaspersky SMTP Appliance</span>&nbsp;|&nbsp;<span style='font-size:12px'>{$hash["displayName"]} - <span style='text-transform:lowercase'>{$usersmenus->hostname}</span></span>");
    }
    if ($users->KASPERSKY_WEB_APPLIANCE) {
        $title = $tpl->_ENGINE_parse_body("<span style='color:black'>{WELCOME}</span> <span style='font-size:13px;color:black'>For Kaspersky Web Appliance</span>&nbsp;|&nbsp;<span style='font-size:12px'>{$hash["displayName"]} - <span style='text-transform:lowercase'>{$usersmenus->hostname}</span></span>");
    }
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    if ($users->ZARAFA_APPLIANCE) {
        $title = $tpl->_ENGINE_parse_body("<span style='color:#005447'>{WELCOME}</span> <span style='font-size:13px;color:#005447'>For Zarafa Mail Appliance</span>&nbsp;|&nbsp;<span style='font-size:12px'>{$hash["displayName"]} - <span style='text-transform:lowercase'>{$usersmenus->hostname}</span></span>");
    }
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    $tpl = new template_users($title, $html, $_SESSION, 0, 0, 0, $cfg);
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    $html = $tpl->web_page;
    SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__, $html);
    echo $html;
    if ($GLOBALS["VERBOSE"]) {
        echo "<H1>Finish</H1>";
    }
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
}
Esempio n. 8
0
function aliase_delete()
{
    $ldap = new clladp();
    $hash = $ldap->UserDatas($_SESSION["uid"]);
    $updatearray["mailAlias"] = $_GET["delete-alias-delete"];
    if (!$ldap->Ldap_del_mod($hash["dn"], $updatearray)) {
        echo $ldap->ldap_last_error;
    }
}
Esempio n. 9
0
function Save_Fetchmail(){
	$add=true;
	$mny=new usersMenus();
	if($mny->AllowFetchMails==false){return null;}
	if(isset($_GET["array_num"])){
		$array_num=$_GET["array_num"];
		unset($_GET["array_num"]);
		$add=false;
	}
		
	if($_GET["pool"]==null){return null;}
	while (list ($num, $ligne) = each ($_GET) ){	
		$line=$line."[$num]=\"$ligne\"\n";
	}
	$ldap=new clladp();
	$hash=$ldap->UserDatas($_SESSION["uid"]);
	
	
	if($add==true){
		$update_array["FetchMailsRules"][]=$line;
		$ldap->Ldap_add_mod($hash["dn"],$update_array);
	}else{
		$update_array["FetchMailsRules"]=$hash["FetchMailsRulesSources"];
		$update_array["FetchMailsRules"][$array_num]=$line;
		$ldap->Ldap_modify($hash["dn"],$update_array);
	}
	if($ldap->ldap_last_error<>null){echo $ldap->ldap_last_error;}else{echo "ok";}
	
}
function finduser()
{
    header("Pragma: no-cache");
    header("Expires: 0");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-cache, must-revalidate");
    $stringtofind = $_GET["finduser"];
    writelogs("Want to search {$stringtofind}", __FUNCTION__, __FILE__);
    $tpl = new templates();
    $usermenu = new usersMenus();
    $ldap = new clladp();
    if ($usermenu->AsAnAdministratorGeneric == true) {
        writelogs("It is an administrator search in the entire tree", __FUNCTION__, __FILE__);
        $hash_full = $ldap->UserSearch(null, $stringtofind);
    } else {
        $us = $ldap->UserDatas($_SESSION["uid"]);
        writelogs("It is an user search in the {$us["ou"]} tree", __FUNCTION__, __FILE__);
        $hash_full = $ldap->UserSearch($us["ou"], $stringtofind);
    }
    $hash1 = $hash_full[0];
    $hash2 = $hash_full[1];
    writelogs("Search results " . count($hash1) . " users and " . count($hash2) . " contacts", __FUNCTION__, __FILE__);
    $count = 0;
    if (is_array($hash1)) {
        while (list($num, $ligne) = each($hash1)) {
            if ($ligne["uid"][0] == null && $ligne["employeenumber"][0] == null) {
                continue;
            }
            $hash[$count]["displayname"][0] = $ligne["displayname"][0];
            $hash[$count]["givenname"][0] = $ligne["givenname"][0];
            $hash[$count]["uid"][0] = $ligne["uid"][0];
            $hash[$count]["employeenumber"][0] = $ligne["employeenumber"][0];
            $hash[$count]["title"][0] = $ligne["title"][0];
            $hash[$count]["uri"][0] = $ligne["uri"][0];
            $hash[$count]["mail"][0] = $ligne["mail"][0];
            $hash[$count]["phone"][0] = $ligne["telephonenumber"][0];
            $hash[$count]["sn"][0] = $ligne["sn"][0];
            $count = $count + 1;
        }
    }
    if (is_array($hash2)) {
        while (list($num, $ligne) = each($hash2)) {
            if ($ligne["uid"][0] == null && $ligne["employeenumber"][0] == null) {
                continue;
            }
            $hash[$count]["displayname"][0] = $ligne["displayname"][0];
            $hash[$count]["givenname"][0] = $ligne["givenname"][0];
            $hash[$count]["uid"][0] = $ligne["uid"][0];
            $hash[$count]["employeenumber"][0] = $ligne["employeenumber"][0];
            $hash[$count]["title"][0] = $ligne["title"][0];
            $hash[$count]["uri"][0] = $ligne["uri"][0];
            $hash[$count]["mail"][0] = $ligne["mail"][0];
            $hash[$count]["phone"][0] = $ligne["telephonenumber"][0];
            $hash[$count]["sn"][0] = $ligne["sn"][0];
            $count = $count + 1;
        }
    }
    $count = count($hash);
    writelogs("Search results {$count} items", __FUNCTION__, __FILE__);
    if (is_array($hash)) {
        while (list($num, $ligne) = each($hash)) {
            if ($ligne["uid"][0] == null && $ligne["employeenumber"][0] == null) {
                continue;
            }
            if ($ligne["uid"][0] == "squidinternalauth") {
                $count = $count - 1;
                continue;
            }
            $edit_config_user = MEMBER_JS($ligne["uid"][0], 1);
            if ($usermenu->AllowAddUsers == true) {
                $uri = $edit_config_user;
            } else {
                $uri = null;
            }
            if ($usermenu->AsOrgAdmin == true) {
                $uri = $edit_config_user;
            } else {
                $uri = null;
            }
            if ($usermenu->AsArticaAdministrator == true) {
                $uri = $edit_config_user;
            } else {
                $uri = null;
            }
            $displayname = $ligne["displayname"][0];
            $givenname = $ligne["givenname"][0];
            $mail = $ligne["mail"][0];
            if ($displayname == null) {
                $displayname = $ligne["uid"][0];
            }
            if ($givenname == null) {
                $givenname = '{unknown}';
            }
            if ($mail == null) {
                $mail = '{unknown}';
            }
            if ($ligne["employeenumber"][0] != null) {
                $user = new contacts($_SESSION["uid"], $ligne["employeenumber"][0]);
                $array["title"] = $user->displayName;
                $uri = "javascript:Loadjs('contact.php?employeeNumber={$ligne["employeenumber"][0]}')";
            } else {
                if ($ligne["uid"][0] != null) {
                    $array["title"] = $ligne["uid"][0];
                    $user = new user($ligne["uid"][0]);
                }
            }
            if (strlen($user->jpegPhoto) > 0) {
                $array["img"] = $user->img_identity;
            } else {
                $array["img"] = "img/contact-unknown-user.png";
            }
            writelogs("identity:{$user->img_identity} ", __FUNCTION__, __FILE__);
            $array["uri"] = $uri;
            $array["mail"] = $ligne["mail"][0];
            $array["phone"] = $ligne["telephonenumber"][0];
            $array["sn"] = $ligne["sn"][0];
            if ($displayname == null) {
                $displayname = "{$givenname} {$ligne["sn"][0]}";
            }
            $array["displayname"] = $displayname;
            $array["givenname"] = $givenname;
            $array["JS"] = $edit_config_user;
            $array["title"] = $ligne["title"][0];
            $tr_users[] = finduser_format($array);
        }
    }
    $tables[] = "<table style='width:100%'><tr>";
    $t = 0;
    while (list($key, $line) = each($tr_users)) {
        $line = trim($line);
        if ($line == null) {
            continue;
        }
        $t = $t + 1;
        $tables[] = "<td valign='top'>{$line}</td>";
        if ($t == 2) {
            $t = 0;
            $tables[] = "</tr><tr>";
        }
    }
    if ($t < 2) {
        for ($i = 0; $i <= $t; $i++) {
            $tables[] = "<td valign='top'>&nbsp;</td>";
        }
    }
    $tables[] = "</table>";
    $add = Paragraphe("my-address-book-user-add.png", '{add_new_contact}', '{add_new_contact_text}', "javascript:Loadjs('contact.php')");
    if ($_SESSION["uid"] == -100) {
        $add = null;
    }
    $html = "<p style='font-size:18px'>{search}:&laquo;{$stringtofind}&raquo; ({$count} {entries})</p>\n\t\n\t<center>\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top'>" . implode("\n", $tables) . "\n\t\t\n\t</td>\n\t<td valign='top'>\n\t{$add}\n\t</td>\n\t</tr>\n\t</table>\n\t\n\t</center>";
    echo $tpl->_ENGINE_parse_body($html);
}
function DeleteMailsFrom()
{
    $ldap = new clladp();
    $sender = $_GET["DeleteMailsFrom"];
    $hash = $ldap->UserDatas($_SESSION["uid"]);
    $mail = $hash["mail"];
    $sql = "SELECT file_path FROM `quarantine` WHERE `mailto`='{$mail}'  AND `mailfrom`='{$sender}'";
    $resultats = QUERY_SQL($sql);
    while ($ligne = mysql_fetch_array($resultats, MYSQL_ASSOC)) {
        $lines = $lines . $ligne["file_path"] . "\n";
    }
    $tempfile = dirname(__FILE__) . "/ressources/conf/" . md5($mail);
    $fp = fopen($tempfile, "w", 0);
    fputs($fp, $lines);
    fclose($fp);
    $sock = new sockets();
    $res = trim($sock->getfile("QuarantineDeletePattern:{$tempfile}"));
    if ($res == "OK") {
        $sql = "DELETE FROM `quarantine` WHERE `mailto`='{$mail}'  AND `mailfrom`='{$sender}'";
        QUERY_SQL($sql);
        echo "OK";
    }
}
Esempio n. 12
0
function DeleteMember()
{
    $usermenu = new usersMenus();
    $tpl = new templates();
    if ($usermenu->AllowAddUsers == false) {
        echo $tpl->_ENGINE_parse_body('{no_privileges}');
        exit;
    }
    $ldap = new clladp();
    $Userdatas = $ldap->UserDatas($_GET["DeleteMember"]);
    $dn = $Userdatas["dn"];
    $ldap->ldap_delete($dn, false);
    if ($ldap->ldap_last_error != null) {
        echo $ldap->ldap_last_error;
        exit;
    }
}
Esempio n. 13
0
function page($usersmenus){
if(GET_CACHED(__FILE__,__FUNCTION__,__FUNCTION__)){return null;}
$ldap=new clladp();
$page=CurrentPageName();
error_log(basename(__FILE__)." ".__FUNCTION__.'() line '. __LINE__);
$hash=$ldap->UserDatas($_SESSION["uid"]);
error_log(basename(__FILE__)." ".__FUNCTION__.'() line '. __LINE__);
if($hash["displayName"]==null){$hash["displayName"]="{Administrator}";}
$sock=new sockets();
$ou=$hash["ou"];
$users=new usersMenus();
error_log(basename(__FILE__)." ".__FUNCTION__.'() line '. __LINE__);
if($users->KASPERSKY_SMTP_APPLIANCE){
	if($sock->GET_INFO("KasperskyMailApplianceWizardFinish")<>1){
		$wizard_kaspersky_mail_appliance="Loadjs('wizard.kaspersky.appliance.php');";
	}
}

	if($users->KASPERSKY_WEB_APPLIANCE){
		$GLOBALS["CHANGE_TEMPLATE"]="squid.kav.html";
		$GLOBALS["JQUERY_UI"]="kavweb";
	}





$html="	
<script language=\"JavaScript\">       
var timerID  = null;
var timerID1  = null;
var tant=0;
var fire=0;
var loop=0;
var loop2=0;
var reste=0;
var mem_ossys=0;

function Loop(){
	loop = loop+1;
	loop2 = loop2+1;
	
	if(loop2>10){
		if(!IfWindowsOpen()){if(RunJgrowlCheck()){Loadjs('jGrowl.php');}}
		loop2=0;
	}
	
	
    fire=10-fire;
    if(loop<25){
    	setTimeout(\"Loop()\",5000);
    }else{
      loop=0;
      Loop();
    }
}

	function RunJgrowlCheck(){
		if(!document.getElementById('navigation')){return false;}
		if($('#jGrowl').size()==0){return true;}
		if($('#jGrowl').size()==1){return true;}
		return false;
	
	}

	function sysevents_query(){
		if(document.getElementById('q_daemons')){
			var q_daemons=document.getElementById('q_daemons').value;
			var q_lines=document.getElementById('q_lines').value;
			var q_search=document.getElementById('q_search').value;
			LoadAjax('events','$page?main=logs&q_daemons='+ q_daemons +'&q_lines=' + q_lines + '&q_search='+q_search+'&hostname={$_GET["hostname"]}');
			}
	
	}
	
	function LoadCadencee(){		
		Loadjs('jGrowl.php');	
		setTimeout(\"Loop()\",2000);
	}


	var x_{$idmd}ChargeLogs= function (obj) {
		var tempvalue=obj.responseText;
		document.getElementById('progression_js_left').innerHTML=tempvalue;
		}		
	
function LoadMemDump(){
		YahooWin(500,'$page?mem-dump=yes');
	}



function CheckDaemon(){
	var XHR = new XHRConnection();
	XHR.appendData('CheckDaemon','yes');
	XHR.sendAndLoad('$page', 'GET');
	}	


</script>	
	".main_admin_tabs()."
	
	<script>
	
		LoadCadencee();
		RTMMailHide();
		$wizard_kaspersky_mail_appliance
		
	</script>
	{$arr[0]}
	";

$cfg["JS"][]=$arr[1];
$cfg["JS"][]="js/admin.js";

if(isset($_GET["admin-ajax"])){
	$tpl=new templates();
	echo $tpl->_ENGINE_parse_body($html);
	exit;
}
error_log(basename(__FILE__)." ".__FUNCTION__.'() line '. __LINE__);
$tpl=new templates();
error_log(basename(__FILE__)." ".__FUNCTION__.'() line '. __LINE__);
$title=$tpl->_ENGINE_parse_body("<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('admin.chHostname.php');\" style='text-transform:lowercase;font-size:12px' >[<span id='hostnameInFront'>$usersmenus->hostname</span>]</a>&nbsp;{WELCOME} <span style='font-size:12px'>{$hash["displayName"]} </span>");

error_log(basename(__FILE__)." ".__FUNCTION__.'() line '. __LINE__);
if($users->KASPERSKY_SMTP_APPLIANCE){
	$title=$tpl->_ENGINE_parse_body("<span style='color:#005447'>{WELCOME}</span> <span style='font-size:13px;color:#005447'>For Kaspersky SMTP Appliance</span>&nbsp;|&nbsp;<span style='font-size:12px'>{$hash["displayName"]} - <span style='text-transform:lowercase'>$usersmenus->hostname</span></span>");
}
if($users->KASPERSKY_WEB_APPLIANCE){
	$title=$tpl->_ENGINE_parse_body("<span style='color:black'>{WELCOME}</span> <span style='font-size:13px;color:black'>For Kaspersky Web Appliance</span>&nbsp;|&nbsp;<span style='font-size:12px'>{$hash["displayName"]} - <span style='text-transform:lowercase'>$usersmenus->hostname</span></span>");
}
error_log(basename(__FILE__)." ".__FUNCTION__.'() line '. __LINE__);
if($users->ZARAFA_APPLIANCE){
	$title=$tpl->_ENGINE_parse_body("<span style='color:#005447'>{WELCOME}</span> <span style='font-size:13px;color:#005447'>For Zarafa Mail Appliance</span>&nbsp;|&nbsp;<span style='font-size:12px'>{$hash["displayName"]} - <span style='text-transform:lowercase'>$usersmenus->hostname</span></span>");
	
}

error_log(basename(__FILE__)." ".__FUNCTION__.'() line '. __LINE__);
$tpl=new template_users($title,$html,$_SESSION,0,0,0,$cfg);
error_log(basename(__FILE__)." ".__FUNCTION__.'() line '. __LINE__);
$html=$tpl->web_page;
SET_CACHED(__FILE__,__FUNCTION__,__FUNCTION__,$html);
echo $html;			
error_log(basename(__FILE__)." ".__FUNCTION__.'() line '. __LINE__);	
	
}
Esempio n. 14
0
function ViewScript()
{
    $uid = $_SESSION["uid"];
    $ldap = new clladp();
    $u = $ldap->UserDatas($uid);
    $script = $u["FetchMailsRulesSources"][$_GET["ViewScript"]];
    $tbl = explode("\n", $script);
    while (list($num, $ligne) = each($tbl)) {
        if ($ligne != null) {
            $arr[] = $ligne;
        }
    }
    $script = implode("\n", $tbl);
    $script = htmlspecialchars($script);
    $script = "<table style='width:100%'><tr><td valign='top' width=1%>" . imgtootltip('42-redo-left.png', '{back}', "LoadAjax('{$_GET["id"]}','{$page}?ViewRule={$_GET["ViewScript"]}&id={$_GET["id"]}');") . "</td><td valign='top'><code>{$script}</code></td></tr></table>";
    $script = nl2br($script);
    $script = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $script);
    echo $script;
}
Esempio n. 15
0
function page($usersmenus)
{
    $left_menus = null;
    if (isset($_GET["admin-ajax"])) {
        echo "<script>LoadAjax('middle','quicklinks.php');</script>";
        return;
    } else {
        if (GET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__)) {
            return null;
        }
    }
    $ldap = new clladp();
    $page = CurrentPageName();
    error_log(basename(__FILE__) . " " . __FUNCTION__ . "() [{$_SESSION["uid"]}] line " . __LINE__);
    $hash = $ldap->UserDatas($_SESSION["uid"]);
    error_log(basename(__FILE__) . " " . __FUNCTION__ . "() [{$_SESSION["uid"]}] line " . __LINE__);
    if ($hash["displayName"] == null) {
        $hash["displayName"] = "{Administrator}";
    }
    $sock = new sockets();
    $ou = $hash["ou"];
    $users = new usersMenus();
    error_log(basename(__FILE__) . " " . __FUNCTION__ . "() [{$_SESSION["uid"]}] line " . __LINE__);
    if (isset($_COOKIE["artica-template"])) {
        if (is_file("ressources/templates/{$_COOKIE["artica-template"]}/JQUERY_UI")) {
            $GLOBALS["JQUERY_UI"] = trim(@file_get_contents("ressources/templates/{$_COOKIE["artica-template"]}/JQUERY_UI"));
        }
    }
    if ($users->KASPERSKY_SMTP_APPLIANCE) {
        if ($sock->GET_INFO("KasperskyMailApplianceWizardFinish") != 1) {
            $wizard_kaspersky_mail_appliance = "Loadjs('wizard.kaspersky.appliance.php',true);";
        }
    }
    if ($users->KASPERSKY_WEB_APPLIANCE) {
        //$GLOBALS["CHANGE_TEMPLATE"]="squid.kav.html";
        //$GLOBALS["JQUERY_UI"]="kavweb";
    }
    if (isset($_GET["admin-ajax"])) {
        $left_menus = "LoadAjax('TEMPLATE_LEFT_MENUS','/admin.tabs.php?left-menus=yes',true);";
    }
    $html = "\n<script>\n\tLoadAjax('middle','quicklinks.php');\n\tChangeHTMLTitle();\n</script>\n\n\n";
    $tpl = new template_users($title, $html, $_SESSION, 0, 0, 0, $cfg);
    error_log(basename(__FILE__) . " " . __FUNCTION__ . "() [{$_SESSION["uid"]}] line " . __LINE__);
    $html = $tpl->web_page;
    SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__, $html);
    echo $html;
    return;
}
Esempio n. 16
0
function finduser_list()
{
    $keycached = "{$_GET["finduser"]}";
    header("Pragma: no-cache");
    header("Expires: 0");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-cache, must-revalidate");
    $GLOBALS["OUTPUT_DEBUG"] = false;
    $stringtofind = trim($_GET["finduser"]);
    if ($_POST["query"] != null) {
        $stringtofind = $_POST["query"];
    }
    if (!isset($_POST["rp"])) {
        $_POST["rp"] = 15;
    }
    $users = new usersMenus();
    $sock = new sockets();
    $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory");
    if (!is_numeric($EnableManageUsersTroughActiveDirectory)) {
        $EnableManageUsersTroughActiveDirectory = 0;
    }
    if (preg_match("#debug:(.+)#", $stringtofind, $re)) {
        $GLOBALS["OUTPUT_DEBUG"] = true;
        $stringtofind = trim($re[1]);
    }
    if ($GLOBALS["OUTPUT_DEBUG"]) {
        echo "Want to search {$stringtofind}<br>";
    }
    $tpl = new templates();
    $usermenu = new usersMenus();
    $ldap = new clladp();
    if (!$ldap->IsKerbAuth()) {
        if ($usermenu->AsAnAdministratorGeneric == true) {
            if ($GLOBALS["OUTPUT_DEBUG"]) {
                echo "It is an administrator search in the entire tree<br>";
            }
            $hash_full = $ldap->UserSearch(null, $stringtofind, $_POST["rp"]);
        } else {
            $us = $ldap->UserDatas($_SESSION["uid"]);
            if ($GLOBALS["OUTPUT_DEBUG"]) {
                echo "It is an user search in the {$us["ou"]} tree<br>";
            }
            $hash_full = $ldap->UserSearch($us["ou"], $stringtofind, $_POST["rp"]);
        }
        $hash1 = $hash_full[0];
        $hash2 = $hash_full[1];
        if ($GLOBALS["OUTPUT_DEBUG"]) {
            echo "Search results " . count($hash1) . " users and " . count($hash2) . " contacts<br>";
        }
    } else {
        include_once dirname(__FILE__) . "/ressources/class.external.ad.inc";
        $ad = new external_ad_search();
        $hash_full = $ad->UserSearch(null, $stringtofind, $_POST["rp"]);
        $hash1 = $hash_full[0];
        $hash2 = $hash_full[1];
        if ($GLOBALS["OUTPUT_DEBUG"]) {
            echo "Search results " . count($hash1) . " users and " . count($hash2) . " contacts<br>";
        }
    }
    $hash = array();
    $count = 0;
    $data = array();
    $data['page'] = 1;
    $data['total'] = 0;
    $data['rows'] = array();
    if (is_array($hash1)) {
        if ($GLOBALS["OUTPUT_DEBUG"]) {
            echo "<strong>Search results ->HASH1</strong><br>\n";
        }
        while (list($num, $ligne) = each($hash1)) {
            if (isset($ligne["samaccountname"][0])) {
                $ligne["uid"][0] = $ligne["samaccountname"][0];
            }
            if ($ligne["uid"][0] == null) {
                if (preg_match("#^CN=(.+?),#i", $ligne["dn"], $re)) {
                    $ligne["uid"][0] = $re[1];
                    $hash[$count]["displayname"][0] = $re[1];
                }
            }
            if ($EnableManageUsersTroughActiveDirectory == 0) {
                if ($ligne["uid"][0] == null && $ligne["employeenumber"][0] == null) {
                    continue;
                }
            }
            if (strpos($ligne["dn"], "dc=pureftpd,dc=organizations") > 0) {
                continue;
            }
            $hash[$count]["displayname"][0] = trim($ligne["displayname"][0]);
            $hash[$count]["givenname"][0] = $ligne["givenname"][0];
            if ($EnableManageUsersTroughActiveDirectory == 1) {
                $hash[$count]["uid"][0] = $ligne["samaccountname"][0];
            } else {
                $hash[$count]["uid"][0] = $ligne["uid"][0];
            }
            if (substr($hash[$count]["uid"][0], strlen($hash[$count]["uid"][0]) - 1, 1) == '$') {
                continue;
            }
            $hash[$count]["employeenumber"][0] = $ligne["employeenumber"][0];
            $hash[$count]["title"][0] = $ligne["title"][0];
            $hash[$count]["uri"][0] = $ligne["uri"][0];
            $hash[$count]["mail"][0] = $ligne["mail"][0];
            $hash[$count]["phone"][0] = $ligne["telephonenumber"][0];
            $hash[$count]["sn"][0] = $ligne["sn"][0];
            $hash[$count]["dn"] = $ligne["dn"];
            $count++;
        }
    } else {
        if ($GLOBALS["OUTPUT_DEBUG"]) {
            echo "<strong>Search results ->HASH1 NOT AN ARRAY</strong><br>\n";
        }
    }
    if (is_array($hash2)) {
        if ($GLOBALS["OUTPUT_DEBUG"]) {
            echo "<strong>Search results ->HASH2</strong><br>\n";
        }
        while (list($num, $ligne) = each($hash2)) {
            if (isset($ligne["samaccountname"][0])) {
                $ligne["uid"][0] = $ligne["samaccountname"][0];
            }
            if ($ligne["uid"][0] == null && $ligne["employeenumber"][0] == null) {
                continue;
            }
            if (strpos($ligne["dn"], "dc=pureftpd,dc=organizations") > 0) {
                continue;
            }
            $hash[$count]["displayname"][0] = $ligne["displayname"][0];
            $hash[$count]["givenname"][0] = $ligne["givenname"][0];
            $hash[$count]["uid"][0] = $ligne["uid"][0];
            $hash[$count]["employeenumber"][0] = $ligne["employeenumber"][0];
            $hash[$count]["title"][0] = $ligne["title"][0];
            $hash[$count]["uri"][0] = $ligne["uri"][0];
            $hash[$count]["mail"][0] = $ligne["mail"][0];
            $hash[$count]["phone"][0] = $ligne["telephonenumber"][0];
            $hash[$count]["sn"][0] = $ligne["sn"][0];
            $hash[$count]["dn"] = $ligne["dn"];
            $count = $count + 1;
        }
    } else {
        if ($GLOBALS["OUTPUT_DEBUG"]) {
            echo "<strong>Search results ->HASH2 NOT AN ARRAY</strong><br>\n";
        }
    }
    $count = count($hash);
    $data['total'] = $count;
    if ($count == 0) {
        json_error_show("no data", 1);
    }
    if ($GLOBALS["OUTPUT_DEBUG"]) {
        echo "<strong>Search results {$count} items</strong><br>\n";
    }
    if (is_array($hash)) {
        while (list($num, $ligne) = each($hash)) {
            if ($GLOBALS["OUTPUT_DEBUG"]) {
                echo "dn:{$ligne["dn"]}<br>";
            }
            if ($GLOBALS["OUTPUT_DEBUG"]) {
                echo "uid:{$ligne["uid"][0]}<br>";
            }
            if ($GLOBALS["OUTPUT_DEBUG"]) {
                echo "employeenumber:{$ligne["employeenumber"][0]}<br>";
            }
            if ($ligne["uid"][0] == null && $ligne["employeenumber"][0] == null) {
                if ($GLOBALS["OUTPUT_DEBUG"]) {
                    echo "null twice, aborting...<br>";
                }
                continue;
            }
            if ($ligne["uid"][0] == "squidinternalauth") {
                $count = $count - 1;
                continue;
            }
            if ($GLOBALS["OUTPUT_DEBUG"]) {
                echo "edit_config_user={$ligne["uid"][0]}<br>";
            }
            $edit_config_user = MEMBER_JS($ligne["uid"][0], 1, 0, $ligne["dn"]);
            if ($usermenu->AllowAddUsers == true) {
                $uri = $edit_config_user;
            } else {
                $uri = null;
            }
            if ($usermenu->AsOrgAdmin == true) {
                $uri = $edit_config_user;
            } else {
                $uri = null;
            }
            if ($usermenu->AsArticaAdministrator == true) {
                $uri = $edit_config_user;
            } else {
                $uri = null;
            }
            $displayname = trim($ligne["displayname"][0]);
            $givenname = $ligne["givenname"][0];
            $mail = $ligne["mail"][0];
            if ($displayname == null) {
                $displayname = $ligne["uid"][0];
            }
            if ($givenname == null) {
                $givenname = '{unknown}';
            }
            if ($mail == null) {
                $mail = '{unknown}';
            }
            if ($ligne["employeenumber"][0] != null) {
                $array["employeenumber"] = $ligne["employeenumber"][0];
                $user = new contacts($_SESSION["uid"], $ligne["employeenumber"][0]);
                $array["title"] = $user->displayName;
                $uri = "javascript:Loadjs('contact.php?employeeNumber={$ligne["employeenumber"][0]}')";
            } else {
                if ($ligne["uid"][0] != null) {
                    $array["title"] = $ligne["uid"][0];
                    $user = new user($ligne["uid"][0]);
                }
            }
            if (strlen($user->jpegPhoto) > 0) {
                $array["img"] = $user->img_identity;
            } else {
                $array["img"] = "img/contact-unknown-user.png";
            }
            writelogs("identity:{$user->img_identity} ", __FUNCTION__, __FILE__);
            $array["uri"] = $uri;
            $array["mail"] = $ligne["mail"][0];
            $array["phone"] = $ligne["telephonenumber"][0];
            $array["sn"] = $ligne["sn"][0];
            if (!$ldap->EnableManageUsersTroughActiveDirectory) {
                if ($displayname == null) {
                    $displayname = "{$givenname} {$ligne["sn"][0]}";
                }
            }
            $array["displayname"] = $displayname;
            $array["givenname"] = $givenname;
            $array["JS"] = $edit_config_user;
            $array["title"] = $ligne["title"][0];
            $array["ou"] = $user->ou;
            $array["uid"] = $ligne["uid"][0];
            $data['rows'][] = finduser_format($array);
        }
    }
    echo json_encode($data);
}
Esempio n. 17
0
function USER_SENDER_PARAM($userid){
			$us=new user($userid);
			
			$SenderParams=$us->SenderCanonicalSMTPRelay();
			
			$page=CurrentPageName();
			writelogs("USER_ACCOUNT::$userid",__FUNCTION__,__FILE__);
			
				
			$ldap=new clladp();
			$userarr=$ldap->UserDatas($userid);
			$hash=$ldap->ReadDNInfos($userarr["dn"]);	
			$hash["ou"]=$userarr["ou"];
			$ou=$hash["ou"];
			
			if(preg_match('#(.+?)@(.+)#',$hash["mail"],$reg)){
				$domain=$reg[2];
				$email=$reg[1];	
				}			
			
			$priv=new usersMenus();
			$button="<input type='button' value='{submit}&nbsp;&raquo;' OnClick=\"javascript:ParseForm('userLdapform2','$page',true);\">";
			$buttonSenderCanonical="<input type='button' OnClick=\"EditSenderCanonical('{$_GET["userid"]}')\" value='{edit} {sender_canonical}&nbsp;&raquo'>";
			if($priv->AllowAddUsers==false){$button=null;$delete=null;$buttonSenderCanonical=null;}
	
	
	$styleTDLeft="style='padding:5px;font-size:11px'";			
			
	$main=new main_cf();
	
	if($main->main_array["smtp_sender_dependent_authentication"]=="yes"){
		$sasl=new smtp_sasl_password_maps();
		preg_match('#(.+?):(.+)#',$sasl->smtp_sasl_password_hash[$hash["sendercanonical"]],$ath);
		
		$sasl="
		<tr>
			<td colspan=2 style='font-size:12px;padding:4px;font-weight:bold;border-bottom:1px solid #CCCCCC'>{smtp_sender_dependent_authentication}</td>
		</tr>
		<tr>
			<td align='right' nowrap class=legend $styleTDRight>{username}:</strong>
			<td $styleTDLeft>" . Field_text('smtp_sender_dependent_authentication_username',$ath[1])."</td>
		</tr>
		<tr>
			<td align='right' nowrap class=legend $styleTDRight>{password}:</strong>
			<td $styleTDLeft>" . Field_password('smtp_sender_dependent_authentication_password',$ath[2])."</td>
		</tr>		
		";
		
	}
	

		$enable_internet="
		<form name='userLdapform3'>
				<input type='hidden' name='ou' value='$ou'>
				<input type='hidden' name='SaveAllowedSMTP' value='yes'>
				<input type='hidden' name='dn' value='{$hash["dn"]}'>
				<input type='hidden' name='mail' value='$email'>
				<input type='hidden' name='user_domain' value='$domain'>
				<input type='hidden' name='uid' value='$userid'>	
		<table style='width:100%'>	
		<tr>
			<td colspan=2 style='font-size:12px;padding:4px;font-weight:bold;border-bottom:1px solid #CCCCCC'>{AllowedSMTPTroughtInternet}<p class=caption>{AllowedSMTPTroughtInternet_text}</p></td>
		</tr>				
		<tr>
			<td align='right' nowrap class=legend $styleTDRight>{AllowedSMTPTroughtInternet}:</strong>
			<td $styleTDLeft>" . Field_numeric_checkbox_img('AllowedSMTPTroughtInternet',$us->AllowedSMTPTroughtInternet,'{AllowedSMTPTroughtInternet_text}')."</td>
		</tr>
		<tr>
		<td colspan=2 align='right'>
			<input type='button' value='{edit}&nbsp;&raquo;' OnClick=\"javascript:ParseForm('userLdapform3','$page',true);\">
		</td>
		</tr>
		</table>
		</form>
		
		";
		
	if($priv->AllowAddUsers==false){$enable_internet=null;}	

	
   
	$html="
		
		<form name='userLdapform2'>
				<input type='hidden' name='ou' value='$ou'>
				<input type='hidden' name='SaveLdapUser' value='yes'>
				<input type='hidden' name='dn' value='{$hash["dn"]}'>
				<input type='hidden' name='mail' value='$email'>
				<input type='hidden' name='user_domain' value='$domain'>
				<input type='hidden' name='uid' value='$userid'>
		<table style='width:100%'>
		<tr>
			<td colspan=2 style='font-size:12px;padding:4px;font-weight:bold;border-bottom:1px solid #CCCCCC'>{sender_canonical}</td>
		</tr>		
		<tr>
			<td align='right' nowrap class=legend $styleTDRight>{sender_canonical}:</strong>
			<td $styleTDLeft>" . Field_text('SaveSenderCanonical',$hash["sendercanonical"],'width:70%')."&nbsp;".imgtootltip('ed_delete.gif','{delete}',"DeleteSenderCanonical('{$_GET["userid"]}');")."</td>
		</tr>
		<tr>
		<td colspan=2 align='right'>$buttonSenderCanonical</td>	
		</tr>
		$sasl
		<tr>
		<td colspan=2 align=right>$button</td>
		</tr>		
		</table>
		</form>
		<br>
		$enable_internet
		
		
	";
	
	$html="<H1>{$_GET["userid"]}:&nbsp;{sender_parameters}</H1>
	".$html;
	$tpl=new templates();
	echo $tpl->_ENGINE_parse_body($html);
	
}
Esempio n. 18
0
function page($usersmenus)
{
    if (GET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__)) {
        return null;
    }
    $page = CurrentPageName();
    $ldap = new clladp();
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    $hash = $ldap->UserDatas($_SESSION["uid"]);
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    if ($hash["displayName"] == null) {
        $hash["displayName"] = "{Administrator}";
    }
    $sock = new sockets();
    $ou = $hash["ou"];
    $users = new usersMenus();
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    if ($users->KASPERSKY_SMTP_APPLIANCE) {
        if ($sock->GET_INFO("KasperskyMailApplianceWizardFinish") != 1) {
            $wizard_kaspersky_mail_appliance = "Loadjs('wizard.kaspersky.appliance.php');";
        }
    }
    $html = "\t\n<script language=\"JavaScript\">       \nvar timerID  = null;\nvar timerID1  = null;\nvar tant=0;\nvar fire=0;\nvar loop=0;\nvar loop2=0;\nvar reste=0;\nvar mem_ossys=0;\n\nfunction Loop(){\n\tloop = loop+1;\n\tloop2 = loop2+1;\n\t\n\tif(loop2>10){\n\t\t\n\t\tif(!IfWindowsOpen()){\n\t\t\tif(RunJgrowlCheck()){\n\t\t\t\tLoadjs('jGrowl.php');\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tloop2=0;\n\t}\n\t\n\t\n    fire=10-fire;\n    if(loop<25){\n    \tsetTimeout(\"Loop()\",5000);\n    }else{\n      loop=0;\n      if(!IfWindowsOpen()){Demarre();}\n      Loop();\n    }\n}\n\n\tfunction RunJgrowlCheck(){\n\t\tif(\$('#jGrowl').size()==0){return true;}\n\t\tif(\$('#jGrowl').size()==1){return true;}\n\t\talert('jgrow=false');\n\t\treturn false;\n\t\n\t}\n\n\t\n\n\t\n\tfunction Demarre(){\n\t\tsetTimeout(\"ResfreshGraphs()\",800);\n\t\t\t\n\t\t}\n\t\t\n\tfunction ResfreshGraphs(){\n\t\tRefreshTab('admin_perso_tabs');\t\n\t}\n\tfunction RefreshStatusRight(){\n\t\tloop=0;\n\t\tLoadjs('{$page}?js-right=yes');\n\t}\n\n\n\tfunction RefreshStatusLeft(){\n\t\t\tLoadjs('{$page}?js-left=yes');\n\t\t}\n\t\t\n\tfunction sysevents_query(){\n\t\tif(document.getElementById('q_daemons')){\n\t\t\tvar q_daemons=document.getElementById('q_daemons').value;\n\t\t\tvar q_lines=document.getElementById('q_lines').value;\n\t\t\tvar q_search=document.getElementById('q_search').value;\n\t\t\tLoadAjax('events','{$page}?main=logs&q_daemons='+ q_daemons +'&q_lines=' + q_lines + '&q_search='+q_search+'&hostname={$_GET["hostname"]}');\n\t\t\t}\n\t\n\t}\n\t\n\tfunction LoadCadencee(){\n\t\t\n\t\tLoadjs('jGrowl.php');\t\n\t\tsetTimeout(\"Demarre()\",1500);\n\t\tsetTimeout(\"Loop()\",2000);\n\t\t\n\t\t\n\t}\n\n\n\tvar x_{$idmd}ChargeLogs= function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tdocument.getElementById('progression_js_left').innerHTML=tempvalue;\n\t\t}\t\t\n\t\nfunction LoadMemDump(){\n\t\tYahooWin(500,'{$page}?mem-dump=yes');\n\t}\n\n\n\nfunction CheckDaemon(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('CheckDaemon','yes');\n\tXHR.sendAndLoad('{$page}', 'GET');\n\t}\t\n\n\n</script>\t\n\t" . main_admin_tabs() . "\n\t\n\t<script>\n\t\n\t\tLoadCadencee();\n\t\tRTMMailHide();\n\t\t{$wizard_kaspersky_mail_appliance}\n\t\t\n\t</script>\n\t{$arr[0]}\n\t";
    $cfg["JS"][] = $arr[1];
    $cfg["JS"][] = "js/admin.js";
    if (isset($_GET["admin-ajax"])) {
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body($html);
        exit;
    }
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    $tpl = new templates();
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    $title = $tpl->_ENGINE_parse_body("<span style='text-transform:lowercase;font-size:12px'>[{$usersmenus->hostname}]</span>&nbsp;{WELCOME} <span style='font-size:12px'>{$hash["displayName"]} </span>");
    if ($users->KASPERSKY_SMTP_APPLIANCE) {
        $title = $tpl->_ENGINE_parse_body("<span style='color:#005447'>{WELCOME}</span> <span style='font-size:13px;color:#005447'>For Kaspersky SMTP Appliance</span>&nbsp;|&nbsp;<span style='font-size:12px'>{$hash["displayName"]} - <span style='text-transform:lowercase'>{$usersmenus->hostname}</span></span>");
    }
    if ($users->KASPERSKY_WEB_APPLIANCE) {
        $title = $tpl->_ENGINE_parse_body("<span style='color:#005447'>{WELCOME}</span> <span style='font-size:13px;color:#005447'>For Kaspersky Web Appliance</span>&nbsp;|&nbsp;<span style='font-size:12px'>{$hash["displayName"]} - <span style='text-transform:lowercase'>{$usersmenus->hostname}</span></span>");
    }
    if ($users->ZARAFA_APPLIANCE) {
        $title = $tpl->_ENGINE_parse_body("<span style='color:#005447'>{WELCOME}</span> <span style='font-size:13px;color:#005447'>For Zarafa Mail Appliance</span>&nbsp;|&nbsp;<span style='font-size:12px'>{$hash["displayName"]} - <span style='text-transform:lowercase'>{$usersmenus->hostname}</span></span>");
    }
    $tpl = new template_users($title, $html, $_SESSION, 0, 0, 0, $cfg);
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
    $html = $tpl->web_page;
    SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__, $html);
    echo $html;
    error_log(basename(__FILE__) . " " . __FUNCTION__ . '() line ' . __LINE__);
}
Esempio n. 19
0
function query_aliases(){
	
	if(isset($_SESSION["qaliases"])){return $_SESSION["qaliases"];}
	$ldap=new clladp();
	$hash=$ldap->UserDatas($_SESSION["uid"]);
	$hash["mailAlias"][]=$hash["mail"];

	if(count($hash["mailAlias"])>0){
		while (list ($num, $array) = each ($hash["mailAlias"]) ){
			$recieve[]="OR storage_recipients.recipient='{$array}'";
		
		}
		$a=implode(" ",$recieve);
		$mymails=substr($a,2,strlen($a));
		return $mymails;
	}
}
Esempio n. 20
0
function UpdateUser($id)
{
    $DisplayName = $_GET["EditBranchValue"];
    $updateA["displayName"] = $DisplayName;
    $ldap = new clladp();
    $hash = $ldap->UserDatas($id);
    if (!is_array($hash)) {
        echo "???";
        exit;
    }
    $ldap->Ldap_modify($hash["dn"], $updateA);
    if ($ldap->ldap_last_error != null) {
        echo "!Error";
    } else {
        echo $DisplayName;
    }
}
function LoadMembersNotAffected()
{
    $ou = $_GET["LoadMembersNotAffected"];
    $ldap = new clladp();
    $hash_users = $ldap->hash_get_users_Only_ou($ou);
    if (!is_array($hash_users)) {
        return null;
    }
    $html = "\n\t\n\t<table style='width:400px;margin-left:10px'>";
    while (list($num, $ligne) = each($hash_users)) {
        $arr = $ldap->UserDatas($num);
        $mail = $arr["mail"];
        $domain = $arr["domainName"];
        $html = $html . "\n\t\t<tr>\n\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t<td><a href=\"javascript:LoadUsersDatas('{$ligne}');\">{$ligne}</a></td>\n\t\t<td>{$mail}</td>\n\t\t<td>{$domain}</td>\n\t\t<td>" . imgtootltip('x.gif', '{delete}', "javascript:DeleteMember('{$ligne}','0')") . "</td>\n\t\t</tr>";
    }
    $html = $html . "</table>";
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html);
}
Esempio n. 22
0
function BuildLevel2($ou)
{
    $ldap = new clladp();
    $privileges = new usersMenus($_GET["PRIVS"]);
    $HashDomains = $ldap->hash_get_domains_ou($ou);
    $hash_group = $ldap->hash_groups($ou);
    $hash_transport = $ldap->hash_load_transport();
    $hash_users = $ldap->hash_get_users_Only_ou($ou);
    writelogs("BuildLevel2 ->{$ou} users number=" . count($hash_users), __FUNCTION__, basename(__FILE__));
    if ($privileges->AllowChangeDomains == true) {
        if (is_array($HashDomains)) {
            while (list($num, $ligne) = each($HashDomains)) {
                $items = $items . "{\n";
                $items = $items . "\t\t\t'id' : 'domain:{$ou},{$num}',\n";
                $items = $items . "\t\t\t'txt' : '{$ligne}',\n";
                if (isset($hash_transport[$ligne])) {
                    $items = $items . "\t\t\t'img' : 'alias-18.gif',\n";
                } else {
                    $items = $items . "\t\t\t'img' : 'globe.gif',\n";
                }
                $items = $items . "\t\t\t'editable' : false,\n";
                $items = $items . "\t\t\t'draggable' : false\n";
                $items = $items . "\t\t\t},";
            }
        }
    }
    if (is_array($hash_users)) {
        if (count($hash_users) > 50) {
            $count = count($hash_users);
            $items = $items . "{\n";
            $items = $items . "\t\t\t'id' : 'users:{$ou}',\n";
            $items = $items . "\t\t\t'txt' : '{$count} users',\n";
            $items = $items . "\t\t'openlink' : 'ldapTree.php',\n";
            $items = $items . "\t\t'draggable' : true,\n";
            $items = $items . "\t\t\t'img' : 'family-20.gif'\n";
            $items = $items . "\t\t\t},";
        }
    }
    if (is_array($hash_group)) {
        while (list($num, $ligne) = each($hash_group)) {
            $num = str_replace("'", "`", $num);
            if (strlen($num) > 20) {
                $num = substr($num, 0, 17) . "...";
            }
            $items = $items . "{\n";
            $items = $items . "\t\t\t'id' : 'group:{$ligne["gid"]}',\n";
            $items = $items . "\t\t\t'txt' : '{$num}',\n";
            $items = $items . "\t\t\t'img' : 'tree-groups',\n";
            $items = $items . "\t\t\t'editable' : true,\n";
            $items = $items . "\t\t\t'draggable' : false,\n";
            $items = $items . "\t\t'onopenpopulate' : myOpenPopulate,\n";
            $items = $items . "\t\t'openlink' : 'ldapTree.php',\n";
            $items = $items . "\t\t'canhavechildren' : true\n";
            $items = $items . "\t\t\t},";
        }
    }
    if (is_array($hash_users)) {
        if (count($hash_users) < 50) {
            while (list($num, $ligne) = each($hash_users)) {
                $userdatas = $ldap->UserDatas($ligne);
                $ligne = str_replace("'", "\\'", $ligne);
                $name = $userdatas["displayName"];
                $name = str_replace("'", "`", $name);
                $items = $items . "{\n";
                $items = $items . "\t\t\t'id' : 'user:{$ligne}',\n";
                $items = $items . "\t\t\t'txt' : '{$name}',\n";
                $items = $items . "\t\t'openlink' : 'ldapTree.php',\n";
                $items = $items . "\t\t'draggable' : true,\n";
                $items = $items . "\t\t\t'img' : 'outicon_1002.gif'\n";
                $items = $items . "\t\t\t},";
            }
        }
    }
    if ($items[strlen($items) - 1] == ',') {
        $items = substr($items, 0, strlen($items) - 1);
    }
    return $items;
}
Esempio n. 23
0
function DeleteHeaderRule(){
$ldap=new clladp();
	$tpl=new templates();
	$hash=$ldap->UserDatas($_SESSION["uid"]);
	$num=$_GET["DeleteHeaderRule"];
	$pattern=$hash["RegexRules"][$num];
	writelogs("Delete pattern $pattern/$num",__FUNCTION__,__FILE__);
	$hash["RegexRules"][$num]=null;

if(is_array($hash["RegexRules"])){
		while (list ($num, $ligne) = each ($hash["RegexRules"]) ){
			if(preg_match('#<header>(.+?)</header><pattern>(.+?)</pattern><regex>(.+?)</regex><action>(.+?)</action>#',$ligne)){
				$upd["ArticaUserFilterRule"][]=$ligne;
			}
			}
	}else{
		writelogs("Delete pattern set to default",__FUNCTION__,__FILE__);
		$upd["ArticaUserFilterRule"][]='DEFAULT';}
	
if(count($upd["ArticaUserFilterRule"])==0){$upd["ArticaUserFilterRule"][]='DEFAULT';}

	if(!$ldap->Ldap_modify($hash["dn"],$upd)){echo $ldap->ldap_last_error;}else{INDEX();}
}
function finduser(){
	$keycached="{$_GET["finduser"]}";
	if(GET_CACHED(__FILE__,__FUNCTION__,$keycached)){return null;}
	header("Pragma: no-cache");	
	header("Expires: 0");
	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
	header("Cache-Control: no-cache, must-revalidate");	
	$GLOBALS["OUTPUT_DEBUG"]=false;
	$stringtofind=trim($_GET["finduser"]);
	$users=new usersMenus();
	
	if(preg_match("#debug:(.+)#",$stringtofind,$re)){
		$GLOBALS["OUTPUT_DEBUG"]=true;
		$stringtofind=trim($re[1]);
	}
	
	if($GLOBALS["OUTPUT_DEBUG"]){echo "Want to search $stringtofind<br>";}
	$tpl=new templates();
	$usermenu=new usersMenus();
	$ldap=new clladp();
	if($usermenu->AsAnAdministratorGeneric==true){
		if($GLOBALS["OUTPUT_DEBUG"]){echo "It is an administrator search in the entire tree<br>";}
		$hash_full=$ldap->UserSearch(null,$stringtofind);
	}else{
		$us=$ldap->UserDatas($_SESSION["uid"]);
		if($GLOBALS["OUTPUT_DEBUG"]){echo "It is an user search in the {$us["ou"]} tree<br>";}
		$hash_full=$ldap->UserSearch($us["ou"],$stringtofind);
	}
	
	$hash1=$hash_full[0];
	$hash2=$hash_full[1];
	if($GLOBALS["OUTPUT_DEBUG"]){echo "Search results ".count($hash1) ." users and ".count($hash2)." contacts<br>";}
	
	
	$hash=array();
	$count=0;
	
	if(is_array($hash1)){
	while (list ($num, $ligne) = each ($hash1) ){
		if(!$ldap->EnableManageUsersTroughActiveDirectory){	if(($ligne["uid"][0]==null) && ($ligne["employeenumber"][0]==null)){continue;}}
		if(strpos($ligne["dn"],"dc=pureftpd,dc=organizations")>0){continue;}
		$hash[$count]["displayname"][0]=trim($ligne["displayname"][0]);
		$hash[$count]["givenname"][0]=$ligne["givenname"][0];
		if($ldap->EnableManageUsersTroughActiveDirectory){
			$hash[$count]["uid"][0]=$ligne["samaccountname"][0];
		}else{
			$hash[$count]["uid"][0]=$ligne["uid"][0];
		}
		if(substr($hash[$count]["uid"][0],strlen($hash[$count]["uid"][0])-1,1)=='$'){continue;}
		
		$hash[$count]["employeenumber"][0]=$ligne["employeenumber"][0];
		$hash[$count]["title"][0]=$ligne["title"][0];
		$hash[$count]["uri"][0]=$ligne["uri"][0];
		$hash[$count]["mail"][0]=$ligne["mail"][0];
		$hash[$count]["phone"][0]=$ligne["telephonenumber"][0];
		$hash[$count]["sn"][0]=$ligne["sn"][0];
		$hash[$count]["dn"]=$ligne["dn"];
		$count++;
		
	}}
	
	
	
	if(is_array($hash2)){
	while (list ($num, $ligne) = each ($hash2) ){
	if(($ligne["uid"][0]==null) && ($ligne["employeenumber"][0]==null)){continue;}
		if(strpos($ligne["dn"],"dc=pureftpd,dc=organizations")>0){continue;}
		$hash[$count]["displayname"][0]=$ligne["displayname"][0];
		$hash[$count]["givenname"][0]=$ligne["givenname"][0];
		$hash[$count]["uid"][0]=$ligne["uid"][0];
		$hash[$count]["employeenumber"][0]=$ligne["employeenumber"][0];
		$hash[$count]["title"][0]=$ligne["title"][0];
		$hash[$count]["uri"][0]=$ligne["uri"][0];
		$hash[$count]["mail"][0]=$ligne["mail"][0];
		$hash[$count]["phone"][0]=$ligne["telephonenumber"][0];
		$hash[$count]["sn"][0]=$ligne["sn"][0];
		$hash[$count]["dn"]=$ligne["dn"];
		$count=$count+1;
		
	}}	
	
	
	$count=count($hash);
	writelogs("Search results $count items" ,__FUNCTION__,__FILE__);
	
	if(is_array($hash)){
		
		while (list ($num, $ligne) = each ($hash) ){
			if($GLOBALS["OUTPUT_DEBUG"]){echo "dn:{$ligne["dn"]}<br>";}
			if($GLOBALS["OUTPUT_DEBUG"]){echo "uid:{$ligne["uid"][0]}<br>";}
			if($GLOBALS["OUTPUT_DEBUG"]){echo "employeenumber:{$ligne["employeenumber"][0]}<br>";}
			if(($ligne["uid"][0]==null) && ($ligne["employeenumber"][0]==null)){
				if($GLOBALS["OUTPUT_DEBUG"]){echo "null twice, aborting...<br>";}
				continue;
			}
			
			if($ligne["uid"][0]=="squidinternalauth"){$count=$count-1;continue;}
			
			if($GLOBALS["OUTPUT_DEBUG"]){echo "edit_config_user={$ligne["uid"][0]}<br>";}
			
			$edit_config_user=MEMBER_JS($ligne["uid"][0],1,0,$ligne["dn"]);
			
			if($usermenu->AllowAddUsers==true){$uri=$edit_config_user;}else{$uri=null;}
			if($usermenu->AsOrgAdmin==true){$uri=$edit_config_user;}else{$uri=null;}
			if($usermenu->AsArticaAdministrator==true){$uri=$edit_config_user;}else{$uri=null;}
			
			
			
			$displayname=trim($ligne["displayname"][0]);
			$givenname=$ligne["givenname"][0];
			$mail=$ligne["mail"][0];
			
			if($displayname==null){$displayname=$ligne["uid"][0];}
			if($givenname==null){$givenname='{unknown}';}
			if($mail==null){$mail='{unknown}';}

			if($ligne["employeenumber"][0]<>null){
				$user=new contacts($_SESSION["uid"],$ligne["employeenumber"][0]);
				$array["title"]=$user->displayName;
				$uri="javascript:Loadjs('contact.php?employeeNumber={$ligne["employeenumber"][0]}')";			
				
			}else{
				if($ligne["uid"][0]<>null){
					$array["title"]=$ligne["uid"][0];
					$user=new user($ligne["uid"][0]);
					
					
				}
			}
			
				if(strlen($user->jpegPhoto)>0){$array["img"]=$user->img_identity;}else{$array["img"]="img/contact-unknown-user.png";}
				writelogs("identity:$user->img_identity ",__FUNCTION__,__FILE__);
				$array["uri"]=$uri;
				$array["mail"]=$ligne["mail"][0];;
				$array["phone"]=$ligne["telephonenumber"][0];
				$array["sn"]=$ligne["sn"][0];
				if(!$ldap->EnableManageUsersTroughActiveDirectory){
					if($displayname==null){$displayname="$givenname {$ligne["sn"][0]}";}
				}
				$array["displayname"]=$displayname;								
				$array["givenname"]=$givenname;
				$array["JS"]=$edit_config_user;
				$array["title"]=$ligne["title"][0];;;
				$tr_users[]=finduser_format($array);
			}
		}
	
		
$tables[]="<table style='width:100%'><tr>";
$t=0;
while (list ($key, $line) = each ($tr_users) ){
		$line=trim($line);
		if($line==null){continue;}
		$t=$t+1;
		$tables[]="<td valign='top'>$line</td>";
		if($t==2){$t=0;$tables[]="</tr><tr>";}
		
}
if($t<2){
	for($i=0;$i<=$t;$i++){
		$tables[]="<td valign='top'>&nbsp;</td>";				
	}
}
				
$tables[]="</table>";	
	
		
	$add=Paragraphe("my-address-book-user-add.png",'{add_new_contact}','{add_new_contact_text}',"javascript:Loadjs('contact.php')");
	if($_SESSION["uid"]==-100){$add=null;}		
	$html="<p style='font-size:18px'>{search}:&laquo;$stringtofind&raquo; ($count {entries})</p>
	
	<center>
	<table style='width:100%'>
	<tr>
	<td valign='top'>". implode("\n",$tables). "
		
	</td>
	<td valign='top'>
	$add
	</td>
	</tr>
	</table>
	
	</center>";
	
	$html=$tpl->_ENGINE_parse_body($html);
	SET_CACHED(__FILE__,__FUNCTION__,$keycached,$html);
	echo $html;
	
}
Esempio n. 25
0
function DeleteAliases()
{
    $ldap = new clladp();
    $hash = $ldap->UserDatas($_GET["DeleteAliases"]);
    $updatearray["mailAlias"] = $_GET["aliase"];
    if (!$ldap->Ldap_del_mod($hash["dn"], $updatearray)) {
        echo $ldap->ldap_last_error;
    }
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?postfix-hash-tables=yes");
}
Esempio n. 26
0
function DeleteRobot()
{
    $ldap = new clladp();
    $H = $ldap->UserDatas($_GET["DeleteRobot"]);
    $dn = $H["dn"];
    $ldap->ldap_delete($dn, true);
}
Esempio n. 27
0
function LoadFetchMailRuleFromUser()
{
    $ldap = new clladp();
    $u = $ldap->UserDatas($_GET["LoadFetchMailRuleFromUser"]);
    $fr = new Fetchmail_settings();
    $tpl = new templates();
    while (list($num, $ligne) = each($u["FetchMailsRulesSources"])) {
        $arr = $fr->parse_config($ligne);
        $arr = $arr[1];
        $line = "\n\t\t<table>\n\t\t<tr>\n\t\t<td width=1% valign='top'><img src='img/fw_bold.gif'></td>\n\t\t<td width=1% nowrap valign='top'>{rule} {$num}</td>\n\t\t<td>" . $arr["poll"] . " {from} " . $arr["user"] . " {to} " . $arr["is"] . "</td>\n\t\t</tr>\n\t\t</table>";
        $res[] = RoundedLightGrey($tpl->_ENGINE_parse_body($line), "javascript:UserFetchMailRule({$num},'{$_GET["LoadFetchMailRuleFromUser"]}');", 1);
    }
    echo $tpl->_ENGINE_parse_body(implode("<br>", $res));
    echo $list;
}
Esempio n. 28
0
function pie_single_mailbox_user()
{
    $tpl = new Templates();
    $users = new usersMenus();
    $uid = $_SESSION["uid"];
    if ($users->cyrus_imapd_installed == 0) {
        return null;
    }
    $ldap = new clladp();
    $hash = $ldap->UserDatas($_SESSION["uid"]);
    if ($hash["MailboxActive"] != 'TRUE') {
        return null;
    }
    $cyrus = new cyrus();
    $res = $cyrus->get_quota_array($uid);
    $size = $cyrus->MailboxInfosSize($uid);
    $free = $cyrus->USER_STORAGE_LIMIT - $cyrus->USER_STORAGE_USAGE;
    if (!$cyrus->MailBoxExists($uid)) {
        return null;
    }
    $USER_STORAGE_USAGE = $cyrus->USER_STORAGE_USAGE;
    $USER_STORAGE_LIMIT = $cyrus->USER_STORAGE_LIMIT;
    $FREE = $free;
    writelogs("USER_STORAGE_USAGE={$USER_STORAGE_USAGE}", __FUNCTION__, __FILE__);
    writelogs("STORAGE_LIMIT={$USER_STORAGE_LIMIT}", __FUNCTION__, __FILE__);
    if ($USER_STORAGE_LIMIT == null) {
        $USER_STORAGE_LIMIT = 1000000;
        $USER_STORAGE_USAGE = 0;
        $FREE = $USER_STORAGE_LIMIT;
    }
    $USER_STORAGE_RESTANT = $USER_STORAGE_LIMIT - $USER_STORAGE_USAGE;
    if ($USER_STORAGE_RESTANT > 1) {
        $reste = round($USER_STORAGE_RESTANT / 1024);
        $data = array($USER_STORAGE_USAGE, $USER_STORAGE_RESTANT);
    } else {
        $data = array($USER_STORAGE_USAGE);
    }
    $title = $tpl->_ENGINE_parse_body("{your mailbox usage} ({$reste} mb free)");
    writelogs("USER_STORAGE_USAGE={$USER_STORAGE_USAGE} - USER_STORAGE_LIMIT={$USER_STORAGE_LIMIT} FREE={$FREE}", __FUNCTION__, __FILE__);
    $date = date('Y-m-d');
    $textes = array();
    $donnees = array();
    $zlabel = array();
    $date = date('Y-m-d');
    $donnees[] = $FREE;
    $textes[] = "{$FREE} Free";
    $donnees[] = $USER_STORAGE_USAGE;
    $textes[] = "{$USER_STORAGE_USAGE} used";
    $data = $donnees;
    $graph = new PieGraph(370, 350, 'auto');
    //$graph->SetShadow();
    $graph->title->Set($title);
    $graph->title->SetFont(FF_FONT1, FS_BOLD);
    $p1 = new PiePlot3D($data);
    $p1->SetLabels($textes, 1);
    $p1->SetEdge('black', 0);
    $p1->SetAngle(55);
    $p1->SetLabelMargin(2);
    $p1->SetCenter(0.4, 0.5);
    $p1->ExplodeAll(10);
    $graph->Add($p1);
    $graph->SetFrame(false);
    $graph->StrokeCSIM();
}