Instance($server_id); if( ! $ldapserver->haveAuthInfo()) pla_error( $lang['not_enough_login_info'] ); $continuous_mode = isset( $_POST['continuous_mode'] ) ?1:0; $file = $_FILES['ldif_file']['tmp_name']; $remote_file = $_FILES['ldif_file']['name']; $file_len = $_FILES['ldif_file']['size']; is_array( $_FILES['ldif_file'] ) or pla_error( $lang['missing_uploaded_file'] ); file_exists( $file ) or pla_error( $lang['no_ldif_file_specified'] ); $file_len > 0 or pla_error( $lang['ldif_file_empty'] ); include './header.php'; ?>

: name ); ?> : ()



connect()); // if ldif file has no version number, just display a warning if(!$ldifReader->hasVersionNumber()){ display_warning($ldifReader->getWarningMessage()); } $i=0; // if .. else not mandatory but should be easier to maintain if( $continuous_mode ){ while( $ldifReader->readEntry() ){ $i++; // get the entry. $currentEntry = $ldifReader->fetchEntryObject(); $changeType = $currentEntry->getChangeType(); echo "".$actionString[$changeType]." ".$currentEntry->dn; if($ldifReader->hasRaisedException()){ echo " ".$lang['failed']."
"; $exception = $ldifReader->getLdapLdifReaderException(); echo "".$lang['ldif_line_number'].": ".$exception->lineNumber."
"; echo "".$lang['ldif_line'].": ".$exception->currentLine."
"; echo "".$lang['desc'].": ".$exception->message."
"; } else{ if($ldapWriter->ldapModify($currentEntry)) echo " ".$lang['success']."
"; else{ echo " ".$lang['failed']."
"; echo "Error Code: ".ldap_errno($ldapserver->connect())."
"; echo "".$lang['desc'].": ".ldap_error($ldapserver->connect())."
"; } } if( 0 == $i % 5 ) flush(); }// end while } else{ //while we have a valid entry, while($entry = $ldifReader->readEntry()){ $i++; $changeType = $entry->getChangeType(); echo "".$actionString[$changeType]." ".$entry->dn; if($ldapWriter->ldapModify($entry)){ echo " ".$lang['success']."
"; if( 0 == $i % 5 ) flush(); } else{ echo " ".$lang['failed']."

"; reload_left_frame(); pla_error( $actionErrorMsg[$changeType]. " " . htmlspecialchars( $entry->dn ), ldap_error( $ldapserver->connect() ), ldap_errno( $ldapserver->connect() ) ); } } // 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 !=""){ echo "".$actionString[$currentEntry->getChangeType()]." ".$currentEntry->dn." ".$lang['failed']."
"; } //get the exception wich was raised $exception = $ldifReader->getLdapLdifReaderException(); echo "
"; echo "
"; display_pla_parse_error($exception,$currentEntry); } } // close the file $ldifReader->done(); //close the ldap connection $ldapWriter->ldapClose(); reload_left_frame(); function reload_left_frame(){ global $server_id; echo "\r\n"; } function display_error_message($error_message){ echo "
".$error_message."
"; } function display_warning($warning){ echo "
".$warning."
"; } function display_pla_parse_error($exception,$faultyEntry){ global $lang; global $actionErrorMsg; $errorMessage = $actionErrorMsg[$faultyEntry->getChangeType()]; print("
"); print(""); print(""); print("
"); } ?>

".$lang['ldif_parse_error']."

"); print("
"); print($errorMessage." ". $faultyEntry->dn); print("

"); print("".$lang['desc'].": ".$exception->message); print("

"); print("

"); print("".$lang['ldif_line'].": ".$exception->currentLine); print("

"); print("

"); print("".$lang['ldif_line_number'].": ".$exception->lineNumber); print("

"); print("
"); print("

\r\n"); print("

"); print(""); print(sprintf($lang['ferror_submit_bug'] , get_href( 'add_bug' ))); print("

"); print("
"); print("