Index: trunk/extensions/Collection/Collection.hooks.php |
— | — | @@ -38,14 +38,14 @@ |
39 | 39 | wfLoadExtensionMessages( 'CollectionCore' ); |
40 | 40 | |
41 | 41 | $action = $wgRequest->getVal('action'); |
42 | | - if ( method_exists( $skinTemplate, 'getTitle' ) ) { |
| 42 | + if( method_exists( $skinTemplate, 'getTitle' ) ) { |
43 | 43 | $title = $skinTemplate->getTitle(); |
44 | 44 | } else { |
45 | 45 | $title = $skinTemplate->mTitle; |
46 | 46 | } |
47 | 47 | |
48 | | - if ( $skinTemplate->iscontent && ( $action == '' || $action == 'view' || $action == 'purge' ) ) { |
49 | | - if ( self::_isCollectionPage( $title, $wgArticle ) ) { |
| 48 | + if( $skinTemplate->iscontent && ( $action == '' || $action == 'view' || $action == 'purge' ) ) { |
| 49 | + if( self::_isCollectionPage( $title, $wgArticle ) ) { |
50 | 50 | $params = 'colltitle=' . wfUrlencode( $title->getPrefixedDBKey() ); |
51 | 51 | if ( isset( $wgCollectionFormats['rl'] ) ) { |
52 | 52 | $nav_urls['printable_version_pdf'] = array( |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | $params .= '&oldid=' . $wgArticle->getLatest(); |
70 | 70 | } |
71 | 71 | } |
72 | | - if ( isset( $wgCollectionFormats['rl'] ) ) { |
| 72 | + if( isset( $wgCollectionFormats['rl'] ) ) { |
73 | 73 | $nav_urls['printable_version_pdf'] = array( |
74 | 74 | 'href' => SkinTemplate::makeSpecialUrlSubpage( |
75 | 75 | 'Book', |
— | — | @@ -88,14 +88,10 @@ |
89 | 89 | static function insertMonoBookToolboxLink( &$skinTemplate ) { |
90 | 90 | global $wgCollectionFormats; |
91 | 91 | |
92 | | - if ( !empty( $skinTemplate->data['nav_urls']['printable_version_pdf']['href'] ) ) { |
| 92 | + if( !empty( $skinTemplate->data['nav_urls']['printable_version_pdf']['href'] ) ) { |
93 | 93 | $href = htmlspecialchars( $skinTemplate->data['nav_urls']['printable_version_pdf']['href'] ); |
94 | 94 | $label = htmlspecialchars( $skinTemplate->data['nav_urls']['printable_version_pdf']['text'] ); |
95 | | - print <<<EOS |
96 | | - |
97 | | - <li id="t-download-as-pdf"><a href="$href" rel="nofollow">$label</a></li> |
98 | | -EOS |
99 | | - ; |
| 95 | + print "<li id=\"t-download-as-pdf\"><a href=\"$href\" rel=\"nofollow\">$label</a></li>"; |
100 | 96 | } |
101 | 97 | return true; |
102 | 98 | } |
— | — | @@ -116,7 +112,7 @@ |
117 | 113 | // but you'd have to inject something for non-open sessions or |
118 | 114 | // it would be very confusing. |
119 | 115 | $html = self::getPortlet(); |
120 | | - if ( $html ) { |
| 116 | + if( $html ) { |
121 | 117 | $bar[ 'coll-create_a_book' ] = $html; |
122 | 118 | } |
123 | 119 | } |
— | — | @@ -132,16 +128,11 @@ |
133 | 129 | |
134 | 130 | $html = self::getPortlet(); |
135 | 131 | |
136 | | - if ( $html ) { |
| 132 | + if( $html ) { |
137 | 133 | $portletTitle = wfMsgHtml( 'coll-create_a_book' ); |
138 | | - print <<<EOS |
139 | | -<div id="p-collection" class="portlet"> |
| 134 | + print "<div id=\"p-collection\" class=\"portlet\"> |
140 | 135 | <h5>$portletTitle</h5> |
141 | | - <div class="pBody"> |
142 | | -EOS |
143 | | - ; |
144 | | - print $html; |
145 | | - print '</div></div>'; |
| 136 | + <div class=\"pBody\">\n$html\n</div></div>"; |
146 | 137 | } |
147 | 138 | } |
148 | 139 | |
— | — | @@ -151,188 +142,148 @@ |
152 | 143 | static function getPortlet( $ajaxHint='' ) { |
153 | 144 | global $wgArticle; |
154 | 145 | global $wgTitle; |
155 | | - global $wgOut; |
| 146 | + global $wgOut, $wgUser; |
156 | 147 | global $wgRequest; |
157 | 148 | global $wgCollectionArticleNamespaces; |
158 | | - global $wgJsMimeType; |
159 | 149 | global $wgScriptPath; |
160 | 150 | global $wgCollectionStyleVersion; |
161 | 151 | global $wgCollectionNavPopups; |
| 152 | + |
| 153 | + $sk = $wgUser->getSkin(); |
162 | 154 | |
163 | | - $navPopupJSURL = "$wgScriptPath/extensions/Collection/collection/Gadget-popups.js?$wgCollectionStyleVersion"; |
164 | | - $navPopupCSSURL = "$wgScriptPath/extensions/Collection/collection/Gadget-navpop.css?$wgCollectionStyleVersion"; |
165 | | - |
166 | | - |
167 | 155 | wfLoadExtensionMessages( 'CollectionCore' ); |
168 | 156 | |
169 | | - if (!$ajaxHint) { |
| 157 | + if( !$ajaxHint ) { |
170 | 158 | // we need to re-construct a title object from the request, because |
171 | | - // the "subpage" (i.e. "par") part has been stripped of by SpecialPage.php |
| 159 | + // the "subpage" (i.e. "par") part has been stripped off by SpecialPage.php |
172 | 160 | // in $wgTitle. |
173 | 161 | $origTitle = Title::newFromUrl($wgRequest->getVal('title')); |
174 | | - if (!is_null($origTitle) |
175 | | - && $origTitle->getLocalUrl() == SkinTemplate::makeSpecialUrl('Book')) { |
| 162 | + if( !is_null( $origTitle ) |
| 163 | + && $origTitle->getLocalUrl() == SkinTemplate::makeSpecialUrl( 'Book' ) ) { |
176 | 164 | return; |
177 | 165 | } |
178 | 166 | } |
179 | 167 | |
180 | | - $addArticle = wfMsgHtml( 'coll-add_page' ); |
181 | | - $addArticleTooltip = wfMsgHtml( 'coll-add_page_tooltip' ); |
182 | | - $removeArticle = wfMsgHtml( 'coll-remove_page' ); |
183 | | - $removeArticleTooltip = wfMsgHtml( 'coll-remove_page_tooltip' ); |
184 | | - $addCategory = wfMsgHtml( 'coll-add_category' ); |
185 | | - $addCategoryTooltip = wfMsgHtml( 'coll-add_category_tooltip' ); |
186 | | - $loadCollection = wfMsgHtml( 'coll-load_collection' ); |
187 | | - $loadCollection = wfMsgHtml( 'coll-load_collection_tooltip' ); |
188 | 168 | $namespace = $wgTitle->getNamespace(); |
189 | 169 | |
190 | 170 | $numArticles = CollectionSession::countArticles(); |
191 | 171 | $showShowAndClearLinks = true; |
192 | | - $addRemoveState = ''; |
193 | 172 | |
194 | | - $out = '<ul id="collectionPortletList">'; |
| 173 | + $out = Xml::element( 'ul', array( 'id' => 'collectionPortletList' ), NULL ); |
195 | 174 | |
196 | | - if ( self::_isCollectionPage( $wgTitle, $wgArticle) ) { |
197 | | - $params = "colltitle=" . $wgTitle->getPrefixedUrl(); |
198 | | - $href = htmlspecialchars( SkinTemplate::makeSpecialUrlSubpage( |
199 | | - 'Book', |
200 | | - 'load_collection/', |
201 | | - $params ) ); |
202 | | - $out .= "<li><a href=\"$href\" rel=\"nofollow\" title=\"$loadCollectionTooltip\">$loadCollection</a></li>"; |
| 175 | + if( self::_isCollectionPage( $wgTitle, $wgArticle) ) { |
| 176 | + $out .= Xml::tags( 'li', array( 'id' => 'coll-load_collection' ), |
| 177 | + $sk->link( SpecialPage::getTitleFor( 'Book', 'load_collection/' ), |
| 178 | + wfMsgHtml( "coll-load_collection" ), |
| 179 | + array( 'rel' => 'nofollow', |
| 180 | + 'title' => wfMsg( "coll-load_collection_tooltip" ), ), |
| 181 | + array( 'colltitle' => $wgTitle->getPrefixedUrl() ), |
| 182 | + array( 'known', 'noclasses' ) |
| 183 | + ) |
| 184 | + ); |
203 | 185 | $showShowAndClearLinks = false; |
204 | 186 | |
205 | | - } else if ( $ajaxHint == 'addcategory' || $namespace == NS_CATEGORY ) { |
206 | | - $addRemoveState = 'addcategory'; |
207 | | - $params = "cattitle=" . $wgTitle->getPartialURL(); |
208 | | - $href = htmlspecialchars( SkinTemplate::makeSpecialUrlSubpage( |
209 | | - 'Book', |
210 | | - 'add_category/', |
211 | | - $params ) ); |
212 | | - $out .= <<<EOS |
213 | | -<li> |
214 | | -<a href="$href" onclick="collectionCall('AddCategory', ['addcategory', wgTitle]); return false;" rel="nofollow" title="$addCategoryTooltip">$addCategory</a> |
215 | | -</li> |
216 | | -EOS |
217 | | - ; |
| 187 | + } else if( $ajaxHint == 'addcategory' || $namespace == NS_CATEGORY ) { |
218 | 188 | |
219 | | - } else if ( $ajaxHint || in_array( $namespace, $wgCollectionArticleNamespaces ) ) { |
220 | | - $params = "arttitle=" . $wgTitle->getPrefixedUrl(); |
| 189 | + $out .= Xml::tags( 'li', array( 'id' => 'coll-add_category' ), |
| 190 | + $sk->link( SpecialPage::getTitleFor( 'Book', 'add_category/' ), |
| 191 | + wfMsgHtml( "coll-add_category" ), |
| 192 | + array( 'onclick' => "collectionCall('AddCategory', ['addcategory', wgTitle]); return false;", |
| 193 | + 'rel' => 'nofollow', |
| 194 | + 'title' => wfMsg( "coll-add_category_tooltip" ), ), |
| 195 | + array( 'cattitle' => $wgTitle->getPartialURL() ), |
| 196 | + array( 'known', 'noclasses', 'noescape' ) |
| 197 | + ) |
| 198 | + ); |
| 199 | + |
| 200 | + } else if( $ajaxHint || in_array( $namespace, $wgCollectionArticleNamespaces ) ) { |
| 201 | + $params = array( 'arttitle' => $wgTitle->getPrefixedUrl() ); |
221 | 202 | if ( !is_null( $wgArticle ) ) { |
222 | 203 | $oldid = $wgArticle->getOldID(); |
223 | | - $params .= "&oldid=" . $oldid; |
224 | | - } else { |
225 | | - $oldid = null; |
| 204 | + $params['oldid'] = $oldid; |
226 | 205 | } |
227 | 206 | |
228 | | - $addLink = false; |
229 | | - if ( $ajaxHint == 'removepage' ) { |
230 | | - $addLink = false; |
231 | | - } else if ( $ajaxHint == 'addpage') { |
232 | | - $addLink = true; |
233 | | - } else if ( CollectionSession::findArticle( $wgTitle->getPrefixedText(), $oldid ) == -1 ) { |
234 | | - $addLink = true; |
235 | | - } |
236 | | - if ( $addLink ) { |
237 | | - $addRemoveState = 'addpage'; |
238 | | - $href = htmlspecialchars( SkinTemplate::makeSpecialUrlSubpage( |
239 | | - 'Book', |
240 | | - 'add_article/', |
241 | | - $params ) ); |
242 | | - $out .= <<<EOS |
243 | | -<li> |
244 | | - <a href="$href" onclick="collectionCall('AddArticle', ['removepage', wgNamespaceNumber, wgTitle, $oldid]); return false;" rel="nofollow" title="$addArticleTooltip">$addArticle</a> |
245 | | -</li> |
246 | | -EOS |
247 | | - ; |
| 207 | + if ( $ajaxHint == 'addpage' || CollectionSession::findArticle( $wgTitle->getPrefixedText(), $oldid ) == -1 ) { |
| 208 | + $action = 'add'; |
| 209 | + $uaction = 'Add'; |
| 210 | + $other_action = 'remove'; |
248 | 211 | } else { |
249 | | - $addRemoveState = 'removepage'; |
250 | | - $href = htmlspecialchars( SkinTemplate::makeSpecialUrlSubpage( |
251 | | - 'Book', |
252 | | - 'remove_article/', |
253 | | - $params ) ); |
254 | | - $out .= <<<EOS |
255 | | -<li> |
256 | | - <a href="$href" onclick="collectionCall('RemoveArticle', ['addpage', wgNamespaceNumber, wgTitle, $oldid]); return false;" rel="nofollow" title="$removeArticleTooltip">$removeArticle</a> |
257 | | -</li> |
258 | | -EOS |
259 | | - ; |
| 212 | + $action = 'remove'; |
| 213 | + $uaction = 'Remove'; |
| 214 | + $other_action = 'add'; |
260 | 215 | } |
| 216 | + |
| 217 | + $out .= Xml::tags( 'li', array( 'id' => "coll-{$action}_page" ), |
| 218 | + $sk->link( SpecialPage::getTitleFor( 'Book', "{$action}_article/" ), |
| 219 | + wfMsgHtml( "coll-{$action}_page" ), |
| 220 | + array( 'onclick' => "collectionCall('{$uaction}Article', ['{$other_action}page', wgNamespaceNumber, wgTitle, $oldid]); return false;", |
| 221 | + 'rel' => 'nofollow', |
| 222 | + 'title' => wfMsg( "coll-{$action}_page_tooltip" ) ), |
| 223 | + $params, |
| 224 | + array( 'known', 'noclasses' ) |
| 225 | + ) |
| 226 | + ); |
261 | 227 | } |
262 | 228 | |
263 | | - if ( $showShowAndClearLinks && $numArticles > 0 ) { |
| 229 | + if( $showShowAndClearLinks && $numArticles > 0 ) { |
264 | 230 | global $wgLang; |
265 | 231 | $articles = wfMsgExt( 'coll-n_pages', array( 'parsemag' ), $wgLang->formatNum( $numArticles ) ); |
266 | | - $showCollection = wfMsgHtml( 'coll-show_collection' ); |
267 | | - $showCollectionTooltip = wfMsgHtml( 'coll-show_collection_tooltip' ); |
268 | | - $showURL = htmlspecialchars( SkinTemplate::makeSpecialUrl( 'Book') ); |
269 | | - $out .= <<<EOS |
270 | | - <li><a href="$showURL" rel="nofollow" title="$showCollectionTooltip">$showCollection<br /> |
271 | | - ($articles)</a></li> |
272 | | -EOS |
273 | | - ; |
| 232 | + $out .= Xml::tags( 'li', array( 'id' => 'coll-show_collection' ), |
| 233 | + $sk->link( SpecialPage::getTitleFor( 'Book' ), |
| 234 | + wfMsgHtml( 'coll-show_collection' ) . "<br />($articles)" , |
| 235 | + array( 'rel' => 'nofollow', |
| 236 | + 'title' => wfMsg( 'coll-show_collection_tooltip' ) ), |
| 237 | + array(), |
| 238 | + array( 'known', 'noclasses' ) |
| 239 | + ) |
| 240 | + ); |
274 | 241 | |
275 | | - $clearCollection = wfMsgHtml( 'coll-clear_collection' ); |
276 | | - $clearCollectionTooltip = wfMsgHtml( 'coll-clear_collection_tooltip' ); |
277 | | - $params = 'return_to=' . $wgTitle->getFullURL(); |
278 | | - $href = htmlspecialchars( SkinTemplate::makeSpecialUrlSubpage( |
279 | | - 'Book', |
280 | | - 'clear_collection/', |
281 | | - $params ) ); |
282 | 242 | $msg = htmlspecialchars( wfMsg( 'coll-clear_collection_confirm' ) ); |
283 | | - $out .= <<<EOS |
284 | | -<li> |
285 | | - <a href="$href" onclick="if (confirm('$msg')) return true; else return false;" rel="nofollow" title="$clearCollectionTooltip">$clearCollection</a> |
286 | | -</li> |
287 | | -EOS |
288 | | - ; |
| 243 | + $out .= Xml::tags( 'li', array( 'id' => 'coll-clear_collection' ), |
| 244 | + $sk->link( SpecialPage::getTitleFor( 'Book', 'clear_collection/' ), |
| 245 | + wfMsgHtml( "coll-clear_collection" ), |
| 246 | + array( 'onclick' => "if (confirm('$msg')) return true; else return false;", |
| 247 | + 'rel' => 'nofollow', |
| 248 | + 'title' => wfMsg( "coll-clear_collection_tooltip" ) ), |
| 249 | + array( 'return_to' => $wgTitle->getFullURL() ), |
| 250 | + array( 'known', 'noclasses' ) |
| 251 | + ) |
| 252 | + ); |
289 | 253 | } |
290 | 254 | |
291 | | - $helpCollections = wfMsgHtml( 'coll-help_collections' ); |
292 | | - $helpCollectionsTooltip = wfMsgHtml( 'coll-help_collections_tooltip' ); |
293 | | - $helpURL = htmlspecialchars( Title::newFromText( wfMsgForContent( 'coll-helppage' ) )->getFullURL() ); |
294 | | - $out .= <<<EOS |
295 | | - <li><a href="$helpURL" title="$helpCollectionsTooltip">$helpCollections</a></li> |
296 | | -EOS |
297 | | - ; |
| 255 | + $out .= Xml::tags( 'li', array( 'id' => 'coll-help_collections' ), |
| 256 | + $sk->link( Title::newFromText( wfMsgForContent( 'coll-helppage' ) ), |
| 257 | + wfMsgHtml( 'coll-help_collections' ), |
| 258 | + array( 'title' => wfMsg( 'coll-help_collections_tooltip' ) ), |
| 259 | + array(), |
| 260 | + array( 'known', 'noclasses' ) |
| 261 | + ) |
| 262 | + ); |
| 263 | + |
| 264 | + $out .= '</ul>'; |
| 265 | + $wgOut->addScript( "/* <![CDATA[ */ wgCollectionAddRemoveState = '$addRemoveState'; /* ]]> */" ); |
| 266 | + $wgOut->addScriptFile( "/extensions/Collection/collection/portlet.js?$wgCollectionStyleVersion" ); |
298 | 267 | |
299 | | - $out .= <<<EOS |
300 | | -</ul> |
301 | | -<script type="text/javascript"> |
302 | | -/* <![CDATA[ */ |
303 | | - wgCollectionAddRemoveState = '$addRemoveState'; |
304 | | -/* ]]> */ |
305 | | -</script> |
306 | | -<script type="text/javascript" src="$wgScriptPath/extensions/Collection/collection/portlet.js?$wgCollectionStyleVersion"></script> |
307 | | -EOS |
308 | | - ; |
309 | | - |
310 | 268 | // activate popup check: |
311 | 269 | if ( $wgCollectionNavPopups ) { |
312 | 270 | $addPageText = wfMsg( 'coll-add_page_popup' ); |
313 | 271 | $addCategoryText = wfMsg( 'coll-add_category_popup' ); |
314 | 272 | $removePageText = wfMsg( 'coll-remove_page_popup' ); |
315 | 273 | $popupHelpText = wfMsg( 'coll-popup_help_text' ); |
316 | | - $out .= <<<EOS |
317 | | -<script type="text/javascript"> |
318 | | -/* <![CDATA[ */ |
319 | | - wgCollectionNavPopupJSURL = '$navPopupJSURL'; |
320 | | - wgCollectionNavPopupCSSURL = '$navPopupCSSURL'; |
321 | | - wgCollectionAddPageText = '$addPageText'; |
322 | | - wgCollectionAddCategoryText = '$addCategoryText'; |
323 | | - wgCollectionRemovePageText = '$removePageText'; |
324 | | - wgCollectionPopupHelpText = '$popupHelpText'; |
325 | | - wgCollectionArticleNamespaces = [ |
326 | | -EOS |
327 | | - ; |
328 | | - $out .= implode( ', ', $wgCollectionArticleNamespaces ); |
329 | | - $out .= <<<EOS |
330 | | -]; |
331 | | -/* ]]> */ |
332 | | -</script> |
333 | | -<script type="text/javascript" src="$wgScriptPath/extensions/Collection/collection/json2.js?$wgCollectionStyleVersion"></script> |
334 | | -<script type="text/javascript" src="$wgScriptPath/extensions/Collection/collection/popupcheck.js?$wgCollectionStyleVersion"></script> |
335 | | -EOS |
336 | | - ; |
| 274 | + |
| 275 | + $wgOut->addScript( "/* <![CDATA[ */ |
| 276 | + wgCollectionNavPopupJSURL = '$wgScriptPath/extensions/Collection/collection/Gadget-popups.js?$wgCollectionStyleVersion'; |
| 277 | + wgCollectionNavPopupCSSURL = '$wgScriptPath/extensions/Collection/collection/Gadget-navpop.css?$wgCollectionStyleVersion'; |
| 278 | + wgCollectionAddPageText = '$addPageText'; |
| 279 | + wgCollectionAddCategoryText = '$addCategoryText'; |
| 280 | + wgCollectionRemovePageText = '$removePageText'; |
| 281 | + wgCollectionPopupHelpText = '$popupHelpText'; |
| 282 | + wgCollectionArticleNamespaces = [ " |
| 283 | + . implode( ', ', $wgCollectionArticleNamespaces ) |
| 284 | + . "]; /* ]]> */ " ); |
| 285 | + $wgOut->addScriptFile( "/extensions/Collection/collection/json2.js?$wgCollectionStyleVersion" ); |
| 286 | + $wgOut->addScriptFile( "/extensions/Collection/collection/popupcheck.js?$wgCollectionStyleVersion" ); |
| 287 | + |
337 | 288 | } |
338 | 289 | |
339 | 290 | return $out; |
— | — | @@ -342,7 +293,7 @@ |
343 | 294 | * OutputPageCheckLastModified hook |
344 | 295 | */ |
345 | 296 | static function checkLastModified( $modifiedTimes ) { |
346 | | - if ( CollectionSession::hasSession() && isset( $_SESSION['wsCollection']['timestamp'] ) ) { |
| 297 | + if( CollectionSession::hasSession() && isset( $_SESSION['wsCollection']['timestamp'] ) ) { |
347 | 298 | $modifiedTimes['collection'] = $_SESSION['wsCollection']['timestamp']; |
348 | 299 | } |
349 | 300 | return true; |
— | — | @@ -351,7 +302,7 @@ |
352 | 303 | static function _isCollectionPage( $title, $article ) { |
353 | 304 | global $wgCommunityCollectionNamespace; |
354 | 305 | |
355 | | - if ( is_null( $title ) || is_null( $article ) ) { |
| 306 | + if( is_null( $title ) || is_null( $article ) ) { |
356 | 307 | return false; |
357 | 308 | } |
358 | 309 | |
— | — | @@ -367,10 +318,10 @@ |
368 | 319 | static protected function pageInCategory( $pageId, $categoryName ) { |
369 | 320 | $dbr = wfGetDB( DB_SLAVE ); |
370 | 321 | $count = $dbr->selectField( 'categorylinks', 'COUNT(*)', |
371 | | - array( |
372 | | - 'cl_from' => $pageId, |
373 | | - 'cl_to' => $categoryName ), |
374 | | - __METHOD__ ); |
375 | | - return ($count > 0); |
| 322 | + array( 'cl_from' => $pageId, |
| 323 | + 'cl_to' => $categoryName ), |
| 324 | + __METHOD__ |
| 325 | + ); |
| 326 | + return ( $count > 0 ); |
376 | 327 | } |
377 | 328 | } |
Index: trunk/extensions/Collection/Collection.body.php |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | self::limitExceeded(); |
57 | 57 | return; |
58 | 58 | } |
59 | | - $title_url = $wgRequest->getVal( 'arttitle', '' ); |
| 59 | + $title_url = urldecode( $wgRequest->getVal( 'arttitle', '' ) ); |
60 | 60 | $oldid = $wgRequest->getInt( 'oldid', 0 ); |
61 | 61 | $title = Title::newFromURL( $title_url ); |
62 | 62 | $this->addArticle( $title, $oldid ); |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | $wgOut->redirect( $redirectURL ); |
70 | 70 | return; |
71 | 71 | case 'remove_article/': |
72 | | - $title_url = $wgRequest->getVal( 'arttitle', '' ); |
| 72 | + $title_url = urldecode( $wgRequest->getVal( 'arttitle', '' ) ); |
73 | 73 | $oldid = $wgRequest->getInt( 'oldid', 0 ); |
74 | 74 | $title = Title::newFromURL( $title_url ); |
75 | 75 | self::removeArticle( $title, $oldid ); |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | $wgOut->redirect( SkinTemplate::makeSpecialUrl( 'Book' ) ); |
98 | 98 | return; |
99 | 99 | case 'add_category/': |
100 | | - $title = Title::makeTitleSafe( NS_CATEGORY, $wgRequest->getVal( 'cattitle', '' ) ); |
| 100 | + $title = Title::makeTitleSafe( NS_CATEGORY, urldecode( $wgRequest->getVal( 'cattitle', '' ) ) ); |
101 | 101 | if ( self::addCategory( $title ) ) { |
102 | 102 | self::limitExceeded(); |
103 | 103 | return; |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | $wgOut->redirect( SkinTemplate::makeSpecialUrl( 'Book' ) ); |
118 | 118 | return; |
119 | 119 | case 'load_collection/': |
120 | | - $title = Title::newFromText( $wgRequest->getVal( 'colltitle', '' ) ); |
| 120 | + $title = Title::newFromText( urldecode( $wgRequest->getVal( 'colltitle', '' ) ) ); |
121 | 121 | if ( $wgRequest->getVal( 'cancel' ) ) { |
122 | 122 | $wgOut->redirect( $title->getFullURL() ); |
123 | 123 | return; |
— | — | @@ -135,12 +135,12 @@ |
136 | 136 | $this->renderLoadOverwritePage( $title ); |
137 | 137 | return; |
138 | 138 | case 'order_collection/': |
139 | | - $title = Title::newFromText( $wgRequest->getVal( 'colltitle', '' ) ); |
| 139 | + $title = Title::newFromText( urldecode( $wgRequest->getVal( 'colltitle', '' ) ) ); |
140 | 140 | $collection = $this->loadCollection( $title ); |
141 | 141 | $partner = $wgRequest->getVal( 'partner', 'pediapress' ); |
142 | 142 | return $this->postZIP( $collection, $partner ); |
143 | 143 | case 'save_collection/': |
144 | | - $collTitle = $wgRequest->getVal( 'colltitle' ); |
| 144 | + $collTitle = urldecode( $wgRequest->getVal( 'colltitle' ) ); |
145 | 145 | if ( $wgRequest->getVal( 'overwrite' ) && !empty( $collTitle ) ) {; |
146 | 146 | $title = Title::newFromText( $collTitle ); |
147 | 147 | $this->saveCollection( $title, $overwrite=true ); |
— | — | @@ -152,14 +152,14 @@ |
153 | 153 | $saveCalled = false; |
154 | 154 | if ( $collType == 'personal' ) { |
155 | 155 | $userPageTitle = $wgUser->getUserPage()->getPrefixedText(); |
156 | | - $name = $wgRequest->getVal( 'pcollname', '' ); |
| 156 | + $name = urldecode( $wgRequest->getVal( 'pcollname', '' ) ); |
157 | 157 | if ( !empty( $name ) ) { |
158 | 158 | $title = Title::newFromText( $userPageTitle . '/' . wfMsgForContent( 'coll-collections' ) . '/' . $name ); |
159 | 159 | $saveCalled = true; |
160 | 160 | $saved = $this->saveCollection( $title, $overwrite ); |
161 | 161 | } |
162 | 162 | } else if ( $collType == 'community' ) { |
163 | | - $name = $wgRequest->getVal( 'ccollname', '' ); |
| 163 | + $name = urldecode( $wgRequest->getVal( 'ccollname', '' ) ); |
164 | 164 | if ( !empty( $name ) ) { |
165 | 165 | $title = Title::makeTitle( $wgCommunityCollectionNamespace, wfMsgForContent( 'coll-collections' ) . '/' . $name ); |
166 | 166 | $saveCalled = true; |
— | — | @@ -188,11 +188,11 @@ |
189 | 189 | case 'download/': |
190 | 190 | return $this->download(); |
191 | 191 | case 'render_article/': |
192 | | - $title = Title::newFromText( $wgRequest->getVal( 'arttitle', '' ) ); |
| 192 | + $title = Title::newFromText( urldecode( $wgRequest->getVal( 'arttitle', '' ) ) ); |
193 | 193 | $oldid = $wgRequest->getInt( 'oldid', 0 ); |
194 | 194 | return $this->renderArticle( $title, $oldid, $wgRequest->getVal( 'writer', 'rl' ) ); |
195 | 195 | case 'render_collection/': |
196 | | - $title = Title::newFromText( $wgRequest->getVal( 'colltitle', '' ) ); |
| 196 | + $title = Title::newFromText( urldecode( $wgRequest->getVal( 'colltitle', '' ) )); |
197 | 197 | $collection = $this->loadCollection( $title ); |
198 | 198 | if ( $collection ) { |
199 | 199 | $this->renderCollection( $collection, $title, $wgRequest->getVal( 'writer', 'rl' ) ); |