Changeset 25472
- Timestamp:
- Nov 13, 2013, 12:08:22 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions/pwg.users.php
r25461 r25472 34 34 * @option int page 35 35 * @option string order 36 * @option string display 36 37 */ 37 38 function ws_users_getList($params, &$service) … … 78 79 if ($params['display'] != 'none') 79 80 { 80 $params['display'] = explode(',', $params['display']);81 $params['display'] = array_map('trim', explode(',', $params['display'])); 81 82 82 83 if (in_array('all', $params['display'])) 83 84 { 84 $params['display'] = array _merge($params['display'], array(85 $params['display'] = array( 85 86 'username','email','status','level','groups','language','theme', 86 87 'nb_image_page','recent_period','expand','show_nb_comments','show_nb_hits', … … 88 89 'registration_date_since', 'last_visit', 'last_visit_string', 89 90 'last_visit_since' 90 ) );91 ); 91 92 } 92 93 else if (in_array('basics', $params['display'])) … … 96 97 )); 97 98 } 99 $params['display'] = array_flip($params['display']); 98 100 99 101 // if registration_date_string or registration_date_since is requested, 100 102 // then registration_date is automatically added 101 if (in_array('registration_date_string', $params['display']) and !in_array('registration_date', $params['display'])) 102 { 103 $params['display'][] = 'registration_date'; 104 } 105 106 if (in_array('registration_date_since', $params['display']) and !in_array('registration_date', $params['display'])) 107 { 108 $params['display'][] = 'registration_date'; 103 if (isset($params['display']['registration_date_string']) or isset($params['display']['registration_date_since'])) 104 { 105 $params['display']['registration_date'] = true; 109 106 } 110 107 111 108 // if last_visit_string or last_visit_since is requested, then 112 109 // last_visit is automatically added 113 if (in_array('last_visit_string', $params['display']) and !in_array('last_visit', $params['display'])) 114 { 115 $params['display'][] = 'last_visit'; 116 } 117 118 if (in_array('last_visit_since', $params['display']) and !in_array('last_visit', $params['display'])) 119 { 120 $params['display'][] = 'last_visit'; 121 } 122 123 if (in_array('username', $params['display'])) 110 if (isset($params['display']['last_visit_string']) or isset($params['display']['last_visit_since'])) 111 { 112 $params['display']['last_visit'] = true; 113 } 114 115 if (isset($params['display']['username'])) 124 116 { 125 117 $display['u.'.$conf['user_fields']['username']] = 'username'; 126 118 } 127 if (i n_array('email', $params['display']))119 if (isset($params['display']['email'])) 128 120 { 129 121 $display['u.'.$conf['user_fields']['email']] = 'email'; … … 136 128 foreach ($ui_fields as $field) 137 129 { 138 if (i n_array($field, $params['display']))130 if (isset($params['display'][$field])) 139 131 { 140 132 $display['ui.'.$field] = $field; … … 157 149 $query.= $field .' AS '. $name; 158 150 } 159 if (i n_array('groups', $params['display']))151 if (isset($params['display']['groups'])) 160 152 { 161 153 if (!$first) $query.= ', '; … … 180 172 if (count($users) > 0) 181 173 { 182 if (i n_array('groups', $params['display']))174 if (isset($params['display']['groups'])) 183 175 { 184 176 $query = ' … … 195 187 } 196 188 197 if (i n_array('registration_date_string', $params['display']))189 if (isset($params['display']['registration_date_string'])) 198 190 { 199 191 foreach ($users as $cur_user) … … 203 195 } 204 196 205 if (i n_array('registration_date_since', $params['display']))197 if (isset($params['display']['registration_date_since'])) 206 198 { 207 199 foreach ($users as $cur_user) … … 211 203 } 212 204 213 if (i n_array('last_visit', $params['display']))205 if (isset($params['display']['last_visit'])) 214 206 { 215 207 $query = ' … … 241 233 $users[ $row['user_id'] ]['last_visit'] = $last_visit; 242 234 243 if (i n_array('last_visit_string', $params['display']))235 if (isset($params['display']['last_visit_string'])) 244 236 { 245 237 $users[ $row['user_id'] ]['last_visit_string'] = format_date($last_visit, false, false); 246 238 } 247 239 248 if (i n_array('last_visit_since', $params['display']))240 if (isset($params['display']['last_visit_since'])) 249 241 { 250 242 $users[ $row['user_id'] ]['last_visit_since'] = time_since($last_visit, 'day'); -
trunk/ws.php
r25394 r25472 827 827 'info'=>'id, username, level, email'), 828 828 'display' => array('default'=>'basics', 829 'info'=>'all,basics,none,username,email,status,level,groups,language,theme,nb_image_page,recent_period,expand,show_nb_comments,show_nb_hits,enabled_high'), 830 ), 831 'Retrieves a list of all the users. 832 <br>"display" controls which data are returned, "basics" stands for "username,email,status,level,groups"', 829 'info'=>'Comma saparated list (see method description)'), 830 ), 831 'Retrieves a list of all the users.<br> 832 <br> 833 <b>display</b> controls which data are returned, possible values are:<br> 834 all, basics, none,<br> 835 username, email, status, level, groups,<br> 836 language, theme, nb_image_page, recent_period, expand, show_nb_comments, show_nb_hits,<br> 837 enabled_high, registration_date, registration_date_string, registration_date_since, last_visit, last_visit_string, last_visit_since<br> 838 <b>basics</b> stands for "username,email,status,level,groups"', 833 839 $ws_functions_root . 'pwg.users.php', 834 840 array('admin_only'=>true)
Note: See TracChangeset
for help on using the changeset viewer.