/**
* The content returned by this function will be output before any result
- */
+ */
function getPageHeader( ) {
return '';
}
+ /**
+ * If using extra form wheely-dealies, return a set of parameters here
+ * as an associative array. They will be encoded and added to the paging
+ * links (prev/next/lengths).
+ * @return array
+ */
+ function linkParameters() {
+ return array();
+ }
+
/**
* Some special pages (for example SpecialListusers) might not return the
* current object formatted, but return the previous one instead.
# often disable 'next' link when we reach the end
if($num < $limit) { $atend = true; } else { $atend = false; }
- $sl = wfViewPrevNext( $offset, $limit , $wgContLang->specialPage( $sname ), "" ,$atend );
+ $sl = wfViewPrevNext( $offset, $limit ,
+ $wgContLang->specialPage( $sname ),
+ wfArrayToCGI( $this->linkParameters() ), $atend );
$wgOut->addHTML( "<br />{$sl}</p>\n" );
}
if ( $num > 0 ) {
$sql = "SELECT 'Listusers' as type, $userspace AS namespace, user_name AS title, " .
"user_name as value, user_id, COUNT(ug_group) as numgroups " .
"FROM $user ".
- "LEFT JOIN $user_groups ON user_id=ug_user ";
-
- if($this->requestedGroup != '') {
- $sql .= 'WHERE ug_group = ' . $dbr->addQuotes( $this->requestedGroup ) . ' ';
- if($this->requestedUser != '') {
- $sql .= "AND user_name = " . $dbr->addQuotes( $this->requestedUser ) . ' ';
- }
- } else {
- if($this->requestedUser !='') {
- $sql .= "WHERE user_name = " . $dbr->addQuotes( $this->requestedUser ) . ' ';
- }
- }
- $sql .= "GROUP BY user_name";
+ "LEFT JOIN $user_groups ON user_id=ug_user " .
+ $this->userQueryWhere( $dbr ) .
+ " GROUP BY user_name";
return $sql;
}
+ function userQueryWhere( &$dbr ) {
+ $conds = $this->userQueryConditions();
+ return empty( $conds )
+ ? ""
+ : "WHERE " . $dbr->makeList( $conds, LIST_AND );
+ }
+
+ function userQueryConditions() {
+ $conds = array();
+ if( $this->requestedGroup != '' ) {
+ $conds['ug_group'] = $this->requestedGroup;
+ }
+ if( $this->requestedUser != '' ) {
+ $conds['user_name'] = $this->requestedUser;
+ }
+ return $conds;
+ }
+
+ function linkParameters() {
+ $conds = array();
+ if( $this->requestedGroup != '' ) {
+ $conds['group'] = $this->requestedGroup;
+ }
+ if( $this->requestedUser != '' ) {
+ $conds['username'] = $this->requestedUser;
+ }
+ return $conds;
+ }
+
function sortDescending() {
return false;
}
}
return $name;
- }
+ }
}
/**