Index: trunk/phase3/includes/api/ApiQueryAllLinks.php |
— | — | @@ -80,9 +80,9 @@ |
81 | 81 | } |
82 | 82 | |
83 | 83 | if (!is_null($params['from'])) |
84 | | - $this->addWhere('pl_title>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from']))); |
| 84 | + $this->addWhere('pl_title>=' . $db->addQuotes($this->titleToKey($params['from']))); |
85 | 85 | if (isset ($params['prefix'])) |
86 | | - $this->addWhere("pl_title LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'"); |
| 86 | + $this->addWhere("pl_title LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'"); |
87 | 87 | |
88 | 88 | if (is_null($resultPageSet)) { |
89 | 89 | $this->addFields(array ( |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | if (++ $count > $limit) { |
110 | 110 | // We've reached the one extra which shows that there are additional pages to be had. Stop here... |
111 | 111 | // TODO: Security issue - if the user has no right to view next title, it will still be shown |
112 | | - $this->setContinueEnumParameter('continue', ApiQueryBase :: keyToTitle($row->pl_title) . "|" . $row->pl_from); |
| 112 | + $this->setContinueEnumParameter('continue', $this->keyToTitle($row->pl_title) . "|" . $row->pl_from); |
113 | 113 | break; |
114 | 114 | } |
115 | 115 | |
Index: trunk/phase3/includes/api/ApiQueryAllCategories.php |
— | — | @@ -57,9 +57,9 @@ |
58 | 58 | $this->addFields('cat_title'); |
59 | 59 | |
60 | 60 | if (!is_null($params['from'])) |
61 | | - $this->addWhere('cat_title>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from']))); |
| 61 | + $this->addWhere('cat_title>=' . $db->addQuotes($this->titleToKey($params['from']))); |
62 | 62 | if (isset ($params['prefix'])) |
63 | | - $this->addWhere("cat_title LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'"); |
| 63 | + $this->addWhere("cat_title LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'"); |
64 | 64 | |
65 | 65 | $this->addOption('LIMIT', $params['limit']+1); |
66 | 66 | $this->addOption('ORDER BY', 'cat_title' . ($params['dir'] == 'descending' ? ' DESC' : '')); |
— | — | @@ -78,7 +78,7 @@ |
79 | 79 | if (++ $count > $params['limit']) { |
80 | 80 | // We've reached the one extra which shows that there are additional cats to be had. Stop here... |
81 | 81 | // TODO: Security issue - if the user has no right to view next title, it will still be shown |
82 | | - $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->cat_title)); |
| 82 | + $this->setContinueEnumParameter('from', $this->keyToTitle($row->cat_title)); |
83 | 83 | break; |
84 | 84 | } |
85 | 85 | |
Index: trunk/phase3/includes/api/ApiQueryAllpages.php |
— | — | @@ -62,10 +62,10 @@ |
63 | 63 | $this->addWhereIf('page_is_redirect = 0', $params['filterredir'] === 'nonredirects'); |
64 | 64 | $this->addWhereFld('page_namespace', $params['namespace']); |
65 | 65 | $dir = ($params['dir'] == 'descending' ? 'older' : 'newer'); |
66 | | - $from = (is_null($params['from']) ? null : ApiQueryBase::titleToKey($params['from'])); |
| 66 | + $from = (is_null($params['from']) ? null : $this->titleToKey($params['from'])); |
67 | 67 | $this->addWhereRange('page_title', $dir, $from, null); |
68 | 68 | if (isset ($params['prefix'])) |
69 | | - $this->addWhere("page_title LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'"); |
| 69 | + $this->addWhere("page_title LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'"); |
70 | 70 | |
71 | 71 | $forceNameTitleIndex = true; |
72 | 72 | if (isset ($params['minsize'])) { |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | if (++ $count > $limit) { |
132 | 132 | // We've reached the one extra which shows that there are additional pages to be had. Stop here... |
133 | 133 | // TODO: Security issue - if the user has no right to view next title, it will still be shown |
134 | | - $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->page_title)); |
| 134 | + $this->setContinueEnumParameter('from', $this->keyToTitle($row->page_title)); |
135 | 135 | break; |
136 | 136 | } |
137 | 137 | |
Index: trunk/phase3/includes/api/ApiQueryBase.php |
— | — | @@ -323,7 +323,7 @@ |
324 | 324 | * @param string $title Page title with spaces |
325 | 325 | * @return string Page title with underscores |
326 | 326 | */ |
327 | | - public static function titleToKey($title) { |
| 327 | + public function titleToKey($title) { |
328 | 328 | $t = Title::newFromText($title); |
329 | 329 | if(!$t) |
330 | 330 | $this->dieUsageMsg('invalidtitle', $title); |
— | — | @@ -335,7 +335,7 @@ |
336 | 336 | * @param string $key Page title with underscores |
337 | 337 | * @return string Page title with spaces |
338 | 338 | */ |
339 | | - public static function keyToTitle($key) { |
| 339 | + public function keyToTitle($key) { |
340 | 340 | $t = Title::newFromDbKey($key); |
341 | 341 | # This really shouldn't happen but we gotta check anyway |
342 | 342 | if(!$t) |
Index: trunk/phase3/includes/api/ApiQueryAllUsers.php |
— | — | @@ -58,10 +58,10 @@ |
59 | 59 | $this->addTables('user', 'u1'); |
60 | 60 | |
61 | 61 | if( !is_null( $params['from'] ) ) |
62 | | - $this->addWhere( 'u1.user_name >= ' . $db->addQuotes( self::keyToTitle( $params['from'] ) ) ); |
| 62 | + $this->addWhere( 'u1.user_name >= ' . $db->addQuotes( $this->keyToTitle( $params['from'] ) ) ); |
63 | 63 | |
64 | 64 | if( isset( $params['prefix'] ) ) |
65 | | - $this->addWhere( 'u1.user_name LIKE "' . $db->escapeLike( self::keyToTitle( $params['prefix'] ) ) . '%"' ); |
| 65 | + $this->addWhere( 'u1.user_name LIKE "' . $db->escapeLike( $this->keyToTitle( $params['prefix'] ) ) . '%"' ); |
66 | 66 | |
67 | 67 | if (!is_null($params['group'])) { |
68 | 68 | // Filter only users that belong to a given group |
— | — | @@ -132,7 +132,7 @@ |
133 | 133 | |
134 | 134 | if ($count > $limit) { |
135 | 135 | // We've reached the one extra which shows that there are additional pages to be had. Stop here... |
136 | | - $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->user_name)); |
| 136 | + $this->setContinueEnumParameter('from', $this->keyToTitle($row->user_name)); |
137 | 137 | break; |
138 | 138 | } |
139 | 139 | |
Index: trunk/phase3/includes/api/ApiQueryAllimages.php |
— | — | @@ -62,9 +62,9 @@ |
63 | 63 | |
64 | 64 | // Image filters |
65 | 65 | if (!is_null($params['from'])) |
66 | | - $this->addWhere('img_name>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from']))); |
| 66 | + $this->addWhere('img_name>=' . $db->addQuotes($this->titleToKey($params['from']))); |
67 | 67 | if (isset ($params['prefix'])) |
68 | | - $this->addWhere("img_name LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'"); |
| 68 | + $this->addWhere("img_name LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'"); |
69 | 69 | |
70 | 70 | if (isset ($params['minsize'])) { |
71 | 71 | $this->addWhere('img_size>=' . intval($params['minsize'])); |
— | — | @@ -103,7 +103,7 @@ |
104 | 104 | if (++ $count > $limit) { |
105 | 105 | // We've reached the one extra which shows that there are additional pages to be had. Stop here... |
106 | 106 | // TODO: Security issue - if the user has no right to view next title, it will still be shown |
107 | | - $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->img_name)); |
| 107 | + $this->setContinueEnumParameter('from', $this->keyToTitle($row->img_name)); |
108 | 108 | break; |
109 | 109 | } |
110 | 110 | |