force_slash_at_end(); $request_uri = $_SERVER['REQUEST_URI']; $c = explode('/', $request_uri); // Error: url too long - redir to /list/ if( isset($c[6+DEPTH]) ) { doerror(); } // if page # is present... if( isset($c[5+DEPTH]) ) { if( is_numeric($c[4+DEPTH]) ) { $ote->list_limit = $c[4+DEPTH]; } else { doerror(); } } // OK: show /list/ if( isset($c[2+DEPTH]) && $c[2+DEPTH] == '' && !isset($c[3+DEPTH]) ) { show_menu(); $ote->show_footer(); exit; } // error: unknown language keys if( $c[2+DEPTH] != LANG_1_NAME && $c[2+DEPTH] != LANG_2_NAME ) { doerror(); } if( $c[3+DEPTH] != LANG_1_NAME && $c[3+DEPTH] != LANG_2_NAME ) { doerror(); } if( $c[2+DEPTH] == LANG_1_NAME ) { show_list( LANG_1_CODE, LANG_2_CODE ); } elseif( $c[2+DEPTH] == LANG_2_NAME ) { show_list( LANG_2_CODE, LANG_1_CODE ); } else { doerror(); } $ote->show_footer(); exit; ////////////////////////////////////////////////////////////////////////////////// function doerror() { header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . HOSTNAME . 'list/'); exit; } ////////////////////////////////////////////////////////////////////////////////// function show_menu() { global $ote; $ote->show_header( $ote->__('translation dictionaries') ); print '' . '

' . '' . LANG_1_NAME . ' > ' . LANG_2_NAME . '' . '   -   ' . $ote->get_word_pair_count(LANG_1_CODE, LANG_2_CODE) . ' ' . $ote->__('word pairs') . '

' . '

' . '' . LANG_2_NAME . ' > ' . LANG_1_NAME . '' . '   -   ' . $ote->get_word_pair_count(LANG_2_CODE, LANG_1_CODE) . ' ' . $ote->__('word pairs') . '

' ; } // END function show_menu ////////////////////////////////////////////////////////////////////////////////// function show_list($source_code, $target_code) { global $ote; $source_language = $ote->get_language_name($source_code); $target_language = $ote->get_language_name($target_code); $ote->show_header( $ote->__('dictionary') . ' - ' . $source_language . ' > ' . $target_language ); $sql = " SELECT w_source.word AS source_word, w_source.id AS source_word_id, w_target.word AS target_word FROM ote_word AS w_source, ote_word AS w_target, ote_word2word AS ww WHERE ww.s_id = w_source.id AND ww.t_id = w_target.id AND ww.s_code = '$source_code' AND ww.t_code = '$target_code' ORDER BY w_source.word"; $limit_range = 1000; if( defined('NUMBER_OF_WORDS_TO_SHOW_ON_LIST') ) { $limit_range = constant('NUMBER_OF_WORDS_TO_SHOW_ON_LIST'); } $limit_start = 0 + ( $ote->list_limit * $limit_range) ; $limit_end = $limit_range; $sql .= " LIMIT $limit_start, $limit_end"; $number_of_pairs = $ote->get_word_pair_count($source_code, $target_code); if( $ote->list_limit > 0 ) { $menu .= ' < < ' . $ote->__('previous page') . '      '; } $menu .= ' Showing word pairs #' . $limit_start . ' to #' . ($limit_start + $limit_end) . ' of ' . $number_of_pairs . ' pairs total'; if( ($limit_start + $limit_end) < $number_of_pairs ) { $menu .= '      ' . '' . $ote->__('next page') . ' > >

'; } print "

$menu

"; $break = "\n"; // $tab = "\t"; $tab = " = "; if( $r = $ote->query($sql) ) { $previous_source_word = $count = ''; print '
';
    print $source_language . $tab . $target_language . $break;
    while( $x = each($r) ) {
      $x = $x[1]; 
      print $break .  show_linked_word( $x->source_word, $source_code, $bold=1)
      . $tab . show_linked_word( $x->target_word, $target_code, $bold=0);
    } // end while
    print '
'; } else { print '

' . $ote->__('no words found') . '

'; } // end if good query print $menu; } // END of function show_list() ///////////////////// function show_linked_word( $word, $lang_code, $bold=0 ) { $r = ''; if ( $bold ) { $r .= ''; } $r .= $word; if ( $bold ) { $r .= ''; } $r .= ''; return $r; }