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

To join the OverTake Racing Club races I want them to be: (multiple choice)

  • Free to access

    Votes: 230 87.8%
  • Better structured events

    Votes: 48 18.3%
  • Better structured racing club forum

    Votes: 37 14.1%
  • More use of default game content

    Votes: 39 14.9%
  • More use of fixed setups

    Votes: 69 26.3%
  • No 3rd party registration pages

    Votes: 89 34.0%
  • Less casual events

    Votes: 23 8.8%
  • More casual events

    Votes: 85 32.4%
  • Other, specify in thread

    Votes: 14 5.3%
Back
Top