lilalo

view l3pre.php @ 148:266dae9ce2a1

mass upload
author igor@book.xt.vpn
date Tue Dec 16 00:18:23 2008 +0200 (2008-12-16)
parents e939c147dcdd
children 822b36252d7f
line source
1 <?
2 $wgExtensionFunctions[] = "wfLiLaLoExtension";
4 function wfLiLaLoExtension() {
5 global $wgParser;
6 $wgParser->setHook( "lilalo", "renderLiLaLoPRE" );
7 }
9 function renderLiLaLoPRE( $input ) {
10 preg_match('/[^\n]*l3: local_session_id=([0-9-]*)[^\n]*[\n]/', $input, $matches);
11 $session_id=$matches[1];
12 preg_match('/([0-9]*)-([0-9]*)/', $session_id, $matches);
13 $session_start_time = intval($matches[2]);
14 $hour=intval(date('G', $session_start_time));
15 $min=intval(date('i', $session_start_time));
16 $sec=intval(date('s', $session_start_time));
17 $input = preg_replace('/[^\n]*l3: local_session_id=([0-9-]*)[^\n]*[\n]/', '', $input);
18 $input = preg_replace('/((..):(..):(...)(#[^\n]*))/e',
19 '\'$2:$3:$4<b><a href="http://xgu.ru/l3?page='.$session_id.'&id='
20 .'\'.strval($session_start_time+3600*(intval("$2")-$hour)+60*(intval("$3")-$min)+1*(intval("$4")-$sec)).\''
21 .'">$5</a></b>\'',
22 $input);
23 # .strval($session_start_time+3600*(intval($2)-$hour)+60*(intval($3)-$min)+(intval($4)-$sec))
24 return "<pre>$hour:$min:$sec $input</pre>";
25 }
27 ?>