- Timestamp:
- Apr 25, 2005, 11:35:10 PM (20 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin.php
r764 r768 51 51 switch ( $_GET['page'] ) 52 52 { 53 case 'user_list': 54 $title = $lang['title_liste_users']; $page_valide = true; break; 55 case 'profile': 56 $title = $lang['title_user_modify']; 57 $page_valide = true; 58 break; 53 case 'user_list' : 54 { 55 $title = $lang['title_liste_users']; 56 $page_valide = true; 57 break; 58 } 59 case 'profile' : 60 { 61 $title = $lang['title_user_modify']; 62 $page_valide = true; 63 break; 64 } 59 65 case 'user_perm': 60 66 $title = $lang['title_user_perm'].' '.$username; … … 249 255 'U_CADDIE'=>add_session_id($link_start.'element_set&cat=caddie'), 250 256 'U_THUMBNAILS'=>add_session_id($link_start.'thumbnail' ), 251 'U_USERS'=>add_session_id($link_start.' profile' ),257 'U_USERS'=>add_session_id($link_start.'user_list' ), 252 258 'U_GROUPS'=>add_session_id($link_start.'group_list' ), 253 259 'U_USERS_AUTH'=>add_session_id($link_start.'user_perm' ), -
trunk/doc/ChangeLog
r767 r768 1 2005-04-25 Pierrick LE GALL 2 3 * profile.php is no longer used for listing users : 4 admin/user_list.php comes back (as in 1.3 branch) 5 6 * user list updated : ability to filter list on username 7 1 8 2005-04-25 Gweltas 2 9 -
trunk/profile.php
r746 r768 31 31 // +-----------------------------------------------------------------------+ 32 32 $userdata = array(); 33 if (defined('IN_ADMIN') and isset($_POST['submituser'])) 34 { 35 $userdata = getuserdata($_POST['username']); 36 } 37 else if (defined('IN_ADMIN') and IN_ADMIN and isset($_GET['user_id'])) 33 if (defined('IN_ADMIN') and IN_ADMIN and isset($_GET['user_id'])) 38 34 { 39 35 $userdata = getuserdata(intval($_GET['user_id'])); … … 209 205 } 210 206 } 211 else if (defined('IN_ADMIN') and IN_ADMIN and isset($_POST['submit_add']))212 {213 $errors = register_user($_POST['login'], $_POST['password'],214 $_POST['password'], '');215 }216 207 // +-----------------------------------------------------------------------+ 217 208 // | page header and options | … … 231 222 $template->set_filenames(array('profile_body'=>'profile.tpl')); 232 223 233 if (defined('IN_ADMIN') and IN_ADMIN and empty($userdata)) 234 { 235 $admin_profile = add_session_id(PHPWG_ROOT_PATH.'admin.php?page=profile'); 236 237 $template->assign_block_vars('add_user', array('F_ACTION'=>$admin_profile)); 238 $template->assign_block_vars('select_user',array()); 239 240 $conf['users_page'] = 20; 241 $start = isset($_GET['start']) ? $_GET['start'] : 0; 242 243 $query = ' 244 SELECT COUNT(*) AS counter 245 FROM '.USERS_TABLE.' 246 WHERE id != 2 247 ;'; 248 list($counter) = mysql_fetch_row(pwg_query($query)); 249 $url = PHPWG_ROOT_PATH.'admin.php'.get_query_string_diff(array('start')); 250 $navbar = create_navigation_bar($url, 251 $counter, 252 $start, 253 $conf['users_page'], 254 ''); 255 256 $template->assign_vars( 224 $expand = ($userdata['expand'] == 'true') ? 'EXPAND_TREE_YES':'EXPAND_TREE_NO'; 225 226 $nb_comments = 227 ($userdata['show_nb_comments'] == 'true') ? 'NB_COMMENTS_YES':'NB_COMMENTS_NO'; 228 229 $template->assign_vars( 230 array( 231 'USERNAME'=>$userdata['username'], 232 'USERID'=>$userdata['id'], 233 'EMAIL'=>@$userdata['mail_address'], 234 'LANG_SELECT'=>language_select($userdata['language'], 'language'), 235 'NB_IMAGE_LINE'=>$userdata['nb_image_line'], 236 'NB_ROW_PAGE'=>$userdata['nb_line_page'], 237 'STYLE_SELECT'=>style_select($userdata['template'], 'template'), 238 'RECENT_PERIOD'=>$userdata['recent_period'], 239 'MAXWIDTH'=>@$userdata['maxwidth'], 240 'MAXHEIGHT'=>@$userdata['maxheight'], 241 242 $expand=>'checked="checked"', 243 $nb_comments=>'checked="checked"', 244 245 'L_TITLE' => $lang['customize_title'], 246 'L_REGISTRATION_INFO' => $lang['register_title'], 247 'L_PREFERENCES' => $lang['preferences'], 248 'L_USERNAME' => $lang['login'], 249 'L_EMAIL' => $lang['mail_address'], 250 'L_CURRENT_PASSWORD' => $lang['password'], 251 'L_CURRENT_PASSWORD_HINT' => $lang['password_hint'], 252 'L_NEW_PASSWORD' => $lang['new_password'], 253 'L_NEW_PASSWORD_HINT' => $lang['new_password_hint'], 254 'L_CONFIRM_PASSWORD' => $lang['reg_confirm'], 255 'L_CONFIRM_PASSWORD_HINT' => $lang['confirm_password_hint'], 256 'L_LANG_SELECT'=>$lang['language'], 257 'L_NB_IMAGE_LINE'=>$lang['nb_image_per_row'], 258 'L_NB_ROW_PAGE'=>$lang['nb_row_per_page'], 259 'L_STYLE_SELECT'=>$lang['theme'], 260 'L_RECENT_PERIOD'=>$lang['recent_period'], 261 'L_EXPAND_TREE'=>$lang['auto_expand'], 262 'L_NB_COMMENTS'=>$lang['show_nb_comments'], 263 'L_MAXWIDTH'=>$lang['maxwidth'], 264 'L_MAXHEIGHT'=>$lang['maxheight'], 265 'L_YES'=>$lang['yes'], 266 'L_NO'=>$lang['no'], 267 'L_SUBMIT'=>$lang['submit'], 268 'L_RESET'=>$lang['reset'], 269 'L_RETURN' => $lang['home'], 270 'L_RETURN_HINT' => $lang['home_hint'], 271 272 'F_ACTION'=>add_session_id($url_action), 273 )); 274 275 if (!defined('IN_ADMIN') or !IN_ADMIN) 276 { 277 $url_return = PHPWG_ROOT_PATH.'category.php?'.$_SERVER['QUERY_STRING']; 278 $template->assign_vars(array('U_RETURN' => add_session_id($url_return))); 279 } 280 //------------------------------------------------------------- user management 281 if (defined('IN_ADMIN') and IN_ADMIN) 282 { 283 $status_select = '<select name="status">'; 284 $status_select .='<option value = "guest" '; 285 if ($userdata['status'] == 'guest') 286 { 287 $status_select .= 'selected="selected"'; 288 } 289 $status_select .='>'.$lang['user_status_guest'] .'</option>'; 290 $status_select .='<option value = "admin" '; 291 if ($userdata['status'] == 'admin') 292 { 293 $status_select .= 'selected="selected"'; 294 } 295 $status_select .='>'.$lang['user_status_admin'] .'</option>'; 296 $status_select .='</select>'; 297 $template->assign_block_vars( 298 'admin', 257 299 array( 258 'L_SELECT_USERNAME'=>$lang['Select_username'], 259 'L_LOOKUP_USER'=>$lang['Look_up_user'], 260 'L_FIND_USERNAME'=>$lang['Find_username'], 261 'L_AUTH_USER'=>$lang['permuser_only_private'], 262 'L_GROUP_ADD_USER' => $lang['group_add_user'], 263 'L_SUBMIT'=>$lang['submit'], 300 'L_ADMIN_USER'=>$lang['user_management'], 264 301 'L_STATUS'=>$lang['user_status'], 265 'L_USERNAME' => $lang['login'], 266 'L_PASSWORD' => $lang['password'], 267 'L_EMAIL' => $lang['mail_address'], 268 'L_ORDER_BY' => $lang['order_by'], 269 'L_ACTIONS' => $lang['actions'], 270 'L_PERMISSIONS' => $lang['permissions'], 271 'L_USERS_LIST' => $lang['title_liste_users'], 272 273 'NAVBAR'=>$navbar, 274 'F_SEARCH_USER_ACTION' => $admin_profile, 275 'F_ORDER_ACTION' => $admin_profile, 276 'U_SEARCH_USER' => add_session_id(PHPWG_ROOT_PATH.'admin/search.php') 302 'L_DELETE'=>$lang['user_delete'], 303 'L_DELETE_HINT'=>$lang['user_delete_hint'], 304 'STATUS'=>$status_select 277 305 )); 278 279 $order_by_items = array('id' => $lang['registration_date'],280 'username' => $lang['login']);281 foreach ($order_by_items as $item => $label)282 {283 $selected = (isset($_GET['order_by']) and $_GET['order_by'] == $item) ?284 'selected="selected"' : '';285 $template->assign_block_vars(286 'select_user.order_by',287 array(288 'VALUE' => $item,289 'CONTENT' => $label,290 'SELECTED' => $selected291 ));292 }293 294 $direction_items = array('asc' => $lang['ascending'],295 'desc' => $lang['descending']);296 foreach ($direction_items as $item => $label)297 {298 $selected = (isset($_GET['direction']) and $_GET['direction'] == $item) ?299 'selected="selected"' : '';300 $template->assign_block_vars(301 'select_user.direction',302 array(303 'VALUE' => $item,304 'CONTENT' => $label,305 'SELECTED' => $selected306 ));307 }308 309 $profile_url = PHPWG_ROOT_PATH.'admin.php?page=profile&user_id=';310 $perm_url = PHPWG_ROOT_PATH.'admin.php?page=user_perm&user_id=';311 312 $users = array();313 $user_ids = array();314 $groups_content = array();315 316 $order_by = 'id';317 if (isset($_GET['order_by'])318 and in_array($_GET['order_by'], array_keys($order_by_items)))319 {320 $order_by = $_GET['order_by'];321 }322 323 $direction = 'ASC';324 if (isset($_GET['direction'])325 and in_array($_GET['direction'], array_keys($direction_items)))326 {327 $direction = strtoupper($_GET['direction']);328 }329 330 $query = '331 SELECT id, username, mail_address, status332 FROM '.USERS_TABLE.'333 WHERE id != 2334 ORDER BY '.$order_by.' '.$direction.'335 LIMIT '.$start.', '.$conf['users_page'].'336 ;';337 $result = pwg_query($query);338 while ($row = mysql_fetch_array($result))339 {340 array_push($users, $row);341 array_push($user_ids, $row['id']);342 $user_groups[$row['id']] = array();343 }344 345 $query = '346 SELECT user_id, group_id, name347 FROM '.USER_GROUP_TABLE.' INNER JOIN '.GROUPS_TABLE.' ON group_id = id348 WHERE user_id IN ('.implode(',', $user_ids).')349 ;';350 $result = pwg_query($query);351 while ($row = mysql_fetch_array($result))352 {353 $groups_content[$row['group_id']] = $row['name'];354 array_push($user_groups[$row['user_id']], $row['group_id']);355 }356 357 foreach ($users as $item)358 {359 $groups = preg_replace('/(\d+)/e',360 "\$groups_content['$1']",361 implode(', ', $user_groups[$item['id']]));362 363 $template->assign_block_vars(364 'select_user.user',365 array(366 'U_MOD'=>add_session_id($profile_url.$item['id']),367 'U_PERM'=>add_session_id($perm_url.$item['id']),368 'USERNAME'=>$item['username'],369 'STATUS'=>$lang['user_status_'.$item['status']],370 'EMAIL'=>isset($item['mail_address']) ? $item['mail_address'] : '',371 'GROUPS'=>$groups372 ));373 }374 }375 else376 {377 $expand =378 ($userdata['expand']=='true')?379 'EXPAND_TREE_YES':'EXPAND_TREE_NO';380 381 $nb_comments =382 ($userdata['show_nb_comments']=='true')?383 'NB_COMMENTS_YES':'NB_COMMENTS_NO';384 385 $template->assign_block_vars('modify',array());386 $template->assign_vars(387 array(388 'USERNAME'=>$userdata['username'],389 'USERID'=>$userdata['id'],390 'EMAIL'=>@$userdata['mail_address'],391 'LANG_SELECT'=>language_select($userdata['language'], 'language'),392 'NB_IMAGE_LINE'=>$userdata['nb_image_line'],393 'NB_ROW_PAGE'=>$userdata['nb_line_page'],394 'STYLE_SELECT'=>style_select($userdata['template'], 'template'),395 'RECENT_PERIOD'=>$userdata['recent_period'],396 'MAXWIDTH'=>@$userdata['maxwidth'],397 'MAXHEIGHT'=>@$userdata['maxheight'],398 399 $expand=>'checked="checked"',400 $nb_comments=>'checked="checked"',401 402 'L_TITLE' => $lang['customize_title'],403 'L_REGISTRATION_INFO' => $lang['register_title'],404 'L_PREFERENCES' => $lang['preferences'],405 'L_USERNAME' => $lang['login'],406 'L_EMAIL' => $lang['mail_address'],407 'L_CURRENT_PASSWORD' => $lang['password'],408 'L_CURRENT_PASSWORD_HINT' => $lang['password_hint'],409 'L_NEW_PASSWORD' => $lang['new_password'],410 'L_NEW_PASSWORD_HINT' => $lang['new_password_hint'],411 'L_CONFIRM_PASSWORD' => $lang['reg_confirm'],412 'L_CONFIRM_PASSWORD_HINT' => $lang['confirm_password_hint'],413 'L_LANG_SELECT'=>$lang['language'],414 'L_NB_IMAGE_LINE'=>$lang['nb_image_per_row'],415 'L_NB_ROW_PAGE'=>$lang['nb_row_per_page'],416 'L_STYLE_SELECT'=>$lang['theme'],417 'L_RECENT_PERIOD'=>$lang['recent_period'],418 'L_EXPAND_TREE'=>$lang['auto_expand'],419 'L_NB_COMMENTS'=>$lang['show_nb_comments'],420 'L_MAXWIDTH'=>$lang['maxwidth'],421 'L_MAXHEIGHT'=>$lang['maxheight'],422 'L_YES'=>$lang['yes'],423 'L_NO'=>$lang['no'],424 'L_SUBMIT'=>$lang['submit'],425 'L_RESET'=>$lang['reset'],426 'L_RETURN' => $lang['home'],427 'L_RETURN_HINT' => $lang['home_hint'],428 429 'F_ACTION'=>add_session_id($url_action),430 ));431 432 if (!defined('IN_ADMIN') or !IN_ADMIN)433 {434 $url_return = PHPWG_ROOT_PATH.'category.php?'.$_SERVER['QUERY_STRING'];435 $template->assign_vars(array('U_RETURN' => add_session_id($url_return)));436 }437 //------------------------------------------------------------- user management438 if (defined('IN_ADMIN') and IN_ADMIN)439 {440 $status_select = '<select name="status">';441 $status_select .='<option value = "guest" ';442 if ($userdata['status'] == 'guest')443 {444 $status_select .= 'selected="selected"';445 }446 $status_select .='>'.$lang['user_status_guest'] .'</option>';447 $status_select .='<option value = "admin" ';448 if ($userdata['status'] == 'admin')449 {450 $status_select .= 'selected="selected"';451 }452 $status_select .='>'.$lang['user_status_admin'] .'</option>';453 $status_select .='</select>';454 $template->assign_block_vars(455 'modify.admin',456 array(457 'L_ADMIN_USER'=>$lang['user_management'],458 'L_STATUS'=>$lang['user_status'],459 'L_DELETE'=>$lang['user_delete'],460 'L_DELETE_HINT'=>$lang['user_delete_hint'],461 'STATUS'=>$status_select462 ));463 }464 306 } 465 307 // +-----------------------------------------------------------------------+ … … 483 325 else 484 326 { 485 $template->assign_block_vars(' modify.profile',array());327 $template->assign_block_vars('profile',array()); 486 328 $template->parse('profile_body'); 487 329 include(PHPWG_ROOT_PATH.'include/page_tail.php'); -
trunk/template/default/profile.tpl
r743 r768 9 9 <!-- END errors --> 10 10 11 <!-- BEGIN add_user -->12 <div class="admin">{L_GROUP_ADD_USER}</div>13 <form method="post" name="post" action="{add_user.F_ACTION}">14 {L_USERNAME} <input type="text" name="login" maxlength="50" size="20" />15 {L_PASSWORD} <input type="text" name="password" />16 <input type="submit" name="submit_add" value="{L_SUBMIT}" class="bouton" />17 </form>18 <!-- END add_user -->19 20 <!-- BEGIN select_user -->21 <div class="admin">{L_SELECT_USERNAME}</div>22 <form method="post" name="post" action="{F_SEARCH_USER_ACTION}">23 <input type="text" name="username" maxlength="50" size="20" />24 <input type="submit" name="submituser" value="{L_LOOKUP_USER}" class="bouton" />25 <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="bouton" onClick="window.open('{U_SEARCH_USER}', '_phpwgsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" />26 </form>27 28 <div class="admin">{L_USERS_LIST}</div>29 <form method="get" action="{F_ORDER_ACTION}">30 <input type="hidden" name="page" value="profile" />31 <div style="text-align:center">32 {L_ORDER_BY}33 <select name="order_by">34 <!-- BEGIN order_by -->35 <option value="{select_user.order_by.VALUE}" {select_user.order_by.SELECTED} >{select_user.order_by.CONTENT}</option>36 <!-- END order_by -->37 </select>38 <select name="direction">39 <!-- BEGIN direction -->40 <option value="{select_user.direction.VALUE}" {select_user.direction.SELECTED} >{select_user.direction.CONTENT}</option>41 <!-- END direction -->42 </select>43 <input type="submit" value="{L_SUBMIT}" class="bouton" />44 </div>45 </form>46 47 <table style="width:100%;" >48 <tr class="throw">49 <th style="width:20%;">{L_USERNAME}</th>50 <th style="width:20%;">{L_STATUS}</th>51 <th style="width:30%;">{L_EMAIL}</th>52 <th style="width:30%;">{L_GROUPS}</th>53 <th style="width:1%;">{L_ACTIONS}</th>54 </tr>55 <!-- BEGIN user -->56 <tr>57 <td><a href="{select_user.user.U_MOD}">{select_user.user.USERNAME}</a></td>58 <td>{select_user.user.STATUS}</td>59 <td>{select_user.user.EMAIL}</td>60 <td>{select_user.user.GROUPS}</td>61 <!-- [<a href="{select_user.user.U_MOD}">{L_MODIFY}</a>] -->62 <td>[<a href="{select_user.user.U_PERM}">{L_PERMISSIONS}</a>]</td>63 </tr>64 <!-- END user -->65 </table>66 <div class="navigationBar">{NAVBAR}</div>67 <!-- END select_user -->68 <!-- BEGIN modify -->69 11 <!-- BEGIN profile --> 70 12 <div class="titrePage">{L_TITLE}</div> … … 170 112 </div> 171 113 <!-- END profile --> 172 <!-- END modify -->
Note: See TracChangeset
for help on using the changeset viewer.