Index: trunk/extensions/CheckUser/api/ApiQueryCheckUser.php |
— | — | @@ -77,20 +77,19 @@ |
78 | 78 | break; |
79 | 79 | |
80 | 80 | case 'edits': |
81 | | - if ( IP::isIPAddress( $target ) && isset( $xff ) ) { |
82 | | - $cond = CheckUser::getIpConds( $db, $target, true ); |
| 81 | + if ( IP::isIPAddress( $target ) ) { |
| 82 | + $cond = CheckUser::getIpConds( $db, $target, isset( $xff ) ); |
83 | 83 | if ( !$cond ) { |
84 | 84 | $this->dieUsage( 'IP or range is invalid', 'invalidip' ); |
85 | 85 | } |
86 | 86 | $this->addWhere( $cond ); |
87 | | - $log_type = array( 'ipedits-xff', 'ip' ); |
88 | | - } elseif ( IP::isIPAddress( $target ) ) { |
89 | | - $cond = CheckUser::getIpConds( $db, $target ); |
90 | | - if ( !$cond ) { |
91 | | - $this->dieUsage( 'IP or range is invalid', 'invalidip' ); |
| 87 | + $log_type = array(); |
| 88 | + if ( isset( $xff ) ) { |
| 89 | + $log_type[] = 'ipeditsxff'; |
| 90 | + } else { |
| 91 | + $log_type[] = 'ipedits'; |
92 | 92 | } |
93 | | - $this->addWhere( $cond ); |
94 | | - $log_type = array( 'ipedits', 'ip' ); |
| 93 | + $log_type[] = 'ip' ; |
95 | 94 | } else { |
96 | 95 | $user_id = User::idFromName( $target ); |
97 | 96 | if ( !$user_id ) { |
— | — | @@ -137,14 +136,13 @@ |
138 | 137 | break; |
139 | 138 | |
140 | 139 | case 'ipusers': |
141 | | - if ( IP::isIPAddress( $target ) && isset( $xff ) ) { |
142 | | - $cond = CheckUser::getIpConds( $db, $target, true ); |
| 140 | + if ( IP::isIPAddress( $target ) ) { |
| 141 | + $cond = CheckUser::getIpConds( $db, $target, isset( $xff ) ); |
143 | 142 | $this->addWhere( $cond ); |
144 | | - $log_type = 'ipusersxff'; |
145 | | - } elseif ( IP::isIPAddress( $target ) ) { |
146 | | - $cond = CheckUser::getIpConds( $db, $target ); |
147 | | - $this->addWhere( $cond ); |
148 | 143 | $log_type = 'ipusers'; |
| 144 | + if ( isset( $xff ) ) { |
| 145 | + $log_type .= 'xff'; |
| 146 | + } |
149 | 147 | } else { |
150 | 148 | $this->dieUsage( 'IP or range is invalid', 'invalidip' ); |
151 | 149 | } |