예제 #1
0
                        <?php 
}
?>
                </select>
                <i class="help-tip icon-question-sign" href="#purge_logs"></i>
            </td>
        </tr>
        <tr>
            <td width="180"><?php 
echo __('Default Name Formatting');
?>
:</td>
            <td>
                <select name="name_format">
<?php 
foreach (PersonsName::allFormats() as $n => $f) {
    list($desc, $func) = $f;
    $selected = $config['name_format'] == $n ? 'selected="selected"' : '';
    ?>
                    <option value="<?php 
    echo $n;
    ?>
" <?php 
    echo $selected;
    ?>
><?php 
    echo __($desc);
    ?>
</option>
<?php 
}
예제 #2
0
 function search($query)
 {
     $c = $this->getConnection();
     // TODO: Include bind information
     $users = array();
     if ($dn = $this->getConfig()->get('bind_dn')) {
         $pw = Crypto::decrypt($this->getConfig()->get('bind_pw'), SECRET_SALT, $this->getConfig()->getNamespace());
         $r = $c->bind($dn, $pw);
         unset($pw);
         if (PEAR::isError($r)) {
             return $users;
         }
     }
     $schema = static::$schemas[$this->getSchema($c)];
     $schema = $schema['user'];
     $r = $c->search($this->getSearchBase(), str_replace('{q}', $query, $schema['search']), array('attributes' => array_filter(flatten(array($schema['first'], $schema['last'], $schema['full'], $schema['phone'], $schema['mobile'], $schema['email'], $schema['username'])))));
     // XXX: Log or return some kind of error?
     if (PEAR::isError($r)) {
         return $users;
     }
     foreach ($r as $e) {
         // Detect first and last name if only full name is given
         if (!($first = $e->getValue($schema['first'])) || !($last = $e->getValue($schema['last']))) {
             $name = new PersonsName($this->_getValue($e, $schema['full']));
             $first = $name->getFirst();
             $last = $name->getLast();
         }
         $users[] = array('username' => $this->_getValue($e, $schema['username']), 'first' => $first, 'last' => $last, 'email' => $this->_getValue($e, $schema['email']), 'phone' => $this->_getValue($e, $schema['phone']), 'mobile' => $this->_getValue($e, $schema['mobile']), 'backend' => static::$id);
     }
     return $users;
 }