Ignore:
Timestamp:
Aug 8, 2005, 10:52:19 PM (19 years ago)
Author:
plg
Message:
  • new : external authentication in another users table. Previous users table is divided between users (common properties with any web application) and user_infos (phpwebgallery specific informations). External table and fields can be configured.
  • modification : profile.php is not reachable through administration anymore (not useful).
  • modification : in profile.php, current password is mandatory only if user tries to change his password. Username can't be changed.
  • deletion : of obsolete functions get_user_restrictions, update_user_restrictions, get_user_all_restrictions, is_user_allowed, update_user
  • modification : user_forbidden table becomes user_cache so that not only restriction informations can be stored in this table.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/user_list.php

    r805 r808  
    4646if (isset($_POST['submit_add']))
    4747{
    48   $page['errors'] = register_user($_POST['login'],
    49                                   $_POST['password'],
    50                                   $_POST['password'],
    51                                   '');
     48  $page['errors'] = register_user($_POST['login'], $_POST['password'], '');
    5249}
    5350
     
    6764SELECT id
    6865  FROM '.USERS_TABLE.'
    69   WHERE id != 2
     66  WHERE id != '.$conf['guest_id'].'
    7067;';
    7168      $collection = array_from_query($query, 'id');
     
    124121    // properties to set for the collection (a user list)
    125122    $datas = array();
    126     $dbfields = array('primary' => array('id'), 'update' => array());
     123    $dbfields = array('primary' => array('user_id'), 'update' => array());
    127124   
    128125    $formfields =
     
    147144      {
    148145        $data = array();
    149         $data['id'] = $user_id;
     146        $data['user_id'] = $user_id;
    150147       
    151148        // TODO : verify if submited values are semanticaly correct
     
    169166      }
    170167
    171       mass_updates(USERS_TABLE, $dbfields, $datas);
     168      mass_updates(USER_INFOS_TABLE, $dbfields, $datas);
    172169    }
    173170  }
     
    203200$base_url = add_session_id(PHPWG_ROOT_PATH.'admin.php?page=user_list');
    204201
    205 $conf['users_page'] = 10;
     202$conf['users_page'] = 20;
    206203
    207204if (isset($_GET['start']) and is_numeric($_GET['start']))
     
    318315    ));
    319316
    320 foreach (get_enums(USERS_TABLE, 'status') as $status)
     317foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
    321318{
    322319  $selected = (isset($_GET['status']) and $_GET['status'] == $status) ?
     
    433430$blockname = 'pref_status_option';
    434431
    435 foreach (get_enums(USERS_TABLE, 'status') as $status)
     432foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
    436433{
    437434  if (isset($_POST['pref_submit']))
     
    551548
    552549if (isset($_GET['status'])
    553     and in_array($_GET['status'], get_enums(USERS_TABLE, 'status')))
     550    and in_array($_GET['status'], get_enums(USER_INFOS_TABLE, 'status')))
    554551{
    555552  $filter['status'] = $_GET['status'];
     
    561558
    562559$query = '
    563 SELECT COUNT(DISTINCT(id))
    564   FROM '.USERS_TABLE.' LEFT JOIN '.USER_GROUP_TABLE.' ON id = user_id
    565   WHERE id != 2';
     560SELECT COUNT(DISTINCT u.'.$conf['user_fields']['id'].')
     561  FROM '.USERS_TABLE.' AS u
     562    INNER JOIN '.USER_INFOS_TABLE.' AS ui
     563      ON u.'.$conf['user_fields']['id'].' = ui.user_id
     564    LEFT JOIN '.USER_GROUP_TABLE.' AS ug
     565      ON u.'.$conf['user_fields']['id'].' = ug.user_id
     566  WHERE u.'.$conf['user_fields']['id'].' != '.$conf['guest_id'];
    566567if (isset($filter['username']))
    567568{
    568569  $query.= '
    569     AND username LIKE \''.$filter['username'].'\'';
     570  AND u.'.$conf['user_fields']['username'].' LIKE \''.$filter['username'].'\'';
    570571}
    571572if (isset($filter['group']))
    572573{
    573574  $query.= '
    574     AND group_id = '.$filter['group'];
     575    AND ug.group_id = '.$filter['group'];
    575576}
    576577if (isset($filter['status']))
    577578{
    578579  $query.= '
    579     AND status = \''.$filter['status']."'";
     580    AND ui.status = \''.$filter['status']."'";
    580581}
    581582$query.= '
     
    618619
    619620$query = '
    620 SELECT DISTINCT(id), username, mail_address, status
    621   FROM '.USERS_TABLE.' LEFT JOIN '.USER_GROUP_TABLE.' ON id = user_id
    622   WHERE id != 2';
     621SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
     622                u.'.$conf['user_fields']['username'].' AS username,
     623                u.'.$conf['user_fields']['email'].' AS email,
     624                ui.status
     625  FROM '.USERS_TABLE.' AS u
     626    INNER JOIN '.USER_INFOS_TABLE.' AS ui
     627      ON u.'.$conf['user_fields']['id'].' = ui.user_id
     628    LEFT JOIN '.USER_GROUP_TABLE.' AS ug
     629      ON u.'.$conf['user_fields']['id'].' = ug.user_id
     630  WHERE id != '.$conf['guest_id'];
    623631if (isset($filter['username']))
    624632{
     
    629637{
    630638  $query.= '
    631     AND group_id = '.$filter['group'];
     639    AND ug.group_id = '.$filter['group'];
    632640}
    633641if (isset($filter['status']))
    634642{
    635643  $query.= '
    636     AND status = \''.$filter['status']."'";
     644    AND ui.status = \''.$filter['status']."'";
    637645}
    638646$query.= '
     
    688696        'USERNAME'=>$item['username'],
    689697        'STATUS'=>$lang['user_status_'.$item['status']],
    690         'EMAIL'=>isset($item['mail_address']) ? $item['mail_address'] : '',
     698        'EMAIL'=>isset($item['email']) ? $item['email'] : '',
    691699        'GROUPS'=>$groups_string
    692700        ));
Note: See TracChangeset for help on using the changeset viewer.