| 
      1
     | 
    
      <?php
 
     | 
  
  
    | 
      2
     | 
    
      
 
     | 
  
  
    | 
      3
     | 
    
      // $Id: search_convert.php 915 2009-01-21 19:27:01Z Ruebenwurzel $
 
     | 
  
  
    | 
      4
     | 
    
      
 
     | 
  
  
    | 
      5
     | 
    
      /*
 
     | 
  
  
    | 
      6
     | 
    
      
 
     | 
  
  
    | 
      7
     | 
    
       Website Baker Project <http://www.websitebaker.org/>
 
     | 
  
  
    | 
      8
     | 
    
       Copyright (C) 2004-2009, Ryan Djurovich
 
     | 
  
  
    | 
      9
     | 
    
      
 
     | 
  
  
    | 
      10
     | 
    
       Website Baker is free software; you can redistribute it and/or modify
 
     | 
  
  
    | 
      11
     | 
    
       it under the terms of the GNU General Public License as published by
 
     | 
  
  
    | 
      12
     | 
    
       the Free Software Foundation; either version 2 of the License, or
 
     | 
  
  
    | 
      13
     | 
    
       (at your option) any later version.
 
     | 
  
  
    | 
      14
     | 
    
      
 
     | 
  
  
    | 
      15
     | 
    
       Website Baker is distributed in the hope that it will be useful,
 
     | 
  
  
    | 
      16
     | 
    
       but WITHOUT ANY WARRANTY; without even the implied warranty of
 
     | 
  
  
    | 
      17
     | 
    
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
     | 
  
  
    | 
      18
     | 
    
       GNU General Public License for more details.
 
     | 
  
  
    | 
      19
     | 
    
      
 
     | 
  
  
    | 
      20
     | 
    
       You should have received a copy of the GNU General Public License
 
     | 
  
  
    | 
      21
     | 
    
       along with Website Baker; if not, write to the Free Software
 
     | 
  
  
    | 
      22
     | 
    
       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
     | 
  
  
    | 
      23
     | 
    
      
 
     | 
  
  
    | 
      24
     | 
    
      */
 
     | 
  
  
    | 
      25
     | 
    
      
 
     | 
  
  
    | 
      26
     | 
    
      /*
 
     | 
  
  
    | 
      27
     | 
    
      Character Conversion file
 
     | 
  
  
    | 
      28
     | 
    
      for search-/highlighting-related character-translations
 
     | 
  
  
    | 
      29
     | 
    
      */
 
     | 
  
  
    | 
      30
     | 
    
      
 
     | 
  
  
    | 
      31
     | 
    
      if(!defined('WB_URL')) {
     | 
  
  
    | 
      32
     | 
    
      	header('Location: ../index.php');
     | 
  
  
    | 
      33
     | 
    
      	exit(0);
 
     | 
  
  
    | 
      34
     | 
    
      }
 
     | 
  
  
    | 
      35
     | 
    
      if(!isset($search_lang)) $search_lang = LANGUAGE;
 
     | 
  
  
    | 
      36
     | 
    
      
 
     | 
  
  
    | 
      37
     | 
    
      // umlaut to '(upper|lower)' for preg_match()
 
     | 
  
  
    | 
      38
     | 
    
      // this is UTF-8-encoded
 
     | 
  
  
    | 
      39
     | 
    
      // there is no need for a translation-table anymore since we use u-switch (utf-8) for preg-functions
 
     | 
  
  
    | 
      40
     | 
    
      // remember that we use the i-switch, too. [No need for (ae|Ae)]
 
     | 
  
  
    | 
      41
     | 
    
      
 
     | 
  
  
    | 
      42
     | 
    
      $string_ul_umlaut = array();
 
     | 
  
  
    | 
      43
     | 
    
      $string_ul_regex = array();
 
     | 
  
  
    | 
      44
     | 
    
      
 
     | 
  
  
    | 
      45
     | 
    
      // but add some national stuff
 
     | 
  
  
    | 
      46
     | 
    
      if($search_lang=='DE') { // add special handling for german umlauts (ä==ae, ...)
     | 
  
  
    | 
      47
     | 
    
      	$string_ul_umlaut_add = array(
 
     | 
  
  
    | 
      48
     | 
    
      		"\xc3\x9f", // german SZ-Ligatur
 
     | 
  
  
    | 
      49
     | 
    
      		"\xc3\xa4", // german ae
 
     | 
  
  
    | 
      50
     | 
    
      		"\xc3\xb6", // german oe
 
     | 
  
  
    | 
      51
     | 
    
      		"\xc3\xbc", // german ue
 
     | 
  
  
    | 
      52
     | 
    
      		"\xc3\x84", // german Ae
 
     | 
  
  
    | 
      53
     | 
    
      		"\xc3\x96", // german Oe
 
     | 
  
  
    | 
      54
     | 
    
      		"\xc3\x9c", // german Ue
 
     | 
  
  
    | 
      55
     | 
    
      		// these are not that usual
 
     | 
  
  
    | 
      56
     | 
    
      		"\xEF\xAC\x84", // german ffl-ligatur
 
     | 
  
  
    | 
      57
     | 
    
      		"ffl",          // german ffl-ligatur
 
     | 
  
  
    | 
      58
     | 
    
      		"\xEF\xAC\x83", // german ffi-ligatur
 
     | 
  
  
    | 
      59
     | 
    
      		"ffi",          // german ffi-ligatur
 
     | 
  
  
    | 
      60
     | 
    
      		"0xEF\xAC\x80", // german ff-Ligatur
 
     | 
  
  
    | 
      61
     | 
    
      		"ff",           // german ff-Ligatur
 
     | 
  
  
    | 
      62
     | 
    
      		"\xEF\xAC\x81", // german fi-ligatur
 
     | 
  
  
    | 
      63
     | 
    
      		"fi",           // german fi-ligatur
 
     | 
  
  
    | 
      64
     | 
    
      		"\xEF\xAC\x82", // german fl-ligatur
 
     | 
  
  
    | 
      65
     | 
    
      		"fl",           // german fl-ligatur
 
     | 
  
  
    | 
      66
     | 
    
      		"\xEF\xAC\x85", // german st-Ligatur (long s)
 
     | 
  
  
    | 
      67
     | 
    
      		"st",           // german st-Ligatur
 
     | 
  
  
    | 
      68
     | 
    
      		"\xEF\xAC\x86"  // german st-ligatur (round-s)
 
     | 
  
  
    | 
      69
     | 
    
      	);
 
     | 
  
  
    | 
      70
     | 
    
      	$string_ul_regex_add = array(
 
     | 
  
  
    | 
      71
     | 
    
      		"(\xc3\x9f|ss)", // german SZ.Ligatur
 
     | 
  
  
    | 
      72
     | 
    
      		"(\xc3\xa4|ae)", // german ae
 
     | 
  
  
    | 
      73
     | 
    
      		"(\xc3\xb6|oe)", // german oe
 
     | 
  
  
    | 
      74
     | 
    
      		"(\xc3\xbc|ue)", // german ue
 
     | 
  
  
    | 
      75
     | 
    
      		"(\xc3\x84|Ae)", // german Ae
 
     | 
  
  
    | 
      76
     | 
    
      		"(\xc3\x96|Oe)", // german Oe
 
     | 
  
  
    | 
      77
     | 
    
      		"(\xc3\x9c|Ue)", // german Ue
 
     | 
  
  
    | 
      78
     | 
    
      		// these are not that usual
 
     | 
  
  
    | 
      79
     | 
    
      		"(\xEF\xAC\x84|ffl)", // german ffl-ligatur
 
     | 
  
  
    | 
      80
     | 
    
      		"(\xEF\xAC\x84|ffl)", // german ffl-ligatur
 
     | 
  
  
    | 
      81
     | 
    
      		"(\xEF\xAC\x83|ffi)", // german ffi-ligatur
 
     | 
  
  
    | 
      82
     | 
    
      		"(\xEF\xAC\x83|ffi)", // german ffi-ligatur
 
     | 
  
  
    | 
      83
     | 
    
      		"(\xEF\xAC\x80|ff)",  // german ff-Ligatur
 
     | 
  
  
    | 
      84
     | 
    
      		"(\xEF\xAC\x80|ff)",  // german ff-Ligatur
 
     | 
  
  
    | 
      85
     | 
    
      		"(\xEF\xAC\x81|fi)",  // german fi-Ligatur
 
     | 
  
  
    | 
      86
     | 
    
      		"(\xEF\xAC\x81|fi)",  // german fi-Ligatur
 
     | 
  
  
    | 
      87
     | 
    
      		"(\xEF\xAC\x82|fl)",  // german fl-ligatur
 
     | 
  
  
    | 
      88
     | 
    
      		"(\xEF\xAC\x82|fl)",  // german fl-ligatur
 
     | 
  
  
    | 
      89
     | 
    
      		"(\xEF\xAC\x85|st)",  // german st-Ligatur (long s)
 
     | 
  
  
    | 
      90
     | 
    
      		"(\xEF\xAC\x85|st|\xEF\xAC\x86)",  // german st-Ligaturs
 
     | 
  
  
    | 
      91
     | 
    
      		"(\xEF\xAC\x86|st)"  // german st-ligatur (round-s)
 
     | 
  
  
    | 
      92
     | 
    
      	);
 
     | 
  
  
    | 
      93
     | 
    
      	$string_ul_umlaut = array_merge($string_ul_umlaut_add, $string_ul_umlaut);
 
     | 
  
  
    | 
      94
     | 
    
      	$string_ul_regex = array_merge($string_ul_regex_add, $string_ul_regex);
 
     | 
  
  
    | 
      95
     | 
    
      }
 
     | 
  
  
    | 
      96
     | 
    
      
 
     | 
  
  
    | 
      97
     | 
    
      
 
     | 
  
  
    | 
      98
     | 
    
      ?>
 
     |