Exemplo n.º 1
0
function formulaire()
{
    $users = new usersMenus();
    $ldap = new clladp();
    $tpl = new templates();
    $page = CurrentPageName();
    if ($users->AsAnAdministratorGeneric) {
        $hash = $ldap->hash_get_ou(false);
    } else {
        $hash = $ldap->Hash_Get_ou_from_users($_SESSION["uid"], 1);
    }
    if (count($hash) == 1) {
        $org = $hash[0];
        $hash_groups = $ldap->hash_groups($org, 1);
        $hash_domains = $ldap->hash_get_domains_ou($org);
        $groups = Field_array_Hash($hash_groups, 'groupid', null, null, null, 0, "font-size:14px;padding:3px");
        $domains = Field_array_Hash($hash_domains, 'domain', null, null, null, 0, "font-size:14px;padding:3px");
    }
    $artica = new artica_general();
    $EnableVirtualDomainsInMailBoxes = $artica->EnableVirtualDomainsInMailBoxes;
    while (list($num, $ligne) = each($hash)) {
        $ous[$ligne] = $ligne;
    }
    $ou = Field_array_Hash($ous, 'organization', null, "ChangeFormValues()", null, 0, "font-size:14px;padding:3px");
    $form = "\n\t\n\t<input type='hidden' id='EnableVirtualDomainsInMailBoxes' value='{$EnableVirtualDomainsInMailBoxes}'>\n\t<table style='width:100%' class=form>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{organization}:</td>\n\t\t\t<td>{$ou}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{group}:</td>\n\t\t\t<td><span id='select_groups'>{$groups}</span>\n\t\t</tr>\n\t\t<tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{firstname}:</td>\n\t\t\t<td>" . Field_text('firstname', null, 'width:120px;font-size:14px;padding:3px', null, 'ChangeFormValues()') . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{lastname}:</td>\n\t\t\t<td>" . Field_text('lastname', null, 'width:120px;font-size:14px;padding:3px', null, "ChangeFormValues()") . "</td>\n\t\t</tr>\t\t\n\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{email}:</td>\n\t\t\t<td>" . Field_text('email', null, 'width:120px;font-size:14px;padding:3px', null, "ChangeFormValues()") . "@<span id='select_domain'>{$domains}</span></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{uid}:</td>\n\t\t\t<td>" . Field_text('login', null, 'width:120px;font-size:14px;padding:3px') . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{password}:</td>\n\t\t\t<td>" . Field_password('password', null, "font-size:14px;padding:3px") . "</td>\n\t\t</tr>\t\n\t\t<tr><td colspan=2>&nbsp;</td></tr>\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'><hr>" . button("{add}", "SaveAddUser()") . "\n\t\t\t\t\n\t\t\t</td>\n\t\t</tr>\n\t\t\n\t\t</table>\n\t";
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' width=1%><div id='ffform'><img src='img/identity-add-96.png'></div></td>\n\t\t<td valign='top' width=99%><div>{$form}</div></td>\n\t</tr>\n\t</table>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
function ORGANISTATION_FROM_USER()
{
    $ldap = new clladp();
    $hash = $ldap->Hash_Get_ou_from_users($_SESSION["uid"], 1);
    if (is_array($hash)) {
        return $hash[0];
    }
}
Exemplo n.º 3
0
function ORGANISTATION_FROM_USER(){
	$ldap=new clladp();
	$hash=$ldap->Hash_Get_ou_from_users($_SESSION["uid"],1);
	$ldap->ldap_close();
	if(!is_array($hash)){return null;}
	return Paragraphe('folder-org-64.jpg',"{manage} &laquo;{$hash[0]}&raquo;","<strong>{$hash[0]}:<br></strong>{manage_organisations_text}",'domains.manage.org.index.php?ou='.$hash[0]);
	
	
}
Exemplo n.º 4
0
function add_group_js()
{
    if (is_base64_encoded($_GET["ou"])) {
        $_GET["ou"] = base64_decode($_GET["ou"]);
    }
    $ou_encrypted = base64_encode($_GET["ou"]);
    $page = CurrentPageName();
    $tpl = new templates();
    $dn = urlencode($_GET["dn"]);
    $ldap = new clladp();
    $title = $tpl->javascript_parse_text("{group name}");
    $t = $_GET["t"];
    $tt = $_GET["tt"];
    $add_group_ou_text = $tpl->javascript_parse_text("{add_group_ou_text}");
    $add_group_ou_text = str_replace("%OU", "{$_GET["ou"]}", $add_group_ou_text);
    if ($_GET["CallBackFunction"] != null) {
        $CallBackFunction = "{$_GET["CallBackFunction"]}();";
    }
    if ($_GET["ou"] == null) {
        $hash = $ldap->Hash_Get_ou_from_users($_SESSION["uid"], 1);
        if (count($hash) == 0) {
            if (isset($_SESSION["ou"])) {
                $hash[0] = $_SESSION["ou"];
            }
        }
        if ($hash[0] == null) {
            echo "YahooWin6('650','{$page}?add-group-no-ou=yes&dn={$_GET["dn"]}&CallBackFunction={$_GET["CallBackFunction"]}&t={$_GET["t"]}&tt={$_GET["tt"]}','New group')";
            return;
        }
        $error_select_ou_first = $tpl->javascript_parse_text("{error_select_ou_first}");
        echo "alert('{$error_select_ou_first}');";
        return;
    }
    $html = "\nvar x_addgroup= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);return;}\n\t{$CallBackFunction}\n\tif(document.getElementById('GroupSettings')){\n\t\tLoadAjax('GroupSettings','domains.edit.group.php?LoadGroupSettings=&ou={$ou_encrypted}&encoded=yes&dn={$dn}&t={$t}&tt={$tt}')\n\t}\n\tif(document.getElementById('organization-find')){SearchOrgs();}\n\t\$('#table-{$t}').flexReload();\n\t\$('#flexRT{$t}').flexReload();\n\t\$('#flexRT{$tt}').flexReload();\n}\n\n\nfunction addgroup_js(){\n\tvar gp=prompt('{$add_group_ou_text}\\n\\n{$title}:');\n\tif(gp){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('addgroup',gp);\n\t\tXHR.appendData('ou','{$_GET["ou"]}');\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_addgroup);\t\n\t}\t\n\n}\n\naddgroup_js();\n";
    echo $html;
}
Exemplo n.º 5
0
function ORGANISTATION_FROM_USER()
{
    if ($_SESSION["uid"] == -100) {
        return;
    }
    $ldap = new clladp();
    $hash = $ldap->Hash_Get_ou_from_users($_SESSION["uid"], 1);
    if (!is_array($hash)) {
        header('location:domains.index.php');
    }
    return $hash[0];
}
Exemplo n.º 6
0
function OU_FIELD()
{
    $users = new usersMenus();
    $ldap = new clladp();
    $tpl = new templates();
    $page = CurrentPageName();
    $t = $_GET["t"];
    if ($users->AsAnAdministratorGeneric) {
        $hash = $ldap->hash_get_ou(false);
    } else {
        if ($_GET["ou"] == null) {
            $hash = $ldap->Hash_Get_ou_from_users($_SESSION["uid"], 1);
            if (count($hash) == 0) {
                if (isset($_SESSION["ou"])) {
                    $hash[0] = $_SESSION["ou"];
                }
            }
        } else {
            $hash[0] = $_GET["ou"];
            if (count($hash) == 0) {
                if (isset($_SESSION["ou"])) {
                    $hash[0] = $_SESSION["ou"];
                }
            }
        }
    }
    if (count($hash) == 1) {
        $org = $hash[0];
    }
    while (list($num, $ligne) = each($hash)) {
        $ous[$ligne] = $ligne;
    }
    echo Field_array_Hash($ous, "organization-{$t}", $_GET["ou"], "ChangeFormValues()", null, 0, "font-size:28px;padding:3px") . "\n\t<script>ChangeFormValues();</script>\t\t\n\t";
}
Exemplo n.º 7
0
function BuildOus()
{
    $ldap = new clladp();
    $mny = new usersMenus();
    if ($mny->IsGlobalAdmin()) {
        $hash = $ldap->hash_get_ou_full_datas();
    } else {
        $hash = $ldap->Hash_Get_ou_from_users($_SESSION["uid"]);
    }
    if (is_array($hash)) {
        while (list($num, $ligne) = each($hash)) {
            $items = $items . "{\n";
            $items = $items . "\t\t'id' : 'ou:{$ligne}',\n";
            $items = $items . "\t\t'txt' : '{$num}',\n";
            $items = $items . "\t\t'img' : 'tree-server.gif',\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},";
        }
    }
    if ($items[strlen($items) - 1] == ',') {
        $items = substr($items, 0, strlen($items) - 1);
    }
    return $items . "";
}
Exemplo n.º 8
0
function ORGANISTATION_FROM_USER()
{
    $ldap = new clladp();
    $tpl = new templates();
    if ($GLOBALS["VERBOSE"]) {
        echo "Hash_Get_ou_from_users({$_SESSION["uid"]}...<br>\n";
    }
    $hash = $ldap->Hash_Get_ou_from_users($_SESSION["uid"], 1);
    if ($GLOBALS["VERBOSE"]) {
        print_r($hash);
    }
    if (!is_array($hash)) {
        return null;
    }
    $t = $_GET["t"];
    $data = array();
    $data['page'] = 1;
    $data['total'] = 1;
    $data['rows'] = array();
    $ou_nozarafa_explain = $tpl->_ENGINE_parse_body("{ou_nozarafa_explain}");
    $ou = $hash[0];
    $ou_encoded = base64_encode($ou);
    $md = md5(serialize($hash) . time());
    $md5S = $md;
    $uri = "javascript:Loadjs('domains.manage.org.index.php?js=yes&ou={$ou}');";
    $usersNB = $ldap->CountDeUSerOu($ou);
    $GroupsNB = $ldap->CountDeGroups($ou);
    $DomainsNB = $ldap->CountDeDomainsOU($ou);
    $select = imgsimple("domain-32.png", "{manage_organisations_text}", $uri);
    $adduser = imgsimple("folder-useradd-32.png", "{$ou}<hr><b>{create_user}</b><br><i>{create_user_text}</i>", "Loadjs('domains.add.user.php?ou={$ou_encoded}&encoded=yes');");
    $addgroup = imgsimple("32-folder-group-add.png", "{$ou}<hr><b>{add_group}</b><br><i>{add_a_new_group_in_this_org}</i>", "Loadjs('domains.edit.group.php?popup-add-group=yes&ou={$ou}&t={$t}');");
    $SearchUser = imgsimple("loupe-32.png", "{$ou}<hr><b>{search}</b>:<i>{members}</i>", "Loadjs('domains.find.user.php?ou={$ou_encoded}&encoded=yes');");
    $SearchGroup = imgsimple("loupe-32.png", "{$ou}<hr><b>{search}</b>:<i>{groups}</i>", "Loadjs('domains.find.groups.php?ou={$ou_encoded}&encoded=yes&t={$t}');");
    $searchDomain = imgsimple("loupe-32.png", "{$ou}<hr><b>{localdomains}</b>:<i>{localdomains_text}</i>", "Loadjs('domains.edit.domains.php?js=yes&ou={$ou}&master-t={$t}');");
    $array = array();
    $array[] = "<a href=\"javascript:blur();\"\n\tOnClick=\"{$uri}\" style='font-size:26px;font-weight:bolder;text-transform:capitalize;\n\ttext-decoration:underline'>{$ou}</strong></a>{$OuZarafaText}";
    if ($_GET["zarafaF"] == 1) {
        $zarafaEnabled = "zarafa-logo-32.png";
        if ($NOZARAFA == 1) {
            $zarafaEnabled = "zarafa-logo-32-grey.png";
        }
        $array[] = "<center>" . imgsimple($zarafaEnabled, "<strong style=font-size:26px>{$ou}:{APP_ZARAFA}</strong>\n\t\t\t\t<br>{ZARAFA_OU_ICON_TEXT}", "Loadjs('domains.edit.zarafa.php?ou={$ou_encoded}&t={$t}')") . "</center>";
    } else {
        $array[] = "&nbsp;";
    }
    $array[] = "<strong style='font-size:26px'>{$usersNB}</strong>";
    $array[] = "<center style='font-size:16px'>{$SearchUser}</center>";
    $array[] = "<strong style='font-size:26px'>{$GroupsNB}</strong>";
    $array[] = "<center style='font-size:16px'>{$SearchGroup}</center>";
    $array[] = "<strong style='font-size:26px'>{$DomainsNB}</strong>";
    $array[] = "<center style='font-size:16px'>{$searchDomain}</center>";
    $array[] = "<center style='font-size:16px'>{$adduser}</center>";
    $array[] = "<center style='font-size:16px'>{$addgroup}</center>";
    $array[] = "<center style='font-size:16px'>&nbsp;</center>";
    $data['rows'][] = array('id' => $md5S, 'cell' => $array);
    $total = 1;
    $data['page'] = 1;
    $data['total'] = $total;
    echo json_encode($data);
}
Exemplo n.º 9
0
function formulaire()
{
    $users = new usersMenus();
    $ldap = new clladp();
    $tpl = new templates();
    $page = CurrentPageName();
    $lang = null;
    $t = $_GET["t"];
    if ($users->AsAnAdministratorGeneric) {
        $hash = $ldap->hash_get_ou(false);
    } else {
        if ($_GET["ou"] == null) {
            $hash = $ldap->Hash_Get_ou_from_users($_SESSION["uid"], 1);
            if (count($hash) == 0) {
                if (isset($_SESSION["ou"])) {
                    $hash[0] = $_SESSION["ou"];
                }
            }
        } else {
            $hash[0] = $_GET["ou"];
            if (count($hash) == 0) {
                if (isset($_SESSION["ou"])) {
                    $hash[0] = $_SESSION["ou"];
                }
            }
        }
    }
    if (count($hash) == 0) {
        echo $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{error_no_ou_created}<center style='margin-top:30px'>" . button("{create_a_new_organization}", "loadjs('organization.js.php?add-ou=yes');", 22) . "</center>"));
        return;
    }
    if (count($hash) == 1) {
        $org = $hash[0];
        $hash_groups = $ldap->hash_groups($org, 1);
        $hash_domains = $ldap->hash_get_domains_ou($org);
        $groups = Field_array_Hash($hash_groups, "groupid-{$t}", null, null, null, 0, "font-size:28px;padding:3px");
        $domains = Field_array_Hash($hash_domains, "domain-{$t}", null, null, null, 0, "font-size:28px;padding:3px");
    }
    $artica = new artica_general();
    $EnableVirtualDomainsInMailBoxes = $artica->EnableVirtualDomainsInMailBoxes;
    if ($users->ZARAFA_INSTALLED) {
        $sock = new sockets();
        $languages = unserialize(base64_decode($sock->getFrameWork("zarafa.php?locales=yes")));
        while (list($index, $data) = each($languages)) {
            if (preg_match("#cannot set#i", $data)) {
                continue;
            }
            $langbox[$data] = $data;
        }
        $ZARAFA_LANG = $sock->GET_INFO("ZARAFA_LANG");
        $mailbox_language = Field_array_Hash($langbox, "ZARAFA_LANG-ZARAFA_LANG", $ZARAFA_LANG, "style:font-size:28px;padding:3px");
        $lang = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:28px'>{language}:</td>\n\t\t\t\t<td><span id='MAILBOX_ZARAFA_LANG_LIST'>{$mailbox_language}</span>\n\t\t\t\t<div style='float:right;margin-top:5px'>" . button("{build_languages}", "BuildLocalesCreateUser()") . "</div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t";
    }
    while (list($num, $ligne) = each($hash)) {
        $ous[$ligne] = $ligne;
    }
    $ou = Field_array_Hash($ous, "organization-{$t}", $_GET["ou"], "ChangeFormValues()", null, 0, "font-size:28px;padding:3px");
    $form = "\n\t\n\t<input type='hidden' id='EnableVirtualDomainsInMailBoxes-{$t}' value='{$EnableVirtualDomainsInMailBoxes}'>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px'>{organization}:</td>\n\t\t\t<td>{$ou}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px'>{group}:</td>\n\t\t\t<td><span id='select_groups-{$t}'>{$groups}</span>\n\t\t</tr>\n\t\t<tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px'>{firstname}:</td>\n\t\t\t<td>" . Field_text("firstname-{$t}", null, 'width:531px;font-size:28px;padding:3px', null, 'ChangeFormValues()') . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px'>{lastname}:</td>\n\t\t\t<td>" . Field_text("lastname-{$t}", null, 'width:531px;font-size:28px;padding:3px', null, "ChangeFormValues()") . "</td>\n\t\t</tr>\t\t\n\t\t\t{$lang}\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px'>{email}:</td>\n\t\t\t<td style='font-size:28px'>" . Field_text("email-{$t}", null, 'width:220px;font-size:28px;padding:3px', null, "ChangeFormValues()") . "&nbsp;@&nbsp;<span id='select_domain-{$t}'>{$domains}</span></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px' nowrap>{uid}:</td>\n\t\t\t<td>" . Field_text("login-{$t}", null, 'width:320px;font-size:28px;padding:3px') . "</td>\n\t\t</tr>\n\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px'>{password}:</td>\n\t\t\t<td>" . Field_password("password-{$t}", null, "font-size:28px;padding:3px", null, null, null, false, "SaveAddUserCheck(event)") . "</td>\n\t\t</tr>\t\n\t\t<tr><td colspan=2>&nbsp;</td></tr>\n\t\t<tr>\n\t\t\t<td colspan=2 align='right' style='padding:10px'><hr>" . button("{add}", "SaveAddUser()", 34) . "\n\t\t\t\t\n\t\t\t</td>\n\t\t</tr>\n\t\t\n\t\t</table>\n\t</div>\n\t";
    $html = "<div id='ffform-{$t}'>\n\t<div>{$form}</div>\n\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}