$this->addFields('cat_title');
if (!is_null($params['from']))
- $this->addWhere('cat_title>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from'])));
+ $this->addWhere('cat_title>=' . $db->addQuotes($this->titleToKey($params['from'])));
if (isset ($params['prefix']))
- $this->addWhere("cat_title LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'");
+ $this->addWhere("cat_title LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'");
$this->addOption('LIMIT', $params['limit']+1);
$this->addOption('ORDER BY', 'cat_title' . ($params['dir'] == 'descending' ? ' DESC' : ''));
if (++ $count > $params['limit']) {
// We've reached the one extra which shows that there are additional cats to be had. Stop here...
// TODO: Security issue - if the user has no right to view next title, it will still be shown
- $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->cat_title));
+ $this->setContinueEnumParameter('from', $this->keyToTitle($row->cat_title));
break;
}
}
if (!is_null($params['from']))
- $this->addWhere('pl_title>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from'])));
+ $this->addWhere('pl_title>=' . $db->addQuotes($this->titleToKey($params['from'])));
if (isset ($params['prefix']))
- $this->addWhere("pl_title LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'");
+ $this->addWhere("pl_title LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'");
if (is_null($resultPageSet)) {
$this->addFields(array (
if (++ $count > $limit) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
// TODO: Security issue - if the user has no right to view next title, it will still be shown
- $this->setContinueEnumParameter('continue', ApiQueryBase :: keyToTitle($row->pl_title) . "|" . $row->pl_from);
+ $this->setContinueEnumParameter('continue', $this->keyToTitle($row->pl_title) . "|" . $row->pl_from);
break;
}
$this->addTables('user', 'u1');
if( !is_null( $params['from'] ) )
- $this->addWhere( 'u1.user_name >= ' . $db->addQuotes( self::keyToTitle( $params['from'] ) ) );
+ $this->addWhere( 'u1.user_name >= ' . $db->addQuotes( $this->keyToTitle( $params['from'] ) ) );
if( isset( $params['prefix'] ) )
- $this->addWhere( 'u1.user_name LIKE "' . $db->escapeLike( self::keyToTitle( $params['prefix'] ) ) . '%"' );
+ $this->addWhere( 'u1.user_name LIKE "' . $db->escapeLike( $this->keyToTitle( $params['prefix'] ) ) . '%"' );
if (!is_null($params['group'])) {
// Filter only users that belong to a given group
if ($count > $limit) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
- $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->user_name));
+ $this->setContinueEnumParameter('from', $this->keyToTitle($row->user_name));
break;
}
// Image filters
if (!is_null($params['from']))
- $this->addWhere('img_name>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from'])));
+ $this->addWhere('img_name>=' . $db->addQuotes($this->titleToKey($params['from'])));
if (isset ($params['prefix']))
- $this->addWhere("img_name LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'");
+ $this->addWhere("img_name LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'");
if (isset ($params['minsize'])) {
$this->addWhere('img_size>=' . intval($params['minsize']));
if (++ $count > $limit) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
// TODO: Security issue - if the user has no right to view next title, it will still be shown
- $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->img_name));
+ $this->setContinueEnumParameter('from', $this->keyToTitle($row->img_name));
break;
}
$this->addWhereIf('page_is_redirect = 0', $params['filterredir'] === 'nonredirects');
$this->addWhereFld('page_namespace', $params['namespace']);
$dir = ($params['dir'] == 'descending' ? 'older' : 'newer');
- $from = (is_null($params['from']) ? null : ApiQueryBase::titleToKey($params['from']));
+ $from = (is_null($params['from']) ? null : $this->titleToKey($params['from']));
$this->addWhereRange('page_title', $dir, $from, null);
if (isset ($params['prefix']))
- $this->addWhere("page_title LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'");
+ $this->addWhere("page_title LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'");
$forceNameTitleIndex = true;
if (isset ($params['minsize'])) {
if (++ $count > $limit) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
// TODO: Security issue - if the user has no right to view next title, it will still be shown
- $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->page_title));
+ $this->setContinueEnumParameter('from', $this->keyToTitle($row->page_title));
break;
}
* @param string $title Page title with spaces
* @return string Page title with underscores
*/
- public static function titleToKey($title) {
+ public function titleToKey($title) {
$t = Title::newFromText($title);
if(!$t)
$this->dieUsageMsg('invalidtitle', $title);
* @param string $key Page title with underscores
* @return string Page title with spaces
*/
- public static function keyToTitle($key) {
+ public function keyToTitle($key) {
$t = Title::newFromDbKey($key);
# This really shouldn't happen but we gotta check anyway
if(!$t)