Index: trunk/extensions/CheckUser/api/ApiQueryCheckUser.php |
— | — | @@ -65,16 +65,15 @@ |
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | | - $count = 0; |
| 69 | + $resultIPs = array(); |
70 | 70 | foreach ( array_keys( $ips ) as $ip ) { |
71 | | - $ips[$count] = $ips[$ip]; |
72 | | - $ips[$count]['address'] = $ip; |
73 | | - unset( $ips[$ip] ); |
74 | | - $count++; |
| 71 | + $newIp = $ips[$ip]; |
| 72 | + $newIp['address'] = $ip; |
| 73 | + $resultIPs[] = $newIp; |
75 | 74 | } |
76 | 75 | |
77 | 76 | CheckUser::addLogEntry( 'userips', 'user', $target, $reason, $user_id ); |
78 | | - $result->addValue( array( 'query', $this->getModuleName() ), 'userips', $ips ); |
| 77 | + $result->addValue( array( 'query', $this->getModuleName() ), 'userips', $resultIPs ); |
79 | 78 | $result->setIndexedTagName_internal( array( 'query', $this->getModuleName(), 'userips' ), 'ip' ); |
80 | 79 | break; |
81 | 80 | |
— | — | @@ -109,26 +108,27 @@ |
110 | 109 | $result = $this->getResult(); |
111 | 110 | |
112 | 111 | $edits = array(); |
113 | | - $count = 0; |
114 | 112 | foreach ( $res as $row ) { |
115 | | - $edits[$count]['timestamp'] = $row->cuc_timestamp; |
116 | | - $edits[$count]['ns'] = $row->cuc_namespace; |
117 | | - $edits[$count]['title'] = $row->cuc_title; |
118 | | - $edits[$count]['user'] = $row->cuc_user_text; |
| 113 | + $edit = array( |
| 114 | + 'timetamp' => $row->cuc_timestamp, |
| 115 | + 'ns' => $row->cuc_namespace, |
| 116 | + 'title' => $row->cuc_title, |
| 117 | + 'user' => $row->cuc_user_text, |
| 118 | + 'ip' => $row->cuc_ip, |
| 119 | + 'agent' => $row->cuc_agent, |
| 120 | + ); |
119 | 121 | if ( $row->cuc_actiontext ) { |
120 | | - $edits[$count]['summary'] = $row->cuc_actiontext; |
| 122 | + $edit['summary'] = $row->cuc_actiontext; |
121 | 123 | } elseif ( $row->cuc_comment ) { |
122 | | - $edits[$count]['summary'] = $row->cuc_comment; |
| 124 | + $edit['summary'] = $row->cuc_comment; |
123 | 125 | } |
124 | 126 | if ( $row->cuc_minor ) { |
125 | | - $edits[$count]['minor'] = 'm'; |
| 127 | + $edit['minor'] = 'm'; |
126 | 128 | } |
127 | | - $edits[$count]['ip'] = $row->cuc_ip; |
128 | 129 | if ( $row->cuc_xff ) { |
129 | | - $edits[$count]['xff'] = $row->cuc_xff; |
| 130 | + $edit['xff'] = $row->cuc_xff; |
130 | 131 | } |
131 | | - $edits[$count]['agent'] = $row->cuc_agent; |
132 | | - $count++; |
| 132 | + $edits[] = $edit; |
133 | 133 | } |
134 | 134 | |
135 | 135 | CheckUser::addLogEntry( $log_type[0], $log_type[1], $target, $reason, $user_id ? $user_id : '0' ); |
— | — | @@ -176,20 +176,17 @@ |
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | | - $count = 0; |
181 | | - foreach ( array_keys( $users ) as $user ) { |
182 | | - $users[$count] = $users[$user]; |
183 | | - $users[$count]['name'] = $user; |
184 | | - unset( $users[$user] ); |
| 180 | + $resultUsers = array(); |
| 181 | + foreach ( $users as $userName => $userData ) { |
| 182 | + $userData['name'] = $userName; |
| 183 | + $result->setIndexedTagName( $userData['ips'], 'ip' ); |
| 184 | + $result->setIndexedTagName( $userData['agents'], 'agent' ); |
185 | 185 | |
186 | | - $result->setIndexedTagName( $users[$count]['ips'], 'ip' ); |
187 | | - $result->setIndexedTagName( $users[$count]['agents'], 'agent' ); |
188 | | - |
189 | | - $count++; |
| 186 | + $resultUsers[] = $userData; |
190 | 187 | } |
191 | 188 | |
192 | 189 | CheckUser::addLogEntry( $log_type, 'ip', $target, $reason ); |
193 | | - $result->addValue( array( 'query', $this->getModuleName() ), 'ipusers', $users ); |
| 190 | + $result->addValue( array( 'query', $this->getModuleName() ), 'ipusers', $resultUsers ); |
194 | 191 | $result->setIndexedTagName_internal( array( 'query', $this->getModuleName(), 'ipusers' ), 'user' ); |
195 | 192 | break; |
196 | 193 | |
Index: trunk/extensions/CheckUser/api/ApiQueryCheckUserLog.php |
— | — | @@ -39,15 +39,15 @@ |
40 | 40 | $res = $this->select( __METHOD__ ); |
41 | 41 | $result = $this->getResult(); |
42 | 42 | |
43 | | - $count = 0; |
44 | 43 | $log = array(); |
45 | 44 | foreach ( $res as $row ) { |
46 | | - $log[$count]['timestamp'] = $row->cul_timestamp; |
47 | | - $log[$count]['checkuser'] = $row->cul_user_text; |
48 | | - $log[$count]['type'] = $row->cul_type; |
49 | | - $log[$count]['reason'] = $row->cul_reason; |
50 | | - $log[$count]['target'] = $row->cul_target_text; |
51 | | - $count++; |
| 45 | + $log[] = array( |
| 46 | + 'timestamp' => $row->cul_timestamp, |
| 47 | + 'checkuser' => $row->cul_user_text, |
| 48 | + 'type' => $row->cul_type, |
| 49 | + 'reason' => $row->cul_reason, |
| 50 | + 'target' => $row->curl_target_text, |
| 51 | + ); |
52 | 52 | } |
53 | 53 | |
54 | 54 | $result->addValue( array( 'query', $this->getModuleName() ), 'entries', $log ); |