diff -up -r phpbb2drupal/phpbb2drupal.install phpbb2drupal/phpbb2drupal.install
--- phpbb2drupal/phpbb2drupal.install	2008-02-09 19:36:37.000000000 -0600
+++ phpbb2drupal/phpbb2drupal.install	2011-03-29 18:31:46.000000000 -0500
@@ -44,4 +44,4 @@ function phpbb2drupal_install() {
 function phpbb2drupal_uninstall() {
   // Drop tables.
   drupal_uninstall_schema('phpbb2drupal');
-}
\ No newline at end of file
+}
diff -up -r phpbb2drupal/phpbb2drupal.module phpbb2drupal/phpbb2drupal.module
--- phpbb2drupal/phpbb2drupal.module	2009-10-03 13:02:13.000000000 -0500
+++ phpbb2drupal/phpbb2drupal.module	2011-03-29 18:31:47.000000000 -0500
@@ -11,7 +11,7 @@ function phpbb2drupal_menu() {
     'title' => 'phpBB to Drupal',
     'access callback' => 'user_access',
     'access arguments' => array('migrate phpBB'),
-    'page callback' => 'phpbb2drupal_main', 
+    'page callback' => 'phpbb2drupal_main',
     'file' => 'phpbb2drupal.pages.inc',
     'type' => MENU_NORMAL_ITEM,
   );
@@ -19,7 +19,7 @@ function phpbb2drupal_menu() {
     'title' => 'Post Migration Configuration',
     'access callback' => 'user_access',
     'access arguments' => array('migrate phpBB'),
-    'page callback' => 'phpbb2drupal_postconfiguration', 
+    'page callback' => 'phpbb2drupal_postconfiguration',
     'file' => 'phpbb2drupal.pages.inc',
     'type' => MENU_NORMAL_ITEM,
   );
