Add attributes from an LDAP server.
139 {
141 assert(array_key_exists(
'Attributes',
$request));
142
144
145
146
147 $arrSearch = array();
148 $arrReplace = array();
150 $arrSearch[] = '%'.$attr.'%';
151
152 if (strlen($val[0]) > 0) {
154 } else {
155 $arrReplace[] = '';
156 }
157 }
158
159
160 $filter = str_replace($arrSearch, $arrReplace, $this->search_filter);
161
162 if (strpos($filter, '%') !== false) {
164 $this->search_filter.')');
165 return;
166 }
167
168 if (!in_array($this->attr_policy, array('merge', 'replace', 'add'), true)) {
170 "'replace' or 'add'.");
171 return;
172 }
173
174
175 try {
177 } catch (Exception $e) {
178
180 return;
181 }
182
183 try {
184 $entries =
$ldap->searchformultiple(
185 $this->base_dn,
186 $filter,
187 array_values($this->search_attributes),
188 true,
189 false
190 );
191 } catch (Exception $e) {
192 return;
193 }
194
195
196 foreach ($entries as $entry) {
197 foreach ($this->search_attributes as
$target =>
$name) {
200 }
201
204 }
206 if (isset($entry[
$name])) {
207 unset($entry[
$name][
'count']);
209 foreach (array_values($entry[
$name]) as $value) {
210 if ($this->attr_policy === 'merge') {
213 }
214 } else {
216 }
217 }
218 } else {
220 }
221 }
222 }
223 }
224 }
foreach($paths as $path) $request
static escape_filter_value($values=array(), $singleValue=true)
Borrowed function from PEAR:LDAP.
getLdap()
Getter for the LDAP connection object.
if(array_key_exists('yes', $_REQUEST)) $attributes