1){ $server_menu_html = ''; } else { $server = reset($servers); $id = key($servers); $base_dn = $server['base'] ? $server['base'] : try_to_get_root_dn( $id ); $server_info_list[$id]['id'] = $id; $server_info_list[$id]['name'] = $server['name']; $server_info_list[$id]['base_dn'] = $base_dn; if( $server['host'] ) $server_menu_html .= '' . '' . $server['name'] . ''; } $filter = isset( $_GET['filter'] ) ? $_GET['filter'] : null; $attr = isset( $_GET['attribute'] ) ? $_GET['attribute'] : null; // grab the base dn for the search if( isset( $_GET['base_dn'] ) ) { $base_dn = $_GET['base_dn']; $base_dn_is_invalid = false; $base_dn_does_not_exist = false; if( trim( $base_dn ) ) if( ! is_dn_string( $base_dn ) ) $base_dn_is_invalid = true; elseif( ! dn_exists( $server_id, $base_dn ) ) $base_dn_does_not_exist = true; } elseif( '' != $servers[$server_id]['base'] ) $base_dn = $servers[$server_id]['base']; else $base_dn = try_to_get_root_dn( $server_id ); $criterion = isset( $_GET['criterion'] ) ? $_GET['criterion'] : null; $form = isset( $_GET['form'] ) ? $_GET['form'] : null; $scope = isset( $_GET['scope'] ) ? $_GET['scope'] : 'sub'; include './header.php'; ?>


.
" . $lang['searching'] . "\n"; flush(); // prevent script from bailing early on a long delete @set_time_limit( 0 ); // grab the size limit set in config.php $size_limit = isset ( $search_result_size_limit ) && is_numeric( $search_result_size_limit ) ? $search_result_size_limit : 50; // Sanity check if( $size_limit < 1 ) $size_limit = 1; $page = isset( $_GET['page'] ) ? $_GET['page'] : 0; $time_start = utime(); if( $scope == 'base' ) $results = @ldap_read( $ds, $base_dn, $filter, $search_result_attributes, 0, 0, 0, get_search_deref_setting() ); elseif( $scope == 'one' ) $results = @ldap_list( $ds, $base_dn, $filter, $search_result_attributes, 0, 0, 0, get_search_deref_setting() ); else // scope == 'sub' $results = @ldap_search( $ds, $base_dn, $filter, $search_result_attributes, 0, 0, 0, get_search_deref_setting() ); $errno = @ldap_errno( $ds ); if( ! $results ) { pla_error( $lang['error_performing_search'], ldap_error( $ds ), ldap_errno( $ds ) ); } $time_end = utime(); $time_elapsed = round( $time_end - $time_start, 2 ); $count = @ldap_count_entries( $ds, $results ); $start_entry = $page * $size_limit; $end_entry = min( $start_entry + $size_limit + 1, $count+1 ); ?>
' . number_format( $count ) ?>  ( ) " . $lang['export_results'] . " ]"; ?> ' . $lang['format'] . ':'; foreach( $result_formats as $f ) { echo ' '; if( $format == $f ) { echo '' . $lang[$f] . ''; } else { $php_self = $_SERVER['PHP_SELF']; $query_string = array_to_query_string( $_GET, array( 'format' ) ); $query_string .= "&format=$f"; echo "" . $lang[$f] . ""; } } ?> ]
" . $lang['size_limit_exceeded'] . "

\n"; } // Draw the paging links $pager_html = ''; $total_pages = $count / $size_limit; $results_per_page = $size_limit; if( $count > $size_limit ) { echo sprintf( $lang['showing_results_x_through_y'], "" . number_format($start_entry+1) . "", "" . number_format($end_entry-1) . "" ) . "
\n"; $php_self = $_SERVER['PHP_SELF']; if( $page != 0 ) { $query_string = array_to_query_string( $_GET, array( 'page' ) ); $query_string .= '&page=' . ($page-1); $pager_html .= "‹‹"; } else { $pager_html .= "‹‹"; } $pager_html .= '  '; // for large search results where we page beyone the first 20 pages, // print elipsis instead of making the pager be super wide. $elipsis_printed = false; for( $i=0; $i<$count; $i+=$size_limit ) { $page_num = $i/$size_limit; if( $count > $size_limit * 20 && abs( $page_num - $page ) > 10 ) { if( ! $elipsis_printed ) { $pager_html .= '...  '; $elipsis_printed = true; } } else if( $page == $page_num ) { $pager_html .= '' . ($page_num + 1) . ''; $pager_html .= '  '; $elipsis_printed = false; } else { $query_string = array_to_query_string( $_GET, array( 'page' ) ); $query_string .= '&page=' . $page_num; $pager_html .= "" . ($page_num+1) . ""; $pager_html .= '  '; $elipsis_printed = false; } } if( $page+1 < $total_pages ) { $query_string = array_to_query_string( $_GET, array( 'page' ) ); $query_string .= '&page=' . ($page+1); $pager_html .= "››"; } else { $pager_html .= "››"; } } if( 0 == $count ) echo '

' . $lang['no_results'] . '

'; else { echo '
' . $pager_html . '

'; flush(); if( $format == 'list' ) include realpath( './search_results_list.php' ); elseif( $format == 'table' ) include realpath( './search_results_table.php' ); else pla_error( sprintf( $lang['unrecoginzed_search_result_format'], htmlspecialchars( $format ) ) ); echo '
' . $pager_html . '
'; } ?>

.