@@ -27,21 +27,21 @@ function phpbb2drupal_menu() {
     'title' => 'Cleanup',
     'access callback' => 'user_access',
     'access arguments' => array('migrate phpBB'),
-    'page callback' => 'phpbb2drupal_cleanup', 
+    'page callback' => 'phpbb2drupal_cleanup',
     'type' => MENU_CALLBACK,
   );
   $items['admin/phpbb2drupal/migrate'] = array(
     'title' => 'Execute Migration',
     'access callback' => 'user_access',
     'access arguments' => array('migrate phpBB'),
-    'page callback' => 'phpbb2drupal_migrate', 
+    'page callback' => 'phpbb2drupal_migrate',
     'type' => MENU_CALLBACK,
   );
   $items['admin/phpbb2drupal/reset'] = array(
     'title' => 'Reset phpBB2 database URL',
     'access callback' => 'user_access',
     'access arguments' => array('migrate phpBB'),
-    'page callback' => 'phpbb2drupal_reset', 
+    'page callback' => 'phpbb2drupal_reset',
     'type' => MENU_CALLBACK,
   );
   $items['admin/settings/phpbb2drupal'] = array(
@@ -69,15 +69,15 @@ function phpbb2drupal_reset() {
   global $db_url;
   variable_set('phpbb2drupal_db_url', $db_url);
   variable_set('phpbb2drupal_ready', 0);
-  return '<p>'. t('The phpBB2 database URL has been reset. You may now <a href="@configlink">go back to the configuration page</a>.',
-      array('@configlink' => url('admin/settings/phpbb2drupal'))) .'</p>';
+  return '<p>' . t('The phpBB2 database URL has been reset. You may now <a href="@configlink">go back to the configuration page</a>.',
+      array('@configlink' => url('admin/settings/phpbb2drupal'))) . '</p>';
 }
 
 /**
  * Callback admin/phpbb2drupal/cleanup
  */
 function phpbb2drupal_cleanup() {
-  return phpbb2drupal_import_cleanup() .'<p>'. t('Drupal database cleaned.') .'</p>';
+  return phpbb2drupal_import_cleanup() . '<p>' . t('Drupal database cleaned.') . '</p>';
 }
 
 /**
@@ -90,13 +90,13 @@ function phpbb2drupal_cleanup() {
  * fails, the process will die() which is a bit too much since we only
  * want to test. Therefore, the test part of the code is not used, now.
  */
-function _phpbb2drupal_db_connect($test= 0) {
+function _phpbb2drupal_db_connect($test = 0) {
   global $db_url;
   $same = variable_get('phpbb2drupal_same_db', 1);
   if (!$same) {
     $db_url2['phpbb'] = variable_get('phpbb2drupal_db_url', $db_url);
     $db_url2['default'] = $db_url;
-    $GLOBALS['db_url'] =& $db_url2;
+    $GLOBALS['db_url'] = &$db_url2;
     if ($test) {
       if (!db_connect($db_url2['phpbb'])) {
         return 0;
@@ -104,12 +104,12 @@ function _phpbb2drupal_db_connect($test=
     }
   }
   return 1;
-  
+
 }
 
 /**
  * Check if the module is enabled.
- * 
+ *
  * @return array
  *    $out['html'] = formatted html.
  *    $out['result'] = boolean.
@@ -119,10 +119,10 @@ function _phpbb2drupal_check_module($mod
   $result = module_exists($module);
   $out['result'] = $result;
   if ($result == 1) {
-    $out['html'] .= '<li>'. t('Module %module is enabled. OK!', array('%module' => $module)) .'</li>';
+    $out['html'] .= '<li>' . t('Module %module is enabled. OK!', array('%module' => $module)) . '</li>';
   }
   else {
-    $out['html'] .= '<li><span class="marker">'. t('Module %module is disabled.', array('%module' => $module)) .'</span></li>';
+    $out['html'] .= '<li><span class="marker">' . t('Module %module is disabled.', array('%module' => $module)) . '</span></li>';
   }
   $out['html'] .= '</ul>';
   return $out;
@@ -130,37 +130,37 @@ function _phpbb2drupal_check_module($mod
 
 /**
  * Check if the sql tables are installed.
- * 
+ *
  * @return array
  *   $out['html'] = formatted html.
  *   $out['result'] = boolean.
  */
-function _phpbb2drupal_check_tables( $tables = array(), $db = 'default' , $prefix = 1) {
+function _phpbb2drupal_check_tables( $tables = array(), $db = 'default', $prefix = 1) {
   _phpbb2drupal_db_connect();
 
   $out['html'] = '<ul>';
-  $out['result']= 1;
+  $out['result'] = 1;
   foreach ($tables as $table) {
     if ($prefix) {
-      $table = db_prefix_tables('{'. $table .'}');
-    }  
+      $table = db_prefix_tables('{' . $table . '}');
+    }
 
     db_set_active($db);
     if ($GLOBALS['db_type'] == 'pgsql') {
       // adapt from db_table_exists in database.pgsql.inc
       $result = (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '%s'", $table));
-	}
-	else {
+    }
+    else {
       // adapt from db_table_exists in database.mysql.inc
       $result = (bool) db_fetch_object(db_query("SHOW TABLES LIKE '%s'", $table));
     }
     db_set_active('default');
     if ($result) {
-      $out['html'] .= '<li>'. t('Table %table: OK!', array('%table' => $table)) .'</li>';
+      $out['html'] .= '<li>' . t('Table %table: OK!', array('%table' => $table)) . '</li>';
     }
     else {
-      $out['html'] .= '<li><span class="marker">'. t('Table <strong>%table</strong> does not exist!', array('%table' => $table)) .'</span></li>';
-      $out['result']= 0;
+      $out['html'] .= '<li><span class="marker">' . t('Table <strong>%table</strong> does not exist!', array('%table' => $table)) . '</span></li>';
+      $out['result'] = 0;
     }
   }
   $out['html'] .= '</ul>';
@@ -171,7 +171,7 @@ function _phpbb2drupal_check_tables( $ta
 
 function phpbb2drupal_migrate() {
   if (!variable_get('phpbb2drupal_ready', 0)) {
-    return '<p>'. t('You cannot migrate the data now. Please <a href="@settings">complete the setup first</a>', array('@settings' => url('admin/settings/phpbb2drupal'))) .'</p>';
+    return '<p>' . t('You cannot migrate the data now. Please <a href="@settings">complete the setup first</a>', array('@settings' => url('admin/settings/phpbb2drupal'))) . '</p>';
   }
 
   $output = 'Phpbb 2 Drupal Migration Form';
@@ -180,7 +180,7 @@ function phpbb2drupal_migrate() {
 }
 
 function phpbb2drupal_migrate_form() {
-  _phpbb2drupal_db_connect() ;
+  _phpbb2drupal_db_connect();
   // Causes problems with form api redirect
   //ini_set('display_errors', TRUE);
 
@@ -188,7 +188,7 @@ function phpbb2drupal_migrate_form() {
   if (!ini_get('safe_mode')) {
     set_time_limit(variable_get('phpbb2drupal_time_limit', 0));
   }
-  
+
   $PHPBB2DRUPAL_FUNCTIONS = array(
     'users' => t('Import Users'),
     'categories' => t('Import Categories'),
@@ -233,7 +233,7 @@ function phpbb2drupal_migrate_form_submi
       }
       break;
 
-    case 'topics':      
+    case 'topics':
       phpbb2drupal_import_topics();
       if (!variable_get('phpbb2drupal_import_topic_successful', 0)) {
         $_SESSION['phpbb2drupal_selected'] = 'topics';
@@ -242,7 +242,7 @@ function phpbb2drupal_migrate_form_submi
         $_SESSION['phpbb2drupal_selected'] = 'posts';
       }
       break;
-      
+
     case 'posts':
       phpbb2drupal_import_posts();
       if (!variable_get('phpbb2drupal_import_post_successful', 0)) {
@@ -260,7 +260,7 @@ function phpbb2drupal_migrate_form_submi
       }
       else {
         drupal_set_message('Congratulations.  Import Finished');
-        drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/phpbb2drupal/postconfiguration') .' page');
+        drupal_set_message('Please visit the ' . l('Post migration configuration', 'admin/phpbb2drupal/postconfiguration') . ' page');
         unset($_SESSION['phpbb2drupal_selected']);
       }
       break;
@@ -280,7 +280,7 @@ function phpbb2drupal_import_users() {
   if (variable_get('phpbb2drupal_import_user_successful', 0)) {
     drupal_set_message(t('Users already imported successfully'));
     return;
-  }  
+  }
 
   if (variable_get('phpbb2drupal_import_user_started', 0) == 0) {
     // create temporary tables
@@ -289,25 +289,25 @@ function phpbb2drupal_import_users() {
     // create profile fields for icq, aim, msn...etc
     $querybase = 'INSERT INTO {profile_fields} (title, name, explanation, category, page, type, weight, required, register, visibility, options) VALUES ';
 
-    $query = $querybase ."('YIM', 'user_yim', '', 'Contact', '', 'textfield', 0, 0, 1, 2, '')";
+    $query = $querybase . "('YIM', 'user_yim', '', 'Contact', '', 'textfield', 0, 0, 1, 2, '')";
     db_query($query);
 
-    $query = $querybase ."('AIM', 'user_aim', '', 'Contact', '', 'textfield', 0, 0, 1, 2, '')";
+    $query = $querybase . "('AIM', 'user_aim', '', 'Contact', '', 'textfield', 0, 0, 1, 2, '')";
     db_query($query);
-    
-    $query = $querybase ."('icq', 'user_icq', '', 'Contact', '', 'textfield', 0, 0, 1, 2, '')";
+
+    $query = $querybase . "('icq', 'user_icq', '', 'Contact', '', 'textfield', 0, 0, 1, 2, '')";
     db_query($query);
-    
-    $query = $querybase ."('Website', 'user_website', '', 'Contact', '', 'url', 0, 0, 1, 2, '')";
+
+    $query = $querybase . "('Website', 'user_website', '', 'Contact', '', 'url', 0, 0, 1, 2, '')";
     db_query($query);
 
-    $query = $querybase ."('Location', 'user_from', '', 'Personal', '', 'textfield', 0, 0, 1, 2, '')";
+    $query = $querybase . "('Location', 'user_from', '', 'Personal', '', 'textfield', 0, 0, 1, 2, '')";
     db_query($query);
 
-    $query = $querybase ."('Occupation', 'user_occ', '', 'Personal', '', 'textfield', 0, 0, 1, 2, '')";
+    $query = $querybase . "('Occupation', 'user_occ', '', 'Personal', '', 'textfield', 0, 0, 1, 2, '')";
     db_query($query);
 
-    $query = $querybase ."('Interests', 'user_interests', '', 'Personal', '', 'textfield', 0, 0, 1, 2, '')";
+    $query = $querybase . "('Interests', 'user_interests', '', 'Personal', '', 'textfield', 0, 0, 1, 2, '')";
     db_query($query);
 
     variable_set('phpbb2drupal_import_user_started', 1);
@@ -327,14 +327,14 @@ function phpbb2drupal_import_users() {
   $user_count = db_result(db_query('SELECT COUNT(*) FROM %susers WHERE user_id > 2', $pre));
 
   if (!$user_count) {
-      drupal_set_message(t('There were no users found: Aborting script'), 'error');
-      return t('There were no users found: Aborting script.');
+    drupal_set_message(t('There were no users found: Aborting script'), 'error');
+    return t('There were no users found: Aborting script.');
   }
 
   drupal_set_message(t('Found %user_count users: Beginning Import', array('%user_count' => $user_count + 1)));
-  
+
   $import_spammers = variable_get('phpbb2drupal_import_spammers', 1);
-  
+
   while ($result = db_fetch_object($user_ids)) {
 
     db_set_active('phpbb');
@@ -343,60 +343,60 @@ function phpbb2drupal_import_users() {
     // If we don't want to import users who have never posted, break this while loop here.
     if ($import_spammers == 1 || $user->user_posts != 0 ) {
 
-    // Make sure the user is has not already been imported
-    db_set_active('default');
-    $count = db_result(db_query('SELECT COUNT(*) FROM {phpbb2drupal_temp_user} WHERE user_id = %d', $user->user_id));
-    if ($count > 0) {
+      // Make sure the user is has not already been imported
+      db_set_active('default');
+      $count = db_result(db_query('SELECT COUNT(*) FROM {phpbb2drupal_temp_user} WHERE user_id = %d', $user->user_id));
+      if ($count > 0) {
         $user->user_active = 0;
-    }
+      }
 
-    $user->user_aim = strtr($user->user_aim, array('+' => ' ')); # PHPBB stores spaces as +, replace with ' '
-    $user->user_yim = strtr($user->user_yim, array('+' => ' '));
-    $user->user_timezone = $user->user_timezone * 60 * 60;  # Drupal stores timezones in seconds
-
-    // if the $user->user_avatar_type is not their own image, delete it
-    // drupal doesn't have pre-defined avatars.   if we were to import it
-    // then multiple people would share the same avatar image and if one user 
-    // were to changes their avatar then it would change it for everybody else.
-    if ($user->user_avatar_type > 1) {
+      $user->user_aim = strtr($user->user_aim, array('+' => ' ')); # PHPBB stores spaces as +, replace with ' '
+      $user->user_yim = strtr($user->user_yim, array('+' => ' '));
+      $user->user_timezone = $user->user_timezone * 60 * 60; # Drupal stores timezones in seconds
+
+      // if the $user->user_avatar_type is not their own image, delete it
+      // drupal doesn't have pre-defined avatars.   if we were to import it
+      // then multiple people would share the same avatar image and if one user
+      // were to changes their avatar then it would change it for everybody else.
+      if ($user->user_avatar_type > 1) {
         $user->user_avatar = '';
-    }
+      }
 
-    $user->user_avatar = ($user->user_avatar) ? "$files_path/$pictures_path/$user->user_avatar" : '';
+      $user->user_avatar = ($user->user_avatar) ? "$files_path/$pictures_path/$user->user_avatar" : '';
 
-    // remove the :bbcode_uid from signature
-    if(!empty($user->user_sig_bbcode_uid)) {
-      $user->user_sig = preg_replace("/:$user->user_sig_bbcode_uid/", '', $user->user_sig);
-    }
-    $signature = _phpbb2drupal_strip_bbcode($user->user_sig);
-    $signature = _phpbb2drupal_text_sanitise($signature);
-    
-    // Signatures for Forums module supports longer values than default 255 chars
-    // http://drupal.org/project/signature_forum0
-    if(!module_exists('signature_forum')) {
-      $signature = substr($signature, 0, 255);
-    }
-    
-    if (variable_get('phpbb2drupal_regdate_us_english', 0)) {
-      $user_regdate = strtotime($user->user_regdate);
-      $user_lastvisit = strtotime($user->user_lastvisit);
-      $user_session_time = strtotime($user->user_session_time);
-    }
-    else {
-      $user_regdate = $user->user_regdate;
-      $user_lastvisit = $user->user_lastvisit;
-      $user_session_time = $user->user_session_time;
-    }
-    
-    //phpbb3 stores user status in user_type instead of user_active as phpbb2 did. inactive users get an id of 1. there are other status too, no idea what they mean.
-    //KISS - user_type of 1 = inactive. The rest mean active.
-    //further complication - duplicate check sets $user->user_active to 0 if the user is a duplicate.
-    //Assume the only time the $user->user_active is set before now is in duplicate check and nothing is taken from database - so php isset() should work.
-    if ($user->user_type <> 1 && !(isset($user->user_active))) {
-      $user->user_active = 1;
-    }
+      // remove the :bbcode_uid from signature
+      if (!empty($user->user_sig_bbcode_uid)) {
+        $user->user_sig = preg_replace("/:$user->user_sig_bbcode_uid/", '', $user->user_sig);
+      }
+      $signature = _phpbb2drupal_strip_bbcode($user->user_sig);
+      $signature = _phpbb2drupal_text_sanitise($signature);
+
+      // Signatures for Forums module supports longer values than default 255 chars
+      // http://drupal.org/project/signature_forum0
+      if (!module_exists('signature_forum')) {
+        $signature = substr($signature, 0, 255);
+      }
 
-    $data = array(
+      if (variable_get('phpbb2drupal_regdate_us_english', 0)) {
+        $user_regdate = strtotime($user->user_regdate);
+        $user_lastvisit = strtotime($user->user_lastvisit);
+        $user_session_time = strtotime($user->user_session_time);
+      }
+      else {
+        $user_regdate = $user->user_regdate;
+        $user_lastvisit = $user->user_lastvisit;
+        $user_session_time = $user->user_session_time;
+      }
+
+      //phpbb3 stores user status in user_type instead of user_active as phpbb2 did. inactive users get an id of 1. there are other status too, no idea what they mean.
+      //KISS - user_type of 1 = inactive. The rest mean active.
+      //further complication - duplicate check sets $user->user_active to 0 if the user is a duplicate.
+      //Assume the only time the $user->user_active is set before now is in duplicate check and nothing is taken from database - so php isset() should work.
+      if ($user->user_type <> 1 && !(isset($user->user_active))) {
+        $user->user_active = 1;
+      }
+
+      $data = array(
       'name' => substr($user->username, 0, 60),
       'pass' => $user->user_password,
       'mail' => substr($user->user_email, 0, 64),
@@ -407,7 +407,7 @@ function phpbb2drupal_import_users() {
       'access' => $user_lastvisit,
       'login' => $user_lastvisit,
       'status' => $user->user_active,
-      'timezone' => $user->user_timezone, 
+      'timezone' => $user->user_timezone,
       'picture' => $user->user_avatar,
       'init' => substr($user->user_email, 0, 64),
       'roles' => array(0 => 2),                       # Authenticated User
@@ -420,20 +420,20 @@ function phpbb2drupal_import_users() {
       'user_occ' => $user->user_occ,
       'user_interests' => $user->user_interest
       );
-    if (variable_get('phpbb2drupal_import_pm', 0)) {
-      $data['privatemsg_allow'] = 1;
-    }
-    
-    $data['interests'] = _phpbb2drupal_text_sanitise($data['interests']);
+      if (variable_get('phpbb2drupal_import_pm', 0)) {
+        $data['privatemsg_allow'] = 1;
+      }
 
-    db_set_active('default');
-    $drupal_user = phpbb2drupal_user_save($data, array('account', 'Personal', 'Contact'));
+      $data['interests'] = _phpbb2drupal_text_sanitise($data['interests']);
 
-    // populate the temporary user table
-    db_set_active('default');
-    db_query('INSERT INTO {phpbb2drupal_temp_user} (user_id, uid) VALUES ( %d, %d )', $user->user_id , $drupal_user->uid);
+      db_set_active('default');
+      $drupal_user = phpbb2drupal_user_save($data, array('account', 'Personal', 'Contact'));
 
-    db_set_active('phpbb');
+      // populate the temporary user table
+      db_set_active('default');
+      db_query('INSERT INTO {phpbb2drupal_temp_user} (user_id, uid) VALUES ( %d, %d )', $user->user_id, $drupal_user->uid);
+
+      db_set_active('phpbb');
     }
   }
 
@@ -456,7 +456,7 @@ function phpbb2drupal_import_categories(
   if (variable_get('phpbb2drupal_import_category_successful', 0)) {
     drupal_set_message(t('Categories already imported successfully'));
     return;
-  }    
+  }
 
   // Retrieve the vocabulary vid named "Forum".
   $forum_vid = variable_get('forum_nav_vocabulary', 0);
@@ -483,7 +483,7 @@ function phpbb2drupal_import_categories(
       $forum['description'] = _phpbb2drupal_text_sanitise($forum['description']);
 
       taxonomy_save_term($forum);
-        
+
       // serialize the forum containers
       if ($result->forum_type == 0) {
         //This is a category
@@ -494,7 +494,7 @@ function phpbb2drupal_import_categories(
       //save the container to the forum table - yes this is hackish.
       db_query('INSERT INTO {phpbb2drupal_temp_forum} (forum_id, tid) VALUES (%d, %d)', $result->forum_id, $forum['tid']);
     }
-  db_set_active('phpbb');
+    db_set_active('phpbb');
   }
   db_set_active('default');
   // set the forums import successful flag in the variable table
@@ -530,42 +530,42 @@ function phpbb2drupal_import_topics() {
   $counter = 0;
   db_set_active('phpbb');
   while ($result = db_fetch_object($topic_ids)) {
-      
+
     // check if this topic has been imported already just to be sure
     db_set_active('default');
     $count = db_result(db_query('SELECT count(*) FROM {phpbb2drupal_temp_topic} WHERE topic_id = %d', $result->topic_id));
     if ($count > 0) {
       db_set_active('phpbb');
       continue;
-    } 
+    }
 
     db_set_active('phpbb');
 
     $query = db_query('SELECT *
       FROM %stopics t
       INNER JOIN %sposts p ON t.topic_id = p.topic_id WHERE p.post_id = t.topic_first_post_id
-      AND t.topic_id = %d',$pre, $pre, $result->topic_id);
+      AND t.topic_id = %d', $pre, $pre, $result->topic_id);
 
     $querycount = db_query('SELECT COUNT(*)
       FROM %stopics t
       INNER JOIN %sposts p ON t.topic_id = p.topic_id WHERE p.post_id = t.topic_first_post_id
-      AND t.topic_id = %d',$pre, $pre, $result->topic_id);
+      AND t.topic_id = %d', $pre, $pre, $result->topic_id);
+
 
-      
     // check if the topic is a valid topic.  if not, continue on
     if (db_result($querycount)) {
-        $topic = db_fetch_object($query);
+      $topic = db_fetch_object($query);
     }
     else {
-      drupal_set_message(t('Could not find post details of topic: %topic_id', array('%topic_id' => $result->topic_id)));    
+      drupal_set_message(t('Could not find post details of topic: %topic_id', array('%topic_id' => $result->topic_id)));
       continue;
     }
-    
+
     db_set_active('default');
     $uid = db_result(db_query('SELECT uid FROM {phpbb2drupal_temp_user} WHERE user_id = %d', $topic->topic_poster));
     $tid = db_result(db_query('SELECT tid FROM {phpbb2drupal_temp_forum} WHERE forum_id = %d', $topic->forum_id));
 
-    if ($topic->topic_poster == 2) {   // is the admin
+    if ($topic->topic_poster == 2) { // is the admin
       $user = user_load(array('name' => variable_get('phpbb2drupal_admin_user', '')));
       $uid = $user->uid;
     }
@@ -574,12 +574,12 @@ function phpbb2drupal_import_topics() {
     }
 
     if ($topic->topic_type == 1) {
-      $sticky = 1;      // sticky
+      $sticky = 1; // sticky
       $promote = 0;
     }
     else if ($topic->topic_type == 2) {
       $sticky = 1;
-      $promote = 0;     // display on the front page, i.e. promote
+      $promote = 0; // display on the front page, i.e. promote
     }
     else {
       $sticky = 0;
@@ -587,14 +587,14 @@ function phpbb2drupal_import_topics() {
     }
 
     if ($topic->topic_status == 1) { // LOCKED
-      $comment = 1;  // read-only
+      $comment = 1; // read-only
     }
     else { // UNLOCKED & WATCH NOTIFIED
-      $comment = 2;  // read-write
+      $comment = 2; // read-write
     }
 
     // remove the bbcode_uid from post_text
-    if(!empty($topic->bbcode_uid)) {
+    if (!empty($topic->bbcode_uid)) {
       $topic->post_text = preg_replace("/:$topic->bbcode_uid/", '', $topic->post_text);
     }
     $topic->post_text = _phpbb2drupal_strip_bbcode($topic->post_text);
@@ -630,13 +630,13 @@ function phpbb2drupal_import_topics() {
       db_set_active('default');
       $moved_tid = db_result(db_query('SELECT tid FROM {phpbb2drupal_temp_forum} WHERE forum_id = %d', $forum_id));
 
-      $node['tid'] = $moved_tid;        // which forum it used to be part of
+      $node['tid'] = $moved_tid; // which forum it used to be part of
     }
     else {
       $node['tid'] = $tid;
     }
 
-    $node = (object)$node; // node_save requires an object form
+    $node = (object) $node; // node_save requires an object form
 
     db_set_active('default');
     node_save($node);
@@ -697,7 +697,7 @@ function phpbb2drupal_import_posts() {
   if (variable_get('phpbb2drupal_import_post_successful', 0)) {
     drupal_set_message(t('Posts already imported successfully'));
     return;
-  }    
+  }
 
   if (!variable_get('phpbb2drupal_import_post_started', 0)) {
     db_set_active('default');
@@ -707,7 +707,7 @@ function phpbb2drupal_import_posts() {
   db_set_active('phpbb');
 
   $topic_ids = db_query('SELECT topic_id, topic_first_post_id, topic_last_post_id
-    FROM %stopics 
+    FROM %stopics
     WHERE topic_replies > 0
     ORDER BY topic_id', $pre);
 
@@ -764,18 +764,18 @@ function phpbb2drupal_import_posts() {
 
       $pid = (is_null($pid)) ? 0 : $pid;
 
-      if ($post->poster_id == 2) {   // is the admin
+      if ($post->poster_id == 2) { // is the admin
         $user = user_load(array('name' => variable_get('phpbb2drupal_admin_user', '')));
         $uid = $user->uid;
       }
       else if ($post->poster_id == -1) { // anonymous
-        $uid = 0; 
-      }    
+        $uid = 0;
+      }
 
       $hostname = phpbb2drupal_decode_ip($post->poster_ip);
 
       // remove the :bbcode_uid from post_text
-      if(!empty($post->bbcode_uid)) {
+      if (!empty($post->bbcode_uid)) {
         $post->post_text = preg_replace("/:$post->bbcode_uid/", '', $post->post_text);
       }
       $post->post_text = _phpbb2drupal_strip_bbcode($post->post_text);
@@ -806,7 +806,7 @@ function phpbb2drupal_import_posts() {
         $errors++;
         drupal_set_message(t('Failed importing %post_id', array('%post_id' => $post->post_id)));
       }
-            
+
       // Handle attachments
       if ($PHPBB2DRUPAL_IMPORT_ATTACHMENTS) {
         if ($post->post_attachment == 1) {
@@ -823,7 +823,7 @@ function phpbb2drupal_import_posts() {
             $fid = db_last_insert_id('files', 'fid');
             db_query("INSERT INTO {comment_upload} (fid, nid, cid, description, list, weight) VALUES (%d, %d, %d, '%s', %d, %d)", $fid, $nid, $cid, substr($file->real_filename, 0, 255), 1, $file->attach_id);
             db_set_active('phpbb');
-          }        
+          }
         }
       }
 
@@ -849,7 +849,7 @@ function phpbb2drupal_import_cleanup() {
   $pre = variable_get('phpbb2drupal_table_prefix', 'phpbb_');
 
   #
-  # Update Drupal sequence 
+  # Update Drupal sequence
   #
   db_set_active('default');
   $term_data_tid = db_result(db_query('SELECT MAX(tid) FROM {term_data}'));
@@ -875,7 +875,7 @@ function phpbb2drupal_import_cleanup() {
     db_query("DELETE FROM {sequences} WHERE name='files_fid'");
     db_query("INSERT INTO {sequences} (name,id) VALUES ('files_fid', '%s')", $files_fid);
   }
-  
+
   variable_del('phpbb2drupal_import_user_successful');
   variable_del('phpbb2drupal_import_user_started');
   variable_del('phpbb2drupal_import_category_successful');
@@ -895,7 +895,7 @@ function phpbb2drupal_import_cleanup() {
   variable_del('phpbb2drupal_time_limit');
   variable_del('phpbb2drupal_import_spammers');
   variable_del('phpbb2drupal_import_attachments');
-  variable_del('phpbb2drupal_import_polls'); 
+  variable_del('phpbb2drupal_import_polls');
   variable_del('phpbb2drupal_import_poll_started');
   variable_del('phpbb2drupal_import_poll_successful');
   variable_del('phpbb2drupal_import_pm_successful');
@@ -915,23 +915,23 @@ function phpbb2drupal_user_save($phpbb_u
 
   if (!($user = user_load(array('name' => $phpbb_user['name'])))) {
     $account = new stdClass();
-    $account->uid = FALSE; 
+    $account->uid = FALSE;
     $user = user_save($account, $phpbb_user);
-    //Drupal overrides the phpBB user registration date when creating a Drupal account. 
+    //Drupal overrides the phpBB user registration date when creating a Drupal account.
     //so we need to update it here.
     $user = user_save($user, array('created' => $phpbb_user['created']));
-    
+
     if ($phpbb_user['pass'] && strlen($phpbb_user['pass']) <> 32 && substr($phpbb_user['pass'], 0, 2) == '$H') {
       // Update the password:import the phpass hash into Drupal phpass mopdule table after modifying the hash identifier - phpbb3 uses $H$ while phpass uses $P$ at the start of every phpass hash
       // set the normal password as plain 'phpass'. This is needed for the phpass module as it uses the count of passwords as 'phpass' when calculatign wether or not to allow the module to be deactivated.
-      $hash = substr_replace($phpbb_user['pass'],'$P', 0, 2);
+      $hash = substr_replace($phpbb_user['pass'], '$P', 0, 2);
       $result = db_query("UPDATE {users} SET pass = 'phpass' WHERE uid = %d", $user->uid);
       $result = db_query("INSERT INTO {user_phpass} (hash, uid) VALUES ('%s', %d)", $hash, $user->uid);
 
     }
     elseif ($phpbb_user['pass']) {
-    //The password has NOT been converted from md5 to phpass yet
-    $result = db_query("UPDATE {users} SET pass = '%s' WHERE uid = %d", $phpbb_user['pass'], $user->uid);
+      //The password has NOT been converted from md5 to phpass yet
+      $result = db_query("UPDATE {users} SET pass = '%s' WHERE uid = %d", $phpbb_user['pass'], $user->uid);
     }
   }
   $phpbb_user['uid'] = $user->uid;
@@ -954,7 +954,7 @@ function phpbb2drupal_profile_save_profi
     // Mark field as handled (prevents saving to user->data).
     $edit[$field->name] = NULL;
   }
-} 
+}
 
 function phpbb2drupal_comment_save($edit) {
   db_set_active('default');
@@ -967,7 +967,7 @@ function phpbb2drupal_comment_save($edit
 
     // Strip the "/" from the end of the thread.
     $max = rtrim($max, '/');
-    $thread = int2vancode(vancode2int($max)+1) .'/';
+    $thread = int2vancode(vancode2int($max) + 1) . '/';
 
   }
   else {
@@ -985,7 +985,7 @@ function phpbb2drupal_comment_save($edit
 
     if ($max == '') {
       // First child of this parent.
-      $thread = $parent->thread .'.'. int2vancode(1) .'/';
+      $thread = $parent->thread . '.' . int2vancode(1) . '/';
     }
     else {
       // Strip the "/" at the end of the thread.
@@ -997,15 +997,15 @@ function phpbb2drupal_comment_save($edit
       $last = $parts[$parent_depth];
 
       // Finally, build the thread field for this new comment.
-      $thread = $parent->thread .'.'. int2vancode(vancode2int($last) + 1) .'/';
-    } 
+      $thread = $parent->thread . '.' . int2vancode(vancode2int($last) + 1) . '/';
+    }
   }
 
-  $status = 0;                        // 1 - not published, 0 - published
+  $status = 0; // 1 - not published, 0 - published
   $format = variable_get('phpbb2drupal_input_format', 0);
-  $score = 0;                         // 0 default value, comments get higher score depending on the author's roles
-  $users = serialize(array(0 => 1));  // default value for everybody!!
-  
+  $score = 0; // 0 default value, comments get higher score depending on the author's roles
+  $users = serialize(array(0 => 1)); // default value for everybody!!
+
   if ($edit['uid'] === $user->uid) { // '===' because we want to modify anonymous users too
     $edit['name'] = $user->name;
   }
@@ -1022,7 +1022,7 @@ function phpbb2drupal_comment_save($edit
  */
 function phpbb2drupal_decode_ip($int_ip) {
   $hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
-  return hexdec($hexipbang[0]) .'.'. hexdec($hexipbang[1]) .'.'. hexdec($hexipbang[2]) .'.'. hexdec($hexipbang[3]);
+  return hexdec($hexipbang[0]) . '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
 }
 
 /**
@@ -1044,7 +1044,7 @@ function _phpbb2drupal_strip_bbcode($tex
   // If bbcode conversion to has been selected, the following will convert the bbcode to normal html.
   if (variable_get('phpbb2drupal_bbcode', 0)) {
     $input_format = variable_get('phpbb2drupal_input_format', 0);
-    $text = bbcode_filter('process', 0 , $input_format, $text);
+    $text = bbcode_filter('process', 0, $input_format, $text);
   }
   return $text;
 }
@@ -1061,21 +1061,21 @@ function _phpbb2drupal_text_sanitise($te
 function _phpbb2drupal_replace_links_topic($matches) {
   //print_r($matches);
   $result = db_result(db_query('SELECT nid FROM {phpbb2drupal_temp_topic} WHERE topic_id = %d', $matches[1]));
-  $link = 'node/'. $result . $matches[2];
+  $link = 'node/' . $result . $matches[2];
   return $link;
 }
 
 function _phpbb2drupal_replace_links_post($matches) {
   //print_r($matches);
   $result = db_fetch_object(db_query('SELECT c.cid, c.nid FROM {phpbb2drupal_temp_post} p JOIN {comments} c ON c.cid = p.cid WHERE post_id = %d', $matches[1]));
-  $link = 'node/'. $result->nid .'#comment-'. $result->cid . $matches[3];
+  $link = 'node/' . $result->nid . '#comment-' . $result->cid . $matches[3];
   return $link;
 }
 
 function _phpbb2drupal_replace_links_forum($matches) {
   //print_r($matches);
   $result = db_fetch_object(db_query('SELECT tid FROM {phpbb2drupal_temp_forum} WHERE forum_id = %d', $matches[1]));
-  $link = 'forum/'. $result->tid . $matches[2] ;
+  $link = 'forum/' . $result->tid . $matches[2];
   return $link;
 }
 
@@ -1100,7 +1100,7 @@ function _phpbb2drupal_replace_links($ht
  */
 function phpbb2drupal_replace_url() {
   db_set_active('default');
-  
+
   // transform nodes:
   // As the topics have just been imported, there is only one vid for each nid,
   // so the query works as it is.
@@ -1119,4 +1119,4 @@ function phpbb2drupal_replace_url() {
   }
 
   variable_set('phpbb2drupal_replace_url_successful', '1');
-}
\ No newline at end of file
+}
diff -up -r phpbb2drupal/phpbb2drupal.pages.inc phpbb2drupal/phpbb2drupal.pages.inc
--- phpbb2drupal/phpbb2drupal.pages.inc	2009-06-29 20:31:33.000000000 -0500
+++ phpbb2drupal/phpbb2drupal.pages.inc	2011-03-29 18:31:47.000000000 -0500
@@ -5,9 +5,9 @@
  * Callback admin/settings/phpbb2drupal
  */
 function phpbb2drupal_admin_settings() {
-  global $conf ;
+  global $conf;
   global $db_url;
-  $stage = variable_get('phpbb2drupal_config_stage', 0); 
+  $stage = variable_get('phpbb2drupal_config_stage', 0);
 
   //We'll be checking that the setup is complete.
   //If it is not complete, the migration will not go ahead.
@@ -20,10 +20,10 @@ function phpbb2drupal_admin_settings() {
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
   );
-    
+
   $output = '';
   if (!variable_get('phpbb2drupal_tested', 0)) {
-    $form['test']['#collapsed']= FALSE;
+    $form['test']['#collapsed'] = FALSE;
     $output = '<span class="marker">';
     $ready_for_migration = 0;
   }
@@ -42,7 +42,7 @@ function phpbb2drupal_admin_settings() {
     '#default_value' => variable_get('phpbb2drupal_tested', 0),
     '#description' => '',
   );
-     
+
   // Where is phpbb data?
   $form['phpbb_data'] = array(
     '#type' => 'fieldset',
@@ -60,9 +60,9 @@ function phpbb2drupal_admin_settings() {
   if (variable_get('phpbb2drupal_same_db', 1) != 1) {
     $url = variable_get('phpbb2drupal_db_url', $db_url);
     if ($url == $db_url) {
-      $output = '<p class="marker">'. t('Set the address of the phpBB database according to the following format: <br /><pre>mysql://phpbb_username:phpbb_password@localhost/phpbb_database</pre>') .'</p>';
+      $output = '<p class="marker">' . t('Set the address of the phpBB database according to the following format: <br /><pre>mysql://phpbb_username:phpbb_password@localhost/phpbb_database</pre>') . '</p>';
       $ready_for_migration = 0;
-      $form['phpbb']['#collapsed']= FALSE;
+      $form['phpbb']['#collapsed'] = FALSE;
     }
 
     $form['phpbb_data']['phpbb2drupal_db_url'] = array(
@@ -78,7 +78,7 @@ function phpbb2drupal_admin_settings() {
   $output = t('<p>Note that due to a limitation within Drupal core, we cannot import messages from one database type to another database type. E.g, we cannot import phpBB from a myqsl DB, to a postgresql DB. You need to import the data into the same type of database first (import all the phpBB data, as is, from mysql to postgresql.</p>
     <p>If both phpBB and Drupal are on postgresql, see <a href="http://drupal.org/node/64877">this issue</a>.</p>');
   $form['phpbb_data']['note'] = array('#value' => $output);
-  
+
   // phpBB2 table prefix
   $output = '';
   $form['phpbb_data']['phpbb2drupal_table_prefix'] = array(
@@ -91,14 +91,14 @@ function phpbb2drupal_admin_settings() {
   );
   $pre = variable_get('phpbb2drupal_table_prefix', 'phpbb_');
 
-  $tables = array($pre .'forums', $pre .'posts', $pre .'topics', $pre .'users');
+  $tables = array($pre . 'forums', $pre . 'posts', $pre . 'topics', $pre . 'users');
 
   $result = _phpbb2drupal_check_tables($tables, 'phpbb', 0);
   $output .= $result['html'];
-  
+
   if ($result['result'] != 1) {
     $ready_for_migration = 0;
-    $form['phpbb_data']['#collapsed']= FALSE;
+    $form['phpbb_data']['#collapsed'] = FALSE;
     $output .= '<span class="marker">';
     $output .= t("Some tables couldn't be found. This can be caused by an incorrect prefix or if your phpbb version is incorrectly set. Please correct the errors so that the phpBB tables can be accessed.");
     $output .= '</span>';
@@ -114,7 +114,7 @@ function phpbb2drupal_admin_settings() {
     '#collapsed' => TRUE,
   );
 
-  // Time limit 
+  // Time limit
   $output = '';
   $form['time']['phpbb2drupal_time_limit'] = array(
     '#type' => 'textfield',
@@ -125,9 +125,9 @@ function phpbb2drupal_admin_settings() {
     '#description' => t('How long, in seconds, will the migration take?'),
   );
   $form['time']['info'] = array(
-    '#value' => '<p>'. t('1200 = 20 minutes should be enough for most boards. It worked well for a board with 300,000 rows. Beware: if your site is cohosted and safe-mode is on, then this value will have no effect.') .'</p>',
+    '#value' => '<p>' . t('1200 = 20 minutes should be enough for most boards. It worked well for a board with 300,000 rows. Beware: if your site is cohosted and safe-mode is on, then this value will have no effect.') . '</p>',
   );
-  
+
   // USERS settings
   $form['users'] = array(
     '#type' => 'fieldset',
@@ -143,8 +143,8 @@ function phpbb2drupal_admin_settings() {
     '#autocomplete_path' => 'user/autocomplete',
     '#default_value' => variable_get('phpbb2drupal_admin_user', $drupal_admin->name ),
   );
-  
-    //Registration date format
+
+  //Registration date format
   $form['users']['phpbb2drupal_regdate_us_english'] = array(
     '#type' => 'checkbox',
     '#title' => t('Convert Registration Date'),
@@ -169,7 +169,7 @@ function phpbb2drupal_admin_settings() {
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
   );
-  $output = '<p>'. t('Select which <a href="@link">input format</a> should the imported messages be set:', array('@link' => url('admin/settings/filters'))) .'</p>';
+  $output = '<p>' . t('Select which <a href="@link">input format</a> should the imported messages be set:', array('@link' => url('admin/settings/filters'))) . '</p>';
   $form['input']['intro'] = array('#value' => $output);
   $output = '';
 
@@ -177,7 +177,7 @@ function phpbb2drupal_admin_settings() {
   $sql = 'SELECT format, name FROM {filter_formats}';
   $result = db_query($sql);
   while ($format = db_fetch_array($result)) {
-    $input_formats[$format['format']]= $format['name'];
+    $input_formats[$format['format']] = $format['name'];
   }
   $input_format = variable_get('phpbb2drupal_input_format', 0);
   $form['input']['phpbb2drupal_input_format'] = array(
@@ -188,9 +188,9 @@ function phpbb2drupal_admin_settings() {
   );
   if (!$input_format) {
     $ready_for_migration = 0;
-    $form['input']['#collapsed']= FALSE;
+    $form['input']['#collapsed'] = FALSE;
   }
-  $output .= '<p><em>'. t('This setting will be applied to all posts and private messages.') .'</em></p>';
+  $output .= '<p><em>' . t('This setting will be applied to all posts and private messages.') . '</em></p>';
   $form['input']['result'] = array('#value' => $output);
 
 
@@ -218,39 +218,39 @@ function phpbb2drupal_admin_settings() {
   $output = '';
   $result7 = _phpbb2drupal_check_module('bbcode');
   $output .= $result7['html'];
-  $link_input_format_enable = url('admin/settings/filters/'. $input_format);
-  $link_input_format_configure = url('admin/settings/filters/'. $input_format .'/configure');
-  if (variable_get('phpbb2drupal_bbcode', 0)) { 
+  $link_input_format_enable = url('admin/settings/filters/' . $input_format);
+  $link_input_format_configure = url('admin/settings/filters/' . $input_format . '/configure');
+  if (variable_get('phpbb2drupal_bbcode', 0)) {
     if ($result7['result'] == 0) {
       $ready_for_migration = 0;
-      $form['bbcode']['#collapsed']= FALSE;
+      $form['bbcode']['#collapsed'] = FALSE;
       $output .= '<p><span class="marker">';
-      $output .= t('<a href="http://drupal.org/project/bbcode" target="_blank">The bbcode module</a> is required to transform BBcode into HTML. 
+      $output .= t('<a href="http://drupal.org/project/bbcode" target="_blank">The bbcode module</a> is required to transform BBcode into HTML.
         You first need to <a href="@adminmodules">enable the bbcode module</a>', array('@adminmodules' => url('admin/modules')));
       $output .= '</span></p>';
     }
     $sql = 'SELECT COUNT(*) FROM {filters} WHERE module = \'bbcode\' AND format = %d';
     $result = db_query($sql, $input_format);
     if (!db_result($result)) {
-      $form['bbcode']['#collapsed']= FALSE;
-      $output .= '<p class="marker">'. t('You need to <a href="@formatenable">enable bbcode in the selected input format</a> <a href="@formatconfigure">THEN click on configure to see bbcode options</a>', array('@formatenable' => $link_input_format_enable, '@formatconfigure' => $link_input_format_configure)) .'</p>';
+      $form['bbcode']['#collapsed'] = FALSE;
+      $output .= '<p class="marker">' . t('You need to <a href="@formatenable">enable bbcode in the selected input format</a> <a href="@formatconfigure">THEN click on configure to see bbcode options</a>', array('@formatenable' => $link_input_format_enable, '@formatconfigure' => $link_input_format_configure)) . '</p>';
     }
-    $output .= '<p>'. t('For best results, <a href="@bbcodeconfig">all four BBcode configure options should be disabled</a>.', array('@bbcodeconfig' => url('admin/settings/filters/'. $input_format .'/configure'))) .'</p>';
-    
+    $output .= '<p>' . t('For best results, <a href="@bbcodeconfig">all four BBcode configure options should be disabled</a>.', array('@bbcodeconfig' => url('admin/settings/filters/' . $input_format . '/configure'))) . '</p>';
+
   }
   else {
     if ($result7['result'] == 0) {
-      $form['bbcode']['#collapsed']= FALSE;
-      $output .= '<p>'. t('<a href="http://drupal.org/project/bbcode" target="_blank">The bbcode module</a> is only recommanded. You may <a href="@adminmodules">enable the bbcode module</a> after having installed it.', array('@adminmodules' => url('admin/modules'))) .'</p>';
+      $form['bbcode']['#collapsed'] = FALSE;
+      $output .= '<p>' . t('<a href="http://drupal.org/project/bbcode" target="_blank">The bbcode module</a> is only recommanded. You may <a href="@adminmodules">enable the bbcode module</a> after having installed it.', array('@adminmodules' => url('admin/modules'))) . '</p>';
     }
     $output .= t('<p>Don\'t forget to <a href="@formatenable">enable bbcode in the selected input format</a> (admin > input formats > configure) and enable bbcode for the format selected for the imported posts.  <a href="@formatconfigure">Then click on configure to see bbcode options</a></p>
       <p>You may want to enable it for other input formats, too.</p>', array('@formatenable' => $link_input_format_enable, '@formatconfigure' => $link_input_format_configure));
   }
-  $output .= '<p><em>'. t('This setting will be applied to all posts, private messages and the users\' signature.') .'</em></p>';
+  $output .= '<p><em>' . t('This setting will be applied to all posts, private messages and the users\' signature.') . '</em></p>';
   $form['bbcode']['result'] = array('#value' => $output);
 
   //Attachments
-  $output ='';
+  $output = '';
   $form['attachments'] = array(
     '#type' => 'fieldset',
     '#title' => t('Attachments import'),
@@ -270,14 +270,14 @@ function phpbb2drupal_admin_settings() {
     $output .= $result['html'];
     if ($result['result'] != 1) {
       $ready_for_migration = 0;
-      $form['attachments']['#collapsed']= FALSE;
+      $form['attachments']['#collapsed'] = FALSE;
       $output .= '<span class="marker">';
       $output .= t('The comment_upload.module is not enabled. You can go to the <a href="http://drupal.org/node/37197" target="_blank">module Home Page</a> and download it. Then go to <a href="@adminmodules">admin/build/modules</a> to enable the module.', array('@adminmodules' => url('admin/build/modules')));
       $output .= '</span>';
       $form['attachments']['result'] = array('#value' => $output);
     }
   }
-  
+
   // Are we ready for migration?
   $form['migration'] = array(
     '#type' => 'fieldset',
@@ -287,52 +287,52 @@ function phpbb2drupal_admin_settings() {
   );
   variable_set('phpbb2drupal_ready', $ready_for_migration);
   if ($ready_for_migration) {
-    $output .= '<p>'. t('Check again all the settings above, and if everything is ok, <a href="@migratelink">you can now proceed with the migration</a>', array('@migratelink' => url('admin/phpbb2drupal/migrate'))) .'</p>';
+    $output .= '<p>' . t('Check again all the settings above, and if everything is ok, <a href="@migratelink">you can now proceed with the migration</a>', array('@migratelink' => url('admin/phpbb2drupal/migrate'))) . '</p>';
   }
   else {
-    $output = '<p class="marker">'. t('You are not ready for the migration yet. Check the settings above.') .'</p>';
+    $output = '<p class="marker">' . t('You are not ready for the migration yet. Check the settings above.') . '</p>';
   }
-  
+
   $form['migration']['info'] = array('#value' => $output);
-  return system_settings_form($form); 
-  
+  return system_settings_form($form);
+
 }
 
 /**
  * Callback admin/phpbb2drupal/postconfiguration
  */
 function phpbb2drupal_postconfiguration() {
-  $output = '<p>'. t('This page will help guide you set up the forums. Before continuing it may be best to have already:') .'</p>';
+  $output = '<p>' . t('This page will help guide you set up the forums. Before continuing it may be best to have already:') . '</p>';
   $output .= '<ul>';
-  $output .= '<li>'. t('Imported users, forums, topics and optionally polls using the phpbb2drupal Module') .'</li>';
-  $output .= '<li>'. t('Imported any additional data using add on modules if available.') .'</li>';
+  $output .= '<li>' . t('Imported users, forums, topics and optionally polls using the phpbb2drupal Module') . '</li>';
+  $output .= '<li>' . t('Imported any additional data using add on modules if available.') . '</li>';
   $output .= '</ul>';
   //User Set up
-  $output .= '<h2>'. t('User Settings') .'</h2>';  
-  $output .= '<p>'. t('Make sure your <a href="@usersettings">user settings</a> are correct. here you can enable or disable signature. In order to activate avatar/picture support, you need to enable pictures on this page and also:', array('@usersettings' => url('admin/user/settings'))) .'</p>';  
+  $output .= '<h2>' . t('User Settings') . '</h2>';
+  $output .= '<p>' . t('Make sure your <a href="@usersettings">user settings</a> are correct. here you can enable or disable signature. In order to activate avatar/picture support, you need to enable pictures on this page and also:', array('@usersettings' => url('admin/user/settings'))) . '</p>';
   $output .= '<ul>';
-  $output .= '<li>'. t('Tick the checkboxes to allow "User pictures in posts" and/or "User pictures in comments" on the <a href="@themeconfig">themes configuration</a> page.', array('@themeconfig' => url('admin/build/themes/settings'))) .'</li>';
-  $output .= '<li>'. t('Manually copy the avatars from the phpbb2/images/avatars/ directory to the @files directory.', array('@files' => file_directory_path(). '/pictures')) .'</li>';
+  $output .= '<li>' . t('Tick the checkboxes to allow "User pictures in posts" and/or "User pictures in comments" on the <a href="@themeconfig">themes configuration</a> page.', array('@themeconfig' => url('admin/build/themes/settings'))) . '</li>';
+  $output .= '<li>' . t('Manually copy the avatars from the phpbb2/images/avatars/ directory to the @files directory.', array('@files' => file_directory_path() . '/pictures')) . '</li>';
   $output .= '</ul>';
   // Forum Set up
-  $output .= '<h2>'. t('Forum Settings') .'</h2>';
-  $output .= '<p>'. t('If you imported polls, you need to allow polls to show in the forums. On <a href="@forumvocab">this page</a> tick the checkbox next to the "polls" content type to allow polls to display in forums. Addidtionally check any additional content types you want to allow in the forums.',
-      array('@forumvocab' => url('admin/content/taxonomy/edit/vocabulary/' .variable_get('forum_nav_vocabulary', 0)))) .'</p>';
-  $output .= '<p>'. t('If need be, set up the private forums as explained in the <a href="http://drupal.org/node/58969" target="_blank">documentation</a>.') .'</p>';
+  $output .= '<h2>' . t('Forum Settings') . '</h2>';
+  $output .= '<p>' . t('If you imported polls, you need to allow polls to show in the forums. On <a href="@forumvocab">this page</a> tick the checkbox next to the "polls" content type to allow polls to display in forums. Addidtionally check any additional content types you want to allow in the forums.',
+      array('@forumvocab' => url('admin/content/taxonomy/edit/vocabulary/' . variable_get('forum_nav_vocabulary', 0)))) . '</p>';
+  $output .= '<p>' . t('If need be, set up the private forums as explained in the <a href="http://drupal.org/node/58969" target="_blank">documentation</a>.') . '</p>';
 
   // Redirection from old URL:
-  $output .= '<h2>'. t('Redirection from phpBB2 forum URL to new Drupal forum URL') .'</h2>';
-  $output .= '<p>'. t('Enable the phpbb_redirect.module. This way, users accessing URLs from your old phpBB2 installation will be redirected to your new Drupal forum. (note that currently the module assumes that the phpbb forum was located in the forum/ subdirectory of your Drupal installation).') .'</p>';
+  $output .= '<h2>' . t('Redirection from phpBB2 forum URL to new Drupal forum URL') . '</h2>';
+  $output .= '<p>' . t('Enable the phpbb_redirect.module. This way, users accessing URLs from your old phpBB2 installation will be redirected to your new Drupal forum. (note that currently the module assumes that the phpbb forum was located in the forum/ subdirectory of your Drupal installation).') . '</p>';
 
   // BBcode
   $bbcode = variable_get('phpbb2drupal_bbcode', 0);
   if ($bbcode) {
-    $output .= '<h2>'. t('Remove BBcode module') .'</h2>';
-    $output .= '<p>'. t("The bbcode has been cleaned from the posts. You shouldn't need the bbcode module anymore. You can disable it.") .'</p>';
+    $output .= '<h2>' . t('Remove BBcode module') . '</h2>';
+    $output .= '<p>' . t("The bbcode has been cleaned from the posts. You shouldn't need the bbcode module anymore. You can disable it.") . '</p>';
   }
   else {
-    $output .= '<h2>'. t('Configure BBcode module') .'</h2>';
-    $output .= '<p>'. t('Most probably, there are many phpBB forum postings formatted in BBcode. During the import procedure, the BBcode has been cleaned so that it can work with the Drupal bbcode.module. Please install and configure the <a href="http://drupal.org/project/bbcode" target="_blank">BBcode module</a> so that the forum topics display properly. See the BBcode module documentation for details.') .'</p>';
+    $output .= '<h2>' . t('Configure BBcode module') . '</h2>';
+    $output .= '<p>' . t('Most probably, there are many phpBB forum postings formatted in BBcode. During the import procedure, the BBcode has been cleaned so that it can work with the Drupal bbcode.module. Please install and configure the <a href="http://drupal.org/project/bbcode" target="_blank">BBcode module</a> so that the forum topics display properly. See the BBcode module documentation for details.') . '</p>';
   }
 
   return $output;
@@ -372,8 +372,8 @@ function phpbb2drupal_main() {
   $output .= '</ol>';
 
   // process will die() if the link to the phpBB2 database is wrong:
-  $output .= '<p>'. t('If the phpBB2 data is in another data base, but you made a mistake while setting up the data base url, you may be unable to access the setting page due to some limitations of the core of Drupal. <a href="@reseturl">Click here to reset the database url</a>.',
-      array('@reseturl' => url('admin/phpbb2drupal/reset'))) .'</p>';
+  $output .= '<p>' . t('If the phpBB2 data is in another data base, but you made a mistake while setting up the data base url, you may be unable to access the setting page due to some limitations of the core of Drupal. <a href="@reseturl">Click here to reset the database url</a>.',
+      array('@reseturl' => url('admin/phpbb2drupal/reset'))) . '</p>';
 
   return $output;
-}
\ No newline at end of file
+}
diff -up -r phpbb2drupal/phpbb2privatemsg.install phpbb2drupal/phpbb2privatemsg.install
--- phpbb2drupal/phpbb2privatemsg.install	2009-05-16 21:01:56.000000000 -0500
+++ phpbb2drupal/phpbb2privatemsg.install	2011-03-29 18:31:47.000000000 -0500
@@ -22,4 +22,4 @@ function phpbb2privatemsg_install() {
 function phpbb2privatemsg_uninstall() {
   variable_del('phpbb2privatemsg_import_successful');
   drupal_uninstall_schema('phpbb2privatemsg');
-}
\ No newline at end of file
+}
diff -up -r phpbb2drupal/phpbb2privatemsg.module phpbb2drupal/phpbb2privatemsg.module
--- phpbb2drupal/phpbb2privatemsg.module	2009-10-03 12:35:02.000000000 -0500
+++ phpbb2drupal/phpbb2privatemsg.module	2011-03-29 18:31:47.000000000 -0500
@@ -11,13 +11,13 @@ function phpbb2privatemsg_menu() {
     'title' => 'phpBB to Privatemsg',
     'access callback' => 'user_access',
     'access arguments' => array('migrate phpBB'),
-    'page callback' => 'phpbb2privatemsg_main', 
+    'page callback' => 'phpbb2privatemsg_main',
   );
-    $items['admin/phpbb2privatemsg/cleanup'] = array(
+  $items['admin/phpbb2privatemsg/cleanup'] = array(
     'title' => 'Cleanup',
     'access callback' => 'user_access',
     'access arguments' => array('migrate phpBB'),
-    'page callback' => 'phpbb2privatemsg_cleanup', 
+    'page callback' => 'phpbb2privatemsg_cleanup',
     'type' => MENU_CALLBACK,
   );
   return $items;
@@ -41,30 +41,30 @@ function phpbb2privatemsg_main() {
   $output .= '</p>';
 
   if (!variable_get('phpbb2drupal_ready', 0)) {
-    return '<p>'. t('the phpBB2Drupal settings. Please <a href="@settings">complete the setup first</a>', array('@settings' => url('admin/settings/phpbb2drupal'))) .'</p>';
+    return '<p>' . t('the phpBB2Drupal settings. Please <a href="@settings">complete the setup first</a>', array('@settings' => url('admin/settings/phpbb2drupal'))) . '</p>';
   }
-  if (variable_get('phpbb2privatemsg_import_successful', 0) == 1) { 
+  if (variable_get('phpbb2privatemsg_import_successful', 0) == 1) {
     return t('Private Messages have already been imported. You can now <a href="@cleanup">clean up</a> any variables set by this module and deactivate/uninstall it.', array('@cleanup' => url('admin/phpbb2privatemsg/cleanup')));
   }
 
   $pre = variable_get('phpbb2drupal_table_prefix', 'phpbb_');
-  $tables = array($pre .'privmsgs', $pre .'privmsgs_to');
+  $tables = array($pre . 'privmsgs', $pre . 'privmsgs_to');
   $result = _phpbb2drupal_check_tables($tables, 'phpbb', 0);
   $output .= $result['html'];
-	  
+
   if ($result['result'] != 1) {
     $output .= '<p class="marker">';
     $output .= t('Please use the correct database settings!');
     $output .= '</p>';
   }
-  else{
+  else {
     $output .= drupal_get_form('phpbb2privatemsg_migrate_form');
   }
   return $output;
 }
 
 function phpbb2privatemsg_migrate_form() {
-  _phpbb2drupal_db_connect() ;
+  _phpbb2drupal_db_connect();
   // Causes problems with form api redirect
   //ini_set('display_errors', TRUE);
 
@@ -86,8 +86,8 @@ function phpbb2privatemsg_migrate_form()
 }
 
 function phpbb2privatemsg_migrate_form_submit($form, $form_state) {
-  if (isset($form_state['values']['import'])) {  
-      phpbb2privatemsg_import();
+  if (isset($form_state['values']['import'])) {
+    phpbb2privatemsg_import();
   }
 }
 
@@ -103,32 +103,32 @@ function phpbb2privatemsg_import() {
   db_set_active('phpbb');
   $query = "SELECT * FROM %sprivmsgs ORDER BY msg_id ASC";
   $messages = db_query($query, $pre);
-  
+
   db_set_active('default');
-  while ($pm = db_fetch_object($messages)) {    
+  while ($pm = db_fetch_object($messages)) {
     $from = db_result(db_query('SELECT uid FROM {phpbb2drupal_temp_user} WHERE user_id = %d', $pm->author_id));
     // don't import private messages from or to users who are not imported.
     if ($from) {
       // remove the bbcode_uid from post_text
-      if(!empty($pm->bbcode_uid)) {
+      if (!empty($pm->bbcode_uid)) {
         $pm->message_text = preg_replace("/:$pm->bbcode_uid/", '', $pm->message_text);
       }
       $pm->message_text = _phpbb2drupal_strip_bbcode($pm->message_text);
       $pm->message_text = _phpbb2drupal_text_sanitise($pm->message_text);
       $pm->message_text = _phpbb2drupal_replace_links($pm->message_text);
       $pm->message_subject = _phpbb2drupal_text_sanitise($pm->message_subject);
-      
-        // Borrow and adapt  code from patch to upgrade privatemsg module to Drupal 6 (http://drupal.org/node/202348#comment-700061).
-        $message = array(
+
+      // Borrow and adapt  code from patch to upgrade privatemsg module to Drupal 6 (http://drupal.org/node/202348#comment-700061).
+      $message = array(
           'author' => $from,
           'subject' => substr($pm->message_subject, 0, 64),
           'body' => $pm->message_text,
           'timestamp' => $pm->message_time,
         );
 
-	    //save message if no duplicates
-	    $dupe = db_result(db_query('SELECT COUNT(*) FROM {pm_message} WHERE author = %d AND timestamp = %d', $message['author'], $message['timestamp']));
-	    if (!($dupe)) {
+      //save message if no duplicates
+      $dupe = db_result(db_query('SELECT COUNT(*) FROM {pm_message} WHERE author = %d AND timestamp = %d', $message['author'], $message['timestamp']));
+      if (!($dupe)) {
 
         $result = drupal_write_record('pm_message', $message);
         $message['mid'] = db_last_insert_id('pm_message', 'mid');
@@ -154,11 +154,11 @@ function phpbb2privatemsg_import() {
           $message['uid'] = db_result(db_query('SELECT uid FROM {phpbb2drupal_temp_user} WHERE user_id = %d', $index->user_id));
           $message['is_new'] = $index->pm_unread;
           $message['deleted'] = $index->pm_deleted;
-          
+
           //Save to the index.
           $save = drupal_write_record('pm_index', $message);
         }
-	    }
+      }
     }
   }
   variable_set('phpbb2privatemsg_import_successful', 1);
@@ -168,6 +168,6 @@ function phpbb2privatemsg_import() {
 function phpbb2privatemsg_cleanup() {
 
   variable_del('phpbb2privatemsg_import_successful');
-  return '<p>'. t('phpbb2privatemsg settings removed.') .'</p>';
+  return '<p>' . t('phpbb2privatemsg settings removed.') . '</p>';
 
-}
\ No newline at end of file
+}
diff -up -r phpbb2drupal/phpbb_redirect.module phpbb2drupal/phpbb_redirect.module
--- phpbb2drupal/phpbb_redirect.module	2008-04-11 11:35:21.000000000 -0500
+++ phpbb2drupal/phpbb_redirect.module	2011-03-29 18:31:47.000000000 -0500
@@ -14,12 +14,12 @@ function phpbb_redirect_help($path, $arg
   $output = '';
   switch ($path) {
     case 'admin/help#phpbb_redirect':
-      $output = '<p>'. t('Redirects links to your old phpBB installation to the new Drupal forum.') .'</p>';
-      $output .= '<p>'. t('This module requires <a href="@cleanurls">clean urls</a> to be active.', array('@cleanurls' => url('admin/settings/clean-urls'))) .'</p>';
-      $output .= '<p>'. t('phpBB_Redirect assumes that the old forum was located in the /forum folder. If that is not true, redirection will not work.') .'</p>';
-      $output .= '<p>'. t('This can be worked around by either adding a redirect in the .htacceass file on apache installations or by manually editing the module.') .'</p>';
-      $output .= '<p>'. t('If you choose to edit the module, all you need to do is change "forum/viewtopic.php" and "forum/viewtopic.php" in the "phpbb_redirect_menu" function. Just replace the "forum" bit with the real old location. e.g. if the old forums were located in the phpbb folder, change these paths to "phpbb/viewtopic.php" and "phpbb/viewtopic.php".') .'</p>';
-	  break;
+      $output = '<p>' . t('Redirects links to your old phpBB installation to the new Drupal forum.') . '</p>';
+      $output .= '<p>' . t('This module requires <a href="@cleanurls">clean urls</a> to be active.', array('@cleanurls' => url('admin/settings/clean-urls'))) . '</p>';
+      $output .= '<p>' . t('phpBB_Redirect assumes that the old forum was located in the /forum folder. If that is not true, redirection will not work.') . '</p>';
+      $output .= '<p>' . t('This can be worked around by either adding a redirect in the .htacceass file on apache installations or by manually editing the module.') . '</p>';
+      $output .= '<p>' . t('If you choose to edit the module, all you need to do is change "forum/viewtopic.php" and "forum/viewtopic.php" in the "phpbb_redirect_menu" function. Just replace the "forum" bit with the real old location. e.g. if the old forums were located in the phpbb folder, change these paths to "phpbb/viewtopic.php" and "phpbb/viewtopic.php".') . '</p>';
+      break;
   }
   return $output;
 }
@@ -58,7 +58,7 @@ function phpbb_redirect_viewtopic() {
     header('HTTP/1.1 301 Moved Permanently');
     drupal_goto("node/$nid");
 
-  } 
+  }
   else if (isset($_GET['p'])) {
     $post = explode('#', $_GET['p']);
     if (is_numeric($post[0])) {
@@ -67,12 +67,12 @@ function phpbb_redirect_viewtopic() {
     else {
       drupal_goto('/');
     }
-    
+
     $cid = db_result(db_query('SELECT cid FROM {phpbb2drupal_temp_post} WHERE post_id = %d', $post_id));
     $nid = db_result(db_query('SELECT nid FROM {comments} WHERE cid = %d', $cid));
-    
+
     $node = node_load($nid);
-    $mode =_comment_get_display_setting('mode', $node);
+    $mode = _comment_get_display_setting('mode', $node);
 
     $flat = in_array($mode, array(COMMENT_MODE_FLAT_COLLAPSED, COMMENT_MODE_FLAT_EXPANDED));
     if ($flat) {
@@ -80,12 +80,12 @@ function phpbb_redirect_viewtopic() {
       $comment_count = db_result(db_query('SELECT COUNT(c.cid) FROM {comments} c WHERE c.nid = %d AND c.status = %d AND c.cid < %d', $nid, COMMENT_PUBLISHED, $cid));
       $page_number = floor($comment_count / $comments_per_page);
     }
-    
+
     if (empty($page_number)) {
       $pagenum = NULL;
     }
     else {
-      $pagenum = 'page='. intval($page_number);
+      $pagenum = 'page=' . intval($page_number);
     }
 
     header('HTTP/1.1 301 Moved Permanently');
@@ -100,7 +100,7 @@ function phpbb_redirect_viewforum() {
     $tid = db_result(db_query('SELECT tid FROM {phpbb2drupal_temp_forum} WHERE forum_id = %d', $forum_id));
 
     header('HTTP/1.1 301 Moved Permanently');
-    drupal_goto("forum/$tid");    
+    drupal_goto("forum/$tid");
   }
 }
 
