Ejemplo n.º 1
0
function find_member()
{
    $tofind = $_GET["find-member"];
    if ($_SESSION["uid"] == -100) {
        $ou = $_GET["ou"];
    } else {
        $ou = $_SESSION["ou"];
    }
    $ldap = new clladp();
    if (is_base64_encoded($ou)) {
        $ou = base64_decode($ou);
    }
    if ($tofind == null) {
        $tofind = '*';
    } else {
        $tofind = "*{$tofind}*";
    }
    $tofind = str_replace('***', '*', $tofind);
    writelogs("FIND {$tofind} IN OU \"{$ou}\"", __FUNCTION__, __FILE__, __LINE__);
    $filter = "(&(objectClass=userAccount)(|(cn={$tofind})(mail={$tofind})(displayName={$tofind})(uid={$tofind}) (givenname={$tofind}) ))";
    $attrs = array("displayName", "uid", "mail", "givenname", "telephoneNumber", "title", "sn", "mozillaSecondEmail", "employeeNumber");
    $dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
    $hash = $ldap->Ldap_search($dn, $filter, $attrs, 20);
    $users = new user();
    $number = $hash["count"];
    for ($i = 0; $i < $number; $i++) {
        $user = $hash[$i];
        $html = $html . formatUser($user);
    }
    return $html;
}
Ejemplo n.º 2
0
function js(){
$page=CurrentPageName();
$tpl=new templates();
$title=$tpl->_ENGINE_parse_body("{remote_users_databases}");
if(is_base64_encoded($_GET["ou"])){$ou=base64_decode($_GET["ou"]);}else{$ou=$_GET["ou"];}
$hostname=$_GET["hostname"];
$add=$tpl->_ENGINE_parse_body("{add}");
$howto=$tpl->_ENGINE_parse_body("{howto}");
$html="

function remote_users_databases_load(){
	YahooWin4('736','$page?popup=yes&ou={$_GET["ou"]}&hostname=$hostname','$ou/$hostname::$title');
	}
	
function FormDatabase(md){
	var title='';
	if(md==''){title='$add';}
	YahooWin5('650','$page?form-database='+md+'&ou={$_GET["ou"]}&hostname=$hostname','$ou/$hostname::'+title);
}
function ADExtHowto(){
	var title='';
	YahooWin6('650','$page?howto=yes&ou={$_GET["ou"]}&hostname=$hostname','$ou/$hostname::$howto');
}


	remote_users_databases_load();
";
echo $html;
}
Ejemplo n.º 3
0
function js(){
	$page=CurrentPageName();
	$tpl=new templates();
	if(is_base64_encoded($_GET["ou"])){$_GET["ou"]=base64_decode($_GET["ou"]);}
	$title="{ip_rotator}::{$_GET["hostname"]}/{$_GET["ou"]}";
	$title=$tpl->_ENGINE_parse_body($title);
	$_GET["ou"]=urlencode($_GET["ou"]);
	echo "YahooWin3(660,'$page?tabs=yes&hostname={$_GET["hostname"]}&ou={$_GET["ou"]}','$title');";
	}
