|
From: OryNider <ory...@us...> - 2008-02-16 06:25:56
|
Update of /cvsroot/mxbb/mx_phpbb/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11757 Modified Files: Tag: core28x 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.24.2.3 retrieving revision 1.24.2.4 diff -C2 -d -r1.24.2.3 -r1.24.2.4 *** forum_hack.php 24 Jan 2008 18:12:13 -0000 1.24.2.3 --- forum_hack.php 16 Feb 2008 06:25:47 -0000 1.24.2.4 *************** *** 550,554 **** if ( $mode == 'searchuser' ) { ! return ''; } break; --- 550,554 ---- if ( $mode == 'searchuser' ) { ! return $script_name; } break; *************** *** 833,836 **** --- 833,907 ---- } + 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('/\*/', '%', 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)) ? 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; + } + // -------------------------------------------------------------------------------- // Fix required by ported posting.php after submiting changes (new,edit,delete)... *************** *** 1498,1501 **** --- 1569,1576 ---- $code = str_replace('exit;', 'return;', $code); break; + + case 'search': + $code = str_replace('username_search(', '$mx_forum->username_search(', $code); + break; case 'modcp': *************** *** 1557,1561 **** if ($sub_call) { ! //die(str_replace("\n", '<br>', htmlspecialchars($code))); eval($code); } --- 1632,1636 ---- if ($sub_call) { ! //die( '<pre>'.preg_replace("#\n#esi", "'<br>' . sprintf('%4d ',\$i++)", htmlspecialchars($code)) . '</pre>'); eval($code); } *************** *** 1563,1567 **** { ! //die(str_replace("\n", '<br>', htmlspecialchars($code))); eval($code); } --- 1638,1642 ---- { ! //die( '<pre>'.preg_replace("#\n#esi", "'<br>' . sprintf('%4d ',\$i++)", htmlspecialchars($code)) . '</pre>'); eval($code); } |