|
From: FlorinCB <ory...@us...> - 2008-10-06 13:24:26
|
Update of /cvsroot/mxbb/core/includes In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23165 Modified Files: mx_functions_admincp.php Log Message: query fix for UTF-8 Index: mx_functions_admincp.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_admincp.php,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** mx_functions_admincp.php 4 Oct 2008 07:04:25 -0000 1.61 --- mx_functions_admincp.php 6 Oct 2008 13:20:03 -0000 1.62 *************** *** 3210,3215 **** $search_raw_words = array(); ! $search_raw_words['text'] = split_words(clean_words('post', $post_text, $stopword_array, $synonym_array)); ! $search_raw_words['title'] = split_words(clean_words('post', $post_title, $stopword_array, $synonym_array)); @set_time_limit(0); --- 3210,3215 ---- $search_raw_words = array(); ! $search_raw_words['text'] = split_words(clean_words('post', utf8_normalize_nfc($post_text), $stopword_array, $synonym_array)); ! $search_raw_words['title'] = split_words(clean_words('post', utf8_normalize_nfc($post_title), $stopword_array, $synonym_array)); @set_time_limit(0); *************** *** 3323,3332 **** case 'mysqli': $sql = "INSERT IGNORE INTO " . $search_word_table . " (word_text, word_common) ! VALUES $value_sql"; break; case 'mssql': case 'mssql-odbc': $sql = "INSERT INTO " . $search_word_table . " (word_text, word_common) ! $value_sql"; break; } --- 3323,3332 ---- case 'mysqli': $sql = "INSERT IGNORE INTO " . $search_word_table . " (word_text, word_common) ! VALUES " . $value_sql; break; case 'mssql': case 'mssql-odbc': $sql = "INSERT INTO " . $search_word_table . " (word_text, word_common) ! " . $value_sql; break; } *************** *** 3346,3358 **** if ( $match_sql != '' ) { $sql = "INSERT INTO " . $search_match_table . " ($db_key, word_id, title_match) SELECT $block_id, word_id, $title_match FROM " . $search_word_table . " WHERE word_text IN ($match_sql)"; ! if ( !$db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not insert new word matches', '', __LINE__, __FILE__, $sql); ! } ! $db->sql_freeresult($result); } } --- 3346,3385 ---- if ( $match_sql != '' ) { + + $sql = "SELECT $block_id, word_id, $title_match + FROM " . $search_word_table . " + WHERE word_text IN ($match_sql)"; + if ( !($result = $db->sql_query($sql)) ) + { + mx_message_die(GENERAL_ERROR, 'Could not select words', '', __LINE__, __FILE__, $sql); + } + + while ( $row = $db->sql_fetchrow($result) ) + { + $word_id = $row['word_id']; + } + $db->sql_freeresult($result); + + + //To do: Need to be upgraded for UTF-8 + //$sql_where = ' IN (' . $match_sql . ')'; $sql = "INSERT INTO " . $search_match_table . " ($db_key, word_id, title_match) SELECT $block_id, word_id, $title_match FROM " . $search_word_table . " WHERE word_text IN ($match_sql)"; ! ! $sql = array( ! $db_key => $block_id, ! 'word_id' => $word_id, ! 'title_match' => $title_match, ! ); ! ! $sql = "INSERT INTO $search_match_table " . $db->sql_build_array('INSERT', $sql); ! ! if ( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not insert new word matches', '', __LINE__, __FILE__, $sql); ! } ! } } |