aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2001-10-16 14:47:27 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2001-10-16 14:47:27 +0000
commitfd59e8889866832a291a77350ecdbfb982cd84c4 (patch)
treebc0d8a34c1a92ba973192155ae7b731b05b4975d
parent69e8054bdcab2a52349f676ae27dd0f1114e3633 (diff)
downloadforums-fd59e8889866832a291a77350ecdbfb982cd84c4.tar
forums-fd59e8889866832a291a77350ecdbfb982cd84c4.tar.gz
forums-fd59e8889866832a291a77350ecdbfb982cd84c4.tar.bz2
forums-fd59e8889866832a291a77350ecdbfb982cd84c4.tar.xz
forums-fd59e8889866832a291a77350ecdbfb982cd84c4.zip
Slight mods to the usersearch function, moved to search.php
git-svn-id: file:///svn/phpbb/trunk@1224 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/admin/admin_userauth.php2
-rw-r--r--phpBB/admin/admin_users.php29
-rw-r--r--phpBB/includes/functions.php94
-rw-r--r--phpBB/language/lang_english/lang_main.php4
-rw-r--r--phpBB/privmsg.php16
-rw-r--r--phpBB/search.php22
-rw-r--r--phpBB/templates/subSilver/posting_body.tpl2
-rw-r--r--phpBB/templates/subSilver/search_username.tpl26
8 files changed, 95 insertions, 100 deletions
diff --git a/phpBB/admin/admin_userauth.php b/phpBB/admin/admin_userauth.php
index 240b40713f..0054516fe1 100644
--- a/phpBB/admin/admin_userauth.php
+++ b/phpBB/admin/admin_userauth.php
@@ -964,7 +964,7 @@ else
"L_LOOK_UP" => $lang['Look_up'] . " " . $lang['User'],
"L_FIND_USERNAME" => $lang['Find_username'],
- "U_SEARCH_USER" => append_sid("admin_users.$phpEx?mode=searchuser"),
+ "U_SEARCH_USER" => append_sid("../search.$phpEx?mode=searchuser"),
"S_USER_ACTION" => append_sid("admin_userauth.$phpEx"))
);
diff --git a/phpBB/admin/admin_users.php b/phpBB/admin/admin_users.php
index 6cbca06024..a314fc8372 100644
--- a/phpBB/admin/admin_users.php
+++ b/phpBB/admin/admin_users.php
@@ -20,8 +20,6 @@
*
***************************************************************************/
-define("IN_ADMIN", true);
-
if($setmodules == 1)
{
$filename = basename(__FILE__);
@@ -35,8 +33,6 @@ if($setmodules == 1)
//
$phpbb_root_dir = "./../";
require('pagestart.inc');
-include($phpbb_root_path . 'includes/post.'.$phpEx);
-include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
if( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
{
@@ -127,21 +123,12 @@ function validate_optional_fields(&$icq, &$aim, &$msnm, &$yim, &$website, &$loca
//
if( $mode == "searchuser" )
{
- if( isset($HTTP_POST_VARS['search']) )
- {
- $username_list = username_search("admin_users.$phpEx", $HTTP_POST_VARS['search_author'], 1);
- }
- else
- {
- username_search("admin_users.$phpEx", "", 1);
- }
-
//
// Remove this later
//
exit;
}
-else if ( ($mode == "edit" && (isset($HTTP_POST_VARS['username']) && $mode != "save" ) || ( isset($HTTP_POST_VARS[POST_USERS_URL]) || isset($HTTP_GET_VARS[POST_USERS_URL]) ) ) )
+else if ( ($mode == "edit") || (isset($HTTP_POST_VARS['username']) || isset($HTTP_GET_VARS[POST_USERS_URL]) || isset($HTTP_POST_VARS[POST_USERS_URL])) )
{
//
// Let's find out a little about them...
@@ -235,13 +222,13 @@ else if ( ($mode == "edit" && (isset($HTTP_POST_VARS['username']) && $mode != "s
$rank_rows = $db->sql_fetchrowset($result);
- $rank_select_box = '<option value="0">No Special Rank</option>';
+ $rank_select_box = "";
for($i = 0; $i < $rank_count; $i++)
{
$rank = $rank_rows[$i]['rank_title'];
$rank_id = $rank_rows[$i]['rank_id'];
- if ( $this_userdata['user_rank'] == $rank_id )
+ if ( $this_userdata['user_rank'] == $i + 1 )
{
$rank_select_box .= "<option value=\"" . $rank_id . "\" selected=\"selected\">" . $rank . "</option>";
}
@@ -408,9 +395,9 @@ else if( $HTTP_POST_VARS['mode'] == "save" )
$user_status = (!empty($HTTP_POST_VARS['user_status'])) ? intval($HTTP_POST_VARS['user_status']) : 0;
$user_allowpm = (!empty($HTTP_POST_VARS['user_allowpm'])) ? intval($HTTP_POST_VARS['user_allowpm']) : 0;
$user_allowavatar = (!empty($HTTP_POST_VARS['user_allowavatar'])) ? intval($HTTP_POST_VARS['user_allowavatar']) : 0;
- $user_rank = (!empty($HTTP_POST_VARS['user_rank'])) ? intval($HTTP_POST_VARS['user_rank']) : 0;
+ $user_rank = (!empty($HTTP_POST_VARS['user_rank'])) ? intval($HTTP_POST_VARS['user_rank']) : "";
- $user_rank_sql = ", user_rank = " . $user_rank;
+ $user_rank_sql = (isset($user_rank)) ? ", user_rank = " . $user_rank : "";
if(isset($HTTP_POST_VARS['submit']))
{
@@ -546,7 +533,7 @@ else if( $HTTP_POST_VARS['mode'] == "save" )
$template->assign_vars(array(
"MESSAGE_TITLE" => $lang['User'] . $lang['User_admin'],
- "MESSAGE_TEXT" => "Error updating user profile<br>$sql")
+ "MESSAGE_TEXT" => "Error updating user profile")
);
$template->pparse("body");
}
@@ -570,6 +557,8 @@ else
//
// Default user selection box
//
+ // This should be altered on the final system
+ //
$sql = "SELECT user_id, username
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS ."
@@ -595,7 +584,7 @@ else
"L_LOOK_UP" => $lang['Look_up'] . " " . $lang['User'],
"L_FIND_USERNAME" => $lang['Find_username'],
- "U_SEARCH_USER" => append_sid("admin_users.$phpEx?mode=searchuser"),
+ "U_SEARCH_USER" => append_sid("../search.$phpEx?mode=searchuser"),
"S_USER_ACTION" => append_sid("admin_users.$phpEx"),
"S_USER_SELECT" => $select_list)
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 66149d509a..66b72a986b 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -897,16 +897,10 @@ function obtain_word_list(&$orig_word, &$replacement_word)
//
// Username search
//
-function username_search($calling_script, $search_match, $enable_window = 0, $default_list = "")
+function username_search($search_match, $is_inline_review = 0, $default_list = "")
{
- global $db, $template, $lang, $theme;
-
- if( $enable_window )
- {
- $template->set_filenames(array(
- "minisearchbody" => "mini_search.tpl")
- );
- }
+ global $db, $board_config, $template, $lang, $images, $theme, $phpEx;
+ global $starttime;
$author_list = "";
if( !empty($search_match) )
@@ -935,72 +929,44 @@ function username_search($calling_script, $search_match, $enable_window = 0, $de
$author_list = "<option>" . $lang['No_match']. "</option>";
}
- if( $enable_window )
- {
- $template->assign_vars(array(
- "S_AUTHOR_OPTIONS" => $author_list)
- );
-
- $template->assign_block_vars("select_name", array());
- }
}
- if( $enable_window )
+ if( !$is_inline_review )
{
- //
- // This theme var setup is very very temporary, completely
- // forgot about it, doh!
- //
+ $gen_simple_header = TRUE;
+
+ $page_title = $lang['Search'];
+ include($phpbb_root_path . 'includes/page_header.'.$phpEx);
+
+ $template->set_filenames(array(
+ "search_user_body" => "search_username.tpl")
+ );
+
$template->assign_vars(array(
- "T_HEAD_STYLESHEET" => $theme['head_stylesheet'],
- "T_BODY_BACKGROUND" => $theme['body_background'],
- "T_BODY_BGCOLOR" => "#".$theme['body_bgcolor'],
- "T_BODY_TEXT" => "#".$theme['body_text'],
- "T_BODY_LINK" => "#".$theme['body_link'],
- "T_BODY_VLINK" => "#".$theme['body_vlink'],
- "T_BODY_ALINK" => "#".$theme['body_alink'],
- "T_BODY_HLINK" => "#".$theme['body_hlink'],
- "T_TR_COLOR1" => "#".$theme['tr_color1'],
- "T_TR_COLOR2" => "#".$theme['tr_color2'],
- "T_TR_COLOR3" => "#".$theme['tr_color3'],
- "T_TR_CLASS1" => $theme['tr_class1'],
- "T_TR_CLASS2" => $theme['tr_class2'],
- "T_TR_CLASS3" => $theme['tr_class3'],
- "T_TH_COLOR1" => "#".$theme['th_color1'],
- "T_TH_COLOR2" => "#".$theme['th_color2'],
- "T_TH_COLOR3" => "#".$theme['th_color3'],
- "T_TH_CLASS1" => $theme['th_class1'],
- "T_TH_CLASS2" => $theme['th_class2'],
- "T_TH_CLASS3" => $theme['th_class3'],
- "T_TD_COLOR1" => "#".$theme['td_color1'],
- "T_TD_COLOR2" => "#".$theme['td_color2'],
- "T_TD_COLOR3" => "#".$theme['td_color3'],
- "T_TD_CLASS1" => $theme['td_class1'],
- "T_TD_CLASS2" => $theme['td_class2'],
- "T_TD_CLASS3" => $theme['td_class3'],
- "T_FONTFACE1" => $theme['fontface1'],
- "T_FONTFACE2" => $theme['fontface2'],
- "T_FONTFACE3" => $theme['fontface3'],
- "T_FONTSIZE1" => $theme['fontsize1'],
- "T_FONTSIZE2" => $theme['fontsize2'],
- "T_FONTSIZE3" => $theme['fontsize3'],
- "T_FONTCOLOR1" => "#".$theme['fontcolor1'],
- "T_FONTCOLOR2" => "#".$theme['fontcolor2'],
- "T_FONTCOLOR3" => "#".$theme['fontcolor3'],
- "T_SPAN_CLASS1" => $theme['span_class1'],
- "T_SPAN_CLASS2" => $theme['span_class2'],
- "T_SPAN_CLASS3" => $theme['span_class3'],
-
"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_SEARCH_ACTION" => append_sid("$calling_script?mode=searchuser"))
+ "S_AUTHOR_OPTIONS" => $author_list,
+ "S_SEARCH_ACTION" => append_sid("search.$phpEx?mode=searchuser"))
);
- $template->pparse("minisearchbody");
+ //
+ // If we have results then dump them out and enable
+ // the appropriate switch block
+ //
+ if( !empty($author_list) )
+ {
+ $template->assign_block_vars("switch_select_name", array());
+ }
+
+ $template->pparse("search_user_body");
+
+ include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
return($author_list);
@@ -1069,7 +1035,7 @@ function message_die($msg_code, $msg_text = "", $msg_title = "", $err_line = "",
if( empty($theme) )
{
- $theme = setup_style($board_config['default_style']);
+ $theme = setup_style($board_config['default_theme']);
}
//
diff --git a/phpBB/language/lang_english/lang_main.php b/phpBB/language/lang_english/lang_main.php
index 2f86c0393d..2817619c78 100644
--- a/phpBB/language/lang_english/lang_main.php
+++ b/phpBB/language/lang_english/lang_main.php
@@ -622,7 +622,7 @@ $lang['found'] = "found"; // this precedes the number of matches found and follo
$lang['match'] = "Match"; // this and the following entry proceed the number of matches found
$lang['matches'] = "Matches";
$lang['Search_new'] = "View posts since last visit";
-
+$lang['Close_window'] = "Close Window";
//
// Auth related entries
@@ -1116,4 +1116,4 @@ $lang['no_disallowed'] = "No Disallowed Usernames";
// That's all Folks!
// -------------------------------------------------
-?>
+?> \ No newline at end of file
diff --git a/phpBB/privmsg.php b/phpBB/privmsg.php
index 10f5fbca78..157eb3b80d 100644
--- a/phpBB/privmsg.php
+++ b/phpBB/privmsg.php
@@ -745,19 +745,12 @@ else if( $submit || $refresh || $mode != "" )
if( $mode == "searchuser" )
{
- if( isset($HTTP_POST_VARS['search']) )
- {
- $username_list = username_search("privmsg.$phpEx", $HTTP_POST_VARS['search_author'], 1);
- }
- else
- {
- username_search("privmsg.$phpEx", "", 1);
- }
-
//
- // Remove this later
+ // This 'will' handle a simple user search
+ // performed from within the private message post
+ // form
//
- exit;
+
}
//
@@ -1488,6 +1481,7 @@ else if( $submit || $refresh || $mode != "" )
"S_HIDDEN_FORM_FIELDS" => $s_hidden_fields,
"S_POST_ACTION" => append_sid("privmsg.$phpEx"),
+ "U_SEARCH_USER" => append_sid("search.$phpEx?mode=searchuser"),
"U_VIEW_FORUM" => append_sid("privmsg.$phpEx"))
);
diff --git a/phpBB/search.php b/phpBB/search.php
index 1b0f48454f..7e9dd3af4c 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -399,7 +399,27 @@ $sortby_sql = array("p.post_time", "pt.post_subject", "t.topic_title", "u.userna
//
// Begin core code
//
-if( $query_keywords != "" || $query_author != "" || $search_id )
+if( $mode == "searchuser" )
+{
+ //
+ // This handles the simple windowed user search
+ // functions called from various other scripts. If a
+ // script allows an 'inline' user search then this is
+ // handled by the script itself, this is only for the
+ // windowed version
+ //
+ if( isset($HTTP_POST_VARS['search']) )
+ {
+ username_search($HTTP_POST_VARS['search_author'], false);
+ }
+ else
+ {
+ username_search("", false);
+ }
+
+ exit;
+}
+else if( $query_keywords != "" || $query_author != "" || $search_id )
{
if( $query_keywords != "" || $query_author != "" || $search_id == "newposts" )
diff --git a/phpBB/templates/subSilver/posting_body.tpl b/phpBB/templates/subSilver/posting_body.tpl
index 2bdedb6fc4..8343b815b7 100644
--- a/phpBB/templates/subSilver/posting_body.tpl
+++ b/phpBB/templates/subSilver/posting_body.tpl
@@ -209,7 +209,7 @@ function bbstyle(formObj, bbnumber) {
<td class="row2"><span class="genmed">
<input type="text" class="post" name="username" maxlength="50" size="20" tabindex="1" value="{USERNAME}" />
&nbsp;
- <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('privmsg.php?mode=searchuser', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" />
+ <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" />
</span></td>
</tr>
<!-- END privmsg_extensions -->
diff --git a/phpBB/templates/subSilver/search_username.tpl b/phpBB/templates/subSilver/search_username.tpl
new file mode 100644
index 0000000000..b915119c1a
--- /dev/null
+++ b/phpBB/templates/subSilver/search_username.tpl
@@ -0,0 +1,26 @@
+
+<script language="javascript" type="text/javascript">
+<!--
+function refresh_username(selected_username)
+{
+ opener.document.forms['post'].username.value = selected_username;
+}
+//-->
+</script>
+
+<form method="post" name="search" action="{S_SEARCH_ACTION}"><table width="100%" border="0" cellspacing="0" cellpadding="5" align="center" height="100%">
+ <tr>
+ <td><table width="100%" border="0" cellspacing="1" cellpadding="4" class="forumline">
+ <tr>
+ <th class="thHead">{L_SEARCH_USERNAME}</th>
+ </tr>
+ <tr>
+ <td valign="top" class="row1"><span class="genmed"><br /><input type="text" name="search_author" value="{AUTHOR}" class="post" /> &nbsp;<input type="submit" name="search" value="{L_SEARCH}" class="liteoption" /></span><br /><span class="gensmall">{L_SEARCH_EXPLAIN}</span><br />
+ <!-- BEGIN switch_select_name -->
+ <span class="genmed">{L_UPDATE_USERNAME}<br /><select name="author_list">{S_AUTHOR_OPTIONS}</select> &nbsp;<input type="submit" class="liteoption" onClick="refresh_username(this.form.author_list.options[this.form.author_list.selectedIndex].value);return false;" name="use" value="{L_SELECT}" /></span><br />
+ <!-- END switch_select_name -->
+ <br /><span class="gen"><a href="javascript:window.close();" class="gen">{L_CLOSE_WINDOW}</a></span></td>
+ </tr>
+ </table></td>
+ </tr>
+</table></form>