Esempio n. 1
0
function _GetServers()
{
    $ldap = new clladp();
    $pattern = "(&(objectclass=apacheConfig)(apacheServerName=*))";
    $attr = array();
    $sr = @ldap_search($ldap->ldap_connection, $ldap->suffix, $pattern, $attr);
    $hash = ldap_get_entries($ldap->ldap_connection, $sr);
    //print_r($hash);
    for ($i = 0; $i < $hash["count"]; $i++) {
        $root = $hash[$i]["apachedocumentroot"][0];
        $wwwservertype = trim($hash[$i]["wwwservertype"][0]);
        $apacheservername = trim($hash[$i]["apacheservername"][0]);
        $dn = $hash[$i]["dn"];
        if ($wwwservertype != "GROUPOFFICE") {
            continue;
        }
        if (preg_match("#ou=www,ou=(.+?),dc=organizations#", $dn, $re)) {
            $ou = $re[1];
        }
        $server_database = str_replace(" ", "_", $apacheservername);
        $server_database = str_replace(".", "_", $server_database);
        $server_database = str_replace("-", "_", $server_database);
        ImportUsers(trim($ou), $server_database);
    }
}
Esempio n. 2
0
function process_temp_file()
{
    if (!is_file($_POST["process_temp_file"])) {
        ImportUsers("{error_unable_process_file} : " . $_POST["process_temp_file"]);
        exit;
    }
    if ($_POST["ou"] == null) {
        ImportUsers("{error_miss_datas} : ou");
        exit;
    }
    if ($_POST["suffix"] == null) {
        ImportUsers("{error_miss_datas} : suffix");
        exit;
    }
    $ou = $_POST["ou"];
    $suffix = $_POST["suffix"];
    $datas = file_get_contents($_POST["process_temp_file"]);
    $process = new ImportFile($_POST["process_temp_file"], $ou);
    $count = count($array_content);
    $page = CurrentPageName();
    $html = "\n<div id='content'>\n<h1>{import users}{$ou}</h1>\n<strong>{$process->countLine} lines</strong><br>\n<strong>{$process->countFailed} users {failed}</strong><br>\n<a href='{$process->logFile}'>" . basename($process->logFile) . "</a>\n<br>\n</div>";
    $tpl = new template_users('{import users}', $html, 0, 1);
    echo $tpl->web_page;
}