SpecialLog.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. # Copyright (C) 2008 Aaron Schulz
  3. # http://www.mediawiki.org/
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License along
  16. # with this program; if not, write to the Free Software Foundation, Inc.,
  17. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. # http://www.gnu.org/copyleft/gpl.html
  19. /**
  20. * @file
  21. * @ingroup SpecialPage
  22. */
  23. /**
  24. * constructor
  25. */
  26. function wfSpecialLog( $par = '' ) {
  27. global $wgRequest, $wgOut, $wgUser, $wgLogTypes;
  28. # Get parameters
  29. $parms = explode( '/', ($par = ( $par !== null ) ? $par : '' ) );
  30. $symsForAll = array( '*', 'all' );
  31. if ( $parms[0] != '' && ( in_array( $par, $wgLogTypes ) || in_array( $par, $symsForAll ) ) ) {
  32. $type = $par;
  33. $user = $wgRequest->getText( 'user' );
  34. } else if ( count( $parms ) == 2 ) {
  35. $type = $parms[0];
  36. $user = $parms[1];
  37. } else {
  38. $type = $wgRequest->getVal( 'type' );
  39. $user = ( $par != '' ) ? $par : $wgRequest->getText( 'user' );
  40. }
  41. $title = $wgRequest->getText( 'page' );
  42. $pattern = $wgRequest->getBool( 'pattern' );
  43. $y = $wgRequest->getIntOrNull( 'year' );
  44. $m = $wgRequest->getIntOrNull( 'month' );
  45. $tagFilter = $wgRequest->getVal( 'tagfilter' );
  46. # Don't let the user get stuck with a certain date
  47. $skip = $wgRequest->getText( 'offset' ) || $wgRequest->getText( 'dir' ) == 'prev';
  48. if( $skip ) {
  49. $y = '';
  50. $m = '';
  51. }
  52. # Create a LogPager item to get the results and a LogEventsList item to format them...
  53. $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
  54. $pager = new LogPager( $loglist, $type, $user, $title, $pattern, array(), $y, $m, $tagFilter );
  55. # Set title and add header
  56. $loglist->showHeader( $pager->getType() );
  57. # Show form options
  58. $loglist->showOptions( $pager->getType(), $pager->getUser(), $pager->getPage(), $pager->getPattern(),
  59. $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $tagFilter );
  60. # Insert list
  61. $logBody = $pager->getBody();
  62. if( $logBody ) {
  63. $wgOut->addHTML(
  64. $pager->getNavigationBar() .
  65. $loglist->beginLogEventsList() .
  66. $logBody .
  67. $loglist->endLogEventsList() .
  68. $pager->getNavigationBar()
  69. );
  70. } else {
  71. $wgOut->addWikiMsg( 'logempty' );
  72. }
  73. }