Ejemplo n.º 4
0
function find_member()
{
    if ($_POST["qtype"] == "find-member") {
        $tofind = $_POST["query"];
    }
    if ($_SESSION["uid"] == -100) {
        $ou = $_GET["ou"];
    } else {
        $ou = $_SESSION["ou"];
    }
    $sock = new sockets();
    if (is_base64_encoded($ou)) {
        $ou = base64_decode($ou);
    }
    if ($tofind == null) {
        $tofind = '*';
    } else {
        $tofind = "*{$tofind}*";
    }
    $tofind = str_replace('***', '*', $tofind);
    $tofind = str_replace('**', '*', $tofind);
    $tofind = str_replace('**', '*', $tofind);
    $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory");
    if (!is_numeric($EnableManageUsersTroughActiveDirectory)) {
        $EnableManageUsersTroughActiveDirectory = 0;
    }
    writelogs("FIND {$tofind} IN OU \"{$ou}\"", __FUNCTION__, __FILE__, __LINE__);
    $ldap = new clladp();
    if (!$ldap->IsOUUnderActiveDirectory($ou)) {
        if ($EnableManageUsersTroughActiveDirectory == 1) {
            $cc = new ldapAD();
            $hash = $cc->find_users($ou, $tofind);
        } else {
            $ldap = new clladp();
            $filter = "(&(objectClass=userAccount)(|(cn={$tofind})(mail={$tofind})(displayName={$tofind})(uid={$tofind}) (givenname={$tofind}) ))";
            $attrs = array("displayName", "uid", "mail", "givenname", "telephoneNumber", "title", "sn", "mozillaSecondEmail", "employeeNumber", "sAMAccountName");
            $dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
            $hash = $ldap->Ldap_search($dn, $filter, $attrs, 20);
        }
    } else {
        include_once dirname(__FILE__) . "/ressources/class.external.ad.inc";
        $p = new external_ad_search();
        $hash = $p->find_users($ou, $tofind);
        $ldap->EnableManageUsersTroughActiveDirectory = true;
    }
    $users = new user();
    $number = $hash["count"];
    $data = array();
    $data['page'] = 0;
    $data['total'] = $number;
    $data['rows'] = array();
    for ($i = 0; $i < $number; $i++) {
        $user = $hash[$i];
        $data['rows'][] = formatUser($user, $ldap->EnableManageUsersTroughActiveDirectory);
    }
    echo json_encode($data);
}
Ejemplo n.º 5
0
function domain_selected()
{
    $t = $_GET["t"];
    $ldap = new clladp();
    if (is_base64_encoded($_GET["ou"])) {
        $_GET["ou"] = base64_decode($_GET["ou"]);
    }
    $hash_domains = $ldap->hash_get_domains_ou($_GET["ou"]);
    $domains = Field_array_Hash($hash_domains, "internet_domain-{$t}", $_GET["ch-domain"], null, null, 0, "font-size:28px;padding:3px");
    echo $domains;
}
Ejemplo n.º 6
0
function build_queues($ou)
{
    if (is_base64_encoded($ou)) {
        $ou = base64_decode($ou);
    }
    event(__FUNCTION__, __LINE__, "Checking {$ou} organization");
    $sql = "SELECT ID FROM emailing_campain_linker WHERE ou='{$ou}' AND queue_builder_pourc=0 ORDER BY ID DESC";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        event(__FUNCTION__, __LINE__, "Checking campaign N.{$ligne["ID"]}");
        $ID = $ligne["ID"];
        construct_queue($ID, $ou);
    }
}
Ejemplo n.º 7
0
function js()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $title = $tpl->_ENGINE_parse_body("{remote_users_databases}");
    if (is_base64_encoded($_GET["ou"])) {
        $ou = base64_decode($_GET["ou"]);
    } else {
        $ou = $_GET["ou"];
    }
    $hostname = $_GET["hostname"];
    $add = $tpl->_ENGINE_parse_body("{add}");
    $howto = $tpl->_ENGINE_parse_body("{howto}");
    $html = "\n\nfunction remote_users_databases_load(){\n\tYahooWin4('736','{$page}?popup=yes&ou={$_GET["ou"]}&hostname={$hostname}','{$ou}/{$hostname}::{$title}');\n\t}\n\t\nfunction FormDatabase(md){\n\tvar title='';\n\tif(md==''){title='{$add}';}\n\tYahooWin5('650','{$page}?form-database='+md+'&ou={$_GET["ou"]}&hostname={$hostname}','{$ou}/{$hostname}::'+title);\n}\nfunction ADExtHowto(){\n\tvar title='';\n\tYahooWin6('650','{$page}?howto=yes&ou={$_GET["ou"]}&hostname={$hostname}','{$ou}/{$hostname}::{$howto}');\n}\n\n\n\tremote_users_databases_load();\n";
    echo $html;
}
function SrvMilterServ()
{
    $sock = new sockets();
    if (is_base64_encoded($_GET["ou"])) {
        $_GET["ou"] = base64_decode($_GET["ou"]);
    }
    $datas = unserialize(base64_decode($sock->getFrameWork("postfix.php?mgreylist-srv=yes&hostname={$_GET["hostname"]}&ou={$_GET["ou"]}&what={$_GET["type"]}")));
    krsort($datas);
    while (list($num, $ligne) = each($datas)) {
        $ligne = trim($ligne);
        if ($ligne == null) {
            continue;
        }
        $html = $html . "<div><code style='font-size:13px'>{$ligne}</code></div>";
    }
    $html = $html . "<script>MiltergreylistMilterStatus();YahooWin5Hide();</script>";
    echo $html;
}
function MIGRATION_DELETE_TASK()
{
    $ou = $_GET["ou"];
    if (is_base64_encoded($ou)) {
        $ou = base64_decode($ou);
    }
    if (!is_numeric($_GET["DELETE_TASK"])) {
        echo "Not numeric!";
        return;
    }
    $sql = "DELETE FROM mbx_migr WHERE ID='{$_GET["DELETE_TASK"]}' AND ou='{$ou}'";
    $q = new mysql();
    if ($GLOBALS["VERBOSE"]) {
        echo "<br><strong>{$sql}</strong>\n";
    }
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo $q->mysql_error;
    }
    $sql = "DELETE FROM mbx_migr_users WHERE \tmbx_migr_id='{$_GET["DELETE_TASK"]}' AND ou='{$ou}'";
    if ($GLOBALS["VERBOSE"]) {
        echo "<br><strong>{$sql}</strong>\n";
    }
    $q->QUERY_SQL($sql, "artica_backup");
}
function users_list()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $ldap = new clladp();
    if ($ldap->IsKerbAuth()) {
        users_list_active_directory();
        return;
    }
    $database = "artica_backup";
    $search = '%';
    $table = "squid_ssl";
    $page = 1;
    $FORCE_FILTER = "AND `type`='ssl-bump-wl'";
    $t = $_GET["t"];
    $sock = new sockets();
    $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory");
    if (!is_numeric($EnableManageUsersTroughActiveDirectory)) {
        $EnableManageUsersTroughActiveDirectory = 0;
    }
    if (is_base64_encoded($_GET["ou"])) {
        $ou_encoded = $_GET["ou"];
        $ou = base64_decode($_GET["ou"]);
    } else {
        $ou = $_GET["ou"];
        $ou_encoded = base64_encode($_GET["ou"]);
    }
    if ($_SESSION["uid"] != -100) {
        $ou = $_SESSION["ou"];
    }
    if ($_POST["query"] != null) {
        $tofind = $_POST["query"];
    }
    if ($tofind == null) {
        $tofind = '*';
    } else {
        $tofind = "*{$tofind}*";
    }
    $filter = "(&(objectClass=userAccount)(|(cn={$tofind})(mail={$tofind})(displayName={$tofind})(uid={$tofind}) (givenname={$tofind})))";
    $attrs = array("displayName", "uid", "mail", "givenname", "telephoneNumber", "title", "sn", "mozillaSecondEmail", "employeeNumber", "sAMAccountName");
    if (!$ldap->IsOUUnderActiveDirectory($ou)) {
        if ($EnableManageUsersTroughActiveDirectory == 1) {
            $cc = new ldapAD();
            $hash = $cc->find_users($ou, $tofind);
        } else {
            $ldap = new clladp();
            $dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
            $hash = $ldap->Ldap_search($dn, $filter, $attrs, 150);
        }
    } else {
        $EnableManageUsersTroughActiveDirectory = 1;
        include_once dirname(__FILE__) . "/ressources/class.external.ad.inc";
        $ad = new external_ad_search();
        $hash = $ad->find_users($ou, $tofind);
    }
    $users = new user();
    $number = $hash["count"];
    if (!is_numeric($number)) {
        $number = 0;
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = $number;
    $data['rows'] = array();
    for ($i = 0; $i < $number; $i++) {
        $userARR = $hash[$i];
        $uid = $userARR["uid"][0];
        if ($EnableManageUsersTroughActiveDirectory == 1) {
            $uid = $userARR["samaccountname"][0];
        }
        if ($uid == "squidinternalauth") {
            continue;
        }
        $js = MEMBER_JS($uid, 1, 1);
        if ($userARR["sn"][0] == null && $userARR["givenname"][0] == null) {
            $userARR["sn"][0] = $uid;
        }
        $sn = texttooltip($userARR["sn"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $givenname = texttooltip($userARR["givenname"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $title = texttooltip($userARR["title"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $mail = texttooltip($userARR["mail"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $telephonenumber = texttooltip($userARR["telephonenumber"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        if ($userARR["telephonenumber"][0] == null) {
            $userARR["telephonenumber"][0] = "&nbsp;";
        }
        if ($userARR["mail"][0] == null) {
            $userARR["mail"][0] = "&nbsp;";
        }
        $img = imgsimple("contact-24.png", null, $js);
        $href = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='text-decoration:underline'>";
        $dele = imgsimple("delete-24.png", null, "Loadjs('domains.delete.user.php?uid={$uid}&flexRT={$t}');");
        $data['rows'][] = array('id' => $uid, 'cell' => array($img, "<span style='font-size:14px;color:{$color}'>{$href}{$userARR["sn"][0]} {$userARR["givenname"][0]}</a><div><i>{$userARR["title"][0]}</i></span>", "<span style='font-size:14px;color:{$color}'>{$userARR["telephonenumber"][0]}</span>", "<span style='font-size:14px;color:{$color}'>{$href}{$userARR["mail"][0]}</a></span>", $dele));
    }
    echo json_encode($data);
}
Ejemplo n.º 11
0
function organization_users_find_member()
{
    $t = time();
    $html = "\n\t<div id='{$t}'></div>\n\t<script>\n\t\tLoadAjax('{$t}','domains.manage.org.findusers.php?ou={$ou}');\n\t</script>\n\t";
    echo $html;
    return;
    $keycached = "{$_GET["finduser"]}{$_GET["ou"]}";
    if (GET_CACHED(__FILE__, __FUNCTION__, $keycached)) {
        return true;
    }
    $sock = new sockets();
    $tofind = $_GET["finduser"];
    $tpl = new templates();
    $page = CurrentPageName();
    $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory");
    if (!is_numeric($EnableManageUsersTroughActiveDirectory)) {
        $EnableManageUsersTroughActiveDirectory = 0;
    }
    if (is_base64_encoded($_GET["ou"])) {
        $ou_encoded = $_GET["ou"];
        $ou = base64_decode($_GET["ou"]);
    } else {
        $ou = $_GET["ou"];
        $ou_encoded = base64_encode($_GET["ou"]);
    }
    writelogs("Find users {$tofind} in {$ou} (encoded={$_GET["ou"]}) EnableManageUsersTroughActiveDirectory:{$EnableManageUsersTroughActiveDirectory}", __FUNCTION__, __FILE__, __LINE__);
    if ($_SESSION["uid"] != -100) {
        $ou = $_SESSION["ou"];
    }
    if ($tofind == null) {
        $tofind = '*';
    } else {
        $tofind = "*{$tofind}*";
    }
    $filter = "(&(objectClass=userAccount)(|(cn={$tofind})(mail={$tofind})(displayName={$tofind})(uid={$tofind}) (givenname={$tofind})))";
    $attrs = array("displayName", "uid", "mail", "givenname", "telephoneNumber", "title", "sn", "mozillaSecondEmail", "employeeNumber", "sAMAccountName");
    if ($EnableManageUsersTroughActiveDirectory == 1) {
        $cc = new ldapAD();
        $hash = $cc->find_users($ou, $tofind);
    } else {
        $ldap = new clladp();
        $dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
        $hash = $ldap->Ldap_search($dn, $filter, $attrs, 150);
    }
    $users = new user();
    $number = $hash["count"];
    if (!is_numeric($number)) {
        $number = 0;
    }
    $bg = "#FFFFFF";
    writelogs("Find users {$tofind} in ou {$ou} DN:\"{$dn}\" (encoded={$_GET["ou"]}) {$number} items", __FUNCTION__, __FILE__, __LINE__);
    $html = "\n\t\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'>\n\t\t<div style='width:100%;height:560px;overflow:auto'>\t\n\t\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n\t\t<thead class='thead'>\n\t\t\t<tr>\n\t\t\t\t<th colspan=4>{$tofind}</th>\n\t\t\t</tr>\n\t\t</thead>\n\t\t<tbody class='tbody'>\n\t\t\t\t\n\t";
    $add_user_disabled = Paragraphe('folder-useradd-64-grey.png', '{create_user}', '{create_user_text}');
    $add_user = Paragraphe('folder-useradd-64.png', '{create_user}', '{create_user_text}', "javascript:Loadjs('domains.add.user.php?ou={$ou}')", null, 210, null, 0, true);
    $groups = Paragraphe('folder-group-64.png', '{manage_groups}', '{manage_groups_text}', "javascript:Loadjs('domains.edit.group.php?ou={$ou_encoded}&js=yes')", null, 210, 100, 0, true);
    $delete_all_users = Paragraphe('member-64-delete.png', '{delete_all_users}', '{delete_all_users_text}', "javascript:DeleteAllusers()", null, 210, 100, 0, true);
    if ($EnableManageUsersTroughActiveDirectory == 1) {
        $delete_all_users = Paragraphe('member-64-delete-grey.png', '{delete_all_users}', '{delete_all_users_text}', "", null, 210, 100, 0, true);
    }
    $usermenus = new usersMenus();
    if ($usermenus->ARTICA_META_ENABLED) {
        if ($sock->GET_INFO("AllowArticaMetaAddUsers") != 1) {
            $add_user = $add_user_disabled;
        }
    }
    if ($EnableManageUsersTroughActiveDirectory == 1) {
        $add_user = $add_user_disabled;
    }
    $delete_all_users_warn = $tpl->javascript_parse_text("{delete_all_users_warn}");
    for ($i = 0; $i < $number; $i++) {
        $userARR = $hash[$i];
        $uid = $userARR["uid"][0];
        if ($EnableManageUsersTroughActiveDirectory == 1) {
            $uid = $userARR["samaccountname"][0];
        }
        if ($uid == "squidinternalauth") {
            continue;
        }
        $js = MEMBER_JS($uid, 1, 1);
        if ($userARR["sn"][0] == null && $userARR["givenname"][0] == null) {
            $userARR["sn"][0] = $uid;
        }
        $sn = texttooltip($userARR["sn"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $givenname = texttooltip($userARR["givenname"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $title = texttooltip($userARR["title"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $mail = texttooltip($userARR["mail"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $telephonenumber = texttooltip($userARR["telephonenumber"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $img = imgtootltip("contact-48.png", "{apply}", $js);
        if ($userARR["telephonenumber"][0] == null) {
            $userARR["telephonenumber"][0] = "&nbsp;";
        }
        if ($userARR["mail"][0] == null) {
            $userARR["mail"][0] = "&nbsp;";
        }
        $html = $html . "<tr class={$classtr}>\n\t\t\t\t\t\t<td width=1% style='font-size:12px'>{$img}</td>\n\t\t\t\t\t\t<td width=50% style='font-size:12px'>{$userARR["sn"][0]} {$userARR["givenname"][0]}<div><i>{$userARR["title"][0]}</i></div></td>\n\t\t\t\t\t\t<td width=1% style='font-size:12px'>{$userARR["telephonenumber"][0]}</td>\n\t\t\t\t\t\t<td width=50% style='font-size:12px' nowrap>{$userARR["mail"][0]}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\n\t\t";
    }
    $html = $html . "</table>\n\t</div>\n\t</td>\n\t<td valign='top' width=1%>{$add_user}<br>{$groups}<br>{$delete_all_users}</td>\n\t</tr>\n\t</table>\n\t\n\t<script>\n\t\n\tvar X_DeleteAllusers= function (obj) {\n\t\tvar results=trim(obj.responseText);\n\t\tif(results.length>0){alert(results);}\n\t\tLoadAjax('org_user_list','{$page}?finduser=&ou='+escape('{$ou}'));\n\t\t}\t\t\n\n\t\tfunction DeleteAllusers(){\n\t\t\tif(confirm('{$delete_all_users_warn}')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('DeleteAllUsersInOu','yes');\n\t\t\tXHR.appendData('ou','{$ou}');\n\t\t\tdocument.getElementById('org_user_list').src='img/wait_verybig.gif';   \t\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',X_DeleteAllusers);\n\t\t\t}\n\t\t\n\t\t}\n\t\n</script>\t\n\t";
    $html = $tpl->_ENGINE_parse_body($html);
    SET_CACHED(__FILE__, __FUNCTION__, $keycached, $html);
    echo $html;
}
Ejemplo n.º 12
0
function remote_domain_form()
{
    $_GET["index"] = base64_decode($_GET["index"]);
    $ou = $_GET["ou"];
    if (is_base64_encoded($ou)) {
        $ou = base64_decode($ou);
    }
    $ldap = new clladp();
    $HashDomains = $ldap->Hash_relay_domains($_GET["ou"]);
    $tools = new DomainsTools();
    $arr = $tools->transport_maps_explode($HashDomains[$_GET["index"]]);
    $page = CurrentPageName();
    $autoalias = new AutoAliases($_GET["ou"]);
    $users = new usersMenus();
    $users->LoadModulesEnabled();
    $num = $_GET["index"];
    if (strlen($autoalias->DomainsArray[$num]) > 0) {
        $alias = "yes";
    }
    $button_as_settings = Paragraphe('64-buldo.png', '{Anti-spam}', '{antispam_text}', "javascript:Loadjs('domains.amavis.php?domain={$num}');");
    if (!$users->AMAVIS_INSTALLED) {
        $button_as_settings = null;
    }
    if ($users->EnableAmavisDaemon != 1) {
        $button_as_settings = null;
    }
    if (!$users->AllowChangeAntiSpamSettings) {
        $button_as_settings = null;
    }
    if ($_GET["index"] != "new domain") {
        $dn = "cn=@{$num},cn=relay_recipient_maps,ou={$_GET["ou"]},dc=organizations,{$ldap->suffix}";
        $trusted_smtp_domain = 0;
        if ($ldap->ExistsDN($dn)) {
            $trusted_smtp_domain = 1;
        }
        $edit_button = "<hr>" . button("{apply}", "EditRelayDomain('{$num}')", "30px");
        $trusted = Paragraphe_switch_img("{trusted_smtp_domain}", "{trusted_smtp_domain_text}", "trusted_smtp_domain", $trusted_smtp_domain, "{enable_disable}", 810);
        $roundrobin = Paragraphe('64-computer-alias.png', '{roundrobin}', '{roundrobin_text}', "javascript:Loadjs('{$page}?round-robin=yes&ou={$_GET["ou"]}&domain={$num}');");
        $form = "\n\t<div style='width:98%' class=form>\n\t<div style='font-size:30px'>{organization}:{$ou}</div>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td><strong style='font-size:18px;color:black'>{domain_name}:</strong></td>\n\t\t\t<td align='right'><strong style='font-size:18px;color:black'>{$_GET["index"]}</strong></td>\n\t\t</tr>\n\t\t<tr>\t\t\t\t\t\t\t\n\t\t\t<td nowrap><strong style='font-size:18px;color:black'>{target_computer_name}:&nbsp;</strong></td>\n\t\t\t<td align='right'>" . Field_text("{$num}_IP", $arr[1], 'width:99%;padding:10px;font-size:18px') . "</td>\n\t\t</tr>\n\t\t\t<td align='right' colspan=2><strong style='font-size:18px;color:black'>{port}:&nbsp;" . Field_text("{$num}_PORT", $arr[2], 'width:110px;padding:3px;font-size:18px') . "&nbsp;" . Field_yesno_checkbox_img("{$num}_MX", $arr[3], '{mx_look}') . "&nbsp;" . Field_yesno_checkbox_img("{$num}_autoaliases", $alias, '<b>{autoaliases}</b><br>{autoaliases_text}') . "\n\t\t\t</td>\n\t\t</tr>\n\t\t\n\t\t<tr>\n\t\t\t<td align='right' colspan=2>{$edit_button}</td>\n\t\t</tr>\n\t</table>\n\t</div>";
    } else {
        $button_as_settings = null;
        $form = "\n\t<div style='width:98%' class=form>\n\t\t\t<div style='font-size:30px'>{organization}:{$ou}</div>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend><strong style='font-size:18px;color:black'>{domain_name}:</strong></td>\n\t\t\t<td align='right'>" . Field_text('AddNewRelayDomainName', null, 'width:98%;padding:10px;font-size:18px') . "</td>\n\t\t</tr>\n\t\t<tr>\t\t\t\t\t\n\t\t\t<td nowrap class=legend><strong style='font-size:18px;color:black'>{target_computer_name}:&nbsp;</strong></td>\n\t\t\t<td align='right'>" . Field_text('AddNewRelayDomainIP', null, 'width:98%;padding:10px;font-size:18px') . "</td>\n\t\t</tr>\n\t\t\t<td align='right' colspan=2><strong style='font-size:18px;color:black'>{port}:&nbsp;" . Field_text('AddNewRelayDomainPort', '25', 'width:120px;padding:3px;font-size:18px') . "&nbsp;" . Field_yesno_checkbox_img('MX', 'no', '{mx_look}') . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'><div style='float:right'>" . Paragraphe_switch_img("{trusted_smtp_domain}", "{trusted_smtp_domain_text}", "trusted_smtp_domain", 1, "{enable_disable}", 810) . "</div></td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td align='right' colspan=2>\n\t\t\t<hr>" . button("{add}", "AddRelayDomain()", "22px") . "</td>\n\t\t</tr>\n\t</table></div>";
    }
    $html = "\n\n<table style='width:100%'>\n<tr>\n\t<td valign='top'>{$form}</td>\n\t<td valign='top' style='padding-left:5px'>{$button_as_settings}{$roundrobin}{$trusted}</td>\n</tr>\n<tr>\n\t<td colspan=2 align='right'>{$edit_button}</td>\n</tr>\n</table>\n\n";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
Ejemplo n.º 13
0
function registerURL($U)
{
    #this function call the db but it should NOT leave this one function
    extract($U);
    include_once 'config.inc.php';
    $key = $GLOBALS['deployment_project']['key'];
    include 'core.header.php';
    #include (S3DB_SERVER_ROOT.'/webActions.php');
    #require_once(S3DB_SERVER_ROOT.'/s3dbcore/class.db.inc.php');
    #include_once(S3DB_SERVER_ROOT.'/s3dbcore/common_functions.inc.php');
    #include_once(S3DB_SERVER_ROOT.'/s3dbcore/callback.php');
    #Generate Did, and,  since we're on it, name if empty
    if (!$Did && $case == 'registernewURL') {
        $Did = s3id();
    }
    if (!$name && $case == 'registernewURL') {
        $name = 'D' . $Did;
        $U['name'] = $name;
    }
    $db = CreateObject('s3dbapi.db');
    $db->Halt_On_Error = 'no';
    $db->Host = $GLOBALS['s3db_info']['server']['db']['db_host'];
    $db->Type = $GLOBALS['s3db_info']['server']['db']['db_type'];
    $db->Database = $GLOBALS['s3db_info']['server']['db']['db_name'];
    $db->User = $GLOBALS['s3db_info']['server']['db']['db_user'];
    $db->Password = $GLOBALS['s3db_info']['server']['db']['db_pass'];
    $db->connect();
    $U['db'] = $db;
    list($inputValid, $errMessage) = validate_register_inputs($U);
    if ($inputValid) {
        switch ($case) {
            case 'registernewURL':
                $protocol = $_SERVER['HTTPS'] != '' ? 'https://' : 'http://';
                $url = ereg('localhost', $url) ? $protocol . getClientIP() . str_replace($protocol . 'localhost', '', $url) : $url;
                #echo $sql;exit;
                #echo $s3rl;exit;
                if ($Did != '') {
                    $sql = "select * from s3db_deployment where deployment_id = '" . $Did . "'";
                    $db->query($sql, __LINE__, __FILE__);
                    if ($db->next_record()) {
                        return array(False, 'Did already exists. Please provide another one or leave that field blank for an arbitrary value');
                    }
                }
                #if($Did!=''){
                $sql = "insert into s3db_deployment (deployment_id, url, publickey, message, created_on) values ('" . $Did . "', '" . $url . "', '" . $publicKey . "', '" . random_string(20) . "', now())";
                #echo $sql;
                $db->query($sql, __LINE__, __FILE__);
                $s3rl = $Did;
                #}
                #else{
                #include('s3id.php');
                #$sql = "insert into s3db_deployment (deployment_id, url, publickey, message, created_on) values ('".$Did."', '".$url."', '".$publicKey."', '".random_string(20)."', now())";
                #echo $sql;exit;
                #$db->query($sql, __LINE__, __FILE__);
                if ($db->Errno == 0) {
                    ##Now create an entry in the project of deployemnts;
                    #create a remote user to access this entry
                    $s3ql = compact('user_id', 'db');
                    $s3ql['insert'] = 'user';
                    $s3ql['where']['user_id'] = $url . (substr($url, strlen($url) - 1, 1) == '/' ? '' : '/') . 'U1';
                    $s3ql['where']['permission_level'] = '111';
                    $s3ql['format'] = 'php';
                    $done = unserialize(S3QLaction($s3ql));
                    //$msg=html2cell($done);
                    $msg = $done[0];
                    if (ereg('^(4|9|0)$', $msg['error_code'])) {
                        $remoteUser = $s3ql['where']['user_id'];
                        $user_id = '1';
                        $s3ql = compact('user_id', 'db');
                        $s3ql['insert'] = 'item';
                        $s3ql['where']['collection_id'] = $GLOBALS['deployment_project']['collection_id'];
                        $s3ql['where']['item_id'] = $Did;
                        $s3ql['where']['notes'] = $name == '' ? urlencode('Deployment ' . $Did) : $name;
                        $s3ql['format'] = 'php';
                        $done = unserialize(S3QLaction($s3ql));
                        $msg = $done[0];
                        if ($msg['error_code'] == '0' || $msg['error_code'] == '4') {
                            $s3ql = compact('user_id', 'db');
                            $s3ql['insert'] = 'user';
                            $s3ql['where']['item_id'] = $msg['item_id'];
                            $s3ql['where']['user_id'] = $remoteUser;
                            $s3ql['where']['permission_level'] = '222';
                            $done = S3QLaction($s3ql);
                            $item_id = $msg['item_id'];
                            $msg = html2cell($done);
                            $msg = $msg[2];
                            #find the collectiont rules
                            $s3ql = compact('user_id', 'db');
                            $s3ql['from'] = 'rules';
                            $s3ql['where']['subject_id'] = $GLOBALS['deployment_project']['collection_id'];
                            $rules = S3QLaction($s3ql);
                            if (!empty($rules)) {
                                $s3ql = compact('user_id', 'db');
                                $s3ql['insert'] = 'statement';
                                $s3ql['where']['item_id'] = $item_id;
                                foreach ($rules as $key => $rule_info) {
                                    if (in_array($rule_info['object'], array_keys($_GET))) {
                                        $s3ql['where']['rule_id'] = $rule_info['rule_id'];
                                        if ($rule_info['object'] == 'keywords') {
                                            $keywords = explode(',', $_GET['keywords']);
                                            foreach ($keywords as $word) {
                                                if (is_base64_encoded($word)) {
                                                    $word = base64_decode($word);
                                                }
                                                $s3ql['where']['value'] = $word;
                                                $done = S3QLaction($s3ql);
                                            }
                                        } elseif ($rule_info['object'] == 'url') {
                                            $s3ql['where']['value'] = $url;
                                            $done = S3QLaction($s3ql);
                                        } elseif ($rule_info['object'] == 'description') {
                                            $v = $_GET[$rule_info['object']];
                                            if (is_base64_encoded($v)) {
                                                $v = base64_decode($v);
                                            }
                                            $s3ql['where']['value'] = $v;
                                            $done = S3QLaction($s3ql);
                                        } elseif ($rule_info['object'] == 'name') {
                                            $s3ql['where']['value'] = $name;
                                            $done = S3QLaction($s3ql);
                                        } else {
                                            $v = $_GET[$rule_info['object']];
                                            $s3ql['where']['value'] = $v;
                                            $done = S3QLaction($s3ql);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                #After registering url, return Did
                if ($Did != '') {
                    return array(True, array('deployment_id' => $Did, 'name' => $name));
                } else {
                    return array(False, '');
                }
                break;
            case 'findURL':
                ##Let's first check if there is already a deployment in this URL
                if ($url != '') {
                    $sql = "select * from s3db_deployment where url = '" . $url . "'";
                    $db->query($sql, __LINE__, __FILE__);
                    if ($db->next_record()) {
                        $reg = array('deployment_id' => $db->f('deployment_id'), 'url' => $db->f('url'), 'modified_on' => $db->f('modified_on'));
                        return array(True, $reg);
                    }
                } elseif ($Did != '') {
                    $sql = "select * from s3db_deployment where deployment_id = '" . str_replace('D', '', $Did) . "'";
                    $db->query($sql, __LINE__, __FILE__);
                    if ($db->next_record()) {
                        $reg = array('url' => $db->f('url'), 'publicKey' => $db->f('publickey'), 'modified_on' => $db->f('modified_on'));
                        return array(True, $reg);
                    } else {
                        return array(False, 'Did not found');
                    }
                }
                break;
            case 'updateURL':
                #did the user send the decripted message already? Validate and change the message
                if ($message != '') {
                    $sql = "select * from s3db_deployment where deployment_id = '" . str_replace('D', '', $Did) . "'";
                    $db->query($sql, __LINE__, __FILE__);
                    if ($db->next_record()) {
                        $oldUrl = $db->f('url');
                        $storedMessage = $db->f('message');
                        #do messages match?
                        if ($storedMessage != $message) {
                            #$sql = "update s3db_register set message= '".random_string(20)."' where deployment_id = '".str_replace('D', '', $Did)."'";
                            return array(False, 'Error code:<error>3</error><description> Decripted Message does not match the request</description>');
                        } else {
                            #echo 'ahaa, you found it :-)';
                            #update key
                            $sql = "update s3db_deployment set url = '" . $newUrl . "', message= '" . random_string(20) . "', modified_on = now() where deployment_id = '" . str_replace('D', '', $Did) . "'";
                            $db->query($sql, __LINE__, __FILE__);
                            ##Now update the entry on s3db
                            $sql = "update s3db_statement set url='" . $newUrl . "' where rule_id='' and item_id=''";
                            $dbdata = get_object_vars($db);
                            if ($dbdata['Errno'] == '0') {
                                return array(True, 'Error code:<error>0</error><description>  URL updated</description>');
                            } else {
                                return array(False, 'Error code:<error>1</error><description>  Could not update URL</description>');
                            }
                        }
                    } else {
                        return array(False, 'Error code:<error>2</error> Could not find Did');
                    }
                } else {
                    #send a message to the url to make sure he is who he says he is
                    $sql = "select * from s3db_deployment where deployment_id = '" . ereg_replace('^D', '', $Did) . "'";
                    $db->query($sql);
                    if ($db->next_record()) {
                        $publicKey = $db->f('publickey');
                        $message = $db->f('message');
                    } else {
                        return array(False, 'Could not find URL');
                    }
                    #encript it
                    require_once 'pearlib/RSACrypt/RSA.php';
                    $encripted = encrypt($message, $publicKey);
                    if ($encripted == '') {
                        $encripted = encrypt($message, urlencode($publicKey));
                    }
                    $ErrMessage = "For authentication, please decript this message using your private key: <message>" . rawurlencode($encripted) . "</message><br />(Note: you might need to remove url encoding that your browser might have added before decoding. Plase refer to http://www.asciitable.com/ for the correct characters.)";
                    echo formatReturn($GLOBALS['error_codes']['success'], $ErrMessage, $format, array('encripted' => $encripted));
                    exit;
                    #echo "For authentication, please decript this message using your private key: <message>".rawurlencode($encripted)."</message>";
                    #echo "<br />(Note: you might need to remove url encoding that your browser might have added before decoding. Plase refer to http://www.asciitable.com/ for the correct characters.)";
                    #	exit;
                }
        }
    } else {
        echo formatReturn($GLOBALS['error_codes']['wrong_input'], $errMessage, $format, '');
    }
}
function USER_ALIASES_MAILING_LIST($userid)
{
    $page = CurrentPageName();
    $u = new user($userid);
    $priv = new usersMenus();
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $add_new_alias = $tpl->javascript_parse_text("{add_new_recipient}");
    $email = $tpl->_ENGINE_parse_body("{email}");
    $telephonenumber = $tpl->_ENGINE_parse_body("{phone}");
    $delete_this_member_ask = $tpl->javascript_parse_text("{delete_this_member_ask}");
    $member = $tpl->_ENGINE_parse_body("{member}");
    $website_ssl_wl_help = $tpl->javascript_parse_text("{website_ssl_wl_help}");
    $parameters = $tpl->javascript_parse_text("{parameters}");
    $send_a_test_mail = $tpl->javascript_parse_text("{send_a_test_mail}");
    $explain = $tpl->_ENGINE_parse_body("<div style='font-size:13px' class=explain>{aliases_mailing_text}:&nbsp;&laquo;<b>{$u->mail}&raquo;</b></div>");
    //$q=new mysql_squid_builder();
    //$q->QUERY_SQL("ALTER TABLE `usersisp` ADD UNIQUE (`email`)");
    if (is_base64_encoded($_GET["ou"])) {
        $ou_encoded = $_GET["ou"];
        $ou = base64_decode($_GET["ou"]);
    } else {
        $ou = $_GET["ou"];
        $ou_encoded = base64_encode($_GET["ou"]);
    }
    $add_user_disabled = Paragraphe('folder-useradd-64-grey.png', '{create_user}', '{create_user_text}');
    $add_user = Paragraphe('folder-useradd-64.png', '{create_user}', '{create_user_text}', "javascript:Loadjs('domains.add.user.php?ou={$ou}')", null, 210, null, 0, true);
    $groups = Paragraphe('folder-group-64.png', '{manage_groups}', '{manage_groups_text}', "javascript:Loadjs('domains.edit.group.php?ou={$ou_encoded}&js=yes')", null, 210, 100, 0, true);
    $delete_all_users = Paragraphe('member-64-delete.png', '{delete_all_users}', '{delete_all_users_text}', "javascript:DeleteAllusers()", null, 210, 100, 0, true);
    $add_new_alias_js = "{name: '<b>{$add_new_alias}</b>', bclass: 'Add', onpress : NewAliasEmail},";
    if ($priv->AllowAddUsers == false) {
        $add_new_alias_js = null;
    }
    $buttons = "\n\tbuttons : [\n\t{$add_new_alias_js}\n\t{name: '<b>{$send_a_test_mail}</b>', bclass: 'eMail', onpress : SendTestMail},{$bt_enable}\n\t],";
    $html = "\n    \t\n    \t<input type='hidden' id='ou' value='{$u->ou}'>\n{$explain}\n    \t" . $tpl->_ENGINE_parse_body("<table style='width:99%' class=form>\n    \t<tr>\n    \t\t<td class=legend>{MailingListAddressGroup}:</td>\n    \t\t<td align='left'>" . Field_checkbox("MailingListAddressGroup", 1, $u->MailingListAddressGroup, "Loadjs('{$page}?MailingListAddressGroupSwitch=yes&uid={$userid}&ou={$u->ou}')", "{MailingListAddressGroup_text}") . "</td>\n    \t</tr>\n    \t</table>") . "\n<table class='flexRT{$t}' style='display: none' id='flexRT{$t}' style='width:100%'></table>\n\n\t\n<script>\nrow_id='';\n\$(document).ready(function(){\n\$('#flexRT{$t}').flexigrid({\n\turl: '{$page}?aliases-mailing-list=yes&ou={$_GET["ou"]}&t={$t}&uid={$userid}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$email}', name : 'email', width : 480, sortable : false, align: 'left'},\n\t\t{display: '&nbsp;', name : 'aaa', width : 31, sortable : false, align: 'center'},\t\n\t\t{display: '&nbsp;', name : 'del', width : 31, sortable : false, align: 'center'},\n\t\t],\n\t{$buttons}\n\tsearchitems : [\n\t\t{display: '{$member}', name : 'search'},\n\t\t],\n\tsortname: 'uid',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: 600,\n\theight: 300,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\t\n\t});   \n});\n\n\tvar x_sslBumbAddwl=function(obj){\n     \tvar tempvalue=obj.responseText;\n      \tif(tempvalue.length>3){alert(tempvalue);}\n     \t//\$('#flexRT{$t}').flexReload();\n     \t}\t\n      \n     function SendTestMail(){\n    \t\tLoadjs('postfix.sendtest.mail.php?rcpt={$u->mail}');\n\t\t}\n\n\tfunction NewAliasEmail(){\n\t\tLoadjs('{$page}?USER_ALIASES_MAILING_LIST_ADD_JS=yes&uid={$userid}&ou={$u->ou}&flexRT={$t}')\n\t}\n\t\n\t\n\t\n</script>\n\n";
    return $html;
}
Ejemplo n.º 15
0
function GROUP_SETTINGS_PAGE_CONTENT()
{
    $ldap = new clladp();
    $page = CurrentPageName();
    $num = $_GET["LoadGroupSettings"];
    $groupID = $num;
    writelogs("Loading group {$num}", __FUNCTION__, __FILE__, __LINE__);
    if (is_base64_encoded($_GET["ou"])) {
        $_GET["ou"] = base64_decode($_GET["ou"]);
    }
    $ou_conn = $_GET["ou"];
    if (!$ldap->EnableManageUsersTroughActiveDirectory) {
        if (!is_numeric($num)) {
            return null;
        }
    }
    if (trim($num) == null) {
        $num = 0;
    }
    if ($num == 0) {
        if (isset($_GET["byGroupName"])) {
            $num = $ldap->GroupIDFromName($_GET["ou"], $_GET["byGroupName"]);
            writelogs("Numeric identifier=0, try to get numeric identifier by {$_GET["ou"]}/{$_GET["byGroupName"]}={$num}", __FUNCTION__, __FILE__, __LINE__);
            if ($num == 0) {
                return;
            }
        }
    }
    $group = new groups($num);
    if (trim($_GET["ou"]) != null) {
        if ($group->ou != $_GET["ou"]) {
            $tpl = new templates();
            $error = "<center style='border:2px solid red;padding:10px;margin:10px'><span style='font-size:13px;font-weight:bold;color:red'>Group: {$num}/{$_GET["ou"]}<br> {error_group_not_in_your_organization}</span></center>";
            //echo $tpl->_ENGINE_parse_body($error);
            writelogs("ERROR: group {$num} from organization \"{$group->ou}\" is different from requested organization \"{$_GET["ou"]}\"", __FUNCTION__, __FILE__);
            return null;
        }
    }
    $text_disbaled = "{ERROR_NO_PRIVILEGES_OR_PLUGIN_DISABLED}";
    $user = new usersMenus();
    $user->LoadModulesEnabled();
    $sock = new sockets();
    $SambaEnabled = $sock->GET_INFO("SambaEnabled");
    if (!is_numeric($SambaEnabled)) {
        $SambaEnabled = 1;
    }
    if ($SambaEnabled == 0) {
        $user->SAMBA_INSTALLED = false;
    }
    $SAMBA_GROUP = Paragraphe('64-group-samba-grey.png', '{MK_SAMBA_GROUP}', $text_disbaled, '');
    $mailing_list = Paragraphe('64-mailinglist-grey.png', "{mailing_list}", "{$text_disbaled}");
    //$hash=$ldap->GroupDatas($num);
    $members = count($group->members);
    if ($user->POSTFIX_INSTALLED == true) {
        $mailing_list_count = $group->CountMailingListes();
        $js = "javascript:Loadjs('domains.edit.group.php?LoadMailingList-js={$_GET['ou']}')";
        $mailing_list = Paragraphe('64-mailinglist.png', "({$mailing_list_count}) {mailing_list}", "{mailing_list_text}", "{$js}");
    }
    if ($user->DANSGUARDIAN_INSTALLED == true) {
        $DANSGUARDIAN = Paragraphe('icon-chevallier-564.png', '{dansguardian_rules}', '{dansguardian_rules_text}', "javascript:DansGuardianRules({$num})");
        //
    }
    $automount = Paragraphe('folder-64-automount.png', '{shared_folders}', '{shared_folders_text}', "javascript:Loadjs('SharedFolders.groups.php?gpid={$num}')");
    if ($user->cyrus_imapd_installed) {
        $sieve_auto = Paragraphe('64-learning.png', '{sieve_auto_script}', '{sieve_auto_script_text}', "javascript:Loadjs('{$page}?sieve-js={$num}')");
    }
    if ($user->SAMBA_INSTALLED) {
        $COMPUTERS = Paragraphe('computers-64.png', '{computers}', '{computers_text}', "javascript:LoadComputerGroup({$num})");
        $SAMBA_GROUP = Paragraphe('64-group-samba.png', '{MK_SAMBA_GROUP}', '{MK_SAMBA_GROUP_text}', "javascript:Change_group_settings({$num})");
        $LOGON_SCRIPT = Paragraphe('script-64.png', '{LOGON_SCRIPT}', '{LOGON_SCRIPT_TEXT}', "javascript:Loadjs('domains.edit.group.login.script.php?gpid={$num}')");
    }
    if ($DANSGUARDIAN == null) {
        $DANSGUARDIAN = Paragraphe('icon-chevallier-564-grey.png', '{dansguardian_rules}', $text_disbaled, '');
    }
    if ($automount == null) {
        $automount = Paragraphe('folder-64-automount-grey.png', '{shared_folders}', $text_disbaled, '');
    }
    if ($COMPUTERS == null) {
        $COMPUTERS = Paragraphe('computers-64-grey.png', '{computers}', $text_disbaled, '');
    }
    if (!$user->cyrus_imapd_installed) {
        if ($user->SAMBA_INSTALLED) {
            $sieve_auto = $LOGON_SCRIPT;
            $LOGON_SCRIPT = null;
        }
    }
    $RENAME_GROUP = Paragraphe('group_rename-64.png', '{GROUP_RENAME}', '{GROUP_RENAME_TEXT}', "javascript:Loadjs('domains.edit.group.rename.php?group-id={$num}&ou={$_GET["ou"]}')");
    $OPTIONS_DEFAULT_PASSWORD = Paragraphe('64-key.png', '{group_default_password}', '{group_default_password_text}', "javascript:YahooWin('400','{$page}?default_password=yes&gpid={$num}')");
    $PRIVILEGES = Paragraphe('members-priv-64.png', '{privileges}', '{privileges_text}', "javascript:GroupPrivileges({$num})");
    $ou_encoded = base64_encode($_GET["ou"]);
    $delete_group = imgtootltip("32-cancel.png", "{delete}::{$group->groupName}", "Loadjs('domains.delete.group.php?gpid={$num}')");
    $quotaDisk = Paragraphe("rename-disk-64.png", '{disk_user_quota}', '{disk_group_quota_text}', "javascript:Loadjs('domains.edit.user.quota.php?uid=@{$group->group_id}&ou={$group->ou}&userid=@{$group->group_id}')", null, 210, 'font-size:12px;font-weight:bold');
    $quotaDisk_disabled = Paragraphe("rename-disk-64-grey.png", '{disk_user_quota}', '{disk_group_quota_text}');
    if (!$user->QUOTA_INSTALLED) {
        $quotaDisk = $quotaDisk_disabled;
    }
    if ($user->EnableManageUsersTroughActiveDirectory) {
        $SAMBA_GROUP = Paragraphe('64-group-samba-64.png', '{MK_SAMBA_GROUP}', '{MK_SAMBA_GROUP_text}');
        $mailing_list = Paragraphe('64-mailinglist-grey.png', "({$mailing_list_count}) {mailing_list}", "{mailing_list_text}");
        $automount = Paragraphe('folder-64-automount-grey.png', '{shared_folders}', '{shared_folders_text}');
        $DANSGUARDIAN = null;
        $PRIVILEGES = Paragraphe('members-priv-64-grey.png', '{privileges}', '{privileges_text}');
        $delete_group = null;
    }
    $GroupSettingsID = null;
    if (isset($_GET["GroupSettingsID"])) {
        $GroupSettingsID = $_GET["GroupSettingsID"];
    }
    $html_tab1 = "\n\t\n\t<div style='width:98%' class=form>\n\t<table>\n\t<tr>\n\t<td valign='top'>{$PRIVILEGES}</td>\n\t<td valign='top'>{$COMPUTERS}</td>\n\t<td valign='top'>{$SAMBA_GROUP}</td>\n\t</tr>\n\t<tr>\n\t<td valign='top'>{$mailing_list}</td>\n\t<td valign='top'>{$automount}</td>\n\t<td valign='top'></td>\n\t</tr>\n\t</table></div>";
    $html_tab2 = "<div style='width:98%' class=form>\t<table>\n\t<tr>\n\t<td valign='top'>&nbsp;</td>\n\t<td valign='top'>&nbsp;</td>\n\t<td valign='top'>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t<td valign='top'>&nbsp;</td>\n\t<td valign='top'>&nbsp;</td>\n\t<td valign='top'>&nbsp;</td>\n\t</tr>\n\t</table></div>";
    $html_tab3 = "<div style='width:98%' class=form>\t\n\t<table>\n\t\t<tr>\n\t\t\t<td valign='top'>{$DANSGUARDIAN}</td>\n\t\t\t<td valign='top'>&nbsp;</td>\n\t\t\t<td valign='top'>&nbsp;</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td valign='top'>&nbsp;</td>\n\t\t\t<td valign='top'>&nbsp;</td>\n\t\t\t<td valign='top'>&nbsp;</td>\n\t\t</tr>\n\t</table></div>";
    $t[] = $RENAME_GROUP;
    $t[] = $OPTIONS_DEFAULT_PASSWORD;
    $t[] = $sieve_auto;
    $t[] = $LOGON_SCRIPT;
    $t[] = $quotaDisk;
    $html_tab4 = "<div style='width:98%' class=form><table>" . CompileTr3($t) . "</table></div>";
    if ($_GET["tab"] == 'asav') {
        $html_tab1 = $html_tab2;
    }
    if ($_GET["tab"] == 'proxy') {
        $html_tab1 = $html_tab3;
    }
    if ($_GET["tab"] == 'options') {
        $html_tab1 = $html_tab4;
    }
    $html = $html_tab1;
    $tpl = new templates();
    $group_description = $tpl->_ENGINE_parse_body("{group_description}");
    $barre_principale = "\n\t<input type='hidden' id='group_delete_text' value='{group_delete_text}'>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td width=3%><div style='height:1px;border-bottom:1px solid #CCCCCC;width:100%;float:right'>&nbsp;</div></td>\n\t\t<td width=1% nowrap><H5 style='border-bottom:0px'>{group}&nbsp;&nbsp;&laquo;&nbsp;{$group->groupName}&nbsp;&raquo;</h5></td>\n\t\t<td><div style='height:1px;border-bottom:1px solid #CCCCCC;width:100%;float:right'>&nbsp;</div></td>\n\t\t<td width=1%>{$delete_group}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=4 align='right'><div style='margin-top:-5px;padding-right:50px'>\n\t\t\t<a href=\"javascript:blur();\" OnClick=\"ChangeGroupDescription()\" \n\t\t\tstyle='font-size:11px;text-decoration:underline;font-style:italic'>{$group->description}</a></div></td>\n\t</tr>\n\t</table>\n\t\n\t<script>\n\t\tfunction ChangeGroupDescription(){\n\t\t\tYahooWin5('360','{$page}?ChangeGroupDescription=yes&gpid={$groupID}&ou={$ou_conn}','{$group->groupName}::{$group_description}');\n\t\t\n\t\t}\n\t\t\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body("{$barre_principale}{$tab}{$html}");
}
Ejemplo n.º 16
0
function find_member(){
	$tofind=$_GET["find-member"];
	if($_SESSION["uid"]==-100){$ou=$_GET["ou"];}else{$ou=$_SESSION["ou"];}
	$ldap=new clladp();
	if(is_base64_encoded($ou)){$ou=base64_decode($ou);}
	if($tofind==null){$tofind='*';}else{$tofind="*$tofind*";}
	$tofind=str_replace('***','*',$tofind);
	writelogs("FIND $tofind IN OU \"$ou\"",__FUNCTION__,__FILE__,__LINE__);
	
	$filter="(&(objectClass=userAccount)(|(cn=$tofind)(mail=$tofind)(displayName=$tofind)(uid=$tofind) (givenname=$tofind) ))";
	$attrs=array("displayName","uid","mail","givenname","telephoneNumber","title","sn","mozillaSecondEmail","employeeNumber","sAMAccountName");
	$dn="ou=$ou,dc=organizations,$ldap->suffix";
	
	if($ldap->EnableManageUsersTroughActiveDirectory){
		$cc=new ldapAD();
		$filter="(&(objectClass=user)(|(cn=$tofind)(mail=$tofind)(displayName=$tofind)(sAMAccountName=$tofind) (givenname=$tofind) ))";
		$dn="ou=$ou,$cc->suffix";
		if(trim($ou)=="Domain Controllers"){$dn="CN=Users,$cc->suffix";}
		
	}
	
	$hash=$ldap->Ldap_search($dn,$filter,$attrs,20);
	
	$users=new user();
	
	$number=$hash["count"];
	
	for($i=0;$i<$number;$i++){
		$user=$hash[$i];
		$html=$html .formatUser($user,$ldap->EnableManageUsersTroughActiveDirectory);
		
	}
	return $html;
}
Ejemplo n.º 17
0
function GROUP_SETTINGS_PAGE_CONTENT()
{
    $ldap = new clladp();
    $page = CurrentPageName();
    $num = $_GET["LoadGroupSettings"];
    $ou_conn = $_GET["ou"];
    if (is_base64_encoded($_GET["ou"])) {
        $_GET["ou"] = base64_decode($_GET["ou"]);
    }
    if (!is_numeric($num)) {
        return null;
    }
    if (trim($num) == null) {
        $num = 0;
    }
    if ($num == 0) {
        if (isset($_GET["byGroupName"])) {
            $num = $ldap->GroupIDFromName($_GET["ou"], $_GET["byGroupName"]);
            writelogs("Numeric identifier=0, try to get numeric identifier by {$_GET["ou"]}/{$_GET["byGroupName"]}={$num}", __FUNCTION__, __FILE__, __LINE__);
            if ($num == 0) {
                return;
            }
        }
    }
    $group = new groups($num);
    if (trim($_GET["ou"]) != null) {
        if ($group->ou != $_GET["ou"]) {
            $tpl = new templates();
            $error = "<center style='border:2px solid red;padding:10px;margin:10px'><span style='font-size:13px;font-weight:bold;color:red'>Group: {$num}/{$_GET["ou"]}<br> {error_group_not_in_your_organization}</span></center>";
            echo $tpl->_ENGINE_parse_body($error);
            writelogs("ERROR: group {$num} from organization \"{$group->ou}\" is different from requested organization \"{$_GET["ou"]}\"", __FUNCTION__, __FILE__);
            return null;
        }
    }
    $text_disbaled = "{ERROR_NO_PRIVILEGES_OR_PLUGIN_DISABLED}";
    $user = new usersMenus();
    $user->LoadModulesEnabled();
    $group = new groups($num);
    $SAMBA_GROUP = Paragraphe('64-group-samba-grey.png', '{MK_SAMBA_GROUP}', $text_disbaled, '');
    $mailing_list = Paragraphe('64-mailinglist-grey.png', "{mailing_list}", "{$text_disbaled}");
    $hash = $ldap->GroupDatas($num);
    $members = count($hash["members"]);
    if ($user->POSTFIX_INSTALLED == true) {
        $mailing_list_count = $group->CountMailingListes();
        $mailing_list = Paragraphe('64-mailinglist.png', "({$mailing_list_count}) {mailing_list}", "{mailing_list_text}", "javascript:LoadMailingList({$num})");
    }
    if ($user->DANSGUARDIAN_INSTALLED == true) {
        $DANSGUARDIAN = Paragraphe('icon-chevallier-564.png', '{dansguardian_rules}', '{dansguardian_rules_text}', "javascript:DansGuardianRules({$num})");
        //
    }
    $automount = Paragraphe('folder-64-automount.png', '{shared_folders}', '{shared_folders_text}', "javascript:Loadjs('SharedFolders.groups.php?gpid={$num}')");
    if ($user->cyrus_imapd_installed) {
        $sieve_auto = Paragraphe('64-learning.png', '{sieve_auto_script}', '{sieve_auto_script_text}', "javascript:Loadjs('{$page}?sieve-js={$num}')");
    }
    if ($user->SAMBA_INSTALLED) {
        $COMPUTERS = Paragraphe('computers-64.png', '{computers}', '{computers_text}', "javascript:LoadComputerGroup({$num})");
        $SAMBA_GROUP = Paragraphe('64-group-samba.png', '{MK_SAMBA_GROUP}', '{MK_SAMBA_GROUP_text}', "javascript:Change_group_settings({$num})");
        $LOGON_SCRIPT = Paragraphe('script-64.png', '{LOGON_SCRIPT}', '{LOGON_SCRIPT_TEXT}', "javascript:Loadjs('domains.edit.group.login.script.php?gpid={$num}')");
    }
    if ($DANSGUARDIAN == null) {
        $DANSGUARDIAN = Paragraphe('icon-chevallier-564-grey.png', '{dansguardian_rules}', $text_disbaled, '');
    }
    if ($automount == null) {
        $automount = Paragraphe('folder-64-automount-grey.png', '{shared_folders}', $text_disbaled, '');
    }
    if ($COMPUTERS == null) {
        $COMPUTERS = Paragraphe('computers-64-grey.png', '{computers}', $text_disbaled, '');
    }
    if (!$user->cyrus_imapd_installed) {
        if ($user->SAMBA_INSTALLED) {
            $sieve_auto = $LOGON_SCRIPT;
            $LOGON_SCRIPT = null;
        }
    }
    $RENAME_GROUP = Paragraphe('group_rename-64.png', '{GROUP_RENAME}', '{GROUP_RENAME_TEXT}', "javascript:Loadjs('domains.edit.group.rename.php?group-id={$num}&ou={$_GET["ou"]}')");
    $OPTIONS_DEFAULT_PASSWORD = Paragraphe('64-key.png', '{group_default_password}', '{group_default_password_text}', "javascript:YahooWin('400','{$page}?default_password=yes&gpid={$num}')");
    $ou_encoded = base64_encode($_GET["ou"]);
    $html_tab1 = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top'>" . Paragraphe('members-priv-64.png', '{privileges}', '{privileges_text}', "javascript:GroupPrivileges({$num})") . "</td>\n\t<td valign='top'>{$COMPUTERS}</td>\n\t<td valign='top'>{$SAMBA_GROUP}</td>\n\t</tr>\n\t<tr>\n\t<td valign='top'>{$mailing_list}</td>\n\t<td valign='top'>{$automount}</td>\n\t<td valign='top'></td>\n\t</tr>\n\t</table>";
    $html_tab2 = "\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top'>&nbsp;</td>\n\t<td valign='top'>&nbsp;</td>\n\t<td valign='top'>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t<td valign='top'>&nbsp;</td>\n\t<td valign='top'>&nbsp;</td>\n\t<td valign='top'>&nbsp;</td>\n\t</tr>\n\t</table>";
    $html_tab3 = "\t\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td valign='top'>{$DANSGUARDIAN}</td>\n\t\t\t<td valign='top'>&nbsp;</td>\n\t\t\t<td valign='top'>&nbsp;</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td valign='top'>&nbsp;</td>\n\t\t\t<td valign='top'>&nbsp;</td>\n\t\t\t<td valign='top'>&nbsp;</td>\n\t\t</tr>\n\t</table>";
    $html_tab4 = "\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td valign='top'>{$RENAME_GROUP}</td>\n\t\t\t<td valign='top'>{$OPTIONS_DEFAULT_PASSWORD}</td>\n\t\t\t<td valign='top'>{$sieve_auto}</td>\n\t\t\t\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td valign='top'>{$LOGON_SCRIPT}</td>\n\t\t\t<td valign='top'>&nbsp;</td>\n\t\t\t<td valign='top'>&nbsp;</td>\n\t\t</tr>\n\t</table>\n\t\n\t";
    if ($_GET["tab"] == 'asav') {
        $html_tab1 = $html_tab2;
    }
    if ($_GET["tab"] == 'proxy') {
        $html_tab1 = $html_tab3;
    }
    if ($_GET["tab"] == 'options') {
        $html_tab1 = $html_tab4;
    }
    $html = $html_tab1;
    $tpl = new templates();
    $barre_principale = "\n\t<input type='hidden' id='group_delete_text' value='{group_delete_text}'>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td width=3%><div style='height:1px;border-bottom:1px solid #CCCCCC;width:100%;float:right'>&nbsp;</div></td>\n\t\t<td width=1% nowrap><H5>{group}&nbsp;&nbsp;&laquo;&nbsp;{$hash["cn"]}&nbsp;&raquo;</td>\n\t\t<td><div style='height:1px;border-bottom:1px solid #CCCCCC;width:100%;float:right'>&nbsp;</div></td>\n\t\t<td width=1%>" . imgtootltip("32-cancel.png", "{delete}::{$hash["cn"]}", "Loadjs('domains.delete.group.php?gpid={$num}')") . "</td>\n\t</tr>\n\t</table>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body("{$barre_principale}{$tab}{$html}");
}
Ejemplo n.º 18
0
function users_search()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $ldap = new clladp();
    if ($ldap->IsKerbAuth()) {
        users_search_directory();
        return;
    }
    $page = 1;
    $t = $_GET["t"];
    $sock = new sockets();
    $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory");
    if (!is_numeric($EnableManageUsersTroughActiveDirectory)) {
        $EnableManageUsersTroughActiveDirectory = 0;
    }
    if (is_base64_encoded($_GET["ou"])) {
        $ou_encoded = $_GET["ou"];
        $ou = base64_decode($_GET["ou"]);
    } else {
        $ou = $_GET["ou"];
        $ou_encoded = base64_encode($_GET["ou"]);
    }
    if ($_SESSION["uid"] != -100) {
        $ou = $_SESSION["ou"];
    }
    if ($_POST["query"] != null) {
        $tofind = $_POST["query"];
    }
    if ($tofind == null) {
        $tofind = '*';
    } else {
        $tofind = "*{$tofind}*";
    }
    $filter = "(&(objectClass=userAccount)(|(cn={$tofind})(mail={$tofind})(displayName={$tofind})(uid={$tofind}) (givenname={$tofind})))";
    $attrs = array("displayName", "uid", "mail", "givenname", "telephoneNumber", "title", "sn", "mozillaSecondEmail", "employeeNumber", "sAMAccountName");
    if (!$ldap->IsOUUnderActiveDirectory($ou)) {
        if ($EnableManageUsersTroughActiveDirectory == 1) {
            $cc = new ldapAD();
            $hash = $cc->find_users($ou, $tofind);
        } else {
            $ldap = new clladp();
            $dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
            $hash = $ldap->Ldap_search($dn, $filter, $attrs, 150);
        }
    } else {
        $EnableManageUsersTroughActiveDirectory = 1;
        include_once dirname(__FILE__) . "/ressources/class.external.ad.inc";
        $ad = new external_ad_search();
        $hash = $ad->find_users($ou, $tofind);
    }
    $boot = new boostrap_form();
    $users = new user();
    $number = $hash["count"];
    if (!is_numeric($number)) {
        $number = 0;
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = $number;
    $data['rows'] = array();
    $styleTD = " style='font-size:16px'";
    for ($i = 0; $i < $number; $i++) {
        $userARR = $hash[$i];
        $uid = $userARR["uid"][0];
        if ($EnableManageUsersTroughActiveDirectory == 1) {
            $uid = $userARR["samaccountname"][0];
        }
        if ($uid == "squidinternalauth") {
            continue;
        }
        $js = MEMBER_JS($uid, 1, 1);
        if ($userARR["sn"][0] == null && $userARR["givenname"][0] == null) {
            $userARR["sn"][0] = $uid;
        }
        $sn = texttooltip($userARR["sn"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $givenname = texttooltip($userARR["givenname"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $title = texttooltip($userARR["title"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $mail = texttooltip($userARR["mail"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $telephonenumber = texttooltip($userARR["telephonenumber"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        if ($userARR["telephonenumber"][0] == null) {
            $userARR["telephonenumber"][0] = "&nbsp;";
        }
        if ($userARR["mail"][0] == null) {
            $userARR["mail"][0] = "&nbsp;";
        }
        $dele = imgsimple("delete-24.png", null, "Loadjs('domains.delete.user.php?uid={$uid}&flexRT={$t}');");
        $link = $boot->trswitch($js);
        $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t<td {$styleTD} width=99% nowrap {$link}><i class='icon-user'></i>&nbsp;{$userARR["sn"][0]} {$userARR["givenname"][0]}<div><i>{$userARR["title"][0]}</i></td>\n\t\t<td {$styleTD} width=99% nowrap {$link}>{$userARR["telephonenumber"][0]}</td>\n\t\t<td {$styleTD} width=99% nowrap {$link}>{$userARR["mail"][0]}</td>\n\t\t<td width=35px align='center' nowrap>{$dele}</td>\n\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{member}</th>\n\t\t\t\t\t<th>{phone}</th>\n\t\t\t\t\t<th>{email}</th>\n\t\t\t\t\t<th>&nbsp;</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t\t\t</table>";
}
Ejemplo n.º 19
0
function parsecmdlines($argv)
{
    $GLOBALS["hostname"] = null;
    $GLOBALS["ou"] = null;
    $GLOBALS["STOP_ONLY"] = null;
    $GLOBALS["NORESTART"] = false;
    $GLOBALS["START_ONLY"] = 0;
    $GLOBALS["STATUS"] = false;
    $GLOBALS["COMMANDLINE"] = implode(" ", $argv);
    if ($GLOBALS["postconf"] == null) {
        $unix = new unix();
        $GLOBALS["postconf"] = $unix->find_program("postconf");
    }
    if ($GLOBALS["postmulti"] == null) {
        $unix = new unix();
        $GLOBALS["postmulti"] = $unix->find_program("postmulti");
    }
    //echo "{$GLOBALS["deflog_start"]} Milter-greylist multiple instance `". @implode(";", $argv)."\n";
    if (strpos($GLOBALS["COMMANDLINE"], "--verbose") > 0) {
        $GLOBALS["VERBOSE"] = true;
        $GLOBALS["debug"] = true;
        $GLOBALS["DEBUG"] = true;
    }
    if (preg_match("#--who=([A-Za-z]+)#", $GLOBALS["COMMANDLINE"], $re)) {
        $GLOBALS["WHOPROCESS"] = $re[1];
    }
    while (list($num, $ligne) = each($argv)) {
        if (preg_match("#--verbose#", $ligne)) {
            $GLOBALS["DEBUG"] = true;
            $GLOBALS["VERBOSE"] = true;
            ini_set('display_errors', 1);
            ini_set('error_reporting', E_ALL);
            ini_set('error_prepend_string', null);
            ini_set('error_append_string', null);
        }
        if (preg_match("#--norestart#", $ligne)) {
            $GLOBALS["NORESTART"] = true;
        }
        if (preg_match("#--hostname=(.+)#", $ligne, $re)) {
            $GLOBALS["hostname"] = $re[1];
            continue;
        }
        if (preg_match("#--ou=(.+)#", $ligne, $re)) {
            if (is_base64_encoded($re[1])) {
                $re[1] = base64_decode($re[1]);
            }
            $GLOBALS["ou"] = $re[1];
            continue;
        }
        if (preg_match("#--start#", $ligne)) {
            $GLOBALS["START_ONLY"] = 1;
            continue;
        }
        if (preg_match("#--stop#", $ligne)) {
            $GLOBALS["STOP_ONLY"] = 1;
            continue;
        }
        if (preg_match("#--status#", $ligne)) {
            $GLOBALS["STATUS"] = true;
        }
    }
    if ($GLOBALS["DEBUG"]) {
        echo "parsecmdlines ou={$GLOBALS["ou"]} hostname={$GLOBALS["hostname"]} STOP={$GLOBALS["STOP_ONLY"]} START={$GLOBALS["START_ONLY"]}\n";
    }
}
Ejemplo n.º 20
0
<?php

include_once dirname(__FILE__) . '/ressources/class.templates.inc';
include_once dirname(__FILE__) . '/ressources/class.ldap.inc';
include_once dirname(__FILE__) . '/ressources/class.users.menus.inc';
include_once dirname(__FILE__) . '/ressources/class.apache.inc';
include_once dirname(__FILE__) . '/ressources/class.system.network.inc';
include_once dirname(__FILE__) . '/ressources/class.pdns.inc';
include_once dirname(__FILE__) . '/ressources/class.os.system.inc';
include_once dirname(__FILE__) . '/framework/class.unix.inc';
include_once dirname(__FILE__) . '/framework/frame.class.inc';
include_once dirname(__FILE__) . '/ressources/class.joomla.php';
include_once dirname(__FILE__) . '/ressources/class.user.inc';
$ou = $argv[1];
if (is_base64_encoded($ou)) {
    $ou = base64_decode($ou);
}
if ($ou == null) {
    die("No organisation defined\n");
}
if (posix_getuid() != 0) {
    die("Cannot be used in web server mode\n\n");
}
$ldap = new clladp();
$pattern = "(&(objectclass=apacheConfig)(apacheServerName=*))";
$attr = array();
$sr = @ldap_search($ldap->ldap_connection, "ou=www,ou={$ou},dc=organizations,{$ldap->suffix}", $pattern, $attr);
if (!$sr) {
    echo "Starting......: database LDAP ERROR {$ldap->ldap_last_error}\n";
    return;
}
Ejemplo n.º 21
0
function find_member()
{
    $ldap = new clladp();
    if ($ldap->IsKerbAuth()) {
        find_member_active_directory();
        return;
    }
    if ($_POST["qtype"] == "find-member") {
        $tofind = $_POST["query"];
    }
    $t = $_GET["t"];
    $tt = $_GET["tt"];
    if ($_SESSION["uid"] == -100) {
        $ou = $_GET["ou"];
    } else {
        $ou = $_SESSION["ou"];
    }
    $sock = new sockets();
    if (is_base64_encoded($ou)) {
        $ou = base64_decode($ou);
    }
    if ($tofind == null) {
        $tofind = '*';
    } else {
        $tofind = "*{$tofind}*";
    }
    $tofind = str_replace('***', '*', $tofind);
    $tofind = str_replace('**', '*', $tofind);
    $tofind = str_replace('**', '*', $tofind);
    $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory");
    if (!is_numeric($EnableManageUsersTroughActiveDirectory)) {
        $EnableManageUsersTroughActiveDirectory = 0;
    }
    $tofind = str_replace(".", '\\.', $tofind);
    $tofind = str_replace("*", '.*?', $tofind);
    $ldap = new clladp();
    writelogs("FIND {$tofind} IN OU \"{$ou}\"", __FUNCTION__, __FILE__, __LINE__);
    if (!$ldap->IsOUUnderActiveDirectory($ou)) {
        if ($EnableManageUsersTroughActiveDirectory == 1) {
            $GLOBALS["NOUSERSCOUNT"] = true;
            $ldap = new ldapAD();
            writelogs("[{$tofind}]: ->hash_get_groups_from_ou_mysql({$ou},{$tofind}) ", __FUNCTION__, __FILE__);
            $hash = $ldap->hash_get_groups_from_ou_mysql($ou, $tofind, true);
        } else {
            $ldap = new clladp();
            $hash = $ldap->hash_groups($ou, 1);
        }
    } else {
        $hash = find_member_active_directory();
        $ldap->EnableManageUsersTroughActiveDirectory = true;
        $GLOBALS["NOUSERSCOUNT"] = true;
    }
    $number = count($hash);
    $data = array();
    $data['page'] = 0;
    $data['total'] = $number;
    $data['rows'] = array();
    $styla = "style='font-size:14px;text-decoration:underline;font-weight:bold'";
    $styleNum = "style='font-size:16px;font-weight:bold'";
    $search = string_to_flexregex();
    if (is_array($hash)) {
        while (list($num, $line) = each($hash)) {
            if (strtolower($line) == 'default_group') {
                continue;
            }
            if (strlen($search) > 2) {
                if (!preg_match("#{$search}#", $line)) {
                    continue;
                }
            }
            $text = null;
            $js = "javascript:Loadjs('domains.edit.group.php?js=yes&group-id={$num}&ou={$_GET["ou"]}&encoded=yes&tt={$t}&ttt={$tt}')";
            $delete = imgsimple("delete-24.png", "{delete} {$num}", "Loadjs('domains.delete.group.php?gpid={$num}')");
            if (!$GLOBALS["NOUSERSCOUNT"]) {
                $delete = "&nbsp;";
                $gp = new groups($num);
                $members = count($gp->members_array);
                if ($gp->description != null) {
                    $text = $gp->description;
                }
                $data['rows'][] = array('id' => $line, 'cell' => array("<a href=\"javascript:blur();\" OnClick=\"{$js}\" {$styla}>{$line}</a>", "<span {$styleNum}>{$members}</span>", "<span style='font-size:14px'>{$text}</span>", $delete));
            } else {
                if (is_array($line)) {
                    if ($line["description"] != null) {
                        $text = $line["description"];
                    }
                    if (strlen($search) > 2) {
                        if (!preg_match("#{$search}#", $line["groupname"])) {
                            continue;
                        }
                    }
                    if (!is_numeric($line["gid"])) {
                        $delete = imgsimple("delete-24-grey.png");
                    }
                    $js = "javascript:Loadjs('domains.edit.group.php?js=yes&group-id={$line["gid"]}&ou={$_GET["ou"]}&encoded=yes&tt={$t}&ttt={$tt}')";
                    $data['rows'][] = array('id' => md5($line["groupname"]), 'cell' => array("<a href=\"javascript:blur();\" OnClick=\"{$js}\" {$styla}>{$line["groupname"]}</a>", "<span {$styleNum}>{$line["UsersCount"]}</span>", "<span style='font-size:14px'>{$text}</span>", $delete));
                } else {
                    $data['rows'][] = array('id' => $line, 'cell' => array("<a href=\"javascript:blur();\" OnClick=\"{$js}\" {$styla}>{$line}</a>", "<span {$styleNum}>?</span>", "<span style='font-size:14px'></span>", $delete));
                }
            }
        }
    }
    echo json_encode($data);
}
function organization_users_find_member()
{
    $tofind = $_GET["finduser"];
    if (is_base64_encoded($_GET["ou"])) {
        $ou = base64_decode($_GET["ou"]);
    } else {
        $ou = $_GET["ou"];
    }
    writelogs("Find users {$tofind} in ou={$ou} (encoded={$_GET["ou"]})", __FUNCTION__, __FILE__, __LINE__);
    if ($_SESSION["uid"] != -100) {
        $ou = $_SESSION["ou"];
    }
    $ldap = new clladp();
    if ($tofind == null) {
        $tofind = '*';
    } else {
        $tofind = "*{$tofind}*";
    }
    $filter = "(&(objectClass=userAccount)(|(cn={$tofind})(mail={$tofind})(displayName={$tofind})(uid={$tofind}) (givenname={$tofind})))";
    $attrs = array("displayName", "uid", "mail", "givenname", "telephoneNumber", "title", "sn", "mozillaSecondEmail", "employeeNumber");
    $dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
    $hash = $ldap->Ldap_search($dn, $filter, $attrs, 150);
    $users = new user();
    $number = $hash["count"];
    $bg = "#FFFFFF";
    writelogs("Find users {$tofind} in ou={$ou} (encoded={$_GET["ou"]}) {$number} items", __FUNCTION__, __FILE__, __LINE__);
    $html = "\n\t\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'>\n\t\t<div style='width:100%;height:560px;overflow:auto'>\t\n\t\t\t<ul id='domains-checklist'>\n\t\t\t\t\n\t";
    $add_user = Paragraphe('folder-useradd-64.png', '{create_user}', '{create_user_text}', "javascript:Loadjs('domains.add.user.php?ou={$ou}')", null, 210, null, 0, true);
    $groups = Paragraphe('folder-group-64.png', '{manage_groups}', '{manage_groups_text}', "javascript:Loadjs('domains.edit.group.php?ou={$ou_encoded}&js=yes')", null, 210, 100, 0, true);
    for ($i = 0; $i < $number; $i++) {
        $userARR = $hash[$i];
        $uid = $userARR["uid"][0];
        if ($uid == "squidinternalauth") {
            continue;
        }
        $js = MEMBER_JS($uid, 1, 1);
        $sn = texttooltip($userARR["sn"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $givenname = texttooltip($userARR["givenname"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $title = texttooltip($userARR["title"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $mail = texttooltip($userARR["mail"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $telephonenumber = texttooltip($userARR["telephonenumber"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
        $img = imgtootltip("contact-48.png", "{edit}", $js);
        $html = $html . "<li class='domainsli' style='width:345px'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td width=1% valign='top'>{$img}</td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<div style='font-size:13px;font-weight:bold;color:#005447'>{$userARR["sn"][0]} {$userARR["givenname"][0]}</div>\n\t\t\t\t\t<div style='font-size:11px;text-align:right;border-top:1px solid #005477;pading-top:3px'>{$userARR["telephonenumber"][0]}&nbsp;|&nbsp;{$userARR["mail"][0]}</div>\n\t\t\t\t\t<div style='font-size:11px;text-align:right;color:black;' {$over} {$out}>{$userARR["title"][0]}</div>\t\t\t\t\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</li>\n\t\t";
    }
    $html = $html . "</ul></div>\n\t</td>\n\t<td valign='top' width=1%>{$add_user}<br>{$groups}</td>\n\t</tr>\n\t</table>";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}