Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php |
— | — | @@ -88,8 +88,10 @@ |
89 | 89 | break; |
90 | 90 | } |
91 | 91 | |
92 | | - $wgOut->addHTML( "<br>Redirecting to page $go" ); |
93 | | - $wgOut->redirect( $go ); |
| 92 | + if ($go) { |
| 93 | + $wgOut->addHTML( "<br>Redirecting to page $go" ); |
| 94 | + $wgOut->redirect( $go ); |
| 95 | + } //TODO: There really should be an else here. |
94 | 96 | } |
95 | 97 | } |
96 | 98 | } else { |
Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php |
— | — | @@ -247,23 +247,57 @@ |
248 | 248 | ); |
249 | 249 | } |
250 | 250 | |
| 251 | + /** |
| 252 | + * getThankYouPage should either return a full page url, or false. |
| 253 | + * @global type $wgLang |
| 254 | + * @return mixed Page URL in string format, or false if none is set. |
| 255 | + */ |
251 | 256 | function getThankYouPage() { |
252 | | - global $wgLang; |
253 | | - $language = $wgLang->getCode(); |
254 | | - $page = self::getGlobal( "ThankYouPage" ) . "/$language"; |
255 | | -// $returnTitle = Title::newFromText( $page ); |
256 | | -// $returnto = $returnTitle->getFullURL(); |
| 257 | + $page = self::getGlobal( "ThankYouPage" ); |
| 258 | + if ( $page ) { |
| 259 | + $page = $this->appendLanguageAndMakeURL( $page ); |
| 260 | + } |
257 | 261 | return $page; |
258 | 262 | } |
259 | 263 | |
| 264 | + /** |
| 265 | + * getFailPage should either return a full page url, or false. |
| 266 | + * @global type $wgLang |
| 267 | + * @return mixed Page URL in string format, or false if none is set. |
| 268 | + */ |
260 | 269 | function getFailPage() { |
261 | | - global $wgLang; |
262 | | - $language = $wgLang->getCode(); |
263 | | - $page = self::getGlobal( "FailPage" ) . "/$language"; |
264 | | - $returnTitle = Title::newFromText( $page ); |
265 | | - $returnto = $returnTitle->getFullURL(); |
266 | | - return $returnto; |
| 270 | + $page = self::getGlobal( "FailPage" ); |
| 271 | + if ( $page ) { |
| 272 | + $page = $this->appendLanguageAndMakeURL( $page ); |
| 273 | + } |
| 274 | + return $page; |
267 | 275 | } |
| 276 | + |
| 277 | + /** |
| 278 | + * For pages we intend to redirect to. This function will take either a full |
| 279 | + * URL or a page title, and turn it into a URL with the appropriate language |
| 280 | + * appended onto the end. |
| 281 | + * @param string $url Either a wiki page title, or a URL to an external wiki |
| 282 | + * page title. |
| 283 | + * @return string A URL |
| 284 | + */ |
| 285 | + function appendLanguageAndMakeURL( $url ){ |
| 286 | + $language = $this->getData_Raw( 'language' ); |
| 287 | + //make sure we don't already have the language in there... |
| 288 | + $dirs = explode('/', $url); |
| 289 | + if ( !is_array($dirs) || !in_array( $language, $dirs ) ){ |
| 290 | + $url = $url . "/$language"; |
| 291 | + } |
| 292 | + |
| 293 | + error_log("Position: " . strpos( $url, 'http' )); |
| 294 | + if ( strpos( $url, 'http' ) === 0) { |
| 295 | + return $url; |
| 296 | + } else { //this isn't a url yet. |
| 297 | + $returnTitle = Title::newFromText( $url ); |
| 298 | + $url = $returnTitle->getFullURL(); |
| 299 | + return $url; |
| 300 | + } |
| 301 | + } |
268 | 302 | |
269 | 303 | /** |
270 | 304 | * Checks the edit tokens in the user's session against the one gathered |