diff -r c5409416b61b -r 99ea0b0ac4be plugins/SpecialLog.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/SpecialLog.php Sun Apr 12 19:26:13 2009 -0400 @@ -0,0 +1,85 @@ +add_page(Array( + 'name'=>'specialpage_log', + 'urlname'=>'Log', + 'namespace'=>'Special', + 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', + )); +} + +function page_Special_Log() +{ + global $db, $session, $paths, $template, $plugins; // Common objects + global $lang; + global $output; + + require_once(ENANO_ROOT . '/includes/log.php'); + $log = new LogDisplay(); + $page = 1; + $pagesize = 50; + + if ( $params = explode('/', $paths->getAllParams()) ) + { + foreach ( $params as $param ) + { + if ( preg_match('/^(user|page|within|resultpage|size)=(.+?)$/', $param, $match) ) + { + $name =& $match[1]; + $value =& $match[2]; + switch($name) + { + case 'resultpage': + $page = intval($value); + break; + case 'size': + $pagesize = intval($value); + break; + default: + $log->add_criterion($name, $value); + break; + } + } + } + } + + $page--; + $rowcount = $log->get_row_count(); + $result_url = makeUrlNS('Special', 'Log/' . rtrim(preg_replace('|/?resultpage=(.+?)/?|', '/', $paths->getAllParams()), '/') . '/resultpage=%s', false, true); + $paginator = generate_paginator($page, ceil($rowcount / $pagesize), $result_url); + + $dataset = $log->get_data($page * $pagesize, $pagesize); + + $output->header(); + echo $paginator; + foreach ( $dataset as $row ) + { + echo LogDisplay::render_row($row) . '
'; + } + $output->footer(); +}