|
From: OryNider <ory...@us...> - 2008-02-16 06:48:55
|
Update of /cvsroot/mxbb/mx_phpbb/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21635 Modified Files: forum_hack.php Log Message: search username fixed Index: forum_hack.php =================================================================== RCS file: /cvsroot/mxbb/mx_phpbb/includes/forum_hack.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** forum_hack.php 11 Feb 2008 22:46:05 -0000 1.33 --- forum_hack.php 16 Feb 2008 06:48:48 -0000 1.34 *************** *** 568,572 **** if ( $mode == 'searchuser' ) { ! return ''; } break; --- 568,572 ---- if ( $mode == 'searchuser' ) { ! return $script_name; } break; *************** *** 672,676 **** 'L_AUTO_LOGIN' => $lang['Log_me_in'], 'L_LOGIN_LOGOUT' => $lang['Login'], ! 'S_LOGIN_ACTION' => append_sid('login.'.$phpEx) ); // --- 672,676 ---- 'L_AUTO_LOGIN' => $lang['Log_me_in'], 'L_LOGIN_LOGOUT' => $lang['Login'], ! 'S_LOGIN_ACTION' => mx_append_sid('login.'.$phpEx) ); // *************** *** 990,993 **** --- 990,1065 ---- $template->assign_vars( array( 'U_MORE_SMILIES' => $this->append_sid( "posting.$phpEx?mode=smilies" ) ) ); } + + function username_search($search_match) + { + global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path; + global $starttime, $gen_simple_header; + global $mx_request_vars, $mx_root_path, $mx_user, $mx_page; + + $gen_simple_header = TRUE; + + $username_list = ''; + if ( !empty($search_match) ) + { + $username_search = preg_replace('/\*/', '%', phpBB2::phpbb_clean_username($search_match)); + + $sql = "SELECT username + FROM " . USERS_TABLE . " + WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "' AND user_id <> " . ANONYMOUS . " + ORDER BY username"; + if ( !($result = $db->sql_query($sql)) ) + { + mx_message_die(GENERAL_ERROR, 'Could not obtain search results', '', __LINE__, __FILE__, $sql); + } + + if ( $row = $db->sql_fetchrow($result) ) + { + do + { + $username_list .= '<option value="' . $row['username'] . '">' . $row['username'] . '</option>'; + } + while ( $row = $db->sql_fetchrow($result) ); + } + else + { + $username_list .= '<option>' . $lang['No_match']. '</option>'; + } + $db->sql_freeresult($result); + } + + $page_title = $lang['Search']; + //include($mx_root_path . 'includes/page_header.'.$phpEx); + + $template->set_filenames(array( + 'search_user_body' => 'search_username.tpl') + ); + + $template->assign_vars(array( + 'USERNAME' => (!empty($search_match)) ? phpBB2::phpbb_clean_username($search_match) : '', + + 'L_CLOSE_WINDOW' => $lang['Close_window'], + 'L_SEARCH_USERNAME' => $lang['Find_username'], + 'L_UPDATE_USERNAME' => $lang['Select_username'], + 'L_SELECT' => $lang['Select'], + 'L_SEARCH' => $lang['Search'], + 'L_SEARCH_EXPLAIN' => $lang['Search_author_explain'], + 'L_CLOSE_WINDOW' => $lang['Close_window'], + + 'S_USERNAME_OPTIONS' => $username_list, + 'S_SEARCH_ACTION' => $this->append_sid("search.$phpEx?mode=searchuser")) + ); + + if ( $username_list != '' ) + { + $template->assign_block_vars('switch_select_name', array()); + } + + $template->pparse('search_user_body'); + + //include($mx_root_path . 'includes/page_tail.'.$phpEx); + + return; + } + // -------------------------------------------------------------------------------- *************** *** 1599,1602 **** --- 1671,1675 ---- // $code = preg_replace ("/include(.*)functions_select/", "//", $code); + $code = preg_replace ("/include(.*)functions_search/", "//", $code); $code = preg_replace ("/include(.*)functions_post/", "//", $code); $code = preg_replace ("/include(.*)bbcode/", "//", $code); *************** *** 1639,1642 **** --- 1712,1716 ---- $code = str_replace('$temp_url = "modcp.', '$temp_url = "' . $phpbb_root_path . 'modcp.', $code); $code = str_replace('$temp_url = "posting.', '$temp_url = "' . $phpbb_root_path . 'posting.', $code); + $code = str_replace('$temp_url = "bin.', '$temp_url = "' . $phpbb_root_path . 'bin.', $code); // *************** *** 1660,1666 **** break; case 'modcp': $code = str_replace('"modcp.$phpEx', '$phpbb_root_path."modcp.$phpEx', $code); ! break; /* --- 1734,1744 ---- break; + case 'search': + $code = str_replace('username_search(', '$mx_forum->username_search(', $code); + break; + case 'modcp': $code = str_replace('"modcp.$phpEx', '$phpbb_root_path."modcp.$phpEx', $code); ! break; /* |