Fix for the 'screwed up' posts in F1 2011 Setup Forums

Hi there,

it really annoys me, that the Posts in the Setup Forum ain't readable any more, so I coded a litte php script which does clean them up.

PHP:
<?php
 
// Connect to the Database
//$pdo = new PDO('mysql:host=127.0.0.1;dbname=forum', 'username','password');
// Select all post form the Racesetup Forum
//$sql = "SELECT ....";
 
// Sample post
$post = <<<EOF
[TABLE="class: grid"]
[TR]
[TD]Car
[/TD]
[TD]WILLIAMS
[/TD]
[/TR]
[TR]
[TD]Circuit
[/TD]
[TD]NURBURGRING
[/TD]
[/TR]
[TR]
[TD]Condition
[/TD]
[TD]WET
[/TD]
[/TR]
[TR]
[TD]Distance
[/TD]
[TD]20%
[/TD]
[/TR]
[TR]
[TD]Aerodynamics
[/TD]
[TD]Front Wing Angle: 9
Rear Wing Angle:11
[/TD]
[/TR]
[TR]
[TD]Braking
[/TD]
[TD]Balance: F 50% - R 50%
Pressure: MED
Brake Size:STND
[/TD]
[/TR]
[TR]
[TD]Balance
[/TD]
[TD]Front Anti-Roll Bar:11
Rear Anti-Roll Bar:11
[/TD]
[/TR]
[TR]
[TD]Suspension
[/TD]
[TD]Front Ride Height: 3
Rear Ride Height: 3
Front Spring Stiffness:11
Rear Spring Stiffness:11
[/TD]
[/TR]
[TR]
[TD]Gearbox
[/TD]
[TD]Gear 1: xxx kph / 6 left mph
Gear 2: xxx kph / 5 left mph
Gear 3: xxx kph / 4 left mph
Gear 4: xxx kph / 3 left mph
Gear 5: xxx kph / 2 left mph
Gear 6: xxx kph / 1 left mph
Gear 7: xxx kph / 196 mph
[/TD]
[/TR]
[TR]
[TD]Engine
[/TD]
[TD]Fuel Map: -
Fuel:full
[/TD]
[/TR]
[TR]
[TD]Alignment
[/TD]
[TD]Camber Front:-3.50
Camber Rear: 1.40
Toe Front: 0.08
Toe Rear:0.35
[/TD]
[/TR]
[TR]
[TD]Tyres
[/TD]
[TD]opt
[/TD]
[/TR]
[TR]
[TD]Notes
[/TD]
[TD]1.30.569 in dry 1.36 in wet
[/TD]
[/TR]
[/TABLE]
EOF;
$post = preg_replace('/\[TABLE="class: grid"\]\s/', '', $post);
$post = preg_replace('/\[TR\]\s\[TD\](\w+)\s\[\/TD\]\s\[TD\]/', "[B]\$1[/B]\n", $post);
$post = preg_replace('/\[\/TD\]\s\[\/TR\]/', "\n", $post);
$post = preg_replace('/\[\/TABLE\]\s/', '', $post);
 
print($post);
?>

Hope this helps!
 

Latest News

What's needed for simracing in 2024?

  • More games, period

  • Better graphics/visuals

  • Advanced physics and handling

  • More cars and tracks

  • AI improvements

  • AI engineering

  • Cross-platform play

  • New game Modes

  • Other, post your idea


Results are only viewable after voting.
Back
Top