Index: trunk/phase3/includes/specials/SpecialWatchlist.php |
— | — | @@ -16,18 +16,22 @@ |
17 | 17 | |
18 | 18 | // Add feed links |
19 | 19 | $wlToken = $wgUser->getOption( 'watchlisttoken' ); |
20 | | - if ($wlToken) { |
21 | | - global $wgServer, $wgScriptPath, $wgFeedClasses; |
22 | | - $apiParams = array( 'action' => 'feedwatchlist', 'allrev' => 'allrev', |
23 | | - 'wlowner' => $wgUser->getName(), 'wltoken' => $wlToken ); |
24 | | - $feedTemplate = $wgServer . $wgScriptPath . '/api.php?'; |
25 | | - |
26 | | - foreach( $wgFeedClasses as $format => $class ) { |
27 | | - $theseParams = $apiParams + array( 'feedformat' => $format ); |
28 | | - $url = $feedTemplate . wfArrayToCGI( $theseParams ); |
29 | | - $wgOut->addFeedLink( $format, $url ); |
30 | | - } |
| 20 | + if (!$wlToken) { |
| 21 | + $wlToken = sha1( mt_rand() . microtime( true ) ); |
| 22 | + $wgUser->setOption( 'watchlisttoken', $wlToken ); |
| 23 | + $wgUser->saveSettings(); |
31 | 24 | } |
| 25 | + |
| 26 | + global $wgServer, $wgScriptPath, $wgFeedClasses; |
| 27 | + $apiParams = array( 'action' => 'feedwatchlist', 'allrev' => 'allrev', |
| 28 | + 'wlowner' => $wgUser->getName(), 'wltoken' => $wlToken ); |
| 29 | + $feedTemplate = $wgServer . $wgScriptPath . '/api.php?'; |
| 30 | + |
| 31 | + foreach( $wgFeedClasses as $format => $class ) { |
| 32 | + $theseParams = $apiParams + array( 'feedformat' => $format ); |
| 33 | + $url = $feedTemplate . wfArrayToCGI( $theseParams ); |
| 34 | + $wgOut->addFeedLink( $format, $url ); |
| 35 | + } |
32 | 36 | |
33 | 37 | $skin = $wgUser->getSkin(); |
34 | 38 | $specialTitle = SpecialPage::getTitleFor( 'Watchlist' ); |