#!/usr/bin/php " . $conta . "\n"; foreach($nomeListaNotes as $value) { //Estabelece conexao com servidor Notes $connectNotes = ldap_connect($serverNotes,$portNotes); ldap_set_option($connectNotes, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_bind($connectNotes, $rootdnNotes, $passNotes); //Define o filtro de busca e que informacoes deverao ser retornadas pela busca realizada $filterNotes = "(&(objectClass=OXUserObject)(cn=$value)(sn=Notes))"; $justtheseNotes = array("cn","alias"); $srNotes = ldap_search($connectNotes, $basednNotes, $filterNotes, $justtheseNotes); $infoNotes = ldap_get_entries($connectNotes, $srNotes); $contNotes = $infoNotes['count']; # Le Ldap e cria arquivos com lista e usuarios $i = 0; while($i <= ($contNotes-1)) { $cnNotes = $infoNotes[$i]['cn'][0]; $nomeTmp = strtr($cnNotes, " _---", "-"); //$nomeTmp = limpaString($nomeTmp); $nomeTmp = strtolower($nomeTmp); $nomeListaNotes = "lista-$nomeTmp-imp"; $infoAddLista["objectclass"][0] = "person"; $infoAddLista["objectclass"][1] = "posixAccount"; $infoAddLista["objectclass"][2] = "phpgwaccount"; $infoAddLista["objectclass"][3] = "mailman"; $infoAddLista["objectclass"][4] = "inetorgperson"; $infoAddLista["uid"] = "$nomeListaNotes"; $infoAddLista["mail"] = "$nomeListaNotes"."$dominioLista"; $infoAddLista["phpgwAccountExpires"] = '-1'; $infoAddLista["phpgwAccountStatus"] = 'A'; $infoAddLista["phpgwAccountType"] = "l"; $infoAddLista["accountStatus"] = "active"; $infoAddLista["sn"] = "$nomeListaNotes"; $infoAddLista["cn"] = "$nomeListaNotes"; $infoAddLista["homeDirectory"] = "/dev/null"; $infoAddLista["gidNumber"] = "777"; $infoAddLista["uidNumber"] = "-".Contador(); $infoAddLista["admLista"] = "$administrador"; $infoAddLista["listpass"] = "$senhaCript"; $infoAddLista["defaultmembermoderation"] = "1"; //Estabelece a conexao com o RHDS $connectRHDS = ldap_connect($serverRHDS,$portRHDS); ldap_set_option($connectRHDS, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_bind($connectRHDS, $rootdnRHDS, $passRHDS); //Efetua a gravacao da lista vinda do Notes no RHDS $dnGravaLista = "uid=$nomeListaNotes".","."$basednRHDS"; $addListaNotesRHDS = ldap_add($connectRHDS, $dnGravaLista, $infoAddLista); $j = 0; while($infoNotes[$i]['alias'][$j] != "") { $participanteNotes = $infoNotes[$i]['alias'][$j]; $infoAddUsuario["mailforwardingaddress"][$j] = "$participanteNotes"; $cmd = "find_member $participanteNotes"; `$cmd`; // echo "Participantes : " . $participanteNotes . "\n"; $j++; } $dnGravaUsuario = "uid=$nomeListaNotes".","."$basednRHDS"; $addUsuario = ldap_mod_add($connectRHDS, $dnGravaUsuario, $infoAddUsuario); $i++; } //fim do while externo (usuario por usuario) } } # Chamada da funcao para inclusao no Mailman $nomeListaNotes = $argv[1]; //pegaListasNotes($server, $port, $rootdn, $pass, $basedn, $nomeListaNotes); pegaListasNotes($serverNotes, $portNotes, $rootdnNotes, $passNotes, $basednNotes, $serverRHDS, $portRHDS, $rootdnRHDS, $passRHDS, $basednRHDS, $listasnotes, $senhaCript, $dominioLista, $administrador); ?>