lilalo

annotate l3pre.php @ 147:94f587855947

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