00001 <?php 00002 # Copyright (C) 2008 Aaron Schulz 00003 # http://www.mediawiki.org/ 00004 # 00005 # This program is free software; you can redistribute it and/or modify 00006 # it under the terms of the GNU General Public License as published by 00007 # the Free Software Foundation; either version 2 of the License, or 00008 # (at your option) any later version. 00009 # 00010 # This program is distributed in the hope that it will be useful, 00011 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 # GNU General Public License for more details. 00014 # 00015 # You should have received a copy of the GNU General Public License along 00016 # with this program; if not, write to the Free Software Foundation, Inc., 00017 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 # http://www.gnu.org/copyleft/gpl.html 00019 00028 function wfSpecialLog( $par = '' ) { 00029 global $wgRequest, $wgOut, $wgUser, $wgLogTypes; 00030 00031 # Get parameters 00032 $parms = explode( '/', ($par = ( $par !== null ) ? $par : '' ) ); 00033 $symsForAll = array( '*', 'all' ); 00034 if ( $parms[0] != '' && ( in_array( $par, $wgLogTypes ) || in_array( $par, $symsForAll ) ) ) { 00035 $type = $par; 00036 $user = $wgRequest->getText( 'user' ); 00037 } else if ( count( $parms ) == 2 ) { 00038 $type = $parms[0]; 00039 $user = $parms[1]; 00040 } else { 00041 $type = $wgRequest->getVal( 'type' ); 00042 $user = ( $par != '' ) ? $par : $wgRequest->getText( 'user' ); 00043 } 00044 $title = $wgRequest->getText( 'page' ); 00045 $pattern = $wgRequest->getBool( 'pattern' ); 00046 $y = $wgRequest->getIntOrNull( 'year' ); 00047 $m = $wgRequest->getIntOrNull( 'month' ); 00048 $tagFilter = $wgRequest->getVal( 'tagfilter' ); 00049 # Don't let the user get stuck with a certain date 00050 $skip = $wgRequest->getText( 'offset' ) || $wgRequest->getText( 'dir' ) == 'prev'; 00051 if( $skip ) { 00052 $y = ''; 00053 $m = ''; 00054 } 00055 # Create a LogPager item to get the results and a LogEventsList item to format them... 00056 $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 ); 00057 $pager = new LogPager( $loglist, $type, $user, $title, $pattern, array(), $y, $m, $tagFilter ); 00058 # Set title and add header 00059 $loglist->showHeader( $pager->getType() ); 00060 # Show form options 00061 $loglist->showOptions( $pager->getType(), $pager->getUser(), $pager->getPage(), $pager->getPattern(), 00062 $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $tagFilter ); 00063 # Insert list 00064 $logBody = $pager->getBody(); 00065 if( $logBody ) { 00066 $wgOut->addHTML( 00067 $pager->getNavigationBar() . 00068 $loglist->beginLogEventsList() . 00069 $logBody . 00070 $loglist->endLogEventsList() . 00071 $pager->getNavigationBar() 00072 ); 00073 } else { 00074 $wgOut->addWikiMsg( 'logempty' ); 00075 } 00076 }