Changeset 393 for trunk/admin/user_perm.php
- Timestamp:
- Mar 20, 2004, 1:52:37 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/user_perm.php
r362 r393 25 25 // | USA. | 26 26 // +-----------------------------------------------------------------------+ 27 include_once( './admin/include/isadmin.inc.php' ); 27 28 if( !defined("IN_ADMIN") ) 29 { 30 die ("Hacking attempt!"); 31 } 32 33 include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' ); 34 35 // 36 // Username search 37 // 38 function username_search($search_match) 39 { 40 global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path; 41 global $starttime, $gen_simple_header; 42 43 $gen_simple_header = TRUE; 44 45 $username_list = ''; 46 if ( !empty($search_match) ) 47 { 48 $username_search = preg_replace('/\*/', '%', trim(strip_tags($search_match))); 49 50 $sql = "SELECT username 51 FROM " . USERS_TABLE . " 52 WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "' 53 ORDER BY username"; 54 if ( !($result = $db->sql_query($sql)) ) 55 { 56 message_die(GENERAL_ERROR, 'Could not obtain search results', '', __LINE__, __FILE__, $sql); 57 } 58 59 if ( $row = $db->sql_fetchrow($result) ) 60 { 61 do 62 { 63 $username_list .= '<option value="' . $row['username'] . '">' . $row['username'] . '</option>'; 64 } 65 while ( $row = $db->sql_fetchrow($result) ); 66 } 67 else 68 { 69 $username_list .= '<option>' . $lang['No_match']. '</option>'; 70 } 71 $db->sql_freeresult($result); 72 } 73 74 $page_title = $lang['Search']; 75 include($phpbb_root_path . 'includes/page_header.'.$phpEx); 76 77 $template->set_filenames(array( 78 'search_user_body' => 'search_username.tpl') 79 ); 80 81 $template->assign_vars(array( 82 'USERNAME' => ( !empty($search_match) ) ? strip_tags($search_match) : '', 83 84 'L_CLOSE_WINDOW' => $lang['Close_window'], 85 'L_SEARCH_USERNAME' => $lang['Find_username'], 86 'L_UPDATE_USERNAME' => $lang['Select_username'], 87 'L_SELECT' => $lang['Select'], 88 'L_SEARCH' => $lang['Search'], 89 'L_SEARCH_EXPLAIN' => $lang['Search_author_explain'], 90 'L_CLOSE_WINDOW' => $lang['Close_window'], 91 92 'S_USERNAME_OPTIONS' => $username_list, 93 'S_SEARCH_ACTION' => append_sid("search.$phpEx?mode=searchuser")) 94 ); 95 96 if ( $username_list != '' ) 97 { 98 $template->assign_block_vars('switch_select_name', array()); 99 } 100 101 $template->pparse('search_user_body'); 102 103 include($phpbb_root_path . 'includes/page_tail.'.$phpEx); 104 105 return; 106 } 107 108 if (isset($HTTP_POST_VARS['username']) || isset( $_POST['submit'] )) 109 { 28 110 //----------------------------------------------------- template initialization 29 $sub = $vtp->Open( './template/'.$user['template'].'/admin/user_perm.vtp' ); 111 $template->set_filenames( array('user'=>'admin/user_perm.tpl') ); 112 30 113 $error = array(); 31 114 $tpl = array( 'permuser_authorized','permuser_forbidden','submit', 32 115 'permuser_parent_forbidden','permuser_info_message', 33 116 'adduser_info_back','permuser_only_private' ); 34 templatize_array( $tpl, 'lang', $sub );35 $vtp->setGlobalVar( $sub, 'user_template', $user['template'] );36 117 //--------------------------------------------------------------------- updates 37 118 if ( isset( $_POST['submit'] ) ) … … 68 149 } 69 150 //---------------------------------------------------------------- form display 151 70 152 $restrictions = get_user_restrictions( $_GET['user_id'], $page['user_status'], 71 153 false, false ); … … 184 266 $vtp->closeSession( $sub, 'category' ); 185 267 } 268 //----------------------------------------------------------- default code 269 else 270 { 271 $sub = $vtp->Open( '../template/'.$user['template'].'/admin/user_select_body.vtp' ); 272 $tpl = array( 'Look_up_user', 'Find_username', 'Select_username' ); 273 templatize_array( $tpl, 'lang', $sub ); 274 $vtp->addSession( $sub, 'user' ); 275 $vtp->setVarTab( $sub, array( 276 'user.S_USER_ACTION' => append_sid("./admin.php?page=user_search"), 277 'user.U_SEARCH_USER' => append_sid("./search.php")) 278 ); 279 $vtp->closeSession( $sub, 'user' ); 280 } 186 281 //----------------------------------------------------------- sending html code 187 282 $vtp->Parse( $handle , 'sub', $sub );
Note: See TracChangeset
for help on using the changeset viewer.