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

How long have you been simracing

  • < 1 year

    Votes: 344 15.6%
  • < 2 years

    Votes: 235 10.7%
  • < 3 years

    Votes: 231 10.5%
  • < 4 years

    Votes: 175 7.9%
  • < 5 years

    Votes: 294 13.3%
  • < 10 years

    Votes: 256 11.6%
  • < 15 years

    Votes: 163 7.4%
  • < 20 years

    Votes: 124 5.6%
  • < 25 years

    Votes: 99 4.5%
  • Ok, I am a dinosaur

    Votes: 284 12.9%
Back
Top