Пример #1
0
 public function testImplodeDnWithUtf8Characters()
 {
     $expected = 'uid=rogasawara,ou=営業部,o=Airius';
     $dnArray = array(array("uid" => "rogasawara"), array("ou" => "営業部"), array("o" => "Airius"));
     $dn = Ldap\Dn::implodeDn($dnArray);
     $this->assertEquals($expected, $dn);
 }
Пример #2
0
Файл: Ldap.php Проект: Rovak/zf2
 /**
  * Copies a LDAP entry from one DN to another DN.
  *
  * @param  string|Dn $from
  * @param  string|Dn $to
  * @param  boolean   $recursively
  * @return Ldap Provides a fluid interface
  * @throws Exception\LdapException
  */
 public function copy($from, $to, $recursively = false)
 {
     $entry = $this->getEntry($from, array(), true);
     if ($to instanceof Dn) {
         $toDnParts = $to->toArray();
     } else {
         $toDnParts = Dn::explodeDn($to);
     }
     $this->add($to, $entry);
     if ($recursively === true && $this->countChildren($from) > 0) {
         $children = $this->getChildrenDns($from);
         foreach ($children as $c) {
             $cDnParts = Dn::explodeDn($c);
             $newChildParts = array_merge(array(array_shift($cDnParts)), $toDnParts);
             $newChild = Dn::implodeDn($newChildParts);
             $this->copy($c, $newChild, true);
         }
     }
     return $this;
 }