Index: trunk/phase3/includes/Article.php |
— | — | @@ -1785,6 +1785,122 @@ |
1786 | 1786 | } |
1787 | 1787 | |
1788 | 1788 | /** |
| 1789 | + * Mark this particular edit/page as patrolled |
| 1790 | + */ |
| 1791 | + public function markpatrolled() { |
| 1792 | + global $wgOut, $wgRequest; |
| 1793 | + |
| 1794 | + $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
| 1795 | + |
| 1796 | + # If we haven't been given an rc_id value, we can't do anything |
| 1797 | + $rcid = (int) $wgRequest->getVal( 'rcid' ); |
| 1798 | + |
| 1799 | + if ( !$wgOut->getUser()->matchEditToken( $wgRequest->getVal( 'token' ), $rcid ) ) { |
| 1800 | + $wgOut->showErrorPage( 'sessionfailure-title', 'sessionfailure' ); |
| 1801 | + return; |
| 1802 | + } |
| 1803 | + |
| 1804 | + $rc = RecentChange::newFromId( $rcid ); |
| 1805 | + |
| 1806 | + if ( is_null( $rc ) ) { |
| 1807 | + $wgOut->showErrorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' ); |
| 1808 | + return; |
| 1809 | + } |
| 1810 | + |
| 1811 | + # It would be nice to see where the user had actually come from, but for now just guess |
| 1812 | + $returnto = $rc->getAttribute( 'rc_type' ) == RC_NEW ? 'Newpages' : 'Recentchanges'; |
| 1813 | + $return = SpecialPage::getTitleFor( $returnto ); |
| 1814 | + |
| 1815 | + $errors = $rc->doMarkPatrolled(); |
| 1816 | + |
| 1817 | + if ( in_array( array( 'rcpatroldisabled' ), $errors ) ) { |
| 1818 | + $wgOut->showErrorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' ); |
| 1819 | + |
| 1820 | + return; |
| 1821 | + } |
| 1822 | + |
| 1823 | + if ( in_array( array( 'hookaborted' ), $errors ) ) { |
| 1824 | + // The hook itself has handled any output |
| 1825 | + return; |
| 1826 | + } |
| 1827 | + |
| 1828 | + if ( in_array( array( 'markedaspatrollederror-noautopatrol' ), $errors ) ) { |
| 1829 | + $wgOut->setPageTitle( wfMsg( 'markedaspatrollederror' ) ); |
| 1830 | + $wgOut->addWikiMsg( 'markedaspatrollederror-noautopatrol' ); |
| 1831 | + $wgOut->returnToMain( null, $return ); |
| 1832 | + |
| 1833 | + return; |
| 1834 | + } |
| 1835 | + |
| 1836 | + if ( !empty( $errors ) ) { |
| 1837 | + $wgOut->showPermissionsErrorPage( $errors ); |
| 1838 | + |
| 1839 | + return; |
| 1840 | + } |
| 1841 | + |
| 1842 | + # Inform the user |
| 1843 | + $wgOut->setPageTitle( wfMsg( 'markedaspatrolled' ) ); |
| 1844 | + $wgOut->addWikiMsg( 'markedaspatrolledtext', $rc->getTitle()->getPrefixedText() ); |
| 1845 | + $wgOut->returnToMain( null, $return ); |
| 1846 | + } |
| 1847 | + |
| 1848 | + /** |
| 1849 | + * User-interface handler for the "watch" action. |
| 1850 | + * Requires Request to pass a token as of 1.19. |
| 1851 | + * @deprecated since 1.18 |
| 1852 | + */ |
| 1853 | + public function watch() { |
| 1854 | + Action::factory( 'watch', $this )->show(); |
| 1855 | + } |
| 1856 | + |
| 1857 | + /** |
| 1858 | + * Add this page to $wgUser's watchlist |
| 1859 | + * |
| 1860 | + * This is safe to be called multiple times |
| 1861 | + * |
| 1862 | + * @return bool true on successful watch operation |
| 1863 | + * @deprecated since 1.18 |
| 1864 | + */ |
| 1865 | + public function doWatch() { |
| 1866 | + global $wgUser; |
| 1867 | + return WatchAction::doWatch( $this->mTitle, $wgUser ); |
| 1868 | + } |
| 1869 | + |
| 1870 | + /** |
| 1871 | + * User interface handler for the "unwatch" action. |
| 1872 | + * Requires Request to pass a token as of 1.19. |
| 1873 | + * @deprecated since 1.18 |
| 1874 | + */ |
| 1875 | + public function unwatch() { |
| 1876 | + Action::factory( 'unwatch', $this )->show(); |
| 1877 | + } |
| 1878 | + |
| 1879 | + /** |
| 1880 | + * Stop watching a page |
| 1881 | + * @return bool true on successful unwatch |
| 1882 | + * @deprecated since 1.18 |
| 1883 | + */ |
| 1884 | + public function doUnwatch() { |
| 1885 | + global $wgUser; |
| 1886 | + return WatchAction::doUnwatch( $this->mTitle, $wgUser ); |
| 1887 | + } |
| 1888 | + |
| 1889 | + /** |
| 1890 | + * action=protect handler |
| 1891 | + */ |
| 1892 | + public function protect() { |
| 1893 | + $form = new ProtectionForm( $this ); |
| 1894 | + $form->execute(); |
| 1895 | + } |
| 1896 | + |
| 1897 | + /** |
| 1898 | + * action=unprotect handler (alias) |
| 1899 | + */ |
| 1900 | + public function unprotect() { |
| 1901 | + $this->protect(); |
| 1902 | + } |
| 1903 | + |
| 1904 | + /** |
1789 | 1905 | * Insert a new empty page record for this article. |
1790 | 1906 | * This *must* be followed up by creating a revision |
1791 | 1907 | * and running $this->updateRevisionOn( ... ); |
— | — | @@ -2324,122 +2440,6 @@ |
2325 | 2441 | } |
2326 | 2442 | |
2327 | 2443 | /** |
2328 | | - * Mark this particular edit/page as patrolled |
2329 | | - */ |
2330 | | - public function markpatrolled() { |
2331 | | - global $wgOut, $wgRequest; |
2332 | | - |
2333 | | - $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
2334 | | - |
2335 | | - # If we haven't been given an rc_id value, we can't do anything |
2336 | | - $rcid = (int) $wgRequest->getVal( 'rcid' ); |
2337 | | - |
2338 | | - if ( !$wgOut->getUser()->matchEditToken( $wgRequest->getVal( 'token' ), $rcid ) ) { |
2339 | | - $wgOut->showErrorPage( 'sessionfailure-title', 'sessionfailure' ); |
2340 | | - return; |
2341 | | - } |
2342 | | - |
2343 | | - $rc = RecentChange::newFromId( $rcid ); |
2344 | | - |
2345 | | - if ( is_null( $rc ) ) { |
2346 | | - $wgOut->showErrorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' ); |
2347 | | - return; |
2348 | | - } |
2349 | | - |
2350 | | - # It would be nice to see where the user had actually come from, but for now just guess |
2351 | | - $returnto = $rc->getAttribute( 'rc_type' ) == RC_NEW ? 'Newpages' : 'Recentchanges'; |
2352 | | - $return = SpecialPage::getTitleFor( $returnto ); |
2353 | | - |
2354 | | - $errors = $rc->doMarkPatrolled(); |
2355 | | - |
2356 | | - if ( in_array( array( 'rcpatroldisabled' ), $errors ) ) { |
2357 | | - $wgOut->showErrorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' ); |
2358 | | - |
2359 | | - return; |
2360 | | - } |
2361 | | - |
2362 | | - if ( in_array( array( 'hookaborted' ), $errors ) ) { |
2363 | | - // The hook itself has handled any output |
2364 | | - return; |
2365 | | - } |
2366 | | - |
2367 | | - if ( in_array( array( 'markedaspatrollederror-noautopatrol' ), $errors ) ) { |
2368 | | - $wgOut->setPageTitle( wfMsg( 'markedaspatrollederror' ) ); |
2369 | | - $wgOut->addWikiMsg( 'markedaspatrollederror-noautopatrol' ); |
2370 | | - $wgOut->returnToMain( null, $return ); |
2371 | | - |
2372 | | - return; |
2373 | | - } |
2374 | | - |
2375 | | - if ( !empty( $errors ) ) { |
2376 | | - $wgOut->showPermissionsErrorPage( $errors ); |
2377 | | - |
2378 | | - return; |
2379 | | - } |
2380 | | - |
2381 | | - # Inform the user |
2382 | | - $wgOut->setPageTitle( wfMsg( 'markedaspatrolled' ) ); |
2383 | | - $wgOut->addWikiMsg( 'markedaspatrolledtext', $rc->getTitle()->getPrefixedText() ); |
2384 | | - $wgOut->returnToMain( null, $return ); |
2385 | | - } |
2386 | | - |
2387 | | - /** |
2388 | | - * User-interface handler for the "watch" action. |
2389 | | - * Requires Request to pass a token as of 1.19. |
2390 | | - * @deprecated since 1.18 |
2391 | | - */ |
2392 | | - public function watch() { |
2393 | | - Action::factory( 'watch', $this )->show(); |
2394 | | - } |
2395 | | - |
2396 | | - /** |
2397 | | - * Add this page to $wgUser's watchlist |
2398 | | - * |
2399 | | - * This is safe to be called multiple times |
2400 | | - * |
2401 | | - * @return bool true on successful watch operation |
2402 | | - * @deprecated since 1.18 |
2403 | | - */ |
2404 | | - public function doWatch() { |
2405 | | - global $wgUser; |
2406 | | - return WatchAction::doWatch( $this->mTitle, $wgUser ); |
2407 | | - } |
2408 | | - |
2409 | | - /** |
2410 | | - * User interface handler for the "unwatch" action. |
2411 | | - * Requires Request to pass a token as of 1.19. |
2412 | | - * @deprecated since 1.18 |
2413 | | - */ |
2414 | | - public function unwatch() { |
2415 | | - Action::factory( 'unwatch', $this )->show(); |
2416 | | - } |
2417 | | - |
2418 | | - /** |
2419 | | - * Stop watching a page |
2420 | | - * @return bool true on successful unwatch |
2421 | | - * @deprecated since 1.18 |
2422 | | - */ |
2423 | | - public function doUnwatch() { |
2424 | | - global $wgUser; |
2425 | | - return WatchAction::doUnwatch( $this->mTitle, $wgUser ); |
2426 | | - } |
2427 | | - |
2428 | | - /** |
2429 | | - * action=protect handler |
2430 | | - */ |
2431 | | - public function protect() { |
2432 | | - $form = new ProtectionForm( $this ); |
2433 | | - $form->execute(); |
2434 | | - } |
2435 | | - |
2436 | | - /** |
2437 | | - * action=unprotect handler (alias) |
2438 | | - */ |
2439 | | - public function unprotect() { |
2440 | | - $this->protect(); |
2441 | | - } |
2442 | | - |
2443 | | - /** |
2444 | 2444 | * Update the article's restriction field, and leave a log entry. |
2445 | 2445 | * |
2446 | 2446 | * @param $limit Array: set of restriction keys |