$edit_href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s', $app['server']->getIndex(), rawurlencode($request['template']->getDN())); $changetype = $request['template']->getType(); printf('<small>%s <a href="%s">%s</a>', $actionString[$changetype], $edit_href, $request['template']->getDN()); if ($request['import']->LDAPimport()) { printf(' <span style="color:green;">%s</span></small><br />', _('Success')); } else { printf(' <span style="color:red;">%s</span></small><br /><br />', _('Failed')); $errormsg = sprintf('%s <b>%s</b>', $actionErrorMsg[$changetype], $request['template']->getDN()); $errormsg .= ldap_error_msg($app['server']->getErrorMessage(null), $app['server']->getErrorNum(null)); system_message(array('title' => _('LDIF text import'), 'body' => $errormsg, 'type' => 'warn')); } } if ($request['import']->error) { printf('<small><span style="color:red;">%s: %s</span></small><br />', _('Error'), $request['import']->error['message']); echo '<br/>'; display_pla_parse_error($request['import']); } if (!$request['continuous_mode']) { break; } } function display_pla_parse_error($request) { $type = $request->getType(); echo '<center>'; echo '<table class="error">'; echo '<tr>'; printf('<td class="img"><img src="%s/%s" /></td>', IMGDIR, 'error-big.png'); printf('<td><h2>%s %s</h2></td>', $type['description'], _('Parse Error')); echo '</tr>'; printf('<tr><td><b>%s</b>:</td><td>%s</td></tr>', _('Description'), $request->error['message']);
printf(' <span style="color:red;">%s</span></small><br /><br />', _('Failed')); reload_left_frame(); pla_error($actionErrorMsg[$changeType] . ' ' . htmlspecialchars($entry->dn), $ldapserver->error(), $ldapserver->errno()); } } # if any errors occurs during reading file ,"catch" the exception and display it here. if ($ldifReader->hasRaisedException()) { # get the entry which raise the exception,quick hack here $currentEntry = $ldifReader->fetchEntryObject(); if ($currentEntry->dn != '') { printf('<small>%s %s <span style="color:red;">%s</span></small><br />', $actionString[$currentEntry->getChangeType()], $currentEntry->dn, _('Failed')); } # get the exception wich was raised $exception = $ldifReader->getLdapLdifReaderException(); echo '<br /><br />'; display_pla_parse_error($exception, $currentEntry); } } # close the file $ldifReader->done(); reload_left_frame(); function reload_left_frame() { echo '<script type="text/javascript" language="javascript">parent.left_frame.location.reload();</script>'; } function display_error_message($error_message) { printf('<div style="color:red;"><small>%s</small></div>', $error_message); } function display_warning($warning) {