Index: trunk/phase3/includes/api/ApiQueryImageInfo.php |
— | — | @@ -194,8 +194,8 @@ |
195 | 195 | if( $mto && !$mto->isError() ) |
196 | 196 | { |
197 | 197 | $vals['thumburl'] = $mto->getUrl(); |
198 | | - $vals['thumbwidth'] = $mto->getWidth(); |
199 | | - $vals['thumbheight'] = $mto->getHeight(); |
| 198 | + $vals['thumbwidth'] = intval( $mto->getWidth() ); |
| 199 | + $vals['thumbheight'] = intval( $mto->getHeight() ); |
200 | 200 | } |
201 | 201 | } |
202 | 202 | $vals['url'] = $file->getFullURL(); |
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php |
— | — | @@ -244,8 +244,6 @@ |
245 | 245 | if ($this->fld_timestamp) |
246 | 246 | $vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row->rc_timestamp); |
247 | 247 | |
248 | | - $this->addFieldsIf('rc_new_len', $this->fld_sizes); |
249 | | - |
250 | 248 | if ($this->fld_sizes) { |
251 | 249 | $vals['oldlen'] = intval($row->rc_old_len); |
252 | 250 | $vals['newlen'] = intval($row->rc_new_len); |
Index: trunk/phase3/includes/api/ApiRollback.php |
— | — | @@ -72,11 +72,11 @@ |
73 | 73 | |
74 | 74 | $info = array( |
75 | 75 | 'title' => $titleObj->getPrefixedText(), |
76 | | - 'pageid' => $details['current']->getPage(), |
| 76 | + 'pageid' => intval($details['current']->getPage()), |
77 | 77 | 'summary' => $details['summary'], |
78 | | - 'revid' => $titleObj->getLatestRevID(), |
79 | | - 'old_revid' => $details['current']->getID(), |
80 | | - 'last_revid' => $details['target']->getID() |
| 78 | + 'revid' => intval($titleObj->getLatestRevID()), |
| 79 | + 'old_revid' => intval($details['current']->getID()), |
| 80 | + 'last_revid' => intval($details['target']->getID()) |
81 | 81 | ); |
82 | 82 | |
83 | 83 | $this->getResult()->addValue(null, $this->getModuleName(), $info); |
Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php |
— | — | @@ -192,7 +192,7 @@ |
193 | 193 | $rev = array(); |
194 | 194 | $rev['timestamp'] = wfTimestamp(TS_ISO_8601, $row->ar_timestamp); |
195 | 195 | if($fld_revid) |
196 | | - $rev['revid'] = $row->ar_rev_id; |
| 196 | + $rev['revid'] = intval($row->ar_rev_id); |
197 | 197 | if($fld_user) |
198 | 198 | $rev['user'] = $row->ar_user_text; |
199 | 199 | if($fld_comment) |
— | — | @@ -210,12 +210,9 @@ |
211 | 211 | $pageID = $newPageID++; |
212 | 212 | $pageMap[$row->ar_namespace][$row->ar_title] = $pageID; |
213 | 213 | $t = Title::makeTitle($row->ar_namespace, $row->ar_title); |
214 | | - $a = array( |
215 | | - 'title' => $t->getPrefixedText(), |
216 | | - 'ns' => intval($row->ar_namespace), |
217 | | - 'revisions' => array($rev) |
218 | | - ); |
| 214 | + $a['revisions'] = array($rev); |
219 | 215 | $result->setIndexedTagName($a['revisions'], 'rev'); |
| 216 | + ApiQueryBase::addTitleInfo($a, $t); |
220 | 217 | if($fld_token) |
221 | 218 | $a['token'] = $token; |
222 | 219 | $fit = $result->addValue(array('query', $this->getModuleName()), $pageID, $a); |
Index: trunk/phase3/includes/api/ApiPatrol.php |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | if($retval) |
62 | 62 | $this->dieUsageMsg(current($retval)); |
63 | 63 | |
64 | | - $result = array('rcid' => $rc->getAttribute('rc_id')); |
| 64 | + $result = array('rcid' => intval($rc->getAttribute('rc_id'))); |
65 | 65 | ApiQueryBase::addTitleInfo($result, $rc->getTitle()); |
66 | 66 | $this->getResult()->addValue(null, $this->getModuleName(), $result); |
67 | 67 | } |
Index: trunk/phase3/includes/api/ApiQueryRandom.php |
— | — | @@ -116,9 +116,8 @@ |
117 | 117 | private function extractRowInfo($row) { |
118 | 118 | $title = Title::makeTitle($row->page_namespace, $row->page_title); |
119 | 119 | $vals = array(); |
120 | | - $vals['title'] = $title->getPrefixedText(); |
121 | | - $vals['ns'] = $row->page_namespace; |
122 | | - $vals['id'] = $row->page_id; |
| 120 | + $vals['id'] = intval($row->page_id); |
| 121 | + ApiQueryBase::addTitleInfo($vals, $title); |
123 | 122 | return $vals; |
124 | 123 | } |
125 | 124 | |
Index: trunk/phase3/includes/api/ApiQueryRevisions.php |
— | — | @@ -292,7 +292,7 @@ |
293 | 293 | $vals = array (); |
294 | 294 | |
295 | 295 | if ($this->fld_ids) { |
296 | | - $vals['revid'] = $revision->getId(); |
| 296 | + $vals['revid'] = intval($revision->getId()); |
297 | 297 | // $vals['oldid'] = intval($row->rev_text_id); // todo: should this be exposed? |
298 | 298 | } |
299 | 299 | |
— | — | @@ -314,7 +314,7 @@ |
315 | 315 | } |
316 | 316 | |
317 | 317 | if ($this->fld_size && !is_null($revision->getSize())) { |
318 | | - $vals['size'] = $revision->getSize(); |
| 318 | + $vals['size'] = intval($revision->getSize()); |
319 | 319 | } |
320 | 320 | |
321 | 321 | if ($this->fld_comment) { |
Index: trunk/phase3/includes/api/ApiLogin.php |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | wfRunHooks('UserLoginComplete', array(&$wgUser, &$injected_html)); |
84 | 84 | |
85 | 85 | $result['result'] = 'Success'; |
86 | | - $result['lguserid'] = $wgUser->getId(); |
| 86 | + $result['lguserid'] = intval($wgUser->getId()); |
87 | 87 | $result['lgusername'] = $wgUser->getName(); |
88 | 88 | $result['lgtoken'] = $wgUser->getToken(); |
89 | 89 | $result['cookieprefix'] = $wgCookiePrefix; |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | case LoginForm :: THROTTLED : |
116 | 116 | global $wgPasswordAttemptThrottle; |
117 | 117 | $result['result'] = 'Throttled'; |
118 | | - $result['wait'] = $wgPasswordAttemptThrottle['seconds']; |
| 118 | + $result['wait'] = intval($wgPasswordAttemptThrottle['seconds']); |
119 | 119 | break; |
120 | 120 | default : |
121 | 121 | ApiBase :: dieDebug(__METHOD__, "Unhandled case value: {$authRes}"); |
Index: trunk/phase3/includes/api/ApiQueryCategoryMembers.php |
— | — | @@ -118,8 +118,7 @@ |
119 | 119 | $vals['pageid'] = intval($row->page_id); |
120 | 120 | if ($fld_title) { |
121 | 121 | $title = Title :: makeTitle($row->page_namespace, $row->page_title); |
122 | | - $vals['ns'] = intval($title->getNamespace()); |
123 | | - $vals['title'] = $title->getPrefixedText(); |
| 122 | + ApiQueryBase::addTitleInfo($vals, $title); |
124 | 123 | } |
125 | 124 | if ($fld_sortkey) |
126 | 125 | $vals['sortkey'] = $row->cl_sortkey; |
Index: trunk/phase3/includes/api/ApiQueryUserInfo.php |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | global $wgUser; |
59 | 59 | $result = $this->getResult(); |
60 | 60 | $vals = array(); |
61 | | - $vals['id'] = $wgUser->getId(); |
| 61 | + $vals['id'] = intval($wgUser->getId()); |
62 | 62 | $vals['name'] = $wgUser->getName(); |
63 | 63 | |
64 | 64 | if($wgUser->isAnon()) |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | $vals['preferencestoken'] = $wgUser->editToken(); |
89 | 89 | } |
90 | 90 | if (isset($this->prop['editcount'])) { |
91 | | - $vals['editcount'] = $wgUser->getEditCount(); |
| 91 | + $vals['editcount'] = intval($wgUser->getEditCount()); |
92 | 92 | } |
93 | 93 | if (isset($this->prop['ratelimits'])) { |
94 | 94 | $vals['ratelimits'] = $this->getRateLimits(); |
— | — | @@ -128,8 +128,8 @@ |
129 | 129 | foreach($categories as $cat) |
130 | 130 | if(isset($limits[$cat]) && !is_null($limits[$cat])) |
131 | 131 | { |
132 | | - $retval[$action][$cat]['hits'] = $limits[$cat][0]; |
133 | | - $retval[$action][$cat]['seconds'] = $limits[$cat][1]; |
| 132 | + $retval[$action][$cat]['hits'] = intval($limits[$cat][0]); |
| 133 | + $retval[$action][$cat]['seconds'] = intval($limits[$cat][1]); |
134 | 134 | } |
135 | 135 | return $retval; |
136 | 136 | } |
Index: trunk/phase3/includes/api/ApiEditPage.php |
— | — | @@ -249,7 +249,7 @@ |
250 | 250 | $r['new'] = ''; |
251 | 251 | case EditPage::AS_SUCCESS_UPDATE: |
252 | 252 | $r['result'] = "Success"; |
253 | | - $r['pageid'] = $titleObj->getArticleID(); |
| 253 | + $r['pageid'] = intval($titleObj->getArticleID()); |
254 | 254 | $r['title'] = $titleObj->getPrefixedText(); |
255 | 255 | # HACK: We create a new Article object here because getRevIdFetched() |
256 | 256 | # refuses to be run twice, and because Title::getLatestRevId() |
— | — | @@ -261,8 +261,8 @@ |
262 | 262 | $r['nochange'] = ''; |
263 | 263 | else |
264 | 264 | { |
265 | | - $r['oldrevid'] = $oldRevId; |
266 | | - $r['newrevid'] = $newRevId; |
| 265 | + $r['oldrevid'] = intval($oldRevId); |
| 266 | + $r['newrevid'] = intval($newRevId); |
267 | 267 | } |
268 | 268 | break; |
269 | 269 | default: |
Index: trunk/phase3/includes/api/ApiQueryUsers.php |
— | — | @@ -103,11 +103,9 @@ |
104 | 104 | $name = $user->getName(); |
105 | 105 | $data[$name]['name'] = $name; |
106 | 106 | if(isset($this->prop['editcount'])) |
107 | | - // No proper member function in the User class for this |
108 | | - $data[$name]['editcount'] = $r->user_editcount; |
| 107 | + $data[$name]['editcount'] = intval($user->getEditCount()); |
109 | 108 | if(isset($this->prop['registration'])) |
110 | | - // Nor for this one |
111 | | - $data[$name]['registration'] = wfTimestampOrNull(TS_ISO_8601, $r->user_registration); |
| 109 | + $data[$name]['registration'] = wfTimestampOrNull(TS_ISO_8601, $user->getRegistration()); |
112 | 110 | if(isset($this->prop['groups']) && !is_null($r->ug_group)) |
113 | 111 | // This row contains only one group, others will be added from other rows |
114 | 112 | $data[$name]['groups'][] = $r->ug_group; |
Index: trunk/phase3/includes/api/ApiBlock.php |
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | $this->dieUsageMsg($retval); |
96 | 96 | |
97 | 97 | $res['user'] = $params['user']; |
98 | | - $res['userID'] = $userID; |
| 98 | + $res['userID'] = intval($userID); |
99 | 99 | $res['expiry'] = ($expiry == Block::infinity() ? 'infinite' : wfTimestamp(TS_ISO_8601, $expiry)); |
100 | 100 | $res['reason'] = $params['reason']; |
101 | 101 | if($params['anononly']) |
Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php |
— | — | @@ -311,7 +311,7 @@ |
312 | 312 | $vals['patrolled'] = ''; |
313 | 313 | |
314 | 314 | if ($this->fld_loginfo && $row->rc_type == RC_LOG) { |
315 | | - $vals['logid'] = $row->rc_logid; |
| 315 | + $vals['logid'] = intval($row->rc_logid); |
316 | 316 | $vals['logtype'] = $row->rc_log_type; |
317 | 317 | $vals['logaction'] = $row->rc_log_action; |
318 | 318 | ApiQueryLogEvents::addLogParams($this->getResult(), |
Index: trunk/phase3/includes/api/ApiQueryAllCategories.php |
— | — | @@ -103,10 +103,10 @@ |
104 | 104 | $item = array(); |
105 | 105 | $result->setContent( $item, $titleObj->getText() ); |
106 | 106 | if( isset( $prop['size'] ) ) { |
107 | | - $item['size'] = $row->cat_pages; |
| 107 | + $item['size'] = intval($row->cat_pages); |
108 | 108 | $item['pages'] = $row->cat_pages - $row->cat_subcats - $row->cat_files; |
109 | | - $item['files'] = $row->cat_files; |
110 | | - $item['subcats'] = $row->cat_subcats; |
| 109 | + $item['files'] = intval($row->cat_files); |
| 110 | + $item['subcats'] = intval($row->cat_subcats); |
111 | 111 | } |
112 | 112 | if( isset( $prop['hidden'] ) && $row->cat_hidden ) |
113 | 113 | $item['hidden'] = ''; |
Index: trunk/phase3/includes/api/ApiQueryExtLinksUsage.php |
— | — | @@ -125,8 +125,7 @@ |
126 | 126 | $vals['pageid'] = intval($row->page_id); |
127 | 127 | if ($fld_title) { |
128 | 128 | $title = Title :: makeTitle($row->page_namespace, $row->page_title); |
129 | | - $vals['ns'] = intval($title->getNamespace()); |
130 | | - $vals['title'] = $title->getPrefixedText(); |
| 129 | + ApiQueryBase::addTitleInfo($vals, $title); |
131 | 130 | } |
132 | 131 | if ($fld_url) |
133 | 132 | $vals['url'] = $row->el_to; |
Index: trunk/phase3/includes/api/ApiQueryInfo.php |
— | — | @@ -492,10 +492,10 @@ |
493 | 493 | { |
494 | 494 | if(MWNamespace::isTalk($row->page_namespace)) |
495 | 495 | $this->talkids[MWNamespace::getSubject($row->page_namespace)][$row->page_title] = |
496 | | - $row->page_id; |
| 496 | + intval($row->page_id); |
497 | 497 | else |
498 | 498 | $this->subjectids[MWNamespace::getTalk($row->page_namespace)][$row->page_title] = |
499 | | - $row->page_id; |
| 499 | + intval($row->page_id); |
500 | 500 | } |
501 | 501 | } |
502 | 502 | |
Index: trunk/phase3/includes/api/ApiQueryBacklinks.php |
— | — | @@ -292,7 +292,7 @@ |
293 | 293 | private function extractRowInfo($row) { |
294 | 294 | $this->pageMap[$row->page_namespace][$row->page_title] = $row->page_id; |
295 | 295 | $t = Title::makeTitle($row->page_namespace, $row->page_title); |
296 | | - $a = array('pageid' => $row->page_id); |
| 296 | + $a = array('pageid' => intval($row->page_id)); |
297 | 297 | ApiQueryBase::addTitleInfo($a, $t); |
298 | 298 | if($row->page_is_redirect) |
299 | 299 | { |
— | — | @@ -305,7 +305,7 @@ |
306 | 306 | |
307 | 307 | private function extractRedirRowInfo($row) |
308 | 308 | { |
309 | | - $a['pageid'] = $row->page_id; |
| 309 | + $a['pageid'] = intval($row->page_id); |
310 | 310 | ApiQueryBase::addTitleInfo($a, Title::makeTitle($row->page_namespace, $row->page_title)); |
311 | 311 | if($row->page_is_redirect) |
312 | 312 | $a['redirect'] = ''; |
Index: trunk/phase3/includes/api/ApiQuerySearch.php |
— | — | @@ -102,9 +102,8 @@ |
103 | 103 | |
104 | 104 | $title = $result->getTitle(); |
105 | 105 | if (is_null($resultPageSet)) { |
106 | | - $vals = array( |
107 | | - 'ns' => intval($title->getNamespace()), |
108 | | - 'title' => $title->getPrefixedText()); |
| 106 | + $vals = array(); |
| 107 | + ApiQueryBase::addTitleInfo($vals, $title); |
109 | 108 | $fit = $this->getResult()->addValue(array('query', $this->getModuleName()), null, $vals); |
110 | 109 | if(!$fit) |
111 | 110 | { |
Index: trunk/phase3/includes/api/ApiUnblock.php |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | if($retval) |
74 | 74 | $this->dieUsageMsg($retval); |
75 | 75 | |
76 | | - $res['id'] = $id; |
| 76 | + $res['id'] = intval($id); |
77 | 77 | $res['user'] = $user; |
78 | 78 | $res['reason'] = $reason; |
79 | 79 | $this->getResult()->addValue(null, $this->getModuleName(), $res); |
Index: trunk/phase3/includes/api/ApiQueryAllLinks.php |
— | — | @@ -121,8 +121,7 @@ |
122 | 122 | $vals['fromid'] = intval($row->pl_from); |
123 | 123 | if ($fld_title) { |
124 | 124 | $title = Title :: makeTitle($params['namespace'], $row->pl_title); |
125 | | - $vals['ns'] = intval($title->getNamespace()); |
126 | | - $vals['title'] = $title->getPrefixedText(); |
| 125 | + ApiQueryBase::addTitleInfo($vals, $title); |
127 | 126 | } |
128 | 127 | $fit = $result->addValue(array('query', $this->getModuleName()), null, $vals); |
129 | 128 | if(!$fit) |
Index: trunk/phase3/includes/api/ApiUndelete.php |
— | — | @@ -78,9 +78,9 @@ |
79 | 79 | array($titleObj, array(), $wgUser, $params['reason']) ); |
80 | 80 | |
81 | 81 | $info['title'] = $titleObj->getPrefixedText(); |
82 | | - $info['revisions'] = $retval[0]; |
83 | | - $info['fileversions'] = $retval[1]; |
84 | | - $info['reason'] = $retval[2]; |
| 82 | + $info['revisions'] = intval($retval[0]); |
| 83 | + $info['fileversions'] = intval($retval[1]); |
| 84 | + $info['reason'] = intval($retval[2]); |
85 | 85 | $this->getResult()->addValue(null, $this->getModuleName(), $info); |
86 | 86 | } |
87 | 87 | |
Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php |
— | — | @@ -137,7 +137,7 @@ |
138 | 138 | $offset = 0; |
139 | 139 | } |
140 | 140 | $data['timezone'] = $tz; |
141 | | - $data['timeoffset'] = $offset; |
| 141 | + $data['timeoffset'] = intval($offset); |
142 | 142 | |
143 | 143 | return $this->getResult()->addValue( 'query', $property, $data ); |
144 | 144 | } |
— | — | @@ -148,7 +148,7 @@ |
149 | 149 | foreach( $wgContLang->getFormattedNamespaces() as $ns => $title ) |
150 | 150 | { |
151 | 151 | $data[$ns] = array( |
152 | | - 'id' => $ns |
| 152 | + 'id' => intval($ns) |
153 | 153 | ); |
154 | 154 | ApiResult :: setContent( $data[$ns], $title ); |
155 | 155 | $canonical = MWNamespace::getCanonicalName( $ns ); |
— | — | @@ -176,7 +176,7 @@ |
177 | 177 | continue; |
178 | 178 | } |
179 | 179 | $item = array( |
180 | | - 'id' => $ns |
| 180 | + 'id' => intval($ns) |
181 | 181 | ); |
182 | 182 | ApiResult :: setContent( $item, strtr( $title, '_', ' ' ) ); |
183 | 183 | $data[] = $item; |
— | — | @@ -272,7 +272,7 @@ |
273 | 273 | list( $host, $lag ) = wfGetLB()->getMaxLag(); |
274 | 274 | $data[] = array( |
275 | 275 | 'host' => $wgShowHostnames ? $host : '', |
276 | | - 'lag' => $lag |
| 276 | + 'lag' => intval( $lag ) |
277 | 277 | ); |
278 | 278 | } |
279 | 279 | |
Index: trunk/phase3/includes/api/ApiImport.php |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | // Add a result entry |
164 | 164 | $r = array(); |
165 | 165 | ApiQueryBase::addTitleInfo($r, $title); |
166 | | - $r['revisions'] = $successCount; |
| 166 | + $r['revisions'] = intval($successCount); |
167 | 167 | $this->mResultArr[] = $r; |
168 | 168 | |
169 | 169 | // Piggyback on the parent to do the logging |
Index: trunk/phase3/includes/api/ApiParse.php |
— | — | @@ -156,7 +156,7 @@ |
157 | 157 | $p_result->getDisplayTitle() : |
158 | 158 | $titleObj->getPrefixedText(); |
159 | 159 | if(!is_null($oldid)) |
160 | | - $result_array['revid'] = $oldid; |
| 160 | + $result_array['revid'] = intval($oldid); |
161 | 161 | |
162 | 162 | $result_mapping = array( |
163 | 163 | 'redirects' => 'r', |
Index: trunk/phase3/includes/api/ApiQueryCategoryInfo.php |
— | — | @@ -81,10 +81,10 @@ |
82 | 82 | while($row = $db->fetchObject($res)) |
83 | 83 | { |
84 | 84 | $vals = array(); |
85 | | - $vals['size'] = $row->cat_pages; |
| 85 | + $vals['size'] = intval($row->cat_pages); |
86 | 86 | $vals['pages'] = $row->cat_pages - $row->cat_subcats - $row->cat_files; |
87 | | - $vals['files'] = $row->cat_files; |
88 | | - $vals['subcats'] = $row->cat_subcats; |
| 87 | + $vals['files'] = intval($row->cat_files); |
| 88 | + $vals['subcats'] = intval($row->cat_subcats); |
89 | 89 | if($row->cat_hidden) |
90 | 90 | $vals['hidden'] = ''; |
91 | 91 | $fit = $this->addPageSubItems($catids[$row->cat_title], $vals); |